
int fd_reopen(int desired_fd,char *file,int flags,mode_t mode)

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  undefined4 uVar4;
  
  iVar1 = (*(code *)PTR_open64_000382d4)(file,flags,mode);
  if ((desired_fd != iVar1) && (-1 < iVar1)) {
    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,desired_fd);
    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();
    uVar4 = *puVar3;
    (*(code *)PTR_close_0003825c)(iVar1);
    *puVar3 = uVar4;
    return iVar2;
  }
  return iVar1;
}



int fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  undefined4 uVar4;
  
  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);
  if ((param_1 != iVar1) && (-1 < iVar1)) {
    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);
    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();
    uVar4 = *puVar3;
    (*(code *)PTR_close_0003825c)(iVar1);
    *puVar3 = uVar4;
    return iVar2;
  }
  return iVar1;
}


lui gp,0x3
addiu gp,gp,-0x3990
addu gp,gp,t9
addiu sp,sp,-0x30
lw t9,-0x7e0c(gp)
or v0,a1,zero
or a1,a2,zero
sw gp,0x10(sp)
or a2,a3,zero
sw s1,0x20(sp)
or s1,a0,zero
sw s0,0x1c(sp)
or a0,v0,zero
sw ra,0x2c(sp)
sw s3,0x28(sp)
jalr t9
_sw s2,0x24(sp)
lw gp,0x10(sp)
beq s1,v0,0x00013ac8
_or s0,v0,zero
bgez v0,0x00013ae8
_lw t9,-0x7d60(gp)
lw ra,0x2c(sp)
or v0,s0,zero
lw s3,0x28(sp)
lw s2,0x24(sp)
lw s1,0x20(sp)
lw s0,0x1c(sp)
jr ra
_addiu sp,sp,0x30
or a1,s1,zero
jalr t9
_or a0,v0,zero
lw gp,0x10(sp)
lw t9,-0x7e20(gp)
jalr t9
_or s3,v0,zero
or a0,s0,zero
lw gp,0x10(sp)
or s1,v0,zero
lw s2,0x0(v0)
lw t9,-0x7e84(gp)
jalr t9
_or s0,s3,zero
or v0,s0,zero
lw ra,0x2c(sp)
lw s3,0x28(sp)
lw s0,0x1c(sp)
sw s2,0x0(s1)
lw s2,0x24(sp)
lw s1,0x20(sp)
jr ra
_addiu sp,sp,0x30
(translation_unit "int fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);\n  if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}\n\n" (function_definition "int fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);\n  if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}" primitive_type (function_declarator "fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)" identifier (parameter_list "(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) , (parameter_declaration "undefined4 param_4" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);\n  if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "undefined4 *puVar3;" type_identifier (pointer_declarator "*puVar3" * identifier) ;) (declaration "undefined4 uVar4;" type_identifier identifier ;) (expression_statement "iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);" (assignment_expression "iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4)" identifier = (call_expression "(*(code *)PTR_open64_000382d4)(param_2,param_3,param_4)" (parenthesized_expression "(*(code *)PTR_open64_000382d4)" ( (pointer_expression "*(code *)PTR_open64_000382d4" * (cast_expression "(code *)PTR_open64_000382d4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_2,param_3,param_4)" ( identifier , identifier , identifier )))) ;) (if_statement "if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }" if (parenthesized_expression "((param_1 != iVar1) && (-1 < iVar1))" ( (binary_expression "(param_1 != iVar1) && (-1 < iVar1)" (parenthesized_expression "(param_1 != iVar1)" ( (binary_expression "param_1 != iVar1" identifier != identifier) )) && (parenthesized_expression "(-1 < iVar1)" ( (binary_expression "-1 < iVar1" number_literal < identifier) ))) )) (compound_statement "{\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }" { (expression_statement "iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);" (assignment_expression "iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1)" identifier = (call_expression "(*(code *)PTR_dup2_00038380)(iVar1,param_1)" (parenthesized_expression "(*(code *)PTR_dup2_00038380)" ( (pointer_expression "*(code *)PTR_dup2_00038380" * (cast_expression "(code *)PTR_dup2_00038380" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1,param_1)" ( identifier , identifier )))) ;) (expression_statement "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();" (assignment_expression "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000382c0)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000382c0)()" (parenthesized_expression "(*(code *)PTR___errno_location_000382c0)" ( (pointer_expression "*(code *)PTR___errno_location_000382c0" * (cast_expression "(code *)PTR___errno_location_000382c0" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "uVar4 = *puVar3;" (assignment_expression "uVar4 = *puVar3" identifier = (pointer_expression "*puVar3" * identifier)) ;) (expression_statement "(*(code *)PTR_close_0003825c)(iVar1);" (call_expression "(*(code *)PTR_close_0003825c)(iVar1)" (parenthesized_expression "(*(code *)PTR_close_0003825c)" ( (pointer_expression "*(code *)PTR_close_0003825c" * (cast_expression "(code *)PTR_close_0003825c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier ))) ;) (expression_statement "*puVar3 = uVar4;" (assignment_expression "*puVar3 = uVar4" (pointer_expression "*puVar3" * identifier) = identifier) ;) (return_statement "return iVar2;" return identifier ;) })) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "int fd_reopen(int desired_fd,char *file,int flags,mode_t mode)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(file,flags,mode);\n  if ((desired_fd != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,desired_fd);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}\n\n" (function_definition "int fd_reopen(int desired_fd,char *file,int flags,mode_t mode)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(file,flags,mode);\n  if ((desired_fd != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,desired_fd);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}" primitive_type (function_declarator "fd_reopen(int desired_fd,char *file,int flags,mode_t mode)" identifier (parameter_list "(int desired_fd,char *file,int flags,mode_t mode)" ( (parameter_declaration "int desired_fd" primitive_type identifier) , (parameter_declaration "char *file" primitive_type (pointer_declarator "*file" * identifier)) , (parameter_declaration "int flags" primitive_type identifier) , (parameter_declaration "mode_t mode" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(file,flags,mode);\n  if ((desired_fd != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,desired_fd);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "undefined4 *puVar3;" type_identifier (pointer_declarator "*puVar3" * identifier) ;) (declaration "undefined4 uVar4;" type_identifier identifier ;) (expression_statement "iVar1 = (*(code *)PTR_open64_000382d4)(file,flags,mode);" (assignment_expression "iVar1 = (*(code *)PTR_open64_000382d4)(file,flags,mode)" identifier = (call_expression "(*(code *)PTR_open64_000382d4)(file,flags,mode)" (parenthesized_expression "(*(code *)PTR_open64_000382d4)" ( (pointer_expression "*(code *)PTR_open64_000382d4" * (cast_expression "(code *)PTR_open64_000382d4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(file,flags,mode)" ( identifier , identifier , identifier )))) ;) (if_statement "if ((desired_fd != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,desired_fd);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }" if (parenthesized_expression "((desired_fd != iVar1) && (-1 < iVar1))" ( (binary_expression "(desired_fd != iVar1) && (-1 < iVar1)" (parenthesized_expression "(desired_fd != iVar1)" ( (binary_expression "desired_fd != iVar1" identifier != identifier) )) && (parenthesized_expression "(-1 < iVar1)" ( (binary_expression "-1 < iVar1" number_literal < identifier) ))) )) (compound_statement "{\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,desired_fd);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }" { (expression_statement "iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,desired_fd);" (assignment_expression "iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,desired_fd)" identifier = (call_expression "(*(code *)PTR_dup2_00038380)(iVar1,desired_fd)" (parenthesized_expression "(*(code *)PTR_dup2_00038380)" ( (pointer_expression "*(code *)PTR_dup2_00038380" * (cast_expression "(code *)PTR_dup2_00038380" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1,desired_fd)" ( identifier , identifier )))) ;) (expression_statement "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();" (assignment_expression "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000382c0)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000382c0)()" (parenthesized_expression "(*(code *)PTR___errno_location_000382c0)" ( (pointer_expression "*(code *)PTR___errno_location_000382c0" * (cast_expression "(code *)PTR___errno_location_000382c0" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "uVar4 = *puVar3;" (assignment_expression "uVar4 = *puVar3" identifier = (pointer_expression "*puVar3" * identifier)) ;) (expression_statement "(*(code *)PTR_close_0003825c)(iVar1);" (call_expression "(*(code *)PTR_close_0003825c)(iVar1)" (parenthesized_expression "(*(code *)PTR_close_0003825c)" ( (pointer_expression "*(code *)PTR_close_0003825c" * (cast_expression "(code *)PTR_close_0003825c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier ))) ;) (expression_statement "*puVar3 = uVar4;" (assignment_expression "*puVar3 = uVar4" (pointer_expression "*puVar3" * identifier) = identifier) ;) (return_statement "return iVar2;" return identifier ;) })) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "int fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);\n  if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}\n\n" (function_definition "int fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);\n  if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}" primitive_type (function_declarator "fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)" identifier (parameter_list "(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) , (parameter_declaration "undefined4 param_4" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);\n  if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "undefined4 *puVar3;" type_identifier (pointer_declarator "*puVar3" * identifier) ;) (declaration "undefined4 uVar4;" type_identifier identifier ;) (expression_statement "iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);" (assignment_expression "iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4)" identifier = (call_expression "(*(code *)PTR_open64_000382d4)(param_2,param_3,param_4)" (parenthesized_expression "(*(code *)PTR_open64_000382d4)" ( (pointer_expression "*(code *)PTR_open64_000382d4" * (cast_expression "(code *)PTR_open64_000382d4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_2,param_3,param_4)" ( identifier , identifier , identifier )))) ;) (if_statement "if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }" if (parenthesized_expression "((param_1 != iVar1) && (-1 < iVar1))" ( (binary_expression "(param_1 != iVar1) && (-1 < iVar1)" (parenthesized_expression "(param_1 != iVar1)" ( (binary_expression "param_1 != iVar1" identifier != identifier) )) && (parenthesized_expression "(-1 < iVar1)" ( (binary_expression "-1 < iVar1" number_literal < identifier) ))) )) (compound_statement "{\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }" { (expression_statement "iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);" (assignment_expression "iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1)" identifier = (call_expression "(*(code *)PTR_dup2_00038380)(iVar1,param_1)" (parenthesized_expression "(*(code *)PTR_dup2_00038380)" ( (pointer_expression "*(code *)PTR_dup2_00038380" * (cast_expression "(code *)PTR_dup2_00038380" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1,param_1)" ( identifier , identifier )))) ;) (expression_statement "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();" (assignment_expression "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000382c0)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000382c0)()" (parenthesized_expression "(*(code *)PTR___errno_location_000382c0)" ( (pointer_expression "*(code *)PTR___errno_location_000382c0" * (cast_expression "(code *)PTR___errno_location_000382c0" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "uVar4 = *puVar3;" (assignment_expression "uVar4 = *puVar3" identifier = (pointer_expression "*puVar3" * identifier)) ;) (expression_statement "(*(code *)PTR_close_0003825c)(iVar1);" (call_expression "(*(code *)PTR_close_0003825c)(iVar1)" (parenthesized_expression "(*(code *)PTR_close_0003825c)" ( (pointer_expression "*(code *)PTR_close_0003825c" * (cast_expression "(code *)PTR_close_0003825c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier ))) ;) (expression_statement "*puVar3 = uVar4;" (assignment_expression "*puVar3 = uVar4" (pointer_expression "*puVar3" * identifier) = identifier) ;) (return_statement "return iVar2;" return identifier ;) })) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT , IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != IDENT) )) && (parenthesized_expression ( (binary_expression LIT < IDENT) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT , IDENT )))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( ))))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (return_statement return IDENT ;) })) (return_statement return IDENT ;) })))
(function_definition "int fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);\n  if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}" (primitive_type "int") (function_declarator "fd_reopen(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)" (identifier "fd_reopen") (parameter_list "(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)" (( "(") (parameter_declaration "int param_1" (primitive_type "int") (identifier "param_1")) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) (, ",") (parameter_declaration "undefined4 param_3" (type_identifier "undefined4") (identifier "param_3")) (, ",") (parameter_declaration "undefined4 param_4" (type_identifier "undefined4") (identifier "param_4")) () ")"))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  undefined4 *puVar3;\n  undefined4 uVar4;\n  \n  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);\n  if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }\n  return iVar1;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "undefined4 *puVar3;" (type_identifier "undefined4") (pointer_declarator "*puVar3" (* "*") (identifier "puVar3")) (; ";")) (declaration "undefined4 uVar4;" (type_identifier "undefined4") (identifier "uVar4") (; ";")) (expression_statement "iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);" (assignment_expression "iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4)" (identifier "iVar1") (= "=") (call_expression "(*(code *)PTR_open64_000382d4)(param_2,param_3,param_4)" (parenthesized_expression "(*(code *)PTR_open64_000382d4)" (( "(") (pointer_expression "*(code *)PTR_open64_000382d4" (* "*") (cast_expression "(code *)PTR_open64_000382d4" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_open64_000382d4"))) () ")")) (argument_list "(param_2,param_3,param_4)" (( "(") (identifier "param_2") (, ",") (identifier "param_3") (, ",") (identifier "param_4") () ")")))) (; ";")) (if_statement "if ((param_1 != iVar1) && (-1 < iVar1)) {\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }" (if "if") (parenthesized_expression "((param_1 != iVar1) && (-1 < iVar1))" (( "(") (binary_expression "(param_1 != iVar1) && (-1 < iVar1)" (parenthesized_expression "(param_1 != iVar1)" (( "(") (binary_expression "param_1 != iVar1" (identifier "param_1") (!= "!=") (identifier "iVar1")) () ")")) (&& "&&") (parenthesized_expression "(-1 < iVar1)" (( "(") (binary_expression "-1 < iVar1" (number_literal "-1") (< "<") (identifier "iVar1")) () ")"))) () ")")) (compound_statement "{\n    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();\n    uVar4 = *puVar3;\n    (*(code *)PTR_close_0003825c)(iVar1);\n    *puVar3 = uVar4;\n    return iVar2;\n  }" ({ "{") (expression_statement "iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);" (assignment_expression "iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1)" (identifier "iVar2") (= "=") (call_expression "(*(code *)PTR_dup2_00038380)(iVar1,param_1)" (parenthesized_expression "(*(code *)PTR_dup2_00038380)" (( "(") (pointer_expression "*(code *)PTR_dup2_00038380" (* "*") (cast_expression "(code *)PTR_dup2_00038380" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_dup2_00038380"))) () ")")) (argument_list "(iVar1,param_1)" (( "(") (identifier "iVar1") (, ",") (identifier "param_1") () ")")))) (; ";")) (expression_statement "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();" (assignment_expression "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)()" (identifier "puVar3") (= "=") (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000382c0)()" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "(*(code *)PTR___errno_location_000382c0)()" (parenthesized_expression "(*(code *)PTR___errno_location_000382c0)" (( "(") (pointer_expression "*(code *)PTR___errno_location_000382c0" (* "*") (cast_expression "(code *)PTR___errno_location_000382c0" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR___errno_location_000382c0"))) () ")")) (argument_list "()" (( "(") () ")"))))) (; ";")) (expression_statement "uVar4 = *puVar3;" (assignment_expression "uVar4 = *puVar3" (identifier "uVar4") (= "=") (pointer_expression "*puVar3" (* "*") (identifier "puVar3"))) (; ";")) (expression_statement "(*(code *)PTR_close_0003825c)(iVar1);" (call_expression "(*(code *)PTR_close_0003825c)(iVar1)" (parenthesized_expression "(*(code *)PTR_close_0003825c)" (( "(") (pointer_expression "*(code *)PTR_close_0003825c" (* "*") (cast_expression "(code *)PTR_close_0003825c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_0003825c"))) () ")")) (argument_list "(iVar1)" (( "(") (identifier "iVar1") () ")"))) (; ";")) (expression_statement "*puVar3 = uVar4;" (assignment_expression "*puVar3 = uVar4" (pointer_expression "*puVar3" (* "*") (identifier "puVar3")) (= "=") (identifier "uVar4")) (; ";")) (return_statement "return iVar2;" (return "return") (identifier "iVar2") (; ";")) (} "}"))) (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}")))

int function_1(int var_1,char *file,int flags,type_1 mode)

{
  int var_2;
  int iVar2;
  type_2 *puVar3;
  type_2 uVar4;
  
  var_2 = (*(type_3 *)PTR_open64_000382d4)(file,flags,mode);
  if ((var_1 != var_2) && (-1 < var_2)) {
    iVar2 = (*(type_3 *)PTR_dup2_00038380)(var_2,var_1);
    puVar3 = (type_2 *)(*(type_3 *)PTR___errno_location_000382c0)();
    uVar4 = *puVar3;
    (*(type_3 *)PTR_close_0003825c)(var_2);
    *puVar3 = uVar4;
    return iVar2;
  }
  return var_2;
}


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

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

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  undefined4 uVar4;
  
  iVar1 = (*(code *)PTR_open64_000382d4)(param_2,param_3,param_4);
  if ((param_1 != iVar1) && (-1 < iVar1)) {
    iVar2 = (*(code *)PTR_dup2_00038380)(iVar1,param_1);
    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_000382c0)();
    uVar4 = *puVar3;
    (*(code *)PTR_close_0003825c)(iVar1);
    *puVar3 = uVar4;
    return iVar2;
  }
  return iVar1;
}

