
/* std::__basic_file<char>::sys_open(int, std::_Ios_Openmode) */

__basic_file<char> * __thiscall
std::__basic_file<char>::sys_open(__basic_file<char> *this,int param_1,_Ios_Openmode param_2)

{
  char cVar1;
  char *__modes;
  FILE *__stream;
  
  __modes = (char *)::(anonymous_namespace)::fopen_mode(param_2);
  if ((__modes != (char *)0x0) && (cVar1 = is_open(this), cVar1 == '\0')) {
    __stream = fdopen(param_1,__modes);
    *(FILE **)this = __stream;
    if (__stream != (FILE *)0x0) {
      this[8] = (__basic_file<char>)0x1;
      if (param_1 != 0) {
        return this;
      }
      setvbuf(__stream,(char *)0x0,2,0);
      return this;
    }
  }
  return (__basic_file<char> *)0x0;
}



undefined8 * FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)

{
  char cVar1;
  char *__modes;
  FILE *__stream;
  
  __modes = (char *)FUN_002770b0(param_3);
  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {
    __stream = fdopen(param_2,__modes);
    *param_1 = __stream;
    if (__stream != (FILE *)0x0) {
      *(undefined1 *)(param_1 + 1) = 1;
      if (param_2 != 0) {
        return param_1;
      }
      setvbuf(__stream,(char *)0x0,2,0);
      return param_1;
    }
  }
  return (undefined8 *)0x0;
}


PUSH R12
PUSH RBP
PUSH RBX
MOV RBX,RDI
MOV EDI,EDX
CALL 0x002770b0
TEST RAX,RAX
JZ 0x00277310
MOV RDI,RBX
MOV R12D,ESI
MOV RBP,RAX
CALL 0x00277210
TEST AL,AL
JNZ 0x00277310
MOV RSI,RBP
MOV EDI,R12D
CALL 0x0013e5a0
MOV qword ptr [RBX],RAX
TEST RAX,RAX
JZ 0x00277310
MOV byte ptr [RBX + 0x8],0x1
TEST R12D,R12D
JNZ 0x00277312
XOR ECX,ECX
MOV EDX,0x2
XOR ESI,ESI
MOV RDI,RAX
CALL 0x0013e280
MOV RAX,RBX
POP RBX
POP RBP
POP R12
RET
XOR EBX,EBX
MOV RAX,RBX
POP RBX
POP RBP
POP R12
RET
(translation_unit "undefined8 * FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)\n\n{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)FUN_002770b0(param_3);\n  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }\n  return (undefined8 *)0x0;\n}\n\n" (function_definition "undefined8 * FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)\n\n{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)FUN_002770b0(param_3);\n  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }\n  return (undefined8 *)0x0;\n}" type_identifier (pointer_declarator "* FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)" * (function_declarator "FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)" identifier (parameter_list "(undefined8 *param_1,int param_2,undefined4 param_3)" ( (parameter_declaration "undefined8 *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "int param_2" primitive_type identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) )))) (compound_statement "{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)FUN_002770b0(param_3);\n  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }\n  return (undefined8 *)0x0;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "char *__modes;" primitive_type (pointer_declarator "*__modes" * identifier) ;) (declaration "FILE *__stream;" type_identifier (pointer_declarator "*__stream" * identifier) ;) (expression_statement "__modes = (char *)FUN_002770b0(param_3);" (assignment_expression "__modes = (char *)FUN_002770b0(param_3)" identifier = (cast_expression "(char *)FUN_002770b0(param_3)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_002770b0(param_3)" identifier (argument_list "(param_3)" ( identifier ))))) ;) (if_statement "if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }" if (parenthesized_expression "((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0'))" ( (binary_expression "(__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')" (parenthesized_expression "(__modes != (char *)0x0)" ( (binary_expression "__modes != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(cVar1 = FUN_00277210(param_1), cVar1 == '\0')" ( (comma_expression "cVar1 = FUN_00277210(param_1), cVar1 == '\0'" (assignment_expression "cVar1 = FUN_00277210(param_1)" identifier = (call_expression "FUN_00277210(param_1)" identifier (argument_list "(param_1)" ( identifier )))) , (binary_expression "cVar1 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence '))) ))) )) (compound_statement "{\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }" { (expression_statement "__stream = fdopen(param_2,__modes);" (assignment_expression "__stream = fdopen(param_2,__modes)" identifier = (call_expression "fdopen(param_2,__modes)" identifier (argument_list "(param_2,__modes)" ( identifier , identifier )))) ;) (expression_statement "*param_1 = __stream;" (assignment_expression "*param_1 = __stream" (pointer_expression "*param_1" * identifier) = identifier) ;) (if_statement "if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }" if (parenthesized_expression "(__stream != (FILE *)0x0)" ( (binary_expression "__stream != (FILE *)0x0" identifier != (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }" { (expression_statement "*(undefined1 *)(param_1 + 1) = 1;" (assignment_expression "*(undefined1 *)(param_1 + 1) = 1" (pointer_expression "*(undefined1 *)(param_1 + 1)" * (cast_expression "(undefined1 *)(param_1 + 1)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 1)" ( (binary_expression "param_1 + 1" identifier + number_literal) )))) = number_literal) ;) (if_statement "if (param_2 != 0) {\n        return param_1;\n      }" if (parenthesized_expression "(param_2 != 0)" ( (binary_expression "param_2 != 0" identifier != number_literal) )) (compound_statement "{\n        return param_1;\n      }" { (return_statement "return param_1;" return identifier ;) })) (expression_statement "setvbuf(__stream,(char *)0x0,2,0);" (call_expression "setvbuf(__stream,(char *)0x0,2,0)" identifier (argument_list "(__stream,(char *)0x0,2,0)" ( identifier , (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) , number_literal , number_literal ))) ;) (return_statement "return param_1;" return identifier ;) })) })) (return_statement "return (undefined8 *)0x0;" return (cast_expression "(undefined8 *)0x0" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit "/* std::__basic_file<char>::sys_open(int, std::_Ios_Openmode) */\n\n__basic_file<char> * __thiscall\nstd::__basic_file<char>::sys_open(__basic_file<char> *this,int param_1,_Ios_Openmode param_2)\n\n{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)::(anonymous_namespace)::fopen_mode(param_2);\n  if ((__modes != (char *)0x0) && (cVar1 = is_open(this), cVar1 == '\0')) {\n    __stream = fdopen(param_1,__modes);\n    *(FILE **)this = __stream;\n    if (__stream != (FILE *)0x0) {\n      this[8] = (__basic_file<char>)0x1;\n      if (param_1 != 0) {\n        return this;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return this;\n    }\n  }\n  return (__basic_file<char> *)0x0;\n}\n\n" comment (ERROR "__basic_file<char> * __thiscall\nstd::__basic_file<char>::sys_open(__basic_file<char> *this,int param_1,_Ios_Openmode param_2)" (binary_expression "__basic_file<char> * __thiscall\nstd::__basic_file<char>::sys_open(__basic_file<char> *this,int param_1,_Ios_Openmode param_2)" (binary_expression "__basic_file<char> * __thiscall\nstd::__basic_file<char" (binary_expression "__basic_file<char> * __thiscall" (binary_expression "__basic_file<char" identifier < identifier) > (pointer_expression "* __thiscall" * identifier)) (ERROR "std::__basic_file" identifier : : identifier) < identifier) > (ERROR "::" : :) (call_expression "sys_open(__basic_file<char> *this,int param_1,_Ios_Openmode param_2)" identifier (argument_list "(__basic_file<char> *this,int param_1,_Ios_Openmode param_2)" ( (binary_expression "__basic_file<char> *this" (binary_expression "__basic_file<char" identifier < identifier) > (pointer_expression "*this" * identifier)) , (ERROR "int" identifier) identifier , identifier (ERROR "param_2" identifier) ))))) (compound_statement "{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)::(anonymous_namespace)::fopen_mode(param_2);\n  if ((__modes != (char *)0x0) && (cVar1 = is_open(this), cVar1 == '\0')) {\n    __stream = fdopen(param_1,__modes);\n    *(FILE **)this = __stream;\n    if (__stream != (FILE *)0x0) {\n      this[8] = (__basic_file<char>)0x1;\n      if (param_1 != 0) {\n        return this;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return this;\n    }\n  }\n  return (__basic_file<char> *)0x0;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "char *__modes;" primitive_type (pointer_declarator "*__modes" * identifier) ;) (declaration "FILE *__stream;" type_identifier (pointer_declarator "*__stream" * identifier) ;) (labeled_statement "__modes = (char *)::(anonymous_namespace)::fopen_mode(param_2);" statement_identifier (ERROR "= (char *)::(anonymous_namespace):" = ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) : : (parenthesized_expression "(anonymous_namespace)" ( identifier )) :) : (expression_statement "fopen_mode(param_2);" (call_expression "fopen_mode(param_2)" identifier (argument_list "(param_2)" ( identifier ))) ;)) (if_statement "if ((__modes != (char *)0x0) && (cVar1 = is_open(this), cVar1 == '\0')) {\n    __stream = fdopen(param_1,__modes);\n    *(FILE **)this = __stream;\n    if (__stream != (FILE *)0x0) {\n      this[8] = (__basic_file<char>)0x1;\n      if (param_1 != 0) {\n        return this;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return this;\n    }\n  }" if (parenthesized_expression "((__modes != (char *)0x0) && (cVar1 = is_open(this), cVar1 == '\0'))" ( (binary_expression "(__modes != (char *)0x0) && (cVar1 = is_open(this), cVar1 == '\0')" (parenthesized_expression "(__modes != (char *)0x0)" ( (binary_expression "__modes != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(cVar1 = is_open(this), cVar1 == '\0')" ( (comma_expression "cVar1 = is_open(this), cVar1 == '\0'" (assignment_expression "cVar1 = is_open(this)" identifier = (call_expression "is_open(this)" identifier (argument_list "(this)" ( identifier )))) , (binary_expression "cVar1 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence '))) ))) )) (compound_statement "{\n    __stream = fdopen(param_1,__modes);\n    *(FILE **)this = __stream;\n    if (__stream != (FILE *)0x0) {\n      this[8] = (__basic_file<char>)0x1;\n      if (param_1 != 0) {\n        return this;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return this;\n    }\n  }" { (expression_statement "__stream = fdopen(param_1,__modes);" (assignment_expression "__stream = fdopen(param_1,__modes)" identifier = (call_expression "fdopen(param_1,__modes)" identifier (argument_list "(param_1,__modes)" ( identifier , identifier )))) ;) (expression_statement "*(FILE **)this = __stream;" (assignment_expression "*(FILE **)this = __stream" (pointer_expression "*(FILE **)this" * (cast_expression "(FILE **)this" ( (type_descriptor "FILE **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) identifier)) = identifier) ;) (if_statement "if (__stream != (FILE *)0x0) {\n      this[8] = (__basic_file<char>)0x1;\n      if (param_1 != 0) {\n        return this;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return this;\n    }" if (parenthesized_expression "(__stream != (FILE *)0x0)" ( (binary_expression "__stream != (FILE *)0x0" identifier != (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      this[8] = (__basic_file<char>)0x1;\n      if (param_1 != 0) {\n        return this;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return this;\n    }" { (expression_statement "this[8] = (__basic_file<char>)0x1;" (assignment_expression "this[8] = (__basic_file<char>)0x1" (subscript_expression "this[8]" identifier [ number_literal ]) = (parenthesized_expression "(__basic_file<char>)0x1" ( (binary_expression "__basic_file<char>)0x1" (binary_expression "__basic_file<char" identifier < identifier) > (ERROR ")" )) number_literal) ))) ;) (if_statement "if (param_1 != 0) {\n        return this;\n      }" if (parenthesized_expression "(param_1 != 0)" ( (binary_expression "param_1 != 0" identifier != number_literal) )) (compound_statement "{\n        return this;\n      }" { (return_statement "return this;" return identifier ;) })) (expression_statement "setvbuf(__stream,(char *)0x0,2,0);" (call_expression "setvbuf(__stream,(char *)0x0,2,0)" identifier (argument_list "(__stream,(char *)0x0,2,0)" ( identifier , (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) , number_literal , number_literal ))) ;) (return_statement "return this;" return identifier ;) })) })) (return_statement "return (__basic_file<char> *)0x0;" return (parenthesized_expression "(__basic_file<char> *)0x0" ( (binary_expression "__basic_file<char> *)0x0" (binary_expression "__basic_file<char" identifier < identifier) > (pointer_expression "*)0x0" * (ERROR ")" )) number_literal)) )) ;) }))
(translation_unit "undefined8 * FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)\n\n{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)FUN_002770b0(param_3);\n  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }\n  return (undefined8 *)0x0;\n}\n\n" (function_definition "undefined8 * FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)\n\n{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)FUN_002770b0(param_3);\n  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }\n  return (undefined8 *)0x0;\n}" type_identifier (pointer_declarator "* FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)" * (function_declarator "FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)" identifier (parameter_list "(undefined8 *param_1,int param_2,undefined4 param_3)" ( (parameter_declaration "undefined8 *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "int param_2" primitive_type identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) )))) (compound_statement "{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)FUN_002770b0(param_3);\n  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }\n  return (undefined8 *)0x0;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "char *__modes;" primitive_type (pointer_declarator "*__modes" * identifier) ;) (declaration "FILE *__stream;" type_identifier (pointer_declarator "*__stream" * identifier) ;) (expression_statement "__modes = (char *)FUN_002770b0(param_3);" (assignment_expression "__modes = (char *)FUN_002770b0(param_3)" identifier = (cast_expression "(char *)FUN_002770b0(param_3)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_002770b0(param_3)" identifier (argument_list "(param_3)" ( identifier ))))) ;) (if_statement "if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }" if (parenthesized_expression "((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0'))" ( (binary_expression "(__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')" (parenthesized_expression "(__modes != (char *)0x0)" ( (binary_expression "__modes != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(cVar1 = FUN_00277210(param_1), cVar1 == '\0')" ( (comma_expression "cVar1 = FUN_00277210(param_1), cVar1 == '\0'" (assignment_expression "cVar1 = FUN_00277210(param_1)" identifier = (call_expression "FUN_00277210(param_1)" identifier (argument_list "(param_1)" ( identifier )))) , (binary_expression "cVar1 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence '))) ))) )) (compound_statement "{\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }" { (expression_statement "__stream = fdopen(param_2,__modes);" (assignment_expression "__stream = fdopen(param_2,__modes)" identifier = (call_expression "fdopen(param_2,__modes)" identifier (argument_list "(param_2,__modes)" ( identifier , identifier )))) ;) (expression_statement "*param_1 = __stream;" (assignment_expression "*param_1 = __stream" (pointer_expression "*param_1" * identifier) = identifier) ;) (if_statement "if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }" if (parenthesized_expression "(__stream != (FILE *)0x0)" ( (binary_expression "__stream != (FILE *)0x0" identifier != (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }" { (expression_statement "*(undefined1 *)(param_1 + 1) = 1;" (assignment_expression "*(undefined1 *)(param_1 + 1) = 1" (pointer_expression "*(undefined1 *)(param_1 + 1)" * (cast_expression "(undefined1 *)(param_1 + 1)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 1)" ( (binary_expression "param_1 + 1" identifier + number_literal) )))) = number_literal) ;) (if_statement "if (param_2 != 0) {\n        return param_1;\n      }" if (parenthesized_expression "(param_2 != 0)" ( (binary_expression "param_2 != 0" identifier != number_literal) )) (compound_statement "{\n        return param_1;\n      }" { (return_statement "return param_1;" return identifier ;) })) (expression_statement "setvbuf(__stream,(char *)0x0,2,0);" (call_expression "setvbuf(__stream,(char *)0x0,2,0)" identifier (argument_list "(__stream,(char *)0x0,2,0)" ( identifier , (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) , number_literal , number_literal ))) ;) (return_statement "return param_1;" return identifier ;) })) })) (return_statement "return (undefined8 *)0x0;" return (cast_expression "(undefined8 *)0x0" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit (function_definition TYPE (pointer_declarator * (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) )))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( IDENT ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) && (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) , (binary_expression IDENT == (char_literal ' escape_sequence '))) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT )))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (call_expression IDENT (argument_list ( IDENT , (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) , LIT , LIT ))) ;) (return_statement return IDENT ;) })) })) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })))
(function_definition "undefined8 * FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)\n\n{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)FUN_002770b0(param_3);\n  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }\n  return (undefined8 *)0x0;\n}" (type_identifier "undefined8") (pointer_declarator "* FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)" (* "*") (function_declarator "FUN_002772b0(undefined8 *param_1,int param_2,undefined4 param_3)" (identifier "FUN_002772b0") (parameter_list "(undefined8 *param_1,int param_2,undefined4 param_3)" (( "(") (parameter_declaration "undefined8 *param_1" (type_identifier "undefined8") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "int param_2" (primitive_type "int") (identifier "param_2")) (, ",") (parameter_declaration "undefined4 param_3" (type_identifier "undefined4") (identifier "param_3")) () ")")))) (compound_statement "{\n  char cVar1;\n  char *__modes;\n  FILE *__stream;\n  \n  __modes = (char *)FUN_002770b0(param_3);\n  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }\n  return (undefined8 *)0x0;\n}" ({ "{") (declaration "char cVar1;" (primitive_type "char") (identifier "cVar1") (; ";")) (declaration "char *__modes;" (primitive_type "char") (pointer_declarator "*__modes" (* "*") (identifier "__modes")) (; ";")) (declaration "FILE *__stream;" (type_identifier "FILE") (pointer_declarator "*__stream" (* "*") (identifier "__stream")) (; ";")) (expression_statement "__modes = (char *)FUN_002770b0(param_3);" (assignment_expression "__modes = (char *)FUN_002770b0(param_3)" (identifier "__modes") (= "=") (cast_expression "(char *)FUN_002770b0(param_3)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_002770b0(param_3)" (identifier "FUN_002770b0") (argument_list "(param_3)" (( "(") (identifier "param_3") () ")"))))) (; ";")) (if_statement "if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }" (if "if") (parenthesized_expression "((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0'))" (( "(") (binary_expression "(__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')" (parenthesized_expression "(__modes != (char *)0x0)" (( "(") (binary_expression "__modes != (char *)0x0" (identifier "__modes") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (&& "&&") (parenthesized_expression "(cVar1 = FUN_00277210(param_1), cVar1 == '\0')" (( "(") (comma_expression "cVar1 = FUN_00277210(param_1), cVar1 == '\0'" (assignment_expression "cVar1 = FUN_00277210(param_1)" (identifier "cVar1") (= "=") (call_expression "FUN_00277210(param_1)" (identifier "FUN_00277210") (argument_list "(param_1)" (( "(") (identifier "param_1") () ")")))) (, ",") (binary_expression "cVar1 == '\0'" (identifier "cVar1") (== "==") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'")))) () ")"))) () ")")) (compound_statement "{\n    __stream = fdopen(param_2,__modes);\n    *param_1 = __stream;\n    if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }\n  }" ({ "{") (expression_statement "__stream = fdopen(param_2,__modes);" (assignment_expression "__stream = fdopen(param_2,__modes)" (identifier "__stream") (= "=") (call_expression "fdopen(param_2,__modes)" (identifier "fdopen") (argument_list "(param_2,__modes)" (( "(") (identifier "param_2") (, ",") (identifier "__modes") () ")")))) (; ";")) (expression_statement "*param_1 = __stream;" (assignment_expression "*param_1 = __stream" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (= "=") (identifier "__stream")) (; ";")) (if_statement "if (__stream != (FILE *)0x0) {\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }" (if "if") (parenthesized_expression "(__stream != (FILE *)0x0)" (( "(") (binary_expression "__stream != (FILE *)0x0" (identifier "__stream") (!= "!=") (cast_expression "(FILE *)0x0" (( "(") (type_descriptor "FILE *" (type_identifier "FILE") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n      *(undefined1 *)(param_1 + 1) = 1;\n      if (param_2 != 0) {\n        return param_1;\n      }\n      setvbuf(__stream,(char *)0x0,2,0);\n      return param_1;\n    }" ({ "{") (expression_statement "*(undefined1 *)(param_1 + 1) = 1;" (assignment_expression "*(undefined1 *)(param_1 + 1) = 1" (pointer_expression "*(undefined1 *)(param_1 + 1)" (* "*") (cast_expression "(undefined1 *)(param_1 + 1)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 1)" (( "(") (binary_expression "param_1 + 1" (identifier "param_1") (+ "+") (number_literal "1")) () ")")))) (= "=") (number_literal "1")) (; ";")) (if_statement "if (param_2 != 0) {\n        return param_1;\n      }" (if "if") (parenthesized_expression "(param_2 != 0)" (( "(") (binary_expression "param_2 != 0" (identifier "param_2") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n        return param_1;\n      }" ({ "{") (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}"))) (expression_statement "setvbuf(__stream,(char *)0x0,2,0);" (call_expression "setvbuf(__stream,(char *)0x0,2,0)" (identifier "setvbuf") (argument_list "(__stream,(char *)0x0,2,0)" (( "(") (identifier "__stream") (, ",") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (, ",") (number_literal "2") (, ",") (number_literal "0") () ")"))) (; ";")) (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}"))) (} "}"))) (return_statement "return (undefined8 *)0x0;" (return "return") (cast_expression "(undefined8 *)0x0" (( "(") (type_descriptor "undefined8 *" (type_identifier "undefined8") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}")))

/* std::__basic_file<char>::sys_open(int, std::_Ios_Openmode) */

var_7<var_8> * __thiscall
std::var_7<var_8>::sys_open(var_7<var_8> *this,int var_9,_Ios_Openmode param_2)

{
  char var_4;
  char *var_2;
  type_1 *var_6;
  
  __modes = (char *)::(anonymous_namespace)::var_1(param_2);
  if ((var_2 != (char *)0x0) && (var_4 = var_3(this), var_4 == '\0')) {
    var_6 = var_5(var_9,var_2);
    *(type_1 **)this = var_6;
    if (var_6 != (type_1 *)0x0) {
      this[8] = (var_7<var_8>)0x1;
      if (var_9 != 0) {
        return this;
      }
      var_10(var_6,(char *)0x0,2,0);
      return this;
    }
  }
  return (var_7<var_8> *)0x0;
}


(translation_unit (function_definition type: (type_identifier) declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (primitive_type) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier))))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (call_expression function: (identifier) arguments: (argument_list (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (number_literal)))) right: (parenthesized_expression (comma_expression left: (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier)))) right: (binary_expression left: (identifier) right: (char_literal (escape_sequence))))))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (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))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (number_literal)) (number_literal) (number_literal)))) (return_statement (identifier)))))) (return_statement (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (number_literal))))))

undefined8 * MASKED(undefined8 *param_1,int param_2,undefined4 param_3)

{
  char cVar1;
  char *__modes;
  FILE *__stream;
  
  __modes = (char *)FUN_002770b0(param_3);
  if ((__modes != (char *)0x0) && (cVar1 = FUN_00277210(param_1), cVar1 == '\0')) {
    __stream = fdopen(param_2,__modes);
    *param_1 = __stream;
    if (__stream != (FILE *)0x0) {
      *(undefined1 *)(param_1 + 1) = 1;
      if (param_2 != 0) {
        return param_1;
      }
      setvbuf(__stream,(char *)0x0,2,0);
      return param_1;
    }
  }
  return (undefined8 *)0x0;
}

