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

int fd_safer(int fd)

{
  int iVar1;
  int iVar2;
  int *piVar3;
  
  if (2 < (uint)fd) {
    return fd;
  }
  iVar2 = dup_safer(fd);
  piVar3 = __errno_location();
  iVar1 = *piVar3;
  close(fd);
  *piVar3 = iVar1;
  return iVar2;
}



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

uint FUN_0001dbc0(uint param_1)

{
  int iVar1;
  uint uVar2;
  int *piVar3;
  
  if (2 < param_1) {
    return param_1;
  }
  uVar2 = FUN_0001eab0(param_1);
  piVar3 = __errno_location();
  iVar1 = *piVar3;
  close(param_1);
  *piVar3 = iVar1;
  return uVar2;
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00012ce0
ADD EBX,0xd437
SUB ESP,0x1c
MOV ESI,dword ptr [ESP + 0x30]
CMP ESI,0x2
JBE 0x0001dbe8
ADD ESP,0x1c
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0xc
PUSH ESI
CALL 0x0001eab0
MOV dword ptr [ESP + 0x1c],EAX
CALL 0x000123c0
MOV EDI,dword ptr [EAX]
MOV EBP,EAX
MOV dword ptr [ESP],ESI
CALL 0x00012560
ADD ESP,0x10
MOV ESI,dword ptr [ESP + 0xc]
MOV dword ptr [EBP],EDI
ADD ESP,0x1c
POP EBX
MOV EAX,ESI
POP ESI
POP EDI
POP EBP
RET
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nuint FUN_0001dbc0(uint param_1)\n\n{\n  int iVar1;\n  uint uVar2;\n  int *piVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar2 = FUN_0001eab0(param_1);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(param_1);\n  *piVar3 = iVar1;\n  return uVar2;\n}\n\n" comment (function_definition "uint FUN_0001dbc0(uint param_1)\n\n{\n  int iVar1;\n  uint uVar2;\n  int *piVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar2 = FUN_0001eab0(param_1);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(param_1);\n  *piVar3 = iVar1;\n  return uVar2;\n}" type_identifier (function_declarator "FUN_0001dbc0(uint param_1)" identifier (parameter_list "(uint param_1)" ( (parameter_declaration "uint param_1" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int *piVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar2 = FUN_0001eab0(param_1);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(param_1);\n  *piVar3 = iVar1;\n  return uVar2;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (if_statement "if (2 < param_1) {\n    return param_1;\n  }" if (parenthesized_expression "(2 < param_1)" ( (binary_expression "2 < param_1" number_literal < identifier) )) (compound_statement "{\n    return param_1;\n  }" { (return_statement "return param_1;" return identifier ;) })) (expression_statement "uVar2 = FUN_0001eab0(param_1);" (assignment_expression "uVar2 = FUN_0001eab0(param_1)" identifier = (call_expression "FUN_0001eab0(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar3;" (assignment_expression "iVar1 = *piVar3" identifier = (pointer_expression "*piVar3" * identifier)) ;) (expression_statement "close(param_1);" (call_expression "close(param_1)" identifier (argument_list "(param_1)" ( identifier ))) ;) (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * identifier) = identifier) ;) (return_statement "return uVar2;" return identifier ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint fd_safer(int fd)\n\n{\n  int iVar1;\n  int iVar2;\n  int *piVar3;\n  \n  if (2 < (uint)fd) {\n    return fd;\n  }\n  iVar2 = dup_safer(fd);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(fd);\n  *piVar3 = iVar1;\n  return iVar2;\n}\n\n" comment (function_definition "int fd_safer(int fd)\n\n{\n  int iVar1;\n  int iVar2;\n  int *piVar3;\n  \n  if (2 < (uint)fd) {\n    return fd;\n  }\n  iVar2 = dup_safer(fd);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(fd);\n  *piVar3 = iVar1;\n  return iVar2;\n}" primitive_type (function_declarator "fd_safer(int fd)" identifier (parameter_list "(int fd)" ( (parameter_declaration "int fd" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  int *piVar3;\n  \n  if (2 < (uint)fd) {\n    return fd;\n  }\n  iVar2 = dup_safer(fd);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(fd);\n  *piVar3 = iVar1;\n  return iVar2;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (if_statement "if (2 < (uint)fd) {\n    return fd;\n  }" if (parenthesized_expression "(2 < (uint)fd)" ( (binary_expression "2 < (uint)fd" number_literal < (cast_expression "(uint)fd" ( (type_descriptor "uint" type_identifier) ) identifier)) )) (compound_statement "{\n    return fd;\n  }" { (return_statement "return fd;" return identifier ;) })) (expression_statement "iVar2 = dup_safer(fd);" (assignment_expression "iVar2 = dup_safer(fd)" identifier = (call_expression "dup_safer(fd)" identifier (argument_list "(fd)" ( identifier )))) ;) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar3;" (assignment_expression "iVar1 = *piVar3" identifier = (pointer_expression "*piVar3" * identifier)) ;) (expression_statement "close(fd);" (call_expression "close(fd)" identifier (argument_list "(fd)" ( identifier ))) ;) (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * identifier) = identifier) ;) (return_statement "return iVar2;" return identifier ;) })))
(translation_unit "uint FUN_0001dbc0(uint param_1)\n\n{\n  int iVar1;\n  uint uVar2;\n  int *piVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar2 = FUN_0001eab0(param_1);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(param_1);\n  *piVar3 = iVar1;\n  return uVar2;\n}\n\n" (function_definition "uint FUN_0001dbc0(uint param_1)\n\n{\n  int iVar1;\n  uint uVar2;\n  int *piVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar2 = FUN_0001eab0(param_1);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(param_1);\n  *piVar3 = iVar1;\n  return uVar2;\n}" type_identifier (function_declarator "FUN_0001dbc0(uint param_1)" identifier (parameter_list "(uint param_1)" ( (parameter_declaration "uint param_1" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int *piVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar2 = FUN_0001eab0(param_1);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(param_1);\n  *piVar3 = iVar1;\n  return uVar2;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (if_statement "if (2 < param_1) {\n    return param_1;\n  }" if (parenthesized_expression "(2 < param_1)" ( (binary_expression "2 < param_1" number_literal < identifier) )) (compound_statement "{\n    return param_1;\n  }" { (return_statement "return param_1;" return identifier ;) })) (expression_statement "uVar2 = FUN_0001eab0(param_1);" (assignment_expression "uVar2 = FUN_0001eab0(param_1)" identifier = (call_expression "FUN_0001eab0(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar1 = *piVar3;" (assignment_expression "iVar1 = *piVar3" identifier = (pointer_expression "*piVar3" * identifier)) ;) (expression_statement "close(param_1);" (call_expression "close(param_1)" identifier (argument_list "(param_1)" ( identifier ))) ;) (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" * identifier) = identifier) ;) (return_statement "return uVar2;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( 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 IDENT ;) })))
(function_definition "uint FUN_0001dbc0(uint param_1)\n\n{\n  int iVar1;\n  uint uVar2;\n  int *piVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar2 = FUN_0001eab0(param_1);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(param_1);\n  *piVar3 = iVar1;\n  return uVar2;\n}" (type_identifier "uint") (function_declarator "FUN_0001dbc0(uint param_1)" (identifier "FUN_0001dbc0") (parameter_list "(uint param_1)" (( "(") (parameter_declaration "uint param_1" (type_identifier "uint") (identifier "param_1")) () ")"))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int *piVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar2 = FUN_0001eab0(param_1);\n  piVar3 = __errno_location();\n  iVar1 = *piVar3;\n  close(param_1);\n  *piVar3 = iVar1;\n  return uVar2;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "int *piVar3;" (primitive_type "int") (pointer_declarator "*piVar3" (* "*") (identifier "piVar3")) (; ";")) (if_statement "if (2 < param_1) {\n    return param_1;\n  }" (if "if") (parenthesized_expression "(2 < param_1)" (( "(") (binary_expression "2 < param_1" (number_literal "2") (< "<") (identifier "param_1")) () ")")) (compound_statement "{\n    return param_1;\n  }" ({ "{") (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}"))) (expression_statement "uVar2 = FUN_0001eab0(param_1);" (assignment_expression "uVar2 = FUN_0001eab0(param_1)" (identifier "uVar2") (= "=") (call_expression "FUN_0001eab0(param_1)" (identifier "FUN_0001eab0") (argument_list "(param_1)" (( "(") (identifier "param_1") () ")")))) (; ";")) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" (identifier "piVar3") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar1 = *piVar3;" (assignment_expression "iVar1 = *piVar3" (identifier "iVar1") (= "=") (pointer_expression "*piVar3" (* "*") (identifier "piVar3"))) (; ";")) (expression_statement "close(param_1);" (call_expression "close(param_1)" (identifier "close") (argument_list "(param_1)" (( "(") (identifier "param_1") () ")"))) (; ";")) (expression_statement "*piVar3 = iVar1;" (assignment_expression "*piVar3 = iVar1" (pointer_expression "*piVar3" (* "*") (identifier "piVar3")) (= "=") (identifier "iVar1")) (; ";")) (return_statement "return uVar2;" (return "return") (identifier "uVar2") (; ";")) (} "}")))

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

int function_1(int fd)

{
  int iVar1;
  int iVar2;
  int *piVar3;
  
  if (2 < (type_1)fd) {
    return fd;
  }
  iVar2 = var_1(fd);
  piVar3 = var_2();
  iVar1 = *piVar3;
  var_3(fd);
  *piVar3 = iVar1;
  return iVar2;
}


(translation_unit (function_definition type: (type_identifier) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (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: (pointer_declarator declarator: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (number_literal) right: (identifier))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (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 (identifier)))))

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

uint MASKED(uint param_1)

{
  int iVar1;
  uint uVar2;
  int *piVar3;
  
  if (2 < param_1) {
    return param_1;
  }
  uVar2 = FUN_0001eab0(param_1);
  piVar3 = __errno_location();
  iVar1 = *piVar3;
  close(param_1);
  *piVar3 = iVar1;
  return uVar2;
}

