
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void ch_close(void)

{
  bool bVar1;
  undefined *puVar2;
  undefined *puVar3;
  int *piVar4;
  int *piVar5;
  uint uVar6;
  int iVar7;
  int *piVar8;
  
  puVar2 = PTR_CHAR_ARRAY_0004ebf8;
  piVar8 = *(int **)(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec);
  if (piVar8 != (int *)0x0) {
    uVar6 = piVar8[0x1005];
    bVar1 = true;
    if ((uVar6 & 0xd) != 0) {
      piVar4 = (int *)*piVar8;
      if (piVar4 != piVar8) {
        do {
          puVar3 = PTR_free_0004f37c;
          iVar7 = *piVar4;
          piVar5 = (int *)piVar4[1];
          *(int **)(iVar7 + 4) = piVar5;
          *piVar5 = iVar7;
          (*(code *)puVar3)(piVar4);
          piVar4 = (int *)*piVar8;
        } while (piVar4 != piVar8);
        uVar6 = piVar8[0x1005];
      }
      piVar4 = piVar8 + 4;
      piVar8[0x1008] = 0;
      do {
        piVar4[2] = (int)piVar4;
        piVar4[3] = (int)piVar4;
        piVar4 = piVar4 + 4;
        bVar1 = false;
      } while (piVar4 != piVar8 + 0x1004);
    }
    if ((uVar6 & 2) == 0) {
      if ((uVar6 & 0xc) == 0) {
        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);
        piVar8 = *(int **)(puVar2 + -0x5ec);
      }
      if (!bVar1) {
        (*(code *)PTR_free_0004f37c)(piVar8);
        puVar3 = PTR_curr_ifile_0004edb4;
        *(undefined4 *)(puVar2 + -0x5ec) = 0;
        set_filestate(*(void **)puVar3,(void *)0x0);
        return;
      }
      piVar8[0x1004] = -1;
    }
  }
  return;
}



void ch_close(void)

{
  bool bVar1;
  undefined *puVar2;
  undefined *puVar3;
  int *piVar4;
  int *piVar5;
  uint uVar6;
  int iVar7;
  int *piVar8;
  
  puVar2 = PTR_DAT_0004ebf8;
  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);
  if (piVar8 != (int *)0x0) {
    uVar6 = piVar8[0x1005];
    bVar1 = true;
    if ((uVar6 & 0xd) != 0) {
      piVar4 = (int *)*piVar8;
      if (piVar4 != piVar8) {
        do {
          puVar3 = PTR_free_0004f37c;
          iVar7 = *piVar4;
          piVar5 = (int *)piVar4[1];
          *(int **)(iVar7 + 4) = piVar5;
          *piVar5 = iVar7;
          (*(code *)puVar3)(piVar4);
          piVar4 = (int *)*piVar8;
        } while (piVar4 != piVar8);
        uVar6 = piVar8[0x1005];
      }
      piVar4 = piVar8 + 4;
      piVar8[0x1008] = 0;
      do {
        piVar4[2] = (int)piVar4;
        piVar4[3] = (int)piVar4;
        piVar4 = piVar4 + 4;
        bVar1 = false;
      } while (piVar4 != piVar8 + 0x1004);
    }
    if ((uVar6 & 2) == 0) {
      if ((uVar6 & 0xc) == 0) {
        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);
        piVar8 = *(int **)(puVar2 + -0x5ec);
      }
      if (!bVar1) {
        (*(code *)PTR_free_0004f37c)(piVar8);
        puVar3 = PTR_curr_ifile_0004edb4;
        *(undefined4 *)(puVar2 + -0x5ec) = 0;
        set_filestate(*(undefined4 *)puVar3,0);
        return;
      }
      piVar8[0x1004] = -1;
    }
  }
  return;
}


lui gp,0x4
addiu gp,gp,-0x251c
addu gp,gp,t9
addiu sp,sp,-0x28
sw s1,0x1c(sp)
sw s0,0x18(sp)
lw s1,-0x7fd8(gp)
sw gp,0x10(sp)
sw ra,0x24(sp)
sw s2,0x20(sp)
lw s0,-0x5ec(s1)
beq s0,zero,0x00019158
_nop
lw v1,0x4014(s0)
andi v0,v1,0xd
bne v0,zero,0x00019170
_li s2,0x1
andi v0,v1,0x2
bne v0,zero,0x0001915c
_lw ra,0x24(sp)
andi v1,v1,0xc
beq v1,zero,0x000191d0
_lw t9,-0x7954(gp)
beq s2,zero,0x000191e8
_lw t9,-0x7854(gp)
li v0,-0x1
sw v0,0x4010(s0)
lw ra,0x24(sp)
lw s2,0x20(sp)
lw s1,0x1c(sp)
lw s0,0x18(sp)
jr ra
_addiu sp,sp,0x28
lw v0,0x0(s0)
beq v0,s0,0x000191a8
_nop
lw v1,0x0(v0)
or a0,v0,zero
lw v0,0x4(v0)
lw t9,-0x7854(gp)
sw v0,0x4(v1)
jalr t9
_sw v1,0x0(v0)
lw v0,0x0(s0)
bne v0,s0,0x0001917c
_lw gp,0x10(sp)
lw v1,0x4014(s0)
addiu v0,s0,0x10
sw zero,0x4020(s0)
addiu a0,s0,0x4010
sw v0,0x8(v0)
sw v0,0xc(v0)
addiu v0,v0,0x10
bne v0,a0,0x000191b4
_or s2,zero,zero
b 0x00019134
_andi v0,v1,0x2
jalr t9
_lw a0,0x4010(s0)
lw gp,0x10(sp)
bne s2,zero,0x00019150
_lw s0,-0x5ec(s1)
lw t9,-0x7854(gp)
jalr t9
_or a0,s0,zero
or a1,zero,zero
lw gp,0x10(sp)
lw ra,0x24(sp)
lw s2,0x20(sp)
lw s0,0x18(sp)
lw v0,-0x7e1c(gp)
lw t9,-0x7dec(gp)
sw zero,-0x5ec(s1)
lw s1,0x1c(sp)
lw a0,0x0(v0)
b 0x00025a20
_addiu sp,sp,0x28
(translation_unit "void ch_close(void)\n\n{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_DAT_0004ebf8;\n  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}\n\n" (function_definition "void ch_close(void)\n\n{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_DAT_0004ebf8;\n  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}" primitive_type (function_declarator "ch_close(void)" identifier (parameter_list "(void)" ( (parameter_declaration "void" primitive_type) ))) (compound_statement "{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_DAT_0004ebf8;\n  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}" { (declaration "bool bVar1;" primitive_type identifier ;) (declaration "undefined *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "undefined *puVar3;" type_identifier (pointer_declarator "*puVar3" * identifier) ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (declaration "int *piVar5;" primitive_type (pointer_declarator "*piVar5" * identifier) ;) (declaration "uint uVar6;" type_identifier identifier ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "int *piVar8;" primitive_type (pointer_declarator "*piVar8" * identifier) ;) (expression_statement "puVar2 = PTR_DAT_0004ebf8;" (assignment_expression "puVar2 = PTR_DAT_0004ebf8" identifier = identifier) ;) (expression_statement "piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);" (assignment_expression "piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec)" identifier = (pointer_expression "*(int **)(PTR_DAT_0004ebf8 + -0x5ec)" * (cast_expression "(int **)(PTR_DAT_0004ebf8 + -0x5ec)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(PTR_DAT_0004ebf8 + -0x5ec)" ( (binary_expression "PTR_DAT_0004ebf8 + -0x5ec" identifier + number_literal) ))))) ;) (if_statement "if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }" if (parenthesized_expression "(piVar8 != (int *)0x0)" ( (binary_expression "piVar8 != (int *)0x0" identifier != (cast_expression "(int *)0x0" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }" { (expression_statement "uVar6 = piVar8[0x1005];" (assignment_expression "uVar6 = piVar8[0x1005]" identifier = (subscript_expression "piVar8[0x1005]" identifier [ number_literal ])) ;) (expression_statement "bVar1 = true;" (assignment_expression "bVar1 = true" identifier = true) ;) (if_statement "if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }" if (parenthesized_expression "((uVar6 & 0xd) != 0)" ( (binary_expression "(uVar6 & 0xd) != 0" (parenthesized_expression "(uVar6 & 0xd)" ( (binary_expression "uVar6 & 0xd" identifier & number_literal) )) != number_literal) )) (compound_statement "{\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }" { (expression_statement "piVar4 = (int *)*piVar8;" (assignment_expression "piVar4 = (int *)*piVar8" identifier = (cast_expression "(int *)*piVar8" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*piVar8" * identifier))) ;) (if_statement "if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }" if (parenthesized_expression "(piVar4 != piVar8)" ( (binary_expression "piVar4 != piVar8" identifier != identifier) )) (compound_statement "{\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }" { (do_statement "do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);" do (compound_statement "{\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        }" { (expression_statement "puVar3 = PTR_free_0004f37c;" (assignment_expression "puVar3 = PTR_free_0004f37c" identifier = identifier) ;) (expression_statement "iVar7 = *piVar4;" (assignment_expression "iVar7 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "piVar5 = (int *)piVar4[1];" (assignment_expression "piVar5 = (int *)piVar4[1]" identifier = (cast_expression "(int *)piVar4[1]" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (subscript_expression "piVar4[1]" identifier [ number_literal ]))) ;) (expression_statement "*(int **)(iVar7 + 4) = piVar5;" (assignment_expression "*(int **)(iVar7 + 4) = piVar5" (pointer_expression "*(int **)(iVar7 + 4)" * (cast_expression "(int **)(iVar7 + 4)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(iVar7 + 4)" ( (binary_expression "iVar7 + 4" identifier + number_literal) )))) = identifier) ;) (expression_statement "*piVar5 = iVar7;" (assignment_expression "*piVar5 = iVar7" (pointer_expression "*piVar5" * identifier) = identifier) ;) (expression_statement "(*(code *)puVar3)(piVar4);" (call_expression "(*(code *)puVar3)(piVar4)" (parenthesized_expression "(*(code *)puVar3)" ( (pointer_expression "*(code *)puVar3" * (cast_expression "(code *)puVar3" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar4)" ( identifier ))) ;) (expression_statement "piVar4 = (int *)*piVar8;" (assignment_expression "piVar4 = (int *)*piVar8" identifier = (cast_expression "(int *)*piVar8" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*piVar8" * identifier))) ;) }) while (parenthesized_expression "(piVar4 != piVar8)" ( (binary_expression "piVar4 != piVar8" identifier != identifier) )) ;) (expression_statement "uVar6 = piVar8[0x1005];" (assignment_expression "uVar6 = piVar8[0x1005]" identifier = (subscript_expression "piVar8[0x1005]" identifier [ number_literal ])) ;) })) (expression_statement "piVar4 = piVar8 + 4;" (assignment_expression "piVar4 = piVar8 + 4" identifier = (binary_expression "piVar8 + 4" identifier + number_literal)) ;) (expression_statement "piVar8[0x1008] = 0;" (assignment_expression "piVar8[0x1008] = 0" (subscript_expression "piVar8[0x1008]" identifier [ number_literal ]) = number_literal) ;) (do_statement "do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);" do (compound_statement "{\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      }" { (expression_statement "piVar4[2] = (int)piVar4;" (assignment_expression "piVar4[2] = (int)piVar4" (subscript_expression "piVar4[2]" identifier [ number_literal ]) = (cast_expression "(int)piVar4" ( (type_descriptor "int" primitive_type) ) identifier)) ;) (expression_statement "piVar4[3] = (int)piVar4;" (assignment_expression "piVar4[3] = (int)piVar4" (subscript_expression "piVar4[3]" identifier [ number_literal ]) = (cast_expression "(int)piVar4" ( (type_descriptor "int" primitive_type) ) identifier)) ;) (expression_statement "piVar4 = piVar4 + 4;" (assignment_expression "piVar4 = piVar4 + 4" identifier = (binary_expression "piVar4 + 4" identifier + number_literal)) ;) (expression_statement "bVar1 = false;" (assignment_expression "bVar1 = false" identifier = false) ;) }) while (parenthesized_expression "(piVar4 != piVar8 + 0x1004)" ( (binary_expression "piVar4 != piVar8 + 0x1004" identifier != (binary_expression "piVar8 + 0x1004" identifier + number_literal)) )) ;) })) (if_statement "if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }" if (parenthesized_expression "((uVar6 & 2) == 0)" ( (binary_expression "(uVar6 & 2) == 0" (parenthesized_expression "(uVar6 & 2)" ( (binary_expression "uVar6 & 2" identifier & number_literal) )) == number_literal) )) (compound_statement "{\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }" { (if_statement "if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }" if (parenthesized_expression "((uVar6 & 0xc) == 0)" ( (binary_expression "(uVar6 & 0xc) == 0" (parenthesized_expression "(uVar6 & 0xc)" ( (binary_expression "uVar6 & 0xc" identifier & number_literal) )) == number_literal) )) (compound_statement "{\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }" { (expression_statement "(*(code *)PTR_close_0004f27c)(piVar8[0x1004]);" (call_expression "(*(code *)PTR_close_0004f27c)(piVar8[0x1004])" (parenthesized_expression "(*(code *)PTR_close_0004f27c)" ( (pointer_expression "*(code *)PTR_close_0004f27c" * (cast_expression "(code *)PTR_close_0004f27c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar8[0x1004])" ( (subscript_expression "piVar8[0x1004]" identifier [ number_literal ]) ))) ;) (expression_statement "piVar8 = *(int **)(puVar2 + -0x5ec);" (assignment_expression "piVar8 = *(int **)(puVar2 + -0x5ec)" identifier = (pointer_expression "*(int **)(puVar2 + -0x5ec)" * (cast_expression "(int **)(puVar2 + -0x5ec)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(puVar2 + -0x5ec)" ( (binary_expression "puVar2 + -0x5ec" identifier + number_literal) ))))) ;) })) (if_statement "if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }" if (parenthesized_expression "(!bVar1)" ( (unary_expression "!bVar1" ! identifier) )) (compound_statement "{\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }" { (expression_statement "(*(code *)PTR_free_0004f37c)(piVar8);" (call_expression "(*(code *)PTR_free_0004f37c)(piVar8)" (parenthesized_expression "(*(code *)PTR_free_0004f37c)" ( (pointer_expression "*(code *)PTR_free_0004f37c" * (cast_expression "(code *)PTR_free_0004f37c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar8)" ( identifier ))) ;) (expression_statement "puVar3 = PTR_curr_ifile_0004edb4;" (assignment_expression "puVar3 = PTR_curr_ifile_0004edb4" identifier = identifier) ;) (expression_statement "*(undefined4 *)(puVar2 + -0x5ec) = 0;" (assignment_expression "*(undefined4 *)(puVar2 + -0x5ec) = 0" (pointer_expression "*(undefined4 *)(puVar2 + -0x5ec)" * (cast_expression "(undefined4 *)(puVar2 + -0x5ec)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(puVar2 + -0x5ec)" ( (binary_expression "puVar2 + -0x5ec" identifier + number_literal) )))) = number_literal) ;) (expression_statement "set_filestate(*(undefined4 *)puVar3,0);" (call_expression "set_filestate(*(undefined4 *)puVar3,0)" identifier (argument_list "(*(undefined4 *)puVar3,0)" ( (pointer_expression "*(undefined4 *)puVar3" * (cast_expression "(undefined4 *)puVar3" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) , number_literal ))) ;) (return_statement "return;" return ;) })) (expression_statement "piVar8[0x1004] = -1;" (assignment_expression "piVar8[0x1004] = -1" (subscript_expression "piVar8[0x1004]" identifier [ number_literal ]) = number_literal) ;) })) })) (return_statement "return;" return ;) })))
(translation_unit "/* WARNING: Unknown calling convention -- yet parameter storage is locked */\n\nvoid ch_close(void)\n\n{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_CHAR_ARRAY_0004ebf8;\n  piVar8 = *(int **)(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}\n\n" comment (function_definition "void ch_close(void)\n\n{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_CHAR_ARRAY_0004ebf8;\n  piVar8 = *(int **)(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}" primitive_type (function_declarator "ch_close(void)" identifier (parameter_list "(void)" ( (parameter_declaration "void" primitive_type) ))) (compound_statement "{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_CHAR_ARRAY_0004ebf8;\n  piVar8 = *(int **)(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}" { (declaration "bool bVar1;" primitive_type identifier ;) (declaration "undefined *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "undefined *puVar3;" type_identifier (pointer_declarator "*puVar3" * identifier) ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (declaration "int *piVar5;" primitive_type (pointer_declarator "*piVar5" * identifier) ;) (declaration "uint uVar6;" type_identifier identifier ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "int *piVar8;" primitive_type (pointer_declarator "*piVar8" * identifier) ;) (expression_statement "puVar2 = PTR_CHAR_ARRAY_0004ebf8;" (assignment_expression "puVar2 = PTR_CHAR_ARRAY_0004ebf8" identifier = identifier) ;) (expression_statement "piVar8 = *(int **)(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec);" (assignment_expression "piVar8 = *(int **)(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec)" identifier = (pointer_expression "*(int **)(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec)" * (cast_expression "(int **)(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(PTR_CHAR_ARRAY_0004ebf8 + -0x5ec)" ( (binary_expression "PTR_CHAR_ARRAY_0004ebf8 + -0x5ec" identifier + number_literal) ))))) ;) (if_statement "if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }" if (parenthesized_expression "(piVar8 != (int *)0x0)" ( (binary_expression "piVar8 != (int *)0x0" identifier != (cast_expression "(int *)0x0" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }" { (expression_statement "uVar6 = piVar8[0x1005];" (assignment_expression "uVar6 = piVar8[0x1005]" identifier = (subscript_expression "piVar8[0x1005]" identifier [ number_literal ])) ;) (expression_statement "bVar1 = true;" (assignment_expression "bVar1 = true" identifier = true) ;) (if_statement "if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }" if (parenthesized_expression "((uVar6 & 0xd) != 0)" ( (binary_expression "(uVar6 & 0xd) != 0" (parenthesized_expression "(uVar6 & 0xd)" ( (binary_expression "uVar6 & 0xd" identifier & number_literal) )) != number_literal) )) (compound_statement "{\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }" { (expression_statement "piVar4 = (int *)*piVar8;" (assignment_expression "piVar4 = (int *)*piVar8" identifier = (cast_expression "(int *)*piVar8" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*piVar8" * identifier))) ;) (if_statement "if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }" if (parenthesized_expression "(piVar4 != piVar8)" ( (binary_expression "piVar4 != piVar8" identifier != identifier) )) (compound_statement "{\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }" { (do_statement "do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);" do (compound_statement "{\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        }" { (expression_statement "puVar3 = PTR_free_0004f37c;" (assignment_expression "puVar3 = PTR_free_0004f37c" identifier = identifier) ;) (expression_statement "iVar7 = *piVar4;" (assignment_expression "iVar7 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "piVar5 = (int *)piVar4[1];" (assignment_expression "piVar5 = (int *)piVar4[1]" identifier = (cast_expression "(int *)piVar4[1]" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (subscript_expression "piVar4[1]" identifier [ number_literal ]))) ;) (expression_statement "*(int **)(iVar7 + 4) = piVar5;" (assignment_expression "*(int **)(iVar7 + 4) = piVar5" (pointer_expression "*(int **)(iVar7 + 4)" * (cast_expression "(int **)(iVar7 + 4)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(iVar7 + 4)" ( (binary_expression "iVar7 + 4" identifier + number_literal) )))) = identifier) ;) (expression_statement "*piVar5 = iVar7;" (assignment_expression "*piVar5 = iVar7" (pointer_expression "*piVar5" * identifier) = identifier) ;) (expression_statement "(*(code *)puVar3)(piVar4);" (call_expression "(*(code *)puVar3)(piVar4)" (parenthesized_expression "(*(code *)puVar3)" ( (pointer_expression "*(code *)puVar3" * (cast_expression "(code *)puVar3" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar4)" ( identifier ))) ;) (expression_statement "piVar4 = (int *)*piVar8;" (assignment_expression "piVar4 = (int *)*piVar8" identifier = (cast_expression "(int *)*piVar8" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*piVar8" * identifier))) ;) }) while (parenthesized_expression "(piVar4 != piVar8)" ( (binary_expression "piVar4 != piVar8" identifier != identifier) )) ;) (expression_statement "uVar6 = piVar8[0x1005];" (assignment_expression "uVar6 = piVar8[0x1005]" identifier = (subscript_expression "piVar8[0x1005]" identifier [ number_literal ])) ;) })) (expression_statement "piVar4 = piVar8 + 4;" (assignment_expression "piVar4 = piVar8 + 4" identifier = (binary_expression "piVar8 + 4" identifier + number_literal)) ;) (expression_statement "piVar8[0x1008] = 0;" (assignment_expression "piVar8[0x1008] = 0" (subscript_expression "piVar8[0x1008]" identifier [ number_literal ]) = number_literal) ;) (do_statement "do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);" do (compound_statement "{\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      }" { (expression_statement "piVar4[2] = (int)piVar4;" (assignment_expression "piVar4[2] = (int)piVar4" (subscript_expression "piVar4[2]" identifier [ number_literal ]) = (cast_expression "(int)piVar4" ( (type_descriptor "int" primitive_type) ) identifier)) ;) (expression_statement "piVar4[3] = (int)piVar4;" (assignment_expression "piVar4[3] = (int)piVar4" (subscript_expression "piVar4[3]" identifier [ number_literal ]) = (cast_expression "(int)piVar4" ( (type_descriptor "int" primitive_type) ) identifier)) ;) (expression_statement "piVar4 = piVar4 + 4;" (assignment_expression "piVar4 = piVar4 + 4" identifier = (binary_expression "piVar4 + 4" identifier + number_literal)) ;) (expression_statement "bVar1 = false;" (assignment_expression "bVar1 = false" identifier = false) ;) }) while (parenthesized_expression "(piVar4 != piVar8 + 0x1004)" ( (binary_expression "piVar4 != piVar8 + 0x1004" identifier != (binary_expression "piVar8 + 0x1004" identifier + number_literal)) )) ;) })) (if_statement "if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }" if (parenthesized_expression "((uVar6 & 2) == 0)" ( (binary_expression "(uVar6 & 2) == 0" (parenthesized_expression "(uVar6 & 2)" ( (binary_expression "uVar6 & 2" identifier & number_literal) )) == number_literal) )) (compound_statement "{\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }" { (if_statement "if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }" if (parenthesized_expression "((uVar6 & 0xc) == 0)" ( (binary_expression "(uVar6 & 0xc) == 0" (parenthesized_expression "(uVar6 & 0xc)" ( (binary_expression "uVar6 & 0xc" identifier & number_literal) )) == number_literal) )) (compound_statement "{\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }" { (expression_statement "(*(code *)PTR_close_0004f27c)(piVar8[0x1004]);" (call_expression "(*(code *)PTR_close_0004f27c)(piVar8[0x1004])" (parenthesized_expression "(*(code *)PTR_close_0004f27c)" ( (pointer_expression "*(code *)PTR_close_0004f27c" * (cast_expression "(code *)PTR_close_0004f27c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar8[0x1004])" ( (subscript_expression "piVar8[0x1004]" identifier [ number_literal ]) ))) ;) (expression_statement "piVar8 = *(int **)(puVar2 + -0x5ec);" (assignment_expression "piVar8 = *(int **)(puVar2 + -0x5ec)" identifier = (pointer_expression "*(int **)(puVar2 + -0x5ec)" * (cast_expression "(int **)(puVar2 + -0x5ec)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(puVar2 + -0x5ec)" ( (binary_expression "puVar2 + -0x5ec" identifier + number_literal) ))))) ;) })) (if_statement "if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }" if (parenthesized_expression "(!bVar1)" ( (unary_expression "!bVar1" ! identifier) )) (compound_statement "{\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(void **)puVar3,(void *)0x0);\n        return;\n      }" { (expression_statement "(*(code *)PTR_free_0004f37c)(piVar8);" (call_expression "(*(code *)PTR_free_0004f37c)(piVar8)" (parenthesized_expression "(*(code *)PTR_free_0004f37c)" ( (pointer_expression "*(code *)PTR_free_0004f37c" * (cast_expression "(code *)PTR_free_0004f37c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar8)" ( identifier ))) ;) (expression_statement "puVar3 = PTR_curr_ifile_0004edb4;" (assignment_expression "puVar3 = PTR_curr_ifile_0004edb4" identifier = identifier) ;) (expression_statement "*(undefined4 *)(puVar2 + -0x5ec) = 0;" (assignment_expression "*(undefined4 *)(puVar2 + -0x5ec) = 0" (pointer_expression "*(undefined4 *)(puVar2 + -0x5ec)" * (cast_expression "(undefined4 *)(puVar2 + -0x5ec)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(puVar2 + -0x5ec)" ( (binary_expression "puVar2 + -0x5ec" identifier + number_literal) )))) = number_literal) ;) (expression_statement "set_filestate(*(void **)puVar3,(void *)0x0);" (call_expression "set_filestate(*(void **)puVar3,(void *)0x0)" identifier (argument_list "(*(void **)puVar3,(void *)0x0)" ( (pointer_expression "*(void **)puVar3" * (cast_expression "(void **)puVar3" ( (type_descriptor "void **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) identifier)) , (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ))) ;) (return_statement "return;" return ;) })) (expression_statement "piVar8[0x1004] = -1;" (assignment_expression "piVar8[0x1004] = -1" (subscript_expression "piVar8[0x1004]" identifier [ number_literal ]) = number_literal) ;) })) })) (return_statement "return;" return ;) })))
(translation_unit "void ch_close(void)\n\n{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_DAT_0004ebf8;\n  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}\n\n" (function_definition "void ch_close(void)\n\n{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_DAT_0004ebf8;\n  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}" primitive_type (function_declarator "ch_close(void)" identifier (parameter_list "(void)" ( (parameter_declaration "void" primitive_type) ))) (compound_statement "{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_DAT_0004ebf8;\n  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}" { (declaration "bool bVar1;" primitive_type identifier ;) (declaration "undefined *puVar2;" type_identifier (pointer_declarator "*puVar2" * identifier) ;) (declaration "undefined *puVar3;" type_identifier (pointer_declarator "*puVar3" * identifier) ;) (declaration "int *piVar4;" primitive_type (pointer_declarator "*piVar4" * identifier) ;) (declaration "int *piVar5;" primitive_type (pointer_declarator "*piVar5" * identifier) ;) (declaration "uint uVar6;" type_identifier identifier ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "int *piVar8;" primitive_type (pointer_declarator "*piVar8" * identifier) ;) (expression_statement "puVar2 = PTR_DAT_0004ebf8;" (assignment_expression "puVar2 = PTR_DAT_0004ebf8" identifier = identifier) ;) (expression_statement "piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);" (assignment_expression "piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec)" identifier = (pointer_expression "*(int **)(PTR_DAT_0004ebf8 + -0x5ec)" * (cast_expression "(int **)(PTR_DAT_0004ebf8 + -0x5ec)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(PTR_DAT_0004ebf8 + -0x5ec)" ( (binary_expression "PTR_DAT_0004ebf8 + -0x5ec" identifier + number_literal) ))))) ;) (if_statement "if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }" if (parenthesized_expression "(piVar8 != (int *)0x0)" ( (binary_expression "piVar8 != (int *)0x0" identifier != (cast_expression "(int *)0x0" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }" { (expression_statement "uVar6 = piVar8[0x1005];" (assignment_expression "uVar6 = piVar8[0x1005]" identifier = (subscript_expression "piVar8[0x1005]" identifier [ number_literal ])) ;) (expression_statement "bVar1 = true;" (assignment_expression "bVar1 = true" identifier = true) ;) (if_statement "if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }" if (parenthesized_expression "((uVar6 & 0xd) != 0)" ( (binary_expression "(uVar6 & 0xd) != 0" (parenthesized_expression "(uVar6 & 0xd)" ( (binary_expression "uVar6 & 0xd" identifier & number_literal) )) != number_literal) )) (compound_statement "{\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }" { (expression_statement "piVar4 = (int *)*piVar8;" (assignment_expression "piVar4 = (int *)*piVar8" identifier = (cast_expression "(int *)*piVar8" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*piVar8" * identifier))) ;) (if_statement "if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }" if (parenthesized_expression "(piVar4 != piVar8)" ( (binary_expression "piVar4 != piVar8" identifier != identifier) )) (compound_statement "{\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }" { (do_statement "do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);" do (compound_statement "{\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        }" { (expression_statement "puVar3 = PTR_free_0004f37c;" (assignment_expression "puVar3 = PTR_free_0004f37c" identifier = identifier) ;) (expression_statement "iVar7 = *piVar4;" (assignment_expression "iVar7 = *piVar4" identifier = (pointer_expression "*piVar4" * identifier)) ;) (expression_statement "piVar5 = (int *)piVar4[1];" (assignment_expression "piVar5 = (int *)piVar4[1]" identifier = (cast_expression "(int *)piVar4[1]" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (subscript_expression "piVar4[1]" identifier [ number_literal ]))) ;) (expression_statement "*(int **)(iVar7 + 4) = piVar5;" (assignment_expression "*(int **)(iVar7 + 4) = piVar5" (pointer_expression "*(int **)(iVar7 + 4)" * (cast_expression "(int **)(iVar7 + 4)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(iVar7 + 4)" ( (binary_expression "iVar7 + 4" identifier + number_literal) )))) = identifier) ;) (expression_statement "*piVar5 = iVar7;" (assignment_expression "*piVar5 = iVar7" (pointer_expression "*piVar5" * identifier) = identifier) ;) (expression_statement "(*(code *)puVar3)(piVar4);" (call_expression "(*(code *)puVar3)(piVar4)" (parenthesized_expression "(*(code *)puVar3)" ( (pointer_expression "*(code *)puVar3" * (cast_expression "(code *)puVar3" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar4)" ( identifier ))) ;) (expression_statement "piVar4 = (int *)*piVar8;" (assignment_expression "piVar4 = (int *)*piVar8" identifier = (cast_expression "(int *)*piVar8" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*piVar8" * identifier))) ;) }) while (parenthesized_expression "(piVar4 != piVar8)" ( (binary_expression "piVar4 != piVar8" identifier != identifier) )) ;) (expression_statement "uVar6 = piVar8[0x1005];" (assignment_expression "uVar6 = piVar8[0x1005]" identifier = (subscript_expression "piVar8[0x1005]" identifier [ number_literal ])) ;) })) (expression_statement "piVar4 = piVar8 + 4;" (assignment_expression "piVar4 = piVar8 + 4" identifier = (binary_expression "piVar8 + 4" identifier + number_literal)) ;) (expression_statement "piVar8[0x1008] = 0;" (assignment_expression "piVar8[0x1008] = 0" (subscript_expression "piVar8[0x1008]" identifier [ number_literal ]) = number_literal) ;) (do_statement "do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);" do (compound_statement "{\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      }" { (expression_statement "piVar4[2] = (int)piVar4;" (assignment_expression "piVar4[2] = (int)piVar4" (subscript_expression "piVar4[2]" identifier [ number_literal ]) = (cast_expression "(int)piVar4" ( (type_descriptor "int" primitive_type) ) identifier)) ;) (expression_statement "piVar4[3] = (int)piVar4;" (assignment_expression "piVar4[3] = (int)piVar4" (subscript_expression "piVar4[3]" identifier [ number_literal ]) = (cast_expression "(int)piVar4" ( (type_descriptor "int" primitive_type) ) identifier)) ;) (expression_statement "piVar4 = piVar4 + 4;" (assignment_expression "piVar4 = piVar4 + 4" identifier = (binary_expression "piVar4 + 4" identifier + number_literal)) ;) (expression_statement "bVar1 = false;" (assignment_expression "bVar1 = false" identifier = false) ;) }) while (parenthesized_expression "(piVar4 != piVar8 + 0x1004)" ( (binary_expression "piVar4 != piVar8 + 0x1004" identifier != (binary_expression "piVar8 + 0x1004" identifier + number_literal)) )) ;) })) (if_statement "if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }" if (parenthesized_expression "((uVar6 & 2) == 0)" ( (binary_expression "(uVar6 & 2) == 0" (parenthesized_expression "(uVar6 & 2)" ( (binary_expression "uVar6 & 2" identifier & number_literal) )) == number_literal) )) (compound_statement "{\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }" { (if_statement "if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }" if (parenthesized_expression "((uVar6 & 0xc) == 0)" ( (binary_expression "(uVar6 & 0xc) == 0" (parenthesized_expression "(uVar6 & 0xc)" ( (binary_expression "uVar6 & 0xc" identifier & number_literal) )) == number_literal) )) (compound_statement "{\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }" { (expression_statement "(*(code *)PTR_close_0004f27c)(piVar8[0x1004]);" (call_expression "(*(code *)PTR_close_0004f27c)(piVar8[0x1004])" (parenthesized_expression "(*(code *)PTR_close_0004f27c)" ( (pointer_expression "*(code *)PTR_close_0004f27c" * (cast_expression "(code *)PTR_close_0004f27c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar8[0x1004])" ( (subscript_expression "piVar8[0x1004]" identifier [ number_literal ]) ))) ;) (expression_statement "piVar8 = *(int **)(puVar2 + -0x5ec);" (assignment_expression "piVar8 = *(int **)(puVar2 + -0x5ec)" identifier = (pointer_expression "*(int **)(puVar2 + -0x5ec)" * (cast_expression "(int **)(puVar2 + -0x5ec)" ( (type_descriptor "int **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(puVar2 + -0x5ec)" ( (binary_expression "puVar2 + -0x5ec" identifier + number_literal) ))))) ;) })) (if_statement "if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }" if (parenthesized_expression "(!bVar1)" ( (unary_expression "!bVar1" ! identifier) )) (compound_statement "{\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }" { (expression_statement "(*(code *)PTR_free_0004f37c)(piVar8);" (call_expression "(*(code *)PTR_free_0004f37c)(piVar8)" (parenthesized_expression "(*(code *)PTR_free_0004f37c)" ( (pointer_expression "*(code *)PTR_free_0004f37c" * (cast_expression "(code *)PTR_free_0004f37c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(piVar8)" ( identifier ))) ;) (expression_statement "puVar3 = PTR_curr_ifile_0004edb4;" (assignment_expression "puVar3 = PTR_curr_ifile_0004edb4" identifier = identifier) ;) (expression_statement "*(undefined4 *)(puVar2 + -0x5ec) = 0;" (assignment_expression "*(undefined4 *)(puVar2 + -0x5ec) = 0" (pointer_expression "*(undefined4 *)(puVar2 + -0x5ec)" * (cast_expression "(undefined4 *)(puVar2 + -0x5ec)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(puVar2 + -0x5ec)" ( (binary_expression "puVar2 + -0x5ec" identifier + number_literal) )))) = number_literal) ;) (expression_statement "set_filestate(*(undefined4 *)puVar3,0);" (call_expression "set_filestate(*(undefined4 *)puVar3,0)" identifier (argument_list "(*(undefined4 *)puVar3,0)" ( (pointer_expression "*(undefined4 *)puVar3" * (cast_expression "(undefined4 *)puVar3" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) , number_literal ))) ;) (return_statement "return;" return ;) })) (expression_statement "piVar8[0x1004] = -1;" (assignment_expression "piVar8[0x1004] = -1" (subscript_expression "piVar8[0x1004]" identifier [ number_literal ]) = number_literal) ;) })) })) (return_statement "return;" return ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (subscript_expression IDENT [ LIT ])) ;) (expression_statement (assignment_expression IDENT = BOOL) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT & LIT) )) != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (pointer_expression * IDENT))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != IDENT) )) (compound_statement { (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (subscript_expression IDENT [ LIT ]))) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = IDENT) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = 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 IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (pointer_expression * IDENT))) ;) }) while (parenthesized_expression ( (binary_expression IDENT != IDENT) )) ;) (expression_statement (assignment_expression IDENT = (subscript_expression IDENT [ LIT ])) ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = LIT) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = BOOL) ;) }) while (parenthesized_expression ( (binary_expression IDENT != (binary_expression IDENT + LIT)) )) ;) })) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT & LIT) )) == LIT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT & LIT) )) == LIT) )) (compound_statement { (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( (subscript_expression IDENT [ LIT ]) ))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) })) (if_statement if (parenthesized_expression ( (unary_expression ! IDENT) )) (compound_statement { (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = LIT) ;) (expression_statement (call_expression IDENT (argument_list ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) , LIT ))) ;) (return_statement return ;) })) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = LIT) ;) })) })) (return_statement return ;) })))
(function_definition "void ch_close(void)\n\n{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_DAT_0004ebf8;\n  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}" (primitive_type "void") (function_declarator "ch_close(void)" (identifier "ch_close") (parameter_list "(void)" (( "(") (parameter_declaration "void" (primitive_type "void")) () ")"))) (compound_statement "{\n  bool bVar1;\n  undefined *puVar2;\n  undefined *puVar3;\n  int *piVar4;\n  int *piVar5;\n  uint uVar6;\n  int iVar7;\n  int *piVar8;\n  \n  puVar2 = PTR_DAT_0004ebf8;\n  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);\n  if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }\n  return;\n}" ({ "{") (declaration "bool bVar1;" (primitive_type "bool") (identifier "bVar1") (; ";")) (declaration "undefined *puVar2;" (type_identifier "undefined") (pointer_declarator "*puVar2" (* "*") (identifier "puVar2")) (; ";")) (declaration "undefined *puVar3;" (type_identifier "undefined") (pointer_declarator "*puVar3" (* "*") (identifier "puVar3")) (; ";")) (declaration "int *piVar4;" (primitive_type "int") (pointer_declarator "*piVar4" (* "*") (identifier "piVar4")) (; ";")) (declaration "int *piVar5;" (primitive_type "int") (pointer_declarator "*piVar5" (* "*") (identifier "piVar5")) (; ";")) (declaration "uint uVar6;" (type_identifier "uint") (identifier "uVar6") (; ";")) (declaration "int iVar7;" (primitive_type "int") (identifier "iVar7") (; ";")) (declaration "int *piVar8;" (primitive_type "int") (pointer_declarator "*piVar8" (* "*") (identifier "piVar8")) (; ";")) (expression_statement "puVar2 = PTR_DAT_0004ebf8;" (assignment_expression "puVar2 = PTR_DAT_0004ebf8" (identifier "puVar2") (= "=") (identifier "PTR_DAT_0004ebf8")) (; ";")) (expression_statement "piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);" (assignment_expression "piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec)" (identifier "piVar8") (= "=") (pointer_expression "*(int **)(PTR_DAT_0004ebf8 + -0x5ec)" (* "*") (cast_expression "(int **)(PTR_DAT_0004ebf8 + -0x5ec)" (( "(") (type_descriptor "int **" (primitive_type "int") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(PTR_DAT_0004ebf8 + -0x5ec)" (( "(") (binary_expression "PTR_DAT_0004ebf8 + -0x5ec" (identifier "PTR_DAT_0004ebf8") (+ "+") (number_literal "-0x5ec")) () ")"))))) (; ";")) (if_statement "if (piVar8 != (int *)0x0) {\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }" (if "if") (parenthesized_expression "(piVar8 != (int *)0x0)" (( "(") (binary_expression "piVar8 != (int *)0x0" (identifier "piVar8") (!= "!=") (cast_expression "(int *)0x0" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n    uVar6 = piVar8[0x1005];\n    bVar1 = true;\n    if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }\n    if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }\n  }" ({ "{") (expression_statement "uVar6 = piVar8[0x1005];" (assignment_expression "uVar6 = piVar8[0x1005]" (identifier "uVar6") (= "=") (subscript_expression "piVar8[0x1005]" (identifier "piVar8") ([ "[") (number_literal "0x1005") (] "]"))) (; ";")) (expression_statement "bVar1 = true;" (assignment_expression "bVar1 = true" (identifier "bVar1") (= "=") (true "true")) (; ";")) (if_statement "if ((uVar6 & 0xd) != 0) {\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }" (if "if") (parenthesized_expression "((uVar6 & 0xd) != 0)" (( "(") (binary_expression "(uVar6 & 0xd) != 0" (parenthesized_expression "(uVar6 & 0xd)" (( "(") (binary_expression "uVar6 & 0xd" (identifier "uVar6") (& "&") (number_literal "0xd")) () ")")) (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      piVar4 = (int *)*piVar8;\n      if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }\n      piVar4 = piVar8 + 4;\n      piVar8[0x1008] = 0;\n      do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);\n    }" ({ "{") (expression_statement "piVar4 = (int *)*piVar8;" (assignment_expression "piVar4 = (int *)*piVar8" (identifier "piVar4") (= "=") (cast_expression "(int *)*piVar8" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (pointer_expression "*piVar8" (* "*") (identifier "piVar8")))) (; ";")) (if_statement "if (piVar4 != piVar8) {\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }" (if "if") (parenthesized_expression "(piVar4 != piVar8)" (( "(") (binary_expression "piVar4 != piVar8" (identifier "piVar4") (!= "!=") (identifier "piVar8")) () ")")) (compound_statement "{\n        do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);\n        uVar6 = piVar8[0x1005];\n      }" ({ "{") (do_statement "do {\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        } while (piVar4 != piVar8);" (do "do") (compound_statement "{\n          puVar3 = PTR_free_0004f37c;\n          iVar7 = *piVar4;\n          piVar5 = (int *)piVar4[1];\n          *(int **)(iVar7 + 4) = piVar5;\n          *piVar5 = iVar7;\n          (*(code *)puVar3)(piVar4);\n          piVar4 = (int *)*piVar8;\n        }" ({ "{") (expression_statement "puVar3 = PTR_free_0004f37c;" (assignment_expression "puVar3 = PTR_free_0004f37c" (identifier "puVar3") (= "=") (identifier "PTR_free_0004f37c")) (; ";")) (expression_statement "iVar7 = *piVar4;" (assignment_expression "iVar7 = *piVar4" (identifier "iVar7") (= "=") (pointer_expression "*piVar4" (* "*") (identifier "piVar4"))) (; ";")) (expression_statement "piVar5 = (int *)piVar4[1];" (assignment_expression "piVar5 = (int *)piVar4[1]" (identifier "piVar5") (= "=") (cast_expression "(int *)piVar4[1]" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (subscript_expression "piVar4[1]" (identifier "piVar4") ([ "[") (number_literal "1") (] "]")))) (; ";")) (expression_statement "*(int **)(iVar7 + 4) = piVar5;" (assignment_expression "*(int **)(iVar7 + 4) = piVar5" (pointer_expression "*(int **)(iVar7 + 4)" (* "*") (cast_expression "(int **)(iVar7 + 4)" (( "(") (type_descriptor "int **" (primitive_type "int") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(iVar7 + 4)" (( "(") (binary_expression "iVar7 + 4" (identifier "iVar7") (+ "+") (number_literal "4")) () ")")))) (= "=") (identifier "piVar5")) (; ";")) (expression_statement "*piVar5 = iVar7;" (assignment_expression "*piVar5 = iVar7" (pointer_expression "*piVar5" (* "*") (identifier "piVar5")) (= "=") (identifier "iVar7")) (; ";")) (expression_statement "(*(code *)puVar3)(piVar4);" (call_expression "(*(code *)puVar3)(piVar4)" (parenthesized_expression "(*(code *)puVar3)" (( "(") (pointer_expression "*(code *)puVar3" (* "*") (cast_expression "(code *)puVar3" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "puVar3"))) () ")")) (argument_list "(piVar4)" (( "(") (identifier "piVar4") () ")"))) (; ";")) (expression_statement "piVar4 = (int *)*piVar8;" (assignment_expression "piVar4 = (int *)*piVar8" (identifier "piVar4") (= "=") (cast_expression "(int *)*piVar8" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (pointer_expression "*piVar8" (* "*") (identifier "piVar8")))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(piVar4 != piVar8)" (( "(") (binary_expression "piVar4 != piVar8" (identifier "piVar4") (!= "!=") (identifier "piVar8")) () ")")) (; ";")) (expression_statement "uVar6 = piVar8[0x1005];" (assignment_expression "uVar6 = piVar8[0x1005]" (identifier "uVar6") (= "=") (subscript_expression "piVar8[0x1005]" (identifier "piVar8") ([ "[") (number_literal "0x1005") (] "]"))) (; ";")) (} "}"))) (expression_statement "piVar4 = piVar8 + 4;" (assignment_expression "piVar4 = piVar8 + 4" (identifier "piVar4") (= "=") (binary_expression "piVar8 + 4" (identifier "piVar8") (+ "+") (number_literal "4"))) (; ";")) (expression_statement "piVar8[0x1008] = 0;" (assignment_expression "piVar8[0x1008] = 0" (subscript_expression "piVar8[0x1008]" (identifier "piVar8") ([ "[") (number_literal "0x1008") (] "]")) (= "=") (number_literal "0")) (; ";")) (do_statement "do {\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      } while (piVar4 != piVar8 + 0x1004);" (do "do") (compound_statement "{\n        piVar4[2] = (int)piVar4;\n        piVar4[3] = (int)piVar4;\n        piVar4 = piVar4 + 4;\n        bVar1 = false;\n      }" ({ "{") (expression_statement "piVar4[2] = (int)piVar4;" (assignment_expression "piVar4[2] = (int)piVar4" (subscript_expression "piVar4[2]" (identifier "piVar4") ([ "[") (number_literal "2") (] "]")) (= "=") (cast_expression "(int)piVar4" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "piVar4"))) (; ";")) (expression_statement "piVar4[3] = (int)piVar4;" (assignment_expression "piVar4[3] = (int)piVar4" (subscript_expression "piVar4[3]" (identifier "piVar4") ([ "[") (number_literal "3") (] "]")) (= "=") (cast_expression "(int)piVar4" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "piVar4"))) (; ";")) (expression_statement "piVar4 = piVar4 + 4;" (assignment_expression "piVar4 = piVar4 + 4" (identifier "piVar4") (= "=") (binary_expression "piVar4 + 4" (identifier "piVar4") (+ "+") (number_literal "4"))) (; ";")) (expression_statement "bVar1 = false;" (assignment_expression "bVar1 = false" (identifier "bVar1") (= "=") (false "false")) (; ";")) (} "}")) (while "while") (parenthesized_expression "(piVar4 != piVar8 + 0x1004)" (( "(") (binary_expression "piVar4 != piVar8 + 0x1004" (identifier "piVar4") (!= "!=") (binary_expression "piVar8 + 0x1004" (identifier "piVar8") (+ "+") (number_literal "0x1004"))) () ")")) (; ";")) (} "}"))) (if_statement "if ((uVar6 & 2) == 0) {\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }" (if "if") (parenthesized_expression "((uVar6 & 2) == 0)" (( "(") (binary_expression "(uVar6 & 2) == 0" (parenthesized_expression "(uVar6 & 2)" (( "(") (binary_expression "uVar6 & 2" (identifier "uVar6") (& "&") (number_literal "2")) () ")")) (== "==") (number_literal "0")) () ")")) (compound_statement "{\n      if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }\n      if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }\n      piVar8[0x1004] = -1;\n    }" ({ "{") (if_statement "if ((uVar6 & 0xc) == 0) {\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }" (if "if") (parenthesized_expression "((uVar6 & 0xc) == 0)" (( "(") (binary_expression "(uVar6 & 0xc) == 0" (parenthesized_expression "(uVar6 & 0xc)" (( "(") (binary_expression "uVar6 & 0xc" (identifier "uVar6") (& "&") (number_literal "0xc")) () ")")) (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);\n        piVar8 = *(int **)(puVar2 + -0x5ec);\n      }" ({ "{") (expression_statement "(*(code *)PTR_close_0004f27c)(piVar8[0x1004]);" (call_expression "(*(code *)PTR_close_0004f27c)(piVar8[0x1004])" (parenthesized_expression "(*(code *)PTR_close_0004f27c)" (( "(") (pointer_expression "*(code *)PTR_close_0004f27c" (* "*") (cast_expression "(code *)PTR_close_0004f27c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_close_0004f27c"))) () ")")) (argument_list "(piVar8[0x1004])" (( "(") (subscript_expression "piVar8[0x1004]" (identifier "piVar8") ([ "[") (number_literal "0x1004") (] "]")) () ")"))) (; ";")) (expression_statement "piVar8 = *(int **)(puVar2 + -0x5ec);" (assignment_expression "piVar8 = *(int **)(puVar2 + -0x5ec)" (identifier "piVar8") (= "=") (pointer_expression "*(int **)(puVar2 + -0x5ec)" (* "*") (cast_expression "(int **)(puVar2 + -0x5ec)" (( "(") (type_descriptor "int **" (primitive_type "int") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(puVar2 + -0x5ec)" (( "(") (binary_expression "puVar2 + -0x5ec" (identifier "puVar2") (+ "+") (number_literal "-0x5ec")) () ")"))))) (; ";")) (} "}"))) (if_statement "if (!bVar1) {\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }" (if "if") (parenthesized_expression "(!bVar1)" (( "(") (unary_expression "!bVar1" (! "!") (identifier "bVar1")) () ")")) (compound_statement "{\n        (*(code *)PTR_free_0004f37c)(piVar8);\n        puVar3 = PTR_curr_ifile_0004edb4;\n        *(undefined4 *)(puVar2 + -0x5ec) = 0;\n        set_filestate(*(undefined4 *)puVar3,0);\n        return;\n      }" ({ "{") (expression_statement "(*(code *)PTR_free_0004f37c)(piVar8);" (call_expression "(*(code *)PTR_free_0004f37c)(piVar8)" (parenthesized_expression "(*(code *)PTR_free_0004f37c)" (( "(") (pointer_expression "*(code *)PTR_free_0004f37c" (* "*") (cast_expression "(code *)PTR_free_0004f37c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_free_0004f37c"))) () ")")) (argument_list "(piVar8)" (( "(") (identifier "piVar8") () ")"))) (; ";")) (expression_statement "puVar3 = PTR_curr_ifile_0004edb4;" (assignment_expression "puVar3 = PTR_curr_ifile_0004edb4" (identifier "puVar3") (= "=") (identifier "PTR_curr_ifile_0004edb4")) (; ";")) (expression_statement "*(undefined4 *)(puVar2 + -0x5ec) = 0;" (assignment_expression "*(undefined4 *)(puVar2 + -0x5ec) = 0" (pointer_expression "*(undefined4 *)(puVar2 + -0x5ec)" (* "*") (cast_expression "(undefined4 *)(puVar2 + -0x5ec)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(puVar2 + -0x5ec)" (( "(") (binary_expression "puVar2 + -0x5ec" (identifier "puVar2") (+ "+") (number_literal "-0x5ec")) () ")")))) (= "=") (number_literal "0")) (; ";")) (expression_statement "set_filestate(*(undefined4 *)puVar3,0);" (call_expression "set_filestate(*(undefined4 *)puVar3,0)" (identifier "set_filestate") (argument_list "(*(undefined4 *)puVar3,0)" (( "(") (pointer_expression "*(undefined4 *)puVar3" (* "*") (cast_expression "(undefined4 *)puVar3" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "puVar3"))) (, ",") (number_literal "0") () ")"))) (; ";")) (return_statement "return;" (return "return") (; ";")) (} "}"))) (expression_statement "piVar8[0x1004] = -1;" (assignment_expression "piVar8[0x1004] = -1" (subscript_expression "piVar8[0x1004]" (identifier "piVar8") ([ "[") (number_literal "0x1004") (] "]")) (= "=") (number_literal "-1")) (; ";")) (} "}"))) (} "}"))) (return_statement "return;" (return "return") (; ";")) (} "}")))

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void function_1(void)

{
  bool bVar1;
  type_1 *var_6;
  type_1 *puVar3;
  int *var_4;
  int *piVar5;
  type_2 var_3;
  int var_5;
  int *var_2;
  
  var_6 = var_1;
  var_2 = *(int **)(var_1 + -0x5ec);
  if (var_2 != (int *)0x0) {
    var_3 = var_2[0x1005];
    bVar1 = true;
    if ((var_3 & 0xd) != 0) {
      var_4 = (int *)*var_2;
      if (var_4 != var_2) {
        do {
          puVar3 = PTR_free_0004f37c;
          var_5 = *var_4;
          piVar5 = (int *)var_4[1];
          *(int **)(var_5 + 4) = piVar5;
          *piVar5 = var_5;
          (*(type_3 *)puVar3)(var_4);
          var_4 = (int *)*var_2;
        } while (var_4 != var_2);
        var_3 = var_2[0x1005];
      }
      var_4 = var_2 + 4;
      var_2[0x1008] = 0;
      do {
        var_4[2] = (int)var_4;
        var_4[3] = (int)var_4;
        var_4 = var_4 + 4;
        bVar1 = false;
      } while (var_4 != var_2 + 0x1004);
    }
    if ((var_3 & 2) == 0) {
      if ((var_3 & 0xc) == 0) {
        (*(type_3 *)PTR_close_0004f27c)(var_2[0x1004]);
        var_2 = *(int **)(var_6 + -0x5ec);
      }
      if (!bVar1) {
        (*(type_3 *)PTR_free_0004f37c)(var_2);
        puVar3 = PTR_curr_ifile_0004edb4;
        *(type_4 *)(var_6 + -0x5ec) = 0;
        var_7(*(void **)puVar3,(void *)0x0);
        return;
      }
      var_2[0x1004] = -1;
    }
  }
  return;
}


(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: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator declarator: (abstract_pointer_declarator))) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (number_literal)))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (subscript_expression argument: (identifier) index: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (true))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (pointer_expression argument: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (compound_statement (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (subscript_expression argument: (identifier) index: (number_literal))))) (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator declarator: (abstract_pointer_declarator))) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) right: (identifier))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (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: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (pointer_expression argument: (identifier)))))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (subscript_expression argument: (identifier) index: (number_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (number_literal))) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (false)))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) right: (number_literal))) consequence: (compound_statement (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) 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 (subscript_expression argument: (identifier) index: (number_literal))))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator declarator: (abstract_pointer_declarator))) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))))) (if_statement condition: (parenthesized_expression (unary_expression argument: (identifier))) 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 (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) right: (number_literal))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (identifier))) (number_literal)))) (return_statement))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (number_literal))))))) (return_statement))))

void MASKED(void)

{
  bool bVar1;
  undefined *puVar2;
  undefined *puVar3;
  int *piVar4;
  int *piVar5;
  uint uVar6;
  int iVar7;
  int *piVar8;
  
  puVar2 = PTR_DAT_0004ebf8;
  piVar8 = *(int **)(PTR_DAT_0004ebf8 + -0x5ec);
  if (piVar8 != (int *)0x0) {
    uVar6 = piVar8[0x1005];
    bVar1 = true;
    if ((uVar6 & 0xd) != 0) {
      piVar4 = (int *)*piVar8;
      if (piVar4 != piVar8) {
        do {
          puVar3 = PTR_free_0004f37c;
          iVar7 = *piVar4;
          piVar5 = (int *)piVar4[1];
          *(int **)(iVar7 + 4) = piVar5;
          *piVar5 = iVar7;
          (*(code *)puVar3)(piVar4);
          piVar4 = (int *)*piVar8;
        } while (piVar4 != piVar8);
        uVar6 = piVar8[0x1005];
      }
      piVar4 = piVar8 + 4;
      piVar8[0x1008] = 0;
      do {
        piVar4[2] = (int)piVar4;
        piVar4[3] = (int)piVar4;
        piVar4 = piVar4 + 4;
        bVar1 = false;
      } while (piVar4 != piVar8 + 0x1004);
    }
    if ((uVar6 & 2) == 0) {
      if ((uVar6 & 0xc) == 0) {
        (*(code *)PTR_close_0004f27c)(piVar8[0x1004]);
        piVar8 = *(int **)(puVar2 + -0x5ec);
      }
      if (!bVar1) {
        (*(code *)PTR_free_0004f37c)(piVar8);
        puVar3 = PTR_curr_ifile_0004edb4;
        *(undefined4 *)(puVar2 + -0x5ec) = 0;
        set_filestate(*(undefined4 *)puVar3,0);
        return;
      }
      piVar8[0x1004] = -1;
    }
  }
  return;
}

