
char * fd_read_hunk(int fd,hunk_terminator_t terminator,long sizehint,long maxsize)

{
  char *pcVar1;
  int iVar2;
  char *pcVar3;
  int iVar4;
  char *p;
  undefined4 *puVar5;
  int iVar6;
  int iVar7;
  size_t sVar8;
  
  iVar7 = 0;
  pcVar1 = (char *)xmalloc(sizehint);
  iVar6 = sizehint + -1;
  p = pcVar1;
  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7), -1 < iVar2) {
    pcVar3 = (*terminator)(p,pcVar1,iVar2);
    if (pcVar3 != (char *)0x0) {
      iVar2 = (int)pcVar3 - (int)pcVar1;
      if (iVar2 == 0) {
        *pcVar1 = '\0';
        return p;
      }
      if (sizehint <= iVar7 + iVar2) {
        sizehint = iVar7 + iVar2 + 1;
        p = (char *)xrealloc(p,sizehint);
        pcVar1 = p + iVar7;
      }
    }
    iVar4 = (*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2);
    if (iVar4 < 0) break;
    iVar7 = iVar7 + iVar4;
    pcVar1 = p + iVar7;
    *pcVar1 = '\0';
    if (iVar4 == 0) {
      if (iVar7 == 0) {
        (*(code *)PTR_free_000afd08)(p);
        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();
        *puVar5 = 0;
        return (char *)0x0;
      }
      return p;
    }
    iVar6 = sizehint - 1;
    if ((pcVar3 != (char *)0x0) && (iVar2 == iVar4)) {
      return p;
    }
    if (iVar6 == iVar7) {
      if (maxsize == 0) {
        sizehint = sizehint << 1;
      }
      else {
        sVar8 = sizehint << 1;
        if (maxsize <= sizehint) {
          (*(code *)PTR_free_000afd08)(p);
          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();
          *puVar5 = 0xc;
          return (char *)0x0;
        }
        sizehint = sVar8;
        if (maxsize < (int)sVar8) {
          sizehint = maxsize;
        }
      }
      p = (char *)xrealloc(p,sizehint);
      iVar6 = sizehint - 1;
      pcVar1 = p + iVar7;
    }
  }
  (*(code *)PTR_free_000afd08)(p);
  return (char *)0x0;
}



undefined1 * fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)

{
  undefined1 *puVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  undefined1 *puVar5;
  undefined4 *puVar6;
  int iVar7;
  int iVar8;
  
  iVar8 = 0;
  puVar1 = (undefined1 *)xmalloc(param_3);
  iVar7 = param_3 + -1;
  puVar5 = puVar1;
  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {
    iVar3 = (*param_2)(puVar5,puVar1,iVar2);
    if (iVar3 != 0) {
      iVar2 = iVar3 - (int)puVar1;
      if (iVar2 == 0) {
        *puVar1 = 0;
        return puVar5;
      }
      if (param_3 <= iVar8 + iVar2) {
        param_3 = iVar8 + iVar2 + 1;
        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);
        puVar1 = puVar5 + iVar8;
      }
    }
    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);
    if (iVar4 < 0) break;
    iVar8 = iVar8 + iVar4;
    puVar1 = puVar5 + iVar8;
    *puVar1 = 0;
    if (iVar4 == 0) {
      if (iVar8 == 0) {
        (*(code *)PTR_free_000afd08)(puVar5);
        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();
        *puVar6 = 0;
        return (undefined1 *)0x0;
      }
      return puVar5;
    }
    iVar7 = param_3 + -1;
    if ((iVar3 != 0) && (iVar2 == iVar4)) {
      return puVar5;
    }
    if (iVar7 == iVar8) {
      if (param_4 == 0) {
        param_3 = param_3 << 1;
      }
      else {
        iVar7 = param_3 << 1;
        if (param_4 <= param_3) {
          (*(code *)PTR_free_000afd08)(puVar5);
          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();
          *puVar6 = 0xc;
          return (undefined1 *)0x0;
        }
        param_3 = iVar7;
        if (param_4 < iVar7) {
          param_3 = param_4;
        }
      }
      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);
      iVar7 = param_3 + -1;
      puVar1 = puVar5 + iVar8;
    }
  }
  (*(code *)PTR_free_000afd08)(puVar5);
  return (undefined1 *)0x0;
}


lui gp,0x7
addiu gp,gp,-0x45b4
addu gp,gp,t9
addiu sp,sp,-0x58
lw t9,-0x7e6c(gp)
sdc1 f22,0x50(sp)
mtc1 zero,f22
sw gp,0x18(sp)
sdc1 f20,0x48(sp)
sw s7,0x3c(sp)
or s7,a3,zero
sw s5,0x34(sp)
or s5,a0,zero
sw s4,0x30(sp)
or a0,a2,zero
sw s3,0x2c(sp)
or s3,a2,zero
sw s2,0x28(sp)
sw s1,0x24(sp)
mthc1 zero,f22
or s1,zero,zero
sw ra,0x44(sp)
sw s8,0x40(sp)
sw s6,0x38(sp)
sw s0,0x20(sp)
bal 0x0006b280
_sw a1,0x5c(sp)
addiu a2,s3,-0x1
lw gp,0x18(sp)
or s4,v0,zero
or s2,s4,zero
lw v0,-0x7fc8(gp)
ldc1 f20,0x40b8(v0)
lw t9,-0x7af4(gp)
subu a2,a2,s1
sdc1 f20,0x10(sp)
or a1,s2,zero
jalr t9
_or a0,s5,zero
or s8,s2,zero
lw gp,0x18(sp)
bltz v0,0x0004bbdc
_or s0,v0,zero
lw t9,0x5c(sp)
or a2,v0,zero
or a1,s2,zero
jalr t9
_or a0,s4,zero
lw gp,0x18(sp)
beq v0,zero,0x0004bac8
_or s6,v0,zero
subu s0,v0,s2
beq s0,zero,0x0004bc28
_addu v0,s1,s0
slt a0,v0,s3
beq a0,zero,0x0004bb4c
_lw t9,-0x7c18(gp)
lw t9,-0x7bf4(gp)
or a2,s0,zero
sdc1 f22,0x10(sp)
or a1,s8,zero
jalr t9
_or a0,s5,zero
bltz v0,0x0004bbdc
_lw gp,0x18(sp)
addu s1,s1,v0
addu s2,s4,s1
beq v0,zero,0x0004bb74
_sb zero,0x0(s2)
beq s6,zero,0x0004bb08
_addiu a2,s3,-0x1
beq s0,v0,0x0004bba4
_lw ra,0x44(sp)
bne a2,s1,0x0004ba6c
_lw t9,-0x7af4(gp)
beq s7,zero,0x0004bb6c
_slt v0,s3,s7
beq v0,zero,0x0004bc68
_sll s3,s3,0x1
slt v0,s7,s3
movn s3,s7,v0
or a0,s4,zero
lw t9,-0x7c18(gp)
bal 0x0006b33c
_or a1,s3,zero
addiu a2,s3,-0x1
lw gp,0x18(sp)
or s4,v0,zero
b 0x0004ba68
_addu s2,v0,s1
addiu s3,v0,0x1
or a0,s4,zero
bal 0x0006b33c
_or a1,s3,zero
lw gp,0x18(sp)
or s4,v0,zero
b 0x0004bac8
_addu s8,v0,s1
b 0x0004bb28
_sll s3,s3,0x1
bne s1,zero,0x0004bba4
_lw ra,0x44(sp)
lw t9,-0x7728(gp)
or a0,s4,zero
jalr t9
_or s4,zero,zero
lw gp,0x18(sp)
lw t9,-0x75a0(gp)
jalr t9
_nop
sw zero,0x0(v0)
lw ra,0x44(sp)
or v0,s4,zero
lw s8,0x40(sp)
lw s7,0x3c(sp)
lw s6,0x38(sp)
lw s5,0x34(sp)
lw s4,0x30(sp)
lw s3,0x2c(sp)
lw s2,0x28(sp)
lw s1,0x24(sp)
lw s0,0x20(sp)
ldc1 f22,0x50(sp)
ldc1 f20,0x48(sp)
jr ra
_addiu sp,sp,0x58
lw t9,-0x7728(gp)
or a0,s4,zero
jalr t9
_or s4,zero,zero
or v0,s4,zero
lw ra,0x44(sp)
lw s8,0x40(sp)
lw s7,0x3c(sp)
lw s6,0x38(sp)
lw s5,0x34(sp)
lw s4,0x30(sp)
lw s3,0x2c(sp)
lw s2,0x28(sp)
lw s1,0x24(sp)
lw s0,0x20(sp)
ldc1 f22,0x50(sp)
ldc1 f20,0x48(sp)
jr ra
_addiu sp,sp,0x58
sb zero,0x0(s2)
or v0,s4,zero
lw ra,0x44(sp)
lw s8,0x40(sp)
lw s7,0x3c(sp)
lw s6,0x38(sp)
lw s5,0x34(sp)
lw s4,0x30(sp)
lw s3,0x2c(sp)
lw s2,0x28(sp)
lw s1,0x24(sp)
lw s0,0x20(sp)
ldc1 f22,0x50(sp)
ldc1 f20,0x48(sp)
jr ra
_addiu sp,sp,0x58
lw t9,-0x7728(gp)
or a0,s4,zero
jalr t9
_or s4,zero,zero
lw gp,0x18(sp)
lw t9,-0x75a0(gp)
jalr t9
_nop
li v1,0xc
b 0x0004bba0
_sw v1,0x0(v0)
(translation_unit "undefined1 * fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)\n\n{\n  undefined1 *puVar1;\n  int iVar2;\n  int iVar3;\n  int iVar4;\n  undefined1 *puVar5;\n  undefined4 *puVar6;\n  int iVar7;\n  int iVar8;\n  \n  iVar8 = 0;\n  puVar1 = (undefined1 *)xmalloc(param_3);\n  iVar7 = param_3 + -1;\n  puVar5 = puVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(puVar5);\n  return (undefined1 *)0x0;\n}\n\n" (function_definition "undefined1 * fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)\n\n{\n  undefined1 *puVar1;\n  int iVar2;\n  int iVar3;\n  int iVar4;\n  undefined1 *puVar5;\n  undefined4 *puVar6;\n  int iVar7;\n  int iVar8;\n  \n  iVar8 = 0;\n  puVar1 = (undefined1 *)xmalloc(param_3);\n  iVar7 = param_3 + -1;\n  puVar5 = puVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(puVar5);\n  return (undefined1 *)0x0;\n}" type_identifier (pointer_declarator "* fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)" * (function_declarator "fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)" identifier (parameter_list "(undefined4 param_1,code *param_2,int param_3,int param_4)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "code *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "int param_3" primitive_type identifier) , (parameter_declaration "int param_4" primitive_type identifier) )))) (compound_statement "{\n  undefined1 *puVar1;\n  int iVar2;\n  int iVar3;\n  int iVar4;\n  undefined1 *puVar5;\n  undefined4 *puVar6;\n  int iVar7;\n  int iVar8;\n  \n  iVar8 = 0;\n  puVar1 = (undefined1 *)xmalloc(param_3);\n  iVar7 = param_3 + -1;\n  puVar5 = puVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(puVar5);\n  return (undefined1 *)0x0;\n}" { (declaration "undefined1 *puVar1;" type_identifier (pointer_declarator "*puVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "undefined1 *puVar5;" type_identifier (pointer_declarator "*puVar5" * identifier) ;) (declaration "undefined4 *puVar6;" type_identifier (pointer_declarator "*puVar6" * identifier) ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "int iVar8;" primitive_type identifier ;) (expression_statement "iVar8 = 0;" (assignment_expression "iVar8 = 0" identifier = number_literal) ;) (expression_statement "puVar1 = (undefined1 *)xmalloc(param_3);" (assignment_expression "puVar1 = (undefined1 *)xmalloc(param_3)" identifier = (cast_expression "(undefined1 *)xmalloc(param_3)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "xmalloc(param_3)" identifier (argument_list "(param_3)" ( identifier ))))) ;) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" identifier = (binary_expression "param_3 + -1" identifier + number_literal)) ;) (expression_statement "puVar5 = puVar1;" (assignment_expression "puVar5 = puVar1" identifier = identifier) ;) (while_statement "while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }" while (parenthesized_expression "(iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2)" ( (comma_expression "iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2" (assignment_expression "iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8)" identifier = (call_expression "(*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8)" (parenthesized_expression "(*(code *)PTR_fd_peek_000af93c)" ( (pointer_expression "*(code *)PTR_fd_peek_000af93c" * (cast_expression "(code *)PTR_fd_peek_000af93c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_1,puVar1,iVar7 - iVar8)" ( identifier , identifier , (binary_expression "iVar7 - iVar8" identifier - identifier) )))) , (binary_expression "-1 < iVar2" number_literal < identifier)) )) (compound_statement "{\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }" { (expression_statement "iVar3 = (*param_2)(puVar5,puVar1,iVar2);" (assignment_expression "iVar3 = (*param_2)(puVar5,puVar1,iVar2)" identifier = (call_expression "(*param_2)(puVar5,puVar1,iVar2)" (parenthesized_expression "(*param_2)" ( (pointer_expression "*param_2" * identifier) )) (argument_list "(puVar5,puVar1,iVar2)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }" { (expression_statement "iVar2 = iVar3 - (int)puVar1;" (assignment_expression "iVar2 = iVar3 - (int)puVar1" identifier = (binary_expression "iVar3 - (int)puVar1" identifier - (cast_expression "(int)puVar1" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (if_statement "if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        *puVar1 = 0;\n        return puVar5;\n      }" { (expression_statement "*puVar1 = 0;" (assignment_expression "*puVar1 = 0" (pointer_expression "*puVar1" * identifier) = number_literal) ;) (return_statement "return puVar5;" return identifier ;) })) (if_statement "if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }" if (parenthesized_expression "(param_3 <= iVar8 + iVar2)" ( (binary_expression "param_3 <= iVar8 + iVar2" identifier <= (binary_expression "iVar8 + iVar2" identifier + identifier)) )) (compound_statement "{\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }" { (expression_statement "param_3 = iVar8 + iVar2 + 1;" (assignment_expression "param_3 = iVar8 + iVar2 + 1" identifier = (binary_expression "iVar8 + iVar2 + 1" (binary_expression "iVar8 + iVar2" identifier + identifier) + number_literal)) ;) (expression_statement "puVar5 = (undefined1 *)xrealloc(puVar5,param_3);" (assignment_expression "puVar5 = (undefined1 *)xrealloc(puVar5,param_3)" identifier = (cast_expression "(undefined1 *)xrealloc(puVar5,param_3)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "xrealloc(puVar5,param_3)" identifier (argument_list "(puVar5,param_3)" ( identifier , identifier ))))) ;) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" identifier = (binary_expression "puVar5 + iVar8" identifier + identifier)) ;) })) })) (expression_statement "iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);" (assignment_expression "iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2)" identifier = (call_expression "(*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2)" (parenthesized_expression "(*(code *)PTR_fd_read_000af83c)" ( (pointer_expression "*(code *)PTR_fd_read_000af83c" * (cast_expression "(code *)PTR_fd_read_000af83c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_1,puVar1,iVar2)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar4 < 0) break;" if (parenthesized_expression "(iVar4 < 0)" ( (binary_expression "iVar4 < 0" identifier < number_literal) )) (break_statement "break;" break ;)) (expression_statement "iVar8 = iVar8 + iVar4;" (assignment_expression "iVar8 = iVar8 + iVar4" identifier = (binary_expression "iVar8 + iVar4" identifier + identifier)) ;) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" identifier = (binary_expression "puVar5 + iVar8" identifier + identifier)) ;) (expression_statement "*puVar1 = 0;" (assignment_expression "*puVar1 = 0" (pointer_expression "*puVar1" * identifier) = number_literal) ;) (if_statement "if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }" if (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) )) (compound_statement "{\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }" { (if_statement "if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }" if (parenthesized_expression "(iVar8 == 0)" ( (binary_expression "iVar8 == 0" identifier == number_literal) )) (compound_statement "{\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }" { (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(puVar5)" ( identifier ))) ;) (expression_statement "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();" (assignment_expression "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000afe90)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000afe90)()" (parenthesized_expression "(*(code *)PTR___errno_location_000afe90)" ( (pointer_expression "*(code *)PTR___errno_location_000afe90" * (cast_expression "(code *)PTR___errno_location_000afe90" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "*puVar6 = 0;" (assignment_expression "*puVar6 = 0" (pointer_expression "*puVar6" * identifier) = number_literal) ;) (return_statement "return (undefined1 *)0x0;" return (cast_expression "(undefined1 *)0x0" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (return_statement "return puVar5;" return identifier ;) })) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" identifier = (binary_expression "param_3 + -1" identifier + number_literal)) ;) (if_statement "if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }" if (parenthesized_expression "((iVar3 != 0) && (iVar2 == iVar4))" ( (binary_expression "(iVar3 != 0) && (iVar2 == iVar4)" (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) && (parenthesized_expression "(iVar2 == iVar4)" ( (binary_expression "iVar2 == iVar4" identifier == identifier) ))) )) (compound_statement "{\n      return puVar5;\n    }" { (return_statement "return puVar5;" return identifier ;) })) (if_statement "if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }" if (parenthesized_expression "(iVar7 == iVar8)" ( (binary_expression "iVar7 == iVar8" identifier == identifier) )) (compound_statement "{\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }" { (if_statement "if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" if (parenthesized_expression "(param_4 == 0)" ( (binary_expression "param_4 == 0" identifier == number_literal) )) (compound_statement "{\n        param_3 = param_3 << 1;\n      }" { (expression_statement "param_3 = param_3 << 1;" (assignment_expression "param_3 = param_3 << 1" identifier = (binary_expression "param_3 << 1" identifier << number_literal)) ;) }) (else_clause "else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" else (compound_statement "{\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" { (expression_statement "iVar7 = param_3 << 1;" (assignment_expression "iVar7 = param_3 << 1" identifier = (binary_expression "param_3 << 1" identifier << number_literal)) ;) (if_statement "if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }" if (parenthesized_expression "(param_4 <= param_3)" ( (binary_expression "param_4 <= param_3" identifier <= identifier) )) (compound_statement "{\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }" { (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(puVar5)" ( identifier ))) ;) (expression_statement "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();" (assignment_expression "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000afe90)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000afe90)()" (parenthesized_expression "(*(code *)PTR___errno_location_000afe90)" ( (pointer_expression "*(code *)PTR___errno_location_000afe90" * (cast_expression "(code *)PTR___errno_location_000afe90" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "*puVar6 = 0xc;" (assignment_expression "*puVar6 = 0xc" (pointer_expression "*puVar6" * identifier) = number_literal) ;) (return_statement "return (undefined1 *)0x0;" return (cast_expression "(undefined1 *)0x0" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "param_3 = iVar7;" (assignment_expression "param_3 = iVar7" identifier = identifier) ;) (if_statement "if (param_4 < iVar7) {\n          param_3 = param_4;\n        }" if (parenthesized_expression "(param_4 < iVar7)" ( (binary_expression "param_4 < iVar7" identifier < identifier) )) (compound_statement "{\n          param_3 = param_4;\n        }" { (expression_statement "param_3 = param_4;" (assignment_expression "param_3 = param_4" identifier = identifier) ;) })) }))) (expression_statement "puVar5 = (undefined1 *)xrealloc(puVar5,param_3);" (assignment_expression "puVar5 = (undefined1 *)xrealloc(puVar5,param_3)" identifier = (cast_expression "(undefined1 *)xrealloc(puVar5,param_3)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "xrealloc(puVar5,param_3)" identifier (argument_list "(puVar5,param_3)" ( identifier , identifier ))))) ;) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" identifier = (binary_expression "param_3 + -1" identifier + number_literal)) ;) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" identifier = (binary_expression "puVar5 + iVar8" identifier + identifier)) ;) })) })) (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(puVar5)" ( identifier ))) ;) (return_statement "return (undefined1 *)0x0;" return (cast_expression "(undefined1 *)0x0" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit "char * fd_read_hunk(int fd,hunk_terminator_t terminator,long sizehint,long maxsize)\n\n{\n  char *pcVar1;\n  int iVar2;\n  char *pcVar3;\n  int iVar4;\n  char *p;\n  undefined4 *puVar5;\n  int iVar6;\n  int iVar7;\n  size_t sVar8;\n  \n  iVar7 = 0;\n  pcVar1 = (char *)xmalloc(sizehint);\n  iVar6 = sizehint + -1;\n  p = pcVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7), -1 < iVar2) {\n    pcVar3 = (*terminator)(p,pcVar1,iVar2);\n    if (pcVar3 != (char *)0x0) {\n      iVar2 = (int)pcVar3 - (int)pcVar1;\n      if (iVar2 == 0) {\n        *pcVar1 = '\0';\n        return p;\n      }\n      if (sizehint <= iVar7 + iVar2) {\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar7 = iVar7 + iVar4;\n    pcVar1 = p + iVar7;\n    *pcVar1 = '\0';\n    if (iVar4 == 0) {\n      if (iVar7 == 0) {\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }\n      return p;\n    }\n    iVar6 = sizehint - 1;\n    if ((pcVar3 != (char *)0x0) && (iVar2 == iVar4)) {\n      return p;\n    }\n    if (iVar6 == iVar7) {\n      if (maxsize == 0) {\n        sizehint = sizehint << 1;\n      }\n      else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }\n      p = (char *)xrealloc(p,sizehint);\n      iVar6 = sizehint - 1;\n      pcVar1 = p + iVar7;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(p);\n  return (char *)0x0;\n}\n\n" (function_definition "char * fd_read_hunk(int fd,hunk_terminator_t terminator,long sizehint,long maxsize)\n\n{\n  char *pcVar1;\n  int iVar2;\n  char *pcVar3;\n  int iVar4;\n  char *p;\n  undefined4 *puVar5;\n  int iVar6;\n  int iVar7;\n  size_t sVar8;\n  \n  iVar7 = 0;\n  pcVar1 = (char *)xmalloc(sizehint);\n  iVar6 = sizehint + -1;\n  p = pcVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7), -1 < iVar2) {\n    pcVar3 = (*terminator)(p,pcVar1,iVar2);\n    if (pcVar3 != (char *)0x0) {\n      iVar2 = (int)pcVar3 - (int)pcVar1;\n      if (iVar2 == 0) {\n        *pcVar1 = '\0';\n        return p;\n      }\n      if (sizehint <= iVar7 + iVar2) {\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar7 = iVar7 + iVar4;\n    pcVar1 = p + iVar7;\n    *pcVar1 = '\0';\n    if (iVar4 == 0) {\n      if (iVar7 == 0) {\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }\n      return p;\n    }\n    iVar6 = sizehint - 1;\n    if ((pcVar3 != (char *)0x0) && (iVar2 == iVar4)) {\n      return p;\n    }\n    if (iVar6 == iVar7) {\n      if (maxsize == 0) {\n        sizehint = sizehint << 1;\n      }\n      else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }\n      p = (char *)xrealloc(p,sizehint);\n      iVar6 = sizehint - 1;\n      pcVar1 = p + iVar7;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(p);\n  return (char *)0x0;\n}" primitive_type (pointer_declarator "* fd_read_hunk(int fd,hunk_terminator_t terminator,long sizehint,long maxsize)" * (function_declarator "fd_read_hunk(int fd,hunk_terminator_t terminator,long sizehint,long maxsize)" identifier (parameter_list "(int fd,hunk_terminator_t terminator,long sizehint,long maxsize)" ( (parameter_declaration "int fd" primitive_type identifier) , (parameter_declaration "hunk_terminator_t terminator" type_identifier identifier) , (parameter_declaration "long sizehint" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long maxsize" (sized_type_specifier "long" long) identifier) )))) (compound_statement "{\n  char *pcVar1;\n  int iVar2;\n  char *pcVar3;\n  int iVar4;\n  char *p;\n  undefined4 *puVar5;\n  int iVar6;\n  int iVar7;\n  size_t sVar8;\n  \n  iVar7 = 0;\n  pcVar1 = (char *)xmalloc(sizehint);\n  iVar6 = sizehint + -1;\n  p = pcVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7), -1 < iVar2) {\n    pcVar3 = (*terminator)(p,pcVar1,iVar2);\n    if (pcVar3 != (char *)0x0) {\n      iVar2 = (int)pcVar3 - (int)pcVar1;\n      if (iVar2 == 0) {\n        *pcVar1 = '\0';\n        return p;\n      }\n      if (sizehint <= iVar7 + iVar2) {\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar7 = iVar7 + iVar4;\n    pcVar1 = p + iVar7;\n    *pcVar1 = '\0';\n    if (iVar4 == 0) {\n      if (iVar7 == 0) {\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }\n      return p;\n    }\n    iVar6 = sizehint - 1;\n    if ((pcVar3 != (char *)0x0) && (iVar2 == iVar4)) {\n      return p;\n    }\n    if (iVar6 == iVar7) {\n      if (maxsize == 0) {\n        sizehint = sizehint << 1;\n      }\n      else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }\n      p = (char *)xrealloc(p,sizehint);\n      iVar6 = sizehint - 1;\n      pcVar1 = p + iVar7;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(p);\n  return (char *)0x0;\n}" { (declaration "char *pcVar1;" primitive_type (pointer_declarator "*pcVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "char *pcVar3;" primitive_type (pointer_declarator "*pcVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "char *p;" primitive_type (pointer_declarator "*p" * identifier) ;) (declaration "undefined4 *puVar5;" type_identifier (pointer_declarator "*puVar5" * identifier) ;) (declaration "int iVar6;" primitive_type identifier ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "size_t sVar8;" primitive_type identifier ;) (expression_statement "iVar7 = 0;" (assignment_expression "iVar7 = 0" identifier = number_literal) ;) (expression_statement "pcVar1 = (char *)xmalloc(sizehint);" (assignment_expression "pcVar1 = (char *)xmalloc(sizehint)" identifier = (cast_expression "(char *)xmalloc(sizehint)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "xmalloc(sizehint)" identifier (argument_list "(sizehint)" ( identifier ))))) ;) (expression_statement "iVar6 = sizehint + -1;" (assignment_expression "iVar6 = sizehint + -1" identifier = (binary_expression "sizehint + -1" identifier + number_literal)) ;) (expression_statement "p = pcVar1;" (assignment_expression "p = pcVar1" identifier = identifier) ;) (while_statement "while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7), -1 < iVar2) {\n    pcVar3 = (*terminator)(p,pcVar1,iVar2);\n    if (pcVar3 != (char *)0x0) {\n      iVar2 = (int)pcVar3 - (int)pcVar1;\n      if (iVar2 == 0) {\n        *pcVar1 = '\0';\n        return p;\n      }\n      if (sizehint <= iVar7 + iVar2) {\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar7 = iVar7 + iVar4;\n    pcVar1 = p + iVar7;\n    *pcVar1 = '\0';\n    if (iVar4 == 0) {\n      if (iVar7 == 0) {\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }\n      return p;\n    }\n    iVar6 = sizehint - 1;\n    if ((pcVar3 != (char *)0x0) && (iVar2 == iVar4)) {\n      return p;\n    }\n    if (iVar6 == iVar7) {\n      if (maxsize == 0) {\n        sizehint = sizehint << 1;\n      }\n      else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }\n      p = (char *)xrealloc(p,sizehint);\n      iVar6 = sizehint - 1;\n      pcVar1 = p + iVar7;\n    }\n  }" while (parenthesized_expression "(iVar2 = (*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7), -1 < iVar2)" ( (comma_expression "iVar2 = (*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7), -1 < iVar2" (assignment_expression "iVar2 = (*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7)" identifier = (call_expression "(*(code *)PTR_fd_peek_000af93c)(fd,pcVar1,iVar6 - iVar7)" (parenthesized_expression "(*(code *)PTR_fd_peek_000af93c)" ( (pointer_expression "*(code *)PTR_fd_peek_000af93c" * (cast_expression "(code *)PTR_fd_peek_000af93c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(fd,pcVar1,iVar6 - iVar7)" ( identifier , identifier , (binary_expression "iVar6 - iVar7" identifier - identifier) )))) , (binary_expression "-1 < iVar2" number_literal < identifier)) )) (compound_statement "{\n    pcVar3 = (*terminator)(p,pcVar1,iVar2);\n    if (pcVar3 != (char *)0x0) {\n      iVar2 = (int)pcVar3 - (int)pcVar1;\n      if (iVar2 == 0) {\n        *pcVar1 = '\0';\n        return p;\n      }\n      if (sizehint <= iVar7 + iVar2) {\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar7 = iVar7 + iVar4;\n    pcVar1 = p + iVar7;\n    *pcVar1 = '\0';\n    if (iVar4 == 0) {\n      if (iVar7 == 0) {\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }\n      return p;\n    }\n    iVar6 = sizehint - 1;\n    if ((pcVar3 != (char *)0x0) && (iVar2 == iVar4)) {\n      return p;\n    }\n    if (iVar6 == iVar7) {\n      if (maxsize == 0) {\n        sizehint = sizehint << 1;\n      }\n      else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }\n      p = (char *)xrealloc(p,sizehint);\n      iVar6 = sizehint - 1;\n      pcVar1 = p + iVar7;\n    }\n  }" { (expression_statement "pcVar3 = (*terminator)(p,pcVar1,iVar2);" (assignment_expression "pcVar3 = (*terminator)(p,pcVar1,iVar2)" identifier = (call_expression "(*terminator)(p,pcVar1,iVar2)" (parenthesized_expression "(*terminator)" ( (pointer_expression "*terminator" * identifier) )) (argument_list "(p,pcVar1,iVar2)" ( identifier , identifier , identifier )))) ;) (if_statement "if (pcVar3 != (char *)0x0) {\n      iVar2 = (int)pcVar3 - (int)pcVar1;\n      if (iVar2 == 0) {\n        *pcVar1 = '\0';\n        return p;\n      }\n      if (sizehint <= iVar7 + iVar2) {\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }\n    }" if (parenthesized_expression "(pcVar3 != (char *)0x0)" ( (binary_expression "pcVar3 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      iVar2 = (int)pcVar3 - (int)pcVar1;\n      if (iVar2 == 0) {\n        *pcVar1 = '\0';\n        return p;\n      }\n      if (sizehint <= iVar7 + iVar2) {\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }\n    }" { (expression_statement "iVar2 = (int)pcVar3 - (int)pcVar1;" (assignment_expression "iVar2 = (int)pcVar3 - (int)pcVar1" identifier = (binary_expression "(int)pcVar3 - (int)pcVar1" (cast_expression "(int)pcVar3" ( (type_descriptor "int" primitive_type) ) identifier) - (cast_expression "(int)pcVar1" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (if_statement "if (iVar2 == 0) {\n        *pcVar1 = '\0';\n        return p;\n      }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        *pcVar1 = '\0';\n        return p;\n      }" { (expression_statement "*pcVar1 = '\0';" (assignment_expression "*pcVar1 = '\0'" (pointer_expression "*pcVar1" * identifier) = (char_literal "'\0'" ' escape_sequence ')) ;) (return_statement "return p;" return identifier ;) })) (if_statement "if (sizehint <= iVar7 + iVar2) {\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }" if (parenthesized_expression "(sizehint <= iVar7 + iVar2)" ( (binary_expression "sizehint <= iVar7 + iVar2" identifier <= (binary_expression "iVar7 + iVar2" identifier + identifier)) )) (compound_statement "{\n        sizehint = iVar7 + iVar2 + 1;\n        p = (char *)xrealloc(p,sizehint);\n        pcVar1 = p + iVar7;\n      }" { (expression_statement "sizehint = iVar7 + iVar2 + 1;" (assignment_expression "sizehint = iVar7 + iVar2 + 1" identifier = (binary_expression "iVar7 + iVar2 + 1" (binary_expression "iVar7 + iVar2" identifier + identifier) + number_literal)) ;) (expression_statement "p = (char *)xrealloc(p,sizehint);" (assignment_expression "p = (char *)xrealloc(p,sizehint)" identifier = (cast_expression "(char *)xrealloc(p,sizehint)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "xrealloc(p,sizehint)" identifier (argument_list "(p,sizehint)" ( identifier , identifier ))))) ;) (expression_statement "pcVar1 = p + iVar7;" (assignment_expression "pcVar1 = p + iVar7" identifier = (binary_expression "p + iVar7" identifier + identifier)) ;) })) })) (expression_statement "iVar4 = (*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2);" (assignment_expression "iVar4 = (*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2)" identifier = (call_expression "(*(code *)PTR_fd_read_000af83c)(fd,pcVar1,iVar2)" (parenthesized_expression "(*(code *)PTR_fd_read_000af83c)" ( (pointer_expression "*(code *)PTR_fd_read_000af83c" * (cast_expression "(code *)PTR_fd_read_000af83c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(fd,pcVar1,iVar2)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar4 < 0) break;" if (parenthesized_expression "(iVar4 < 0)" ( (binary_expression "iVar4 < 0" identifier < number_literal) )) (break_statement "break;" break ;)) (expression_statement "iVar7 = iVar7 + iVar4;" (assignment_expression "iVar7 = iVar7 + iVar4" identifier = (binary_expression "iVar7 + iVar4" identifier + identifier)) ;) (expression_statement "pcVar1 = p + iVar7;" (assignment_expression "pcVar1 = p + iVar7" identifier = (binary_expression "p + iVar7" identifier + identifier)) ;) (expression_statement "*pcVar1 = '\0';" (assignment_expression "*pcVar1 = '\0'" (pointer_expression "*pcVar1" * identifier) = (char_literal "'\0'" ' escape_sequence ')) ;) (if_statement "if (iVar4 == 0) {\n      if (iVar7 == 0) {\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }\n      return p;\n    }" if (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) )) (compound_statement "{\n      if (iVar7 == 0) {\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }\n      return p;\n    }" { (if_statement "if (iVar7 == 0) {\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }" if (parenthesized_expression "(iVar7 == 0)" ( (binary_expression "iVar7 == 0" identifier == number_literal) )) (compound_statement "{\n        (*(code *)PTR_free_000afd08)(p);\n        puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar5 = 0;\n        return (char *)0x0;\n      }" { (expression_statement "(*(code *)PTR_free_000afd08)(p);" (call_expression "(*(code *)PTR_free_000afd08)(p)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(p)" ( identifier ))) ;) (expression_statement "puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();" (assignment_expression "puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000afe90)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000afe90)()" (parenthesized_expression "(*(code *)PTR___errno_location_000afe90)" ( (pointer_expression "*(code *)PTR___errno_location_000afe90" * (cast_expression "(code *)PTR___errno_location_000afe90" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "*puVar5 = 0;" (assignment_expression "*puVar5 = 0" (pointer_expression "*puVar5" * identifier) = number_literal) ;) (return_statement "return (char *)0x0;" return (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (return_statement "return p;" return identifier ;) })) (expression_statement "iVar6 = sizehint - 1;" (assignment_expression "iVar6 = sizehint - 1" identifier = (binary_expression "sizehint - 1" identifier - number_literal)) ;) (if_statement "if ((pcVar3 != (char *)0x0) && (iVar2 == iVar4)) {\n      return p;\n    }" if (parenthesized_expression "((pcVar3 != (char *)0x0) && (iVar2 == iVar4))" ( (binary_expression "(pcVar3 != (char *)0x0) && (iVar2 == iVar4)" (parenthesized_expression "(pcVar3 != (char *)0x0)" ( (binary_expression "pcVar3 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(iVar2 == iVar4)" ( (binary_expression "iVar2 == iVar4" identifier == identifier) ))) )) (compound_statement "{\n      return p;\n    }" { (return_statement "return p;" return identifier ;) })) (if_statement "if (iVar6 == iVar7) {\n      if (maxsize == 0) {\n        sizehint = sizehint << 1;\n      }\n      else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }\n      p = (char *)xrealloc(p,sizehint);\n      iVar6 = sizehint - 1;\n      pcVar1 = p + iVar7;\n    }" if (parenthesized_expression "(iVar6 == iVar7)" ( (binary_expression "iVar6 == iVar7" identifier == identifier) )) (compound_statement "{\n      if (maxsize == 0) {\n        sizehint = sizehint << 1;\n      }\n      else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }\n      p = (char *)xrealloc(p,sizehint);\n      iVar6 = sizehint - 1;\n      pcVar1 = p + iVar7;\n    }" { (if_statement "if (maxsize == 0) {\n        sizehint = sizehint << 1;\n      }\n      else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }" if (parenthesized_expression "(maxsize == 0)" ( (binary_expression "maxsize == 0" identifier == number_literal) )) (compound_statement "{\n        sizehint = sizehint << 1;\n      }" { (expression_statement "sizehint = sizehint << 1;" (assignment_expression "sizehint = sizehint << 1" identifier = (binary_expression "sizehint << 1" identifier << number_literal)) ;) }) (else_clause "else {\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }" else (compound_statement "{\n        sVar8 = sizehint << 1;\n        if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }\n        sizehint = sVar8;\n        if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }\n      }" { (expression_statement "sVar8 = sizehint << 1;" (assignment_expression "sVar8 = sizehint << 1" identifier = (binary_expression "sizehint << 1" identifier << number_literal)) ;) (if_statement "if (maxsize <= sizehint) {\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }" if (parenthesized_expression "(maxsize <= sizehint)" ( (binary_expression "maxsize <= sizehint" identifier <= identifier) )) (compound_statement "{\n          (*(code *)PTR_free_000afd08)(p);\n          puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar5 = 0xc;\n          return (char *)0x0;\n        }" { (expression_statement "(*(code *)PTR_free_000afd08)(p);" (call_expression "(*(code *)PTR_free_000afd08)(p)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(p)" ( identifier ))) ;) (expression_statement "puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();" (assignment_expression "puVar5 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000afe90)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000afe90)()" (parenthesized_expression "(*(code *)PTR___errno_location_000afe90)" ( (pointer_expression "*(code *)PTR___errno_location_000afe90" * (cast_expression "(code *)PTR___errno_location_000afe90" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "*puVar5 = 0xc;" (assignment_expression "*puVar5 = 0xc" (pointer_expression "*puVar5" * identifier) = number_literal) ;) (return_statement "return (char *)0x0;" return (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "sizehint = sVar8;" (assignment_expression "sizehint = sVar8" identifier = identifier) ;) (if_statement "if (maxsize < (int)sVar8) {\n          sizehint = maxsize;\n        }" if (parenthesized_expression "(maxsize < (int)sVar8)" ( (binary_expression "maxsize < (int)sVar8" identifier < (cast_expression "(int)sVar8" ( (type_descriptor "int" primitive_type) ) identifier)) )) (compound_statement "{\n          sizehint = maxsize;\n        }" { (expression_statement "sizehint = maxsize;" (assignment_expression "sizehint = maxsize" identifier = identifier) ;) })) }))) (expression_statement "p = (char *)xrealloc(p,sizehint);" (assignment_expression "p = (char *)xrealloc(p,sizehint)" identifier = (cast_expression "(char *)xrealloc(p,sizehint)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "xrealloc(p,sizehint)" identifier (argument_list "(p,sizehint)" ( identifier , identifier ))))) ;) (expression_statement "iVar6 = sizehint - 1;" (assignment_expression "iVar6 = sizehint - 1" identifier = (binary_expression "sizehint - 1" identifier - number_literal)) ;) (expression_statement "pcVar1 = p + iVar7;" (assignment_expression "pcVar1 = p + iVar7" identifier = (binary_expression "p + iVar7" identifier + identifier)) ;) })) })) (expression_statement "(*(code *)PTR_free_000afd08)(p);" (call_expression "(*(code *)PTR_free_000afd08)(p)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(p)" ( identifier ))) ;) (return_statement "return (char *)0x0;" return (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit "undefined1 * fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)\n\n{\n  undefined1 *puVar1;\n  int iVar2;\n  int iVar3;\n  int iVar4;\n  undefined1 *puVar5;\n  undefined4 *puVar6;\n  int iVar7;\n  int iVar8;\n  \n  iVar8 = 0;\n  puVar1 = (undefined1 *)xmalloc(param_3);\n  iVar7 = param_3 + -1;\n  puVar5 = puVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(puVar5);\n  return (undefined1 *)0x0;\n}\n\n" (function_definition "undefined1 * fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)\n\n{\n  undefined1 *puVar1;\n  int iVar2;\n  int iVar3;\n  int iVar4;\n  undefined1 *puVar5;\n  undefined4 *puVar6;\n  int iVar7;\n  int iVar8;\n  \n  iVar8 = 0;\n  puVar1 = (undefined1 *)xmalloc(param_3);\n  iVar7 = param_3 + -1;\n  puVar5 = puVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(puVar5);\n  return (undefined1 *)0x0;\n}" type_identifier (pointer_declarator "* fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)" * (function_declarator "fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)" identifier (parameter_list "(undefined4 param_1,code *param_2,int param_3,int param_4)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "code *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "int param_3" primitive_type identifier) , (parameter_declaration "int param_4" primitive_type identifier) )))) (compound_statement "{\n  undefined1 *puVar1;\n  int iVar2;\n  int iVar3;\n  int iVar4;\n  undefined1 *puVar5;\n  undefined4 *puVar6;\n  int iVar7;\n  int iVar8;\n  \n  iVar8 = 0;\n  puVar1 = (undefined1 *)xmalloc(param_3);\n  iVar7 = param_3 + -1;\n  puVar5 = puVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(puVar5);\n  return (undefined1 *)0x0;\n}" { (declaration "undefined1 *puVar1;" type_identifier (pointer_declarator "*puVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "undefined1 *puVar5;" type_identifier (pointer_declarator "*puVar5" * identifier) ;) (declaration "undefined4 *puVar6;" type_identifier (pointer_declarator "*puVar6" * identifier) ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "int iVar8;" primitive_type identifier ;) (expression_statement "iVar8 = 0;" (assignment_expression "iVar8 = 0" identifier = number_literal) ;) (expression_statement "puVar1 = (undefined1 *)xmalloc(param_3);" (assignment_expression "puVar1 = (undefined1 *)xmalloc(param_3)" identifier = (cast_expression "(undefined1 *)xmalloc(param_3)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "xmalloc(param_3)" identifier (argument_list "(param_3)" ( identifier ))))) ;) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" identifier = (binary_expression "param_3 + -1" identifier + number_literal)) ;) (expression_statement "puVar5 = puVar1;" (assignment_expression "puVar5 = puVar1" identifier = identifier) ;) (while_statement "while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }" while (parenthesized_expression "(iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2)" ( (comma_expression "iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2" (assignment_expression "iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8)" identifier = (call_expression "(*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8)" (parenthesized_expression "(*(code *)PTR_fd_peek_000af93c)" ( (pointer_expression "*(code *)PTR_fd_peek_000af93c" * (cast_expression "(code *)PTR_fd_peek_000af93c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_1,puVar1,iVar7 - iVar8)" ( identifier , identifier , (binary_expression "iVar7 - iVar8" identifier - identifier) )))) , (binary_expression "-1 < iVar2" number_literal < identifier)) )) (compound_statement "{\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }" { (expression_statement "iVar3 = (*param_2)(puVar5,puVar1,iVar2);" (assignment_expression "iVar3 = (*param_2)(puVar5,puVar1,iVar2)" identifier = (call_expression "(*param_2)(puVar5,puVar1,iVar2)" (parenthesized_expression "(*param_2)" ( (pointer_expression "*param_2" * identifier) )) (argument_list "(puVar5,puVar1,iVar2)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }" { (expression_statement "iVar2 = iVar3 - (int)puVar1;" (assignment_expression "iVar2 = iVar3 - (int)puVar1" identifier = (binary_expression "iVar3 - (int)puVar1" identifier - (cast_expression "(int)puVar1" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (if_statement "if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        *puVar1 = 0;\n        return puVar5;\n      }" { (expression_statement "*puVar1 = 0;" (assignment_expression "*puVar1 = 0" (pointer_expression "*puVar1" * identifier) = number_literal) ;) (return_statement "return puVar5;" return identifier ;) })) (if_statement "if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }" if (parenthesized_expression "(param_3 <= iVar8 + iVar2)" ( (binary_expression "param_3 <= iVar8 + iVar2" identifier <= (binary_expression "iVar8 + iVar2" identifier + identifier)) )) (compound_statement "{\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }" { (expression_statement "param_3 = iVar8 + iVar2 + 1;" (assignment_expression "param_3 = iVar8 + iVar2 + 1" identifier = (binary_expression "iVar8 + iVar2 + 1" (binary_expression "iVar8 + iVar2" identifier + identifier) + number_literal)) ;) (expression_statement "puVar5 = (undefined1 *)xrealloc(puVar5,param_3);" (assignment_expression "puVar5 = (undefined1 *)xrealloc(puVar5,param_3)" identifier = (cast_expression "(undefined1 *)xrealloc(puVar5,param_3)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "xrealloc(puVar5,param_3)" identifier (argument_list "(puVar5,param_3)" ( identifier , identifier ))))) ;) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" identifier = (binary_expression "puVar5 + iVar8" identifier + identifier)) ;) })) })) (expression_statement "iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);" (assignment_expression "iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2)" identifier = (call_expression "(*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2)" (parenthesized_expression "(*(code *)PTR_fd_read_000af83c)" ( (pointer_expression "*(code *)PTR_fd_read_000af83c" * (cast_expression "(code *)PTR_fd_read_000af83c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(param_1,puVar1,iVar2)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar4 < 0) break;" if (parenthesized_expression "(iVar4 < 0)" ( (binary_expression "iVar4 < 0" identifier < number_literal) )) (break_statement "break;" break ;)) (expression_statement "iVar8 = iVar8 + iVar4;" (assignment_expression "iVar8 = iVar8 + iVar4" identifier = (binary_expression "iVar8 + iVar4" identifier + identifier)) ;) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" identifier = (binary_expression "puVar5 + iVar8" identifier + identifier)) ;) (expression_statement "*puVar1 = 0;" (assignment_expression "*puVar1 = 0" (pointer_expression "*puVar1" * identifier) = number_literal) ;) (if_statement "if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }" if (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) )) (compound_statement "{\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }" { (if_statement "if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }" if (parenthesized_expression "(iVar8 == 0)" ( (binary_expression "iVar8 == 0" identifier == number_literal) )) (compound_statement "{\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }" { (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(puVar5)" ( identifier ))) ;) (expression_statement "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();" (assignment_expression "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000afe90)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000afe90)()" (parenthesized_expression "(*(code *)PTR___errno_location_000afe90)" ( (pointer_expression "*(code *)PTR___errno_location_000afe90" * (cast_expression "(code *)PTR___errno_location_000afe90" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "*puVar6 = 0;" (assignment_expression "*puVar6 = 0" (pointer_expression "*puVar6" * identifier) = number_literal) ;) (return_statement "return (undefined1 *)0x0;" return (cast_expression "(undefined1 *)0x0" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (return_statement "return puVar5;" return identifier ;) })) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" identifier = (binary_expression "param_3 + -1" identifier + number_literal)) ;) (if_statement "if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }" if (parenthesized_expression "((iVar3 != 0) && (iVar2 == iVar4))" ( (binary_expression "(iVar3 != 0) && (iVar2 == iVar4)" (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) && (parenthesized_expression "(iVar2 == iVar4)" ( (binary_expression "iVar2 == iVar4" identifier == identifier) ))) )) (compound_statement "{\n      return puVar5;\n    }" { (return_statement "return puVar5;" return identifier ;) })) (if_statement "if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }" if (parenthesized_expression "(iVar7 == iVar8)" ( (binary_expression "iVar7 == iVar8" identifier == identifier) )) (compound_statement "{\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }" { (if_statement "if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" if (parenthesized_expression "(param_4 == 0)" ( (binary_expression "param_4 == 0" identifier == number_literal) )) (compound_statement "{\n        param_3 = param_3 << 1;\n      }" { (expression_statement "param_3 = param_3 << 1;" (assignment_expression "param_3 = param_3 << 1" identifier = (binary_expression "param_3 << 1" identifier << number_literal)) ;) }) (else_clause "else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" else (compound_statement "{\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" { (expression_statement "iVar7 = param_3 << 1;" (assignment_expression "iVar7 = param_3 << 1" identifier = (binary_expression "param_3 << 1" identifier << number_literal)) ;) (if_statement "if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }" if (parenthesized_expression "(param_4 <= param_3)" ( (binary_expression "param_4 <= param_3" identifier <= identifier) )) (compound_statement "{\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }" { (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(puVar5)" ( identifier ))) ;) (expression_statement "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();" (assignment_expression "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)()" identifier = (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000afe90)()" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(*(code *)PTR___errno_location_000afe90)()" (parenthesized_expression "(*(code *)PTR___errno_location_000afe90)" ( (pointer_expression "*(code *)PTR___errno_location_000afe90" * (cast_expression "(code *)PTR___errno_location_000afe90" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "()" ( ))))) ;) (expression_statement "*puVar6 = 0xc;" (assignment_expression "*puVar6 = 0xc" (pointer_expression "*puVar6" * identifier) = number_literal) ;) (return_statement "return (undefined1 *)0x0;" return (cast_expression "(undefined1 *)0x0" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "param_3 = iVar7;" (assignment_expression "param_3 = iVar7" identifier = identifier) ;) (if_statement "if (param_4 < iVar7) {\n          param_3 = param_4;\n        }" if (parenthesized_expression "(param_4 < iVar7)" ( (binary_expression "param_4 < iVar7" identifier < identifier) )) (compound_statement "{\n          param_3 = param_4;\n        }" { (expression_statement "param_3 = param_4;" (assignment_expression "param_3 = param_4" identifier = identifier) ;) })) }))) (expression_statement "puVar5 = (undefined1 *)xrealloc(puVar5,param_3);" (assignment_expression "puVar5 = (undefined1 *)xrealloc(puVar5,param_3)" identifier = (cast_expression "(undefined1 *)xrealloc(puVar5,param_3)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "xrealloc(puVar5,param_3)" identifier (argument_list "(puVar5,param_3)" ( identifier , identifier ))))) ;) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" identifier = (binary_expression "param_3 + -1" identifier + number_literal)) ;) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" identifier = (binary_expression "puVar5 + iVar8" identifier + identifier)) ;) })) })) (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" ( (pointer_expression "*(code *)PTR_free_000afd08" * (cast_expression "(code *)PTR_free_000afd08" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(puVar5)" ( identifier ))) ;) (return_statement "return (undefined1 *)0x0;" return (cast_expression "(undefined1 *)0x0" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit (function_definition TYPE (pointer_declarator * (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) )))) (compound_statement { (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( IDENT ))))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (while_statement while (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT , IDENT , (binary_expression IDENT - IDENT) )))) , (binary_expression LIT < IDENT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * IDENT) )) (argument_list ( IDENT , IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT - (cast_expression ( (type_descriptor TYPE) ) IDENT))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) (return_statement return IDENT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= (binary_expression IDENT + IDENT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + IDENT) + LIT)) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( IDENT , IDENT ))))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) })) })) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT , IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( ))))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })) (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != LIT) )) && (parenthesized_expression ( (binary_expression IDENT == IDENT) ))) )) (compound_statement { (return_statement return IDENT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT == IDENT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT << LIT)) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT << LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= 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 = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( ))))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })) (expression_statement (assignment_expression IDENT = IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) })) }))) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( IDENT , IDENT ))))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) })) })) (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT ))) ;) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })))
(function_definition "undefined1 * fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)\n\n{\n  undefined1 *puVar1;\n  int iVar2;\n  int iVar3;\n  int iVar4;\n  undefined1 *puVar5;\n  undefined4 *puVar6;\n  int iVar7;\n  int iVar8;\n  \n  iVar8 = 0;\n  puVar1 = (undefined1 *)xmalloc(param_3);\n  iVar7 = param_3 + -1;\n  puVar5 = puVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(puVar5);\n  return (undefined1 *)0x0;\n}" (type_identifier "undefined1") (pointer_declarator "* fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)" (* "*") (function_declarator "fd_read_hunk(undefined4 param_1,code *param_2,int param_3,int param_4)" (identifier "fd_read_hunk") (parameter_list "(undefined4 param_1,code *param_2,int param_3,int param_4)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (identifier "param_1")) (, ",") (parameter_declaration "code *param_2" (type_identifier "code") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) (, ",") (parameter_declaration "int param_3" (primitive_type "int") (identifier "param_3")) (, ",") (parameter_declaration "int param_4" (primitive_type "int") (identifier "param_4")) () ")")))) (compound_statement "{\n  undefined1 *puVar1;\n  int iVar2;\n  int iVar3;\n  int iVar4;\n  undefined1 *puVar5;\n  undefined4 *puVar6;\n  int iVar7;\n  int iVar8;\n  \n  iVar8 = 0;\n  puVar1 = (undefined1 *)xmalloc(param_3);\n  iVar7 = param_3 + -1;\n  puVar5 = puVar1;\n  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }\n  (*(code *)PTR_free_000afd08)(puVar5);\n  return (undefined1 *)0x0;\n}" ({ "{") (declaration "undefined1 *puVar1;" (type_identifier "undefined1") (pointer_declarator "*puVar1" (* "*") (identifier "puVar1")) (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "int iVar4;" (primitive_type "int") (identifier "iVar4") (; ";")) (declaration "undefined1 *puVar5;" (type_identifier "undefined1") (pointer_declarator "*puVar5" (* "*") (identifier "puVar5")) (; ";")) (declaration "undefined4 *puVar6;" (type_identifier "undefined4") (pointer_declarator "*puVar6" (* "*") (identifier "puVar6")) (; ";")) (declaration "int iVar7;" (primitive_type "int") (identifier "iVar7") (; ";")) (declaration "int iVar8;" (primitive_type "int") (identifier "iVar8") (; ";")) (expression_statement "iVar8 = 0;" (assignment_expression "iVar8 = 0" (identifier "iVar8") (= "=") (number_literal "0")) (; ";")) (expression_statement "puVar1 = (undefined1 *)xmalloc(param_3);" (assignment_expression "puVar1 = (undefined1 *)xmalloc(param_3)" (identifier "puVar1") (= "=") (cast_expression "(undefined1 *)xmalloc(param_3)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "xmalloc(param_3)" (identifier "xmalloc") (argument_list "(param_3)" (( "(") (identifier "param_3") () ")"))))) (; ";")) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" (identifier "iVar7") (= "=") (binary_expression "param_3 + -1" (identifier "param_3") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "puVar5 = puVar1;" (assignment_expression "puVar5 = puVar1" (identifier "puVar5") (= "=") (identifier "puVar1")) (; ";")) (while_statement "while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }" (while "while") (parenthesized_expression "(iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2)" (( "(") (comma_expression "iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2" (assignment_expression "iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8)" (identifier "iVar2") (= "=") (call_expression "(*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8)" (parenthesized_expression "(*(code *)PTR_fd_peek_000af93c)" (( "(") (pointer_expression "*(code *)PTR_fd_peek_000af93c" (* "*") (cast_expression "(code *)PTR_fd_peek_000af93c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_fd_peek_000af93c"))) () ")")) (argument_list "(param_1,puVar1,iVar7 - iVar8)" (( "(") (identifier "param_1") (, ",") (identifier "puVar1") (, ",") (binary_expression "iVar7 - iVar8" (identifier "iVar7") (- "-") (identifier "iVar8")) () ")")))) (, ",") (binary_expression "-1 < iVar2" (number_literal "-1") (< "<") (identifier "iVar2"))) () ")")) (compound_statement "{\n    iVar3 = (*param_2)(puVar5,puVar1,iVar2);\n    if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }\n    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);\n    if (iVar4 < 0) break;\n    iVar8 = iVar8 + iVar4;\n    puVar1 = puVar5 + iVar8;\n    *puVar1 = 0;\n    if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }\n    iVar7 = param_3 + -1;\n    if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }\n    if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }\n  }" ({ "{") (expression_statement "iVar3 = (*param_2)(puVar5,puVar1,iVar2);" (assignment_expression "iVar3 = (*param_2)(puVar5,puVar1,iVar2)" (identifier "iVar3") (= "=") (call_expression "(*param_2)(puVar5,puVar1,iVar2)" (parenthesized_expression "(*param_2)" (( "(") (pointer_expression "*param_2" (* "*") (identifier "param_2")) () ")")) (argument_list "(puVar5,puVar1,iVar2)" (( "(") (identifier "puVar5") (, ",") (identifier "puVar1") (, ",") (identifier "iVar2") () ")")))) (; ";")) (if_statement "if (iVar3 != 0) {\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }" (if "if") (parenthesized_expression "(iVar3 != 0)" (( "(") (binary_expression "iVar3 != 0" (identifier "iVar3") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      iVar2 = iVar3 - (int)puVar1;\n      if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }\n      if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }\n    }" ({ "{") (expression_statement "iVar2 = iVar3 - (int)puVar1;" (assignment_expression "iVar2 = iVar3 - (int)puVar1" (identifier "iVar2") (= "=") (binary_expression "iVar3 - (int)puVar1" (identifier "iVar3") (- "-") (cast_expression "(int)puVar1" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "puVar1")))) (; ";")) (if_statement "if (iVar2 == 0) {\n        *puVar1 = 0;\n        return puVar5;\n      }" (if "if") (parenthesized_expression "(iVar2 == 0)" (( "(") (binary_expression "iVar2 == 0" (identifier "iVar2") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        *puVar1 = 0;\n        return puVar5;\n      }" ({ "{") (expression_statement "*puVar1 = 0;" (assignment_expression "*puVar1 = 0" (pointer_expression "*puVar1" (* "*") (identifier "puVar1")) (= "=") (number_literal "0")) (; ";")) (return_statement "return puVar5;" (return "return") (identifier "puVar5") (; ";")) (} "}"))) (if_statement "if (param_3 <= iVar8 + iVar2) {\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }" (if "if") (parenthesized_expression "(param_3 <= iVar8 + iVar2)" (( "(") (binary_expression "param_3 <= iVar8 + iVar2" (identifier "param_3") (<= "<=") (binary_expression "iVar8 + iVar2" (identifier "iVar8") (+ "+") (identifier "iVar2"))) () ")")) (compound_statement "{\n        param_3 = iVar8 + iVar2 + 1;\n        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n        puVar1 = puVar5 + iVar8;\n      }" ({ "{") (expression_statement "param_3 = iVar8 + iVar2 + 1;" (assignment_expression "param_3 = iVar8 + iVar2 + 1" (identifier "param_3") (= "=") (binary_expression "iVar8 + iVar2 + 1" (binary_expression "iVar8 + iVar2" (identifier "iVar8") (+ "+") (identifier "iVar2")) (+ "+") (number_literal "1"))) (; ";")) (expression_statement "puVar5 = (undefined1 *)xrealloc(puVar5,param_3);" (assignment_expression "puVar5 = (undefined1 *)xrealloc(puVar5,param_3)" (identifier "puVar5") (= "=") (cast_expression "(undefined1 *)xrealloc(puVar5,param_3)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "xrealloc(puVar5,param_3)" (identifier "xrealloc") (argument_list "(puVar5,param_3)" (( "(") (identifier "puVar5") (, ",") (identifier "param_3") () ")"))))) (; ";")) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" (identifier "puVar1") (= "=") (binary_expression "puVar5 + iVar8" (identifier "puVar5") (+ "+") (identifier "iVar8"))) (; ";")) (} "}"))) (} "}"))) (expression_statement "iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);" (assignment_expression "iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2)" (identifier "iVar4") (= "=") (call_expression "(*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2)" (parenthesized_expression "(*(code *)PTR_fd_read_000af83c)" (( "(") (pointer_expression "*(code *)PTR_fd_read_000af83c" (* "*") (cast_expression "(code *)PTR_fd_read_000af83c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_fd_read_000af83c"))) () ")")) (argument_list "(param_1,puVar1,iVar2)" (( "(") (identifier "param_1") (, ",") (identifier "puVar1") (, ",") (identifier "iVar2") () ")")))) (; ";")) (if_statement "if (iVar4 < 0) break;" (if "if") (parenthesized_expression "(iVar4 < 0)" (( "(") (binary_expression "iVar4 < 0" (identifier "iVar4") (< "<") (number_literal "0")) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "iVar8 = iVar8 + iVar4;" (assignment_expression "iVar8 = iVar8 + iVar4" (identifier "iVar8") (= "=") (binary_expression "iVar8 + iVar4" (identifier "iVar8") (+ "+") (identifier "iVar4"))) (; ";")) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" (identifier "puVar1") (= "=") (binary_expression "puVar5 + iVar8" (identifier "puVar5") (+ "+") (identifier "iVar8"))) (; ";")) (expression_statement "*puVar1 = 0;" (assignment_expression "*puVar1 = 0" (pointer_expression "*puVar1" (* "*") (identifier "puVar1")) (= "=") (number_literal "0")) (; ";")) (if_statement "if (iVar4 == 0) {\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }" (if "if") (parenthesized_expression "(iVar4 == 0)" (( "(") (binary_expression "iVar4 == 0" (identifier "iVar4") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n      if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }\n      return puVar5;\n    }" ({ "{") (if_statement "if (iVar8 == 0) {\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }" (if "if") (parenthesized_expression "(iVar8 == 0)" (( "(") (binary_expression "iVar8 == 0" (identifier "iVar8") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        (*(code *)PTR_free_000afd08)(puVar5);\n        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n        *puVar6 = 0;\n        return (undefined1 *)0x0;\n      }" ({ "{") (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" (( "(") (pointer_expression "*(code *)PTR_free_000afd08" (* "*") (cast_expression "(code *)PTR_free_000afd08" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_free_000afd08"))) () ")")) (argument_list "(puVar5)" (( "(") (identifier "puVar5") () ")"))) (; ";")) (expression_statement "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();" (assignment_expression "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)()" (identifier "puVar6") (= "=") (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000afe90)()" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "(*(code *)PTR___errno_location_000afe90)()" (parenthesized_expression "(*(code *)PTR___errno_location_000afe90)" (( "(") (pointer_expression "*(code *)PTR___errno_location_000afe90" (* "*") (cast_expression "(code *)PTR___errno_location_000afe90" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR___errno_location_000afe90"))) () ")")) (argument_list "()" (( "(") () ")"))))) (; ";")) (expression_statement "*puVar6 = 0;" (assignment_expression "*puVar6 = 0" (pointer_expression "*puVar6" (* "*") (identifier "puVar6")) (= "=") (number_literal "0")) (; ";")) (return_statement "return (undefined1 *)0x0;" (return "return") (cast_expression "(undefined1 *)0x0" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}"))) (return_statement "return puVar5;" (return "return") (identifier "puVar5") (; ";")) (} "}"))) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" (identifier "iVar7") (= "=") (binary_expression "param_3 + -1" (identifier "param_3") (+ "+") (number_literal "-1"))) (; ";")) (if_statement "if ((iVar3 != 0) && (iVar2 == iVar4)) {\n      return puVar5;\n    }" (if "if") (parenthesized_expression "((iVar3 != 0) && (iVar2 == iVar4))" (( "(") (binary_expression "(iVar3 != 0) && (iVar2 == iVar4)" (parenthesized_expression "(iVar3 != 0)" (( "(") (binary_expression "iVar3 != 0" (identifier "iVar3") (!= "!=") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(iVar2 == iVar4)" (( "(") (binary_expression "iVar2 == iVar4" (identifier "iVar2") (== "==") (identifier "iVar4")) () ")"))) () ")")) (compound_statement "{\n      return puVar5;\n    }" ({ "{") (return_statement "return puVar5;" (return "return") (identifier "puVar5") (; ";")) (} "}"))) (if_statement "if (iVar7 == iVar8) {\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }" (if "if") (parenthesized_expression "(iVar7 == iVar8)" (( "(") (binary_expression "iVar7 == iVar8" (identifier "iVar7") (== "==") (identifier "iVar8")) () ")")) (compound_statement "{\n      if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }\n      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);\n      iVar7 = param_3 + -1;\n      puVar1 = puVar5 + iVar8;\n    }" ({ "{") (if_statement "if (param_4 == 0) {\n        param_3 = param_3 << 1;\n      }\n      else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" (if "if") (parenthesized_expression "(param_4 == 0)" (( "(") (binary_expression "param_4 == 0" (identifier "param_4") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        param_3 = param_3 << 1;\n      }" ({ "{") (expression_statement "param_3 = param_3 << 1;" (assignment_expression "param_3 = param_3 << 1" (identifier "param_3") (= "=") (binary_expression "param_3 << 1" (identifier "param_3") (<< "<<") (number_literal "1"))) (; ";")) (} "}")) (else_clause "else {\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" (else "else") (compound_statement "{\n        iVar7 = param_3 << 1;\n        if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }\n        param_3 = iVar7;\n        if (param_4 < iVar7) {\n          param_3 = param_4;\n        }\n      }" ({ "{") (expression_statement "iVar7 = param_3 << 1;" (assignment_expression "iVar7 = param_3 << 1" (identifier "iVar7") (= "=") (binary_expression "param_3 << 1" (identifier "param_3") (<< "<<") (number_literal "1"))) (; ";")) (if_statement "if (param_4 <= param_3) {\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }" (if "if") (parenthesized_expression "(param_4 <= param_3)" (( "(") (binary_expression "param_4 <= param_3" (identifier "param_4") (<= "<=") (identifier "param_3")) () ")")) (compound_statement "{\n          (*(code *)PTR_free_000afd08)(puVar5);\n          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();\n          *puVar6 = 0xc;\n          return (undefined1 *)0x0;\n        }" ({ "{") (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" (( "(") (pointer_expression "*(code *)PTR_free_000afd08" (* "*") (cast_expression "(code *)PTR_free_000afd08" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_free_000afd08"))) () ")")) (argument_list "(puVar5)" (( "(") (identifier "puVar5") () ")"))) (; ";")) (expression_statement "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();" (assignment_expression "puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)()" (identifier "puVar6") (= "=") (cast_expression "(undefined4 *)(*(code *)PTR___errno_location_000afe90)()" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "(*(code *)PTR___errno_location_000afe90)()" (parenthesized_expression "(*(code *)PTR___errno_location_000afe90)" (( "(") (pointer_expression "*(code *)PTR___errno_location_000afe90" (* "*") (cast_expression "(code *)PTR___errno_location_000afe90" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR___errno_location_000afe90"))) () ")")) (argument_list "()" (( "(") () ")"))))) (; ";")) (expression_statement "*puVar6 = 0xc;" (assignment_expression "*puVar6 = 0xc" (pointer_expression "*puVar6" (* "*") (identifier "puVar6")) (= "=") (number_literal "0xc")) (; ";")) (return_statement "return (undefined1 *)0x0;" (return "return") (cast_expression "(undefined1 *)0x0" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}"))) (expression_statement "param_3 = iVar7;" (assignment_expression "param_3 = iVar7" (identifier "param_3") (= "=") (identifier "iVar7")) (; ";")) (if_statement "if (param_4 < iVar7) {\n          param_3 = param_4;\n        }" (if "if") (parenthesized_expression "(param_4 < iVar7)" (( "(") (binary_expression "param_4 < iVar7" (identifier "param_4") (< "<") (identifier "iVar7")) () ")")) (compound_statement "{\n          param_3 = param_4;\n        }" ({ "{") (expression_statement "param_3 = param_4;" (assignment_expression "param_3 = param_4" (identifier "param_3") (= "=") (identifier "param_4")) (; ";")) (} "}"))) (} "}")))) (expression_statement "puVar5 = (undefined1 *)xrealloc(puVar5,param_3);" (assignment_expression "puVar5 = (undefined1 *)xrealloc(puVar5,param_3)" (identifier "puVar5") (= "=") (cast_expression "(undefined1 *)xrealloc(puVar5,param_3)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "xrealloc(puVar5,param_3)" (identifier "xrealloc") (argument_list "(puVar5,param_3)" (( "(") (identifier "puVar5") (, ",") (identifier "param_3") () ")"))))) (; ";")) (expression_statement "iVar7 = param_3 + -1;" (assignment_expression "iVar7 = param_3 + -1" (identifier "iVar7") (= "=") (binary_expression "param_3 + -1" (identifier "param_3") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "puVar1 = puVar5 + iVar8;" (assignment_expression "puVar1 = puVar5 + iVar8" (identifier "puVar1") (= "=") (binary_expression "puVar5 + iVar8" (identifier "puVar5") (+ "+") (identifier "iVar8"))) (; ";")) (} "}"))) (} "}"))) (expression_statement "(*(code *)PTR_free_000afd08)(puVar5);" (call_expression "(*(code *)PTR_free_000afd08)(puVar5)" (parenthesized_expression "(*(code *)PTR_free_000afd08)" (( "(") (pointer_expression "*(code *)PTR_free_000afd08" (* "*") (cast_expression "(code *)PTR_free_000afd08" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_free_000afd08"))) () ")")) (argument_list "(puVar5)" (( "(") (identifier "puVar5") () ")"))) (; ";")) (return_statement "return (undefined1 *)0x0;" (return "return") (cast_expression "(undefined1 *)0x0" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}")))

char * function_1(int fd,type_1 terminator,long var_2,long var_10)

{
  char *pcVar1;
  int var_5;
  char *var_6;
  int var_9;
  char *var_8;
  type_2 *puVar5;
  int var_3;
  int var_4;
  size_t sVar8;
  
  var_4 = 0;
  pcVar1 = (char *)var_1(var_2);
  var_3 = var_2 + -1;
  var_8 = pcVar1;
  while (var_5 = (*(type_3 *)PTR_fd_peek_000af93c)(fd,pcVar1,var_3 - var_4), -1 < var_5) {
    var_6 = (*terminator)(var_8,pcVar1,var_5);
    if (var_6 != (char *)0x0) {
      var_5 = (int)var_6 - (int)pcVar1;
      if (var_5 == 0) {
        *pcVar1 = '\0';
        return var_8;
      }
      if (var_2 <= var_4 + var_5) {
        var_2 = var_4 + var_5 + 1;
        var_8 = (char *)var_7(var_8,var_2);
        pcVar1 = var_8 + var_4;
      }
    }
    var_9 = (*(type_3 *)PTR_fd_read_000af83c)(fd,pcVar1,var_5);
    if (var_9 < 0) break;
    var_4 = var_4 + var_9;
    pcVar1 = var_8 + var_4;
    *pcVar1 = '\0';
    if (var_9 == 0) {
      if (var_4 == 0) {
        (*(type_3 *)PTR_free_000afd08)(var_8);
        puVar5 = (type_2 *)(*(type_3 *)PTR___errno_location_000afe90)();
        *puVar5 = 0;
        return (char *)0x0;
      }
      return var_8;
    }
    var_3 = var_2 - 1;
    if ((var_6 != (char *)0x0) && (var_5 == var_9)) {
      return var_8;
    }
    if (var_3 == var_4) {
      if (var_10 == 0) {
        var_2 = var_2 << 1;
      }
      else {
        sVar8 = var_2 << 1;
        if (var_10 <= var_2) {
          (*(type_3 *)PTR_free_000afd08)(var_8);
          puVar5 = (type_2 *)(*(type_3 *)PTR___errno_location_000afe90)();
          *puVar5 = 0xc;
          return (char *)0x0;
        }
        var_2 = sVar8;
        if (var_10 < (int)sVar8) {
          var_2 = var_10;
        }
      }
      var_8 = (char *)var_7(var_8,var_2);
      var_3 = var_2 - 1;
      pcVar1 = var_8 + var_4;
    }
  }
  (*(type_3 *)PTR_free_000afd08)(var_8);
  return (char *)0x0;
}


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

undefined1 * MASKED(undefined4 param_1,code *param_2,int param_3,int param_4)

{
  undefined1 *puVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  undefined1 *puVar5;
  undefined4 *puVar6;
  int iVar7;
  int iVar8;
  
  iVar8 = 0;
  puVar1 = (undefined1 *)xmalloc(param_3);
  iVar7 = param_3 + -1;
  puVar5 = puVar1;
  while (iVar2 = (*(code *)PTR_fd_peek_000af93c)(param_1,puVar1,iVar7 - iVar8), -1 < iVar2) {
    iVar3 = (*param_2)(puVar5,puVar1,iVar2);
    if (iVar3 != 0) {
      iVar2 = iVar3 - (int)puVar1;
      if (iVar2 == 0) {
        *puVar1 = 0;
        return puVar5;
      }
      if (param_3 <= iVar8 + iVar2) {
        param_3 = iVar8 + iVar2 + 1;
        puVar5 = (undefined1 *)xrealloc(puVar5,param_3);
        puVar1 = puVar5 + iVar8;
      }
    }
    iVar4 = (*(code *)PTR_fd_read_000af83c)(param_1,puVar1,iVar2);
    if (iVar4 < 0) break;
    iVar8 = iVar8 + iVar4;
    puVar1 = puVar5 + iVar8;
    *puVar1 = 0;
    if (iVar4 == 0) {
      if (iVar8 == 0) {
        (*(code *)PTR_free_000afd08)(puVar5);
        puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();
        *puVar6 = 0;
        return (undefined1 *)0x0;
      }
      return puVar5;
    }
    iVar7 = param_3 + -1;
    if ((iVar3 != 0) && (iVar2 == iVar4)) {
      return puVar5;
    }
    if (iVar7 == iVar8) {
      if (param_4 == 0) {
        param_3 = param_3 << 1;
      }
      else {
        iVar7 = param_3 << 1;
        if (param_4 <= param_3) {
          (*(code *)PTR_free_000afd08)(puVar5);
          puVar6 = (undefined4 *)(*(code *)PTR___errno_location_000afe90)();
          *puVar6 = 0xc;
          return (undefined1 *)0x0;
        }
        param_3 = iVar7;
        if (param_4 < iVar7) {
          param_3 = param_4;
        }
      }
      puVar5 = (undefined1 *)xrealloc(puVar5,param_3);
      iVar7 = param_3 + -1;
      puVar1 = puVar5 + iVar8;
    }
  }
  (*(code *)PTR_free_000afd08)(puVar5);
  return (undefined1 *)0x0;
}

