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

_IO_FILE * std::__basic_file<char>::sys_open(_IO_FILE *param_1,_Ios_Openmode param_2)

{
  int iVar1;
  FILE *__stream;
  char cVar2;
  int iVar3;
  int *piVar4;
  undefined4 in_register_00000034;
  
  __stream = (FILE *)CONCAT44(in_register_00000034,param_2);
  cVar2 = is_open((__basic_file<char> *)param_1);
  if ((cVar2 != '\x01') && (__stream != (FILE *)0x0)) {
    piVar4 = __errno_location();
    iVar1 = *piVar4;
    *piVar4 = 0;
    do {
      iVar3 = fflush(__stream);
      if (iVar3 == 0) {
        *piVar4 = iVar1;
        *(FILE **)param_1 = __stream;
        *(undefined1 *)&param_1->_IO_read_ptr = 0;
        return param_1;
      }
    } while (*piVar4 == 4);
    *piVar4 = iVar1;
  }
  return (_IO_FILE *)0x0;
}



undefined8 * FUN_0049e840(undefined8 *param_1,FILE *param_2)

{
  int iVar1;
  char cVar2;
  int iVar3;
  int *piVar4;
  
  cVar2 = FUN_0049e830();
  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {
    piVar4 = __errno_location();
    iVar1 = *piVar4;
    *piVar4 = 0;
    do {
      iVar3 = fflush(param_2);
      if (iVar3 == 0) {
        *piVar4 = iVar1;
        *param_1 = param_2;
        *(undefined1 *)(param_1 + 1) = 0;
        return param_1;
      }
    } while (*piVar4 == 4);
    *piVar4 = iVar1;
  }
  return (undefined8 *)0x0;
}


PUSH R13
PUSH R12
MOV R12,RDI
PUSH RBP
PUSH RBX
MOV RBX,RSI
SUB RSP,0x8
CALL 0x0049e830
CMP AL,0x1
JZ 0x0049e8b4
TEST RBX,RBX
JZ 0x0049e8b4
CALL 0x00177760
MOV R13D,dword ptr [RAX]
MOV RBP,RAX
MOV dword ptr [RAX],0x0
JMP 0x0049e87e
CMP dword ptr [RBP],0x4
JNZ 0x0049e8b0
MOV RDI,RBX
CALL 0x00177b10
TEST EAX,EAX
JNZ 0x0049e878
MOV dword ptr [RBP],R13D
MOV RAX,R12
MOV qword ptr [R12],RBX
MOV byte ptr [R12 + 0x8],0x0
ADD RSP,0x8
POP RBX
POP RBP
POP R12
POP R13
RET
MOV dword ptr [RBP],R13D
ADD RSP,0x8
XOR EAX,EAX
POP RBX
POP RBP
POP R12
POP R13
RET
(translation_unit "undefined8 * FUN_0049e840(undefined8 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  \n  cVar2 = FUN_0049e830();\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (undefined8 *)0x0;\n}\n\n" (function_definition "undefined8 * FUN_0049e840(undefined8 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  \n  cVar2 = FUN_0049e830();\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (undefined8 *)0x0;\n}" type_identifier (pointer_declarator "* FUN_0049e840(undefined8 *param_1,FILE *param_2)" * (function_declarator "FUN_0049e840(undefined8 *param_1,FILE *param_2)" identifier (parameter_list "(undefined8 *param_1,FILE *param_2)" ( (parameter_declaration "undefined8 *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "FILE *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) )))) (compound_statement "{\n  int iVar1;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  \n  cVar2 = FUN_0049e830();\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (undefined8 *)0x0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "char cVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (expression_statement "cVar2 = FUN_0049e830();" (assignment_expression "cVar2 = FUN_0049e830()" identifier = (call_expression "FUN_0049e830()" identifier (argument_list "()" ( )))) ;) (if_statement "if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }" if (parenthesized_expression "((cVar2 != '\x01') && (param_2 != (FILE *)0x0))" ( (binary_expression "(cVar2 != '\x01') && (param_2 != (FILE *)0x0)" (parenthesized_expression "(cVar2 != '\x01')" ( (binary_expression "cVar2 != '\x01'" identifier != (char_literal "'\x01'" ' escape_sequence ')) )) && (parenthesized_expression "(param_2 != (FILE *)0x0)" ( (binary_expression "param_2 != (FILE *)0x0" identifier != (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) ))) )) (compound_statement "{\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }" { (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar4;" (assignment_expression "iVar1 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "*piVar4 = 0;" (assignment_expression "*piVar4 = 0" (pointer_expression "*piVar4" * identifier) = number_literal) ;) (do_statement "do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);" do (compound_statement "{\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    }" { (expression_statement "iVar3 = fflush(param_2);" (assignment_expression "iVar3 = fflush(param_2)" identifier = (call_expression "fflush(param_2)" identifier (argument_list "(param_2)" ( identifier )))) ;) (if_statement "if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" { (expression_statement "*piVar4 = iVar1;" (assignment_expression "*piVar4 = iVar1" (pointer_expression "*piVar4" * identifier) = identifier) ;) (expression_statement "*param_1 = param_2;" (assignment_expression "*param_1 = param_2" (pointer_expression "*param_1" * identifier) = identifier) ;) (expression_statement "*(undefined1 *)(param_1 + 1) = 0;" (assignment_expression "*(undefined1 *)(param_1 + 1) = 0" (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) ;) (return_statement "return param_1;" return identifier ;) })) }) while (parenthesized_expression "(*piVar4 == 4)" ( (binary_expression "*piVar4 == 4" (pointer_expression "*piVar4" * identifier) == number_literal) )) ;) (expression_statement "*piVar4 = iVar1;" (assignment_expression "*piVar4 = iVar1" (pointer_expression "*piVar4" * identifier) = 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(_IO_FILE*, std::_Ios_Openmode) */\n\n_IO_FILE * std::__basic_file<char>::sys_open(_IO_FILE *param_1,_Ios_Openmode param_2)\n\n{\n  int iVar1;\n  FILE *__stream;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  undefined4 in_register_00000034;\n  \n  __stream = (FILE *)CONCAT44(in_register_00000034,param_2);\n  cVar2 = is_open((__basic_file<char> *)param_1);\n  if ((cVar2 != '\x01') && (__stream != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(__stream);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *(FILE **)param_1 = __stream;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (_IO_FILE *)0x0;\n}\n\n" comment (ERROR "_IO_FILE * std::__basic_file<char>::sys_open(_IO_FILE *param_1,_Ios_Openmode param_2)" (binary_expression "_IO_FILE * std::__basic_file<char>::sys_open(_IO_FILE *param_1,_Ios_Openmode param_2)" (binary_expression "_IO_FILE * std::__basic_file<char" (binary_expression "_IO_FILE * std" identifier * identifier) (ERROR "::__basic_file" : : identifier) < identifier) > (ERROR "::" : :) (call_expression "sys_open(_IO_FILE *param_1,_Ios_Openmode param_2)" identifier (argument_list "(_IO_FILE *param_1,_Ios_Openmode param_2)" ( (binary_expression "_IO_FILE *param_1" identifier * identifier) , identifier (ERROR "param_2" identifier) ))))) (compound_statement "{\n  int iVar1;\n  FILE *__stream;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  undefined4 in_register_00000034;\n  \n  __stream = (FILE *)CONCAT44(in_register_00000034,param_2);\n  cVar2 = is_open((__basic_file<char> *)param_1);\n  if ((cVar2 != '\x01') && (__stream != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(__stream);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *(FILE **)param_1 = __stream;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (_IO_FILE *)0x0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "FILE *__stream;" type_identifier (pointer_declarator "*__stream" * identifier) ;) (declaration "char cVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (declaration "undefined4 in_register_00000034;" type_identifier identifier ;) (expression_statement "__stream = (FILE *)CONCAT44(in_register_00000034,param_2);" (assignment_expression "__stream = (FILE *)CONCAT44(in_register_00000034,param_2)" identifier = (cast_expression "(FILE *)CONCAT44(in_register_00000034,param_2)" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "CONCAT44(in_register_00000034,param_2)" identifier (argument_list "(in_register_00000034,param_2)" ( identifier , identifier ))))) ;) (expression_statement "cVar2 = is_open((__basic_file<char> *)param_1);" (assignment_expression "cVar2 = is_open((__basic_file<char> *)param_1)" identifier = (call_expression "is_open((__basic_file<char> *)param_1)" identifier (argument_list "((__basic_file<char> *)param_1)" ( (parenthesized_expression "(__basic_file<char> *)param_1)" ( (binary_expression "__basic_file<char> *)param_1" (binary_expression "__basic_file<char" identifier < identifier) > (pointer_expression "*)param_1" * (ERROR ")" )) identifier)) )) )))) ;) (if_statement "if ((cVar2 != '\x01') && (__stream != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(__stream);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *(FILE **)param_1 = __stream;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }" if (parenthesized_expression "((cVar2 != '\x01') && (__stream != (FILE *)0x0))" ( (binary_expression "(cVar2 != '\x01') && (__stream != (FILE *)0x0)" (parenthesized_expression "(cVar2 != '\x01')" ( (binary_expression "cVar2 != '\x01'" identifier != (char_literal "'\x01'" ' escape_sequence ')) )) && (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    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(__stream);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *(FILE **)param_1 = __stream;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }" { (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar4;" (assignment_expression "iVar1 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "*piVar4 = 0;" (assignment_expression "*piVar4 = 0" (pointer_expression "*piVar4" * identifier) = number_literal) ;) (do_statement "do {\n      iVar3 = fflush(__stream);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *(FILE **)param_1 = __stream;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);" do (compound_statement "{\n      iVar3 = fflush(__stream);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *(FILE **)param_1 = __stream;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    }" { (expression_statement "iVar3 = fflush(__stream);" (assignment_expression "iVar3 = fflush(__stream)" identifier = (call_expression "fflush(__stream)" identifier (argument_list "(__stream)" ( identifier )))) ;) (if_statement "if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *(FILE **)param_1 = __stream;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n        *piVar4 = iVar1;\n        *(FILE **)param_1 = __stream;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }" { (expression_statement "*piVar4 = iVar1;" (assignment_expression "*piVar4 = iVar1" (pointer_expression "*piVar4" * identifier) = identifier) ;) (expression_statement "*(FILE **)param_1 = __stream;" (assignment_expression "*(FILE **)param_1 = __stream" (pointer_expression "*(FILE **)param_1" * (cast_expression "(FILE **)param_1" ( (type_descriptor "FILE **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) identifier)) = identifier) ;) (expression_statement "*(undefined1 *)&param_1->_IO_read_ptr = 0;" (assignment_expression "*(undefined1 *)&param_1->_IO_read_ptr = 0" (pointer_expression "*(undefined1 *)&param_1->_IO_read_ptr" * (cast_expression "(undefined1 *)&param_1->_IO_read_ptr" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&param_1->_IO_read_ptr" & (field_expression "param_1->_IO_read_ptr" identifier -> field_identifier)))) = number_literal) ;) (return_statement "return param_1;" return identifier ;) })) }) while (parenthesized_expression "(*piVar4 == 4)" ( (binary_expression "*piVar4 == 4" (pointer_expression "*piVar4" * identifier) == number_literal) )) ;) (expression_statement "*piVar4 = iVar1;" (assignment_expression "*piVar4 = iVar1" (pointer_expression "*piVar4" * identifier) = identifier) ;) })) (return_statement "return (_IO_FILE *)0x0;" return (cast_expression "(_IO_FILE *)0x0" ( (type_descriptor "_IO_FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) }))
(translation_unit "undefined8 * FUN_0049e840(undefined8 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  \n  cVar2 = FUN_0049e830();\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (undefined8 *)0x0;\n}\n\n" (function_definition "undefined8 * FUN_0049e840(undefined8 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  \n  cVar2 = FUN_0049e830();\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (undefined8 *)0x0;\n}" type_identifier (pointer_declarator "* FUN_0049e840(undefined8 *param_1,FILE *param_2)" * (function_declarator "FUN_0049e840(undefined8 *param_1,FILE *param_2)" identifier (parameter_list "(undefined8 *param_1,FILE *param_2)" ( (parameter_declaration "undefined8 *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "FILE *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) )))) (compound_statement "{\n  int iVar1;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  \n  cVar2 = FUN_0049e830();\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (undefined8 *)0x0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "char cVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (expression_statement "cVar2 = FUN_0049e830();" (assignment_expression "cVar2 = FUN_0049e830()" identifier = (call_expression "FUN_0049e830()" identifier (argument_list "()" ( )))) ;) (if_statement "if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }" if (parenthesized_expression "((cVar2 != '\x01') && (param_2 != (FILE *)0x0))" ( (binary_expression "(cVar2 != '\x01') && (param_2 != (FILE *)0x0)" (parenthesized_expression "(cVar2 != '\x01')" ( (binary_expression "cVar2 != '\x01'" identifier != (char_literal "'\x01'" ' escape_sequence ')) )) && (parenthesized_expression "(param_2 != (FILE *)0x0)" ( (binary_expression "param_2 != (FILE *)0x0" identifier != (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) ))) )) (compound_statement "{\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }" { (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar4;" (assignment_expression "iVar1 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "*piVar4 = 0;" (assignment_expression "*piVar4 = 0" (pointer_expression "*piVar4" * identifier) = number_literal) ;) (do_statement "do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);" do (compound_statement "{\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    }" { (expression_statement "iVar3 = fflush(param_2);" (assignment_expression "iVar3 = fflush(param_2)" identifier = (call_expression "fflush(param_2)" identifier (argument_list "(param_2)" ( identifier )))) ;) (if_statement "if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" { (expression_statement "*piVar4 = iVar1;" (assignment_expression "*piVar4 = iVar1" (pointer_expression "*piVar4" * identifier) = identifier) ;) (expression_statement "*param_1 = param_2;" (assignment_expression "*param_1 = param_2" (pointer_expression "*param_1" * identifier) = identifier) ;) (expression_statement "*(undefined1 *)(param_1 + 1) = 0;" (assignment_expression "*(undefined1 *)(param_1 + 1) = 0" (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) ;) (return_statement "return param_1;" return identifier ;) })) }) while (parenthesized_expression "(*piVar4 == 4)" ( (binary_expression "*piVar4 == 4" (pointer_expression "*piVar4" * identifier) == number_literal) )) ;) (expression_statement "*piVar4 = iVar1;" (assignment_expression "*piVar4 = iVar1" (pointer_expression "*piVar4" * identifier) = 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 (pointer_declarator * IDENT)) )))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) && (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = LIT) ;) (return_statement return IDENT ;) })) }) while (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) == LIT) )) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) })) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })))
(function_definition "undefined8 * FUN_0049e840(undefined8 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  \n  cVar2 = FUN_0049e830();\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (undefined8 *)0x0;\n}" (type_identifier "undefined8") (pointer_declarator "* FUN_0049e840(undefined8 *param_1,FILE *param_2)" (* "*") (function_declarator "FUN_0049e840(undefined8 *param_1,FILE *param_2)" (identifier "FUN_0049e840") (parameter_list "(undefined8 *param_1,FILE *param_2)" (( "(") (parameter_declaration "undefined8 *param_1" (type_identifier "undefined8") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "FILE *param_2" (type_identifier "FILE") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) () ")")))) (compound_statement "{\n  int iVar1;\n  char cVar2;\n  int iVar3;\n  int *piVar4;\n  \n  cVar2 = FUN_0049e830();\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }\n  return (undefined8 *)0x0;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "char cVar2;" (primitive_type "char") (identifier "cVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "int *piVar4;" (primitive_type "int") (pointer_declarator "*piVar4" (* "*") (identifier "piVar4")) (; ";")) (expression_statement "cVar2 = FUN_0049e830();" (assignment_expression "cVar2 = FUN_0049e830()" (identifier "cVar2") (= "=") (call_expression "FUN_0049e830()" (identifier "FUN_0049e830") (argument_list "()" (( "(") () ")")))) (; ";")) (if_statement "if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }" (if "if") (parenthesized_expression "((cVar2 != '\x01') && (param_2 != (FILE *)0x0))" (( "(") (binary_expression "(cVar2 != '\x01') && (param_2 != (FILE *)0x0)" (parenthesized_expression "(cVar2 != '\x01')" (( "(") (binary_expression "cVar2 != '\x01'" (identifier "cVar2") (!= "!=") (char_literal "'\x01'" (' "'") (escape_sequence "\x01") (' "'"))) () ")")) (&& "&&") (parenthesized_expression "(param_2 != (FILE *)0x0)" (( "(") (binary_expression "param_2 != (FILE *)0x0" (identifier "param_2") (!= "!=") (cast_expression "(FILE *)0x0" (( "(") (type_descriptor "FILE *" (type_identifier "FILE") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")"))) () ")")) (compound_statement "{\n    piVar4 = __errno_location();\n    iVar1 = *piVar4;\n    *piVar4 = 0;\n    do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);\n    *piVar4 = iVar1;\n  }" ({ "{") (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" (identifier "piVar4") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar1 = *piVar4;" (assignment_expression "iVar1 = *piVar4" (identifier "iVar1") (= "=") (pointer_expression "*piVar4" (* "*") (identifier "piVar4"))) (; ";")) (expression_statement "*piVar4 = 0;" (assignment_expression "*piVar4 = 0" (pointer_expression "*piVar4" (* "*") (identifier "piVar4")) (= "=") (number_literal "0")) (; ";")) (do_statement "do {\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar4 == 4);" (do "do") (compound_statement "{\n      iVar3 = fflush(param_2);\n      if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    }" ({ "{") (expression_statement "iVar3 = fflush(param_2);" (assignment_expression "iVar3 = fflush(param_2)" (identifier "iVar3") (= "=") (call_expression "fflush(param_2)" (identifier "fflush") (argument_list "(param_2)" (( "(") (identifier "param_2") () ")")))) (; ";")) (if_statement "if (iVar3 == 0) {\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" (if "if") (parenthesized_expression "(iVar3 == 0)" (( "(") (binary_expression "iVar3 == 0" (identifier "iVar3") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        *piVar4 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" ({ "{") (expression_statement "*piVar4 = iVar1;" (assignment_expression "*piVar4 = iVar1" (pointer_expression "*piVar4" (* "*") (identifier "piVar4")) (= "=") (identifier "iVar1")) (; ";")) (expression_statement "*param_1 = param_2;" (assignment_expression "*param_1 = param_2" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (= "=") (identifier "param_2")) (; ";")) (expression_statement "*(undefined1 *)(param_1 + 1) = 0;" (assignment_expression "*(undefined1 *)(param_1 + 1) = 0" (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 "0")) (; ";")) (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}"))) (} "}")) (while "while") (parenthesized_expression "(*piVar4 == 4)" (( "(") (binary_expression "*piVar4 == 4" (pointer_expression "*piVar4" (* "*") (identifier "piVar4")) (== "==") (number_literal "4")) () ")")) (; ";")) (expression_statement "*piVar4 = iVar1;" (assignment_expression "*piVar4 = iVar1" (pointer_expression "*piVar4" (* "*") (identifier "piVar4")) (= "=") (identifier "iVar1")) (; ";")) (} "}"))) (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(_IO_FILE*, std::_Ios_Openmode) */

type_4 * std::var_3<var_4>::sys_open(type_4 *param_1,_Ios_Openmode param_2)

{
  int iVar1;
  type_1 *var_6;
  char var_5;
  int var_9;
  int *piVar4;
  type_2 in_register_00000034;
  
  var_6 = (type_1 *)var_1(in_register_00000034,param_2);
  var_5 = var_2((var_3<var_4> *)param_1);
  if ((var_5 != '\x01') && (var_6 != (type_1 *)0x0)) {
    piVar4 = var_7();
    iVar1 = *piVar4;
    *piVar4 = 0;
    do {
      var_9 = var_8(var_6);
      if (var_9 == 0) {
        *piVar4 = iVar1;
        *(type_1 **)param_1 = var_6;
        *(type_3 *)&param_1->_IO_read_ptr = 0;
        return param_1;
      }
    } while (*piVar4 == 4);
    *piVar4 = iVar1;
  }
  return (type_4 *)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: (type_identifier) declarator: (pointer_declarator declarator: (identifier)))))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (char_literal (escape_sequence)))) right: (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: (identifier) right: (call_expression function: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (number_literal))) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (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))) (return_statement (identifier))))) condition: (parenthesized_expression (binary_expression left: (pointer_expression argument: (identifier)) right: (number_literal)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))))) (return_statement (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (number_literal))))))

undefined8 * MASKED(undefined8 *param_1,FILE *param_2)

{
  int iVar1;
  char cVar2;
  int iVar3;
  int *piVar4;
  
  cVar2 = FUN_0049e830();
  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {
    piVar4 = __errno_location();
    iVar1 = *piVar4;
    *piVar4 = 0;
    do {
      iVar3 = fflush(param_2);
      if (iVar3 == 0) {
        *piVar4 = iVar1;
        *param_1 = param_2;
        *(undefined1 *)(param_1 + 1) = 0;
        return param_1;
      }
    } while (*piVar4 == 4);
    *piVar4 = iVar1;
  }
  return (undefined8 *)0x0;
}

