
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */

int open_cloexec(char *path,int flags,...)

{
  int iVar1;
  int iVar2;
  undefined4 uVar3;
  undefined4 in_stack_0000000c;
  
  uVar3 = 0;
  if ((flags & 0x40U) != 0) {
    uVar3 = in_stack_0000000c;
  }
  if (!open_cloexec::cloexec_status_known) {
    iVar1 = open_safer("/",0x80000);
    if (iVar1 < 0) {
      open_cloexec::cloexec_status_known = true;
      open_cloexec::cloexec_works = false;
    }
    else {
      iVar2 = rpl_fcntl(iVar1,1);
      close(iVar1);
      open_cloexec::cloexec_status_known = true;
      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);
    }
  }
  iVar1 = open_safer(path,flags | 0x80000,uVar3);
  if ((-1 < iVar1) && (open_cloexec::cloexec_works == false)) {
    set_cloexec_flag(iVar1,true);
    return iVar1;
  }
  return iVar1;
}



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

int FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)

{
  byte bVar1;
  int iVar2;
  undefined4 uVar3;
  
  uVar3 = 0;
  if ((param_2 & 0x40) != 0) {
    uVar3 = param_3;
  }
  if (DAT_00028161 == '\0') {
    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);
    if (iVar2 < 0) {
      DAT_00028161 = '\x01';
      DAT_00028160 = 0;
    }
    else {
      bVar1 = FUN_0001cad0(iVar2,1);
      close(iVar2);
      DAT_00028161 = '\x01';
      DAT_00028160 = bVar1 & 1;
    }
  }
  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);
  if ((-1 < iVar2) && (DAT_00028160 == 0)) {
    FUN_00016a40(iVar2,1);
    return iVar2;
  }
  return iVar2;
}


PUSH EBP
PUSH EDI
MOV EDI,0x0
PUSH ESI
PUSH EBX
CALL 0x00013670
ADD EBX,0x11b66
SUB ESP,0x1c
MOV ESI,dword ptr [ESP + 0x34]
TEST ESI,0x40
CMOVNZ EDI,dword ptr [ESP + 0x38]
MOVZX EBP,byte ptr [EBX + 0x2fd]
MOV EAX,EBP
TEST AL,AL
JZ 0x00016358
SUB ESP,0x4
OR ESI,0x80000
PUSH EDI
PUSH ESI
PUSH dword ptr [ESP + 0x3c]
CALL 0x00016e10
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JS 0x00016349
CMP byte ptr [EBX + 0x2fc],0x0
JZ 0x00016388
ADD ESP,0x1c
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x8
LEA EAX,[EBX + 0xffff8fb2]
PUSH 0x80000
PUSH EAX
CALL 0x00016e10
ADD ESP,0x10
TEST EAX,EAX
JNS 0x000163a0
MOV EAX,EBP
MOV byte ptr [EBX + 0x2fd],0x1
MOV byte ptr [EBX + 0x2fc],AL
JMP 0x00016323
SUB ESP,0x8
PUSH 0x1
PUSH EAX
CALL 0x00016a40
ADD ESP,0x10
MOV EAX,ESI
ADD ESP,0x1c
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x8
PUSH 0x1
PUSH EAX
MOV dword ptr [ESP + 0x1c],EAX
CALL 0x0001cad0
MOV EDX,dword ptr [ESP + 0x1c]
MOV EBP,EAX
AND EBP,0x1
MOV dword ptr [ESP],EDX
CALL 0x00012510
MOV EAX,EBP
ADD ESP,0x10
MOV byte ptr [EBX + 0x2fd],0x1
MOV byte ptr [EBX + 0x2fc],AL
JMP 0x00016323
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)\n\n{\n  byte bVar1;\n  int iVar2;\n  undefined4 uVar3;\n  \n  uVar3 = 0;\n  if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }\n  if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }\n  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);\n  if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }\n  return iVar2;\n}\n\n" comment (function_definition "int FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)\n\n{\n  byte bVar1;\n  int iVar2;\n  undefined4 uVar3;\n  \n  uVar3 = 0;\n  if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }\n  if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }\n  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);\n  if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }\n  return iVar2;\n}" primitive_type (function_declarator "FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)" identifier (parameter_list "(undefined4 param_1,uint param_2,undefined4 param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) ))) (compound_statement "{\n  byte bVar1;\n  int iVar2;\n  undefined4 uVar3;\n  \n  uVar3 = 0;\n  if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }\n  if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }\n  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);\n  if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }\n  return iVar2;\n}" { (declaration "byte bVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "undefined4 uVar3;" type_identifier identifier ;) (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" identifier = number_literal) ;) (if_statement "if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }" if (parenthesized_expression "((param_2 & 0x40) != 0)" ( (binary_expression "(param_2 & 0x40) != 0" (parenthesized_expression "(param_2 & 0x40)" ( (binary_expression "param_2 & 0x40" identifier & number_literal) )) != number_literal) )) (compound_statement "{\n    uVar3 = param_3;\n  }" { (expression_statement "uVar3 = param_3;" (assignment_expression "uVar3 = param_3" identifier = identifier) ;) })) (if_statement "if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }" if (parenthesized_expression "(DAT_00028161 == '\0')" ( (binary_expression "DAT_00028161 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }" { (expression_statement "iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);" (assignment_expression "iVar2 = FUN_00016e10(&DAT_00020e16,0x80000)" identifier = (call_expression "FUN_00016e10(&DAT_00020e16,0x80000)" identifier (argument_list "(&DAT_00020e16,0x80000)" ( (pointer_expression "&DAT_00020e16" & identifier) , number_literal )))) ;) (if_statement "if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" if (parenthesized_expression "(iVar2 < 0)" ( (binary_expression "iVar2 < 0" identifier < number_literal) )) (compound_statement "{\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }" { (expression_statement "DAT_00028161 = '\x01';" (assignment_expression "DAT_00028161 = '\x01'" identifier = (char_literal "'\x01'" ' escape_sequence ')) ;) (expression_statement "DAT_00028160 = 0;" (assignment_expression "DAT_00028160 = 0" identifier = number_literal) ;) }) (else_clause "else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" else (compound_statement "{\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" { (expression_statement "bVar1 = FUN_0001cad0(iVar2,1);" (assignment_expression "bVar1 = FUN_0001cad0(iVar2,1)" identifier = (call_expression "FUN_0001cad0(iVar2,1)" identifier (argument_list "(iVar2,1)" ( identifier , number_literal )))) ;) (expression_statement "close(iVar2);" (call_expression "close(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "DAT_00028161 = '\x01';" (assignment_expression "DAT_00028161 = '\x01'" identifier = (char_literal "'\x01'" ' escape_sequence ')) ;) (expression_statement "DAT_00028160 = bVar1 & 1;" (assignment_expression "DAT_00028160 = bVar1 & 1" identifier = (binary_expression "bVar1 & 1" identifier & number_literal)) ;) }))) })) (expression_statement "iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);" (assignment_expression "iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3)" identifier = (call_expression "FUN_00016e10(param_1,param_2 | 0x80000,uVar3)" identifier (argument_list "(param_1,param_2 | 0x80000,uVar3)" ( identifier , (binary_expression "param_2 | 0x80000" identifier | number_literal) , identifier )))) ;) (if_statement "if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }" if (parenthesized_expression "((-1 < iVar2) && (DAT_00028160 == 0))" ( (binary_expression "(-1 < iVar2) && (DAT_00028160 == 0)" (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) && (parenthesized_expression "(DAT_00028160 == 0)" ( (binary_expression "DAT_00028160 == 0" identifier == number_literal) ))) )) (compound_statement "{\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }" { (expression_statement "FUN_00016a40(iVar2,1);" (call_expression "FUN_00016a40(iVar2,1)" identifier (argument_list "(iVar2,1)" ( identifier , number_literal ))) ;) (return_statement "return iVar2;" return identifier ;) })) (return_statement "return iVar2;" return identifier ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* WARNING: Unknown calling convention */\n\nint open_cloexec(char *path,int flags,...)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 uVar3;\n  undefined4 in_stack_0000000c;\n  \n  uVar3 = 0;\n  if ((flags & 0x40U) != 0) {\n    uVar3 = in_stack_0000000c;\n  }\n  if (!open_cloexec::cloexec_status_known) {\n    iVar1 = open_safer("/",0x80000);\n    if (iVar1 < 0) {\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = false;\n    }\n    else {\n      iVar2 = rpl_fcntl(iVar1,1);\n      close(iVar1);\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);\n    }\n  }\n  iVar1 = open_safer(path,flags | 0x80000,uVar3);\n  if ((-1 < iVar1) && (open_cloexec::cloexec_works == false)) {\n    set_cloexec_flag(iVar1,true);\n    return iVar1;\n  }\n  return iVar1;\n}\n\n" comment comment (function_definition "int open_cloexec(char *path,int flags,...)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 uVar3;\n  undefined4 in_stack_0000000c;\n  \n  uVar3 = 0;\n  if ((flags & 0x40U) != 0) {\n    uVar3 = in_stack_0000000c;\n  }\n  if (!open_cloexec::cloexec_status_known) {\n    iVar1 = open_safer("/",0x80000);\n    if (iVar1 < 0) {\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = false;\n    }\n    else {\n      iVar2 = rpl_fcntl(iVar1,1);\n      close(iVar1);\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);\n    }\n  }\n  iVar1 = open_safer(path,flags | 0x80000,uVar3);\n  if ((-1 < iVar1) && (open_cloexec::cloexec_works == false)) {\n    set_cloexec_flag(iVar1,true);\n    return iVar1;\n  }\n  return iVar1;\n}" primitive_type (function_declarator "open_cloexec(char *path,int flags,...)" identifier (parameter_list "(char *path,int flags,...)" ( (parameter_declaration "char *path" primitive_type (pointer_declarator "*path" * identifier)) , (parameter_declaration "int flags" primitive_type identifier) , (variadic_parameter "..." ...) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  undefined4 uVar3;\n  undefined4 in_stack_0000000c;\n  \n  uVar3 = 0;\n  if ((flags & 0x40U) != 0) {\n    uVar3 = in_stack_0000000c;\n  }\n  if (!open_cloexec::cloexec_status_known) {\n    iVar1 = open_safer("/",0x80000);\n    if (iVar1 < 0) {\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = false;\n    }\n    else {\n      iVar2 = rpl_fcntl(iVar1,1);\n      close(iVar1);\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);\n    }\n  }\n  iVar1 = open_safer(path,flags | 0x80000,uVar3);\n  if ((-1 < iVar1) && (open_cloexec::cloexec_works == false)) {\n    set_cloexec_flag(iVar1,true);\n    return iVar1;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "undefined4 uVar3;" type_identifier identifier ;) (declaration "undefined4 in_stack_0000000c;" type_identifier identifier ;) (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" identifier = number_literal) ;) (if_statement "if ((flags & 0x40U) != 0) {\n    uVar3 = in_stack_0000000c;\n  }" if (parenthesized_expression "((flags & 0x40U) != 0)" ( (binary_expression "(flags & 0x40U) != 0" (parenthesized_expression "(flags & 0x40U)" ( (binary_expression "flags & 0x40U" identifier & number_literal) )) != number_literal) )) (compound_statement "{\n    uVar3 = in_stack_0000000c;\n  }" { (expression_statement "uVar3 = in_stack_0000000c;" (assignment_expression "uVar3 = in_stack_0000000c" identifier = identifier) ;) })) (if_statement "if (!open_cloexec::cloexec_status_known) {\n    iVar1 = open_safer("/",0x80000);\n    if (iVar1 < 0) {\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = false;\n    }\n    else {\n      iVar2 = rpl_fcntl(iVar1,1);\n      close(iVar1);\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);\n    }\n  }" if (parenthesized_expression "(!open_cloexec::cloexec_status_known)" ( (ERROR "!open_cloexec::" (unary_expression "!open_cloexec" ! identifier) : :) identifier )) (compound_statement "{\n    iVar1 = open_safer("/",0x80000);\n    if (iVar1 < 0) {\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = false;\n    }\n    else {\n      iVar2 = rpl_fcntl(iVar1,1);\n      close(iVar1);\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);\n    }\n  }" { (expression_statement "iVar1 = open_safer("/",0x80000);" (assignment_expression "iVar1 = open_safer("/",0x80000)" identifier = (call_expression "open_safer("/",0x80000)" identifier (argument_list "("/",0x80000)" ( (string_literal ""/"" " string_content ") , number_literal )))) ;) (if_statement "if (iVar1 < 0) {\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = false;\n    }\n    else {\n      iVar2 = rpl_fcntl(iVar1,1);\n      close(iVar1);\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = false;\n    }" { (labeled_statement "open_cloexec::cloexec_status_known = true;" statement_identifier : (ERROR ":" :) (expression_statement "cloexec_status_known = true;" (assignment_expression "cloexec_status_known = true" identifier = true) ;)) (labeled_statement "open_cloexec::cloexec_works = false;" statement_identifier : (ERROR ":" :) (expression_statement "cloexec_works = false;" (assignment_expression "cloexec_works = false" identifier = false) ;)) }) (else_clause "else {\n      iVar2 = rpl_fcntl(iVar1,1);\n      close(iVar1);\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);\n    }" else (compound_statement "{\n      iVar2 = rpl_fcntl(iVar1,1);\n      close(iVar1);\n      open_cloexec::cloexec_status_known = true;\n      open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);\n    }" { (expression_statement "iVar2 = rpl_fcntl(iVar1,1);" (assignment_expression "iVar2 = rpl_fcntl(iVar1,1)" identifier = (call_expression "rpl_fcntl(iVar1,1)" identifier (argument_list "(iVar1,1)" ( identifier , number_literal )))) ;) (expression_statement "close(iVar1);" (call_expression "close(iVar1)" identifier (argument_list "(iVar1)" ( identifier ))) ;) (labeled_statement "open_cloexec::cloexec_status_known = true;" statement_identifier : (ERROR ":" :) (expression_statement "cloexec_status_known = true;" (assignment_expression "cloexec_status_known = true" identifier = true) ;)) (labeled_statement "open_cloexec::cloexec_works = (_Bool)((byte)iVar2 & 1);" statement_identifier : (ERROR ":" :) (expression_statement "cloexec_works = (_Bool)((byte)iVar2 & 1);" (assignment_expression "cloexec_works = (_Bool)((byte)iVar2 & 1)" identifier = (call_expression "(_Bool)((byte)iVar2 & 1)" (parenthesized_expression "(_Bool)" ( identifier )) (argument_list "((byte)iVar2 & 1)" ( (binary_expression "(byte)iVar2 & 1" (cast_expression "(byte)iVar2" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) )))) ;)) }))) })) (expression_statement "iVar1 = open_safer(path,flags | 0x80000,uVar3);" (assignment_expression "iVar1 = open_safer(path,flags | 0x80000,uVar3)" identifier = (call_expression "open_safer(path,flags | 0x80000,uVar3)" identifier (argument_list "(path,flags | 0x80000,uVar3)" ( identifier , (binary_expression "flags | 0x80000" identifier | number_literal) , identifier )))) ;) (if_statement "if ((-1 < iVar1) && (open_cloexec::cloexec_works == false)) {\n    set_cloexec_flag(iVar1,true);\n    return iVar1;\n  }" if (parenthesized_expression "((-1 < iVar1) && (open_cloexec::cloexec_works == false))" ( (binary_expression "(-1 < iVar1) && (open_cloexec::cloexec_works == false)" (parenthesized_expression "(-1 < iVar1)" ( (binary_expression "-1 < iVar1" number_literal < identifier) )) && (parenthesized_expression "(open_cloexec::cloexec_works == false)" ( (ERROR "open_cloexec::" identifier : :) (binary_expression "cloexec_works == false" identifier == false) ))) )) (compound_statement "{\n    set_cloexec_flag(iVar1,true);\n    return iVar1;\n  }" { (expression_statement "set_cloexec_flag(iVar1,true);" (call_expression "set_cloexec_flag(iVar1,true)" identifier (argument_list "(iVar1,true)" ( identifier , true ))) ;) (return_statement "return iVar1;" return identifier ;) })) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "int FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)\n\n{\n  byte bVar1;\n  int iVar2;\n  undefined4 uVar3;\n  \n  uVar3 = 0;\n  if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }\n  if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }\n  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);\n  if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }\n  return iVar2;\n}\n\n" (function_definition "int FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)\n\n{\n  byte bVar1;\n  int iVar2;\n  undefined4 uVar3;\n  \n  uVar3 = 0;\n  if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }\n  if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }\n  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);\n  if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }\n  return iVar2;\n}" primitive_type (function_declarator "FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)" identifier (parameter_list "(undefined4 param_1,uint param_2,undefined4 param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) ))) (compound_statement "{\n  byte bVar1;\n  int iVar2;\n  undefined4 uVar3;\n  \n  uVar3 = 0;\n  if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }\n  if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }\n  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);\n  if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }\n  return iVar2;\n}" { (declaration "byte bVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "undefined4 uVar3;" type_identifier identifier ;) (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" identifier = number_literal) ;) (if_statement "if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }" if (parenthesized_expression "((param_2 & 0x40) != 0)" ( (binary_expression "(param_2 & 0x40) != 0" (parenthesized_expression "(param_2 & 0x40)" ( (binary_expression "param_2 & 0x40" identifier & number_literal) )) != number_literal) )) (compound_statement "{\n    uVar3 = param_3;\n  }" { (expression_statement "uVar3 = param_3;" (assignment_expression "uVar3 = param_3" identifier = identifier) ;) })) (if_statement "if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }" if (parenthesized_expression "(DAT_00028161 == '\0')" ( (binary_expression "DAT_00028161 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }" { (expression_statement "iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);" (assignment_expression "iVar2 = FUN_00016e10(&DAT_00020e16,0x80000)" identifier = (call_expression "FUN_00016e10(&DAT_00020e16,0x80000)" identifier (argument_list "(&DAT_00020e16,0x80000)" ( (pointer_expression "&DAT_00020e16" & identifier) , number_literal )))) ;) (if_statement "if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" if (parenthesized_expression "(iVar2 < 0)" ( (binary_expression "iVar2 < 0" identifier < number_literal) )) (compound_statement "{\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }" { (expression_statement "DAT_00028161 = '\x01';" (assignment_expression "DAT_00028161 = '\x01'" identifier = (char_literal "'\x01'" ' escape_sequence ')) ;) (expression_statement "DAT_00028160 = 0;" (assignment_expression "DAT_00028160 = 0" identifier = number_literal) ;) }) (else_clause "else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" else (compound_statement "{\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" { (expression_statement "bVar1 = FUN_0001cad0(iVar2,1);" (assignment_expression "bVar1 = FUN_0001cad0(iVar2,1)" identifier = (call_expression "FUN_0001cad0(iVar2,1)" identifier (argument_list "(iVar2,1)" ( identifier , number_literal )))) ;) (expression_statement "close(iVar2);" (call_expression "close(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "DAT_00028161 = '\x01';" (assignment_expression "DAT_00028161 = '\x01'" identifier = (char_literal "'\x01'" ' escape_sequence ')) ;) (expression_statement "DAT_00028160 = bVar1 & 1;" (assignment_expression "DAT_00028160 = bVar1 & 1" identifier = (binary_expression "bVar1 & 1" identifier & number_literal)) ;) }))) })) (expression_statement "iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);" (assignment_expression "iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3)" identifier = (call_expression "FUN_00016e10(param_1,param_2 | 0x80000,uVar3)" identifier (argument_list "(param_1,param_2 | 0x80000,uVar3)" ( identifier , (binary_expression "param_2 | 0x80000" identifier | number_literal) , identifier )))) ;) (if_statement "if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }" if (parenthesized_expression "((-1 < iVar2) && (DAT_00028160 == 0))" ( (binary_expression "(-1 < iVar2) && (DAT_00028160 == 0)" (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) && (parenthesized_expression "(DAT_00028160 == 0)" ( (binary_expression "DAT_00028160 == 0" identifier == number_literal) ))) )) (compound_statement "{\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }" { (expression_statement "FUN_00016a40(iVar2,1);" (call_expression "FUN_00016a40(iVar2,1)" identifier (argument_list "(iVar2,1)" ( identifier , number_literal ))) ;) (return_statement "return iVar2;" return identifier ;) })) (return_statement "return iVar2;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT & LIT) )) != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (char_literal ' escape_sequence ')) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (pointer_expression & IDENT) , LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (char_literal ' escape_sequence ')) ;) (expression_statement (assignment_expression IDENT = LIT) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT )))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression IDENT = (char_literal ' escape_sequence ')) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT & LIT)) ;) }))) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , (binary_expression IDENT | LIT) , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression LIT < IDENT) )) && (parenthesized_expression ( (binary_expression IDENT == LIT) ))) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT , LIT ))) ;) (return_statement return IDENT ;) })) (return_statement return IDENT ;) })))
(function_definition "int FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)\n\n{\n  byte bVar1;\n  int iVar2;\n  undefined4 uVar3;\n  \n  uVar3 = 0;\n  if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }\n  if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }\n  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);\n  if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }\n  return iVar2;\n}" (primitive_type "int") (function_declarator "FUN_000162f0(undefined4 param_1,uint param_2,undefined4 param_3)" (identifier "FUN_000162f0") (parameter_list "(undefined4 param_1,uint param_2,undefined4 param_3)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (identifier "param_1")) (, ",") (parameter_declaration "uint param_2" (type_identifier "uint") (identifier "param_2")) (, ",") (parameter_declaration "undefined4 param_3" (type_identifier "undefined4") (identifier "param_3")) () ")"))) (compound_statement "{\n  byte bVar1;\n  int iVar2;\n  undefined4 uVar3;\n  \n  uVar3 = 0;\n  if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }\n  if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }\n  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);\n  if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }\n  return iVar2;\n}" ({ "{") (declaration "byte bVar1;" (type_identifier "byte") (identifier "bVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "undefined4 uVar3;" (type_identifier "undefined4") (identifier "uVar3") (; ";")) (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" (identifier "uVar3") (= "=") (number_literal "0")) (; ";")) (if_statement "if ((param_2 & 0x40) != 0) {\n    uVar3 = param_3;\n  }" (if "if") (parenthesized_expression "((param_2 & 0x40) != 0)" (( "(") (binary_expression "(param_2 & 0x40) != 0" (parenthesized_expression "(param_2 & 0x40)" (( "(") (binary_expression "param_2 & 0x40" (identifier "param_2") (& "&") (number_literal "0x40")) () ")")) (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    uVar3 = param_3;\n  }" ({ "{") (expression_statement "uVar3 = param_3;" (assignment_expression "uVar3 = param_3" (identifier "uVar3") (= "=") (identifier "param_3")) (; ";")) (} "}"))) (if_statement "if (DAT_00028161 == '\0') {\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }" (if "if") (parenthesized_expression "(DAT_00028161 == '\0')" (( "(") (binary_expression "DAT_00028161 == '\0'" (identifier "DAT_00028161") (== "==") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);\n    if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }\n  }" ({ "{") (expression_statement "iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);" (assignment_expression "iVar2 = FUN_00016e10(&DAT_00020e16,0x80000)" (identifier "iVar2") (= "=") (call_expression "FUN_00016e10(&DAT_00020e16,0x80000)" (identifier "FUN_00016e10") (argument_list "(&DAT_00020e16,0x80000)" (( "(") (pointer_expression "&DAT_00020e16" (& "&") (identifier "DAT_00020e16")) (, ",") (number_literal "0x80000") () ")")))) (; ";")) (if_statement "if (iVar2 < 0) {\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }\n    else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" (if "if") (parenthesized_expression "(iVar2 < 0)" (( "(") (binary_expression "iVar2 < 0" (identifier "iVar2") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n      DAT_00028161 = '\x01';\n      DAT_00028160 = 0;\n    }" ({ "{") (expression_statement "DAT_00028161 = '\x01';" (assignment_expression "DAT_00028161 = '\x01'" (identifier "DAT_00028161") (= "=") (char_literal "'\x01'" (' "'") (escape_sequence "\x01") (' "'"))) (; ";")) (expression_statement "DAT_00028160 = 0;" (assignment_expression "DAT_00028160 = 0" (identifier "DAT_00028160") (= "=") (number_literal "0")) (; ";")) (} "}")) (else_clause "else {\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" (else "else") (compound_statement "{\n      bVar1 = FUN_0001cad0(iVar2,1);\n      close(iVar2);\n      DAT_00028161 = '\x01';\n      DAT_00028160 = bVar1 & 1;\n    }" ({ "{") (expression_statement "bVar1 = FUN_0001cad0(iVar2,1);" (assignment_expression "bVar1 = FUN_0001cad0(iVar2,1)" (identifier "bVar1") (= "=") (call_expression "FUN_0001cad0(iVar2,1)" (identifier "FUN_0001cad0") (argument_list "(iVar2,1)" (( "(") (identifier "iVar2") (, ",") (number_literal "1") () ")")))) (; ";")) (expression_statement "close(iVar2);" (call_expression "close(iVar2)" (identifier "close") (argument_list "(iVar2)" (( "(") (identifier "iVar2") () ")"))) (; ";")) (expression_statement "DAT_00028161 = '\x01';" (assignment_expression "DAT_00028161 = '\x01'" (identifier "DAT_00028161") (= "=") (char_literal "'\x01'" (' "'") (escape_sequence "\x01") (' "'"))) (; ";")) (expression_statement "DAT_00028160 = bVar1 & 1;" (assignment_expression "DAT_00028160 = bVar1 & 1" (identifier "DAT_00028160") (= "=") (binary_expression "bVar1 & 1" (identifier "bVar1") (& "&") (number_literal "1"))) (; ";")) (} "}")))) (} "}"))) (expression_statement "iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);" (assignment_expression "iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3)" (identifier "iVar2") (= "=") (call_expression "FUN_00016e10(param_1,param_2 | 0x80000,uVar3)" (identifier "FUN_00016e10") (argument_list "(param_1,param_2 | 0x80000,uVar3)" (( "(") (identifier "param_1") (, ",") (binary_expression "param_2 | 0x80000" (identifier "param_2") (| "|") (number_literal "0x80000")) (, ",") (identifier "uVar3") () ")")))) (; ";")) (if_statement "if ((-1 < iVar2) && (DAT_00028160 == 0)) {\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }" (if "if") (parenthesized_expression "((-1 < iVar2) && (DAT_00028160 == 0))" (( "(") (binary_expression "(-1 < iVar2) && (DAT_00028160 == 0)" (parenthesized_expression "(-1 < iVar2)" (( "(") (binary_expression "-1 < iVar2" (number_literal "-1") (< "<") (identifier "iVar2")) () ")")) (&& "&&") (parenthesized_expression "(DAT_00028160 == 0)" (( "(") (binary_expression "DAT_00028160 == 0" (identifier "DAT_00028160") (== "==") (number_literal "0")) () ")"))) () ")")) (compound_statement "{\n    FUN_00016a40(iVar2,1);\n    return iVar2;\n  }" ({ "{") (expression_statement "FUN_00016a40(iVar2,1);" (call_expression "FUN_00016a40(iVar2,1)" (identifier "FUN_00016a40") (argument_list "(iVar2,1)" (( "(") (identifier "iVar2") (, ",") (number_literal "1") () ")"))) (; ";")) (return_statement "return iVar2;" (return "return") (identifier "iVar2") (; ";")) (} "}"))) (return_statement "return iVar2;" (return "return") (identifier "iVar2") (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */

int function_1(char *path,int var_1,...)

{
  int var_3;
  int iVar2;
  type_1 uVar3;
  type_1 in_stack_0000000c;
  
  uVar3 = 0;
  if ((var_1 & 0x40U) != 0) {
    uVar3 = in_stack_0000000c;
  }
  if (!function_1::cloexec_status_known) {
    var_3 = var_2("/",0x80000);
    if (var_3 < 0) {
      open_cloexec::cloexec_status_known = true;
      open_cloexec::var_6 = false;
    }
    else {
      iVar2 = var_4(var_3,1);
      var_5(var_3);
      open_cloexec::cloexec_status_known = true;
      open_cloexec::var_6 = (_Bool)((type_2)iVar2 & 1);
    }
  }
  var_3 = var_2(path,var_1 | 0x80000,uVar3);
  if ((-1 < var_3) && (function_1::var_6 == false)) {
    var_7(var_3,true);
    return var_3;
  }
  return var_3;
}


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

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

int MASKED(undefined4 param_1,uint param_2,undefined4 param_3)

{
  byte bVar1;
  int iVar2;
  undefined4 uVar3;
  
  uVar3 = 0;
  if ((param_2 & 0x40) != 0) {
    uVar3 = param_3;
  }
  if (DAT_00028161 == '\0') {
    iVar2 = FUN_00016e10(&DAT_00020e16,0x80000);
    if (iVar2 < 0) {
      DAT_00028161 = '\x01';
      DAT_00028160 = 0;
    }
    else {
      bVar1 = FUN_0001cad0(iVar2,1);
      close(iVar2);
      DAT_00028161 = '\x01';
      DAT_00028160 = bVar1 & 1;
    }
  }
  iVar2 = FUN_00016e10(param_1,param_2 | 0x80000,uVar3);
  if ((-1 < iVar2) && (DAT_00028160 == 0)) {
    FUN_00016a40(iVar2,1);
    return iVar2;
  }
  return iVar2;
}

