
/* std::filebuf::setbuf(char*, long) */

filebuf * __thiscall std::filebuf::setbuf(filebuf *this,char *param_1,long param_2)

{
  char cVar1;
  
  cVar1 = __basic_file<char>::is_open((__basic_file<char> *)(this + 0x68));
  if (cVar1 == '\0') {
    if (param_1 == (char *)0x0 && param_2 == 0) {
      *(undefined8 *)(this + 0xa0) = 1;
    }
    else if ((param_1 != (char *)0x0) && (0 < param_2)) {
      *(char **)(this + 0x98) = param_1;
      *(long *)(this + 0xa0) = param_2;
      return this;
    }
  }
  return this;
}



long FUN_00301ad0(long param_1,long param_2,long param_3)

{
  char cVar1;
  
  cVar1 = FUN_002db150(param_1 + 0x68);
  if (cVar1 == '\0') {
    if (param_2 == 0 && param_3 == 0) {
      *(undefined8 *)(param_1 + 0xa0) = 1;
    }
    else if ((param_2 != 0) && (0 < param_3)) {
      *(long *)(param_1 + 0x98) = param_2;
      *(long *)(param_1 + 0xa0) = param_3;
      return param_1;
    }
  }
  return param_1;
}


PUSH R12
MOV R12,RDX
PUSH RBP
MOV RBP,RSI
PUSH RBX
MOV RBX,RDI
ADD RDI,0x68
CALL 0x002db150
TEST AL,AL
JNZ 0x00301afd
MOV RAX,RBP
OR RAX,R12
JNZ 0x00301b08
MOV qword ptr [RBX + 0xa0],0x1
MOV RAX,RBX
POP RBX
POP RBP
POP R12
RET
TEST RBP,RBP
JZ 0x00301afd
TEST R12,R12
JLE 0x00301afd
MOV qword ptr [RBX + 0x98],RBP
MOV RAX,RBX
MOV qword ptr [RBX + 0xa0],R12
POP RBX
POP RBP
POP R12
RET
(translation_unit "long FUN_00301ad0(long param_1,long param_2,long param_3)\n\n{\n  char cVar1;\n  \n  cVar1 = FUN_002db150(param_1 + 0x68);\n  if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }\n  return param_1;\n}\n\n" (function_definition "long FUN_00301ad0(long param_1,long param_2,long param_3)\n\n{\n  char cVar1;\n  \n  cVar1 = FUN_002db150(param_1 + 0x68);\n  if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }\n  return param_1;\n}" (sized_type_specifier "long" long) (function_declarator "FUN_00301ad0(long param_1,long param_2,long param_3)" identifier (parameter_list "(long param_1,long param_2,long param_3)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  char cVar1;\n  \n  cVar1 = FUN_002db150(param_1 + 0x68);\n  if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }\n  return param_1;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (expression_statement "cVar1 = FUN_002db150(param_1 + 0x68);" (assignment_expression "cVar1 = FUN_002db150(param_1 + 0x68)" identifier = (call_expression "FUN_002db150(param_1 + 0x68)" identifier (argument_list "(param_1 + 0x68)" ( (binary_expression "param_1 + 0x68" identifier + number_literal) )))) ;) (if_statement "if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }" if (parenthesized_expression "(cVar1 == '\0')" ( (binary_expression "cVar1 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }" { (if_statement "if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" if (parenthesized_expression "(param_2 == 0 && param_3 == 0)" ( (binary_expression "param_2 == 0 && param_3 == 0" (binary_expression "param_2 == 0" identifier == number_literal) && (binary_expression "param_3 == 0" identifier == number_literal)) )) (compound_statement "{\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }" { (expression_statement "*(undefined8 *)(param_1 + 0xa0) = 1;" (assignment_expression "*(undefined8 *)(param_1 + 0xa0) = 1" (pointer_expression "*(undefined8 *)(param_1 + 0xa0)" * (cast_expression "(undefined8 *)(param_1 + 0xa0)" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0xa0)" ( (binary_expression "param_1 + 0xa0" identifier + number_literal) )))) = number_literal) ;) }) (else_clause "else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" else (if_statement "if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" if (parenthesized_expression "((param_2 != 0) && (0 < param_3))" ( (binary_expression "(param_2 != 0) && (0 < param_3)" (parenthesized_expression "(param_2 != 0)" ( (binary_expression "param_2 != 0" identifier != number_literal) )) && (parenthesized_expression "(0 < param_3)" ( (binary_expression "0 < param_3" number_literal < identifier) ))) )) (compound_statement "{\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" { (expression_statement "*(long *)(param_1 + 0x98) = param_2;" (assignment_expression "*(long *)(param_1 + 0x98) = param_2" (pointer_expression "*(long *)(param_1 + 0x98)" * (cast_expression "(long *)(param_1 + 0x98)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x98)" ( (binary_expression "param_1 + 0x98" identifier + number_literal) )))) = identifier) ;) (expression_statement "*(long *)(param_1 + 0xa0) = param_3;" (assignment_expression "*(long *)(param_1 + 0xa0) = param_3" (pointer_expression "*(long *)(param_1 + 0xa0)" * (cast_expression "(long *)(param_1 + 0xa0)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0xa0)" ( (binary_expression "param_1 + 0xa0" identifier + number_literal) )))) = identifier) ;) (return_statement "return param_1;" return identifier ;) })))) })) (return_statement "return param_1;" return identifier ;) })))
(translation_unit "/* std::filebuf::setbuf(char*, long) */\n\nfilebuf * __thiscall std::filebuf::setbuf(filebuf *this,char *param_1,long param_2)\n\n{\n  char cVar1;\n  \n  cVar1 = __basic_file<char>::is_open((__basic_file<char> *)(this + 0x68));\n  if (cVar1 == '\0') {\n    if (param_1 == (char *)0x0 && param_2 == 0) {\n      *(undefined8 *)(this + 0xa0) = 1;\n    }\n    else if ((param_1 != (char *)0x0) && (0 < param_2)) {\n      *(char **)(this + 0x98) = param_1;\n      *(long *)(this + 0xa0) = param_2;\n      return this;\n    }\n  }\n  return this;\n}\n\n" comment (ERROR "filebuf * __thiscall std::filebuf::setbuf(filebuf *this,char *param_1,long param_2)" (binary_expression "filebuf * __thiscall std::filebuf::setbuf(filebuf *this" (binary_expression "filebuf * __thiscall" identifier * identifier) (ERROR "std::filebuf::setbuf(filebuf" identifier : : identifier : : identifier ( identifier) * identifier) , primitive_type (pointer_declarator "*param_1" * identifier) , identifier identifier )) (compound_statement "{\n  char cVar1;\n  \n  cVar1 = __basic_file<char>::is_open((__basic_file<char> *)(this + 0x68));\n  if (cVar1 == '\0') {\n    if (param_1 == (char *)0x0 && param_2 == 0) {\n      *(undefined8 *)(this + 0xa0) = 1;\n    }\n    else if ((param_1 != (char *)0x0) && (0 < param_2)) {\n      *(char **)(this + 0x98) = param_1;\n      *(long *)(this + 0xa0) = param_2;\n      return this;\n    }\n  }\n  return this;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (expression_statement "cVar1 = __basic_file<char>::is_open((__basic_file<char> *)(this + 0x68));" (assignment_expression "cVar1 = __basic_file<char>::is_open((__basic_file<char> *)(this + 0x68))" identifier = (binary_expression "__basic_file<char>::is_open((__basic_file<char> *)(this + 0x68))" (binary_expression "__basic_file<char" identifier < identifier) > (ERROR "::" : :) (call_expression "is_open((__basic_file<char> *)(this + 0x68))" identifier (argument_list "((__basic_file<char> *)(this + 0x68))" ( (call_expression "(__basic_file<char> *)(this + 0x68)" (parenthesized_expression "(__basic_file<char> *)" ( (binary_expression "__basic_file<char> *" (binary_expression "__basic_file<char" identifier < identifier) > (pointer_expression "*" * identifier)) )) (argument_list "(this + 0x68)" ( (binary_expression "this + 0x68" identifier + number_literal) ))) ))))) ;) (if_statement "if (cVar1 == '\0') {\n    if (param_1 == (char *)0x0 && param_2 == 0) {\n      *(undefined8 *)(this + 0xa0) = 1;\n    }\n    else if ((param_1 != (char *)0x0) && (0 < param_2)) {\n      *(char **)(this + 0x98) = param_1;\n      *(long *)(this + 0xa0) = param_2;\n      return this;\n    }\n  }" if (parenthesized_expression "(cVar1 == '\0')" ( (binary_expression "cVar1 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    if (param_1 == (char *)0x0 && param_2 == 0) {\n      *(undefined8 *)(this + 0xa0) = 1;\n    }\n    else if ((param_1 != (char *)0x0) && (0 < param_2)) {\n      *(char **)(this + 0x98) = param_1;\n      *(long *)(this + 0xa0) = param_2;\n      return this;\n    }\n  }" { (if_statement "if (param_1 == (char *)0x0 && param_2 == 0) {\n      *(undefined8 *)(this + 0xa0) = 1;\n    }\n    else if ((param_1 != (char *)0x0) && (0 < param_2)) {\n      *(char **)(this + 0x98) = param_1;\n      *(long *)(this + 0xa0) = param_2;\n      return this;\n    }" if (parenthesized_expression "(param_1 == (char *)0x0 && param_2 == 0)" ( (binary_expression "param_1 == (char *)0x0 && param_2 == 0" (binary_expression "param_1 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) && (binary_expression "param_2 == 0" identifier == number_literal)) )) (compound_statement "{\n      *(undefined8 *)(this + 0xa0) = 1;\n    }" { (expression_statement "*(undefined8 *)(this + 0xa0) = 1;" (assignment_expression "*(undefined8 *)(this + 0xa0) = 1" (pointer_expression "*(undefined8 *)(this + 0xa0)" * (cast_expression "(undefined8 *)(this + 0xa0)" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(this + 0xa0)" ( (binary_expression "this + 0xa0" identifier + number_literal) )))) = number_literal) ;) }) (else_clause "else if ((param_1 != (char *)0x0) && (0 < param_2)) {\n      *(char **)(this + 0x98) = param_1;\n      *(long *)(this + 0xa0) = param_2;\n      return this;\n    }" else (if_statement "if ((param_1 != (char *)0x0) && (0 < param_2)) {\n      *(char **)(this + 0x98) = param_1;\n      *(long *)(this + 0xa0) = param_2;\n      return this;\n    }" if (parenthesized_expression "((param_1 != (char *)0x0) && (0 < param_2))" ( (binary_expression "(param_1 != (char *)0x0) && (0 < param_2)" (parenthesized_expression "(param_1 != (char *)0x0)" ( (binary_expression "param_1 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(0 < param_2)" ( (binary_expression "0 < param_2" number_literal < identifier) ))) )) (compound_statement "{\n      *(char **)(this + 0x98) = param_1;\n      *(long *)(this + 0xa0) = param_2;\n      return this;\n    }" { (expression_statement "*(char **)(this + 0x98) = param_1;" (assignment_expression "*(char **)(this + 0x98) = param_1" (pointer_expression "*(char **)(this + 0x98)" * (cast_expression "(char **)(this + 0x98)" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(this + 0x98)" ( (binary_expression "this + 0x98" identifier + number_literal) )))) = identifier) ;) (expression_statement "*(long *)(this + 0xa0) = param_2;" (assignment_expression "*(long *)(this + 0xa0) = param_2" (pointer_expression "*(long *)(this + 0xa0)" * (cast_expression "(long *)(this + 0xa0)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(this + 0xa0)" ( (binary_expression "this + 0xa0" identifier + number_literal) )))) = identifier) ;) (return_statement "return this;" return identifier ;) })))) })) (return_statement "return this;" return identifier ;) }))
(translation_unit "long FUN_00301ad0(long param_1,long param_2,long param_3)\n\n{\n  char cVar1;\n  \n  cVar1 = FUN_002db150(param_1 + 0x68);\n  if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }\n  return param_1;\n}\n\n" (function_definition "long FUN_00301ad0(long param_1,long param_2,long param_3)\n\n{\n  char cVar1;\n  \n  cVar1 = FUN_002db150(param_1 + 0x68);\n  if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }\n  return param_1;\n}" (sized_type_specifier "long" long) (function_declarator "FUN_00301ad0(long param_1,long param_2,long param_3)" identifier (parameter_list "(long param_1,long param_2,long param_3)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  char cVar1;\n  \n  cVar1 = FUN_002db150(param_1 + 0x68);\n  if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }\n  return param_1;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (expression_statement "cVar1 = FUN_002db150(param_1 + 0x68);" (assignment_expression "cVar1 = FUN_002db150(param_1 + 0x68)" identifier = (call_expression "FUN_002db150(param_1 + 0x68)" identifier (argument_list "(param_1 + 0x68)" ( (binary_expression "param_1 + 0x68" identifier + number_literal) )))) ;) (if_statement "if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }" if (parenthesized_expression "(cVar1 == '\0')" ( (binary_expression "cVar1 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }" { (if_statement "if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" if (parenthesized_expression "(param_2 == 0 && param_3 == 0)" ( (binary_expression "param_2 == 0 && param_3 == 0" (binary_expression "param_2 == 0" identifier == number_literal) && (binary_expression "param_3 == 0" identifier == number_literal)) )) (compound_statement "{\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }" { (expression_statement "*(undefined8 *)(param_1 + 0xa0) = 1;" (assignment_expression "*(undefined8 *)(param_1 + 0xa0) = 1" (pointer_expression "*(undefined8 *)(param_1 + 0xa0)" * (cast_expression "(undefined8 *)(param_1 + 0xa0)" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0xa0)" ( (binary_expression "param_1 + 0xa0" identifier + number_literal) )))) = number_literal) ;) }) (else_clause "else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" else (if_statement "if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" if (parenthesized_expression "((param_2 != 0) && (0 < param_3))" ( (binary_expression "(param_2 != 0) && (0 < param_3)" (parenthesized_expression "(param_2 != 0)" ( (binary_expression "param_2 != 0" identifier != number_literal) )) && (parenthesized_expression "(0 < param_3)" ( (binary_expression "0 < param_3" number_literal < identifier) ))) )) (compound_statement "{\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" { (expression_statement "*(long *)(param_1 + 0x98) = param_2;" (assignment_expression "*(long *)(param_1 + 0x98) = param_2" (pointer_expression "*(long *)(param_1 + 0x98)" * (cast_expression "(long *)(param_1 + 0x98)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x98)" ( (binary_expression "param_1 + 0x98" identifier + number_literal) )))) = identifier) ;) (expression_statement "*(long *)(param_1 + 0xa0) = param_3;" (assignment_expression "*(long *)(param_1 + 0xa0) = param_3" (pointer_expression "*(long *)(param_1 + 0xa0)" * (cast_expression "(long *)(param_1 + 0xa0)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0xa0)" ( (binary_expression "param_1 + 0xa0" identifier + number_literal) )))) = identifier) ;) (return_statement "return param_1;" return identifier ;) })))) })) (return_statement "return param_1;" return identifier ;) })))
(translation_unit (function_definition (sized_type_specifier long) (function_declarator IDENT (parameter_list ( (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (char_literal ' escape_sequence ')) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT == LIT) && (binary_expression IDENT == LIT)) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = LIT) ;) }) (else_clause else (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != LIT) )) && (parenthesized_expression ( (binary_expression LIT < IDENT) ))) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = IDENT) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = IDENT) ;) (return_statement return IDENT ;) })))) })) (return_statement return IDENT ;) })))
(function_definition "long FUN_00301ad0(long param_1,long param_2,long param_3)\n\n{\n  char cVar1;\n  \n  cVar1 = FUN_002db150(param_1 + 0x68);\n  if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }\n  return param_1;\n}" (sized_type_specifier "long" (long "long")) (function_declarator "FUN_00301ad0(long param_1,long param_2,long param_3)" (identifier "FUN_00301ad0") (parameter_list "(long param_1,long param_2,long param_3)" (( "(") (parameter_declaration "long param_1" (sized_type_specifier "long" (long "long")) (identifier "param_1")) (, ",") (parameter_declaration "long param_2" (sized_type_specifier "long" (long "long")) (identifier "param_2")) (, ",") (parameter_declaration "long param_3" (sized_type_specifier "long" (long "long")) (identifier "param_3")) () ")"))) (compound_statement "{\n  char cVar1;\n  \n  cVar1 = FUN_002db150(param_1 + 0x68);\n  if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }\n  return param_1;\n}" ({ "{") (declaration "char cVar1;" (primitive_type "char") (identifier "cVar1") (; ";")) (expression_statement "cVar1 = FUN_002db150(param_1 + 0x68);" (assignment_expression "cVar1 = FUN_002db150(param_1 + 0x68)" (identifier "cVar1") (= "=") (call_expression "FUN_002db150(param_1 + 0x68)" (identifier "FUN_002db150") (argument_list "(param_1 + 0x68)" (( "(") (binary_expression "param_1 + 0x68" (identifier "param_1") (+ "+") (number_literal "0x68")) () ")")))) (; ";")) (if_statement "if (cVar1 == '\0') {\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }" (if "if") (parenthesized_expression "(cVar1 == '\0')" (( "(") (binary_expression "cVar1 == '\0'" (identifier "cVar1") (== "==") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n    if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }\n  }" ({ "{") (if_statement "if (param_2 == 0 && param_3 == 0) {\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }\n    else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" (if "if") (parenthesized_expression "(param_2 == 0 && param_3 == 0)" (( "(") (binary_expression "param_2 == 0 && param_3 == 0" (binary_expression "param_2 == 0" (identifier "param_2") (== "==") (number_literal "0")) (&& "&&") (binary_expression "param_3 == 0" (identifier "param_3") (== "==") (number_literal "0"))) () ")")) (compound_statement "{\n      *(undefined8 *)(param_1 + 0xa0) = 1;\n    }" ({ "{") (expression_statement "*(undefined8 *)(param_1 + 0xa0) = 1;" (assignment_expression "*(undefined8 *)(param_1 + 0xa0) = 1" (pointer_expression "*(undefined8 *)(param_1 + 0xa0)" (* "*") (cast_expression "(undefined8 *)(param_1 + 0xa0)" (( "(") (type_descriptor "undefined8 *" (type_identifier "undefined8") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0xa0)" (( "(") (binary_expression "param_1 + 0xa0" (identifier "param_1") (+ "+") (number_literal "0xa0")) () ")")))) (= "=") (number_literal "1")) (; ";")) (} "}")) (else_clause "else if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" (else "else") (if_statement "if ((param_2 != 0) && (0 < param_3)) {\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" (if "if") (parenthesized_expression "((param_2 != 0) && (0 < param_3))" (( "(") (binary_expression "(param_2 != 0) && (0 < param_3)" (parenthesized_expression "(param_2 != 0)" (( "(") (binary_expression "param_2 != 0" (identifier "param_2") (!= "!=") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(0 < param_3)" (( "(") (binary_expression "0 < param_3" (number_literal "0") (< "<") (identifier "param_3")) () ")"))) () ")")) (compound_statement "{\n      *(long *)(param_1 + 0x98) = param_2;\n      *(long *)(param_1 + 0xa0) = param_3;\n      return param_1;\n    }" ({ "{") (expression_statement "*(long *)(param_1 + 0x98) = param_2;" (assignment_expression "*(long *)(param_1 + 0x98) = param_2" (pointer_expression "*(long *)(param_1 + 0x98)" (* "*") (cast_expression "(long *)(param_1 + 0x98)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x98)" (( "(") (binary_expression "param_1 + 0x98" (identifier "param_1") (+ "+") (number_literal "0x98")) () ")")))) (= "=") (identifier "param_2")) (; ";")) (expression_statement "*(long *)(param_1 + 0xa0) = param_3;" (assignment_expression "*(long *)(param_1 + 0xa0) = param_3" (pointer_expression "*(long *)(param_1 + 0xa0)" (* "*") (cast_expression "(long *)(param_1 + 0xa0)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0xa0)" (( "(") (binary_expression "param_1 + 0xa0" (identifier "param_1") (+ "+") (number_literal "0xa0")) () ")")))) (= "=") (identifier "param_3")) (; ";")) (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}"))))) (} "}"))) (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}")))

/* std::filebuf::setbuf(char*, long) */

filebuf * __thiscall std::filebuf::setbuf(filebuf *var_4,char *var_6,long var_7)

{
  char var_5;
  
  var_5 = var_1<var_2>::var_3((var_1<var_2> *)(var_4 + 0x68));
  if (var_5 == '\0') {
    if (var_6 == (char *)0x0 && var_7 == 0) {
      *(type_1 *)(var_4 + 0xa0) = 1;
    }
    else if ((var_6 != (char *)0x0) && (0 < var_7)) {
      *(char **)(var_4 + 0x98) = var_6;
      *(long *)(var_4 + 0xa0) = var_7;
      return var_4;
    }
  }
  return var_4;
}


(translation_unit (function_definition type: (sized_type_specifier) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (sized_type_specifier) declarator: (identifier)) (parameter_declaration type: (sized_type_specifier) declarator: (identifier)) (parameter_declaration type: (sized_type_specifier) declarator: (identifier)))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (char_literal (escape_sequence)))) consequence: (compound_statement (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (number_literal)) right: (binary_expression left: (identifier) right: (number_literal)))) consequence: (compound_statement (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) right: (number_literal)))) alternative: (else_clause (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) right: (parenthesized_expression (binary_expression left: (number_literal) right: (identifier))))) consequence: (compound_statement (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (sized_type_specifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) right: (identifier))) (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (sized_type_specifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) right: (identifier))) (return_statement (identifier)))))))) (return_statement (identifier)))))

long MASKED(long param_1,long param_2,long param_3)

{
  char cVar1;
  
  cVar1 = FUN_002db150(param_1 + 0x68);
  if (cVar1 == '\0') {
    if (param_2 == 0 && param_3 == 0) {
      *(undefined8 *)(param_1 + 0xa0) = 1;
    }
    else if ((param_2 != 0) && (0 < param_3)) {
      *(long *)(param_1 + 0x98) = param_2;
      *(long *)(param_1 + 0xa0) = param_3;
      return param_1;
    }
  }
  return param_1;
}

