
DIR * opendir_safer(char *name)

{
  DIR *pDVar1;
  uint fd;
  int iVar2;
  undefined4 *puVar3;
  DIR *pDVar4;
  undefined4 uVar5;
  
  pDVar1 = (DIR *)(*(code *)PTR_opendir_00032204)();
  if ((pDVar1 != (DIR *)0x0) && (fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3)) {
    iVar2 = rpl_fcntl(fd,0x406,3);
    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();
    if (iVar2 < 0) {
      uVar5 = *puVar3;
      pDVar4 = (DIR *)0x0;
    }
    else {
      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);
      uVar5 = *puVar3;
      if (pDVar4 == (DIR *)0x0) {
        (*(code *)PTR_close_0003220c)(iVar2);
      }
    }
    (*(code *)PTR_closedir_00032208)(pDVar1);
    *puVar3 = uVar5;
    return pDVar4;
  }
  return pDVar1;
}



int opendir_safer(void)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  undefined4 *puVar4;
  int iVar5;
  undefined4 uVar6;
  
  iVar1 = (*(code *)PTR_opendir_00032204)();
  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {
    iVar3 = rpl_fcntl(uVar2,0x406,3);
    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();
    if (iVar3 < 0) {
      uVar6 = *puVar4;
      iVar5 = 0;
    }
    else {
      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);
      uVar6 = *puVar4;
      if (iVar5 == 0) {
        (*(code *)PTR_close_0003220c)(iVar3);
      }
    }
    (*(code *)PTR_closedir_00032208)(iVar1);
    *puVar4 = uVar6;
    return iVar5;
  }
  return iVar1;
}


lui gp,0x2
addiu gp,gp,0x2d00
addu gp,gp,t9
addiu sp,sp,-0x30
lw t9,-0x7e9c(gp)
sw gp,0x10(sp)
sw s0,0x18(sp)
sw ra,0x2c(sp)
sw s4,0x28(sp)
sw s3,0x24(sp)
sw s2,0x20(sp)
jalr t9
_sw s1,0x1c(sp)
lw gp,0x10(sp)
beq v0,zero,0x000173f8
_or s0,v0,zero
lw t9,-0x7d64(gp)
jalr t9
_or a0,v0,zero
sltiu v1,v0,0x3
bne v1,zero,0x0001741c
_lw gp,0x10(sp)
lw ra,0x2c(sp)
or v0,s0,zero
lw s4,0x28(sp)
lw s3,0x24(sp)
lw s2,0x20(sp)
lw s1,0x1c(sp)
lw s0,0x18(sp)
jr ra
_addiu sp,sp,0x30
lw t9,-0x7fa4(gp)
li a2,0x3
li a1,0x406
bal 0x0001c910
_or a0,v0,zero
lw gp,0x10(sp)
lw t9,-0x7e10(gp)
jalr t9
_or s2,v0,zero
lw gp,0x10(sp)
bgez s2,0x0001748c
_or s1,v0,zero
lw s4,0x0(v0)
or s3,zero,zero
lw t9,-0x7e98(gp)
or a0,s0,zero
jalr t9
_or s0,s3,zero
or v0,s0,zero
lw ra,0x2c(sp)
lw s3,0x24(sp)
lw s2,0x20(sp)
lw s0,0x18(sp)
sw s4,0x0(s1)
lw s4,0x28(sp)
lw s1,0x1c(sp)
jr ra
_addiu sp,sp,0x30
lw t9,-0x7e54(gp)
jalr t9
_or a0,s2,zero
lw gp,0x10(sp)
or s3,v0,zero
bne v0,zero,0x00017454
_lw s4,0x0(s1)
lw t9,-0x7e94(gp)
jalr t9
_or a0,s2,zero
b 0x00017454
_lw gp,0x10(sp)
(translation_unit "int opendir_safer(void)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  undefined4 *puVar4;\n  int iVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_opendir_00032204)();\n  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }\n  return iVar1;\n}\n\n" (function_definition "int opendir_safer(void)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  undefined4 *puVar4;\n  int iVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_opendir_00032204)();\n  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }\n  return iVar1;\n}" primitive_type (function_declarator "opendir_safer(void)" identifier (parameter_list "(void)" ( (parameter_declaration "void" primitive_type) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  undefined4 *puVar4;\n  int iVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_opendir_00032204)();\n  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "undefined4 *puVar4;" type_identifier (pointer_declarator "*puVar4" * identifier) ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "undefined4 uVar6;" type_identifier identifier ;) (expression_statement "iVar1 = (*(code *)PTR_opendir_00032204)();" (assignment_expression "iVar1 = (*(code *)PTR_opendir_00032204)()" identifier = (call_expression "(*(code *)PTR_opendir_00032204)()" (parenthesized_expression "(*(code *)PTR_opendir_00032204)" ( (pointer_expression "*(code *)PTR_opendir_00032204" * (cast_expression "(code *)PTR_opendir_00032204" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( )))) ;) (if_statement "if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }" if (parenthesized_expression "((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3))" ( (binary_expression "(iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)" (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) && (parenthesized_expression "(uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)" ( (comma_expression "uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3" (assignment_expression "uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1)" identifier = (call_expression "(*(code *)PTR_dirfd_0003233c)(iVar1)" (parenthesized_expression "(*(code *)PTR_dirfd_0003233c)" ( (pointer_expression "*(code *)PTR_dirfd_0003233c" * (cast_expression "(code *)PTR_dirfd_0003233c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier )))) , (binary_expression "uVar2 < 3" identifier < number_literal)) ))) )) (compound_statement "{\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }" { (expression_statement "iVar3 = rpl_fcntl(uVar2,0x406,3);" (assignment_expression "iVar3 = rpl_fcntl(uVar2,0x406,3)" identifier = (call_expression "rpl_fcntl(uVar2,0x406,3)" identifier (argument_list "(uVar2,0x406,3)" ( identifier , number_literal , number_literal )))) ;) (expression_statement "puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();" (assignment_expression "puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00032290)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00032290)()" (parenthesized_expression "(*(code *)PTR___errno_location_00032290)" ( (pointer_expression "*(code *)PTR___errno_location_00032290" * (cast_expression "(code *)PTR___errno_location_00032290" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (if_statement "if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" if (parenthesized_expression "(iVar3 < 0)" ( (binary_expression "iVar3 < 0" identifier < number_literal) )) (compound_statement "{\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }" { (expression_statement "uVar6 = *puVar4;" (assignment_expression "uVar6 = *puVar4" identifier = (pointer_expression "*puVar4" * identifier)) ;) (expression_statement "iVar5 = 0;" (assignment_expression "iVar5 = 0" identifier = number_literal) ;) }) (else_clause "else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" else (compound_statement "{\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" { (expression_statement "iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);" (assignment_expression "iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3)" identifier = (call_expression "(*(code *)PTR_fdopendir_0003224c)(iVar3)" (parenthesized_expression "(*(code *)PTR_fdopendir_0003224c)" ( (pointer_expression "*(code *)PTR_fdopendir_0003224c" * (cast_expression "(code *)PTR_fdopendir_0003224c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3)" ( identifier )))) ;) (expression_statement "uVar6 = *puVar4;" (assignment_expression "uVar6 = *puVar4" identifier = (pointer_expression "*puVar4" * identifier)) ;) (if_statement "if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }" if (parenthesized_expression "(iVar5 == 0)" ( (binary_expression "iVar5 == 0" identifier == number_literal) )) (compound_statement "{\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }" { (expression_statement "(*(code *)PTR_close_0003220c)(iVar3);" (call_expression "(*(code *)PTR_close_0003220c)(iVar3)" (parenthesized_expression "(*(code *)PTR_close_0003220c)" ( (pointer_expression "*(code *)PTR_close_0003220c" * (cast_expression "(code *)PTR_close_0003220c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3)" ( identifier ))) ;) })) }))) (expression_statement "(*(code *)PTR_closedir_00032208)(iVar1);" (call_expression "(*(code *)PTR_closedir_00032208)(iVar1)" (parenthesized_expression "(*(code *)PTR_closedir_00032208)" ( (pointer_expression "*(code *)PTR_closedir_00032208" * (cast_expression "(code *)PTR_closedir_00032208" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier ))) ;) (expression_statement "*puVar4 = uVar6;" (assignment_expression "*puVar4 = uVar6" (pointer_expression "*puVar4" * identifier) = identifier) ;) (return_statement "return iVar5;" return identifier ;) })) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "DIR * opendir_safer(char *name)\n\n{\n  DIR *pDVar1;\n  uint fd;\n  int iVar2;\n  undefined4 *puVar3;\n  DIR *pDVar4;\n  undefined4 uVar5;\n  \n  pDVar1 = (DIR *)(*(code *)PTR_opendir_00032204)();\n  if ((pDVar1 != (DIR *)0x0) && (fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3)) {\n    iVar2 = rpl_fcntl(fd,0x406,3);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar2 < 0) {\n      uVar5 = *puVar3;\n      pDVar4 = (DIR *)0x0;\n    }\n    else {\n      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);\n      uVar5 = *puVar3;\n      if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(pDVar1);\n    *puVar3 = uVar5;\n    return pDVar4;\n  }\n  return pDVar1;\n}\n\n" (function_definition "DIR * opendir_safer(char *name)\n\n{\n  DIR *pDVar1;\n  uint fd;\n  int iVar2;\n  undefined4 *puVar3;\n  DIR *pDVar4;\n  undefined4 uVar5;\n  \n  pDVar1 = (DIR *)(*(code *)PTR_opendir_00032204)();\n  if ((pDVar1 != (DIR *)0x0) && (fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3)) {\n    iVar2 = rpl_fcntl(fd,0x406,3);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar2 < 0) {\n      uVar5 = *puVar3;\n      pDVar4 = (DIR *)0x0;\n    }\n    else {\n      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);\n      uVar5 = *puVar3;\n      if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(pDVar1);\n    *puVar3 = uVar5;\n    return pDVar4;\n  }\n  return pDVar1;\n}" type_identifier (pointer_declarator "* opendir_safer(char *name)" * (function_declarator "opendir_safer(char *name)" identifier (parameter_list "(char *name)" ( (parameter_declaration "char *name" primitive_type (pointer_declarator "*name" * identifier)) )))) (compound_statement "{\n  DIR *pDVar1;\n  uint fd;\n  int iVar2;\n  undefined4 *puVar3;\n  DIR *pDVar4;\n  undefined4 uVar5;\n  \n  pDVar1 = (DIR *)(*(code *)PTR_opendir_00032204)();\n  if ((pDVar1 != (DIR *)0x0) && (fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3)) {\n    iVar2 = rpl_fcntl(fd,0x406,3);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar2 < 0) {\n      uVar5 = *puVar3;\n      pDVar4 = (DIR *)0x0;\n    }\n    else {\n      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);\n      uVar5 = *puVar3;\n      if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(pDVar1);\n    *puVar3 = uVar5;\n    return pDVar4;\n  }\n  return pDVar1;\n}" { (declaration "DIR *pDVar1;" type_identifier (pointer_declarator "*pDVar1" * identifier) ;) (declaration "uint fd;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "undefined4 *puVar3;" type_identifier (pointer_declarator "*puVar3" * identifier) ;) (declaration "DIR *pDVar4;" type_identifier (pointer_declarator "*pDVar4" * identifier) ;) (declaration "undefined4 uVar5;" type_identifier identifier ;) (expression_statement "pDVar1 = (DIR *)(*(code *)PTR_opendir_00032204)();" (assignment_expression "pDVar1 = (DIR *)(*(code *)PTR_opendir_00032204)()" identifier = (cast_expression "(DIR *)(*(code *)PTR_opendir_00032204)()" ( (type_descriptor "DIR *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR_opendir_00032204)()" (parenthesized_expression "(*(code *)PTR_opendir_00032204)" ( (pointer_expression "*(code *)PTR_opendir_00032204" * (cast_expression "(code *)PTR_opendir_00032204" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (if_statement "if ((pDVar1 != (DIR *)0x0) && (fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3)) {\n    iVar2 = rpl_fcntl(fd,0x406,3);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar2 < 0) {\n      uVar5 = *puVar3;\n      pDVar4 = (DIR *)0x0;\n    }\n    else {\n      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);\n      uVar5 = *puVar3;\n      if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(pDVar1);\n    *puVar3 = uVar5;\n    return pDVar4;\n  }" if (parenthesized_expression "((pDVar1 != (DIR *)0x0) && (fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3))" ( (binary_expression "(pDVar1 != (DIR *)0x0) && (fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3)" (parenthesized_expression "(pDVar1 != (DIR *)0x0)" ( (binary_expression "pDVar1 != (DIR *)0x0" identifier != (cast_expression "(DIR *)0x0" ( (type_descriptor "DIR *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3)" ( (comma_expression "fd = (*(code *)PTR_dirfd_0003233c)(pDVar1), fd < 3" (assignment_expression "fd = (*(code *)PTR_dirfd_0003233c)(pDVar1)" identifier = (call_expression "(*(code *)PTR_dirfd_0003233c)(pDVar1)" (parenthesized_expression "(*(code *)PTR_dirfd_0003233c)" ( (pointer_expression "*(code *)PTR_dirfd_0003233c" * (cast_expression "(code *)PTR_dirfd_0003233c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(pDVar1)" ( identifier )))) , (binary_expression "fd < 3" identifier < number_literal)) ))) )) (compound_statement "{\n    iVar2 = rpl_fcntl(fd,0x406,3);\n    puVar3 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar2 < 0) {\n      uVar5 = *puVar3;\n      pDVar4 = (DIR *)0x0;\n    }\n    else {\n      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);\n      uVar5 = *puVar3;\n      if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(pDVar1);\n    *puVar3 = uVar5;\n    return pDVar4;\n  }" { (expression_statement "iVar2 = rpl_fcntl(fd,0x406,3);" (assignment_expression "iVar2 = rpl_fcntl(fd,0x406,3)" identifier = (call_expression "rpl_fcntl(fd,0x406,3)" identifier (argument_list "(fd,0x406,3)" ( identifier , number_literal , number_literal )))) ;) (expression_statement "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();" (assignment_expression "puVar3 = (undefined4 *)(*(code *)PTR___errno_location_00032290)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00032290)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00032290)()" (parenthesized_expression "(*(code *)PTR___errno_location_00032290)" ( (pointer_expression "*(code *)PTR___errno_location_00032290" * (cast_expression "(code *)PTR___errno_location_00032290" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (if_statement "if (iVar2 < 0) {\n      uVar5 = *puVar3;\n      pDVar4 = (DIR *)0x0;\n    }\n    else {\n      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);\n      uVar5 = *puVar3;\n      if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }\n    }" if (parenthesized_expression "(iVar2 < 0)" ( (binary_expression "iVar2 < 0" identifier < number_literal) )) (compound_statement "{\n      uVar5 = *puVar3;\n      pDVar4 = (DIR *)0x0;\n    }" { (expression_statement "uVar5 = *puVar3;" (assignment_expression "uVar5 = *puVar3" identifier = (pointer_expression "*puVar3" * identifier)) ;) (expression_statement "pDVar4 = (DIR *)0x0;" (assignment_expression "pDVar4 = (DIR *)0x0" identifier = (cast_expression "(DIR *)0x0" ( (type_descriptor "DIR *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) ;) }) (else_clause "else {\n      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);\n      uVar5 = *puVar3;\n      if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }\n    }" else (compound_statement "{\n      pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);\n      uVar5 = *puVar3;\n      if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }\n    }" { (expression_statement "pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2);" (assignment_expression "pDVar4 = (DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2)" identifier = (cast_expression "(DIR *)(*(code *)PTR_fdopendir_0003224c)(iVar2)" ( (type_descriptor "DIR *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR_fdopendir_0003224c)(iVar2)" (parenthesized_expression "(*(code *)PTR_fdopendir_0003224c)" ( (pointer_expression "*(code *)PTR_fdopendir_0003224c" * (cast_expression "(code *)PTR_fdopendir_0003224c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar2)" ( identifier ))))) ;) (expression_statement "uVar5 = *puVar3;" (assignment_expression "uVar5 = *puVar3" identifier = (pointer_expression "*puVar3" * identifier)) ;) (if_statement "if (pDVar4 == (DIR *)0x0) {\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }" if (parenthesized_expression "(pDVar4 == (DIR *)0x0)" ( (binary_expression "pDVar4 == (DIR *)0x0" identifier == (cast_expression "(DIR *)0x0" ( (type_descriptor "DIR *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        (*(code *)PTR_close_0003220c)(iVar2);\n      }" { (expression_statement "(*(code *)PTR_close_0003220c)(iVar2);" (call_expression "(*(code *)PTR_close_0003220c)(iVar2)" (parenthesized_expression "(*(code *)PTR_close_0003220c)" ( (pointer_expression "*(code *)PTR_close_0003220c" * (cast_expression "(code *)PTR_close_0003220c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar2)" ( identifier ))) ;) })) }))) (expression_statement "(*(code *)PTR_closedir_00032208)(pDVar1);" (call_expression "(*(code *)PTR_closedir_00032208)(pDVar1)" (parenthesized_expression "(*(code *)PTR_closedir_00032208)" ( (pointer_expression "*(code *)PTR_closedir_00032208" * (cast_expression "(code *)PTR_closedir_00032208" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(pDVar1)" ( identifier ))) ;) (expression_statement "*puVar3 = uVar5;" (assignment_expression "*puVar3 = uVar5" (pointer_expression "*puVar3" * identifier) = identifier) ;) (return_statement "return pDVar4;" return identifier ;) })) (return_statement "return pDVar1;" return identifier ;) })))
(translation_unit "int opendir_safer(void)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  undefined4 *puVar4;\n  int iVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_opendir_00032204)();\n  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }\n  return iVar1;\n}\n\n" (function_definition "int opendir_safer(void)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  undefined4 *puVar4;\n  int iVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_opendir_00032204)();\n  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }\n  return iVar1;\n}" primitive_type (function_declarator "opendir_safer(void)" identifier (parameter_list "(void)" ( (parameter_declaration "void" primitive_type) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  undefined4 *puVar4;\n  int iVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_opendir_00032204)();\n  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "undefined4 *puVar4;" type_identifier (pointer_declarator "*puVar4" * identifier) ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "undefined4 uVar6;" type_identifier identifier ;) (expression_statement "iVar1 = (*(code *)PTR_opendir_00032204)();" (assignment_expression "iVar1 = (*(code *)PTR_opendir_00032204)()" identifier = (call_expression "(*(code *)PTR_opendir_00032204)()" (parenthesized_expression "(*(code *)PTR_opendir_00032204)" ( (pointer_expression "*(code *)PTR_opendir_00032204" * (cast_expression "(code *)PTR_opendir_00032204" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( )))) ;) (if_statement "if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }" if (parenthesized_expression "((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3))" ( (binary_expression "(iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)" (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) && (parenthesized_expression "(uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)" ( (comma_expression "uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3" (assignment_expression "uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1)" identifier = (call_expression "(*(code *)PTR_dirfd_0003233c)(iVar1)" (parenthesized_expression "(*(code *)PTR_dirfd_0003233c)" ( (pointer_expression "*(code *)PTR_dirfd_0003233c" * (cast_expression "(code *)PTR_dirfd_0003233c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier )))) , (binary_expression "uVar2 < 3" identifier < number_literal)) ))) )) (compound_statement "{\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }" { (expression_statement "iVar3 = rpl_fcntl(uVar2,0x406,3);" (assignment_expression "iVar3 = rpl_fcntl(uVar2,0x406,3)" identifier = (call_expression "rpl_fcntl(uVar2,0x406,3)" identifier (argument_list "(uVar2,0x406,3)" ( identifier , number_literal , number_literal )))) ;) (expression_statement "puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();" (assignment_expression "puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00032290)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00032290)()" (parenthesized_expression "(*(code *)PTR___errno_location_00032290)" ( (pointer_expression "*(code *)PTR___errno_location_00032290" * (cast_expression "(code *)PTR___errno_location_00032290" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (if_statement "if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" if (parenthesized_expression "(iVar3 < 0)" ( (binary_expression "iVar3 < 0" identifier < number_literal) )) (compound_statement "{\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }" { (expression_statement "uVar6 = *puVar4;" (assignment_expression "uVar6 = *puVar4" identifier = (pointer_expression "*puVar4" * identifier)) ;) (expression_statement "iVar5 = 0;" (assignment_expression "iVar5 = 0" identifier = number_literal) ;) }) (else_clause "else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" else (compound_statement "{\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" { (expression_statement "iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);" (assignment_expression "iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3)" identifier = (call_expression "(*(code *)PTR_fdopendir_0003224c)(iVar3)" (parenthesized_expression "(*(code *)PTR_fdopendir_0003224c)" ( (pointer_expression "*(code *)PTR_fdopendir_0003224c" * (cast_expression "(code *)PTR_fdopendir_0003224c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3)" ( identifier )))) ;) (expression_statement "uVar6 = *puVar4;" (assignment_expression "uVar6 = *puVar4" identifier = (pointer_expression "*puVar4" * identifier)) ;) (if_statement "if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }" if (parenthesized_expression "(iVar5 == 0)" ( (binary_expression "iVar5 == 0" identifier == number_literal) )) (compound_statement "{\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }" { (expression_statement "(*(code *)PTR_close_0003220c)(iVar3);" (call_expression "(*(code *)PTR_close_0003220c)(iVar3)" (parenthesized_expression "(*(code *)PTR_close_0003220c)" ( (pointer_expression "*(code *)PTR_close_0003220c" * (cast_expression "(code *)PTR_close_0003220c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar3)" ( identifier ))) ;) })) }))) (expression_statement "(*(code *)PTR_closedir_00032208)(iVar1);" (call_expression "(*(code *)PTR_closedir_00032208)(iVar1)" (parenthesized_expression "(*(code *)PTR_closedir_00032208)" ( (pointer_expression "*(code *)PTR_closedir_00032208" * (cast_expression "(code *)PTR_closedir_00032208" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar1)" ( identifier ))) ;) (expression_statement "*puVar4 = uVar6;" (assignment_expression "*puVar4 = uVar6" (pointer_expression "*puVar4" * identifier) = identifier) ;) (return_statement "return iVar5;" return identifier ;) })) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * 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 ( )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != LIT) )) && (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT )))) , (binary_expression IDENT < LIT)) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT , LIT )))) ;) (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 = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = LIT) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT )))) ;) (expression_statement (assignment_expression IDENT = (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 ( IDENT ))) ;) })) }))) (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (return_statement return IDENT ;) })) (return_statement return IDENT ;) })))
(function_definition "int opendir_safer(void)\n\n{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  undefined4 *puVar4;\n  int iVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_opendir_00032204)();\n  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }\n  return iVar1;\n}" (primitive_type "int") (function_declarator "opendir_safer(void)" (identifier "opendir_safer") (parameter_list "(void)" (( "(") (parameter_declaration "void" (primitive_type "void")) () ")"))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int iVar3;\n  undefined4 *puVar4;\n  int iVar5;\n  undefined4 uVar6;\n  \n  iVar1 = (*(code *)PTR_opendir_00032204)();\n  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }\n  return iVar1;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "undefined4 *puVar4;" (type_identifier "undefined4") (pointer_declarator "*puVar4" (* "*") (identifier "puVar4")) (; ";")) (declaration "int iVar5;" (primitive_type "int") (identifier "iVar5") (; ";")) (declaration "undefined4 uVar6;" (type_identifier "undefined4") (identifier "uVar6") (; ";")) (expression_statement "iVar1 = (*(code *)PTR_opendir_00032204)();" (assignment_expression "iVar1 = (*(code *)PTR_opendir_00032204)()" (identifier "iVar1") (= "=") (call_expression "(*(code *)PTR_opendir_00032204)()" (parenthesized_expression "(*(code *)PTR_opendir_00032204)" (( "(") (pointer_expression "*(code *)PTR_opendir_00032204" (* "*") (cast_expression "(code *)PTR_opendir_00032204" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_opendir_00032204"))) () ")")) (argument_list "()" (( "(") () ")")))) (; ";")) (if_statement "if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }" (if "if") (parenthesized_expression "((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3))" (( "(") (binary_expression "(iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)" (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)" (( "(") (comma_expression "uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3" (assignment_expression "uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1)" (identifier "uVar2") (= "=") (call_expression "(*(code *)PTR_dirfd_0003233c)(iVar1)" (parenthesized_expression "(*(code *)PTR_dirfd_0003233c)" (( "(") (pointer_expression "*(code *)PTR_dirfd_0003233c" (* "*") (cast_expression "(code *)PTR_dirfd_0003233c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_dirfd_0003233c"))) () ")")) (argument_list "(iVar1)" (( "(") (identifier "iVar1") () ")")))) (, ",") (binary_expression "uVar2 < 3" (identifier "uVar2") (< "<") (number_literal "3"))) () ")"))) () ")")) (compound_statement "{\n    iVar3 = rpl_fcntl(uVar2,0x406,3);\n    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();\n    if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }\n    (*(code *)PTR_closedir_00032208)(iVar1);\n    *puVar4 = uVar6;\n    return iVar5;\n  }" ({ "{") (expression_statement "iVar3 = rpl_fcntl(uVar2,0x406,3);" (assignment_expression "iVar3 = rpl_fcntl(uVar2,0x406,3)" (identifier "iVar3") (= "=") (call_expression "rpl_fcntl(uVar2,0x406,3)" (identifier "rpl_fcntl") (argument_list "(uVar2,0x406,3)" (( "(") (identifier "uVar2") (, ",") (number_literal "0x406") (, ",") (number_literal "3") () ")")))) (; ";")) (expression_statement "puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();" (assignment_expression "puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)()" (identifier "puVar4") (= "=") (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00032290)()" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "(*(code *)PTR___errno_location_00032290)()" (parenthesized_expression "(*(code *)PTR___errno_location_00032290)" (( "(") (pointer_expression "*(code *)PTR___errno_location_00032290" (* "*") (cast_expression "(code *)PTR___errno_location_00032290" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR___errno_location_00032290"))) () ")")) (argument_list "()" (( "(") () ")"))))) (; ";")) (if_statement "if (iVar3 < 0) {\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }\n    else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" (if "if") (parenthesized_expression "(iVar3 < 0)" (( "(") (binary_expression "iVar3 < 0" (identifier "iVar3") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n      uVar6 = *puVar4;\n      iVar5 = 0;\n    }" ({ "{") (expression_statement "uVar6 = *puVar4;" (assignment_expression "uVar6 = *puVar4" (identifier "uVar6") (= "=") (pointer_expression "*puVar4" (* "*") (identifier "puVar4"))) (; ";")) (expression_statement "iVar5 = 0;" (assignment_expression "iVar5 = 0" (identifier "iVar5") (= "=") (number_literal "0")) (; ";")) (} "}")) (else_clause "else {\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" (else "else") (compound_statement "{\n      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);\n      uVar6 = *puVar4;\n      if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }\n    }" ({ "{") (expression_statement "iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);" (assignment_expression "iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3)" (identifier "iVar5") (= "=") (call_expression "(*(code *)PTR_fdopendir_0003224c)(iVar3)" (parenthesized_expression "(*(code *)PTR_fdopendir_0003224c)" (( "(") (pointer_expression "*(code *)PTR_fdopendir_0003224c" (* "*") (cast_expression "(code *)PTR_fdopendir_0003224c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_fdopendir_0003224c"))) () ")")) (argument_list "(iVar3)" (( "(") (identifier "iVar3") () ")")))) (; ";")) (expression_statement "uVar6 = *puVar4;" (assignment_expression "uVar6 = *puVar4" (identifier "uVar6") (= "=") (pointer_expression "*puVar4" (* "*") (identifier "puVar4"))) (; ";")) (if_statement "if (iVar5 == 0) {\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }" (if "if") (parenthesized_expression "(iVar5 == 0)" (( "(") (binary_expression "iVar5 == 0" (identifier "iVar5") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        (*(code *)PTR_close_0003220c)(iVar3);\n      }" ({ "{") (expression_statement "(*(code *)PTR_close_0003220c)(iVar3);" (call_expression "(*(code *)PTR_close_0003220c)(iVar3)" (parenthesized_expression "(*(code *)PTR_close_0003220c)" (( "(") (pointer_expression "*(code *)PTR_close_0003220c" (* "*") (cast_expression "(code *)PTR_close_0003220c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_0003220c"))) () ")")) (argument_list "(iVar3)" (( "(") (identifier "iVar3") () ")"))) (; ";")) (} "}"))) (} "}")))) (expression_statement "(*(code *)PTR_closedir_00032208)(iVar1);" (call_expression "(*(code *)PTR_closedir_00032208)(iVar1)" (parenthesized_expression "(*(code *)PTR_closedir_00032208)" (( "(") (pointer_expression "*(code *)PTR_closedir_00032208" (* "*") (cast_expression "(code *)PTR_closedir_00032208" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_closedir_00032208"))) () ")")) (argument_list "(iVar1)" (( "(") (identifier "iVar1") () ")"))) (; ";")) (expression_statement "*puVar4 = uVar6;" (assignment_expression "*puVar4 = uVar6" (pointer_expression "*puVar4" (* "*") (identifier "puVar4")) (= "=") (identifier "uVar6")) (; ";")) (return_statement "return iVar5;" (return "return") (identifier "iVar5") (; ";")) (} "}"))) (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}")))

type_1 * function_1(char *name)

{
  type_1 *var_1;
  type_2 var_2;
  int var_4;
  type_3 *puVar3;
  type_1 *var_5;
  type_3 uVar5;
  
  var_1 = (type_1 *)(*(type_4 *)PTR_opendir_00032204)();
  if ((var_1 != (type_1 *)0x0) && (var_2 = (*(type_4 *)PTR_dirfd_0003233c)(var_1), var_2 < 3)) {
    var_4 = var_3(var_2,0x406,3);
    puVar3 = (type_3 *)(*(type_4 *)PTR___errno_location_00032290)();
    if (var_4 < 0) {
      uVar5 = *puVar3;
      var_5 = (type_1 *)0x0;
    }
    else {
      var_5 = (type_1 *)(*(type_4 *)PTR_fdopendir_0003224c)(var_4);
      uVar5 = *puVar3;
      if (var_5 == (type_1 *)0x0) {
        (*(type_4 *)PTR_close_0003220c)(var_4);
      }
    }
    (*(type_4 *)PTR_closedir_00032208)(var_1);
    *puVar3 = uVar5;
    return var_5;
  }
  return var_1;
}


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

int MASKED(void)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  undefined4 *puVar4;
  int iVar5;
  undefined4 uVar6;
  
  iVar1 = (*(code *)PTR_opendir_00032204)();
  if ((iVar1 != 0) && (uVar2 = (*(code *)PTR_dirfd_0003233c)(iVar1), uVar2 < 3)) {
    iVar3 = rpl_fcntl(uVar2,0x406,3);
    puVar4 = (undefined4 *)(*(code *)PTR___errno_location_00032290)();
    if (iVar3 < 0) {
      uVar6 = *puVar4;
      iVar5 = 0;
    }
    else {
      iVar5 = (*(code *)PTR_fdopendir_0003224c)(iVar3);
      uVar6 = *puVar4;
      if (iVar5 == 0) {
        (*(code *)PTR_close_0003220c)(iVar3);
      }
    }
    (*(code *)PTR_closedir_00032208)(iVar1);
    *puVar4 = uVar6;
    return iVar5;
  }
  return iVar1;
}

