
FILE * rpl_freopen(char *filename,char *mode,FILE *stream)

{
  FILE *pFVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  
  pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)();
  if ((pFVar1 != (FILE *)0x0) && (filename != (char *)0x0)) {
    iVar2 = (*(code *)PTR_fileno_0003123c)(pFVar1);
    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);
    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {
      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);
      if (iVar2 != iVar3) {
        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);
        (*(code *)PTR_close_000311e4)(iVar3);
        if (iVar2 < 0) {
          return pFVar1;
        }
      }
      pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);
    }
  }
  return pFVar1;
}



int rpl_freopen(int param_1,undefined4 param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  
  iVar1 = (*(code *)PTR_freopen64_00031264)();
  if ((iVar1 != 0) && (param_1 != 0)) {
    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);
    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);
    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {
      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);
      if (iVar2 != iVar3) {
        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);
        (*(code *)PTR_close_000311e4)(iVar3);
        if (iVar2 < 0) {
          return iVar1;
        }
      }
      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);
    }
  }
  return iVar1;
}


lui gp,0x2
addiu gp,gp,-0x4cb0
addu gp,gp,t9
addiu sp,sp,-0x30
sw ra,0x2c(sp)
sw s4,0x28(sp)
sw s3,0x24(sp)
sw s2,0x20(sp)
sw s1,0x1c(sp)
sw s0,0x18(sp)
sw gp,0x10(sp)
or s1,a0,zero
or s3,a1,zero
lw t9,-0x7e3c(gp)
jalr t9
_nop
lw gp,0x10(sp)
beq v0,zero,0x0001ddd8
_or s0,v0,zero
beq s1,zero,0x0001ddd8
_or a0,v0,zero
lw t9,-0x7e64(gp)
jalr t9
_nop
lw gp,0x10(sp)
or s2,v0,zero
or a1,v0,zero
or a0,v0,zero
lw t9,-0x7da4(gp)
jalr t9
_nop
lw gp,0x10(sp)
bltz v0,0x0001ddfc
_lw t9,-0x7e60(gp)
or v0,s0,zero
lw ra,0x2c(sp)
lw s4,0x28(sp)
lw s3,0x24(sp)
lw s2,0x20(sp)
lw s1,0x1c(sp)
lw s0,0x18(sp)
jr ra
_addiu sp,sp,0x30
jalr t9
_nop
lw gp,0x10(sp)
lw v1,0x0(v0)
li v0,0x9
bne v1,v0,0x0001dddc
_or v0,s0,zero
lui a1,0x8
lw a0,-0x7fc8(gp)
addiu a0,a0,-0x474
lw t9,-0x7e4c(gp)
jalr t9
_nop
lw gp,0x10(sp)
beq s2,v0,0x0001de74
_or s4,v0,zero
or a1,s2,zero
or a0,v0,zero
lw t9,-0x7da4(gp)
jalr t9
_nop
lw gp,0x10(sp)
or s2,v0,zero
or a0,s4,zero
lw t9,-0x7ebc(gp)
jalr t9
_nop
lw gp,0x10(sp)
bltz s2,0x0001dddc
_or v0,s0,zero
or a2,s0,zero
or a1,s3,zero
or a0,s1,zero
lw t9,-0x7e3c(gp)
jalr t9
_nop
lw gp,0x10(sp)
b 0x0001ddd8
_or s0,v0,zero
(translation_unit "int rpl_freopen(int param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  iVar1 = (*(code *)PTR_freopen64_00031264)();\n  if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }\n  return iVar1;\n}\n\n" (function_definition "int rpl_freopen(int param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  iVar1 = (*(code *)PTR_freopen64_00031264)();\n  if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }\n  return iVar1;\n}" primitive_type (function_declarator "rpl_freopen(int param_1,undefined4 param_2)" identifier (parameter_list "(int param_1,undefined4 param_2)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  iVar1 = (*(code *)PTR_freopen64_00031264)();\n  if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (expression_statement "iVar1 = (*(code *)PTR_freopen64_00031264)();" (assignment_expression "iVar1 = (*(code *)PTR_freopen64_00031264)()" identifier = (call_expression "(*(code *)PTR_freopen64_00031264)()" (parenthesized_expression "(*(code *)PTR_freopen64_00031264)" ( (pointer_expression "*(code *)PTR_freopen64_00031264" * (cast_expression "(code *)PTR_freopen64_00031264" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( )))) ;) (if_statement "if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }" if (parenthesized_expression "((iVar1 != 0) && (param_1 != 0))" ( (binary_expression "(iVar1 != 0) && (param_1 != 0)" (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) && (parenthesized_expression "(param_1 != 0)" ( (binary_expression "param_1 != 0" identifier != number_literal) ))) )) (compound_statement "{\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }" { (expression_statement "iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);" (assignment_expression "iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1)" identifier = (call_expression "(*(code *)PTR_fileno_0003123c)(iVar1)" (parenthesized_expression "(*(code *)PTR_fileno_0003123c)" ( (pointer_expression "*(code *)PTR_fileno_0003123c" * (cast_expression "(code *)PTR_fileno_0003123c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier )))) ;) (expression_statement "iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);" (assignment_expression "iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2)" identifier = (call_expression "(*(code *)PTR_dup2_000312fc)(iVar2,iVar2)" (parenthesized_expression "(*(code *)PTR_dup2_000312fc)" ( (pointer_expression "*(code *)PTR_dup2_000312fc" * (cast_expression "(code *)PTR_dup2_000312fc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar2,iVar2)" ( identifier , identifier )))) ;) (if_statement "if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }" if (parenthesized_expression "((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9))" ( (binary_expression "(iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)" (parenthesized_expression "(iVar3 < 0)" ( (binary_expression "iVar3 < 0" identifier < number_literal) )) && (parenthesized_expression "(piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)" ( (comma_expression "piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9" (assignment_expression "piVar4 = (int *)(*(code *)PTR___errno_location_00031240)()" identifier = (cast_expression "(int *)(*(code *)PTR___errno_location_00031240)()" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00031240)()" (parenthesized_expression "(*(code *)PTR___errno_location_00031240)" ( (pointer_expression "*(code *)PTR___errno_location_00031240" * (cast_expression "(code *)PTR___errno_location_00031240" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) , (binary_expression "*piVar4 == 9" (pointer_expression "*piVar4" * identifier) == number_literal)) ))) )) (compound_statement "{\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }" { (expression_statement "iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);" (assignment_expression "iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000)" identifier = (call_expression "(*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000)" (parenthesized_expression "(*(code *)PTR_open64_00031254)" ( (pointer_expression "*(code *)PTR_open64_00031254" * (cast_expression "(code *)PTR_open64_00031254" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(PTR_UINT_000310d8 + -0x474,0x80000)" ( (binary_expression "PTR_UINT_000310d8 + -0x474" identifier + number_literal) , number_literal )))) ;) (if_statement "if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }" if (parenthesized_expression "(iVar2 != iVar3)" ( (binary_expression "iVar2 != iVar3" identifier != identifier) )) (compound_statement "{\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }" { (expression_statement "iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);" (assignment_expression "iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2)" identifier = (call_expression "(*(code *)PTR_dup2_000312fc)(iVar3,iVar2)" (parenthesized_expression "(*(code *)PTR_dup2_000312fc)" ( (pointer_expression "*(code *)PTR_dup2_000312fc" * (cast_expression "(code *)PTR_dup2_000312fc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3,iVar2)" ( identifier , identifier )))) ;) (expression_statement "(*(code *)PTR_close_000311e4)(iVar3);" (call_expression "(*(code *)PTR_close_000311e4)(iVar3)" (parenthesized_expression "(*(code *)PTR_close_000311e4)" ( (pointer_expression "*(code *)PTR_close_000311e4" * (cast_expression "(code *)PTR_close_000311e4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3)" ( identifier ))) ;) (if_statement "if (iVar2 < 0) {\n          return iVar1;\n        }" if (parenthesized_expression "(iVar2 < 0)" ( (binary_expression "iVar2 < 0" identifier < number_literal) )) (compound_statement "{\n          return iVar1;\n        }" { (return_statement "return iVar1;" return identifier ;) })) })) (expression_statement "iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);" (assignment_expression "iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1)" identifier = (call_expression "(*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1)" (parenthesized_expression "(*(code *)PTR_freopen64_00031264)" ( (pointer_expression "*(code *)PTR_freopen64_00031264" * (cast_expression "(code *)PTR_freopen64_00031264" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_1,param_2,iVar1)" ( identifier , identifier , identifier )))) ;) })) })) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "FILE * rpl_freopen(char *filename,char *mode,FILE *stream)\n\n{\n  FILE *pFVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)();\n  if ((pFVar1 != (FILE *)0x0) && (filename != (char *)0x0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(pFVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }\n      pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);\n    }\n  }\n  return pFVar1;\n}\n\n" (function_definition "FILE * rpl_freopen(char *filename,char *mode,FILE *stream)\n\n{\n  FILE *pFVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)();\n  if ((pFVar1 != (FILE *)0x0) && (filename != (char *)0x0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(pFVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }\n      pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);\n    }\n  }\n  return pFVar1;\n}" type_identifier (pointer_declarator "* rpl_freopen(char *filename,char *mode,FILE *stream)" * (function_declarator "rpl_freopen(char *filename,char *mode,FILE *stream)" identifier (parameter_list "(char *filename,char *mode,FILE *stream)" ( (parameter_declaration "char *filename" primitive_type (pointer_declarator "*filename" * identifier)) , (parameter_declaration "char *mode" primitive_type (pointer_declarator "*mode" * identifier)) , (parameter_declaration "FILE *stream" type_identifier (pointer_declarator "*stream" * identifier)) )))) (compound_statement "{\n  FILE *pFVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)();\n  if ((pFVar1 != (FILE *)0x0) && (filename != (char *)0x0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(pFVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }\n      pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);\n    }\n  }\n  return pFVar1;\n}" { (declaration "FILE *pFVar1;" type_identifier (pointer_declarator "*pFVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (expression_statement "pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)();" (assignment_expression "pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)()" identifier = (cast_expression "(FILE *)(*(code *)PTR_freopen64_00031264)()" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR_freopen64_00031264)()" (parenthesized_expression "(*(code *)PTR_freopen64_00031264)" ( (pointer_expression "*(code *)PTR_freopen64_00031264" * (cast_expression "(code *)PTR_freopen64_00031264" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (if_statement "if ((pFVar1 != (FILE *)0x0) && (filename != (char *)0x0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(pFVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }\n      pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);\n    }\n  }" if (parenthesized_expression "((pFVar1 != (FILE *)0x0) && (filename != (char *)0x0))" ( (binary_expression "(pFVar1 != (FILE *)0x0) && (filename != (char *)0x0)" (parenthesized_expression "(pFVar1 != (FILE *)0x0)" ( (binary_expression "pFVar1 != (FILE *)0x0" identifier != (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(filename != (char *)0x0)" ( (binary_expression "filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ))) )) (compound_statement "{\n    iVar2 = (*(code *)PTR_fileno_0003123c)(pFVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }\n      pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);\n    }\n  }" { (expression_statement "iVar2 = (*(code *)PTR_fileno_0003123c)(pFVar1);" (assignment_expression "iVar2 = (*(code *)PTR_fileno_0003123c)(pFVar1)" identifier = (call_expression "(*(code *)PTR_fileno_0003123c)(pFVar1)" (parenthesized_expression "(*(code *)PTR_fileno_0003123c)" ( (pointer_expression "*(code *)PTR_fileno_0003123c" * (cast_expression "(code *)PTR_fileno_0003123c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(pFVar1)" ( identifier )))) ;) (expression_statement "iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);" (assignment_expression "iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2)" identifier = (call_expression "(*(code *)PTR_dup2_000312fc)(iVar2,iVar2)" (parenthesized_expression "(*(code *)PTR_dup2_000312fc)" ( (pointer_expression "*(code *)PTR_dup2_000312fc" * (cast_expression "(code *)PTR_dup2_000312fc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar2,iVar2)" ( identifier , identifier )))) ;) (if_statement "if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }\n      pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);\n    }" if (parenthesized_expression "((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9))" ( (binary_expression "(iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)" (parenthesized_expression "(iVar3 < 0)" ( (binary_expression "iVar3 < 0" identifier < number_literal) )) && (parenthesized_expression "(piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)" ( (comma_expression "piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9" (assignment_expression "piVar4 = (int *)(*(code *)PTR___errno_location_00031240)()" identifier = (cast_expression "(int *)(*(code *)PTR___errno_location_00031240)()" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00031240)()" (parenthesized_expression "(*(code *)PTR___errno_location_00031240)" ( (pointer_expression "*(code *)PTR___errno_location_00031240" * (cast_expression "(code *)PTR___errno_location_00031240" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) , (binary_expression "*piVar4 == 9" (pointer_expression "*piVar4" * identifier) == number_literal)) ))) )) (compound_statement "{\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }\n      pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);\n    }" { (expression_statement "iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);" (assignment_expression "iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000)" identifier = (call_expression "(*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000)" (parenthesized_expression "(*(code *)PTR_open64_00031254)" ( (pointer_expression "*(code *)PTR_open64_00031254" * (cast_expression "(code *)PTR_open64_00031254" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(PTR_UINT_000310d8 + -0x474,0x80000)" ( (binary_expression "PTR_UINT_000310d8 + -0x474" identifier + number_literal) , number_literal )))) ;) (if_statement "if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }" if (parenthesized_expression "(iVar2 != iVar3)" ( (binary_expression "iVar2 != iVar3" identifier != identifier) )) (compound_statement "{\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return pFVar1;\n        }\n      }" { (expression_statement "iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);" (assignment_expression "iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2)" identifier = (call_expression "(*(code *)PTR_dup2_000312fc)(iVar3,iVar2)" (parenthesized_expression "(*(code *)PTR_dup2_000312fc)" ( (pointer_expression "*(code *)PTR_dup2_000312fc" * (cast_expression "(code *)PTR_dup2_000312fc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3,iVar2)" ( identifier , identifier )))) ;) (expression_statement "(*(code *)PTR_close_000311e4)(iVar3);" (call_expression "(*(code *)PTR_close_000311e4)(iVar3)" (parenthesized_expression "(*(code *)PTR_close_000311e4)" ( (pointer_expression "*(code *)PTR_close_000311e4" * (cast_expression "(code *)PTR_close_000311e4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3)" ( identifier ))) ;) (if_statement "if (iVar2 < 0) {\n          return pFVar1;\n        }" if (parenthesized_expression "(iVar2 < 0)" ( (binary_expression "iVar2 < 0" identifier < number_literal) )) (compound_statement "{\n          return pFVar1;\n        }" { (return_statement "return pFVar1;" return identifier ;) })) })) (expression_statement "pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1);" (assignment_expression "pFVar1 = (FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1)" identifier = (cast_expression "(FILE *)(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1)" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR_freopen64_00031264)(filename,mode,pFVar1)" (parenthesized_expression "(*(code *)PTR_freopen64_00031264)" ( (pointer_expression "*(code *)PTR_freopen64_00031264" * (cast_expression "(code *)PTR_freopen64_00031264" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(filename,mode,pFVar1)" ( identifier , identifier , identifier ))))) ;) })) })) (return_statement "return pFVar1;" return identifier ;) })))
(translation_unit "int rpl_freopen(int param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  iVar1 = (*(code *)PTR_freopen64_00031264)();\n  if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }\n  return iVar1;\n}\n\n" (function_definition "int rpl_freopen(int param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  iVar1 = (*(code *)PTR_freopen64_00031264)();\n  if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }\n  return iVar1;\n}" primitive_type (function_declarator "rpl_freopen(int param_1,undefined4 param_2)" identifier (parameter_list "(int param_1,undefined4 param_2)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  iVar1 = (*(code *)PTR_freopen64_00031264)();\n  if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (expression_statement "iVar1 = (*(code *)PTR_freopen64_00031264)();" (assignment_expression "iVar1 = (*(code *)PTR_freopen64_00031264)()" identifier = (call_expression "(*(code *)PTR_freopen64_00031264)()" (parenthesized_expression "(*(code *)PTR_freopen64_00031264)" ( (pointer_expression "*(code *)PTR_freopen64_00031264" * (cast_expression "(code *)PTR_freopen64_00031264" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( )))) ;) (if_statement "if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }" if (parenthesized_expression "((iVar1 != 0) && (param_1 != 0))" ( (binary_expression "(iVar1 != 0) && (param_1 != 0)" (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) && (parenthesized_expression "(param_1 != 0)" ( (binary_expression "param_1 != 0" identifier != number_literal) ))) )) (compound_statement "{\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }" { (expression_statement "iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);" (assignment_expression "iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1)" identifier = (call_expression "(*(code *)PTR_fileno_0003123c)(iVar1)" (parenthesized_expression "(*(code *)PTR_fileno_0003123c)" ( (pointer_expression "*(code *)PTR_fileno_0003123c" * (cast_expression "(code *)PTR_fileno_0003123c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier )))) ;) (expression_statement "iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);" (assignment_expression "iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2)" identifier = (call_expression "(*(code *)PTR_dup2_000312fc)(iVar2,iVar2)" (parenthesized_expression "(*(code *)PTR_dup2_000312fc)" ( (pointer_expression "*(code *)PTR_dup2_000312fc" * (cast_expression "(code *)PTR_dup2_000312fc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar2,iVar2)" ( identifier , identifier )))) ;) (if_statement "if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }" if (parenthesized_expression "((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9))" ( (binary_expression "(iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)" (parenthesized_expression "(iVar3 < 0)" ( (binary_expression "iVar3 < 0" identifier < number_literal) )) && (parenthesized_expression "(piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)" ( (comma_expression "piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9" (assignment_expression "piVar4 = (int *)(*(code *)PTR___errno_location_00031240)()" identifier = (cast_expression "(int *)(*(code *)PTR___errno_location_00031240)()" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00031240)()" (parenthesized_expression "(*(code *)PTR___errno_location_00031240)" ( (pointer_expression "*(code *)PTR___errno_location_00031240" * (cast_expression "(code *)PTR___errno_location_00031240" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) , (binary_expression "*piVar4 == 9" (pointer_expression "*piVar4" * identifier) == number_literal)) ))) )) (compound_statement "{\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }" { (expression_statement "iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);" (assignment_expression "iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000)" identifier = (call_expression "(*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000)" (parenthesized_expression "(*(code *)PTR_open64_00031254)" ( (pointer_expression "*(code *)PTR_open64_00031254" * (cast_expression "(code *)PTR_open64_00031254" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(PTR_UINT_000310d8 + -0x474,0x80000)" ( (binary_expression "PTR_UINT_000310d8 + -0x474" identifier + number_literal) , number_literal )))) ;) (if_statement "if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }" if (parenthesized_expression "(iVar2 != iVar3)" ( (binary_expression "iVar2 != iVar3" identifier != identifier) )) (compound_statement "{\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }" { (expression_statement "iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);" (assignment_expression "iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2)" identifier = (call_expression "(*(code *)PTR_dup2_000312fc)(iVar3,iVar2)" (parenthesized_expression "(*(code *)PTR_dup2_000312fc)" ( (pointer_expression "*(code *)PTR_dup2_000312fc" * (cast_expression "(code *)PTR_dup2_000312fc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3,iVar2)" ( identifier , identifier )))) ;) (expression_statement "(*(code *)PTR_close_000311e4)(iVar3);" (call_expression "(*(code *)PTR_close_000311e4)(iVar3)" (parenthesized_expression "(*(code *)PTR_close_000311e4)" ( (pointer_expression "*(code *)PTR_close_000311e4" * (cast_expression "(code *)PTR_close_000311e4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3)" ( identifier ))) ;) (if_statement "if (iVar2 < 0) {\n          return iVar1;\n        }" if (parenthesized_expression "(iVar2 < 0)" ( (binary_expression "iVar2 < 0" identifier < number_literal) )) (compound_statement "{\n          return iVar1;\n        }" { (return_statement "return iVar1;" return identifier ;) })) })) (expression_statement "iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);" (assignment_expression "iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1)" identifier = (call_expression "(*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1)" (parenthesized_expression "(*(code *)PTR_freopen64_00031264)" ( (pointer_expression "*(code *)PTR_freopen64_00031264" * (cast_expression "(code *)PTR_freopen64_00031264" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_1,param_2,iVar1)" ( identifier , identifier , 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) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != LIT) )) && (parenthesized_expression ( (binary_expression IDENT != LIT) ))) )) (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 )))) ;) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT < LIT) )) && (parenthesized_expression ( (comma_expression (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 ( ))))) , (binary_expression (pointer_expression * IDENT) == LIT)) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( (binary_expression IDENT + LIT) , LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != 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 (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT ))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (return_statement return 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 )))) ;) })) })) (return_statement return IDENT ;) })))
(function_definition "int rpl_freopen(int param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  iVar1 = (*(code *)PTR_freopen64_00031264)();\n  if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }\n  return iVar1;\n}" (primitive_type "int") (function_declarator "rpl_freopen(int param_1,undefined4 param_2)" (identifier "rpl_freopen") (parameter_list "(int param_1,undefined4 param_2)" (( "(") (parameter_declaration "int param_1" (primitive_type "int") (identifier "param_1")) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) () ")"))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  int iVar3;\n  int *piVar4;\n  \n  iVar1 = (*(code *)PTR_freopen64_00031264)();\n  if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }\n  return iVar1;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "int *piVar4;" (primitive_type "int") (pointer_declarator "*piVar4" (* "*") (identifier "piVar4")) (; ";")) (expression_statement "iVar1 = (*(code *)PTR_freopen64_00031264)();" (assignment_expression "iVar1 = (*(code *)PTR_freopen64_00031264)()" (identifier "iVar1") (= "=") (call_expression "(*(code *)PTR_freopen64_00031264)()" (parenthesized_expression "(*(code *)PTR_freopen64_00031264)" (( "(") (pointer_expression "*(code *)PTR_freopen64_00031264" (* "*") (cast_expression "(code *)PTR_freopen64_00031264" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_freopen64_00031264"))) () ")")) (argument_list "()" (( "(") () ")")))) (; ";")) (if_statement "if ((iVar1 != 0) && (param_1 != 0)) {\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }" (if "if") (parenthesized_expression "((iVar1 != 0) && (param_1 != 0))" (( "(") (binary_expression "(iVar1 != 0) && (param_1 != 0)" (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(param_1 != 0)" (( "(") (binary_expression "param_1 != 0" (identifier "param_1") (!= "!=") (number_literal "0")) () ")"))) () ")")) (compound_statement "{\n    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);\n    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);\n    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }\n  }" ({ "{") (expression_statement "iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);" (assignment_expression "iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1)" (identifier "iVar2") (= "=") (call_expression "(*(code *)PTR_fileno_0003123c)(iVar1)" (parenthesized_expression "(*(code *)PTR_fileno_0003123c)" (( "(") (pointer_expression "*(code *)PTR_fileno_0003123c" (* "*") (cast_expression "(code *)PTR_fileno_0003123c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_fileno_0003123c"))) () ")")) (argument_list "(iVar1)" (( "(") (identifier "iVar1") () ")")))) (; ";")) (expression_statement "iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);" (assignment_expression "iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2)" (identifier "iVar3") (= "=") (call_expression "(*(code *)PTR_dup2_000312fc)(iVar2,iVar2)" (parenthesized_expression "(*(code *)PTR_dup2_000312fc)" (( "(") (pointer_expression "*(code *)PTR_dup2_000312fc" (* "*") (cast_expression "(code *)PTR_dup2_000312fc" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_dup2_000312fc"))) () ")")) (argument_list "(iVar2,iVar2)" (( "(") (identifier "iVar2") (, ",") (identifier "iVar2") () ")")))) (; ";")) (if_statement "if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }" (if "if") (parenthesized_expression "((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9))" (( "(") (binary_expression "(iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)" (parenthesized_expression "(iVar3 < 0)" (( "(") (binary_expression "iVar3 < 0" (identifier "iVar3") (< "<") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)" (( "(") (comma_expression "piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9" (assignment_expression "piVar4 = (int *)(*(code *)PTR___errno_location_00031240)()" (identifier "piVar4") (= "=") (cast_expression "(int *)(*(code *)PTR___errno_location_00031240)()" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "(*(code *)PTR___errno_location_00031240)()" (parenthesized_expression "(*(code *)PTR___errno_location_00031240)" (( "(") (pointer_expression "*(code *)PTR___errno_location_00031240" (* "*") (cast_expression "(code *)PTR___errno_location_00031240" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR___errno_location_00031240"))) () ")")) (argument_list "()" (( "(") () ")"))))) (, ",") (binary_expression "*piVar4 == 9" (pointer_expression "*piVar4" (* "*") (identifier "piVar4")) (== "==") (number_literal "9"))) () ")"))) () ")")) (compound_statement "{\n      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);\n      if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }\n      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);\n    }" ({ "{") (expression_statement "iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);" (assignment_expression "iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000)" (identifier "iVar3") (= "=") (call_expression "(*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000)" (parenthesized_expression "(*(code *)PTR_open64_00031254)" (( "(") (pointer_expression "*(code *)PTR_open64_00031254" (* "*") (cast_expression "(code *)PTR_open64_00031254" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_open64_00031254"))) () ")")) (argument_list "(PTR_UINT_000310d8 + -0x474,0x80000)" (( "(") (binary_expression "PTR_UINT_000310d8 + -0x474" (identifier "PTR_UINT_000310d8") (+ "+") (number_literal "-0x474")) (, ",") (number_literal "0x80000") () ")")))) (; ";")) (if_statement "if (iVar2 != iVar3) {\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }" (if "if") (parenthesized_expression "(iVar2 != iVar3)" (( "(") (binary_expression "iVar2 != iVar3" (identifier "iVar2") (!= "!=") (identifier "iVar3")) () ")")) (compound_statement "{\n        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);\n        (*(code *)PTR_close_000311e4)(iVar3);\n        if (iVar2 < 0) {\n          return iVar1;\n        }\n      }" ({ "{") (expression_statement "iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);" (assignment_expression "iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2)" (identifier "iVar2") (= "=") (call_expression "(*(code *)PTR_dup2_000312fc)(iVar3,iVar2)" (parenthesized_expression "(*(code *)PTR_dup2_000312fc)" (( "(") (pointer_expression "*(code *)PTR_dup2_000312fc" (* "*") (cast_expression "(code *)PTR_dup2_000312fc" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_dup2_000312fc"))) () ")")) (argument_list "(iVar3,iVar2)" (( "(") (identifier "iVar3") (, ",") (identifier "iVar2") () ")")))) (; ";")) (expression_statement "(*(code *)PTR_close_000311e4)(iVar3);" (call_expression "(*(code *)PTR_close_000311e4)(iVar3)" (parenthesized_expression "(*(code *)PTR_close_000311e4)" (( "(") (pointer_expression "*(code *)PTR_close_000311e4" (* "*") (cast_expression "(code *)PTR_close_000311e4" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_000311e4"))) () ")")) (argument_list "(iVar3)" (( "(") (identifier "iVar3") () ")"))) (; ";")) (if_statement "if (iVar2 < 0) {\n          return iVar1;\n        }" (if "if") (parenthesized_expression "(iVar2 < 0)" (( "(") (binary_expression "iVar2 < 0" (identifier "iVar2") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n          return iVar1;\n        }" ({ "{") (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}"))) (} "}"))) (expression_statement "iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);" (assignment_expression "iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1)" (identifier "iVar1") (= "=") (call_expression "(*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1)" (parenthesized_expression "(*(code *)PTR_freopen64_00031264)" (( "(") (pointer_expression "*(code *)PTR_freopen64_00031264" (* "*") (cast_expression "(code *)PTR_freopen64_00031264" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_freopen64_00031264"))) () ")")) (argument_list "(param_1,param_2,iVar1)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "iVar1") () ")")))) (; ";")) (} "}"))) (} "}"))) (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}")))
(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)))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (pointer_declarator 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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) 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))))) (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))))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) right: (parenthesized_expression (comma_expression left: (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) 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)))) right: (binary_expression left: (pointer_expression argument: (identifier)) right: (number_literal)))))) 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 (binary_expression left: (identifier) right: (number_literal)) (number_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) 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 (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)))) (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: (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))))))))) (return_statement (identifier)))))

int MASKED(int param_1,undefined4 param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  
  iVar1 = (*(code *)PTR_freopen64_00031264)();
  if ((iVar1 != 0) && (param_1 != 0)) {
    iVar2 = (*(code *)PTR_fileno_0003123c)(iVar1);
    iVar3 = (*(code *)PTR_dup2_000312fc)(iVar2,iVar2);
    if ((iVar3 < 0) && (piVar4 = (int *)(*(code *)PTR___errno_location_00031240)(), *piVar4 == 9)) {
      iVar3 = (*(code *)PTR_open64_00031254)(PTR_UINT_000310d8 + -0x474,0x80000);
      if (iVar2 != iVar3) {
        iVar2 = (*(code *)PTR_dup2_000312fc)(iVar3,iVar2);
        (*(code *)PTR_close_000311e4)(iVar3);
        if (iVar2 < 0) {
          return iVar1;
        }
      }
      iVar1 = (*(code *)PTR_freopen64_00031264)(param_1,param_2,iVar1);
    }
  }
  return iVar1;
}

