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

int rpl_fcntl(int fd,int action,...)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  int *piVar4;
  int target;
  undefined4 in_stack_0000000c;
  
  if (action != 0x406) {
    iVar1 = fcntl64(fd,action,in_stack_0000000c);
    return iVar1;
  }
  if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec < 0) {
    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);
    if (iVar1 < 0) {
      return iVar1;
    }
    if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec != -1) {
      return iVar1;
    }
  }
  else {
    iVar1 = fcntl64(fd,0x406,in_stack_0000000c);
    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {
      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;
      return iVar1;
    }
    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);
    if (iVar1 < 0) {
      return iVar1;
    }
    rpl_fcntl::lexical_block_5::have_dupfd_cloexec = -1;
  }
  uVar2 = fcntl64(iVar1,1);
  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {
    return iVar1;
  }
  piVar4 = __errno_location();
  iVar3 = *piVar4;
  close(iVar1);
  *piVar4 = iVar3;
  return -1;
}



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

int FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  int *piVar4;
  
  if (param_2 != 0x406) {
    iVar1 = fcntl64(param_1,param_2,param_3);
    return iVar1;
  }
  if (DAT_0003d904 < 0) {
    iVar1 = FUN_00024aa0(param_1,0,param_3);
    if (iVar1 < 0) {
      return iVar1;
    }
    if (DAT_0003d904 != -1) {
      return iVar1;
    }
  }
  else {
    iVar1 = fcntl64(param_1,0x406,param_3);
    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {
      DAT_0003d904 = 1;
      return iVar1;
    }
    iVar1 = FUN_00024aa0(param_1,0,param_3);
    if (iVar1 < 0) {
      return iVar1;
    }
    DAT_0003d904 = -1;
  }
  uVar2 = fcntl64(iVar1,1);
  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {
    return iVar1;
  }
  piVar4 = __errno_location();
  iVar3 = *piVar4;
  close(iVar1);
  *piVar4 = iVar3;
  return -1;
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00013950
ADD EBX,0x16557
SUB ESP,0xc
MOV EAX,dword ptr [ESP + 0x24]
MOV EDI,dword ptr [ESP + 0x20]
CMP EAX,0x406
JNZ 0x00024b70
MOV EAX,dword ptr [EBX + 0x2904]
MOV EBP,dword ptr [ESP + 0x28]
TEST EAX,EAX
JS 0x00024b08
SUB ESP,0x4
PUSH EBP
PUSH 0x406
PUSH EDI
CALL 0x000126f0
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JS 0x00024b90
MOV dword ptr [EBX + 0x2904],0x1
ADD ESP,0xc
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x4
PUSH EBP
PUSH 0x0
PUSH EDI
CALL 0x00024aa0
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JS 0x00024af9
CMP dword ptr [EBX + 0x2904],-0x1
JNZ 0x00024af9
SUB ESP,0x8
PUSH 0x1
PUSH ESI
CALL 0x000126f0
ADD ESP,0x10
TEST EAX,EAX
JS 0x00024b4f
SUB ESP,0x4
OR EAX,0x1
PUSH EAX
PUSH 0x2
PUSH ESI
CALL 0x000126f0
ADD ESP,0x10
CMP EAX,-0x1
JNZ 0x00024af9
CALL 0x00012640
SUB ESP,0xc
MOV EBP,dword ptr [EAX]
PUSH ESI
MOV EDI,EAX
MOV ESI,0xffffffff
CALL 0x000129b0
MOV dword ptr [EDI],EBP
ADD ESP,0x10
JMP 0x00024af9
SUB ESP,0x4
PUSH dword ptr [ESP + 0x2c]
PUSH EAX
PUSH EDI
CALL 0x000126f0
ADD ESP,0x10
ADD ESP,0xc
MOV ESI,EAX
POP EBX
MOV EAX,ESI
POP ESI
POP EDI
POP EBP
RET
CALL 0x00012640
CMP dword ptr [EAX],0x16
JNZ 0x00024aef
SUB ESP,0x4
PUSH EBP
PUSH 0x0
PUSH EDI
CALL 0x00024aa0
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JS 0x00024af9
MOV dword ptr [EBX + 0x2904],0xffffffff
JMP 0x00024b26
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  \n  if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }\n  if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}\n\n" comment (function_definition "int FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  \n  if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }\n  if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}" primitive_type (function_declarator "FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)" identifier (parameter_list "(undefined4 param_1,int param_2,undefined4 param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "int param_2" primitive_type identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  \n  if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }\n  if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (if_statement "if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }" if (parenthesized_expression "(param_2 != 0x406)" ( (binary_expression "param_2 != 0x406" identifier != number_literal) )) (compound_statement "{\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }" { (expression_statement "iVar1 = fcntl64(param_1,param_2,param_3);" (assignment_expression "iVar1 = fcntl64(param_1,param_2,param_3)" identifier = (call_expression "fcntl64(param_1,param_2,param_3)" identifier (argument_list "(param_1,param_2,param_3)" ( identifier , identifier , identifier )))) ;) (return_statement "return iVar1;" return identifier ;) })) (if_statement "if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" if (parenthesized_expression "(DAT_0003d904 < 0)" ( (binary_expression "DAT_0003d904 < 0" identifier < number_literal) )) (compound_statement "{\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }" { (expression_statement "iVar1 = FUN_00024aa0(param_1,0,param_3);" (assignment_expression "iVar1 = FUN_00024aa0(param_1,0,param_3)" identifier = (call_expression "FUN_00024aa0(param_1,0,param_3)" identifier (argument_list "(param_1,0,param_3)" ( identifier , number_literal , identifier )))) ;) (if_statement "if (iVar1 < 0) {\n      return iVar1;\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) (if_statement "if (DAT_0003d904 != -1) {\n      return iVar1;\n    }" if (parenthesized_expression "(DAT_0003d904 != -1)" ( (binary_expression "DAT_0003d904 != -1" identifier != number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) }) (else_clause "else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" else (compound_statement "{\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" { (expression_statement "iVar1 = fcntl64(param_1,0x406,param_3);" (assignment_expression "iVar1 = fcntl64(param_1,0x406,param_3)" identifier = (call_expression "fcntl64(param_1,0x406,param_3)" identifier (argument_list "(param_1,0x406,param_3)" ( identifier , number_literal , identifier )))) ;) (if_statement "if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }" if (parenthesized_expression "((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16))" ( (binary_expression "(-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)" (parenthesized_expression "(-1 < iVar1)" ( (binary_expression "-1 < iVar1" number_literal < identifier) )) || (parenthesized_expression "(piVar4 = __errno_location(), *piVar4 != 0x16)" ( (comma_expression "piVar4 = __errno_location(), *piVar4 != 0x16" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) , (binary_expression "*piVar4 != 0x16" (pointer_expression "*piVar4" * identifier) != number_literal)) ))) )) (compound_statement "{\n      DAT_0003d904 = 1;\n      return iVar1;\n    }" { (expression_statement "DAT_0003d904 = 1;" (assignment_expression "DAT_0003d904 = 1" identifier = number_literal) ;) (return_statement "return iVar1;" return identifier ;) })) (expression_statement "iVar1 = FUN_00024aa0(param_1,0,param_3);" (assignment_expression "iVar1 = FUN_00024aa0(param_1,0,param_3)" identifier = (call_expression "FUN_00024aa0(param_1,0,param_3)" identifier (argument_list "(param_1,0,param_3)" ( identifier , number_literal , identifier )))) ;) (if_statement "if (iVar1 < 0) {\n      return iVar1;\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) (expression_statement "DAT_0003d904 = -1;" (assignment_expression "DAT_0003d904 = -1" identifier = number_literal) ;) }))) (expression_statement "uVar2 = fcntl64(iVar1,1);" (assignment_expression "uVar2 = fcntl64(iVar1,1)" identifier = (call_expression "fcntl64(iVar1,1)" identifier (argument_list "(iVar1,1)" ( identifier , number_literal )))) ;) (if_statement "if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }" if (parenthesized_expression "((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1))" ( (binary_expression "(-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)" (parenthesized_expression "(-1 < (int)uVar2)" ( (binary_expression "-1 < (int)uVar2" number_literal < (cast_expression "(int)uVar2" ( (type_descriptor "int" primitive_type) ) identifier)) )) && (parenthesized_expression "(iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)" ( (comma_expression "iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1" (assignment_expression "iVar3 = fcntl64(iVar1,2,uVar2 | 1)" identifier = (call_expression "fcntl64(iVar1,2,uVar2 | 1)" identifier (argument_list "(iVar1,2,uVar2 | 1)" ( identifier , number_literal , (binary_expression "uVar2 | 1" identifier | number_literal) )))) , (binary_expression "iVar3 != -1" identifier != number_literal)) ))) )) (compound_statement "{\n    return iVar1;\n  }" { (return_statement "return iVar1;" return identifier ;) })) (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar4;" (assignment_expression "iVar3 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "close(iVar1);" (call_expression "close(iVar1)" identifier (argument_list "(iVar1)" ( identifier ))) ;) (expression_statement "*piVar4 = iVar3;" (assignment_expression "*piVar4 = iVar3" (pointer_expression "*piVar4" * identifier) = identifier) ;) (return_statement "return -1;" return number_literal ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* WARNING: Unknown calling convention */\n\nint rpl_fcntl(int fd,int action,...)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  int target;\n  undefined4 in_stack_0000000c;\n  \n  if (action != 0x406) {\n    iVar1 = fcntl64(fd,action,in_stack_0000000c);\n    return iVar1;\n  }\n  if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec < 0) {\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(fd,0x406,in_stack_0000000c);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;\n      return iVar1;\n    }\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    rpl_fcntl::lexical_block_5::have_dupfd_cloexec = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}\n\n" comment comment (function_definition "int rpl_fcntl(int fd,int action,...)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  int target;\n  undefined4 in_stack_0000000c;\n  \n  if (action != 0x406) {\n    iVar1 = fcntl64(fd,action,in_stack_0000000c);\n    return iVar1;\n  }\n  if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec < 0) {\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(fd,0x406,in_stack_0000000c);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;\n      return iVar1;\n    }\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    rpl_fcntl::lexical_block_5::have_dupfd_cloexec = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}" primitive_type (function_declarator "rpl_fcntl(int fd,int action,...)" identifier (parameter_list "(int fd,int action,...)" ( (parameter_declaration "int fd" primitive_type identifier) , (parameter_declaration "int action" primitive_type identifier) , (variadic_parameter "..." ...) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  int target;\n  undefined4 in_stack_0000000c;\n  \n  if (action != 0x406) {\n    iVar1 = fcntl64(fd,action,in_stack_0000000c);\n    return iVar1;\n  }\n  if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec < 0) {\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(fd,0x406,in_stack_0000000c);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;\n      return iVar1;\n    }\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    rpl_fcntl::lexical_block_5::have_dupfd_cloexec = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (declaration "int target;" primitive_type identifier ;) (declaration "undefined4 in_stack_0000000c;" type_identifier identifier ;) (if_statement "if (action != 0x406) {\n    iVar1 = fcntl64(fd,action,in_stack_0000000c);\n    return iVar1;\n  }" if (parenthesized_expression "(action != 0x406)" ( (binary_expression "action != 0x406" identifier != number_literal) )) (compound_statement "{\n    iVar1 = fcntl64(fd,action,in_stack_0000000c);\n    return iVar1;\n  }" { (expression_statement "iVar1 = fcntl64(fd,action,in_stack_0000000c);" (assignment_expression "iVar1 = fcntl64(fd,action,in_stack_0000000c)" identifier = (call_expression "fcntl64(fd,action,in_stack_0000000c)" identifier (argument_list "(fd,action,in_stack_0000000c)" ( identifier , identifier , identifier )))) ;) (return_statement "return iVar1;" return identifier ;) })) (if_statement "if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec < 0) {\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(fd,0x406,in_stack_0000000c);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;\n      return iVar1;\n    }\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    rpl_fcntl::lexical_block_5::have_dupfd_cloexec = -1;\n  }" if (parenthesized_expression "(rpl_fcntl::lexical_block_5::have_dupfd_cloexec < 0)" ( (ERROR "rpl_fcntl::lexical_block_5::" identifier : : identifier : :) (binary_expression "have_dupfd_cloexec < 0" identifier < number_literal) )) (compound_statement "{\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec != -1) {\n      return iVar1;\n    }\n  }" { (expression_statement "iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);" (assignment_expression "iVar1 = rpl_fcntl(fd,0,in_stack_0000000c)" identifier = (call_expression "rpl_fcntl(fd,0,in_stack_0000000c)" identifier (argument_list "(fd,0,in_stack_0000000c)" ( identifier , number_literal , identifier )))) ;) (if_statement "if (iVar1 < 0) {\n      return iVar1;\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) (if_statement "if (rpl_fcntl::lexical_block_5::have_dupfd_cloexec != -1) {\n      return iVar1;\n    }" if (parenthesized_expression "(rpl_fcntl::lexical_block_5::have_dupfd_cloexec != -1)" ( (ERROR "rpl_fcntl::lexical_block_5::" identifier : : identifier : :) (binary_expression "have_dupfd_cloexec != -1" identifier != number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) }) (else_clause "else {\n    iVar1 = fcntl64(fd,0x406,in_stack_0000000c);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;\n      return iVar1;\n    }\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    rpl_fcntl::lexical_block_5::have_dupfd_cloexec = -1;\n  }" else (compound_statement "{\n    iVar1 = fcntl64(fd,0x406,in_stack_0000000c);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;\n      return iVar1;\n    }\n    iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    rpl_fcntl::lexical_block_5::have_dupfd_cloexec = -1;\n  }" { (expression_statement "iVar1 = fcntl64(fd,0x406,in_stack_0000000c);" (assignment_expression "iVar1 = fcntl64(fd,0x406,in_stack_0000000c)" identifier = (call_expression "fcntl64(fd,0x406,in_stack_0000000c)" identifier (argument_list "(fd,0x406,in_stack_0000000c)" ( identifier , number_literal , identifier )))) ;) (if_statement "if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;\n      return iVar1;\n    }" if (parenthesized_expression "((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16))" ( (binary_expression "(-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)" (parenthesized_expression "(-1 < iVar1)" ( (binary_expression "-1 < iVar1" number_literal < identifier) )) || (parenthesized_expression "(piVar4 = __errno_location(), *piVar4 != 0x16)" ( (comma_expression "piVar4 = __errno_location(), *piVar4 != 0x16" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) , (binary_expression "*piVar4 != 0x16" (pointer_expression "*piVar4" * identifier) != number_literal)) ))) )) (compound_statement "{\n      rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;\n      return iVar1;\n    }" { (labeled_statement "rpl_fcntl::lexical_block_5::have_dupfd_cloexec = 1;" statement_identifier : (ERROR ":" :) (labeled_statement "lexical_block_5::have_dupfd_cloexec = 1;" statement_identifier : (ERROR ":" :) (expression_statement "have_dupfd_cloexec = 1;" (assignment_expression "have_dupfd_cloexec = 1" identifier = number_literal) ;))) (return_statement "return iVar1;" return identifier ;) })) (expression_statement "iVar1 = rpl_fcntl(fd,0,in_stack_0000000c);" (assignment_expression "iVar1 = rpl_fcntl(fd,0,in_stack_0000000c)" identifier = (call_expression "rpl_fcntl(fd,0,in_stack_0000000c)" identifier (argument_list "(fd,0,in_stack_0000000c)" ( identifier , number_literal , identifier )))) ;) (if_statement "if (iVar1 < 0) {\n      return iVar1;\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) (labeled_statement "rpl_fcntl::lexical_block_5::have_dupfd_cloexec = -1;" statement_identifier : (ERROR ":" :) (labeled_statement "lexical_block_5::have_dupfd_cloexec = -1;" statement_identifier : (ERROR ":" :) (expression_statement "have_dupfd_cloexec = -1;" (assignment_expression "have_dupfd_cloexec = -1" identifier = number_literal) ;))) }))) (expression_statement "uVar2 = fcntl64(iVar1,1);" (assignment_expression "uVar2 = fcntl64(iVar1,1)" identifier = (call_expression "fcntl64(iVar1,1)" identifier (argument_list "(iVar1,1)" ( identifier , number_literal )))) ;) (if_statement "if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }" if (parenthesized_expression "((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1))" ( (binary_expression "(-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)" (parenthesized_expression "(-1 < (int)uVar2)" ( (binary_expression "-1 < (int)uVar2" number_literal < (cast_expression "(int)uVar2" ( (type_descriptor "int" primitive_type) ) identifier)) )) && (parenthesized_expression "(iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)" ( (comma_expression "iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1" (assignment_expression "iVar3 = fcntl64(iVar1,2,uVar2 | 1)" identifier = (call_expression "fcntl64(iVar1,2,uVar2 | 1)" identifier (argument_list "(iVar1,2,uVar2 | 1)" ( identifier , number_literal , (binary_expression "uVar2 | 1" identifier | number_literal) )))) , (binary_expression "iVar3 != -1" identifier != number_literal)) ))) )) (compound_statement "{\n    return iVar1;\n  }" { (return_statement "return iVar1;" return identifier ;) })) (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar4;" (assignment_expression "iVar3 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "close(iVar1);" (call_expression "close(iVar1)" identifier (argument_list "(iVar1)" ( identifier ))) ;) (expression_statement "*piVar4 = iVar3;" (assignment_expression "*piVar4 = iVar3" (pointer_expression "*piVar4" * identifier) = identifier) ;) (return_statement "return -1;" return number_literal ;) })))
(translation_unit "int FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  \n  if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }\n  if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}\n\n" (function_definition "int FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  \n  if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }\n  if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}" primitive_type (function_declarator "FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)" identifier (parameter_list "(undefined4 param_1,int param_2,undefined4 param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "int param_2" primitive_type identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  \n  if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }\n  if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (if_statement "if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }" if (parenthesized_expression "(param_2 != 0x406)" ( (binary_expression "param_2 != 0x406" identifier != number_literal) )) (compound_statement "{\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }" { (expression_statement "iVar1 = fcntl64(param_1,param_2,param_3);" (assignment_expression "iVar1 = fcntl64(param_1,param_2,param_3)" identifier = (call_expression "fcntl64(param_1,param_2,param_3)" identifier (argument_list "(param_1,param_2,param_3)" ( identifier , identifier , identifier )))) ;) (return_statement "return iVar1;" return identifier ;) })) (if_statement "if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" if (parenthesized_expression "(DAT_0003d904 < 0)" ( (binary_expression "DAT_0003d904 < 0" identifier < number_literal) )) (compound_statement "{\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }" { (expression_statement "iVar1 = FUN_00024aa0(param_1,0,param_3);" (assignment_expression "iVar1 = FUN_00024aa0(param_1,0,param_3)" identifier = (call_expression "FUN_00024aa0(param_1,0,param_3)" identifier (argument_list "(param_1,0,param_3)" ( identifier , number_literal , identifier )))) ;) (if_statement "if (iVar1 < 0) {\n      return iVar1;\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) (if_statement "if (DAT_0003d904 != -1) {\n      return iVar1;\n    }" if (parenthesized_expression "(DAT_0003d904 != -1)" ( (binary_expression "DAT_0003d904 != -1" identifier != number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) }) (else_clause "else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" else (compound_statement "{\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" { (expression_statement "iVar1 = fcntl64(param_1,0x406,param_3);" (assignment_expression "iVar1 = fcntl64(param_1,0x406,param_3)" identifier = (call_expression "fcntl64(param_1,0x406,param_3)" identifier (argument_list "(param_1,0x406,param_3)" ( identifier , number_literal , identifier )))) ;) (if_statement "if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }" if (parenthesized_expression "((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16))" ( (binary_expression "(-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)" (parenthesized_expression "(-1 < iVar1)" ( (binary_expression "-1 < iVar1" number_literal < identifier) )) || (parenthesized_expression "(piVar4 = __errno_location(), *piVar4 != 0x16)" ( (comma_expression "piVar4 = __errno_location(), *piVar4 != 0x16" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) , (binary_expression "*piVar4 != 0x16" (pointer_expression "*piVar4" * identifier) != number_literal)) ))) )) (compound_statement "{\n      DAT_0003d904 = 1;\n      return iVar1;\n    }" { (expression_statement "DAT_0003d904 = 1;" (assignment_expression "DAT_0003d904 = 1" identifier = number_literal) ;) (return_statement "return iVar1;" return identifier ;) })) (expression_statement "iVar1 = FUN_00024aa0(param_1,0,param_3);" (assignment_expression "iVar1 = FUN_00024aa0(param_1,0,param_3)" identifier = (call_expression "FUN_00024aa0(param_1,0,param_3)" identifier (argument_list "(param_1,0,param_3)" ( identifier , number_literal , identifier )))) ;) (if_statement "if (iVar1 < 0) {\n      return iVar1;\n    }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n      return iVar1;\n    }" { (return_statement "return iVar1;" return identifier ;) })) (expression_statement "DAT_0003d904 = -1;" (assignment_expression "DAT_0003d904 = -1" identifier = number_literal) ;) }))) (expression_statement "uVar2 = fcntl64(iVar1,1);" (assignment_expression "uVar2 = fcntl64(iVar1,1)" identifier = (call_expression "fcntl64(iVar1,1)" identifier (argument_list "(iVar1,1)" ( identifier , number_literal )))) ;) (if_statement "if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }" if (parenthesized_expression "((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1))" ( (binary_expression "(-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)" (parenthesized_expression "(-1 < (int)uVar2)" ( (binary_expression "-1 < (int)uVar2" number_literal < (cast_expression "(int)uVar2" ( (type_descriptor "int" primitive_type) ) identifier)) )) && (parenthesized_expression "(iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)" ( (comma_expression "iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1" (assignment_expression "iVar3 = fcntl64(iVar1,2,uVar2 | 1)" identifier = (call_expression "fcntl64(iVar1,2,uVar2 | 1)" identifier (argument_list "(iVar1,2,uVar2 | 1)" ( identifier , number_literal , (binary_expression "uVar2 | 1" identifier | number_literal) )))) , (binary_expression "iVar3 != -1" identifier != number_literal)) ))) )) (compound_statement "{\n    return iVar1;\n  }" { (return_statement "return iVar1;" return identifier ;) })) (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar4;" (assignment_expression "iVar3 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "close(iVar1);" (call_expression "close(iVar1)" identifier (argument_list "(iVar1)" ( identifier ))) ;) (expression_statement "*piVar4 = iVar3;" (assignment_expression "*piVar4 = iVar3" (pointer_expression "*piVar4" * identifier) = identifier) ;) (return_statement "return -1;" return number_literal ;) })))
(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 ;) (declaration TYPE (pointer_declarator * IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT )))) ;) (return_statement return IDENT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (return_statement return IDENT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (return_statement return IDENT ;) })) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression LIT < IDENT) )) || (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) , (binary_expression (pointer_expression * IDENT) != LIT)) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) }))) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression LIT < (cast_expression ( (type_descriptor TYPE) ) IDENT)) )) && (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT , (binary_expression IDENT | LIT) )))) , (binary_expression IDENT != LIT)) ))) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (return_statement return LIT ;) })))
(function_definition "int FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  \n  if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }\n  if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}" (primitive_type "int") (function_declarator "FUN_00024aa0(undefined4 param_1,int param_2,undefined4 param_3)" (identifier "FUN_00024aa0") (parameter_list "(undefined4 param_1,int param_2,undefined4 param_3)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (identifier "param_1")) (, ",") (parameter_declaration "int param_2" (primitive_type "int") (identifier "param_2")) (, ",") (parameter_declaration "undefined4 param_3" (type_identifier "undefined4") (identifier "param_3")) () ")"))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  int *piVar4;\n  \n  if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }\n  if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }\n  uVar2 = fcntl64(iVar1,1);\n  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }\n  piVar4 = __errno_location();\n  iVar3 = *piVar4;\n  close(iVar1);\n  *piVar4 = iVar3;\n  return -1;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "int *piVar4;" (primitive_type "int") (pointer_declarator "*piVar4" (* "*") (identifier "piVar4")) (; ";")) (if_statement "if (param_2 != 0x406) {\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }" (if "if") (parenthesized_expression "(param_2 != 0x406)" (( "(") (binary_expression "param_2 != 0x406" (identifier "param_2") (!= "!=") (number_literal "0x406")) () ")")) (compound_statement "{\n    iVar1 = fcntl64(param_1,param_2,param_3);\n    return iVar1;\n  }" ({ "{") (expression_statement "iVar1 = fcntl64(param_1,param_2,param_3);" (assignment_expression "iVar1 = fcntl64(param_1,param_2,param_3)" (identifier "iVar1") (= "=") (call_expression "fcntl64(param_1,param_2,param_3)" (identifier "fcntl64") (argument_list "(param_1,param_2,param_3)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "param_3") () ")")))) (; ";")) (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}"))) (if_statement "if (DAT_0003d904 < 0) {\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }\n  else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" (if "if") (parenthesized_expression "(DAT_0003d904 < 0)" (( "(") (binary_expression "DAT_0003d904 < 0" (identifier "DAT_0003d904") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    if (DAT_0003d904 != -1) {\n      return iVar1;\n    }\n  }" ({ "{") (expression_statement "iVar1 = FUN_00024aa0(param_1,0,param_3);" (assignment_expression "iVar1 = FUN_00024aa0(param_1,0,param_3)" (identifier "iVar1") (= "=") (call_expression "FUN_00024aa0(param_1,0,param_3)" (identifier "FUN_00024aa0") (argument_list "(param_1,0,param_3)" (( "(") (identifier "param_1") (, ",") (number_literal "0") (, ",") (identifier "param_3") () ")")))) (; ";")) (if_statement "if (iVar1 < 0) {\n      return iVar1;\n    }" (if "if") (parenthesized_expression "(iVar1 < 0)" (( "(") (binary_expression "iVar1 < 0" (identifier "iVar1") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n      return iVar1;\n    }" ({ "{") (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}"))) (if_statement "if (DAT_0003d904 != -1) {\n      return iVar1;\n    }" (if "if") (parenthesized_expression "(DAT_0003d904 != -1)" (( "(") (binary_expression "DAT_0003d904 != -1" (identifier "DAT_0003d904") (!= "!=") (number_literal "-1")) () ")")) (compound_statement "{\n      return iVar1;\n    }" ({ "{") (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}"))) (} "}")) (else_clause "else {\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" (else "else") (compound_statement "{\n    iVar1 = fcntl64(param_1,0x406,param_3);\n    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }\n    iVar1 = FUN_00024aa0(param_1,0,param_3);\n    if (iVar1 < 0) {\n      return iVar1;\n    }\n    DAT_0003d904 = -1;\n  }" ({ "{") (expression_statement "iVar1 = fcntl64(param_1,0x406,param_3);" (assignment_expression "iVar1 = fcntl64(param_1,0x406,param_3)" (identifier "iVar1") (= "=") (call_expression "fcntl64(param_1,0x406,param_3)" (identifier "fcntl64") (argument_list "(param_1,0x406,param_3)" (( "(") (identifier "param_1") (, ",") (number_literal "0x406") (, ",") (identifier "param_3") () ")")))) (; ";")) (if_statement "if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {\n      DAT_0003d904 = 1;\n      return iVar1;\n    }" (if "if") (parenthesized_expression "((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16))" (( "(") (binary_expression "(-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)" (parenthesized_expression "(-1 < iVar1)" (( "(") (binary_expression "-1 < iVar1" (number_literal "-1") (< "<") (identifier "iVar1")) () ")")) (|| "||") (parenthesized_expression "(piVar4 = __errno_location(), *piVar4 != 0x16)" (( "(") (comma_expression "piVar4 = __errno_location(), *piVar4 != 0x16" (assignment_expression "piVar4 = __errno_location()" (identifier "piVar4") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (, ",") (binary_expression "*piVar4 != 0x16" (pointer_expression "*piVar4" (* "*") (identifier "piVar4")) (!= "!=") (number_literal "0x16"))) () ")"))) () ")")) (compound_statement "{\n      DAT_0003d904 = 1;\n      return iVar1;\n    }" ({ "{") (expression_statement "DAT_0003d904 = 1;" (assignment_expression "DAT_0003d904 = 1" (identifier "DAT_0003d904") (= "=") (number_literal "1")) (; ";")) (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}"))) (expression_statement "iVar1 = FUN_00024aa0(param_1,0,param_3);" (assignment_expression "iVar1 = FUN_00024aa0(param_1,0,param_3)" (identifier "iVar1") (= "=") (call_expression "FUN_00024aa0(param_1,0,param_3)" (identifier "FUN_00024aa0") (argument_list "(param_1,0,param_3)" (( "(") (identifier "param_1") (, ",") (number_literal "0") (, ",") (identifier "param_3") () ")")))) (; ";")) (if_statement "if (iVar1 < 0) {\n      return iVar1;\n    }" (if "if") (parenthesized_expression "(iVar1 < 0)" (( "(") (binary_expression "iVar1 < 0" (identifier "iVar1") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n      return iVar1;\n    }" ({ "{") (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}"))) (expression_statement "DAT_0003d904 = -1;" (assignment_expression "DAT_0003d904 = -1" (identifier "DAT_0003d904") (= "=") (number_literal "-1")) (; ";")) (} "}")))) (expression_statement "uVar2 = fcntl64(iVar1,1);" (assignment_expression "uVar2 = fcntl64(iVar1,1)" (identifier "uVar2") (= "=") (call_expression "fcntl64(iVar1,1)" (identifier "fcntl64") (argument_list "(iVar1,1)" (( "(") (identifier "iVar1") (, ",") (number_literal "1") () ")")))) (; ";")) (if_statement "if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {\n    return iVar1;\n  }" (if "if") (parenthesized_expression "((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1))" (( "(") (binary_expression "(-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)" (parenthesized_expression "(-1 < (int)uVar2)" (( "(") (binary_expression "-1 < (int)uVar2" (number_literal "-1") (< "<") (cast_expression "(int)uVar2" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "uVar2"))) () ")")) (&& "&&") (parenthesized_expression "(iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)" (( "(") (comma_expression "iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1" (assignment_expression "iVar3 = fcntl64(iVar1,2,uVar2 | 1)" (identifier "iVar3") (= "=") (call_expression "fcntl64(iVar1,2,uVar2 | 1)" (identifier "fcntl64") (argument_list "(iVar1,2,uVar2 | 1)" (( "(") (identifier "iVar1") (, ",") (number_literal "2") (, ",") (binary_expression "uVar2 | 1" (identifier "uVar2") (| "|") (number_literal "1")) () ")")))) (, ",") (binary_expression "iVar3 != -1" (identifier "iVar3") (!= "!=") (number_literal "-1"))) () ")"))) () ")")) (compound_statement "{\n    return iVar1;\n  }" ({ "{") (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}"))) (expression_statement "piVar4 = __errno_location();" (assignment_expression "piVar4 = __errno_location()" (identifier "piVar4") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar3 = *piVar4;" (assignment_expression "iVar3 = *piVar4" (identifier "iVar3") (= "=") (pointer_expression "*piVar4" (* "*") (identifier "piVar4"))) (; ";")) (expression_statement "close(iVar1);" (call_expression "close(iVar1)" (identifier "close") (argument_list "(iVar1)" (( "(") (identifier "iVar1") () ")"))) (; ";")) (expression_statement "*piVar4 = iVar3;" (assignment_expression "*piVar4 = iVar3" (pointer_expression "*piVar4" (* "*") (identifier "piVar4")) (= "=") (identifier "iVar3")) (; ";")) (return_statement "return -1;" (return "return") (number_literal "-1") (; ";")) (} "}")))

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

int function_1(int fd,int var_1,...)

{
  int var_4;
  type_1 var_6;
  int var_7;
  int *piVar4;
  int target;
  type_2 in_stack_0000000c;
  
  if (var_1 != 0x406) {
    var_4 = var_2(fd,var_1,in_stack_0000000c);
    return var_4;
  }
  if (function_1::lexical_block_5::var_3 < 0) {
    var_4 = function_1(fd,0,in_stack_0000000c);
    if (var_4 < 0) {
      return var_4;
    }
    if (function_1::lexical_block_5::var_3 != -1) {
      return var_4;
    }
  }
  else {
    var_4 = var_2(fd,0x406,in_stack_0000000c);
    if ((-1 < var_4) || (piVar4 = var_5(), *piVar4 != 0x16)) {
      rpl_fcntl::lexical_block_5::var_3 = 1;
      return var_4;
    }
    var_4 = function_1(fd,0,in_stack_0000000c);
    if (var_4 < 0) {
      return var_4;
    }
    rpl_fcntl::lexical_block_5::var_3 = -1;
  }
  var_6 = var_2(var_4,1);
  if ((-1 < (int)var_6) && (var_7 = var_2(var_4,2,var_6 | 1), var_7 != -1)) {
    return var_4;
  }
  piVar4 = var_5();
  var_7 = *piVar4;
  var_8(var_4);
  *piVar4 = var_7;
  return -1;
}


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

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

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

{
  int iVar1;
  uint uVar2;
  int iVar3;
  int *piVar4;
  
  if (param_2 != 0x406) {
    iVar1 = fcntl64(param_1,param_2,param_3);
    return iVar1;
  }
  if (DAT_0003d904 < 0) {
    iVar1 = MASKED(param_1,0,param_3);
    if (iVar1 < 0) {
      return iVar1;
    }
    if (DAT_0003d904 != -1) {
      return iVar1;
    }
  }
  else {
    iVar1 = fcntl64(param_1,0x406,param_3);
    if ((-1 < iVar1) || (piVar4 = __errno_location(), *piVar4 != 0x16)) {
      DAT_0003d904 = 1;
      return iVar1;
    }
    iVar1 = MASKED(param_1,0,param_3);
    if (iVar1 < 0) {
      return iVar1;
    }
    DAT_0003d904 = -1;
  }
  uVar2 = fcntl64(iVar1,1);
  if ((-1 < (int)uVar2) && (iVar3 = fcntl64(iVar1,2,uVar2 | 1), iVar3 != -1)) {
    return iVar1;
  }
  piVar4 = __errno_location();
  iVar3 = *piVar4;
  close(iVar1);
  *piVar4 = iVar3;
  return -1;
}

