
int fd_safer(int fd)

{
  int iVar1;
  undefined4 *puVar2;
  undefined4 uVar3;
  
  if (2 < (uint)fd) {
    return fd;
  }
  iVar1 = dup_safer(fd);
  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();
  uVar3 = *puVar2;
  (*(code *)PTR_close_000332c4)(fd);
  *puVar2 = uVar3;
  return iVar1;
}



uint fd_safer(uint param_1)

{
  uint uVar1;
  undefined4 *puVar2;
  undefined4 uVar3;
  
  if (2 < param_1) {
    return param_1;
  }
  uVar1 = dup_safer();
  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();
  uVar3 = *puVar2;
  (*(code *)PTR_close_000332c4)(param_1);
  *puVar2 = uVar3;
  return uVar1;
}


lui gp,0x2
addiu gp,gp,-0x37a0
addu gp,gp,t9
addiu sp,sp,-0x30
sltiu v0,a0,0x3
sw gp,0x10(sp)
sw s0,0x1c(sp)
or s0,a0,zero
sw ra,0x2c(sp)
sw s3,0x28(sp)
sw s2,0x24(sp)
bne v0,zero,0x0001e8c4
_sw s1,0x20(sp)
lw ra,0x2c(sp)
or v0,s0,zero
lw s3,0x28(sp)
lw s2,0x24(sp)
lw s1,0x20(sp)
lw s0,0x1c(sp)
jr ra
_addiu sp,sp,0x30
lw t9,-0x7e54(gp)
bal 0x0001f980
_nop
lw gp,0x10(sp)
lw t9,-0x7d98(gp)
jalr t9
_or s3,v0,zero
or a0,s0,zero
lw gp,0x10(sp)
or s1,v0,zero
lw s2,0x0(v0)
lw t9,-0x7e0c(gp)
jalr t9
_or s0,s3,zero
or v0,s0,zero
lw ra,0x2c(sp)
lw s3,0x28(sp)
lw s0,0x1c(sp)
sw s2,0x0(s1)
lw s2,0x24(sp)
lw s1,0x20(sp)
jr ra
_addiu sp,sp,0x30
(translation_unit "uint fd_safer(uint param_1)\n\n{\n  uint uVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar1 = dup_safer();\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(param_1);\n  *puVar2 = uVar3;\n  return uVar1;\n}\n\n" (function_definition "uint fd_safer(uint param_1)\n\n{\n  uint uVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar1 = dup_safer();\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(param_1);\n  *puVar2 = uVar3;\n  return uVar1;\n}" type_identifier (function_declarator "fd_safer(uint param_1)" identifier (parameter_list "(uint param_1)" ( (parameter_declaration "uint param_1" type_identifier identifier) ))) (compound_statement "{\n  uint uVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar1 = dup_safer();\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(param_1);\n  *puVar2 = uVar3;\n  return uVar1;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (declaration "undefined4 *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "undefined4 uVar3;" type_identifier identifier ;) (if_statement "if (2 < param_1) {\n    return param_1;\n  }" if (parenthesized_expression "(2 < param_1)" ( (binary_expression "2 < param_1" number_literal < identifier) )) (compound_statement "{\n    return param_1;\n  }" { (return_statement "return param_1;" return identifier ;) })) (expression_statement "uVar1 = dup_safer();" (assignment_expression "uVar1 = dup_safer()" identifier = (call_expression "dup_safer()" identifier (argument_list "()" ( )))) ;) (expression_statement "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();" (assignment_expression "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00033338)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00033338)()" (parenthesized_expression "(*(code *)PTR___errno_location_00033338)" ( (pointer_expression "*(code *)PTR___errno_location_00033338" * (cast_expression "(code *)PTR___errno_location_00033338" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "uVar3 = *puVar2;" (assignment_expression "uVar3 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (expression_statement "(*(code *)PTR_close_000332c4)(param_1);" (call_expression "(*(code *)PTR_close_000332c4)(param_1)" (parenthesized_expression "(*(code *)PTR_close_000332c4)" ( (pointer_expression "*(code *)PTR_close_000332c4" * (cast_expression "(code *)PTR_close_000332c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_1)" ( identifier ))) ;) (expression_statement "*puVar2 = uVar3;" (assignment_expression "*puVar2 = uVar3" (pointer_expression "*puVar2" * identifier) = identifier) ;) (return_statement "return uVar1;" return identifier ;) })))
(translation_unit "int fd_safer(int fd)\n\n{\n  int iVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < (uint)fd) {\n    return fd;\n  }\n  iVar1 = dup_safer(fd);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(fd);\n  *puVar2 = uVar3;\n  return iVar1;\n}\n\n" (function_definition "int fd_safer(int fd)\n\n{\n  int iVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < (uint)fd) {\n    return fd;\n  }\n  iVar1 = dup_safer(fd);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(fd);\n  *puVar2 = uVar3;\n  return iVar1;\n}" primitive_type (function_declarator "fd_safer(int fd)" identifier (parameter_list "(int fd)" ( (parameter_declaration "int fd" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < (uint)fd) {\n    return fd;\n  }\n  iVar1 = dup_safer(fd);\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(fd);\n  *puVar2 = uVar3;\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "undefined4 *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "undefined4 uVar3;" type_identifier identifier ;) (if_statement "if (2 < (uint)fd) {\n    return fd;\n  }" if (parenthesized_expression "(2 < (uint)fd)" ( (binary_expression "2 < (uint)fd" number_literal < (cast_expression "(uint)fd" ( (type_descriptor "uint" type_identifier) ) identifier)) )) (compound_statement "{\n    return fd;\n  }" { (return_statement "return fd;" return identifier ;) })) (expression_statement "iVar1 = dup_safer(fd);" (assignment_expression "iVar1 = dup_safer(fd)" identifier = (call_expression "dup_safer(fd)" identifier (argument_list "(fd)" ( identifier )))) ;) (expression_statement "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();" (assignment_expression "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00033338)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00033338)()" (parenthesized_expression "(*(code *)PTR___errno_location_00033338)" ( (pointer_expression "*(code *)PTR___errno_location_00033338" * (cast_expression "(code *)PTR___errno_location_00033338" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "uVar3 = *puVar2;" (assignment_expression "uVar3 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (expression_statement "(*(code *)PTR_close_000332c4)(fd);" (call_expression "(*(code *)PTR_close_000332c4)(fd)" (parenthesized_expression "(*(code *)PTR_close_000332c4)" ( (pointer_expression "*(code *)PTR_close_000332c4" * (cast_expression "(code *)PTR_close_000332c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(fd)" ( identifier ))) ;) (expression_statement "*puVar2 = uVar3;" (assignment_expression "*puVar2 = uVar3" (pointer_expression "*puVar2" * identifier) = identifier) ;) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "uint fd_safer(uint param_1)\n\n{\n  uint uVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar1 = dup_safer();\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(param_1);\n  *puVar2 = uVar3;\n  return uVar1;\n}\n\n" (function_definition "uint fd_safer(uint param_1)\n\n{\n  uint uVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar1 = dup_safer();\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(param_1);\n  *puVar2 = uVar3;\n  return uVar1;\n}" type_identifier (function_declarator "fd_safer(uint param_1)" identifier (parameter_list "(uint param_1)" ( (parameter_declaration "uint param_1" type_identifier identifier) ))) (compound_statement "{\n  uint uVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar1 = dup_safer();\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(param_1);\n  *puVar2 = uVar3;\n  return uVar1;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (declaration "undefined4 *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "undefined4 uVar3;" type_identifier identifier ;) (if_statement "if (2 < param_1) {\n    return param_1;\n  }" if (parenthesized_expression "(2 < param_1)" ( (binary_expression "2 < param_1" number_literal < identifier) )) (compound_statement "{\n    return param_1;\n  }" { (return_statement "return param_1;" return identifier ;) })) (expression_statement "uVar1 = dup_safer();" (assignment_expression "uVar1 = dup_safer()" identifier = (call_expression "dup_safer()" identifier (argument_list "()" ( )))) ;) (expression_statement "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();" (assignment_expression "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00033338)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_00033338)()" (parenthesized_expression "(*(code *)PTR___errno_location_00033338)" ( (pointer_expression "*(code *)PTR___errno_location_00033338" * (cast_expression "(code *)PTR___errno_location_00033338" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "uVar3 = *puVar2;" (assignment_expression "uVar3 = *puVar2" identifier = (pointer_expression "*puVar2" * identifier)) ;) (expression_statement "(*(code *)PTR_close_000332c4)(param_1);" (call_expression "(*(code *)PTR_close_000332c4)(param_1)" (parenthesized_expression "(*(code *)PTR_close_000332c4)" ( (pointer_expression "*(code *)PTR_close_000332c4" * (cast_expression "(code *)PTR_close_000332c4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_1)" ( identifier ))) ;) (expression_statement "*puVar2 = uVar3;" (assignment_expression "*puVar2 = uVar3" (pointer_expression "*puVar2" * identifier) = identifier) ;) (return_statement "return uVar1;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( ))))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (return_statement return IDENT ;) })))
(function_definition "uint fd_safer(uint param_1)\n\n{\n  uint uVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar1 = dup_safer();\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(param_1);\n  *puVar2 = uVar3;\n  return uVar1;\n}" (type_identifier "uint") (function_declarator "fd_safer(uint param_1)" (identifier "fd_safer") (parameter_list "(uint param_1)" (( "(") (parameter_declaration "uint param_1" (type_identifier "uint") (identifier "param_1")) () ")"))) (compound_statement "{\n  uint uVar1;\n  undefined4 *puVar2;\n  undefined4 uVar3;\n  \n  if (2 < param_1) {\n    return param_1;\n  }\n  uVar1 = dup_safer();\n  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();\n  uVar3 = *puVar2;\n  (*(code *)PTR_close_000332c4)(param_1);\n  *puVar2 = uVar3;\n  return uVar1;\n}" ({ "{") (declaration "uint uVar1;" (type_identifier "uint") (identifier "uVar1") (; ";")) (declaration "undefined4 *puVar2;" (type_identifier "undefined4") (pointer_declarator "*puVar2" (* "*") (identifier "puVar2")) (; ";")) (declaration "undefined4 uVar3;" (type_identifier "undefined4") (identifier "uVar3") (; ";")) (if_statement "if (2 < param_1) {\n    return param_1;\n  }" (if "if") (parenthesized_expression "(2 < param_1)" (( "(") (binary_expression "2 < param_1" (number_literal "2") (< "<") (identifier "param_1")) () ")")) (compound_statement "{\n    return param_1;\n  }" ({ "{") (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}"))) (expression_statement "uVar1 = dup_safer();" (assignment_expression "uVar1 = dup_safer()" (identifier "uVar1") (= "=") (call_expression "dup_safer()" (identifier "dup_safer") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();" (assignment_expression "puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)()" (identifier "puVar2") (= "=") (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_00033338)()" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "(*(code *)PTR___errno_location_00033338)()" (parenthesized_expression "(*(code *)PTR___errno_location_00033338)" (( "(") (pointer_expression "*(code *)PTR___errno_location_00033338" (* "*") (cast_expression "(code *)PTR___errno_location_00033338" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR___errno_location_00033338"))) () ")")) (argument_list "()" (( "(") () ")"))))) (; ";")) (expression_statement "uVar3 = *puVar2;" (assignment_expression "uVar3 = *puVar2" (identifier "uVar3") (= "=") (pointer_expression "*puVar2" (* "*") (identifier "puVar2"))) (; ";")) (expression_statement "(*(code *)PTR_close_000332c4)(param_1);" (call_expression "(*(code *)PTR_close_000332c4)(param_1)" (parenthesized_expression "(*(code *)PTR_close_000332c4)" (( "(") (pointer_expression "*(code *)PTR_close_000332c4" (* "*") (cast_expression "(code *)PTR_close_000332c4" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_000332c4"))) () ")")) (argument_list "(param_1)" (( "(") (identifier "param_1") () ")"))) (; ";")) (expression_statement "*puVar2 = uVar3;" (assignment_expression "*puVar2 = uVar3" (pointer_expression "*puVar2" (* "*") (identifier "puVar2")) (= "=") (identifier "uVar3")) (; ";")) (return_statement "return uVar1;" (return "return") (identifier "uVar1") (; ";")) (} "}")))

int function_1(int fd)

{
  int iVar1;
  type_1 *puVar2;
  type_1 uVar3;
  
  if (2 < (type_2)fd) {
    return fd;
  }
  iVar1 = var_1(fd);
  puVar2 = (type_1 *)(*(type_3 *)PTR___errno_location_00033338)();
  uVar3 = *puVar2;
  (*(type_3 *)PTR_close_000332c4)(fd);
  *puVar2 = uVar3;
  return iVar1;
}


(translation_unit (function_definition type: (type_identifier) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (identifier)))) body: (compound_statement (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (identifier)) (if_statement condition: (parenthesized_expression (binary_expression left: (number_literal) right: (identifier))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (call_expression function: (parenthesized_expression (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (identifier)))) arguments: (argument_list))))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (expression_statement (call_expression function: (parenthesized_expression (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (identifier)))) arguments: (argument_list (identifier)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (return_statement (identifier)))))

uint MASKED(uint param_1)

{
  uint uVar1;
  undefined4 *puVar2;
  undefined4 uVar3;
  
  if (2 < param_1) {
    return param_1;
  }
  uVar1 = dup_safer();
  puVar2 = (undefined4 *)(*(code *)PTR___errno_location_00033338)();
  uVar3 = *puVar2;
  (*(code *)PTR_close_000332c4)(param_1);
  *puVar2 = uVar3;
  return uVar1;
}

