
FILE * freopen_safer(char *name,char *mode,FILE *f)

{
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  undefined3 extraout_var_01;
  int iVar1;
  undefined4 *puVar2;
  _Bool _Var4;
  FILE *pFVar3;
  uint uVar5;
  uint uVar6;
  undefined4 uVar7;
  
  iVar1 = (*(code *)PTR_fileno_0003021c)(f);
  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();
  if (iVar1 != 1) {
    uVar6 = 0;
    if (iVar1 == 2) {
LAB_00018354:
      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);
      uVar5 = (uint)(iVar1 != 1);
      goto LAB_00018370;
    }
    if (iVar1 != 0) {
      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);
      uVar6 = (uint)(iVar1 != 2);
      goto LAB_00018354;
    }
    uVar5 = 0;
    iVar1 = 0;
    goto LAB_000183cc;
  }
  uVar6 = 0;
  uVar5 = 0;
LAB_00018370:
  iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);
  if (iVar1 == 0) {
    iVar1 = 0;
    if (uVar5 == 0) {
LAB_000183ac:
      if (uVar6 == 0) {
LAB_000183cc:
        pFVar3 = rpl_freopen(name,mode,f);
        goto LAB_000183e8;
      }
      _Var4 = protect_fd(2);
      uVar6 = CONCAT31(extraout_var_00,_Var4);
      if (uVar6 != 0) goto LAB_000183cc;
      uVar7 = *puVar2;
      pFVar3 = (FILE *)0x0;
      goto LAB_000184c8;
    }
LAB_0001843c:
    _Var4 = protect_fd(1);
    uVar5 = CONCAT31(extraout_var_01,_Var4);
    if (uVar5 != 0) goto LAB_000183ac;
    uVar7 = *puVar2;
    if (uVar6 != 0) {
      (*(code *)PTR_close_000301c4)(2);
    }
    pFVar3 = (FILE *)0x0;
  }
  else {
    _Var4 = protect_fd(0);
    iVar1 = CONCAT31(extraout_var,_Var4);
    if (iVar1 != 0) {
      if (uVar5 != 0) goto LAB_0001843c;
      goto LAB_000183ac;
    }
    iVar1 = 1;
    pFVar3 = (FILE *)0x0;
LAB_000183e8:
    uVar7 = *puVar2;
    if (uVar6 != 0) {
LAB_000184c8:
      (*(code *)PTR_close_000301c4)(2);
    }
    if (uVar5 == 0) goto joined_r0x0001846c;
  }
  (*(code *)PTR_close_000301c4)(1);
joined_r0x0001846c:
  if (iVar1 != 0) {
    (*(code *)PTR_close_000301c4)(0);
  }
  if (pFVar3 == (FILE *)0x0) {
    *puVar2 = uVar7;
    return (FILE *)0x0;
  }
  return pFVar3;
}



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

{
  int iVar1;
  undefined4 *puVar2;
  int iVar3;
  uint uVar4;
  uint uVar5;
  undefined4 uVar6;
  
  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);
  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();
  if (iVar1 == 1) {
    uVar5 = 0;
    uVar4 = 0;
LAB_00018370:
    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);
    if (iVar1 != 0) {
      iVar1 = FUN_00018210(0);
      if (iVar1 != 0) {
        if (uVar4 != 0) goto LAB_0001843c;
        goto LAB_000183ac;
      }
      iVar1 = 1;
      iVar3 = 0;
      goto LAB_000183e8;
    }
    iVar1 = 0;
    if (uVar4 == 0) {
LAB_000183ac:
      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;
      uVar6 = *puVar2;
      iVar3 = 0;
      goto LAB_000184c8;
    }
LAB_0001843c:
    uVar4 = FUN_00018210(1);
    if (uVar4 != 0) goto LAB_000183ac;
    uVar6 = *puVar2;
    if (uVar5 != 0) {
      (*(code *)PTR_close_000301c4)(2);
    }
    iVar3 = 0;
  }
  else {
    uVar5 = 0;
    if (iVar1 == 2) {
LAB_00018354:
      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);
      uVar4 = (uint)(iVar1 != 1);
      goto LAB_00018370;
    }
    if (iVar1 != 0) {
      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);
      uVar5 = (uint)(iVar1 != 2);
      goto LAB_00018354;
    }
    uVar4 = 0;
    iVar1 = 0;
LAB_000183cc:
    iVar3 = rpl_freopen(param_1,param_2,param_3);
LAB_000183e8:
    uVar6 = *puVar2;
    if (uVar5 != 0) {
LAB_000184c8:
      (*(code *)PTR_close_000301c4)(2);
    }
    if (uVar4 == 0) goto joined_r0x000183f8;
  }
  (*(code *)PTR_close_000301c4)(1);
joined_r0x000183f8:
  if (iVar1 != 0) {
    (*(code *)PTR_close_000301c4)(0);
  }
  if (iVar3 == 0) {
    *puVar2 = uVar6;
    return 0;
  }
  return iVar3;
}


lui gp,0x2
addiu gp,gp,-0x21c
addu gp,gp,t9
addiu sp,sp,-0x38
lw t9,-0x7e84(gp)
sw gp,0x10(sp)
sw ra,0x34(sp)
sw s6,0x30(sp)
or s6,a1,zero
sw s5,0x2c(sp)
or s5,a0,zero
sw s4,0x28(sp)
or a0,a2,zero
sw s2,0x20(sp)
or s2,a2,zero
sw s0,0x18(sp)
sw s3,0x24(sp)
jalr t9
_sw s1,0x1c(sp)
lw gp,0x10(sp)
lw t9,-0x7e80(gp)
jalr t9
_or s0,v0,zero
li v1,0x1
lw gp,0x10(sp)
beq s0,v1,0x000184dc
_or s4,v0,zero
li v0,0x2
beq s0,v0,0x00018354
_or s1,zero,zero
beq s0,zero,0x000184b4
_lw t9,-0x7dc4(gp)
li a1,0x2
jalr t9
_li a0,0x2
lw gp,0x10(sp)
xori v0,v0,0x2
sltu s1,zero,v0
lw t9,-0x7dc4(gp)
li a1,0x1
jalr t9
_li a0,0x1
lw gp,0x10(sp)
xori v0,v0,0x1
sltu s0,zero,v0
lw t9,-0x7dc4(gp)
or a1,zero,zero
jalr t9
_or a0,zero,zero
beq v0,zero,0x00018430
_lw gp,0x10(sp)
lw t9,-0x7fc8(gp)
addiu t9,t9,-0x7df0
bal 0x00018210
_or a0,zero,zero
lw gp,0x10(sp)
beq v0,zero,0x000184e8
_or s3,v0,zero
bne s0,zero,0x0001843c
_lw t9,-0x7fc8(gp)
beq s1,zero,0x000183cc
_lw t9,-0x7fc8(gp)
addiu t9,t9,-0x7df0
bal 0x00018210
_li a0,0x2
lw gp,0x10(sp)
beq v0,zero,0x000184c0
_or s1,v0,zero
lw t9,-0x7f28(gp)
or a2,s2,zero
or a1,s6,zero
bal 0x0001ce00
_or a0,s5,zero
lw gp,0x10(sp)
or s2,v0,zero
bne s1,zero,0x000184c8
_lw s5,0x0(s4)
bne s0,zero,0x00018464
_lw t9,-0x7edc(gp)
bne s3,zero,0x00018478
_nop
beq s2,zero,0x00018488
_lw ra,0x34(sp)
or v0,s2,zero
lw s6,0x30(sp)
lw s5,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,0x38
beq s0,zero,0x000183ac
_or s3,zero,zero
lw t9,-0x7fc8(gp)
addiu t9,t9,-0x7df0
bal 0x00018210
_li a0,0x1
lw gp,0x10(sp)
bne v0,zero,0x000183ac
_or s0,v0,zero
bne s1,zero,0x000184f4
_lw s5,0x0(s4)
or s2,zero,zero
lw t9,-0x7edc(gp)
jalr t9
_li a0,0x1
beq s3,zero,0x00018400
_lw gp,0x10(sp)
lw t9,-0x7edc(gp)
jalr t9
_or a0,zero,zero
bne s2,zero,0x00018408
_lw ra,0x34(sp)
or v0,s2,zero
lw s6,0x30(sp)
lw s3,0x24(sp)
lw s2,0x20(sp)
lw s1,0x1c(sp)
lw s0,0x18(sp)
sw s5,0x0(s4)
lw s5,0x2c(sp)
lw s4,0x28(sp)
jr ra
_addiu sp,sp,0x38
or s0,zero,zero
b 0x000183cc
_or s3,zero,zero
lw s5,0x0(s4)
or s2,zero,zero
lw t9,-0x7edc(gp)
jalr t9
_li a0,0x2
b 0x000183f0
_lw gp,0x10(sp)
or s1,zero,zero
b 0x00018370
_or s0,zero,zero
li s3,0x1
b 0x000183e8
_or s2,zero,zero
lw t9,-0x7edc(gp)
li a0,0x2
jalr t9
_or s2,zero,zero
b 0x00018460
_lw gp,0x10(sp)
(translation_unit "int freopen_safer(undefined4 param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  undefined4 *puVar2;\n  int iVar3;\n  uint uVar4;\n  uint uVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }\n  return iVar3;\n}\n\n" (function_definition "int freopen_safer(undefined4 param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  undefined4 *puVar2;\n  int iVar3;\n  uint uVar4;\n  uint uVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }\n  return iVar3;\n}" primitive_type (function_declarator "freopen_safer(undefined4 param_1,undefined4 param_2,undefined4 param_3)" identifier (parameter_list "(undefined4 param_1,undefined4 param_2,undefined4 param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  undefined4 *puVar2;\n  int iVar3;\n  uint uVar4;\n  uint uVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }\n  return iVar3;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "undefined4 *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "uint uVar4;" type_identifier identifier ;) (declaration "uint uVar5;" type_identifier identifier ;) (declaration "undefined4 uVar6;" type_identifier identifier ;) (expression_statement "iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);" (assignment_expression "iVar1 = (*(code *)PTR_fileno_0003021c)(param_3)" identifier = (call_expression "(*(code *)PTR_fileno_0003021c)(param_3)" (parenthesized_expression "(*(code *)PTR_fileno_0003021c)" ( (pointer_expression "*(code *)PTR_fileno_0003021c" * (cast_expression "(code *)PTR_fileno_0003021c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_3)" ( identifier )))) ;) (expression_statement "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();" (assignment_expression "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00030220)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00030220)()" (parenthesized_expression "(*(code *)PTR___errno_location_00030220)" ( (pointer_expression "*(code *)PTR___errno_location_00030220" * (cast_expression "(code *)PTR___errno_location_00030220" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (if_statement "if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" if (parenthesized_expression "(iVar1 == 1)" ( (binary_expression "iVar1 == 1" identifier == number_literal) )) (compound_statement "{\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }" { (expression_statement "uVar5 = 0;" (assignment_expression "uVar5 = 0" identifier = number_literal) ;) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" identifier = number_literal) ;) (labeled_statement "LAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);" statement_identifier : (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(0,0)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(0,0)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(0,0)" ( number_literal , number_literal )))) ;)) (if_statement "if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }" { (expression_statement "iVar1 = FUN_00018210(0);" (assignment_expression "iVar1 = FUN_00018210(0)" identifier = (call_expression "FUN_00018210(0)" identifier (argument_list "(0)" ( number_literal )))) ;) (if_statement "if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }" { (if_statement "if (uVar4 != 0) goto LAB_0001843c;" if (parenthesized_expression "(uVar4 != 0)" ( (binary_expression "uVar4 != 0" identifier != number_literal) )) (goto_statement "goto LAB_0001843c;" goto statement_identifier ;)) (goto_statement "goto LAB_000183ac;" goto statement_identifier ;) })) (expression_statement "iVar1 = 1;" (assignment_expression "iVar1 = 1" identifier = number_literal) ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_000183e8;" goto statement_identifier ;) })) (expression_statement "iVar1 = 0;" (assignment_expression "iVar1 = 0" identifier = number_literal) ;) (if_statement "if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }" if (parenthesized_expression "(uVar4 == 0)" ( (binary_expression "uVar4 == 0" identifier == number_literal) )) (compound_statement "{\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }" { (labeled_statement "LAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;" statement_identifier : (if_statement "if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;" if (parenthesized_expression "((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0))" ( (binary_expression "(uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)" (parenthesized_expression "(uVar5 == 0)" ( (binary_expression "uVar5 == 0" identifier == number_literal) )) || (parenthesized_expression "(uVar5 = FUN_00018210(2), uVar5 != 0)" ( (comma_expression "uVar5 = FUN_00018210(2), uVar5 != 0" (assignment_expression "uVar5 = FUN_00018210(2)" identifier = (call_expression "FUN_00018210(2)" identifier (argument_list "(2)" ( number_literal )))) , (binary_expression "uVar5 != 0" identifier != number_literal)) ))) )) (goto_statement "goto LAB_000183cc;" goto statement_identifier ;))) (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_000184c8;" goto statement_identifier ;) })) (labeled_statement "LAB_0001843c:\n    uVar4 = FUN_00018210(1);" statement_identifier : (expression_statement "uVar4 = FUN_00018210(1);" (assignment_expression "uVar4 = FUN_00018210(1)" identifier = (call_expression "FUN_00018210(1)" identifier (argument_list "(1)" ( number_literal )))) ;)) (if_statement "if (uVar4 != 0) goto LAB_000183ac;" if (parenthesized_expression "(uVar4 != 0)" ( (binary_expression "uVar4 != 0" identifier != number_literal) )) (goto_statement "goto LAB_000183ac;" goto statement_identifier ;)) (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (if_statement "if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }" if (parenthesized_expression "(uVar5 != 0)" ( (binary_expression "uVar5 != 0" identifier != number_literal) )) (compound_statement "{\n      (*(code *)PTR_close_000301c4)(2);\n    }" { (expression_statement "(*(code *)PTR_close_000301c4)(2);" (call_expression "(*(code *)PTR_close_000301c4)(2)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2)" ( number_literal ))) ;) })) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) }) (else_clause "else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" else (compound_statement "{\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" { (expression_statement "uVar5 = 0;" (assignment_expression "uVar5 = 0" identifier = number_literal) ;) (if_statement "if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }" if (parenthesized_expression "(iVar1 == 2)" ( (binary_expression "iVar1 == 2" identifier == number_literal) )) (compound_statement "{\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }" { (labeled_statement "LAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);" statement_identifier : (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(1,1)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(1,1)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(1,1)" ( number_literal , number_literal )))) ;)) (expression_statement "uVar4 = (uint)(iVar1 != 1);" (assignment_expression "uVar4 = (uint)(iVar1 != 1)" identifier = (call_expression "(uint)(iVar1 != 1)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(iVar1 != 1)" ( (binary_expression "iVar1 != 1" identifier != number_literal) )))) ;) (goto_statement "goto LAB_00018370;" goto statement_identifier ;) })) (if_statement "if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }" { (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(2,2)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(2,2)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2,2)" ( number_literal , number_literal )))) ;) (expression_statement "uVar5 = (uint)(iVar1 != 2);" (assignment_expression "uVar5 = (uint)(iVar1 != 2)" identifier = (call_expression "(uint)(iVar1 != 2)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(iVar1 != 2)" ( (binary_expression "iVar1 != 2" identifier != number_literal) )))) ;) (goto_statement "goto LAB_00018354;" goto statement_identifier ;) })) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" identifier = number_literal) ;) (expression_statement "iVar1 = 0;" (assignment_expression "iVar1 = 0" identifier = number_literal) ;) (labeled_statement "LAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);" statement_identifier : (expression_statement "iVar3 = rpl_freopen(param_1,param_2,param_3);" (assignment_expression "iVar3 = rpl_freopen(param_1,param_2,param_3)" identifier = (call_expression "rpl_freopen(param_1,param_2,param_3)" identifier (argument_list "(param_1,param_2,param_3)" ( identifier , identifier , identifier )))) ;)) (labeled_statement "LAB_000183e8:\n    uVar6 = *puVar2;" statement_identifier : (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;)) (if_statement "if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }" if (parenthesized_expression "(uVar5 != 0)" ( (binary_expression "uVar5 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }" { (labeled_statement "LAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);" statement_identifier : (expression_statement "(*(code *)PTR_close_000301c4)(2);" (call_expression "(*(code *)PTR_close_000301c4)(2)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2)" ( number_literal ))) ;)) })) (if_statement "if (uVar4 == 0) goto joined_r0x000183f8;" if (parenthesized_expression "(uVar4 == 0)" ( (binary_expression "uVar4 == 0" identifier == number_literal) )) (goto_statement "goto joined_r0x000183f8;" goto statement_identifier ;)) }))) (expression_statement "(*(code *)PTR_close_000301c4)(1);" (call_expression "(*(code *)PTR_close_000301c4)(1)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(1)" ( number_literal ))) ;) (labeled_statement "joined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }" statement_identifier : (if_statement "if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n    (*(code *)PTR_close_000301c4)(0);\n  }" { (expression_statement "(*(code *)PTR_close_000301c4)(0);" (call_expression "(*(code *)PTR_close_000301c4)(0)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(0)" ( number_literal ))) ;) }))) (if_statement "if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n    *puVar2 = uVar6;\n    return 0;\n  }" { (expression_statement "*puVar2 = uVar6;" (assignment_expression "*puVar2 = uVar6" (pointer_expression "*puVar2" * identifier) = identifier) ;) (return_statement "return 0;" return number_literal ;) })) (return_statement "return iVar3;" return identifier ;) })))
(translation_unit "FILE * freopen_safer(char *name,char *mode,FILE *f)\n\n{\n  undefined3 extraout_var;\n  undefined3 extraout_var_00;\n  undefined3 extraout_var_01;\n  int iVar1;\n  undefined4 *puVar2;\n  _Bool _Var4;\n  FILE *pFVar3;\n  uint uVar5;\n  uint uVar6;\n  undefined4 uVar7;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(f);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 != 1) {\n    uVar6 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar5 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar6 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar5 = 0;\n    iVar1 = 0;\n    goto LAB_000183cc;\n  }\n  uVar6 = 0;\n  uVar5 = 0;\nLAB_00018370:\n  iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n  if (iVar1 == 0) {\n    iVar1 = 0;\n    if (uVar5 == 0) {\nLAB_000183ac:\n      if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }\n      _Var4 = protect_fd(2);\n      uVar6 = CONCAT31(extraout_var_00,_Var4);\n      if (uVar6 != 0) goto LAB_000183cc;\n      uVar7 = *puVar2;\n      pFVar3 = (FILE *)0x0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    _Var4 = protect_fd(1);\n    uVar5 = CONCAT31(extraout_var_01,_Var4);\n    if (uVar5 != 0) goto LAB_000183ac;\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    pFVar3 = (FILE *)0x0;\n  }\n  else {\n    _Var4 = protect_fd(0);\n    iVar1 = CONCAT31(extraout_var,_Var4);\n    if (iVar1 != 0) {\n      if (uVar5 != 0) goto LAB_0001843c;\n      goto LAB_000183ac;\n    }\n    iVar1 = 1;\n    pFVar3 = (FILE *)0x0;\nLAB_000183e8:\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar5 == 0) goto joined_r0x0001846c;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x0001846c:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (pFVar3 == (FILE *)0x0) {\n    *puVar2 = uVar7;\n    return (FILE *)0x0;\n  }\n  return pFVar3;\n}\n\n" (function_definition "FILE * freopen_safer(char *name,char *mode,FILE *f)\n\n{\n  undefined3 extraout_var;\n  undefined3 extraout_var_00;\n  undefined3 extraout_var_01;\n  int iVar1;\n  undefined4 *puVar2;\n  _Bool _Var4;\n  FILE *pFVar3;\n  uint uVar5;\n  uint uVar6;\n  undefined4 uVar7;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(f);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 != 1) {\n    uVar6 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar5 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar6 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar5 = 0;\n    iVar1 = 0;\n    goto LAB_000183cc;\n  }\n  uVar6 = 0;\n  uVar5 = 0;\nLAB_00018370:\n  iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n  if (iVar1 == 0) {\n    iVar1 = 0;\n    if (uVar5 == 0) {\nLAB_000183ac:\n      if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }\n      _Var4 = protect_fd(2);\n      uVar6 = CONCAT31(extraout_var_00,_Var4);\n      if (uVar6 != 0) goto LAB_000183cc;\n      uVar7 = *puVar2;\n      pFVar3 = (FILE *)0x0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    _Var4 = protect_fd(1);\n    uVar5 = CONCAT31(extraout_var_01,_Var4);\n    if (uVar5 != 0) goto LAB_000183ac;\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    pFVar3 = (FILE *)0x0;\n  }\n  else {\n    _Var4 = protect_fd(0);\n    iVar1 = CONCAT31(extraout_var,_Var4);\n    if (iVar1 != 0) {\n      if (uVar5 != 0) goto LAB_0001843c;\n      goto LAB_000183ac;\n    }\n    iVar1 = 1;\n    pFVar3 = (FILE *)0x0;\nLAB_000183e8:\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar5 == 0) goto joined_r0x0001846c;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x0001846c:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (pFVar3 == (FILE *)0x0) {\n    *puVar2 = uVar7;\n    return (FILE *)0x0;\n  }\n  return pFVar3;\n}" type_identifier (pointer_declarator "* freopen_safer(char *name,char *mode,FILE *f)" * (function_declarator "freopen_safer(char *name,char *mode,FILE *f)" identifier (parameter_list "(char *name,char *mode,FILE *f)" ( (parameter_declaration "char *name" primitive_type (pointer_declarator "*name" * identifier)) , (parameter_declaration "char *mode" primitive_type (pointer_declarator "*mode" * identifier)) , (parameter_declaration "FILE *f" type_identifier (pointer_declarator "*f" * identifier)) )))) (compound_statement "{\n  undefined3 extraout_var;\n  undefined3 extraout_var_00;\n  undefined3 extraout_var_01;\n  int iVar1;\n  undefined4 *puVar2;\n  _Bool _Var4;\n  FILE *pFVar3;\n  uint uVar5;\n  uint uVar6;\n  undefined4 uVar7;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(f);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 != 1) {\n    uVar6 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar5 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar6 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar5 = 0;\n    iVar1 = 0;\n    goto LAB_000183cc;\n  }\n  uVar6 = 0;\n  uVar5 = 0;\nLAB_00018370:\n  iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n  if (iVar1 == 0) {\n    iVar1 = 0;\n    if (uVar5 == 0) {\nLAB_000183ac:\n      if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }\n      _Var4 = protect_fd(2);\n      uVar6 = CONCAT31(extraout_var_00,_Var4);\n      if (uVar6 != 0) goto LAB_000183cc;\n      uVar7 = *puVar2;\n      pFVar3 = (FILE *)0x0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    _Var4 = protect_fd(1);\n    uVar5 = CONCAT31(extraout_var_01,_Var4);\n    if (uVar5 != 0) goto LAB_000183ac;\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    pFVar3 = (FILE *)0x0;\n  }\n  else {\n    _Var4 = protect_fd(0);\n    iVar1 = CONCAT31(extraout_var,_Var4);\n    if (iVar1 != 0) {\n      if (uVar5 != 0) goto LAB_0001843c;\n      goto LAB_000183ac;\n    }\n    iVar1 = 1;\n    pFVar3 = (FILE *)0x0;\nLAB_000183e8:\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar5 == 0) goto joined_r0x0001846c;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x0001846c:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (pFVar3 == (FILE *)0x0) {\n    *puVar2 = uVar7;\n    return (FILE *)0x0;\n  }\n  return pFVar3;\n}" { (declaration "undefined3 extraout_var;" type_identifier identifier ;) (declaration "undefined3 extraout_var_00;" type_identifier identifier ;) (declaration "undefined3 extraout_var_01;" type_identifier identifier ;) (declaration "int iVar1;" primitive_type identifier ;) (declaration "undefined4 *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "_Bool _Var4;" type_identifier identifier ;) (declaration "FILE *pFVar3;" type_identifier (pointer_declarator "*pFVar3" * identifier) ;) (declaration "uint uVar5;" type_identifier identifier ;) (declaration "uint uVar6;" type_identifier identifier ;) (declaration "undefined4 uVar7;" type_identifier identifier ;) (expression_statement "iVar1 = (*(code *)PTR_fileno_0003021c)(f);" (assignment_expression "iVar1 = (*(code *)PTR_fileno_0003021c)(f)" identifier = (call_expression "(*(code *)PTR_fileno_0003021c)(f)" (parenthesized_expression "(*(code *)PTR_fileno_0003021c)" ( (pointer_expression "*(code *)PTR_fileno_0003021c" * (cast_expression "(code *)PTR_fileno_0003021c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(f)" ( identifier )))) ;) (expression_statement "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();" (assignment_expression "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00030220)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00030220)()" (parenthesized_expression "(*(code *)PTR___errno_location_00030220)" ( (pointer_expression "*(code *)PTR___errno_location_00030220" * (cast_expression "(code *)PTR___errno_location_00030220" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (if_statement "if (iVar1 != 1) {\n    uVar6 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar5 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar6 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar5 = 0;\n    iVar1 = 0;\n    goto LAB_000183cc;\n  }" if (parenthesized_expression "(iVar1 != 1)" ( (binary_expression "iVar1 != 1" identifier != number_literal) )) (compound_statement "{\n    uVar6 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar5 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar6 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar5 = 0;\n    iVar1 = 0;\n    goto LAB_000183cc;\n  }" { (expression_statement "uVar6 = 0;" (assignment_expression "uVar6 = 0" identifier = number_literal) ;) (if_statement "if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar5 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }" if (parenthesized_expression "(iVar1 == 2)" ( (binary_expression "iVar1 == 2" identifier == number_literal) )) (compound_statement "{\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar5 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }" { (labeled_statement "LAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);" statement_identifier : (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(1,1)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(1,1)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(1,1)" ( number_literal , number_literal )))) ;)) (expression_statement "uVar5 = (uint)(iVar1 != 1);" (assignment_expression "uVar5 = (uint)(iVar1 != 1)" identifier = (call_expression "(uint)(iVar1 != 1)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(iVar1 != 1)" ( (binary_expression "iVar1 != 1" identifier != number_literal) )))) ;) (goto_statement "goto LAB_00018370;" goto statement_identifier ;) })) (if_statement "if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar6 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar6 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }" { (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(2,2)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(2,2)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2,2)" ( number_literal , number_literal )))) ;) (expression_statement "uVar6 = (uint)(iVar1 != 2);" (assignment_expression "uVar6 = (uint)(iVar1 != 2)" identifier = (call_expression "(uint)(iVar1 != 2)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(iVar1 != 2)" ( (binary_expression "iVar1 != 2" identifier != number_literal) )))) ;) (goto_statement "goto LAB_00018354;" goto statement_identifier ;) })) (expression_statement "uVar5 = 0;" (assignment_expression "uVar5 = 0" identifier = number_literal) ;) (expression_statement "iVar1 = 0;" (assignment_expression "iVar1 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_000183cc;" goto statement_identifier ;) })) (expression_statement "uVar6 = 0;" (assignment_expression "uVar6 = 0" identifier = number_literal) ;) (expression_statement "uVar5 = 0;" (assignment_expression "uVar5 = 0" identifier = number_literal) ;) (labeled_statement "LAB_00018370:\n  iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);" statement_identifier : (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(0,0)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(0,0)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(0,0)" ( number_literal , number_literal )))) ;)) (if_statement "if (iVar1 == 0) {\n    iVar1 = 0;\n    if (uVar5 == 0) {\nLAB_000183ac:\n      if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }\n      _Var4 = protect_fd(2);\n      uVar6 = CONCAT31(extraout_var_00,_Var4);\n      if (uVar6 != 0) goto LAB_000183cc;\n      uVar7 = *puVar2;\n      pFVar3 = (FILE *)0x0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    _Var4 = protect_fd(1);\n    uVar5 = CONCAT31(extraout_var_01,_Var4);\n    if (uVar5 != 0) goto LAB_000183ac;\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    pFVar3 = (FILE *)0x0;\n  }\n  else {\n    _Var4 = protect_fd(0);\n    iVar1 = CONCAT31(extraout_var,_Var4);\n    if (iVar1 != 0) {\n      if (uVar5 != 0) goto LAB_0001843c;\n      goto LAB_000183ac;\n    }\n    iVar1 = 1;\n    pFVar3 = (FILE *)0x0;\nLAB_000183e8:\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar5 == 0) goto joined_r0x0001846c;\n  }" if (parenthesized_expression "(iVar1 == 0)" ( (binary_expression "iVar1 == 0" identifier == number_literal) )) (compound_statement "{\n    iVar1 = 0;\n    if (uVar5 == 0) {\nLAB_000183ac:\n      if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }\n      _Var4 = protect_fd(2);\n      uVar6 = CONCAT31(extraout_var_00,_Var4);\n      if (uVar6 != 0) goto LAB_000183cc;\n      uVar7 = *puVar2;\n      pFVar3 = (FILE *)0x0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    _Var4 = protect_fd(1);\n    uVar5 = CONCAT31(extraout_var_01,_Var4);\n    if (uVar5 != 0) goto LAB_000183ac;\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    pFVar3 = (FILE *)0x0;\n  }" { (expression_statement "iVar1 = 0;" (assignment_expression "iVar1 = 0" identifier = number_literal) ;) (if_statement "if (uVar5 == 0) {\nLAB_000183ac:\n      if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }\n      _Var4 = protect_fd(2);\n      uVar6 = CONCAT31(extraout_var_00,_Var4);\n      if (uVar6 != 0) goto LAB_000183cc;\n      uVar7 = *puVar2;\n      pFVar3 = (FILE *)0x0;\n      goto LAB_000184c8;\n    }" if (parenthesized_expression "(uVar5 == 0)" ( (binary_expression "uVar5 == 0" identifier == number_literal) )) (compound_statement "{\nLAB_000183ac:\n      if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }\n      _Var4 = protect_fd(2);\n      uVar6 = CONCAT31(extraout_var_00,_Var4);\n      if (uVar6 != 0) goto LAB_000183cc;\n      uVar7 = *puVar2;\n      pFVar3 = (FILE *)0x0;\n      goto LAB_000184c8;\n    }" { (labeled_statement "LAB_000183ac:\n      if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }" statement_identifier : (if_statement "if (uVar6 == 0) {\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }" if (parenthesized_expression "(uVar6 == 0)" ( (binary_expression "uVar6 == 0" identifier == number_literal) )) (compound_statement "{\nLAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);\n        goto LAB_000183e8;\n      }" { (labeled_statement "LAB_000183cc:\n        pFVar3 = rpl_freopen(name,mode,f);" statement_identifier : (expression_statement "pFVar3 = rpl_freopen(name,mode,f);" (assignment_expression "pFVar3 = rpl_freopen(name,mode,f)" identifier = (call_expression "rpl_freopen(name,mode,f)" identifier (argument_list "(name,mode,f)" ( identifier , identifier , identifier )))) ;)) (goto_statement "goto LAB_000183e8;" goto statement_identifier ;) }))) (expression_statement "_Var4 = protect_fd(2);" (assignment_expression "_Var4 = protect_fd(2)" identifier = (call_expression "protect_fd(2)" identifier (argument_list "(2)" ( number_literal )))) ;) (expression_statement "uVar6 = CONCAT31(extraout_var_00,_Var4);" (assignment_expression "uVar6 = CONCAT31(extraout_var_00,_Var4)" identifier = (call_expression "CONCAT31(extraout_var_00,_Var4)" identifier (argument_list "(extraout_var_00,_Var4)" ( identifier , identifier )))) ;) (if_statement "if (uVar6 != 0) goto LAB_000183cc;" if (parenthesized_expression "(uVar6 != 0)" ( (binary_expression "uVar6 != 0" identifier != number_literal) )) (goto_statement "goto LAB_000183cc;" goto statement_identifier ;)) (expression_statement "uVar7 = *puVar2;" (assignment_expression "uVar7 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (expression_statement "pFVar3 = (FILE *)0x0;" (assignment_expression "pFVar3 = (FILE *)0x0" identifier = (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (goto_statement "goto LAB_000184c8;" goto statement_identifier ;) })) (labeled_statement "LAB_0001843c:\n    _Var4 = protect_fd(1);" statement_identifier : (expression_statement "_Var4 = protect_fd(1);" (assignment_expression "_Var4 = protect_fd(1)" identifier = (call_expression "protect_fd(1)" identifier (argument_list "(1)" ( number_literal )))) ;)) (expression_statement "uVar5 = CONCAT31(extraout_var_01,_Var4);" (assignment_expression "uVar5 = CONCAT31(extraout_var_01,_Var4)" identifier = (call_expression "CONCAT31(extraout_var_01,_Var4)" identifier (argument_list "(extraout_var_01,_Var4)" ( identifier , identifier )))) ;) (if_statement "if (uVar5 != 0) goto LAB_000183ac;" if (parenthesized_expression "(uVar5 != 0)" ( (binary_expression "uVar5 != 0" identifier != number_literal) )) (goto_statement "goto LAB_000183ac;" goto statement_identifier ;)) (expression_statement "uVar7 = *puVar2;" (assignment_expression "uVar7 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (if_statement "if (uVar6 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }" if (parenthesized_expression "(uVar6 != 0)" ( (binary_expression "uVar6 != 0" identifier != number_literal) )) (compound_statement "{\n      (*(code *)PTR_close_000301c4)(2);\n    }" { (expression_statement "(*(code *)PTR_close_000301c4)(2);" (call_expression "(*(code *)PTR_close_000301c4)(2)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2)" ( number_literal ))) ;) })) (expression_statement "pFVar3 = (FILE *)0x0;" (assignment_expression "pFVar3 = (FILE *)0x0" identifier = (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) ;) }) (else_clause "else {\n    _Var4 = protect_fd(0);\n    iVar1 = CONCAT31(extraout_var,_Var4);\n    if (iVar1 != 0) {\n      if (uVar5 != 0) goto LAB_0001843c;\n      goto LAB_000183ac;\n    }\n    iVar1 = 1;\n    pFVar3 = (FILE *)0x0;\nLAB_000183e8:\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar5 == 0) goto joined_r0x0001846c;\n  }" else (compound_statement "{\n    _Var4 = protect_fd(0);\n    iVar1 = CONCAT31(extraout_var,_Var4);\n    if (iVar1 != 0) {\n      if (uVar5 != 0) goto LAB_0001843c;\n      goto LAB_000183ac;\n    }\n    iVar1 = 1;\n    pFVar3 = (FILE *)0x0;\nLAB_000183e8:\n    uVar7 = *puVar2;\n    if (uVar6 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar5 == 0) goto joined_r0x0001846c;\n  }" { (expression_statement "_Var4 = protect_fd(0);" (assignment_expression "_Var4 = protect_fd(0)" identifier = (call_expression "protect_fd(0)" identifier (argument_list "(0)" ( number_literal )))) ;) (expression_statement "iVar1 = CONCAT31(extraout_var,_Var4);" (assignment_expression "iVar1 = CONCAT31(extraout_var,_Var4)" identifier = (call_expression "CONCAT31(extraout_var,_Var4)" identifier (argument_list "(extraout_var,_Var4)" ( identifier , identifier )))) ;) (if_statement "if (iVar1 != 0) {\n      if (uVar5 != 0) goto LAB_0001843c;\n      goto LAB_000183ac;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      if (uVar5 != 0) goto LAB_0001843c;\n      goto LAB_000183ac;\n    }" { (if_statement "if (uVar5 != 0) goto LAB_0001843c;" if (parenthesized_expression "(uVar5 != 0)" ( (binary_expression "uVar5 != 0" identifier != number_literal) )) (goto_statement "goto LAB_0001843c;" goto statement_identifier ;)) (goto_statement "goto LAB_000183ac;" goto statement_identifier ;) })) (expression_statement "iVar1 = 1;" (assignment_expression "iVar1 = 1" identifier = number_literal) ;) (expression_statement "pFVar3 = (FILE *)0x0;" (assignment_expression "pFVar3 = (FILE *)0x0" identifier = (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (labeled_statement "LAB_000183e8:\n    uVar7 = *puVar2;" statement_identifier : (expression_statement "uVar7 = *puVar2;" (assignment_expression "uVar7 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;)) (if_statement "if (uVar6 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }" if (parenthesized_expression "(uVar6 != 0)" ( (binary_expression "uVar6 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }" { (labeled_statement "LAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);" statement_identifier : (expression_statement "(*(code *)PTR_close_000301c4)(2);" (call_expression "(*(code *)PTR_close_000301c4)(2)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2)" ( number_literal ))) ;)) })) (if_statement "if (uVar5 == 0) goto joined_r0x0001846c;" if (parenthesized_expression "(uVar5 == 0)" ( (binary_expression "uVar5 == 0" identifier == number_literal) )) (goto_statement "goto joined_r0x0001846c;" goto statement_identifier ;)) }))) (expression_statement "(*(code *)PTR_close_000301c4)(1);" (call_expression "(*(code *)PTR_close_000301c4)(1)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(1)" ( number_literal ))) ;) (labeled_statement "joined_r0x0001846c:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }" statement_identifier : (if_statement "if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n    (*(code *)PTR_close_000301c4)(0);\n  }" { (expression_statement "(*(code *)PTR_close_000301c4)(0);" (call_expression "(*(code *)PTR_close_000301c4)(0)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(0)" ( number_literal ))) ;) }))) (if_statement "if (pFVar3 == (FILE *)0x0) {\n    *puVar2 = uVar7;\n    return (FILE *)0x0;\n  }" if (parenthesized_expression "(pFVar3 == (FILE *)0x0)" ( (binary_expression "pFVar3 == (FILE *)0x0" identifier == (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    *puVar2 = uVar7;\n    return (FILE *)0x0;\n  }" { (expression_statement "*puVar2 = uVar7;" (assignment_expression "*puVar2 = uVar7" (pointer_expression "*puVar2" * identifier) = identifier) ;) (return_statement "return (FILE *)0x0;" return (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (return_statement "return pFVar3;" return identifier ;) })))
(translation_unit "int freopen_safer(undefined4 param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  undefined4 *puVar2;\n  int iVar3;\n  uint uVar4;\n  uint uVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }\n  return iVar3;\n}\n\n" (function_definition "int freopen_safer(undefined4 param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  undefined4 *puVar2;\n  int iVar3;\n  uint uVar4;\n  uint uVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }\n  return iVar3;\n}" primitive_type (function_declarator "freopen_safer(undefined4 param_1,undefined4 param_2,undefined4 param_3)" identifier (parameter_list "(undefined4 param_1,undefined4 param_2,undefined4 param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  undefined4 *puVar2;\n  int iVar3;\n  uint uVar4;\n  uint uVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }\n  return iVar3;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "undefined4 *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "uint uVar4;" type_identifier identifier ;) (declaration "uint uVar5;" type_identifier identifier ;) (declaration "undefined4 uVar6;" type_identifier identifier ;) (expression_statement "iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);" (assignment_expression "iVar1 = (*(code *)PTR_fileno_0003021c)(param_3)" identifier = (call_expression "(*(code *)PTR_fileno_0003021c)(param_3)" (parenthesized_expression "(*(code *)PTR_fileno_0003021c)" ( (pointer_expression "*(code *)PTR_fileno_0003021c" * (cast_expression "(code *)PTR_fileno_0003021c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_3)" ( identifier )))) ;) (expression_statement "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();" (assignment_expression "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00030220)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00030220)()" (parenthesized_expression "(*(code *)PTR___errno_location_00030220)" ( (pointer_expression "*(code *)PTR___errno_location_00030220" * (cast_expression "(code *)PTR___errno_location_00030220" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (if_statement "if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" if (parenthesized_expression "(iVar1 == 1)" ( (binary_expression "iVar1 == 1" identifier == number_literal) )) (compound_statement "{\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }" { (expression_statement "uVar5 = 0;" (assignment_expression "uVar5 = 0" identifier = number_literal) ;) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" identifier = number_literal) ;) (labeled_statement "LAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);" statement_identifier : (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(0,0)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(0,0)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(0,0)" ( number_literal , number_literal )))) ;)) (if_statement "if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }" { (expression_statement "iVar1 = FUN_00018210(0);" (assignment_expression "iVar1 = FUN_00018210(0)" identifier = (call_expression "FUN_00018210(0)" identifier (argument_list "(0)" ( number_literal )))) ;) (if_statement "if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }" { (if_statement "if (uVar4 != 0) goto LAB_0001843c;" if (parenthesized_expression "(uVar4 != 0)" ( (binary_expression "uVar4 != 0" identifier != number_literal) )) (goto_statement "goto LAB_0001843c;" goto statement_identifier ;)) (goto_statement "goto LAB_000183ac;" goto statement_identifier ;) })) (expression_statement "iVar1 = 1;" (assignment_expression "iVar1 = 1" identifier = number_literal) ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_000183e8;" goto statement_identifier ;) })) (expression_statement "iVar1 = 0;" (assignment_expression "iVar1 = 0" identifier = number_literal) ;) (if_statement "if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }" if (parenthesized_expression "(uVar4 == 0)" ( (binary_expression "uVar4 == 0" identifier == number_literal) )) (compound_statement "{\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }" { (labeled_statement "LAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;" statement_identifier : (if_statement "if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;" if (parenthesized_expression "((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0))" ( (binary_expression "(uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)" (parenthesized_expression "(uVar5 == 0)" ( (binary_expression "uVar5 == 0" identifier == number_literal) )) || (parenthesized_expression "(uVar5 = FUN_00018210(2), uVar5 != 0)" ( (comma_expression "uVar5 = FUN_00018210(2), uVar5 != 0" (assignment_expression "uVar5 = FUN_00018210(2)" identifier = (call_expression "FUN_00018210(2)" identifier (argument_list "(2)" ( number_literal )))) , (binary_expression "uVar5 != 0" identifier != number_literal)) ))) )) (goto_statement "goto LAB_000183cc;" goto statement_identifier ;))) (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_000184c8;" goto statement_identifier ;) })) (labeled_statement "LAB_0001843c:\n    uVar4 = FUN_00018210(1);" statement_identifier : (expression_statement "uVar4 = FUN_00018210(1);" (assignment_expression "uVar4 = FUN_00018210(1)" identifier = (call_expression "FUN_00018210(1)" identifier (argument_list "(1)" ( number_literal )))) ;)) (if_statement "if (uVar4 != 0) goto LAB_000183ac;" if (parenthesized_expression "(uVar4 != 0)" ( (binary_expression "uVar4 != 0" identifier != number_literal) )) (goto_statement "goto LAB_000183ac;" goto statement_identifier ;)) (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (if_statement "if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }" if (parenthesized_expression "(uVar5 != 0)" ( (binary_expression "uVar5 != 0" identifier != number_literal) )) (compound_statement "{\n      (*(code *)PTR_close_000301c4)(2);\n    }" { (expression_statement "(*(code *)PTR_close_000301c4)(2);" (call_expression "(*(code *)PTR_close_000301c4)(2)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2)" ( number_literal ))) ;) })) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) }) (else_clause "else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" else (compound_statement "{\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" { (expression_statement "uVar5 = 0;" (assignment_expression "uVar5 = 0" identifier = number_literal) ;) (if_statement "if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }" if (parenthesized_expression "(iVar1 == 2)" ( (binary_expression "iVar1 == 2" identifier == number_literal) )) (compound_statement "{\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }" { (labeled_statement "LAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);" statement_identifier : (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(1,1)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(1,1)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(1,1)" ( number_literal , number_literal )))) ;)) (expression_statement "uVar4 = (uint)(iVar1 != 1);" (assignment_expression "uVar4 = (uint)(iVar1 != 1)" identifier = (call_expression "(uint)(iVar1 != 1)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(iVar1 != 1)" ( (binary_expression "iVar1 != 1" identifier != number_literal) )))) ;) (goto_statement "goto LAB_00018370;" goto statement_identifier ;) })) (if_statement "if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }" { (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(2,2)" identifier = (call_expression "(*(code *)PTR_dup2_000302dc)(2,2)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" ( (pointer_expression "*(code *)PTR_dup2_000302dc" * (cast_expression "(code *)PTR_dup2_000302dc" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2,2)" ( number_literal , number_literal )))) ;) (expression_statement "uVar5 = (uint)(iVar1 != 2);" (assignment_expression "uVar5 = (uint)(iVar1 != 2)" identifier = (call_expression "(uint)(iVar1 != 2)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(iVar1 != 2)" ( (binary_expression "iVar1 != 2" identifier != number_literal) )))) ;) (goto_statement "goto LAB_00018354;" goto statement_identifier ;) })) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" identifier = number_literal) ;) (expression_statement "iVar1 = 0;" (assignment_expression "iVar1 = 0" identifier = number_literal) ;) (labeled_statement "LAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);" statement_identifier : (expression_statement "iVar3 = rpl_freopen(param_1,param_2,param_3);" (assignment_expression "iVar3 = rpl_freopen(param_1,param_2,param_3)" identifier = (call_expression "rpl_freopen(param_1,param_2,param_3)" identifier (argument_list "(param_1,param_2,param_3)" ( identifier , identifier , identifier )))) ;)) (labeled_statement "LAB_000183e8:\n    uVar6 = *puVar2;" statement_identifier : (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;)) (if_statement "if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }" if (parenthesized_expression "(uVar5 != 0)" ( (binary_expression "uVar5 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }" { (labeled_statement "LAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);" statement_identifier : (expression_statement "(*(code *)PTR_close_000301c4)(2);" (call_expression "(*(code *)PTR_close_000301c4)(2)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(2)" ( number_literal ))) ;)) })) (if_statement "if (uVar4 == 0) goto joined_r0x000183f8;" if (parenthesized_expression "(uVar4 == 0)" ( (binary_expression "uVar4 == 0" identifier == number_literal) )) (goto_statement "goto joined_r0x000183f8;" goto statement_identifier ;)) }))) (expression_statement "(*(code *)PTR_close_000301c4)(1);" (call_expression "(*(code *)PTR_close_000301c4)(1)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(1)" ( number_literal ))) ;) (labeled_statement "joined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }" statement_identifier : (if_statement "if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n    (*(code *)PTR_close_000301c4)(0);\n  }" { (expression_statement "(*(code *)PTR_close_000301c4)(0);" (call_expression "(*(code *)PTR_close_000301c4)(0)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" ( (pointer_expression "*(code *)PTR_close_000301c4" * (cast_expression "(code *)PTR_close_000301c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(0)" ( number_literal ))) ;) }))) (if_statement "if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n    *puVar2 = uVar6;\n    return 0;\n  }" { (expression_statement "*puVar2 = uVar6;" (assignment_expression "*puVar2 = uVar6" (pointer_expression "*puVar2" * identifier) = identifier) ;) (return_statement "return 0;" return number_literal ;) })) (return_statement "return iVar3;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE 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 )))) ;) (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 ( ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( LIT , LIT )))) ;)) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (goto_statement goto statement_identifier ;)) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (labeled_statement statement_identifier : (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT == LIT) )) || (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (call_expression IDENT (argument_list ( LIT )))) , (binary_expression IDENT != LIT)) ))) )) (goto_statement goto statement_identifier ;))) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (goto_statement goto statement_identifier ;) })) (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( LIT )))) ;)) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (goto_statement goto statement_identifier ;)) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( LIT ))) ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( LIT , LIT )))) ;)) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression IDENT != LIT) )))) ;) (goto_statement goto statement_identifier ;) })) (if_statement if (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 ( LIT , LIT )))) ;) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression IDENT != LIT) )))) ;) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT )))) ;)) (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;)) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (labeled_statement statement_identifier : (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( LIT ))) ;)) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (goto_statement goto statement_identifier ;)) }))) (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( LIT ))) ;) (labeled_statement statement_identifier : (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( LIT ))) ;) }))) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (return_statement return LIT ;) })) (return_statement return IDENT ;) })))
(function_definition "int freopen_safer(undefined4 param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  int iVar1;\n  undefined4 *puVar2;\n  int iVar3;\n  uint uVar4;\n  uint uVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }\n  return iVar3;\n}" (primitive_type "int") (function_declarator "freopen_safer(undefined4 param_1,undefined4 param_2,undefined4 param_3)" (identifier "freopen_safer") (parameter_list "(undefined4 param_1,undefined4 param_2,undefined4 param_3)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (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")) () ")"))) (compound_statement "{\n  int iVar1;\n  undefined4 *puVar2;\n  int iVar3;\n  uint uVar4;\n  uint uVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();\n  if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }\n  (*(code *)PTR_close_000301c4)(1);\njoined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }\n  if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }\n  return iVar3;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "undefined4 *puVar2;" (type_identifier "undefined4") (pointer_declarator "*puVar2" (* "*") (identifier "puVar2")) (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "uint uVar4;" (type_identifier "uint") (identifier "uVar4") (; ";")) (declaration "uint uVar5;" (type_identifier "uint") (identifier "uVar5") (; ";")) (declaration "undefined4 uVar6;" (type_identifier "undefined4") (identifier "uVar6") (; ";")) (expression_statement "iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);" (assignment_expression "iVar1 = (*(code *)PTR_fileno_0003021c)(param_3)" (identifier "iVar1") (= "=") (call_expression "(*(code *)PTR_fileno_0003021c)(param_3)" (parenthesized_expression "(*(code *)PTR_fileno_0003021c)" (( "(") (pointer_expression "*(code *)PTR_fileno_0003021c" (* "*") (cast_expression "(code *)PTR_fileno_0003021c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_fileno_0003021c"))) () ")")) (argument_list "(param_3)" (( "(") (identifier "param_3") () ")")))) (; ";")) (expression_statement "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();" (assignment_expression "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)()" (identifier "puVar2") (= "=") (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00030220)()" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "(*(code *)PTR___errno_location_00030220)()" (parenthesized_expression "(*(code *)PTR___errno_location_00030220)" (( "(") (pointer_expression "*(code *)PTR___errno_location_00030220" (* "*") (cast_expression "(code *)PTR___errno_location_00030220" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR___errno_location_00030220"))) () ")")) (argument_list "()" (( "(") () ")"))))) (; ";")) (if_statement "if (iVar1 == 1) {\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }\n  else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" (if "if") (parenthesized_expression "(iVar1 == 1)" (( "(") (binary_expression "iVar1 == 1" (identifier "iVar1") (== "==") (number_literal "1")) () ")")) (compound_statement "{\n    uVar5 = 0;\n    uVar4 = 0;\nLAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);\n    if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }\n    iVar1 = 0;\n    if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }\nLAB_0001843c:\n    uVar4 = FUN_00018210(1);\n    if (uVar4 != 0) goto LAB_000183ac;\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    iVar3 = 0;\n  }" ({ "{") (expression_statement "uVar5 = 0;" (assignment_expression "uVar5 = 0" (identifier "uVar5") (= "=") (number_literal "0")) (; ";")) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" (identifier "uVar4") (= "=") (number_literal "0")) (; ";")) (labeled_statement "LAB_00018370:\n    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);" (statement_identifier "LAB_00018370") (: ":") (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(0,0)" (identifier "iVar1") (= "=") (call_expression "(*(code *)PTR_dup2_000302dc)(0,0)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" (( "(") (pointer_expression "*(code *)PTR_dup2_000302dc" (* "*") (cast_expression "(code *)PTR_dup2_000302dc" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_dup2_000302dc"))) () ")")) (argument_list "(0,0)" (( "(") (number_literal "0") (, ",") (number_literal "0") () ")")))) (; ";"))) (if_statement "if (iVar1 != 0) {\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      iVar1 = FUN_00018210(0);\n      if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }\n      iVar1 = 1;\n      iVar3 = 0;\n      goto LAB_000183e8;\n    }" ({ "{") (expression_statement "iVar1 = FUN_00018210(0);" (assignment_expression "iVar1 = FUN_00018210(0)" (identifier "iVar1") (= "=") (call_expression "FUN_00018210(0)" (identifier "FUN_00018210") (argument_list "(0)" (( "(") (number_literal "0") () ")")))) (; ";")) (if_statement "if (iVar1 != 0) {\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n        if (uVar4 != 0) goto LAB_0001843c;\n        goto LAB_000183ac;\n      }" ({ "{") (if_statement "if (uVar4 != 0) goto LAB_0001843c;" (if "if") (parenthesized_expression "(uVar4 != 0)" (( "(") (binary_expression "uVar4 != 0" (identifier "uVar4") (!= "!=") (number_literal "0")) () ")")) (goto_statement "goto LAB_0001843c;" (goto "goto") (statement_identifier "LAB_0001843c") (; ";"))) (goto_statement "goto LAB_000183ac;" (goto "goto") (statement_identifier "LAB_000183ac") (; ";")) (} "}"))) (expression_statement "iVar1 = 1;" (assignment_expression "iVar1 = 1" (identifier "iVar1") (= "=") (number_literal "1")) (; ";")) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" (identifier "iVar3") (= "=") (number_literal "0")) (; ";")) (goto_statement "goto LAB_000183e8;" (goto "goto") (statement_identifier "LAB_000183e8") (; ";")) (} "}"))) (expression_statement "iVar1 = 0;" (assignment_expression "iVar1 = 0" (identifier "iVar1") (= "=") (number_literal "0")) (; ";")) (if_statement "if (uVar4 == 0) {\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }" (if "if") (parenthesized_expression "(uVar4 == 0)" (( "(") (binary_expression "uVar4 == 0" (identifier "uVar4") (== "==") (number_literal "0")) () ")")) (compound_statement "{\nLAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;\n      uVar6 = *puVar2;\n      iVar3 = 0;\n      goto LAB_000184c8;\n    }" ({ "{") (labeled_statement "LAB_000183ac:\n      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;" (statement_identifier "LAB_000183ac") (: ":") (if_statement "if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;" (if "if") (parenthesized_expression "((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0))" (( "(") (binary_expression "(uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)" (parenthesized_expression "(uVar5 == 0)" (( "(") (binary_expression "uVar5 == 0" (identifier "uVar5") (== "==") (number_literal "0")) () ")")) (|| "||") (parenthesized_expression "(uVar5 = FUN_00018210(2), uVar5 != 0)" (( "(") (comma_expression "uVar5 = FUN_00018210(2), uVar5 != 0" (assignment_expression "uVar5 = FUN_00018210(2)" (identifier "uVar5") (= "=") (call_expression "FUN_00018210(2)" (identifier "FUN_00018210") (argument_list "(2)" (( "(") (number_literal "2") () ")")))) (, ",") (binary_expression "uVar5 != 0" (identifier "uVar5") (!= "!=") (number_literal "0"))) () ")"))) () ")")) (goto_statement "goto LAB_000183cc;" (goto "goto") (statement_identifier "LAB_000183cc") (; ";")))) (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" (identifier "uVar6") (= "=") (pointer_expression "*puVar2" (* "*") (identifier "puVar2"))) (; ";")) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" (identifier "iVar3") (= "=") (number_literal "0")) (; ";")) (goto_statement "goto LAB_000184c8;" (goto "goto") (statement_identifier "LAB_000184c8") (; ";")) (} "}"))) (labeled_statement "LAB_0001843c:\n    uVar4 = FUN_00018210(1);" (statement_identifier "LAB_0001843c") (: ":") (expression_statement "uVar4 = FUN_00018210(1);" (assignment_expression "uVar4 = FUN_00018210(1)" (identifier "uVar4") (= "=") (call_expression "FUN_00018210(1)" (identifier "FUN_00018210") (argument_list "(1)" (( "(") (number_literal "1") () ")")))) (; ";"))) (if_statement "if (uVar4 != 0) goto LAB_000183ac;" (if "if") (parenthesized_expression "(uVar4 != 0)" (( "(") (binary_expression "uVar4 != 0" (identifier "uVar4") (!= "!=") (number_literal "0")) () ")")) (goto_statement "goto LAB_000183ac;" (goto "goto") (statement_identifier "LAB_000183ac") (; ";"))) (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" (identifier "uVar6") (= "=") (pointer_expression "*puVar2" (* "*") (identifier "puVar2"))) (; ";")) (if_statement "if (uVar5 != 0) {\n      (*(code *)PTR_close_000301c4)(2);\n    }" (if "if") (parenthesized_expression "(uVar5 != 0)" (( "(") (binary_expression "uVar5 != 0" (identifier "uVar5") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      (*(code *)PTR_close_000301c4)(2);\n    }" ({ "{") (expression_statement "(*(code *)PTR_close_000301c4)(2);" (call_expression "(*(code *)PTR_close_000301c4)(2)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" (( "(") (pointer_expression "*(code *)PTR_close_000301c4" (* "*") (cast_expression "(code *)PTR_close_000301c4" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_000301c4"))) () ")")) (argument_list "(2)" (( "(") (number_literal "2") () ")"))) (; ";")) (} "}"))) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" (identifier "iVar3") (= "=") (number_literal "0")) (; ";")) (} "}")) (else_clause "else {\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" (else "else") (compound_statement "{\n    uVar5 = 0;\n    if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }\n    if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }\n    uVar4 = 0;\n    iVar1 = 0;\nLAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);\nLAB_000183e8:\n    uVar6 = *puVar2;\n    if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }\n    if (uVar4 == 0) goto joined_r0x000183f8;\n  }" ({ "{") (expression_statement "uVar5 = 0;" (assignment_expression "uVar5 = 0" (identifier "uVar5") (= "=") (number_literal "0")) (; ";")) (if_statement "if (iVar1 == 2) {\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }" (if "if") (parenthesized_expression "(iVar1 == 2)" (( "(") (binary_expression "iVar1 == 2" (identifier "iVar1") (== "==") (number_literal "2")) () ")")) (compound_statement "{\nLAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);\n      uVar4 = (uint)(iVar1 != 1);\n      goto LAB_00018370;\n    }" ({ "{") (labeled_statement "LAB_00018354:\n      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);" (statement_identifier "LAB_00018354") (: ":") (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(1,1)" (identifier "iVar1") (= "=") (call_expression "(*(code *)PTR_dup2_000302dc)(1,1)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" (( "(") (pointer_expression "*(code *)PTR_dup2_000302dc" (* "*") (cast_expression "(code *)PTR_dup2_000302dc" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_dup2_000302dc"))) () ")")) (argument_list "(1,1)" (( "(") (number_literal "1") (, ",") (number_literal "1") () ")")))) (; ";"))) (expression_statement "uVar4 = (uint)(iVar1 != 1);" (assignment_expression "uVar4 = (uint)(iVar1 != 1)" (identifier "uVar4") (= "=") (call_expression "(uint)(iVar1 != 1)" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (argument_list "(iVar1 != 1)" (( "(") (binary_expression "iVar1 != 1" (identifier "iVar1") (!= "!=") (number_literal "1")) () ")")))) (; ";")) (goto_statement "goto LAB_00018370;" (goto "goto") (statement_identifier "LAB_00018370") (; ";")) (} "}"))) (if_statement "if (iVar1 != 0) {\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);\n      uVar5 = (uint)(iVar1 != 2);\n      goto LAB_00018354;\n    }" ({ "{") (expression_statement "iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);" (assignment_expression "iVar1 = (*(code *)PTR_dup2_000302dc)(2,2)" (identifier "iVar1") (= "=") (call_expression "(*(code *)PTR_dup2_000302dc)(2,2)" (parenthesized_expression "(*(code *)PTR_dup2_000302dc)" (( "(") (pointer_expression "*(code *)PTR_dup2_000302dc" (* "*") (cast_expression "(code *)PTR_dup2_000302dc" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_dup2_000302dc"))) () ")")) (argument_list "(2,2)" (( "(") (number_literal "2") (, ",") (number_literal "2") () ")")))) (; ";")) (expression_statement "uVar5 = (uint)(iVar1 != 2);" (assignment_expression "uVar5 = (uint)(iVar1 != 2)" (identifier "uVar5") (= "=") (call_expression "(uint)(iVar1 != 2)" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (argument_list "(iVar1 != 2)" (( "(") (binary_expression "iVar1 != 2" (identifier "iVar1") (!= "!=") (number_literal "2")) () ")")))) (; ";")) (goto_statement "goto LAB_00018354;" (goto "goto") (statement_identifier "LAB_00018354") (; ";")) (} "}"))) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" (identifier "uVar4") (= "=") (number_literal "0")) (; ";")) (expression_statement "iVar1 = 0;" (assignment_expression "iVar1 = 0" (identifier "iVar1") (= "=") (number_literal "0")) (; ";")) (labeled_statement "LAB_000183cc:\n    iVar3 = rpl_freopen(param_1,param_2,param_3);" (statement_identifier "LAB_000183cc") (: ":") (expression_statement "iVar3 = rpl_freopen(param_1,param_2,param_3);" (assignment_expression "iVar3 = rpl_freopen(param_1,param_2,param_3)" (identifier "iVar3") (= "=") (call_expression "rpl_freopen(param_1,param_2,param_3)" (identifier "rpl_freopen") (argument_list "(param_1,param_2,param_3)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "param_3") () ")")))) (; ";"))) (labeled_statement "LAB_000183e8:\n    uVar6 = *puVar2;" (statement_identifier "LAB_000183e8") (: ":") (expression_statement "uVar6 = *puVar2;" (assignment_expression "uVar6 = *puVar2" (identifier "uVar6") (= "=") (pointer_expression "*puVar2" (* "*") (identifier "puVar2"))) (; ";"))) (if_statement "if (uVar5 != 0) {\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }" (if "if") (parenthesized_expression "(uVar5 != 0)" (( "(") (binary_expression "uVar5 != 0" (identifier "uVar5") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\nLAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);\n    }" ({ "{") (labeled_statement "LAB_000184c8:\n      (*(code *)PTR_close_000301c4)(2);" (statement_identifier "LAB_000184c8") (: ":") (expression_statement "(*(code *)PTR_close_000301c4)(2);" (call_expression "(*(code *)PTR_close_000301c4)(2)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" (( "(") (pointer_expression "*(code *)PTR_close_000301c4" (* "*") (cast_expression "(code *)PTR_close_000301c4" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_000301c4"))) () ")")) (argument_list "(2)" (( "(") (number_literal "2") () ")"))) (; ";"))) (} "}"))) (if_statement "if (uVar4 == 0) goto joined_r0x000183f8;" (if "if") (parenthesized_expression "(uVar4 == 0)" (( "(") (binary_expression "uVar4 == 0" (identifier "uVar4") (== "==") (number_literal "0")) () ")")) (goto_statement "goto joined_r0x000183f8;" (goto "goto") (statement_identifier "joined_r0x000183f8") (; ";"))) (} "}")))) (expression_statement "(*(code *)PTR_close_000301c4)(1);" (call_expression "(*(code *)PTR_close_000301c4)(1)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" (( "(") (pointer_expression "*(code *)PTR_close_000301c4" (* "*") (cast_expression "(code *)PTR_close_000301c4" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_000301c4"))) () ")")) (argument_list "(1)" (( "(") (number_literal "1") () ")"))) (; ";")) (labeled_statement "joined_r0x000183f8:\n  if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }" (statement_identifier "joined_r0x000183f8") (: ":") (if_statement "if (iVar1 != 0) {\n    (*(code *)PTR_close_000301c4)(0);\n  }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    (*(code *)PTR_close_000301c4)(0);\n  }" ({ "{") (expression_statement "(*(code *)PTR_close_000301c4)(0);" (call_expression "(*(code *)PTR_close_000301c4)(0)" (parenthesized_expression "(*(code *)PTR_close_000301c4)" (( "(") (pointer_expression "*(code *)PTR_close_000301c4" (* "*") (cast_expression "(code *)PTR_close_000301c4" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_000301c4"))) () ")")) (argument_list "(0)" (( "(") (number_literal "0") () ")"))) (; ";")) (} "}")))) (if_statement "if (iVar3 == 0) {\n    *puVar2 = uVar6;\n    return 0;\n  }" (if "if") (parenthesized_expression "(iVar3 == 0)" (( "(") (binary_expression "iVar3 == 0" (identifier "iVar3") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n    *puVar2 = uVar6;\n    return 0;\n  }" ({ "{") (expression_statement "*puVar2 = uVar6;" (assignment_expression "*puVar2 = uVar6" (pointer_expression "*puVar2" (* "*") (identifier "puVar2")) (= "=") (identifier "uVar6")) (; ";")) (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}"))) (return_statement "return iVar3;" (return "return") (identifier "iVar3") (; ";")) (} "}")))
(translation_unit (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) 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))))) (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))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (labeled_statement label: (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 (number_literal) (number_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (number_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (goto_statement label: (statement_identifier))) (goto_statement label: (statement_identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (goto_statement label: (statement_identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (labeled_statement label: (statement_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: (call_expression function: (identifier) arguments: (argument_list (number_literal)))) right: (binary_expression left: (identifier) right: (number_literal)))))) consequence: (goto_statement label: (statement_identifier)))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (goto_statement label: (statement_identifier)))) (labeled_statement label: (statement_identifier) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (number_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (goto_statement label: (statement_identifier))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (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 (number_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (number_literal)))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (labeled_statement label: (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 (number_literal) (number_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (parenthesized_expression (identifier)) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)))))) (goto_statement label: (statement_identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (parenthesized_expression (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (identifier)))) arguments: (argument_list (number_literal) (number_literal))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (parenthesized_expression (identifier)) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)))))) (goto_statement label: (statement_identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (labeled_statement label: (statement_identifier) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier)))))) (labeled_statement label: (statement_identifier) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (labeled_statement label: (statement_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 (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (goto_statement label: (statement_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 (number_literal)))) (labeled_statement label: (statement_identifier) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (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 (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (return_statement (number_literal)))) (return_statement (identifier)))))

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

{
  int iVar1;
  undefined4 *puVar2;
  int iVar3;
  uint uVar4;
  uint uVar5;
  undefined4 uVar6;
  
  iVar1 = (*(code *)PTR_fileno_0003021c)(param_3);
  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00030220)();
  if (iVar1 == 1) {
    uVar5 = 0;
    uVar4 = 0;
LAB_00018370:
    iVar1 = (*(code *)PTR_dup2_000302dc)(0,0);
    if (iVar1 != 0) {
      iVar1 = FUN_00018210(0);
      if (iVar1 != 0) {
        if (uVar4 != 0) goto LAB_0001843c;
        goto LAB_000183ac;
      }
      iVar1 = 1;
      iVar3 = 0;
      goto LAB_000183e8;
    }
    iVar1 = 0;
    if (uVar4 == 0) {
LAB_000183ac:
      if ((uVar5 == 0) || (uVar5 = FUN_00018210(2), uVar5 != 0)) goto LAB_000183cc;
      uVar6 = *puVar2;
      iVar3 = 0;
      goto LAB_000184c8;
    }
LAB_0001843c:
    uVar4 = FUN_00018210(1);
    if (uVar4 != 0) goto LAB_000183ac;
    uVar6 = *puVar2;
    if (uVar5 != 0) {
      (*(code *)PTR_close_000301c4)(2);
    }
    iVar3 = 0;
  }
  else {
    uVar5 = 0;
    if (iVar1 == 2) {
LAB_00018354:
      iVar1 = (*(code *)PTR_dup2_000302dc)(1,1);
      uVar4 = (uint)(iVar1 != 1);
      goto LAB_00018370;
    }
    if (iVar1 != 0) {
      iVar1 = (*(code *)PTR_dup2_000302dc)(2,2);
      uVar5 = (uint)(iVar1 != 2);
      goto LAB_00018354;
    }
    uVar4 = 0;
    iVar1 = 0;
LAB_000183cc:
    iVar3 = rpl_freopen(param_1,param_2,param_3);
LAB_000183e8:
    uVar6 = *puVar2;
    if (uVar5 != 0) {
LAB_000184c8:
      (*(code *)PTR_close_000301c4)(2);
    }
    if (uVar4 == 0) goto joined_r0x000183f8;
  }
  (*(code *)PTR_close_000301c4)(1);
joined_r0x000183f8:
  if (iVar1 != 0) {
    (*(code *)PTR_close_000301c4)(0);
  }
  if (iVar3 == 0) {
    *puVar2 = uVar6;
    return 0;
  }
  return iVar3;
}

