
int unixRead(sqlite3_file *id,void *pBuf,int amt,sqlite3_int64 offset)

{
  sqlite3_io_methods *psVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  size_t __n;
  void *pvVar6;
  void *local_50;
  long local_48;
  
  psVar1 = id[10].pMethods;
  local_50 = pBuf;
  if (offset < (long)psVar1) {
    pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + offset);
    if (amt + offset <= (long)psVar1) {
      memcpy(pBuf,pvVar6,(long)amt);
      return 0;
    }
    iVar4 = (int)psVar1 - (int)offset;
    __n = (size_t)iVar4;
    amt = amt - iVar4;
    offset = offset + __n;
    local_50 = memcpy(pBuf,pvVar6,__n);
    local_50 = (void *)((long)local_50 + __n);
  }
  local_48 = (long)amt;
  iVar5 = 0;
  pvVar6 = local_50;
  iVar4 = amt;
LAB_00117b62:
  do {
    iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset);
    if (iVar4 == iVar2) {
      iVar5 = iVar5 + iVar4;
      if (amt == iVar5) {
        return 0;
      }
      if (iVar5 < 0) {
        return 0x10a;
      }
LAB_00117c1b:
      *(undefined4 *)&id[4].pMethods = 0;
      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));
      return 0x20a;
    }
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (amt == iVar5) {
          return 0;
        }
        goto LAB_00117c1b;
      }
      iVar4 = iVar4 - iVar2;
      iVar5 = iVar5 + iVar2;
      local_48 = (long)iVar4;
      offset = offset + iVar2;
      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);
      goto LAB_00117b62;
    }
    piVar3 = __errno_location();
    if (*piVar3 != 4) {
      *(int *)&id[4].pMethods = *piVar3;
      if (amt != iVar2) {
        return 0x10a;
      }
      return 0;
    }
  } while( true );
}



undefined8 FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)

{
  long lVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  void *pvVar6;
  size_t __n;
  void *local_50;
  long local_48;
  
  lVar1 = *(long *)(param_1 + 0x50);
  local_50 = param_2;
  if (param_4 < lVar1) {
    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);
    if (param_3 + param_4 <= lVar1) {
      memcpy(param_2,pvVar6,(long)param_3);
      return 0;
    }
    iVar4 = (int)lVar1 - (int)param_4;
    __n = (size_t)iVar4;
    param_3 = param_3 - iVar4;
    param_4 = param_4 + __n;
    local_50 = memcpy(param_2,pvVar6,__n);
    local_50 = (void *)((long)local_50 + __n);
  }
  local_48 = (long)param_3;
  iVar5 = 0;
  pvVar6 = local_50;
  iVar4 = param_3;
LAB_00117b62:
  do {
    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)
    ;
    if (iVar4 == iVar2) {
      iVar5 = iVar5 + iVar4;
      if (param_3 == iVar5) {
        return 0;
      }
      if (iVar5 < 0) {
        return 0x10a;
      }
LAB_00117c1b:
      *(undefined4 *)(param_1 + 0x20) = 0;
      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));
      return 0x20a;
    }
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (param_3 == iVar5) {
          return 0;
        }
        goto LAB_00117c1b;
      }
      iVar4 = iVar4 - iVar2;
      iVar5 = iVar5 + iVar2;
      local_48 = (long)iVar4;
      param_4 = param_4 + iVar2;
      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);
      goto LAB_00117b62;
    }
    piVar3 = __errno_location();
    if (*piVar3 != 4) {
      *(int *)(param_1 + 0x20) = *piVar3;
      if (param_3 != iVar2) {
        return 0x10a;
      }
      return 0;
    }
  } while( true );
}


PUSH R15
MOV R15,RDI
PUSH R14
PUSH R13
PUSH R12
MOV R12,RCX
PUSH RBP
PUSH RBX
MOV EBX,EDX
SUB RSP,0x28
MOV RAX,qword ptr [RDI + 0x50]
MOV qword ptr [RSP + 0x8],RSI
CMP RAX,RCX
JLE 0x00117b50
MOV RSI,qword ptr [RDI + 0x68]
MOVSXD RDX,EDX
ADD RSI,RCX
LEA RCX,[RDX + RCX*0x1]
CMP RAX,RCX
JGE 0x00117bd8
MOV EBP,EAX
MOV R14,qword ptr [RSP + 0x8]
SUB EBP,R12D
MOVSXD R13,EBP
MOV RDI,R14
SUB EBX,EBP
MOV RDX,R13
ADD R12,R13
CALL 0x0010a240
ADD RAX,R13
MOV qword ptr [RSP + 0x8],RAX
MOVSXD RAX,EBX
MOV R13,qword ptr [RSP + 0x8]
MOV R14D,EBX
XOR EBP,EBP
MOV qword ptr [RSP + 0x10],RAX
MOV EDI,dword ptr [R15 + 0x18]
MOV RCX,R12
MOV RDX,qword ptr [RSP + 0x10]
MOV RSI,R13
CALL qword ptr [0x00221478]
MOV dword ptr [RSP + 0x1c],EAX
CMP R14D,EAX
JZ 0x00117c10
TEST EAX,EAX
JS 0x00117ba8
JZ 0x00117bf8
SUB R14D,EAX
MOVSXD RDX,EAX
ADD EBP,EAX
MOVSXD RAX,R14D
ADD R12,RDX
ADD R13,RDX
MOV qword ptr [RSP + 0x10],RAX
JMP 0x00117b62
CALL 0x0010a090
MOV EAX,dword ptr [RAX]
CMP EAX,0x4
JZ 0x00117b62
MOV dword ptr [R15 + 0x20],EAX
CMP EBX,dword ptr [RSP + 0x1c]
JZ 0x00117bfc
ADD RSP,0x28
MOV EAX,0x10a
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
MOV RDI,qword ptr [RSP + 0x8]
CALL 0x0010a240
ADD RSP,0x28
XOR EAX,EAX
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
CMP EBX,EBP
JNZ 0x00117c1b
ADD RSP,0x28
XOR EAX,EAX
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
ADD EBP,R14D
CMP EBX,EBP
JZ 0x00117bfc
TEST EBP,EBP
JS 0x00117bbe
MOV RDI,qword ptr [RSP + 0x8]
MOV dword ptr [R15 + 0x20],0x0
SUB EBX,EBP
MOVSXD RBP,EBP
MOVSXD RDX,EBX
XOR ESI,ESI
ADD RDI,RBP
CALL 0x0010a1a0
ADD RSP,0x28
MOV EAX,0x20a
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
(translation_unit "undefined8 FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)\n\n{\n  long lVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  void *pvVar6;\n  size_t __n;\n  void *local_50;\n  long local_48;\n  \n  lVar1 = *(long *)(param_1 + 0x50);\n  local_50 = param_2;\n  if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)param_3;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = param_3;\nLAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}\n\n" (function_definition "undefined8 FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)\n\n{\n  long lVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  void *pvVar6;\n  size_t __n;\n  void *local_50;\n  long local_48;\n  \n  lVar1 = *(long *)(param_1 + 0x50);\n  local_50 = param_2;\n  if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)param_3;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = param_3;\nLAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}" type_identifier (function_declarator "FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)" identifier (parameter_list "(long param_1,void *param_2,int param_3,long param_4)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "void *param_2" primitive_type (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "int param_3" primitive_type identifier) , (parameter_declaration "long param_4" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  long lVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  void *pvVar6;\n  size_t __n;\n  void *local_50;\n  long local_48;\n  \n  lVar1 = *(long *)(param_1 + 0x50);\n  local_50 = param_2;\n  if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)param_3;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = param_3;\nLAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}" { (declaration "long lVar1;" (sized_type_specifier "long" long) identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "void *pvVar6;" primitive_type (pointer_declarator "*pvVar6" * identifier) ;) (declaration "size_t __n;" primitive_type identifier ;) (declaration "void *local_50;" primitive_type (pointer_declarator "*local_50" * identifier) ;) (declaration "long local_48;" (sized_type_specifier "long" long) identifier ;) (expression_statement "lVar1 = *(long *)(param_1 + 0x50);" (assignment_expression "lVar1 = *(long *)(param_1 + 0x50)" identifier = (pointer_expression "*(long *)(param_1 + 0x50)" * (cast_expression "(long *)(param_1 + 0x50)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x50)" ( (binary_expression "param_1 + 0x50" identifier + number_literal) ))))) ;) (expression_statement "local_50 = param_2;" (assignment_expression "local_50 = param_2" identifier = identifier) ;) (if_statement "if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }" if (parenthesized_expression "(param_4 < lVar1)" ( (binary_expression "param_4 < lVar1" identifier < identifier) )) (compound_statement "{\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }" { (expression_statement "pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);" (assignment_expression "pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4)" identifier = (cast_expression "(void *)(*(long *)(param_1 + 0x68) + param_4)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(long *)(param_1 + 0x68) + param_4)" ( (binary_expression "*(long *)(param_1 + 0x68) + param_4" (pointer_expression "*(long *)(param_1 + 0x68)" * (cast_expression "(long *)(param_1 + 0x68)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x68)" ( (binary_expression "param_1 + 0x68" identifier + number_literal) )))) + identifier) )))) ;) (if_statement "if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }" if (parenthesized_expression "(param_3 + param_4 <= lVar1)" ( (binary_expression "param_3 + param_4 <= lVar1" (binary_expression "param_3 + param_4" identifier + identifier) <= identifier) )) (compound_statement "{\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }" { (expression_statement "memcpy(param_2,pvVar6,(long)param_3);" (call_expression "memcpy(param_2,pvVar6,(long)param_3)" identifier (argument_list "(param_2,pvVar6,(long)param_3)" ( identifier , identifier , (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) ))) ;) (return_statement "return 0;" return number_literal ;) })) (expression_statement "iVar4 = (int)lVar1 - (int)param_4;" (assignment_expression "iVar4 = (int)lVar1 - (int)param_4" identifier = (binary_expression "(int)lVar1 - (int)param_4" (cast_expression "(int)lVar1" ( (type_descriptor "int" primitive_type) ) identifier) - (cast_expression "(int)param_4" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (expression_statement "__n = (size_t)iVar4;" (assignment_expression "__n = (size_t)iVar4" identifier = (cast_expression "(size_t)iVar4" ( (type_descriptor "size_t" primitive_type) ) identifier)) ;) (expression_statement "param_3 = param_3 - iVar4;" (assignment_expression "param_3 = param_3 - iVar4" identifier = (binary_expression "param_3 - iVar4" identifier - identifier)) ;) (expression_statement "param_4 = param_4 + __n;" (assignment_expression "param_4 = param_4 + __n" identifier = (binary_expression "param_4 + __n" identifier + identifier)) ;) (expression_statement "local_50 = memcpy(param_2,pvVar6,__n);" (assignment_expression "local_50 = memcpy(param_2,pvVar6,__n)" identifier = (call_expression "memcpy(param_2,pvVar6,__n)" identifier (argument_list "(param_2,pvVar6,__n)" ( identifier , identifier , identifier )))) ;) (expression_statement "local_50 = (void *)((long)local_50 + __n);" (assignment_expression "local_50 = (void *)((long)local_50 + __n)" identifier = (cast_expression "(void *)((long)local_50 + __n)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)local_50 + __n)" ( (binary_expression "(long)local_50 + __n" (cast_expression "(long)local_50" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + identifier) )))) ;) })) (expression_statement "local_48 = (long)param_3;" (assignment_expression "local_48 = (long)param_3" identifier = (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "iVar5 = 0;" (assignment_expression "iVar5 = 0" identifier = number_literal) ;) (expression_statement "pvVar6 = local_50;" (assignment_expression "pvVar6 = local_50" identifier = identifier) ;) (expression_statement "iVar4 = param_3;" (assignment_expression "iVar4 = param_3" identifier = identifier) ;) (labeled_statement "LAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );" statement_identifier : (do_statement "do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );" do (compound_statement "{\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  }" { (expression_statement "iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;" (assignment_expression "iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" identifier = (call_expression "(*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" (parenthesized_expression "(*(code *)PTR_pread64_00221478)" ( (pointer_expression "*(code *)PTR_pread64_00221478" * (cast_expression "(code *)PTR_pread64_00221478" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" ( (pointer_expression "*(undefined4 *)(param_1 + 0x18)" * (cast_expression "(undefined4 *)(param_1 + 0x18)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x18)" ( (binary_expression "param_1 + 0x18" identifier + number_literal) )))) , identifier , identifier , identifier )))) ;) (if_statement "if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }" if (parenthesized_expression "(iVar4 == iVar2)" ( (binary_expression "iVar4 == iVar2" identifier == identifier) )) (compound_statement "{\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }" { (expression_statement "iVar5 = iVar5 + iVar4;" (assignment_expression "iVar5 = iVar5 + iVar4" identifier = (binary_expression "iVar5 + iVar4" identifier + identifier)) ;) (if_statement "if (param_3 == iVar5) {\n        return 0;\n      }" if (parenthesized_expression "(param_3 == iVar5)" ( (binary_expression "param_3 == iVar5" identifier == identifier) )) (compound_statement "{\n        return 0;\n      }" { (return_statement "return 0;" return number_literal ;) })) (if_statement "if (iVar5 < 0) {\n        return 0x10a;\n      }" if (parenthesized_expression "(iVar5 < 0)" ( (binary_expression "iVar5 < 0" identifier < number_literal) )) (compound_statement "{\n        return 0x10a;\n      }" { (return_statement "return 0x10a;" return number_literal ;) })) (labeled_statement "LAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;" statement_identifier : (expression_statement "*(undefined4 *)(param_1 + 0x20) = 0;" (assignment_expression "*(undefined4 *)(param_1 + 0x20) = 0" (pointer_expression "*(undefined4 *)(param_1 + 0x20)" * (cast_expression "(undefined4 *)(param_1 + 0x20)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x20)" ( (binary_expression "param_1 + 0x20" identifier + number_literal) )))) = number_literal) ;)) (expression_statement "memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));" (call_expression "memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5))" identifier (argument_list "((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5))" ( (cast_expression "(void *)((long)local_50 + (long)iVar5)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)local_50 + (long)iVar5)" ( (binary_expression "(long)local_50 + (long)iVar5" (cast_expression "(long)local_50" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar5" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , number_literal , (cast_expression "(long)(param_3 - iVar5)" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (parenthesized_expression "(param_3 - iVar5)" ( (binary_expression "param_3 - iVar5" identifier - identifier) ))) ))) ;) (return_statement "return 0x20a;" return number_literal ;) })) (if_statement "if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }" if (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) (compound_statement "{\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }" { (if_statement "if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }" { (if_statement "if (param_3 == iVar5) {\n          return 0;\n        }" if (parenthesized_expression "(param_3 == iVar5)" ( (binary_expression "param_3 == iVar5" identifier == identifier) )) (compound_statement "{\n          return 0;\n        }" { (return_statement "return 0;" return number_literal ;) })) (goto_statement "goto LAB_00117c1b;" goto statement_identifier ;) })) (expression_statement "iVar4 = iVar4 - iVar2;" (assignment_expression "iVar4 = iVar4 - iVar2" identifier = (binary_expression "iVar4 - iVar2" identifier - identifier)) ;) (expression_statement "iVar5 = iVar5 + iVar2;" (assignment_expression "iVar5 = iVar5 + iVar2" identifier = (binary_expression "iVar5 + iVar2" identifier + identifier)) ;) (expression_statement "local_48 = (long)iVar4;" (assignment_expression "local_48 = (long)iVar4" identifier = (cast_expression "(long)iVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "param_4 = param_4 + iVar2;" (assignment_expression "param_4 = param_4 + iVar2" identifier = (binary_expression "param_4 + iVar2" identifier + identifier)) ;) (expression_statement "pvVar6 = (void *)((long)pvVar6 + (long)iVar2);" (assignment_expression "pvVar6 = (void *)((long)pvVar6 + (long)iVar2)" identifier = (cast_expression "(void *)((long)pvVar6 + (long)iVar2)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)pvVar6 + (long)iVar2)" ( (binary_expression "(long)pvVar6 + (long)iVar2" (cast_expression "(long)pvVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) ;) (goto_statement "goto LAB_00117b62;" goto statement_identifier ;) })) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (if_statement "if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }" if (parenthesized_expression "(*piVar3 != 4)" ( (binary_expression "*piVar3 != 4" (pointer_expression "*piVar3" * identifier) != number_literal) )) (compound_statement "{\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }" { (expression_statement "*(int *)(param_1 + 0x20) = *piVar3;" (assignment_expression "*(int *)(param_1 + 0x20) = *piVar3" (pointer_expression "*(int *)(param_1 + 0x20)" * (cast_expression "(int *)(param_1 + 0x20)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x20)" ( (binary_expression "param_1 + 0x20" identifier + number_literal) )))) = (pointer_expression "*piVar3" * identifier)) ;) (if_statement "if (param_3 != iVar2) {\n        return 0x10a;\n      }" if (parenthesized_expression "(param_3 != iVar2)" ( (binary_expression "param_3 != iVar2" identifier != identifier) )) (compound_statement "{\n        return 0x10a;\n      }" { (return_statement "return 0x10a;" return number_literal ;) })) (return_statement "return 0;" return number_literal ;) })) }) while (parenthesized_expression "( true )" ( true )) ;)) })))
(translation_unit "int unixRead(sqlite3_file *id,void *pBuf,int amt,sqlite3_int64 offset)\n\n{\n  sqlite3_io_methods *psVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  size_t __n;\n  void *pvVar6;\n  void *local_50;\n  long local_48;\n  \n  psVar1 = id[10].pMethods;\n  local_50 = pBuf;\n  if (offset < (long)psVar1) {\n    pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + offset);\n    if (amt + offset <= (long)psVar1) {\n      memcpy(pBuf,pvVar6,(long)amt);\n      return 0;\n    }\n    iVar4 = (int)psVar1 - (int)offset;\n    __n = (size_t)iVar4;\n    amt = amt - iVar4;\n    offset = offset + __n;\n    local_50 = memcpy(pBuf,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)amt;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = amt;\nLAB_00117b62:\n  do {\n    iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset);\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (amt == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      offset = offset + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)&id[4].pMethods = *piVar3;\n      if (amt != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}\n\n" (function_definition "int unixRead(sqlite3_file *id,void *pBuf,int amt,sqlite3_int64 offset)\n\n{\n  sqlite3_io_methods *psVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  size_t __n;\n  void *pvVar6;\n  void *local_50;\n  long local_48;\n  \n  psVar1 = id[10].pMethods;\n  local_50 = pBuf;\n  if (offset < (long)psVar1) {\n    pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + offset);\n    if (amt + offset <= (long)psVar1) {\n      memcpy(pBuf,pvVar6,(long)amt);\n      return 0;\n    }\n    iVar4 = (int)psVar1 - (int)offset;\n    __n = (size_t)iVar4;\n    amt = amt - iVar4;\n    offset = offset + __n;\n    local_50 = memcpy(pBuf,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)amt;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = amt;\nLAB_00117b62:\n  do {\n    iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset);\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (amt == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      offset = offset + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)&id[4].pMethods = *piVar3;\n      if (amt != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}" primitive_type (function_declarator "unixRead(sqlite3_file *id,void *pBuf,int amt,sqlite3_int64 offset)" identifier (parameter_list "(sqlite3_file *id,void *pBuf,int amt,sqlite3_int64 offset)" ( (parameter_declaration "sqlite3_file *id" type_identifier (pointer_declarator "*id" * identifier)) , (parameter_declaration "void *pBuf" primitive_type (pointer_declarator "*pBuf" * identifier)) , (parameter_declaration "int amt" primitive_type identifier) , (parameter_declaration "sqlite3_int64 offset" type_identifier identifier) ))) (compound_statement "{\n  sqlite3_io_methods *psVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  size_t __n;\n  void *pvVar6;\n  void *local_50;\n  long local_48;\n  \n  psVar1 = id[10].pMethods;\n  local_50 = pBuf;\n  if (offset < (long)psVar1) {\n    pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + offset);\n    if (amt + offset <= (long)psVar1) {\n      memcpy(pBuf,pvVar6,(long)amt);\n      return 0;\n    }\n    iVar4 = (int)psVar1 - (int)offset;\n    __n = (size_t)iVar4;\n    amt = amt - iVar4;\n    offset = offset + __n;\n    local_50 = memcpy(pBuf,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)amt;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = amt;\nLAB_00117b62:\n  do {\n    iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset);\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (amt == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      offset = offset + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)&id[4].pMethods = *piVar3;\n      if (amt != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}" { (declaration "sqlite3_io_methods *psVar1;" type_identifier (pointer_declarator "*psVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "size_t __n;" primitive_type identifier ;) (declaration "void *pvVar6;" primitive_type (pointer_declarator "*pvVar6" * identifier) ;) (declaration "void *local_50;" primitive_type (pointer_declarator "*local_50" * identifier) ;) (declaration "long local_48;" (sized_type_specifier "long" long) identifier ;) (expression_statement "psVar1 = id[10].pMethods;" (assignment_expression "psVar1 = id[10].pMethods" identifier = (field_expression "id[10].pMethods" (subscript_expression "id[10]" identifier [ number_literal ]) . field_identifier)) ;) (expression_statement "local_50 = pBuf;" (assignment_expression "local_50 = pBuf" identifier = identifier) ;) (if_statement "if (offset < (long)psVar1) {\n    pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + offset);\n    if (amt + offset <= (long)psVar1) {\n      memcpy(pBuf,pvVar6,(long)amt);\n      return 0;\n    }\n    iVar4 = (int)psVar1 - (int)offset;\n    __n = (size_t)iVar4;\n    amt = amt - iVar4;\n    offset = offset + __n;\n    local_50 = memcpy(pBuf,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }" if (parenthesized_expression "(offset < (long)psVar1)" ( (binary_expression "offset < (long)psVar1" identifier < (cast_expression "(long)psVar1" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )) (compound_statement "{\n    pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + offset);\n    if (amt + offset <= (long)psVar1) {\n      memcpy(pBuf,pvVar6,(long)amt);\n      return 0;\n    }\n    iVar4 = (int)psVar1 - (int)offset;\n    __n = (size_t)iVar4;\n    amt = amt - iVar4;\n    offset = offset + __n;\n    local_50 = memcpy(pBuf,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }" { (expression_statement "pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + offset);" (assignment_expression "pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + offset)" identifier = (cast_expression "(void *)((long)&(id[0xd].pMethods)->iVersion + offset)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)&(id[0xd].pMethods)->iVersion + offset)" ( (binary_expression "(long)&(id[0xd].pMethods)->iVersion + offset" (cast_expression "(long)&(id[0xd].pMethods)->iVersion" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (pointer_expression "&(id[0xd].pMethods)->iVersion" & (field_expression "(id[0xd].pMethods)->iVersion" (parenthesized_expression "(id[0xd].pMethods)" ( (field_expression "id[0xd].pMethods" (subscript_expression "id[0xd]" identifier [ number_literal ]) . field_identifier) )) -> field_identifier))) + identifier) )))) ;) (if_statement "if (amt + offset <= (long)psVar1) {\n      memcpy(pBuf,pvVar6,(long)amt);\n      return 0;\n    }" if (parenthesized_expression "(amt + offset <= (long)psVar1)" ( (binary_expression "amt + offset <= (long)psVar1" (binary_expression "amt + offset" identifier + identifier) <= (cast_expression "(long)psVar1" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )) (compound_statement "{\n      memcpy(pBuf,pvVar6,(long)amt);\n      return 0;\n    }" { (expression_statement "memcpy(pBuf,pvVar6,(long)amt);" (call_expression "memcpy(pBuf,pvVar6,(long)amt)" identifier (argument_list "(pBuf,pvVar6,(long)amt)" ( identifier , identifier , (cast_expression "(long)amt" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) ))) ;) (return_statement "return 0;" return number_literal ;) })) (expression_statement "iVar4 = (int)psVar1 - (int)offset;" (assignment_expression "iVar4 = (int)psVar1 - (int)offset" identifier = (binary_expression "(int)psVar1 - (int)offset" (cast_expression "(int)psVar1" ( (type_descriptor "int" primitive_type) ) identifier) - (cast_expression "(int)offset" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (expression_statement "__n = (size_t)iVar4;" (assignment_expression "__n = (size_t)iVar4" identifier = (cast_expression "(size_t)iVar4" ( (type_descriptor "size_t" primitive_type) ) identifier)) ;) (expression_statement "amt = amt - iVar4;" (assignment_expression "amt = amt - iVar4" identifier = (binary_expression "amt - iVar4" identifier - identifier)) ;) (expression_statement "offset = offset + __n;" (assignment_expression "offset = offset + __n" identifier = (binary_expression "offset + __n" identifier + identifier)) ;) (expression_statement "local_50 = memcpy(pBuf,pvVar6,__n);" (assignment_expression "local_50 = memcpy(pBuf,pvVar6,__n)" identifier = (call_expression "memcpy(pBuf,pvVar6,__n)" identifier (argument_list "(pBuf,pvVar6,__n)" ( identifier , identifier , identifier )))) ;) (expression_statement "local_50 = (void *)((long)local_50 + __n);" (assignment_expression "local_50 = (void *)((long)local_50 + __n)" identifier = (cast_expression "(void *)((long)local_50 + __n)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)local_50 + __n)" ( (binary_expression "(long)local_50 + __n" (cast_expression "(long)local_50" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + identifier) )))) ;) })) (expression_statement "local_48 = (long)amt;" (assignment_expression "local_48 = (long)amt" identifier = (cast_expression "(long)amt" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "iVar5 = 0;" (assignment_expression "iVar5 = 0" identifier = number_literal) ;) (expression_statement "pvVar6 = local_50;" (assignment_expression "pvVar6 = local_50" identifier = identifier) ;) (expression_statement "iVar4 = amt;" (assignment_expression "iVar4 = amt" identifier = identifier) ;) (labeled_statement "LAB_00117b62:\n  do {\n    iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset);\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (amt == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      offset = offset + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)&id[4].pMethods = *piVar3;\n      if (amt != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );" statement_identifier : (do_statement "do {\n    iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset);\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (amt == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      offset = offset + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)&id[4].pMethods = *piVar3;\n      if (amt != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );" do (compound_statement "{\n    iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset);\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (amt == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      offset = offset + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)&id[4].pMethods = *piVar3;\n      if (amt != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  }" { (expression_statement "iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset);" (assignment_expression "iVar2 = (*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset)" identifier = (call_expression "(*aSyscall[10].pCurrent)((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset)" (parenthesized_expression "(*aSyscall[10].pCurrent)" ( (pointer_expression "*aSyscall[10].pCurrent" * (field_expression "aSyscall[10].pCurrent" (subscript_expression "aSyscall[10]" identifier [ number_literal ]) . field_identifier)) )) (argument_list "((ulong)*(uint *)&id[3].pMethods,pvVar6,local_48,offset)" ( (binary_expression "(ulong)*(uint *)&id[3].pMethods" (parenthesized_expression "(ulong)" ( identifier )) * (cast_expression "(uint *)&id[3].pMethods" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&id[3].pMethods" & (field_expression "id[3].pMethods" (subscript_expression "id[3]" identifier [ number_literal ]) . field_identifier)))) , identifier , identifier , identifier )))) ;) (if_statement "if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (amt == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));\n      return 0x20a;\n    }" if (parenthesized_expression "(iVar4 == iVar2)" ( (binary_expression "iVar4 == iVar2" identifier == identifier) )) (compound_statement "{\n      iVar5 = iVar5 + iVar4;\n      if (amt == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));\n      return 0x20a;\n    }" { (expression_statement "iVar5 = iVar5 + iVar4;" (assignment_expression "iVar5 = iVar5 + iVar4" identifier = (binary_expression "iVar5 + iVar4" identifier + identifier)) ;) (if_statement "if (amt == iVar5) {\n        return 0;\n      }" if (parenthesized_expression "(amt == iVar5)" ( (binary_expression "amt == iVar5" identifier == identifier) )) (compound_statement "{\n        return 0;\n      }" { (return_statement "return 0;" return number_literal ;) })) (if_statement "if (iVar5 < 0) {\n        return 0x10a;\n      }" if (parenthesized_expression "(iVar5 < 0)" ( (binary_expression "iVar5 < 0" identifier < number_literal) )) (compound_statement "{\n        return 0x10a;\n      }" { (return_statement "return 0x10a;" return number_literal ;) })) (labeled_statement "LAB_00117c1b:\n      *(undefined4 *)&id[4].pMethods = 0;" statement_identifier : (expression_statement "*(undefined4 *)&id[4].pMethods = 0;" (assignment_expression "*(undefined4 *)&id[4].pMethods = 0" (pointer_expression "*(undefined4 *)&id[4].pMethods" * (cast_expression "(undefined4 *)&id[4].pMethods" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&id[4].pMethods" & (field_expression "id[4].pMethods" (subscript_expression "id[4]" identifier [ number_literal ]) . field_identifier)))) = number_literal) ;)) (expression_statement "memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5));" (call_expression "memset((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5))" identifier (argument_list "((void *)((long)local_50 + (long)iVar5),0,(long)(amt - iVar5))" ( (cast_expression "(void *)((long)local_50 + (long)iVar5)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)local_50 + (long)iVar5)" ( (binary_expression "(long)local_50 + (long)iVar5" (cast_expression "(long)local_50" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar5" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , number_literal , (cast_expression "(long)(amt - iVar5)" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (parenthesized_expression "(amt - iVar5)" ( (binary_expression "amt - iVar5" identifier - identifier) ))) ))) ;) (return_statement "return 0x20a;" return number_literal ;) })) (if_statement "if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      offset = offset + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }" if (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) (compound_statement "{\n      if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      offset = offset + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }" { (if_statement "if (iVar2 == 0) {\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        if (amt == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }" { (if_statement "if (amt == iVar5) {\n          return 0;\n        }" if (parenthesized_expression "(amt == iVar5)" ( (binary_expression "amt == iVar5" identifier == identifier) )) (compound_statement "{\n          return 0;\n        }" { (return_statement "return 0;" return number_literal ;) })) (goto_statement "goto LAB_00117c1b;" goto statement_identifier ;) })) (expression_statement "iVar4 = iVar4 - iVar2;" (assignment_expression "iVar4 = iVar4 - iVar2" identifier = (binary_expression "iVar4 - iVar2" identifier - identifier)) ;) (expression_statement "iVar5 = iVar5 + iVar2;" (assignment_expression "iVar5 = iVar5 + iVar2" identifier = (binary_expression "iVar5 + iVar2" identifier + identifier)) ;) (expression_statement "local_48 = (long)iVar4;" (assignment_expression "local_48 = (long)iVar4" identifier = (cast_expression "(long)iVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "offset = offset + iVar2;" (assignment_expression "offset = offset + iVar2" identifier = (binary_expression "offset + iVar2" identifier + identifier)) ;) (expression_statement "pvVar6 = (void *)((long)pvVar6 + (long)iVar2);" (assignment_expression "pvVar6 = (void *)((long)pvVar6 + (long)iVar2)" identifier = (cast_expression "(void *)((long)pvVar6 + (long)iVar2)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)pvVar6 + (long)iVar2)" ( (binary_expression "(long)pvVar6 + (long)iVar2" (cast_expression "(long)pvVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) ;) (goto_statement "goto LAB_00117b62;" goto statement_identifier ;) })) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (if_statement "if (*piVar3 != 4) {\n      *(int *)&id[4].pMethods = *piVar3;\n      if (amt != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }" if (parenthesized_expression "(*piVar3 != 4)" ( (binary_expression "*piVar3 != 4" (pointer_expression "*piVar3" * identifier) != number_literal) )) (compound_statement "{\n      *(int *)&id[4].pMethods = *piVar3;\n      if (amt != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }" { (expression_statement "*(int *)&id[4].pMethods = *piVar3;" (assignment_expression "*(int *)&id[4].pMethods = *piVar3" (pointer_expression "*(int *)&id[4].pMethods" * (cast_expression "(int *)&id[4].pMethods" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "&id[4].pMethods" & (field_expression "id[4].pMethods" (subscript_expression "id[4]" identifier [ number_literal ]) . field_identifier)))) = (pointer_expression "*piVar3" * identifier)) ;) (if_statement "if (amt != iVar2) {\n        return 0x10a;\n      }" if (parenthesized_expression "(amt != iVar2)" ( (binary_expression "amt != iVar2" identifier != identifier) )) (compound_statement "{\n        return 0x10a;\n      }" { (return_statement "return 0x10a;" return number_literal ;) })) (return_statement "return 0;" return number_literal ;) })) }) while (parenthesized_expression "( true )" ( true )) ;)) })))
(translation_unit "undefined8 FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)\n\n{\n  long lVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  void *pvVar6;\n  size_t __n;\n  void *local_50;\n  long local_48;\n  \n  lVar1 = *(long *)(param_1 + 0x50);\n  local_50 = param_2;\n  if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)param_3;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = param_3;\nLAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}\n\n" (function_definition "undefined8 FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)\n\n{\n  long lVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  void *pvVar6;\n  size_t __n;\n  void *local_50;\n  long local_48;\n  \n  lVar1 = *(long *)(param_1 + 0x50);\n  local_50 = param_2;\n  if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)param_3;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = param_3;\nLAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}" type_identifier (function_declarator "FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)" identifier (parameter_list "(long param_1,void *param_2,int param_3,long param_4)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "void *param_2" primitive_type (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "int param_3" primitive_type identifier) , (parameter_declaration "long param_4" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  long lVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  void *pvVar6;\n  size_t __n;\n  void *local_50;\n  long local_48;\n  \n  lVar1 = *(long *)(param_1 + 0x50);\n  local_50 = param_2;\n  if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)param_3;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = param_3;\nLAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}" { (declaration "long lVar1;" (sized_type_specifier "long" long) identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "void *pvVar6;" primitive_type (pointer_declarator "*pvVar6" * identifier) ;) (declaration "size_t __n;" primitive_type identifier ;) (declaration "void *local_50;" primitive_type (pointer_declarator "*local_50" * identifier) ;) (declaration "long local_48;" (sized_type_specifier "long" long) identifier ;) (expression_statement "lVar1 = *(long *)(param_1 + 0x50);" (assignment_expression "lVar1 = *(long *)(param_1 + 0x50)" identifier = (pointer_expression "*(long *)(param_1 + 0x50)" * (cast_expression "(long *)(param_1 + 0x50)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x50)" ( (binary_expression "param_1 + 0x50" identifier + number_literal) ))))) ;) (expression_statement "local_50 = param_2;" (assignment_expression "local_50 = param_2" identifier = identifier) ;) (if_statement "if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }" if (parenthesized_expression "(param_4 < lVar1)" ( (binary_expression "param_4 < lVar1" identifier < identifier) )) (compound_statement "{\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }" { (expression_statement "pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);" (assignment_expression "pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4)" identifier = (cast_expression "(void *)(*(long *)(param_1 + 0x68) + param_4)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(long *)(param_1 + 0x68) + param_4)" ( (binary_expression "*(long *)(param_1 + 0x68) + param_4" (pointer_expression "*(long *)(param_1 + 0x68)" * (cast_expression "(long *)(param_1 + 0x68)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x68)" ( (binary_expression "param_1 + 0x68" identifier + number_literal) )))) + identifier) )))) ;) (if_statement "if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }" if (parenthesized_expression "(param_3 + param_4 <= lVar1)" ( (binary_expression "param_3 + param_4 <= lVar1" (binary_expression "param_3 + param_4" identifier + identifier) <= identifier) )) (compound_statement "{\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }" { (expression_statement "memcpy(param_2,pvVar6,(long)param_3);" (call_expression "memcpy(param_2,pvVar6,(long)param_3)" identifier (argument_list "(param_2,pvVar6,(long)param_3)" ( identifier , identifier , (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) ))) ;) (return_statement "return 0;" return number_literal ;) })) (expression_statement "iVar4 = (int)lVar1 - (int)param_4;" (assignment_expression "iVar4 = (int)lVar1 - (int)param_4" identifier = (binary_expression "(int)lVar1 - (int)param_4" (cast_expression "(int)lVar1" ( (type_descriptor "int" primitive_type) ) identifier) - (cast_expression "(int)param_4" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (expression_statement "__n = (size_t)iVar4;" (assignment_expression "__n = (size_t)iVar4" identifier = (cast_expression "(size_t)iVar4" ( (type_descriptor "size_t" primitive_type) ) identifier)) ;) (expression_statement "param_3 = param_3 - iVar4;" (assignment_expression "param_3 = param_3 - iVar4" identifier = (binary_expression "param_3 - iVar4" identifier - identifier)) ;) (expression_statement "param_4 = param_4 + __n;" (assignment_expression "param_4 = param_4 + __n" identifier = (binary_expression "param_4 + __n" identifier + identifier)) ;) (expression_statement "local_50 = memcpy(param_2,pvVar6,__n);" (assignment_expression "local_50 = memcpy(param_2,pvVar6,__n)" identifier = (call_expression "memcpy(param_2,pvVar6,__n)" identifier (argument_list "(param_2,pvVar6,__n)" ( identifier , identifier , identifier )))) ;) (expression_statement "local_50 = (void *)((long)local_50 + __n);" (assignment_expression "local_50 = (void *)((long)local_50 + __n)" identifier = (cast_expression "(void *)((long)local_50 + __n)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)local_50 + __n)" ( (binary_expression "(long)local_50 + __n" (cast_expression "(long)local_50" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + identifier) )))) ;) })) (expression_statement "local_48 = (long)param_3;" (assignment_expression "local_48 = (long)param_3" identifier = (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "iVar5 = 0;" (assignment_expression "iVar5 = 0" identifier = number_literal) ;) (expression_statement "pvVar6 = local_50;" (assignment_expression "pvVar6 = local_50" identifier = identifier) ;) (expression_statement "iVar4 = param_3;" (assignment_expression "iVar4 = param_3" identifier = identifier) ;) (labeled_statement "LAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );" statement_identifier : (do_statement "do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );" do (compound_statement "{\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  }" { (expression_statement "iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;" (assignment_expression "iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" identifier = (call_expression "(*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" (parenthesized_expression "(*(code *)PTR_pread64_00221478)" ( (pointer_expression "*(code *)PTR_pread64_00221478" * (cast_expression "(code *)PTR_pread64_00221478" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" ( (pointer_expression "*(undefined4 *)(param_1 + 0x18)" * (cast_expression "(undefined4 *)(param_1 + 0x18)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x18)" ( (binary_expression "param_1 + 0x18" identifier + number_literal) )))) , identifier , identifier , identifier )))) ;) (if_statement "if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }" if (parenthesized_expression "(iVar4 == iVar2)" ( (binary_expression "iVar4 == iVar2" identifier == identifier) )) (compound_statement "{\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }" { (expression_statement "iVar5 = iVar5 + iVar4;" (assignment_expression "iVar5 = iVar5 + iVar4" identifier = (binary_expression "iVar5 + iVar4" identifier + identifier)) ;) (if_statement "if (param_3 == iVar5) {\n        return 0;\n      }" if (parenthesized_expression "(param_3 == iVar5)" ( (binary_expression "param_3 == iVar5" identifier == identifier) )) (compound_statement "{\n        return 0;\n      }" { (return_statement "return 0;" return number_literal ;) })) (if_statement "if (iVar5 < 0) {\n        return 0x10a;\n      }" if (parenthesized_expression "(iVar5 < 0)" ( (binary_expression "iVar5 < 0" identifier < number_literal) )) (compound_statement "{\n        return 0x10a;\n      }" { (return_statement "return 0x10a;" return number_literal ;) })) (labeled_statement "LAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;" statement_identifier : (expression_statement "*(undefined4 *)(param_1 + 0x20) = 0;" (assignment_expression "*(undefined4 *)(param_1 + 0x20) = 0" (pointer_expression "*(undefined4 *)(param_1 + 0x20)" * (cast_expression "(undefined4 *)(param_1 + 0x20)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x20)" ( (binary_expression "param_1 + 0x20" identifier + number_literal) )))) = number_literal) ;)) (expression_statement "memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));" (call_expression "memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5))" identifier (argument_list "((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5))" ( (cast_expression "(void *)((long)local_50 + (long)iVar5)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)local_50 + (long)iVar5)" ( (binary_expression "(long)local_50 + (long)iVar5" (cast_expression "(long)local_50" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar5" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , number_literal , (cast_expression "(long)(param_3 - iVar5)" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (parenthesized_expression "(param_3 - iVar5)" ( (binary_expression "param_3 - iVar5" identifier - identifier) ))) ))) ;) (return_statement "return 0x20a;" return number_literal ;) })) (if_statement "if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }" if (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) (compound_statement "{\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }" { (if_statement "if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }" { (if_statement "if (param_3 == iVar5) {\n          return 0;\n        }" if (parenthesized_expression "(param_3 == iVar5)" ( (binary_expression "param_3 == iVar5" identifier == identifier) )) (compound_statement "{\n          return 0;\n        }" { (return_statement "return 0;" return number_literal ;) })) (goto_statement "goto LAB_00117c1b;" goto statement_identifier ;) })) (expression_statement "iVar4 = iVar4 - iVar2;" (assignment_expression "iVar4 = iVar4 - iVar2" identifier = (binary_expression "iVar4 - iVar2" identifier - identifier)) ;) (expression_statement "iVar5 = iVar5 + iVar2;" (assignment_expression "iVar5 = iVar5 + iVar2" identifier = (binary_expression "iVar5 + iVar2" identifier + identifier)) ;) (expression_statement "local_48 = (long)iVar4;" (assignment_expression "local_48 = (long)iVar4" identifier = (cast_expression "(long)iVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "param_4 = param_4 + iVar2;" (assignment_expression "param_4 = param_4 + iVar2" identifier = (binary_expression "param_4 + iVar2" identifier + identifier)) ;) (expression_statement "pvVar6 = (void *)((long)pvVar6 + (long)iVar2);" (assignment_expression "pvVar6 = (void *)((long)pvVar6 + (long)iVar2)" identifier = (cast_expression "(void *)((long)pvVar6 + (long)iVar2)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)pvVar6 + (long)iVar2)" ( (binary_expression "(long)pvVar6 + (long)iVar2" (cast_expression "(long)pvVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) ;) (goto_statement "goto LAB_00117b62;" goto statement_identifier ;) })) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (if_statement "if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }" if (parenthesized_expression "(*piVar3 != 4)" ( (binary_expression "*piVar3 != 4" (pointer_expression "*piVar3" * identifier) != number_literal) )) (compound_statement "{\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }" { (expression_statement "*(int *)(param_1 + 0x20) = *piVar3;" (assignment_expression "*(int *)(param_1 + 0x20) = *piVar3" (pointer_expression "*(int *)(param_1 + 0x20)" * (cast_expression "(int *)(param_1 + 0x20)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x20)" ( (binary_expression "param_1 + 0x20" identifier + number_literal) )))) = (pointer_expression "*piVar3" * identifier)) ;) (if_statement "if (param_3 != iVar2) {\n        return 0x10a;\n      }" if (parenthesized_expression "(param_3 != iVar2)" ( (binary_expression "param_3 != iVar2" identifier != identifier) )) (compound_statement "{\n        return 0x10a;\n      }" { (return_statement "return 0x10a;" return number_literal ;) })) (return_statement "return 0;" return number_literal ;) })) }) while (parenthesized_expression "( true )" ( true )) ;)) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) ))) (compound_statement { (declaration (sized_type_specifier long) IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration (sized_type_specifier long) IDENT ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) + IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT + IDENT) <= IDENT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) ))) ;) (return_statement return LIT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) - (cast_expression ( (type_descriptor TYPE) ) IDENT))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT )))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + IDENT) )))) ;) })) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (labeled_statement statement_identifier : (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) , IDENT , IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == IDENT) )) (compound_statement { (return_statement return LIT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (return_statement return LIT ;) })) (labeled_statement statement_identifier : (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = LIT) ;)) (expression_statement (call_expression IDENT (argument_list ( (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) ))) , LIT , (cast_expression ( (type_descriptor (sized_type_specifier long)) ) (parenthesized_expression ( (binary_expression IDENT - IDENT) ))) ))) ;) (return_statement return LIT ;) })) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == IDENT) )) (compound_statement { (return_statement return LIT ;) })) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) )))) ;) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) != LIT) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = (pointer_expression * IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != IDENT) )) (compound_statement { (return_statement return LIT ;) })) (return_statement return LIT ;) })) }) while (parenthesized_expression ( BOOL )) ;)) })))
(function_definition "undefined8 FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)\n\n{\n  long lVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  void *pvVar6;\n  size_t __n;\n  void *local_50;\n  long local_48;\n  \n  lVar1 = *(long *)(param_1 + 0x50);\n  local_50 = param_2;\n  if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)param_3;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = param_3;\nLAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}" (type_identifier "undefined8") (function_declarator "FUN_00117af0(long param_1,void *param_2,int param_3,long param_4)" (identifier "FUN_00117af0") (parameter_list "(long param_1,void *param_2,int param_3,long param_4)" (( "(") (parameter_declaration "long param_1" (sized_type_specifier "long" (long "long")) (identifier "param_1")) (, ",") (parameter_declaration "void *param_2" (primitive_type "void") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) (, ",") (parameter_declaration "int param_3" (primitive_type "int") (identifier "param_3")) (, ",") (parameter_declaration "long param_4" (sized_type_specifier "long" (long "long")) (identifier "param_4")) () ")"))) (compound_statement "{\n  long lVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int iVar5;\n  void *pvVar6;\n  size_t __n;\n  void *local_50;\n  long local_48;\n  \n  lVar1 = *(long *)(param_1 + 0x50);\n  local_50 = param_2;\n  if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }\n  local_48 = (long)param_3;\n  iVar5 = 0;\n  pvVar6 = local_50;\n  iVar4 = param_3;\nLAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );\n}" ({ "{") (declaration "long lVar1;" (sized_type_specifier "long" (long "long")) (identifier "lVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "int *piVar3;" (primitive_type "int") (pointer_declarator "*piVar3" (* "*") (identifier "piVar3")) (; ";")) (declaration "int iVar4;" (primitive_type "int") (identifier "iVar4") (; ";")) (declaration "int iVar5;" (primitive_type "int") (identifier "iVar5") (; ";")) (declaration "void *pvVar6;" (primitive_type "void") (pointer_declarator "*pvVar6" (* "*") (identifier "pvVar6")) (; ";")) (declaration "size_t __n;" (primitive_type "size_t") (identifier "__n") (; ";")) (declaration "void *local_50;" (primitive_type "void") (pointer_declarator "*local_50" (* "*") (identifier "local_50")) (; ";")) (declaration "long local_48;" (sized_type_specifier "long" (long "long")) (identifier "local_48") (; ";")) (expression_statement "lVar1 = *(long *)(param_1 + 0x50);" (assignment_expression "lVar1 = *(long *)(param_1 + 0x50)" (identifier "lVar1") (= "=") (pointer_expression "*(long *)(param_1 + 0x50)" (* "*") (cast_expression "(long *)(param_1 + 0x50)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x50)" (( "(") (binary_expression "param_1 + 0x50" (identifier "param_1") (+ "+") (number_literal "0x50")) () ")"))))) (; ";")) (expression_statement "local_50 = param_2;" (assignment_expression "local_50 = param_2" (identifier "local_50") (= "=") (identifier "param_2")) (; ";")) (if_statement "if (param_4 < lVar1) {\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }" (if "if") (parenthesized_expression "(param_4 < lVar1)" (( "(") (binary_expression "param_4 < lVar1" (identifier "param_4") (< "<") (identifier "lVar1")) () ")")) (compound_statement "{\n    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);\n    if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }\n    iVar4 = (int)lVar1 - (int)param_4;\n    __n = (size_t)iVar4;\n    param_3 = param_3 - iVar4;\n    param_4 = param_4 + __n;\n    local_50 = memcpy(param_2,pvVar6,__n);\n    local_50 = (void *)((long)local_50 + __n);\n  }" ({ "{") (expression_statement "pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);" (assignment_expression "pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4)" (identifier "pvVar6") (= "=") (cast_expression "(void *)(*(long *)(param_1 + 0x68) + param_4)" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(*(long *)(param_1 + 0x68) + param_4)" (( "(") (binary_expression "*(long *)(param_1 + 0x68) + param_4" (pointer_expression "*(long *)(param_1 + 0x68)" (* "*") (cast_expression "(long *)(param_1 + 0x68)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x68)" (( "(") (binary_expression "param_1 + 0x68" (identifier "param_1") (+ "+") (number_literal "0x68")) () ")")))) (+ "+") (identifier "param_4")) () ")")))) (; ";")) (if_statement "if (param_3 + param_4 <= lVar1) {\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }" (if "if") (parenthesized_expression "(param_3 + param_4 <= lVar1)" (( "(") (binary_expression "param_3 + param_4 <= lVar1" (binary_expression "param_3 + param_4" (identifier "param_3") (+ "+") (identifier "param_4")) (<= "<=") (identifier "lVar1")) () ")")) (compound_statement "{\n      memcpy(param_2,pvVar6,(long)param_3);\n      return 0;\n    }" ({ "{") (expression_statement "memcpy(param_2,pvVar6,(long)param_3);" (call_expression "memcpy(param_2,pvVar6,(long)param_3)" (identifier "memcpy") (argument_list "(param_2,pvVar6,(long)param_3)" (( "(") (identifier "param_2") (, ",") (identifier "pvVar6") (, ",") (cast_expression "(long)param_3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "param_3")) () ")"))) (; ";")) (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}"))) (expression_statement "iVar4 = (int)lVar1 - (int)param_4;" (assignment_expression "iVar4 = (int)lVar1 - (int)param_4" (identifier "iVar4") (= "=") (binary_expression "(int)lVar1 - (int)param_4" (cast_expression "(int)lVar1" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "lVar1")) (- "-") (cast_expression "(int)param_4" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_4")))) (; ";")) (expression_statement "__n = (size_t)iVar4;" (assignment_expression "__n = (size_t)iVar4" (identifier "__n") (= "=") (cast_expression "(size_t)iVar4" (( "(") (type_descriptor "size_t" (primitive_type "size_t")) () ")") (identifier "iVar4"))) (; ";")) (expression_statement "param_3 = param_3 - iVar4;" (assignment_expression "param_3 = param_3 - iVar4" (identifier "param_3") (= "=") (binary_expression "param_3 - iVar4" (identifier "param_3") (- "-") (identifier "iVar4"))) (; ";")) (expression_statement "param_4 = param_4 + __n;" (assignment_expression "param_4 = param_4 + __n" (identifier "param_4") (= "=") (binary_expression "param_4 + __n" (identifier "param_4") (+ "+") (identifier "__n"))) (; ";")) (expression_statement "local_50 = memcpy(param_2,pvVar6,__n);" (assignment_expression "local_50 = memcpy(param_2,pvVar6,__n)" (identifier "local_50") (= "=") (call_expression "memcpy(param_2,pvVar6,__n)" (identifier "memcpy") (argument_list "(param_2,pvVar6,__n)" (( "(") (identifier "param_2") (, ",") (identifier "pvVar6") (, ",") (identifier "__n") () ")")))) (; ";")) (expression_statement "local_50 = (void *)((long)local_50 + __n);" (assignment_expression "local_50 = (void *)((long)local_50 + __n)" (identifier "local_50") (= "=") (cast_expression "(void *)((long)local_50 + __n)" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((long)local_50 + __n)" (( "(") (binary_expression "(long)local_50 + __n" (cast_expression "(long)local_50" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "local_50")) (+ "+") (identifier "__n")) () ")")))) (; ";")) (} "}"))) (expression_statement "local_48 = (long)param_3;" (assignment_expression "local_48 = (long)param_3" (identifier "local_48") (= "=") (cast_expression "(long)param_3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "param_3"))) (; ";")) (expression_statement "iVar5 = 0;" (assignment_expression "iVar5 = 0" (identifier "iVar5") (= "=") (number_literal "0")) (; ";")) (expression_statement "pvVar6 = local_50;" (assignment_expression "pvVar6 = local_50" (identifier "pvVar6") (= "=") (identifier "local_50")) (; ";")) (expression_statement "iVar4 = param_3;" (assignment_expression "iVar4 = param_3" (identifier "iVar4") (= "=") (identifier "param_3")) (; ";")) (labeled_statement "LAB_00117b62:\n  do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );" (statement_identifier "LAB_00117b62") (: ":") (do_statement "do {\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  } while( true );" (do "do") (compound_statement "{\n    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;\n    if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }\n    if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }\n    piVar3 = __errno_location();\n    if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }\n  }" ({ "{") (expression_statement "iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)\n    ;" (assignment_expression "iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" (identifier "iVar2") (= "=") (call_expression "(*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" (parenthesized_expression "(*(code *)PTR_pread64_00221478)" (( "(") (pointer_expression "*(code *)PTR_pread64_00221478" (* "*") (cast_expression "(code *)PTR_pread64_00221478" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_pread64_00221478"))) () ")")) (argument_list "(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)" (( "(") (pointer_expression "*(undefined4 *)(param_1 + 0x18)" (* "*") (cast_expression "(undefined4 *)(param_1 + 0x18)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x18)" (( "(") (binary_expression "param_1 + 0x18" (identifier "param_1") (+ "+") (number_literal "0x18")) () ")")))) (, ",") (identifier "pvVar6") (, ",") (identifier "local_48") (, ",") (identifier "param_4") () ")")))) (; ";")) (if_statement "if (iVar4 == iVar2) {\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }" (if "if") (parenthesized_expression "(iVar4 == iVar2)" (( "(") (binary_expression "iVar4 == iVar2" (identifier "iVar4") (== "==") (identifier "iVar2")) () ")")) (compound_statement "{\n      iVar5 = iVar5 + iVar4;\n      if (param_3 == iVar5) {\n        return 0;\n      }\n      if (iVar5 < 0) {\n        return 0x10a;\n      }\nLAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;\n      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));\n      return 0x20a;\n    }" ({ "{") (expression_statement "iVar5 = iVar5 + iVar4;" (assignment_expression "iVar5 = iVar5 + iVar4" (identifier "iVar5") (= "=") (binary_expression "iVar5 + iVar4" (identifier "iVar5") (+ "+") (identifier "iVar4"))) (; ";")) (if_statement "if (param_3 == iVar5) {\n        return 0;\n      }" (if "if") (parenthesized_expression "(param_3 == iVar5)" (( "(") (binary_expression "param_3 == iVar5" (identifier "param_3") (== "==") (identifier "iVar5")) () ")")) (compound_statement "{\n        return 0;\n      }" ({ "{") (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}"))) (if_statement "if (iVar5 < 0) {\n        return 0x10a;\n      }" (if "if") (parenthesized_expression "(iVar5 < 0)" (( "(") (binary_expression "iVar5 < 0" (identifier "iVar5") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n        return 0x10a;\n      }" ({ "{") (return_statement "return 0x10a;" (return "return") (number_literal "0x10a") (; ";")) (} "}"))) (labeled_statement "LAB_00117c1b:\n      *(undefined4 *)(param_1 + 0x20) = 0;" (statement_identifier "LAB_00117c1b") (: ":") (expression_statement "*(undefined4 *)(param_1 + 0x20) = 0;" (assignment_expression "*(undefined4 *)(param_1 + 0x20) = 0" (pointer_expression "*(undefined4 *)(param_1 + 0x20)" (* "*") (cast_expression "(undefined4 *)(param_1 + 0x20)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x20)" (( "(") (binary_expression "param_1 + 0x20" (identifier "param_1") (+ "+") (number_literal "0x20")) () ")")))) (= "=") (number_literal "0")) (; ";"))) (expression_statement "memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));" (call_expression "memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5))" (identifier "memset") (argument_list "((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5))" (( "(") (cast_expression "(void *)((long)local_50 + (long)iVar5)" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((long)local_50 + (long)iVar5)" (( "(") (binary_expression "(long)local_50 + (long)iVar5" (cast_expression "(long)local_50" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "local_50")) (+ "+") (cast_expression "(long)iVar5" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar5"))) () ")"))) (, ",") (number_literal "0") (, ",") (cast_expression "(long)(param_3 - iVar5)" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (parenthesized_expression "(param_3 - iVar5)" (( "(") (binary_expression "param_3 - iVar5" (identifier "param_3") (- "-") (identifier "iVar5")) () ")"))) () ")"))) (; ";")) (return_statement "return 0x20a;" (return "return") (number_literal "0x20a") (; ";")) (} "}"))) (if_statement "if (-1 < iVar2) {\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }" (if "if") (parenthesized_expression "(-1 < iVar2)" (( "(") (binary_expression "-1 < iVar2" (number_literal "-1") (< "<") (identifier "iVar2")) () ")")) (compound_statement "{\n      if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }\n      iVar4 = iVar4 - iVar2;\n      iVar5 = iVar5 + iVar2;\n      local_48 = (long)iVar4;\n      param_4 = param_4 + iVar2;\n      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);\n      goto LAB_00117b62;\n    }" ({ "{") (if_statement "if (iVar2 == 0) {\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }" (if "if") (parenthesized_expression "(iVar2 == 0)" (( "(") (binary_expression "iVar2 == 0" (identifier "iVar2") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        if (param_3 == iVar5) {\n          return 0;\n        }\n        goto LAB_00117c1b;\n      }" ({ "{") (if_statement "if (param_3 == iVar5) {\n          return 0;\n        }" (if "if") (parenthesized_expression "(param_3 == iVar5)" (( "(") (binary_expression "param_3 == iVar5" (identifier "param_3") (== "==") (identifier "iVar5")) () ")")) (compound_statement "{\n          return 0;\n        }" ({ "{") (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}"))) (goto_statement "goto LAB_00117c1b;" (goto "goto") (statement_identifier "LAB_00117c1b") (; ";")) (} "}"))) (expression_statement "iVar4 = iVar4 - iVar2;" (assignment_expression "iVar4 = iVar4 - iVar2" (identifier "iVar4") (= "=") (binary_expression "iVar4 - iVar2" (identifier "iVar4") (- "-") (identifier "iVar2"))) (; ";")) (expression_statement "iVar5 = iVar5 + iVar2;" (assignment_expression "iVar5 = iVar5 + iVar2" (identifier "iVar5") (= "=") (binary_expression "iVar5 + iVar2" (identifier "iVar5") (+ "+") (identifier "iVar2"))) (; ";")) (expression_statement "local_48 = (long)iVar4;" (assignment_expression "local_48 = (long)iVar4" (identifier "local_48") (= "=") (cast_expression "(long)iVar4" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar4"))) (; ";")) (expression_statement "param_4 = param_4 + iVar2;" (assignment_expression "param_4 = param_4 + iVar2" (identifier "param_4") (= "=") (binary_expression "param_4 + iVar2" (identifier "param_4") (+ "+") (identifier "iVar2"))) (; ";")) (expression_statement "pvVar6 = (void *)((long)pvVar6 + (long)iVar2);" (assignment_expression "pvVar6 = (void *)((long)pvVar6 + (long)iVar2)" (identifier "pvVar6") (= "=") (cast_expression "(void *)((long)pvVar6 + (long)iVar2)" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((long)pvVar6 + (long)iVar2)" (( "(") (binary_expression "(long)pvVar6 + (long)iVar2" (cast_expression "(long)pvVar6" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "pvVar6")) (+ "+") (cast_expression "(long)iVar2" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar2"))) () ")")))) (; ";")) (goto_statement "goto LAB_00117b62;" (goto "goto") (statement_identifier "LAB_00117b62") (; ";")) (} "}"))) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" (identifier "piVar3") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (if_statement "if (*piVar3 != 4) {\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }" (if "if") (parenthesized_expression "(*piVar3 != 4)" (( "(") (binary_expression "*piVar3 != 4" (pointer_expression "*piVar3" (* "*") (identifier "piVar3")) (!= "!=") (number_literal "4")) () ")")) (compound_statement "{\n      *(int *)(param_1 + 0x20) = *piVar3;\n      if (param_3 != iVar2) {\n        return 0x10a;\n      }\n      return 0;\n    }" ({ "{") (expression_statement "*(int *)(param_1 + 0x20) = *piVar3;" (assignment_expression "*(int *)(param_1 + 0x20) = *piVar3" (pointer_expression "*(int *)(param_1 + 0x20)" (* "*") (cast_expression "(int *)(param_1 + 0x20)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x20)" (( "(") (binary_expression "param_1 + 0x20" (identifier "param_1") (+ "+") (number_literal "0x20")) () ")")))) (= "=") (pointer_expression "*piVar3" (* "*") (identifier "piVar3"))) (; ";")) (if_statement "if (param_3 != iVar2) {\n        return 0x10a;\n      }" (if "if") (parenthesized_expression "(param_3 != iVar2)" (( "(") (binary_expression "param_3 != iVar2" (identifier "param_3") (!= "!=") (identifier "iVar2")) () ")")) (compound_statement "{\n        return 0x10a;\n      }" ({ "{") (return_statement "return 0x10a;" (return "return") (number_literal "0x10a") (; ";")) (} "}"))) (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}"))) (} "}")) (while "while") (parenthesized_expression "( true )" (( "(") (true "true") () ")")) (; ";"))) (} "}")))

int function_1(type_1 *id,void *pBuf,int var_2,type_2 var_1)

{
  type_3 *psVar1;
  int var_6;
  int *piVar3;
  int var_4;
  int var_7;
  size_t var_5;
  void *pvVar6;
  void *local_50;
  long local_48;
  
  psVar1 = id[10].pMethods;
  local_50 = pBuf;
  if (var_1 < (long)psVar1) {
    pvVar6 = (void *)((long)&(id[0xd].pMethods)->iVersion + var_1);
    if (var_2 + var_1 <= (long)psVar1) {
      var_3(pBuf,pvVar6,(long)var_2);
      return 0;
    }
    var_4 = (int)psVar1 - (int)var_1;
    var_5 = (size_t)var_4;
    var_2 = var_2 - var_4;
    var_1 = var_1 + var_5;
    local_50 = var_3(pBuf,pvVar6,var_5);
    local_50 = (void *)((long)local_50 + var_5);
  }
  local_48 = (long)var_2;
  var_7 = 0;
  pvVar6 = local_50;
  var_4 = var_2;
LAB_00117b62:
  do {
    var_6 = (*aSyscall[10].pCurrent)((ulong)*(type_4 *)&id[3].pMethods,pvVar6,local_48,var_1);
    if (var_4 == var_6) {
      var_7 = var_7 + var_4;
      if (var_2 == var_7) {
        return 0;
      }
      if (var_7 < 0) {
        return 0x10a;
      }
LAB_00117c1b:
      *(type_5 *)&id[4].pMethods = 0;
      var_8((void *)((long)local_50 + (long)var_7),0,(long)(var_2 - var_7));
      return 0x20a;
    }
    if (-1 < var_6) {
      if (var_6 == 0) {
        if (var_2 == var_7) {
          return 0;
        }
        goto LAB_00117c1b;
      }
      var_4 = var_4 - var_6;
      var_7 = var_7 + var_6;
      local_48 = (long)var_4;
      var_1 = var_1 + var_6;
      pvVar6 = (void *)((long)pvVar6 + (long)var_6);
      goto LAB_00117b62;
    }
    piVar3 = var_9();
    if (*piVar3 != 4) {
      *(int *)&id[4].pMethods = *piVar3;
      if (var_2 != var_6) {
        return 0x10a;
      }
      return 0;
    }
  } while( true );
}


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

undefined8 MASKED(long param_1,void *param_2,int param_3,long param_4)

{
  long lVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  void *pvVar6;
  size_t __n;
  void *local_50;
  long local_48;
  
  lVar1 = *(long *)(param_1 + 0x50);
  local_50 = param_2;
  if (param_4 < lVar1) {
    pvVar6 = (void *)(*(long *)(param_1 + 0x68) + param_4);
    if (param_3 + param_4 <= lVar1) {
      memcpy(param_2,pvVar6,(long)param_3);
      return 0;
    }
    iVar4 = (int)lVar1 - (int)param_4;
    __n = (size_t)iVar4;
    param_3 = param_3 - iVar4;
    param_4 = param_4 + __n;
    local_50 = memcpy(param_2,pvVar6,__n);
    local_50 = (void *)((long)local_50 + __n);
  }
  local_48 = (long)param_3;
  iVar5 = 0;
  pvVar6 = local_50;
  iVar4 = param_3;
LAB_00117b62:
  do {
    iVar2 = (*(code *)PTR_pread64_00221478)(*(undefined4 *)(param_1 + 0x18),pvVar6,local_48,param_4)
    ;
    if (iVar4 == iVar2) {
      iVar5 = iVar5 + iVar4;
      if (param_3 == iVar5) {
        return 0;
      }
      if (iVar5 < 0) {
        return 0x10a;
      }
LAB_00117c1b:
      *(undefined4 *)(param_1 + 0x20) = 0;
      memset((void *)((long)local_50 + (long)iVar5),0,(long)(param_3 - iVar5));
      return 0x20a;
    }
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (param_3 == iVar5) {
          return 0;
        }
        goto LAB_00117c1b;
      }
      iVar4 = iVar4 - iVar2;
      iVar5 = iVar5 + iVar2;
      local_48 = (long)iVar4;
      param_4 = param_4 + iVar2;
      pvVar6 = (void *)((long)pvVar6 + (long)iVar2);
      goto LAB_00117b62;
    }
    piVar3 = __errno_location();
    if (*piVar3 != 4) {
      *(int *)(param_1 + 0x20) = *piVar3;
      if (param_3 != iVar2) {
        return 0x10a;
      }
      return 0;
    }
  } while( true );
}

