
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* 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;
  char cVar2;
  int *piVar3;
  int iVar4;
  
  cVar2 = is_open((__basic_file<char> *)param_1);
  if ((cVar2 != '\x01') && (param_2 != ~(_S_ios_openmode_min|_S_ios_openmode_max))) {
    piVar3 = __errno_location();
    iVar1 = *piVar3;
    *piVar3 = 0;
    do {
      iVar4 = fflush((FILE *)param_2);
      if (iVar4 == 0) {
        *piVar3 = iVar1;
        param_1->_flags = param_2;
        *(undefined1 *)&param_1->_IO_read_ptr = 0;
        return param_1;
      }
    } while (*piVar3 == 4);
    *piVar3 = iVar1;
  }
  return (_IO_FILE *)0x0;
}



/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

undefined4 * FUN_001e73f0(undefined4 *param_1,FILE *param_2)

{
  int iVar1;
  char cVar2;
  int *piVar3;
  int iVar4;
  
  cVar2 = FUN_001e73e0(param_1);
  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {
    piVar3 = __errno_location();
    iVar1 = *piVar3;
    *piVar3 = 0;
    do {
      iVar4 = fflush(param_2);
      if (iVar4 == 0) {
        *piVar3 = iVar1;
        *param_1 = param_2;
        *(undefined1 *)(param_1 + 1) = 0;
        return param_1;
      }
    } while (*piVar3 == 4);
    *piVar3 = iVar1;
  }
  return (undefined4 *)0x0;
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00035840
ADD EBX,0x1a7c07
SUB ESP,0x28
MOV EBP,dword ptr [ESP + 0x3c]
MOV ESI,dword ptr [ESP + 0x40]
PUSH EBP
CALL 0x001e73e0
ADD ESP,0x10
CMP AL,0x1
JZ 0x001e7466
TEST ESI,ESI
JZ 0x001e7466
CALL 0x00029090
MOV EDI,EAX
MOV EAX,dword ptr [EAX]
MOV dword ptr [EDI],0x0
MOV dword ptr [ESP + 0xc],EAX
JMP 0x001e7435
CMP dword ptr [EDI],0x4
JNZ 0x001e7460
SUB ESP,0xc
PUSH ESI
CALL 0x00029480
ADD ESP,0x10
TEST EAX,EAX
JNZ 0x001e7430
MOV EAX,dword ptr [ESP + 0xc]
MOV dword ptr [EDI],EAX
MOV EAX,EBP
MOV dword ptr [EBP],ESI
MOV byte ptr [EBP + 0x4],0x0
ADD ESP,0x1c
POP EBX
POP ESI
POP EDI
POP EBP
RET
MOV EAX,dword ptr [ESP + 0xc]
MOV dword ptr [EDI],EAX
ADD ESP,0x1c
XOR EAX,EAX
POP EBX
POP ESI
POP EDI
POP EBP
RET
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nundefined4 * FUN_001e73f0(undefined4 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int *piVar3;\n  int iVar4;\n  \n  cVar2 = FUN_001e73e0(param_1);\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (undefined4 *)0x0;\n}\n\n" comment (function_definition "undefined4 * FUN_001e73f0(undefined4 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int *piVar3;\n  int iVar4;\n  \n  cVar2 = FUN_001e73e0(param_1);\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (undefined4 *)0x0;\n}" type_identifier (pointer_declarator "* FUN_001e73f0(undefined4 *param_1,FILE *param_2)" * (function_declarator "FUN_001e73f0(undefined4 *param_1,FILE *param_2)" identifier (parameter_list "(undefined4 *param_1,FILE *param_2)" ( (parameter_declaration "undefined4 *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 *piVar3;\n  int iVar4;\n  \n  cVar2 = FUN_001e73e0(param_1);\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (undefined4 *)0x0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "char cVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (expression_statement "cVar2 = FUN_001e73e0(param_1);" (assignment_expression "cVar2 = FUN_001e73e0(param_1)" identifier = (call_expression "FUN_001e73e0(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = 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    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }" { (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar3;" (assignment_expression "iVar1 = *piVar3" identifier = (pointer_expression "*piVar3" * identifier)) ;) (expression_statement "*piVar3 = 0;" (assignment_expression "*piVar3 = 0" (pointer_expression "*piVar3" * identifier) = number_literal) ;) (do_statement "do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);" do (compound_statement "{\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    }" { (expression_statement "iVar4 = fflush(param_2);" (assignment_expression "iVar4 = fflush(param_2)" identifier = (call_expression "fflush(param_2)" identifier (argument_list "(param_2)" ( identifier )))) ;) (if_statement "if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" if (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) )) (compound_statement "{\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" { (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * 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 "(*piVar3 == 4)" ( (binary_expression "*piVar3 == 4" (pointer_expression "*piVar3" * identifier) == number_literal) )) ;) (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * identifier) = identifier) ;) })) (return_statement "return (undefined4 *)0x0;" return (cast_expression "(undefined4 *)0x0" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* 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  char cVar2;\n  int *piVar3;\n  int iVar4;\n  \n  cVar2 = is_open((__basic_file<char> *)param_1);\n  if ((cVar2 != '\x01') && (param_2 != ~(_S_ios_openmode_min|_S_ios_openmode_max))) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush((FILE *)param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        param_1->_flags = param_2;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (_IO_FILE *)0x0;\n}\n\n" comment 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  char cVar2;\n  int *piVar3;\n  int iVar4;\n  \n  cVar2 = is_open((__basic_file<char> *)param_1);\n  if ((cVar2 != '\x01') && (param_2 != ~(_S_ios_openmode_min|_S_ios_openmode_max))) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush((FILE *)param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        param_1->_flags = param_2;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (_IO_FILE *)0x0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "char cVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type 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') && (param_2 != ~(_S_ios_openmode_min|_S_ios_openmode_max))) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush((FILE *)param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        param_1->_flags = param_2;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }" if (parenthesized_expression "((cVar2 != '\x01') && (param_2 != ~(_S_ios_openmode_min|_S_ios_openmode_max)))" ( (binary_expression "(cVar2 != '\x01') && (param_2 != ~(_S_ios_openmode_min|_S_ios_openmode_max))" (parenthesized_expression "(cVar2 != '\x01')" ( (binary_expression "cVar2 != '\x01'" identifier != (char_literal "'\x01'" ' escape_sequence ')) )) && (parenthesized_expression "(param_2 != ~(_S_ios_openmode_min|_S_ios_openmode_max))" ( (binary_expression "param_2 != ~(_S_ios_openmode_min|_S_ios_openmode_max)" identifier != (unary_expression "~(_S_ios_openmode_min|_S_ios_openmode_max)" ~ (parenthesized_expression "(_S_ios_openmode_min|_S_ios_openmode_max)" ( (binary_expression "_S_ios_openmode_min|_S_ios_openmode_max" identifier | identifier) )))) ))) )) (compound_statement "{\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush((FILE *)param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        param_1->_flags = param_2;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }" { (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar3;" (assignment_expression "iVar1 = *piVar3" identifier = (pointer_expression "*piVar3" * identifier)) ;) (expression_statement "*piVar3 = 0;" (assignment_expression "*piVar3 = 0" (pointer_expression "*piVar3" * identifier) = number_literal) ;) (do_statement "do {\n      iVar4 = fflush((FILE *)param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        param_1->_flags = param_2;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);" do (compound_statement "{\n      iVar4 = fflush((FILE *)param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        param_1->_flags = param_2;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }\n    }" { (expression_statement "iVar4 = fflush((FILE *)param_2);" (assignment_expression "iVar4 = fflush((FILE *)param_2)" identifier = (call_expression "fflush((FILE *)param_2)" identifier (argument_list "((FILE *)param_2)" ( (cast_expression "(FILE *)param_2" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier) )))) ;) (if_statement "if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        param_1->_flags = param_2;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }" if (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) )) (compound_statement "{\n        *piVar3 = iVar1;\n        param_1->_flags = param_2;\n        *(undefined1 *)&param_1->_IO_read_ptr = 0;\n        return param_1;\n      }" { (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * identifier) = identifier) ;) (expression_statement "param_1->_flags = param_2;" (assignment_expression "param_1->_flags = param_2" (field_expression "param_1->_flags" identifier -> field_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 "(*piVar3 == 4)" ( (binary_expression "*piVar3 == 4" (pointer_expression "*piVar3" * identifier) == number_literal) )) ;) (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * 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 "undefined4 * FUN_001e73f0(undefined4 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int *piVar3;\n  int iVar4;\n  \n  cVar2 = FUN_001e73e0(param_1);\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (undefined4 *)0x0;\n}\n\n" (function_definition "undefined4 * FUN_001e73f0(undefined4 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int *piVar3;\n  int iVar4;\n  \n  cVar2 = FUN_001e73e0(param_1);\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (undefined4 *)0x0;\n}" type_identifier (pointer_declarator "* FUN_001e73f0(undefined4 *param_1,FILE *param_2)" * (function_declarator "FUN_001e73f0(undefined4 *param_1,FILE *param_2)" identifier (parameter_list "(undefined4 *param_1,FILE *param_2)" ( (parameter_declaration "undefined4 *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 *piVar3;\n  int iVar4;\n  \n  cVar2 = FUN_001e73e0(param_1);\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (undefined4 *)0x0;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "char cVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (expression_statement "cVar2 = FUN_001e73e0(param_1);" (assignment_expression "cVar2 = FUN_001e73e0(param_1)" identifier = (call_expression "FUN_001e73e0(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = 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    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }" { (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar3;" (assignment_expression "iVar1 = *piVar3" identifier = (pointer_expression "*piVar3" * identifier)) ;) (expression_statement "*piVar3 = 0;" (assignment_expression "*piVar3 = 0" (pointer_expression "*piVar3" * identifier) = number_literal) ;) (do_statement "do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);" do (compound_statement "{\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    }" { (expression_statement "iVar4 = fflush(param_2);" (assignment_expression "iVar4 = fflush(param_2)" identifier = (call_expression "fflush(param_2)" identifier (argument_list "(param_2)" ( identifier )))) ;) (if_statement "if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" if (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) )) (compound_statement "{\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" { (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * 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 "(*piVar3 == 4)" ( (binary_expression "*piVar3 == 4" (pointer_expression "*piVar3" * identifier) == number_literal) )) ;) (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * identifier) = identifier) ;) })) (return_statement "return (undefined4 *)0x0;" return (cast_expression "(undefined4 *)0x0" ( (type_descriptor "undefined4 *" 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 (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (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 "undefined4 * FUN_001e73f0(undefined4 *param_1,FILE *param_2)\n\n{\n  int iVar1;\n  char cVar2;\n  int *piVar3;\n  int iVar4;\n  \n  cVar2 = FUN_001e73e0(param_1);\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (undefined4 *)0x0;\n}" (type_identifier "undefined4") (pointer_declarator "* FUN_001e73f0(undefined4 *param_1,FILE *param_2)" (* "*") (function_declarator "FUN_001e73f0(undefined4 *param_1,FILE *param_2)" (identifier "FUN_001e73f0") (parameter_list "(undefined4 *param_1,FILE *param_2)" (( "(") (parameter_declaration "undefined4 *param_1" (type_identifier "undefined4") (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 *piVar3;\n  int iVar4;\n  \n  cVar2 = FUN_001e73e0(param_1);\n  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }\n  return (undefined4 *)0x0;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "char cVar2;" (primitive_type "char") (identifier "cVar2") (; ";")) (declaration "int *piVar3;" (primitive_type "int") (pointer_declarator "*piVar3" (* "*") (identifier "piVar3")) (; ";")) (declaration "int iVar4;" (primitive_type "int") (identifier "iVar4") (; ";")) (expression_statement "cVar2 = FUN_001e73e0(param_1);" (assignment_expression "cVar2 = FUN_001e73e0(param_1)" (identifier "cVar2") (= "=") (call_expression "FUN_001e73e0(param_1)" (identifier "FUN_001e73e0") (argument_list "(param_1)" (( "(") (identifier "param_1") () ")")))) (; ";")) (if_statement "if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {\n    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = 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    piVar3 = __errno_location();\n    iVar1 = *piVar3;\n    *piVar3 = 0;\n    do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);\n    *piVar3 = iVar1;\n  }" ({ "{") (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" (identifier "piVar3") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar1 = *piVar3;" (assignment_expression "iVar1 = *piVar3" (identifier "iVar1") (= "=") (pointer_expression "*piVar3" (* "*") (identifier "piVar3"))) (; ";")) (expression_statement "*piVar3 = 0;" (assignment_expression "*piVar3 = 0" (pointer_expression "*piVar3" (* "*") (identifier "piVar3")) (= "=") (number_literal "0")) (; ";")) (do_statement "do {\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    } while (*piVar3 == 4);" (do "do") (compound_statement "{\n      iVar4 = fflush(param_2);\n      if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }\n    }" ({ "{") (expression_statement "iVar4 = fflush(param_2);" (assignment_expression "iVar4 = fflush(param_2)" (identifier "iVar4") (= "=") (call_expression "fflush(param_2)" (identifier "fflush") (argument_list "(param_2)" (( "(") (identifier "param_2") () ")")))) (; ";")) (if_statement "if (iVar4 == 0) {\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" (if "if") (parenthesized_expression "(iVar4 == 0)" (( "(") (binary_expression "iVar4 == 0" (identifier "iVar4") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        *piVar3 = iVar1;\n        *param_1 = param_2;\n        *(undefined1 *)(param_1 + 1) = 0;\n        return param_1;\n      }" ({ "{") (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" (* "*") (identifier "piVar3")) (= "=") (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 "(*piVar3 == 4)" (( "(") (binary_expression "*piVar3 == 4" (pointer_expression "*piVar3" (* "*") (identifier "piVar3")) (== "==") (number_literal "4")) () ")")) (; ";")) (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" (* "*") (identifier "piVar3")) (= "=") (identifier "iVar1")) (; ";")) (} "}"))) (return_statement "return (undefined4 *)0x0;" (return "return") (cast_expression "(undefined4 *)0x0" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* std::__basic_file<char>::sys_open(_IO_FILE*, std::_Ios_Openmode) */

type_3 * std::var_2<var_3>::sys_open(type_3 *param_1,_Ios_Openmode var_5)

{
  int iVar1;
  char var_4;
  int *piVar3;
  int var_10;
  
  var_4 = var_1((var_2<var_3> *)param_1);
  if ((var_4 != '\x01') && (var_5 != ~(var_6|var_7))) {
    piVar3 = var_8();
    iVar1 = *piVar3;
    *piVar3 = 0;
    do {
      var_10 = var_9((type_1 *)var_5);
      if (var_10 == 0) {
        *piVar3 = iVar1;
        param_1->_flags = var_5;
        *(type_2 *)&param_1->_IO_read_ptr = 0;
        return param_1;
      }
    } while (*piVar3 == 4);
    *piVar3 = iVar1;
  }
  return (type_3 *)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: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (identifier)) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier))))) (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))))))

/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

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

{
  int iVar1;
  char cVar2;
  int *piVar3;
  int iVar4;
  
  cVar2 = FUN_001e73e0(param_1);
  if ((cVar2 != '\x01') && (param_2 != (FILE *)0x0)) {
    piVar3 = __errno_location();
    iVar1 = *piVar3;
    *piVar3 = 0;
    do {
      iVar4 = fflush(param_2);
      if (iVar4 == 0) {
        *piVar3 = iVar1;
        *param_1 = param_2;
        *(undefined1 *)(param_1 + 1) = 0;
        return param_1;
      }
    } while (*piVar3 == 4);
    *piVar3 = iVar1;
  }
  return (undefined4 *)0x0;
}

