
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

int __regparm3 unixLockSharedMemory(unixFile *pDbFd,unixShmNode *pShmNode)

{
  int iVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int in_GS_OFFSET;
  flock lock;
  flock f;
  
  iVar4 = 0xf0a;
  iVar1 = *(int *)(in_GS_OFFSET + 0x14);
  lock.l_start._0_4_ = 0x80;
  lock.l_start._4_4_ = 0;
  lock.l_len._0_4_ = 1;
  lock.l_len._4_4_ = 0;
  lock.l_type = 1;
  lock.l_whence = 0;
  iVar2 = (*aSyscall[7].pCurrent)(pShmNode->hShm,0xc,&lock);
  if (iVar2 != 0) goto LAB_00039f01;
  if (lock.l_type == 2) {
    if (pShmNode->isReadonly != '\0') {
      pShmNode->isUnlocked = '\x01';
      iVar4 = 0x508;
      goto LAB_00039f01;
    }
    iVar4 = pDbFd->pInode->pShmNode->hShm;
    if (-1 < iVar4) {
      f.l_type = 1;
      f.l_whence = 0;
      f.l_start._0_4_ = 0x80;
      f.l_start._4_4_ = 0;
      f.l_len._0_4_ = 1;
      f.l_len._4_4_ = 0;
      iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);
      if (iVar4 == -1) goto LAB_0003a000;
    }
    iVar4 = pShmNode->hShm;
    do {
      iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);
      if (-1 < iVar2) {
        if (iVar2 == 0) goto LAB_00039ead;
        break;
      }
      piVar3 = __errno_location();
    } while (*piVar3 == 4);
    iVar4 = unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483);
    if (iVar4 != 0) goto LAB_00039f01;
  }
  else if (lock.l_type == 1) {
LAB_0003a000:
    iVar4 = 5;
    goto LAB_00039f01;
  }
LAB_00039ead:
  iVar2 = pDbFd->pInode->pShmNode->hShm;
  iVar4 = 0;
  if (-1 < iVar2) {
    f.l_type = 0;
    f.l_whence = 0;
    f.l_start._0_4_ = 0x80;
    f.l_start._4_4_ = 0;
    f.l_len._0_4_ = 1;
    f.l_len._4_4_ = 0;
    iVar2 = (*aSyscall[7].pCurrent)(iVar2,0xd,&f);
    if (iVar2 == -1) {
      iVar4 = 5;
    }
  }
LAB_00039f01:
  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail_local();
  }
  return iVar4;
}



/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

int __regparm3 FUN_00039e30(int param_1,int param_2)

{
  undefined4 uVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int in_GS_OFFSET;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  int local_20;
  undefined4 uStack_14;
  
  uStack_14 = 0x39e3d;
  iVar4 = 0xf0a;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_4c = 0x80;
  local_48 = 0;
  local_44 = 1;
  local_40 = 0;
  local_50 = 1;
  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);
  if (iVar2 != 0) goto LAB_00039f01;
  if ((short)local_50 == 2) {
    if (*(char *)(param_2 + 0x16) != '\0') {
      *(undefined1 *)(param_2 + 0x17) = 1;
      iVar4 = 0x508;
      goto LAB_00039f01;
    }
    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);
    if (-1 < iVar4) {
      local_38 = 1;
      local_34 = 0x80;
      local_30 = 0;
      local_2c = 1;
      local_28 = 0;
      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);
      if (iVar4 == -1) goto LAB_0003a000;
    }
    uVar1 = *(undefined4 *)(param_2 + 0xc);
    do {
      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);
      if (-1 < iVar4) {
        if (iVar4 == 0) goto LAB_00039ead;
        break;
      }
      piVar3 = __errno_location();
    } while (*piVar3 == 4);
    iVar4 = FUN_00039de0(0x9483);
    if (iVar4 != 0) goto LAB_00039f01;
  }
  else if ((short)local_50 == 1) {
LAB_0003a000:
    iVar4 = 5;
    goto LAB_00039f01;
  }
LAB_00039ead:
  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);
  iVar4 = 0;
  if (-1 < iVar2) {
    local_38 = 0;
    local_34 = 0x80;
    local_30 = 0;
    local_2c = 1;
    local_28 = 0;
    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);
    if (iVar2 == -1) {
      iVar4 = 5;
    }
  }
LAB_00039f01:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    FUN_000d1450();
  }
  return iVar4;
}


PUSH EBP
PUSH EDI
MOV EBP,EAX
PUSH ESI
PUSH EBX
MOV EDI,EDX
CALL 0x0001ddf0
ADD EBX,0xcc1c3
SUB ESP,0x60
MOV ESI,0xf0a
MOV EAX,GS:[0x14]
MOV dword ptr [ESP + 0x50],EAX
XOR EAX,EAX
LEA EAX,[ESP + 0x20]
MOV dword ptr [ESP + 0x24],0x80
MOV dword ptr [ESP + 0x28],0x0
MOV dword ptr [ESP + 0x2c],0x1
MOV dword ptr [ESP + 0x30],0x0
MOV dword ptr [ESP + 0x20],0x1
PUSH EAX
PUSH 0xc
PUSH dword ptr [EDX + 0xc]
CALL dword ptr [EBX + 0x1498]
ADD ESP,0x10
TEST EAX,EAX
JNZ 0x00039f01
MOV ESI,EAX
MOVZX EAX,word ptr [ESP + 0x1c]
CMP AX,0x2
JZ 0x00039f20
CMP AX,0x1
JZ 0x0003a000
MOV EAX,dword ptr [EBP + 0x8]
MOV EAX,dword ptr [EAX + 0x28]
MOV EAX,dword ptr [EAX + 0xc]
TEST EAX,EAX
JS 0x00039f01
MOV dword ptr [ESP + 0x34],0x0
MOV dword ptr [ESP + 0x38],0x80
SUB ESP,0x4
MOV dword ptr [ESP + 0x40],0x0
MOV dword ptr [ESP + 0x44],0x1
MOV dword ptr [ESP + 0x48],0x0
LEA EDX,[ESP + 0x38]
PUSH EDX
PUSH 0xd
PUSH EAX
CALL dword ptr [EBX + 0x1498]
ADD ESP,0x10
CMP EAX,-0x1
MOV EAX,0x5
CMOVZ ESI,EAX
MOV ECX,dword ptr [ESP + 0x4c]
XOR ECX,dword ptr GS:[0x14]
MOV EAX,ESI
JNZ 0x0003a00a
ADD ESP,0x5c
POP EBX
POP ESI
POP EDI
POP EBP
RET
CMP byte ptr [EDI + 0x16],0x0
JNZ 0x00039ff0
MOV EAX,dword ptr [EBP + 0x8]
MOV EAX,dword ptr [EAX + 0x28]
MOV EAX,dword ptr [EAX + 0xc]
TEST EAX,EAX
JS 0x00039f7c
MOV dword ptr [ESP + 0x34],0x1
MOV dword ptr [ESP + 0x38],0x80
SUB ESP,0x4
MOV dword ptr [ESP + 0x40],0x0
MOV dword ptr [ESP + 0x44],0x1
MOV dword ptr [ESP + 0x48],0x0
LEA EDX,[ESP + 0x38]
PUSH EDX
PUSH 0xd
PUSH EAX
CALL dword ptr [EBX + 0x1498]
ADD ESP,0x10
CMP EAX,-0x1
JZ 0x0003a000
MOV EAX,dword ptr [EDI + 0xc]
MOV dword ptr [ESP + 0x8],EAX
LEA EAX,[0x1440]
MOV dword ptr [ESP + 0xc],EAX
JMP 0x00039f9a
CALL 0x00016900
CMP dword ptr [EAX],0x4
JNZ 0x00039fc0
SUB ESP,0x4
PUSH 0x0
PUSH 0x3
PUSH dword ptr [ESP + 0x14]
MOV EAX,dword ptr [ESP + 0x1c]
CALL dword ptr [EAX + EBX*0x1 + 0x4c]
ADD ESP,0x10
TEST EAX,EAX
JS 0x00039f90
JZ 0x00039ead
LEA ESI,[ESI]
SUB ESP,0xc
MOV ECX,dword ptr [EDI + 0x8]
LEA EDX,[EBX + 0xfffcb70c]
PUSH 0x9483
MOV EAX,0x120a
CALL 0x00039de0
ADD ESP,0x10
TEST EAX,EAX
JZ 0x00039ead
MOV ESI,EAX
JMP 0x00039f01
MOV byte ptr [EDI + 0x17],0x1
MOV ESI,0x508
JMP 0x00039f01
MOV ESI,0x5
JMP 0x00039f01
CALL 0x000d1450
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint __regparm3 FUN_00039e30(int param_1,int param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  undefined4 local_50;\n  undefined4 local_4c;\n  undefined4 local_48;\n  undefined4 local_44;\n  undefined4 local_40;\n  undefined4 local_38;\n  undefined4 local_34;\n  undefined4 local_30;\n  undefined4 local_2c;\n  undefined4 local_28;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x39e3d;\n  iVar4 = 0xf0a;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  local_4c = 0x80;\n  local_48 = 0;\n  local_44 = 1;\n  local_40 = 0;\n  local_50 = 1;\n  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_000d1450();\n  }\n  return iVar4;\n}\n\n" comment (function_definition "int __regparm3 FUN_00039e30(int param_1,int param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  undefined4 local_50;\n  undefined4 local_4c;\n  undefined4 local_48;\n  undefined4 local_44;\n  undefined4 local_40;\n  undefined4 local_38;\n  undefined4 local_34;\n  undefined4 local_30;\n  undefined4 local_2c;\n  undefined4 local_28;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x39e3d;\n  iVar4 = 0xf0a;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  local_4c = 0x80;\n  local_48 = 0;\n  local_44 = 1;\n  local_40 = 0;\n  local_50 = 1;\n  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_000d1450();\n  }\n  return iVar4;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "FUN_00039e30(int param_1,int param_2)" identifier (parameter_list "(int param_1,int param_2)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "int param_2" primitive_type identifier) ))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  undefined4 local_50;\n  undefined4 local_4c;\n  undefined4 local_48;\n  undefined4 local_44;\n  undefined4 local_40;\n  undefined4 local_38;\n  undefined4 local_34;\n  undefined4 local_30;\n  undefined4 local_2c;\n  undefined4 local_28;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x39e3d;\n  iVar4 = 0xf0a;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  local_4c = 0x80;\n  local_48 = 0;\n  local_44 = 1;\n  local_40 = 0;\n  local_50 = 1;\n  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_000d1450();\n  }\n  return iVar4;\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "undefined4 local_50;" type_identifier identifier ;) (declaration "undefined4 local_4c;" type_identifier identifier ;) (declaration "undefined4 local_48;" type_identifier identifier ;) (declaration "undefined4 local_44;" type_identifier identifier ;) (declaration "undefined4 local_40;" type_identifier identifier ;) (declaration "undefined4 local_38;" type_identifier identifier ;) (declaration "undefined4 local_34;" type_identifier identifier ;) (declaration "undefined4 local_30;" type_identifier identifier ;) (declaration "undefined4 local_2c;" type_identifier identifier ;) (declaration "undefined4 local_28;" type_identifier identifier ;) (declaration "int local_20;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x39e3d;" (assignment_expression "uStack_14 = 0x39e3d" identifier = number_literal) ;) (expression_statement "iVar4 = 0xf0a;" (assignment_expression "iVar4 = 0xf0a" identifier = number_literal) ;) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "local_4c = 0x80;" (assignment_expression "local_4c = 0x80" identifier = number_literal) ;) (expression_statement "local_48 = 0;" (assignment_expression "local_48 = 0" identifier = number_literal) ;) (expression_statement "local_44 = 1;" (assignment_expression "local_44 = 1" identifier = number_literal) ;) (expression_statement "local_40 = 0;" (assignment_expression "local_40 = 0" identifier = number_literal) ;) (expression_statement "local_50 = 1;" (assignment_expression "local_50 = 1" identifier = number_literal) ;) (expression_statement "iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);" (assignment_expression "iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" identifier = (call_expression "(*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" ( (pointer_expression "*(code *)PTR_fcntl_00107498" * (cast_expression "(code *)PTR_fcntl_00107498" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" ( (pointer_expression "*(undefined4 *)(param_2 + 0xc)" * (cast_expression "(undefined4 *)(param_2 + 0xc)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + 0xc)" ( (binary_expression "param_2 + 0xc" identifier + number_literal) )))) , number_literal , (pointer_expression "&local_50" & identifier) )))) ;) (if_statement "if (iVar2 != 0) goto LAB_00039f01;" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;)) (if_statement "if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" if (parenthesized_expression "((short)local_50 == 2)" ( (binary_expression "(short)local_50 == 2" (cast_expression "(short)local_50" ( (type_descriptor "short" (sized_type_specifier "short" short)) ) identifier) == number_literal) )) (compound_statement "{\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }" { (if_statement "if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }" if (parenthesized_expression "(*(char *)(param_2 + 0x16) != '\0')" ( (binary_expression "*(char *)(param_2 + 0x16) != '\0'" (pointer_expression "*(char *)(param_2 + 0x16)" * (cast_expression "(char *)(param_2 + 0x16)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + 0x16)" ( (binary_expression "param_2 + 0x16" identifier + number_literal) )))) != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }" { (expression_statement "*(undefined1 *)(param_2 + 0x17) = 1;" (assignment_expression "*(undefined1 *)(param_2 + 0x17) = 1" (pointer_expression "*(undefined1 *)(param_2 + 0x17)" * (cast_expression "(undefined1 *)(param_2 + 0x17)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + 0x17)" ( (binary_expression "param_2 + 0x17" identifier + number_literal) )))) = number_literal) ;) (expression_statement "iVar4 = 0x508;" (assignment_expression "iVar4 = 0x508" identifier = number_literal) ;) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;) })) (expression_statement "iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" (assignment_expression "iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" identifier = (pointer_expression "*(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" * (cast_expression "(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" ( (binary_expression "*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc" (pointer_expression "*(int *)(*(int *)(param_1 + 8) + 0x28)" * (cast_expression "(int *)(*(int *)(param_1 + 8) + 0x28)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)(param_1 + 8) + 0x28)" ( (binary_expression "*(int *)(param_1 + 8) + 0x28" (pointer_expression "*(int *)(param_1 + 8)" * (cast_expression "(int *)(param_1 + 8)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 8)" ( (binary_expression "param_1 + 8" identifier + number_literal) )))) + number_literal) )))) + number_literal) ))))) ;) (if_statement "if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }" if (parenthesized_expression "(-1 < iVar4)" ( (binary_expression "-1 < iVar4" number_literal < identifier) )) (compound_statement "{\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }" { (expression_statement "local_38 = 1;" (assignment_expression "local_38 = 1" identifier = number_literal) ;) (expression_statement "local_34 = 0x80;" (assignment_expression "local_34 = 0x80" identifier = number_literal) ;) (expression_statement "local_30 = 0;" (assignment_expression "local_30 = 0" identifier = number_literal) ;) (expression_statement "local_2c = 1;" (assignment_expression "local_2c = 1" identifier = number_literal) ;) (expression_statement "local_28 = 0;" (assignment_expression "local_28 = 0" identifier = number_literal) ;) (expression_statement "iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);" (assignment_expression "iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38)" identifier = (call_expression "(*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" ( (pointer_expression "*(code *)PTR_fcntl_00107498" * (cast_expression "(code *)PTR_fcntl_00107498" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar4,0xd,&local_38)" ( identifier , number_literal , (pointer_expression "&local_38" & identifier) )))) ;) (if_statement "if (iVar4 == -1) goto LAB_0003a000;" if (parenthesized_expression "(iVar4 == -1)" ( (binary_expression "iVar4 == -1" identifier == number_literal) )) (goto_statement "goto LAB_0003a000;" goto statement_identifier ;)) })) (expression_statement "uVar1 = *(undefined4 *)(param_2 + 0xc);" (assignment_expression "uVar1 = *(undefined4 *)(param_2 + 0xc)" identifier = (pointer_expression "*(undefined4 *)(param_2 + 0xc)" * (cast_expression "(undefined4 *)(param_2 + 0xc)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + 0xc)" ( (binary_expression "param_2 + 0xc" identifier + number_literal) ))))) ;) (do_statement "do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);" do (compound_statement "{\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    }" { (expression_statement "iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);" (assignment_expression "iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0)" identifier = (call_expression "(*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0)" (parenthesized_expression "(*(code *)PTR_ftruncate64_0010748c)" ( (pointer_expression "*(code *)PTR_ftruncate64_0010748c" * (cast_expression "(code *)PTR_ftruncate64_0010748c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(uVar1,3,0)" ( identifier , number_literal , number_literal )))) ;) (if_statement "if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }" if (parenthesized_expression "(-1 < iVar4)" ( (binary_expression "-1 < iVar4" number_literal < identifier) )) (compound_statement "{\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }" { (if_statement "if (iVar4 == 0) goto LAB_00039ead;" if (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) )) (goto_statement "goto LAB_00039ead;" goto statement_identifier ;)) (break_statement "break;" break ;) })) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) }) while (parenthesized_expression "(*piVar3 == 4)" ( (binary_expression "*piVar3 == 4" (pointer_expression "*piVar3" * identifier) == number_literal) )) ;) (expression_statement "iVar4 = FUN_00039de0(0x9483);" (assignment_expression "iVar4 = FUN_00039de0(0x9483)" identifier = (call_expression "FUN_00039de0(0x9483)" identifier (argument_list "(0x9483)" ( number_literal )))) ;) (if_statement "if (iVar4 != 0) goto LAB_00039f01;" if (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) )) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;)) }) (else_clause "else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" else (if_statement "if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" if (parenthesized_expression "((short)local_50 == 1)" ( (binary_expression "(short)local_50 == 1" (cast_expression "(short)local_50" ( (type_descriptor "short" (sized_type_specifier "short" short)) ) identifier) == number_literal) )) (compound_statement "{\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" { (labeled_statement "LAB_0003a000:\n    iVar4 = 5;" statement_identifier : (expression_statement "iVar4 = 5;" (assignment_expression "iVar4 = 5" identifier = number_literal) ;)) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;) })))) (labeled_statement "LAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" statement_identifier : (expression_statement "iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" (assignment_expression "iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" identifier = (pointer_expression "*(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" * (cast_expression "(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" ( (binary_expression "*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc" (pointer_expression "*(int *)(*(int *)(param_1 + 8) + 0x28)" * (cast_expression "(int *)(*(int *)(param_1 + 8) + 0x28)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)(param_1 + 8) + 0x28)" ( (binary_expression "*(int *)(param_1 + 8) + 0x28" (pointer_expression "*(int *)(param_1 + 8)" * (cast_expression "(int *)(param_1 + 8)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 8)" ( (binary_expression "param_1 + 8" identifier + number_literal) )))) + number_literal) )))) + number_literal) ))))) ;)) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (if_statement "if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }" if (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) (compound_statement "{\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }" { (expression_statement "local_38 = 0;" (assignment_expression "local_38 = 0" identifier = number_literal) ;) (expression_statement "local_34 = 0x80;" (assignment_expression "local_34 = 0x80" identifier = number_literal) ;) (expression_statement "local_30 = 0;" (assignment_expression "local_30 = 0" identifier = number_literal) ;) (expression_statement "local_2c = 1;" (assignment_expression "local_2c = 1" identifier = number_literal) ;) (expression_statement "local_28 = 0;" (assignment_expression "local_28 = 0" identifier = number_literal) ;) (expression_statement "iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);" (assignment_expression "iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38)" identifier = (call_expression "(*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" ( (pointer_expression "*(code *)PTR_fcntl_00107498" * (cast_expression "(code *)PTR_fcntl_00107498" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar2,0xd,&local_38)" ( identifier , number_literal , (pointer_expression "&local_38" & identifier) )))) ;) (if_statement "if (iVar2 == -1) {\n      iVar4 = 5;\n    }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n      iVar4 = 5;\n    }" { (expression_statement "iVar4 = 5;" (assignment_expression "iVar4 = 5" identifier = number_literal) ;) })) })) (labeled_statement "LAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_000d1450();\n  }" statement_identifier : (if_statement "if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_000d1450();\n  }" if (parenthesized_expression "(local_20 != *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_20 != *(int *)(in_GS_OFFSET + 0x14)" identifier != (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    FUN_000d1450();\n  }" { comment (expression_statement "FUN_000d1450();" (call_expression "FUN_000d1450()" identifier (argument_list "()" ( ))) ;) }))) (return_statement "return iVar4;" return identifier ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint __regparm3 unixLockSharedMemory(unixFile *pDbFd,unixShmNode *pShmNode)\n\n{\n  int iVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  flock lock;\n  flock f;\n  \n  iVar4 = 0xf0a;\n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  lock.l_start._0_4_ = 0x80;\n  lock.l_start._4_4_ = 0;\n  lock.l_len._0_4_ = 1;\n  lock.l_len._4_4_ = 0;\n  lock.l_type = 1;\n  lock.l_whence = 0;\n  iVar2 = (*aSyscall[7].pCurrent)(pShmNode->hShm,0xc,&lock);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if (lock.l_type == 2) {\n    if (pShmNode->isReadonly != '\0') {\n      pShmNode->isUnlocked = '\x01';\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = pDbFd->pInode->pShmNode->hShm;\n    if (-1 < iVar4) {\n      f.l_type = 1;\n      f.l_whence = 0;\n      f.l_start._0_4_ = 0x80;\n      f.l_start._4_4_ = 0;\n      f.l_len._0_4_ = 1;\n      f.l_len._4_4_ = 0;\n      iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    iVar4 = pShmNode->hShm;\n    do {\n      iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);\n      if (-1 < iVar2) {\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if (lock.l_type == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = pDbFd->pInode->pShmNode->hShm;\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    f.l_type = 0;\n    f.l_whence = 0;\n    f.l_start._0_4_ = 0x80;\n    f.l_start._4_4_ = 0;\n    f.l_len._0_4_ = 1;\n    f.l_len._4_4_ = 0;\n    iVar2 = (*aSyscall[7].pCurrent)(iVar2,0xd,&f);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar4;\n}\n\n" comment (function_definition "int __regparm3 unixLockSharedMemory(unixFile *pDbFd,unixShmNode *pShmNode)\n\n{\n  int iVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  flock lock;\n  flock f;\n  \n  iVar4 = 0xf0a;\n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  lock.l_start._0_4_ = 0x80;\n  lock.l_start._4_4_ = 0;\n  lock.l_len._0_4_ = 1;\n  lock.l_len._4_4_ = 0;\n  lock.l_type = 1;\n  lock.l_whence = 0;\n  iVar2 = (*aSyscall[7].pCurrent)(pShmNode->hShm,0xc,&lock);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if (lock.l_type == 2) {\n    if (pShmNode->isReadonly != '\0') {\n      pShmNode->isUnlocked = '\x01';\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = pDbFd->pInode->pShmNode->hShm;\n    if (-1 < iVar4) {\n      f.l_type = 1;\n      f.l_whence = 0;\n      f.l_start._0_4_ = 0x80;\n      f.l_start._4_4_ = 0;\n      f.l_len._0_4_ = 1;\n      f.l_len._4_4_ = 0;\n      iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    iVar4 = pShmNode->hShm;\n    do {\n      iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);\n      if (-1 < iVar2) {\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if (lock.l_type == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = pDbFd->pInode->pShmNode->hShm;\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    f.l_type = 0;\n    f.l_whence = 0;\n    f.l_start._0_4_ = 0x80;\n    f.l_start._4_4_ = 0;\n    f.l_len._0_4_ = 1;\n    f.l_len._4_4_ = 0;\n    iVar2 = (*aSyscall[7].pCurrent)(iVar2,0xd,&f);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar4;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "unixLockSharedMemory(unixFile *pDbFd,unixShmNode *pShmNode)" identifier (parameter_list "(unixFile *pDbFd,unixShmNode *pShmNode)" ( (parameter_declaration "unixFile *pDbFd" type_identifier (pointer_declarator "*pDbFd" * identifier)) , (parameter_declaration "unixShmNode *pShmNode" type_identifier (pointer_declarator "*pShmNode" * identifier)) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  flock lock;\n  flock f;\n  \n  iVar4 = 0xf0a;\n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  lock.l_start._0_4_ = 0x80;\n  lock.l_start._4_4_ = 0;\n  lock.l_len._0_4_ = 1;\n  lock.l_len._4_4_ = 0;\n  lock.l_type = 1;\n  lock.l_whence = 0;\n  iVar2 = (*aSyscall[7].pCurrent)(pShmNode->hShm,0xc,&lock);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if (lock.l_type == 2) {\n    if (pShmNode->isReadonly != '\0') {\n      pShmNode->isUnlocked = '\x01';\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = pDbFd->pInode->pShmNode->hShm;\n    if (-1 < iVar4) {\n      f.l_type = 1;\n      f.l_whence = 0;\n      f.l_start._0_4_ = 0x80;\n      f.l_start._4_4_ = 0;\n      f.l_len._0_4_ = 1;\n      f.l_len._4_4_ = 0;\n      iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    iVar4 = pShmNode->hShm;\n    do {\n      iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);\n      if (-1 < iVar2) {\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if (lock.l_type == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = pDbFd->pInode->pShmNode->hShm;\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    f.l_type = 0;\n    f.l_whence = 0;\n    f.l_start._0_4_ = 0x80;\n    f.l_start._4_4_ = 0;\n    f.l_len._0_4_ = 1;\n    f.l_len._4_4_ = 0;\n    iVar2 = (*aSyscall[7].pCurrent)(iVar2,0xd,&f);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar4;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "flock lock;" type_identifier identifier ;) (declaration "flock f;" type_identifier identifier ;) (expression_statement "iVar4 = 0xf0a;" (assignment_expression "iVar4 = 0xf0a" identifier = number_literal) ;) (expression_statement "iVar1 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "iVar1 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "lock.l_start._0_4_ = 0x80;" (assignment_expression "lock.l_start._0_4_ = 0x80" (field_expression "lock.l_start._0_4_" (field_expression "lock.l_start" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "lock.l_start._4_4_ = 0;" (assignment_expression "lock.l_start._4_4_ = 0" (field_expression "lock.l_start._4_4_" (field_expression "lock.l_start" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "lock.l_len._0_4_ = 1;" (assignment_expression "lock.l_len._0_4_ = 1" (field_expression "lock.l_len._0_4_" (field_expression "lock.l_len" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "lock.l_len._4_4_ = 0;" (assignment_expression "lock.l_len._4_4_ = 0" (field_expression "lock.l_len._4_4_" (field_expression "lock.l_len" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "lock.l_type = 1;" (assignment_expression "lock.l_type = 1" (field_expression "lock.l_type" identifier . field_identifier) = number_literal) ;) (expression_statement "lock.l_whence = 0;" (assignment_expression "lock.l_whence = 0" (field_expression "lock.l_whence" identifier . field_identifier) = number_literal) ;) (expression_statement "iVar2 = (*aSyscall[7].pCurrent)(pShmNode->hShm,0xc,&lock);" (assignment_expression "iVar2 = (*aSyscall[7].pCurrent)(pShmNode->hShm,0xc,&lock)" identifier = (call_expression "(*aSyscall[7].pCurrent)(pShmNode->hShm,0xc,&lock)" (parenthesized_expression "(*aSyscall[7].pCurrent)" ( (pointer_expression "*aSyscall[7].pCurrent" * (field_expression "aSyscall[7].pCurrent" (subscript_expression "aSyscall[7]" identifier [ number_literal ]) . field_identifier)) )) (argument_list "(pShmNode->hShm,0xc,&lock)" ( (field_expression "pShmNode->hShm" identifier -> field_identifier) , number_literal , (pointer_expression "&lock" & identifier) )))) ;) (if_statement "if (iVar2 != 0) goto LAB_00039f01;" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;)) (if_statement "if (lock.l_type == 2) {\n    if (pShmNode->isReadonly != '\0') {\n      pShmNode->isUnlocked = '\x01';\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = pDbFd->pInode->pShmNode->hShm;\n    if (-1 < iVar4) {\n      f.l_type = 1;\n      f.l_whence = 0;\n      f.l_start._0_4_ = 0x80;\n      f.l_start._4_4_ = 0;\n      f.l_len._0_4_ = 1;\n      f.l_len._4_4_ = 0;\n      iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    iVar4 = pShmNode->hShm;\n    do {\n      iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);\n      if (-1 < iVar2) {\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if (lock.l_type == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" if (parenthesized_expression "(lock.l_type == 2)" ( (binary_expression "lock.l_type == 2" (field_expression "lock.l_type" identifier . field_identifier) == number_literal) )) (compound_statement "{\n    if (pShmNode->isReadonly != '\0') {\n      pShmNode->isUnlocked = '\x01';\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = pDbFd->pInode->pShmNode->hShm;\n    if (-1 < iVar4) {\n      f.l_type = 1;\n      f.l_whence = 0;\n      f.l_start._0_4_ = 0x80;\n      f.l_start._4_4_ = 0;\n      f.l_len._0_4_ = 1;\n      f.l_len._4_4_ = 0;\n      iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    iVar4 = pShmNode->hShm;\n    do {\n      iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);\n      if (-1 < iVar2) {\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }" { (if_statement "if (pShmNode->isReadonly != '\0') {\n      pShmNode->isUnlocked = '\x01';\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }" if (parenthesized_expression "(pShmNode->isReadonly != '\0')" ( (binary_expression "pShmNode->isReadonly != '\0'" (field_expression "pShmNode->isReadonly" identifier -> field_identifier) != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n      pShmNode->isUnlocked = '\x01';\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }" { (expression_statement "pShmNode->isUnlocked = '\x01';" (assignment_expression "pShmNode->isUnlocked = '\x01'" (field_expression "pShmNode->isUnlocked" identifier -> field_identifier) = (char_literal "'\x01'" ' escape_sequence ')) ;) (expression_statement "iVar4 = 0x508;" (assignment_expression "iVar4 = 0x508" identifier = number_literal) ;) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;) })) (expression_statement "iVar4 = pDbFd->pInode->pShmNode->hShm;" (assignment_expression "iVar4 = pDbFd->pInode->pShmNode->hShm" identifier = (field_expression "pDbFd->pInode->pShmNode->hShm" (field_expression "pDbFd->pInode->pShmNode" (field_expression "pDbFd->pInode" identifier -> field_identifier) -> field_identifier) -> field_identifier)) ;) (if_statement "if (-1 < iVar4) {\n      f.l_type = 1;\n      f.l_whence = 0;\n      f.l_start._0_4_ = 0x80;\n      f.l_start._4_4_ = 0;\n      f.l_len._0_4_ = 1;\n      f.l_len._4_4_ = 0;\n      iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }" if (parenthesized_expression "(-1 < iVar4)" ( (binary_expression "-1 < iVar4" number_literal < identifier) )) (compound_statement "{\n      f.l_type = 1;\n      f.l_whence = 0;\n      f.l_start._0_4_ = 0x80;\n      f.l_start._4_4_ = 0;\n      f.l_len._0_4_ = 1;\n      f.l_len._4_4_ = 0;\n      iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }" { (expression_statement "f.l_type = 1;" (assignment_expression "f.l_type = 1" (field_expression "f.l_type" identifier . field_identifier) = number_literal) ;) (expression_statement "f.l_whence = 0;" (assignment_expression "f.l_whence = 0" (field_expression "f.l_whence" identifier . field_identifier) = number_literal) ;) (expression_statement "f.l_start._0_4_ = 0x80;" (assignment_expression "f.l_start._0_4_ = 0x80" (field_expression "f.l_start._0_4_" (field_expression "f.l_start" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "f.l_start._4_4_ = 0;" (assignment_expression "f.l_start._4_4_ = 0" (field_expression "f.l_start._4_4_" (field_expression "f.l_start" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "f.l_len._0_4_ = 1;" (assignment_expression "f.l_len._0_4_ = 1" (field_expression "f.l_len._0_4_" (field_expression "f.l_len" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "f.l_len._4_4_ = 0;" (assignment_expression "f.l_len._4_4_ = 0" (field_expression "f.l_len._4_4_" (field_expression "f.l_len" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f);" (assignment_expression "iVar4 = (*aSyscall[7].pCurrent)(iVar4,0xd,&f)" identifier = (call_expression "(*aSyscall[7].pCurrent)(iVar4,0xd,&f)" (parenthesized_expression "(*aSyscall[7].pCurrent)" ( (pointer_expression "*aSyscall[7].pCurrent" * (field_expression "aSyscall[7].pCurrent" (subscript_expression "aSyscall[7]" identifier [ number_literal ]) . field_identifier)) )) (argument_list "(iVar4,0xd,&f)" ( identifier , number_literal , (pointer_expression "&f" & identifier) )))) ;) (if_statement "if (iVar4 == -1) goto LAB_0003a000;" if (parenthesized_expression "(iVar4 == -1)" ( (binary_expression "iVar4 == -1" identifier == number_literal) )) (goto_statement "goto LAB_0003a000;" goto statement_identifier ;)) })) (expression_statement "iVar4 = pShmNode->hShm;" (assignment_expression "iVar4 = pShmNode->hShm" identifier = (field_expression "pShmNode->hShm" identifier -> field_identifier)) ;) (do_statement "do {\n      iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);\n      if (-1 < iVar2) {\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);" do (compound_statement "{\n      iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);\n      if (-1 < iVar2) {\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    }" { (expression_statement "iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0);" (assignment_expression "iVar2 = (*aSyscall[6].pCurrent)(iVar4,3,0)" identifier = (call_expression "(*aSyscall[6].pCurrent)(iVar4,3,0)" (parenthesized_expression "(*aSyscall[6].pCurrent)" ( (pointer_expression "*aSyscall[6].pCurrent" * (field_expression "aSyscall[6].pCurrent" (subscript_expression "aSyscall[6]" identifier [ number_literal ]) . field_identifier)) )) (argument_list "(iVar4,3,0)" ( identifier , number_literal , number_literal )))) ;) (if_statement "if (-1 < iVar2) {\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }" if (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) (compound_statement "{\n        if (iVar2 == 0) goto LAB_00039ead;\n        break;\n      }" { (if_statement "if (iVar2 == 0) goto LAB_00039ead;" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (goto_statement "goto LAB_00039ead;" goto statement_identifier ;)) (break_statement "break;" break ;) })) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) }) while (parenthesized_expression "(*piVar3 == 4)" ( (binary_expression "*piVar3 == 4" (pointer_expression "*piVar3" * identifier) == number_literal) )) ;) (expression_statement "iVar4 = unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483);" (assignment_expression "iVar4 = unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483)" identifier = (call_expression "unixLogErrorAtLine(0x120a,"ftruncate",pShmNode->zFilename,0x9483)" identifier (argument_list "(0x120a,"ftruncate",pShmNode->zFilename,0x9483)" ( number_literal , (string_literal ""ftruncate"" " string_content ") , (field_expression "pShmNode->zFilename" identifier -> field_identifier) , number_literal )))) ;) (if_statement "if (iVar4 != 0) goto LAB_00039f01;" if (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) )) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;)) }) (else_clause "else if (lock.l_type == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" else (if_statement "if (lock.l_type == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" if (parenthesized_expression "(lock.l_type == 1)" ( (binary_expression "lock.l_type == 1" (field_expression "lock.l_type" identifier . field_identifier) == number_literal) )) (compound_statement "{\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" { (labeled_statement "LAB_0003a000:\n    iVar4 = 5;" statement_identifier : (expression_statement "iVar4 = 5;" (assignment_expression "iVar4 = 5" identifier = number_literal) ;)) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;) })))) (labeled_statement "LAB_00039ead:\n  iVar2 = pDbFd->pInode->pShmNode->hShm;" statement_identifier : (expression_statement "iVar2 = pDbFd->pInode->pShmNode->hShm;" (assignment_expression "iVar2 = pDbFd->pInode->pShmNode->hShm" identifier = (field_expression "pDbFd->pInode->pShmNode->hShm" (field_expression "pDbFd->pInode->pShmNode" (field_expression "pDbFd->pInode" identifier -> field_identifier) -> field_identifier) -> field_identifier)) ;)) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (if_statement "if (-1 < iVar2) {\n    f.l_type = 0;\n    f.l_whence = 0;\n    f.l_start._0_4_ = 0x80;\n    f.l_start._4_4_ = 0;\n    f.l_len._0_4_ = 1;\n    f.l_len._4_4_ = 0;\n    iVar2 = (*aSyscall[7].pCurrent)(iVar2,0xd,&f);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }" if (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) (compound_statement "{\n    f.l_type = 0;\n    f.l_whence = 0;\n    f.l_start._0_4_ = 0x80;\n    f.l_start._4_4_ = 0;\n    f.l_len._0_4_ = 1;\n    f.l_len._4_4_ = 0;\n    iVar2 = (*aSyscall[7].pCurrent)(iVar2,0xd,&f);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }" { (expression_statement "f.l_type = 0;" (assignment_expression "f.l_type = 0" (field_expression "f.l_type" identifier . field_identifier) = number_literal) ;) (expression_statement "f.l_whence = 0;" (assignment_expression "f.l_whence = 0" (field_expression "f.l_whence" identifier . field_identifier) = number_literal) ;) (expression_statement "f.l_start._0_4_ = 0x80;" (assignment_expression "f.l_start._0_4_ = 0x80" (field_expression "f.l_start._0_4_" (field_expression "f.l_start" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "f.l_start._4_4_ = 0;" (assignment_expression "f.l_start._4_4_ = 0" (field_expression "f.l_start._4_4_" (field_expression "f.l_start" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "f.l_len._0_4_ = 1;" (assignment_expression "f.l_len._0_4_ = 1" (field_expression "f.l_len._0_4_" (field_expression "f.l_len" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "f.l_len._4_4_ = 0;" (assignment_expression "f.l_len._4_4_ = 0" (field_expression "f.l_len._4_4_" (field_expression "f.l_len" identifier . field_identifier) . field_identifier) = number_literal) ;) (expression_statement "iVar2 = (*aSyscall[7].pCurrent)(iVar2,0xd,&f);" (assignment_expression "iVar2 = (*aSyscall[7].pCurrent)(iVar2,0xd,&f)" identifier = (call_expression "(*aSyscall[7].pCurrent)(iVar2,0xd,&f)" (parenthesized_expression "(*aSyscall[7].pCurrent)" ( (pointer_expression "*aSyscall[7].pCurrent" * (field_expression "aSyscall[7].pCurrent" (subscript_expression "aSyscall[7]" identifier [ number_literal ]) . field_identifier)) )) (argument_list "(iVar2,0xd,&f)" ( identifier , number_literal , (pointer_expression "&f" & identifier) )))) ;) (if_statement "if (iVar2 == -1) {\n      iVar4 = 5;\n    }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n      iVar4 = 5;\n    }" { (expression_statement "iVar4 = 5;" (assignment_expression "iVar4 = 5" identifier = number_literal) ;) })) })) (labeled_statement "LAB_00039f01:\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }" statement_identifier : (if_statement "if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }" if (parenthesized_expression "(iVar1 != *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "iVar1 != *(int *)(in_GS_OFFSET + 0x14)" identifier != (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }" { comment (expression_statement "__stack_chk_fail_local();" (call_expression "__stack_chk_fail_local()" identifier (argument_list "()" ( ))) ;) }))) (return_statement "return iVar4;" return identifier ;) })))
(translation_unit "int __regparm3 FUN_00039e30(int param_1,int param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  undefined4 local_50;\n  undefined4 local_4c;\n  undefined4 local_48;\n  undefined4 local_44;\n  undefined4 local_40;\n  undefined4 local_38;\n  undefined4 local_34;\n  undefined4 local_30;\n  undefined4 local_2c;\n  undefined4 local_28;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x39e3d;\n  iVar4 = 0xf0a;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  local_4c = 0x80;\n  local_48 = 0;\n  local_44 = 1;\n  local_40 = 0;\n  local_50 = 1;\n  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }\n  return iVar4;\n}\n\n" (function_definition "int __regparm3 FUN_00039e30(int param_1,int param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  undefined4 local_50;\n  undefined4 local_4c;\n  undefined4 local_48;\n  undefined4 local_44;\n  undefined4 local_40;\n  undefined4 local_38;\n  undefined4 local_34;\n  undefined4 local_30;\n  undefined4 local_2c;\n  undefined4 local_28;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x39e3d;\n  iVar4 = 0xf0a;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  local_4c = 0x80;\n  local_48 = 0;\n  local_44 = 1;\n  local_40 = 0;\n  local_50 = 1;\n  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }\n  return iVar4;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "FUN_00039e30(int param_1,int param_2)" identifier (parameter_list "(int param_1,int param_2)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "int param_2" primitive_type identifier) ))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  undefined4 local_50;\n  undefined4 local_4c;\n  undefined4 local_48;\n  undefined4 local_44;\n  undefined4 local_40;\n  undefined4 local_38;\n  undefined4 local_34;\n  undefined4 local_30;\n  undefined4 local_2c;\n  undefined4 local_28;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x39e3d;\n  iVar4 = 0xf0a;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  local_4c = 0x80;\n  local_48 = 0;\n  local_44 = 1;\n  local_40 = 0;\n  local_50 = 1;\n  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }\n  return iVar4;\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "int *piVar3;" primitive_type (pointer_declarator "*piVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "undefined4 local_50;" type_identifier identifier ;) (declaration "undefined4 local_4c;" type_identifier identifier ;) (declaration "undefined4 local_48;" type_identifier identifier ;) (declaration "undefined4 local_44;" type_identifier identifier ;) (declaration "undefined4 local_40;" type_identifier identifier ;) (declaration "undefined4 local_38;" type_identifier identifier ;) (declaration "undefined4 local_34;" type_identifier identifier ;) (declaration "undefined4 local_30;" type_identifier identifier ;) (declaration "undefined4 local_2c;" type_identifier identifier ;) (declaration "undefined4 local_28;" type_identifier identifier ;) (declaration "int local_20;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x39e3d;" (assignment_expression "uStack_14 = 0x39e3d" identifier = number_literal) ;) (expression_statement "iVar4 = 0xf0a;" (assignment_expression "iVar4 = 0xf0a" identifier = number_literal) ;) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "local_4c = 0x80;" (assignment_expression "local_4c = 0x80" identifier = number_literal) ;) (expression_statement "local_48 = 0;" (assignment_expression "local_48 = 0" identifier = number_literal) ;) (expression_statement "local_44 = 1;" (assignment_expression "local_44 = 1" identifier = number_literal) ;) (expression_statement "local_40 = 0;" (assignment_expression "local_40 = 0" identifier = number_literal) ;) (expression_statement "local_50 = 1;" (assignment_expression "local_50 = 1" identifier = number_literal) ;) (expression_statement "iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);" (assignment_expression "iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" identifier = (call_expression "(*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" ( (pointer_expression "*(code *)PTR_fcntl_00107498" * (cast_expression "(code *)PTR_fcntl_00107498" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" ( (pointer_expression "*(undefined4 *)(param_2 + 0xc)" * (cast_expression "(undefined4 *)(param_2 + 0xc)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + 0xc)" ( (binary_expression "param_2 + 0xc" identifier + number_literal) )))) , number_literal , (pointer_expression "&local_50" & identifier) )))) ;) (if_statement "if (iVar2 != 0) goto LAB_00039f01;" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;)) (if_statement "if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" if (parenthesized_expression "((short)local_50 == 2)" ( (binary_expression "(short)local_50 == 2" (cast_expression "(short)local_50" ( (type_descriptor "short" (sized_type_specifier "short" short)) ) identifier) == number_literal) )) (compound_statement "{\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }" { (if_statement "if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }" if (parenthesized_expression "(*(char *)(param_2 + 0x16) != '\0')" ( (binary_expression "*(char *)(param_2 + 0x16) != '\0'" (pointer_expression "*(char *)(param_2 + 0x16)" * (cast_expression "(char *)(param_2 + 0x16)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + 0x16)" ( (binary_expression "param_2 + 0x16" identifier + number_literal) )))) != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }" { (expression_statement "*(undefined1 *)(param_2 + 0x17) = 1;" (assignment_expression "*(undefined1 *)(param_2 + 0x17) = 1" (pointer_expression "*(undefined1 *)(param_2 + 0x17)" * (cast_expression "(undefined1 *)(param_2 + 0x17)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + 0x17)" ( (binary_expression "param_2 + 0x17" identifier + number_literal) )))) = number_literal) ;) (expression_statement "iVar4 = 0x508;" (assignment_expression "iVar4 = 0x508" identifier = number_literal) ;) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;) })) (expression_statement "iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" (assignment_expression "iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" identifier = (pointer_expression "*(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" * (cast_expression "(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" ( (binary_expression "*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc" (pointer_expression "*(int *)(*(int *)(param_1 + 8) + 0x28)" * (cast_expression "(int *)(*(int *)(param_1 + 8) + 0x28)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)(param_1 + 8) + 0x28)" ( (binary_expression "*(int *)(param_1 + 8) + 0x28" (pointer_expression "*(int *)(param_1 + 8)" * (cast_expression "(int *)(param_1 + 8)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 8)" ( (binary_expression "param_1 + 8" identifier + number_literal) )))) + number_literal) )))) + number_literal) ))))) ;) (if_statement "if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }" if (parenthesized_expression "(-1 < iVar4)" ( (binary_expression "-1 < iVar4" number_literal < identifier) )) (compound_statement "{\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }" { (expression_statement "local_38 = 1;" (assignment_expression "local_38 = 1" identifier = number_literal) ;) (expression_statement "local_34 = 0x80;" (assignment_expression "local_34 = 0x80" identifier = number_literal) ;) (expression_statement "local_30 = 0;" (assignment_expression "local_30 = 0" identifier = number_literal) ;) (expression_statement "local_2c = 1;" (assignment_expression "local_2c = 1" identifier = number_literal) ;) (expression_statement "local_28 = 0;" (assignment_expression "local_28 = 0" identifier = number_literal) ;) (expression_statement "iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);" (assignment_expression "iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38)" identifier = (call_expression "(*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" ( (pointer_expression "*(code *)PTR_fcntl_00107498" * (cast_expression "(code *)PTR_fcntl_00107498" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar4,0xd,&local_38)" ( identifier , number_literal , (pointer_expression "&local_38" & identifier) )))) ;) (if_statement "if (iVar4 == -1) goto LAB_0003a000;" if (parenthesized_expression "(iVar4 == -1)" ( (binary_expression "iVar4 == -1" identifier == number_literal) )) (goto_statement "goto LAB_0003a000;" goto statement_identifier ;)) })) (expression_statement "uVar1 = *(undefined4 *)(param_2 + 0xc);" (assignment_expression "uVar1 = *(undefined4 *)(param_2 + 0xc)" identifier = (pointer_expression "*(undefined4 *)(param_2 + 0xc)" * (cast_expression "(undefined4 *)(param_2 + 0xc)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + 0xc)" ( (binary_expression "param_2 + 0xc" identifier + number_literal) ))))) ;) (do_statement "do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);" do (compound_statement "{\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    }" { (expression_statement "iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);" (assignment_expression "iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0)" identifier = (call_expression "(*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0)" (parenthesized_expression "(*(code *)PTR_ftruncate64_0010748c)" ( (pointer_expression "*(code *)PTR_ftruncate64_0010748c" * (cast_expression "(code *)PTR_ftruncate64_0010748c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(uVar1,3,0)" ( identifier , number_literal , number_literal )))) ;) (if_statement "if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }" if (parenthesized_expression "(-1 < iVar4)" ( (binary_expression "-1 < iVar4" number_literal < identifier) )) (compound_statement "{\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }" { (if_statement "if (iVar4 == 0) goto LAB_00039ead;" if (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) )) (goto_statement "goto LAB_00039ead;" goto statement_identifier ;)) (break_statement "break;" break ;) })) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) }) while (parenthesized_expression "(*piVar3 == 4)" ( (binary_expression "*piVar3 == 4" (pointer_expression "*piVar3" * identifier) == number_literal) )) ;) (expression_statement "iVar4 = FUN_00039de0(0x9483);" (assignment_expression "iVar4 = FUN_00039de0(0x9483)" identifier = (call_expression "FUN_00039de0(0x9483)" identifier (argument_list "(0x9483)" ( number_literal )))) ;) (if_statement "if (iVar4 != 0) goto LAB_00039f01;" if (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) )) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;)) }) (else_clause "else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" else (if_statement "if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" if (parenthesized_expression "((short)local_50 == 1)" ( (binary_expression "(short)local_50 == 1" (cast_expression "(short)local_50" ( (type_descriptor "short" (sized_type_specifier "short" short)) ) identifier) == number_literal) )) (compound_statement "{\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" { (labeled_statement "LAB_0003a000:\n    iVar4 = 5;" statement_identifier : (expression_statement "iVar4 = 5;" (assignment_expression "iVar4 = 5" identifier = number_literal) ;)) (goto_statement "goto LAB_00039f01;" goto statement_identifier ;) })))) (labeled_statement "LAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" statement_identifier : (expression_statement "iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" (assignment_expression "iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" identifier = (pointer_expression "*(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" * (cast_expression "(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" ( (binary_expression "*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc" (pointer_expression "*(int *)(*(int *)(param_1 + 8) + 0x28)" * (cast_expression "(int *)(*(int *)(param_1 + 8) + 0x28)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)(param_1 + 8) + 0x28)" ( (binary_expression "*(int *)(param_1 + 8) + 0x28" (pointer_expression "*(int *)(param_1 + 8)" * (cast_expression "(int *)(param_1 + 8)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 8)" ( (binary_expression "param_1 + 8" identifier + number_literal) )))) + number_literal) )))) + number_literal) ))))) ;)) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (if_statement "if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }" if (parenthesized_expression "(-1 < iVar2)" ( (binary_expression "-1 < iVar2" number_literal < identifier) )) (compound_statement "{\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }" { (expression_statement "local_38 = 0;" (assignment_expression "local_38 = 0" identifier = number_literal) ;) (expression_statement "local_34 = 0x80;" (assignment_expression "local_34 = 0x80" identifier = number_literal) ;) (expression_statement "local_30 = 0;" (assignment_expression "local_30 = 0" identifier = number_literal) ;) (expression_statement "local_2c = 1;" (assignment_expression "local_2c = 1" identifier = number_literal) ;) (expression_statement "local_28 = 0;" (assignment_expression "local_28 = 0" identifier = number_literal) ;) (expression_statement "iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);" (assignment_expression "iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38)" identifier = (call_expression "(*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" ( (pointer_expression "*(code *)PTR_fcntl_00107498" * (cast_expression "(code *)PTR_fcntl_00107498" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar2,0xd,&local_38)" ( identifier , number_literal , (pointer_expression "&local_38" & identifier) )))) ;) (if_statement "if (iVar2 == -1) {\n      iVar4 = 5;\n    }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n      iVar4 = 5;\n    }" { (expression_statement "iVar4 = 5;" (assignment_expression "iVar4 = 5" identifier = number_literal) ;) })) })) (labeled_statement "LAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }" statement_identifier : (if_statement "if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }" if (parenthesized_expression "(local_20 != *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_20 != *(int *)(in_GS_OFFSET + 0x14)" identifier != (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n                    \n    FUN_000d1450();\n  }" { (expression_statement "FUN_000d1450();" (call_expression "FUN_000d1450()" identifier (argument_list "()" ( ))) ;) }))) (return_statement "return iVar4;" return identifier ;) })))
(translation_unit (function_definition TYPE (ERROR IDENT) (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (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) )))) , LIT , (pointer_expression & IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (goto_statement goto statement_identifier ;)) (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier short)) ) IDENT) == LIT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) != (char_literal ' escape_sequence ')) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) + LIT) )))) + LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT , LIT , (pointer_expression & IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (goto_statement goto statement_identifier ;)) })) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (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 ( IDENT , LIT , LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (goto_statement goto statement_identifier ;)) (break_statement break ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) }) while (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) == LIT) )) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (goto_statement goto statement_identifier ;)) }) (else_clause else (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier short)) ) IDENT) == LIT) )) (compound_statement { (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = LIT) ;)) (goto_statement goto statement_identifier ;) })))) (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) + LIT) )))) + LIT) ))))) ;)) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( IDENT , LIT , (pointer_expression & IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) })) })) (labeled_statement statement_identifier : (if_statement if (parenthesized_expression ( (binary_expression IDENT != (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( ))) ;) }))) (return_statement return IDENT ;) })))
(function_definition "int __regparm3 FUN_00039e30(int param_1,int param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  undefined4 local_50;\n  undefined4 local_4c;\n  undefined4 local_48;\n  undefined4 local_44;\n  undefined4 local_40;\n  undefined4 local_38;\n  undefined4 local_34;\n  undefined4 local_30;\n  undefined4 local_2c;\n  undefined4 local_28;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x39e3d;\n  iVar4 = 0xf0a;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  local_4c = 0x80;\n  local_48 = 0;\n  local_44 = 1;\n  local_40 = 0;\n  local_50 = 1;\n  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }\n  return iVar4;\n}" (primitive_type "int") (ERROR "__regparm3" (identifier "__regparm3")) (function_declarator "FUN_00039e30(int param_1,int param_2)" (identifier "FUN_00039e30") (parameter_list "(int param_1,int param_2)" (( "(") (parameter_declaration "int param_1" (primitive_type "int") (identifier "param_1")) (, ",") (parameter_declaration "int param_2" (primitive_type "int") (identifier "param_2")) () ")"))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  int *piVar3;\n  int iVar4;\n  int in_GS_OFFSET;\n  undefined4 local_50;\n  undefined4 local_4c;\n  undefined4 local_48;\n  undefined4 local_44;\n  undefined4 local_40;\n  undefined4 local_38;\n  undefined4 local_34;\n  undefined4 local_30;\n  undefined4 local_2c;\n  undefined4 local_28;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x39e3d;\n  iVar4 = 0xf0a;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  local_4c = 0x80;\n  local_48 = 0;\n  local_44 = 1;\n  local_40 = 0;\n  local_50 = 1;\n  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);\n  if (iVar2 != 0) goto LAB_00039f01;\n  if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }\nLAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n  iVar4 = 0;\n  if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }\nLAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }\n  return iVar4;\n}" ({ "{") (declaration "undefined4 uVar1;" (type_identifier "undefined4") (identifier "uVar1") (; ";")) (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 in_GS_OFFSET;" (primitive_type "int") (identifier "in_GS_OFFSET") (; ";")) (declaration "undefined4 local_50;" (type_identifier "undefined4") (identifier "local_50") (; ";")) (declaration "undefined4 local_4c;" (type_identifier "undefined4") (identifier "local_4c") (; ";")) (declaration "undefined4 local_48;" (type_identifier "undefined4") (identifier "local_48") (; ";")) (declaration "undefined4 local_44;" (type_identifier "undefined4") (identifier "local_44") (; ";")) (declaration "undefined4 local_40;" (type_identifier "undefined4") (identifier "local_40") (; ";")) (declaration "undefined4 local_38;" (type_identifier "undefined4") (identifier "local_38") (; ";")) (declaration "undefined4 local_34;" (type_identifier "undefined4") (identifier "local_34") (; ";")) (declaration "undefined4 local_30;" (type_identifier "undefined4") (identifier "local_30") (; ";")) (declaration "undefined4 local_2c;" (type_identifier "undefined4") (identifier "local_2c") (; ";")) (declaration "undefined4 local_28;" (type_identifier "undefined4") (identifier "local_28") (; ";")) (declaration "int local_20;" (primitive_type "int") (identifier "local_20") (; ";")) (declaration "undefined4 uStack_14;" (type_identifier "undefined4") (identifier "uStack_14") (; ";")) (expression_statement "uStack_14 = 0x39e3d;" (assignment_expression "uStack_14 = 0x39e3d" (identifier "uStack_14") (= "=") (number_literal "0x39e3d")) (; ";")) (expression_statement "iVar4 = 0xf0a;" (assignment_expression "iVar4 = 0xf0a" (identifier "iVar4") (= "=") (number_literal "0xf0a")) (; ";")) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_20") (= "=") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) (; ";")) (expression_statement "local_4c = 0x80;" (assignment_expression "local_4c = 0x80" (identifier "local_4c") (= "=") (number_literal "0x80")) (; ";")) (expression_statement "local_48 = 0;" (assignment_expression "local_48 = 0" (identifier "local_48") (= "=") (number_literal "0")) (; ";")) (expression_statement "local_44 = 1;" (assignment_expression "local_44 = 1" (identifier "local_44") (= "=") (number_literal "1")) (; ";")) (expression_statement "local_40 = 0;" (assignment_expression "local_40 = 0" (identifier "local_40") (= "=") (number_literal "0")) (; ";")) (expression_statement "local_50 = 1;" (assignment_expression "local_50 = 1" (identifier "local_50") (= "=") (number_literal "1")) (; ";")) (expression_statement "iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);" (assignment_expression "iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" (identifier "iVar2") (= "=") (call_expression "(*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" (( "(") (pointer_expression "*(code *)PTR_fcntl_00107498" (* "*") (cast_expression "(code *)PTR_fcntl_00107498" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_fcntl_00107498"))) () ")")) (argument_list "(*(undefined4 *)(param_2 + 0xc),0xc,&local_50)" (( "(") (pointer_expression "*(undefined4 *)(param_2 + 0xc)" (* "*") (cast_expression "(undefined4 *)(param_2 + 0xc)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_2 + 0xc)" (( "(") (binary_expression "param_2 + 0xc" (identifier "param_2") (+ "+") (number_literal "0xc")) () ")")))) (, ",") (number_literal "0xc") (, ",") (pointer_expression "&local_50" (& "&") (identifier "local_50")) () ")")))) (; ";")) (if_statement "if (iVar2 != 0) goto LAB_00039f01;" (if "if") (parenthesized_expression "(iVar2 != 0)" (( "(") (binary_expression "iVar2 != 0" (identifier "iVar2") (!= "!=") (number_literal "0")) () ")")) (goto_statement "goto LAB_00039f01;" (goto "goto") (statement_identifier "LAB_00039f01") (; ";"))) (if_statement "if ((short)local_50 == 2) {\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }\n  else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" (if "if") (parenthesized_expression "((short)local_50 == 2)" (( "(") (binary_expression "(short)local_50 == 2" (cast_expression "(short)local_50" (( "(") (type_descriptor "short" (sized_type_specifier "short" (short "short"))) () ")") (identifier "local_50")) (== "==") (number_literal "2")) () ")")) (compound_statement "{\n    if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }\n    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);\n    if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }\n    uVar1 = *(undefined4 *)(param_2 + 0xc);\n    do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);\n    iVar4 = FUN_00039de0(0x9483);\n    if (iVar4 != 0) goto LAB_00039f01;\n  }" ({ "{") (if_statement "if (*(char *)(param_2 + 0x16) != '\0') {\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }" (if "if") (parenthesized_expression "(*(char *)(param_2 + 0x16) != '\0')" (( "(") (binary_expression "*(char *)(param_2 + 0x16) != '\0'" (pointer_expression "*(char *)(param_2 + 0x16)" (* "*") (cast_expression "(char *)(param_2 + 0x16)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_2 + 0x16)" (( "(") (binary_expression "param_2 + 0x16" (identifier "param_2") (+ "+") (number_literal "0x16")) () ")")))) (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n      *(undefined1 *)(param_2 + 0x17) = 1;\n      iVar4 = 0x508;\n      goto LAB_00039f01;\n    }" ({ "{") (expression_statement "*(undefined1 *)(param_2 + 0x17) = 1;" (assignment_expression "*(undefined1 *)(param_2 + 0x17) = 1" (pointer_expression "*(undefined1 *)(param_2 + 0x17)" (* "*") (cast_expression "(undefined1 *)(param_2 + 0x17)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_2 + 0x17)" (( "(") (binary_expression "param_2 + 0x17" (identifier "param_2") (+ "+") (number_literal "0x17")) () ")")))) (= "=") (number_literal "1")) (; ";")) (expression_statement "iVar4 = 0x508;" (assignment_expression "iVar4 = 0x508" (identifier "iVar4") (= "=") (number_literal "0x508")) (; ";")) (goto_statement "goto LAB_00039f01;" (goto "goto") (statement_identifier "LAB_00039f01") (; ";")) (} "}"))) (expression_statement "iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" (assignment_expression "iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" (identifier "iVar4") (= "=") (pointer_expression "*(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" (* "*") (cast_expression "(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" (( "(") (binary_expression "*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc" (pointer_expression "*(int *)(*(int *)(param_1 + 8) + 0x28)" (* "*") (cast_expression "(int *)(*(int *)(param_1 + 8) + 0x28)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(*(int *)(param_1 + 8) + 0x28)" (( "(") (binary_expression "*(int *)(param_1 + 8) + 0x28" (pointer_expression "*(int *)(param_1 + 8)" (* "*") (cast_expression "(int *)(param_1 + 8)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 8)" (( "(") (binary_expression "param_1 + 8" (identifier "param_1") (+ "+") (number_literal "8")) () ")")))) (+ "+") (number_literal "0x28")) () ")")))) (+ "+") (number_literal "0xc")) () ")"))))) (; ";")) (if_statement "if (-1 < iVar4) {\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }" (if "if") (parenthesized_expression "(-1 < iVar4)" (( "(") (binary_expression "-1 < iVar4" (number_literal "-1") (< "<") (identifier "iVar4")) () ")")) (compound_statement "{\n      local_38 = 1;\n      local_34 = 0x80;\n      local_30 = 0;\n      local_2c = 1;\n      local_28 = 0;\n      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);\n      if (iVar4 == -1) goto LAB_0003a000;\n    }" ({ "{") (expression_statement "local_38 = 1;" (assignment_expression "local_38 = 1" (identifier "local_38") (= "=") (number_literal "1")) (; ";")) (expression_statement "local_34 = 0x80;" (assignment_expression "local_34 = 0x80" (identifier "local_34") (= "=") (number_literal "0x80")) (; ";")) (expression_statement "local_30 = 0;" (assignment_expression "local_30 = 0" (identifier "local_30") (= "=") (number_literal "0")) (; ";")) (expression_statement "local_2c = 1;" (assignment_expression "local_2c = 1" (identifier "local_2c") (= "=") (number_literal "1")) (; ";")) (expression_statement "local_28 = 0;" (assignment_expression "local_28 = 0" (identifier "local_28") (= "=") (number_literal "0")) (; ";")) (expression_statement "iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);" (assignment_expression "iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38)" (identifier "iVar4") (= "=") (call_expression "(*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" (( "(") (pointer_expression "*(code *)PTR_fcntl_00107498" (* "*") (cast_expression "(code *)PTR_fcntl_00107498" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_fcntl_00107498"))) () ")")) (argument_list "(iVar4,0xd,&local_38)" (( "(") (identifier "iVar4") (, ",") (number_literal "0xd") (, ",") (pointer_expression "&local_38" (& "&") (identifier "local_38")) () ")")))) (; ";")) (if_statement "if (iVar4 == -1) goto LAB_0003a000;" (if "if") (parenthesized_expression "(iVar4 == -1)" (( "(") (binary_expression "iVar4 == -1" (identifier "iVar4") (== "==") (number_literal "-1")) () ")")) (goto_statement "goto LAB_0003a000;" (goto "goto") (statement_identifier "LAB_0003a000") (; ";"))) (} "}"))) (expression_statement "uVar1 = *(undefined4 *)(param_2 + 0xc);" (assignment_expression "uVar1 = *(undefined4 *)(param_2 + 0xc)" (identifier "uVar1") (= "=") (pointer_expression "*(undefined4 *)(param_2 + 0xc)" (* "*") (cast_expression "(undefined4 *)(param_2 + 0xc)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_2 + 0xc)" (( "(") (binary_expression "param_2 + 0xc" (identifier "param_2") (+ "+") (number_literal "0xc")) () ")"))))) (; ";")) (do_statement "do {\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    } while (*piVar3 == 4);" (do "do") (compound_statement "{\n      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);\n      if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }\n      piVar3 = __errno_location();\n    }" ({ "{") (expression_statement "iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);" (assignment_expression "iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0)" (identifier "iVar4") (= "=") (call_expression "(*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0)" (parenthesized_expression "(*(code *)PTR_ftruncate64_0010748c)" (( "(") (pointer_expression "*(code *)PTR_ftruncate64_0010748c" (* "*") (cast_expression "(code *)PTR_ftruncate64_0010748c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_ftruncate64_0010748c"))) () ")")) (argument_list "(uVar1,3,0)" (( "(") (identifier "uVar1") (, ",") (number_literal "3") (, ",") (number_literal "0") () ")")))) (; ";")) (if_statement "if (-1 < iVar4) {\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }" (if "if") (parenthesized_expression "(-1 < iVar4)" (( "(") (binary_expression "-1 < iVar4" (number_literal "-1") (< "<") (identifier "iVar4")) () ")")) (compound_statement "{\n        if (iVar4 == 0) goto LAB_00039ead;\n        break;\n      }" ({ "{") (if_statement "if (iVar4 == 0) goto LAB_00039ead;" (if "if") (parenthesized_expression "(iVar4 == 0)" (( "(") (binary_expression "iVar4 == 0" (identifier "iVar4") (== "==") (number_literal "0")) () ")")) (goto_statement "goto LAB_00039ead;" (goto "goto") (statement_identifier "LAB_00039ead") (; ";"))) (break_statement "break;" (break "break") (; ";")) (} "}"))) (expression_statement "piVar3 = __errno_location();" (assignment_expression "piVar3 = __errno_location()" (identifier "piVar3") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(*piVar3 == 4)" (( "(") (binary_expression "*piVar3 == 4" (pointer_expression "*piVar3" (* "*") (identifier "piVar3")) (== "==") (number_literal "4")) () ")")) (; ";")) (expression_statement "iVar4 = FUN_00039de0(0x9483);" (assignment_expression "iVar4 = FUN_00039de0(0x9483)" (identifier "iVar4") (= "=") (call_expression "FUN_00039de0(0x9483)" (identifier "FUN_00039de0") (argument_list "(0x9483)" (( "(") (number_literal "0x9483") () ")")))) (; ";")) (if_statement "if (iVar4 != 0) goto LAB_00039f01;" (if "if") (parenthesized_expression "(iVar4 != 0)" (( "(") (binary_expression "iVar4 != 0" (identifier "iVar4") (!= "!=") (number_literal "0")) () ")")) (goto_statement "goto LAB_00039f01;" (goto "goto") (statement_identifier "LAB_00039f01") (; ";"))) (} "}")) (else_clause "else if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" (else "else") (if_statement "if ((short)local_50 == 1) {\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" (if "if") (parenthesized_expression "((short)local_50 == 1)" (( "(") (binary_expression "(short)local_50 == 1" (cast_expression "(short)local_50" (( "(") (type_descriptor "short" (sized_type_specifier "short" (short "short"))) () ")") (identifier "local_50")) (== "==") (number_literal "1")) () ")")) (compound_statement "{\nLAB_0003a000:\n    iVar4 = 5;\n    goto LAB_00039f01;\n  }" ({ "{") (labeled_statement "LAB_0003a000:\n    iVar4 = 5;" (statement_identifier "LAB_0003a000") (: ":") (expression_statement "iVar4 = 5;" (assignment_expression "iVar4 = 5" (identifier "iVar4") (= "=") (number_literal "5")) (; ";"))) (goto_statement "goto LAB_00039f01;" (goto "goto") (statement_identifier "LAB_00039f01") (; ";")) (} "}"))))) (labeled_statement "LAB_00039ead:\n  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" (statement_identifier "LAB_00039ead") (: ":") (expression_statement "iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);" (assignment_expression "iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" (identifier "iVar2") (= "=") (pointer_expression "*(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" (* "*") (cast_expression "(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc)" (( "(") (binary_expression "*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc" (pointer_expression "*(int *)(*(int *)(param_1 + 8) + 0x28)" (* "*") (cast_expression "(int *)(*(int *)(param_1 + 8) + 0x28)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(*(int *)(param_1 + 8) + 0x28)" (( "(") (binary_expression "*(int *)(param_1 + 8) + 0x28" (pointer_expression "*(int *)(param_1 + 8)" (* "*") (cast_expression "(int *)(param_1 + 8)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 8)" (( "(") (binary_expression "param_1 + 8" (identifier "param_1") (+ "+") (number_literal "8")) () ")")))) (+ "+") (number_literal "0x28")) () ")")))) (+ "+") (number_literal "0xc")) () ")"))))) (; ";"))) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" (identifier "iVar4") (= "=") (number_literal "0")) (; ";")) (if_statement "if (-1 < iVar2) {\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }" (if "if") (parenthesized_expression "(-1 < iVar2)" (( "(") (binary_expression "-1 < iVar2" (number_literal "-1") (< "<") (identifier "iVar2")) () ")")) (compound_statement "{\n    local_38 = 0;\n    local_34 = 0x80;\n    local_30 = 0;\n    local_2c = 1;\n    local_28 = 0;\n    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);\n    if (iVar2 == -1) {\n      iVar4 = 5;\n    }\n  }" ({ "{") (expression_statement "local_38 = 0;" (assignment_expression "local_38 = 0" (identifier "local_38") (= "=") (number_literal "0")) (; ";")) (expression_statement "local_34 = 0x80;" (assignment_expression "local_34 = 0x80" (identifier "local_34") (= "=") (number_literal "0x80")) (; ";")) (expression_statement "local_30 = 0;" (assignment_expression "local_30 = 0" (identifier "local_30") (= "=") (number_literal "0")) (; ";")) (expression_statement "local_2c = 1;" (assignment_expression "local_2c = 1" (identifier "local_2c") (= "=") (number_literal "1")) (; ";")) (expression_statement "local_28 = 0;" (assignment_expression "local_28 = 0" (identifier "local_28") (= "=") (number_literal "0")) (; ";")) (expression_statement "iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);" (assignment_expression "iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38)" (identifier "iVar2") (= "=") (call_expression "(*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38)" (parenthesized_expression "(*(code *)PTR_fcntl_00107498)" (( "(") (pointer_expression "*(code *)PTR_fcntl_00107498" (* "*") (cast_expression "(code *)PTR_fcntl_00107498" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_fcntl_00107498"))) () ")")) (argument_list "(iVar2,0xd,&local_38)" (( "(") (identifier "iVar2") (, ",") (number_literal "0xd") (, ",") (pointer_expression "&local_38" (& "&") (identifier "local_38")) () ")")))) (; ";")) (if_statement "if (iVar2 == -1) {\n      iVar4 = 5;\n    }" (if "if") (parenthesized_expression "(iVar2 == -1)" (( "(") (binary_expression "iVar2 == -1" (identifier "iVar2") (== "==") (number_literal "-1")) () ")")) (compound_statement "{\n      iVar4 = 5;\n    }" ({ "{") (expression_statement "iVar4 = 5;" (assignment_expression "iVar4 = 5" (identifier "iVar4") (= "=") (number_literal "5")) (; ";")) (} "}"))) (} "}"))) (labeled_statement "LAB_00039f01:\n  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }" (statement_identifier "LAB_00039f01") (: ":") (if_statement "if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_000d1450();\n  }" (if "if") (parenthesized_expression "(local_20 != *(int *)(in_GS_OFFSET + 0x14))" (( "(") (binary_expression "local_20 != *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_20") (!= "!=") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) () ")")) (compound_statement "{\n                    \n    FUN_000d1450();\n  }" ({ "{") (expression_statement "FUN_000d1450();" (call_expression "FUN_000d1450()" (identifier "FUN_000d1450") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}")))) (return_statement "return iVar4;" (return "return") (identifier "iVar4") (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

int __regparm3 function_1(type_1 *pDbFd,type_2 *pShmNode)

{
  int var_6;
  int var_2;
  int *piVar3;
  int var_3;
  int var_1;
  type_3 lock;
  type_3 f;
  
  var_3 = 0xf0a;
  var_6 = *(int *)(var_1 + 0x14);
  lock.l_start._0_4_ = 0x80;
  lock.l_start._4_4_ = 0;
  lock.l_len._0_4_ = 1;
  lock.l_len._4_4_ = 0;
  lock.l_type = 1;
  lock.l_whence = 0;
  var_2 = (*aSyscall[7].pCurrent)(pShmNode->hShm,0xc,&lock);
  if (var_2 != 0) goto LAB_00039f01;
  if (lock.l_type == 2) {
    if (pShmNode->isReadonly != '\0') {
      pShmNode->isUnlocked = '\x01';
      var_3 = 0x508;
      goto LAB_00039f01;
    }
    var_3 = pDbFd->pInode->pShmNode->hShm;
    if (-1 < var_3) {
      f.l_type = 1;
      f.l_whence = 0;
      f.l_start._0_4_ = 0x80;
      f.l_start._4_4_ = 0;
      f.l_len._0_4_ = 1;
      f.l_len._4_4_ = 0;
      var_3 = (*aSyscall[7].pCurrent)(var_3,0xd,&f);
      if (var_3 == -1) goto LAB_0003a000;
    }
    var_3 = pShmNode->hShm;
    do {
      var_2 = (*aSyscall[6].pCurrent)(var_3,3,0);
      if (-1 < var_2) {
        if (var_2 == 0) goto LAB_00039ead;
        break;
      }
      piVar3 = var_4();
    } while (*piVar3 == 4);
    var_3 = var_5(0x120a,"ftruncate",pShmNode->zFilename,0x9483);
    if (var_3 != 0) goto LAB_00039f01;
  }
  else if (lock.l_type == 1) {
LAB_0003a000:
    var_3 = 5;
    goto LAB_00039f01;
  }
LAB_00039ead:
  var_2 = pDbFd->pInode->pShmNode->hShm;
  var_3 = 0;
  if (-1 < var_2) {
    f.l_type = 0;
    f.l_whence = 0;
    f.l_start._0_4_ = 0x80;
    f.l_start._4_4_ = 0;
    f.l_len._0_4_ = 1;
    f.l_len._4_4_ = 0;
    var_2 = (*aSyscall[7].pCurrent)(var_2,0xd,&f);
    if (var_2 == -1) {
      var_3 = 5;
    }
  }
LAB_00039f01:
  if (var_6 != *(int *)(var_1 + 0x14)) {
                    /* WARNING: Subroutine does not return */
    var_7();
  }
  return var_3;
}


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

/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

int __regparm3 MASKED(int param_1,int param_2)

{
  undefined4 uVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int in_GS_OFFSET;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  int local_20;
  undefined4 uStack_14;
  
  uStack_14 = 0x39e3d;
  iVar4 = 0xf0a;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_4c = 0x80;
  local_48 = 0;
  local_44 = 1;
  local_40 = 0;
  local_50 = 1;
  iVar2 = (*(code *)PTR_fcntl_00107498)(*(undefined4 *)(param_2 + 0xc),0xc,&local_50);
  if (iVar2 != 0) goto LAB_00039f01;
  if ((short)local_50 == 2) {
    if (*(char *)(param_2 + 0x16) != '\0') {
      *(undefined1 *)(param_2 + 0x17) = 1;
      iVar4 = 0x508;
      goto LAB_00039f01;
    }
    iVar4 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);
    if (-1 < iVar4) {
      local_38 = 1;
      local_34 = 0x80;
      local_30 = 0;
      local_2c = 1;
      local_28 = 0;
      iVar4 = (*(code *)PTR_fcntl_00107498)(iVar4,0xd,&local_38);
      if (iVar4 == -1) goto LAB_0003a000;
    }
    uVar1 = *(undefined4 *)(param_2 + 0xc);
    do {
      iVar4 = (*(code *)PTR_ftruncate64_0010748c)(uVar1,3,0);
      if (-1 < iVar4) {
        if (iVar4 == 0) goto LAB_00039ead;
        break;
      }
      piVar3 = __errno_location();
    } while (*piVar3 == 4);
    iVar4 = FUN_00039de0(0x9483);
    if (iVar4 != 0) goto LAB_00039f01;
  }
  else if ((short)local_50 == 1) {
LAB_0003a000:
    iVar4 = 5;
    goto LAB_00039f01;
  }
LAB_00039ead:
  iVar2 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 0x28) + 0xc);
  iVar4 = 0;
  if (-1 < iVar2) {
    local_38 = 0;
    local_34 = 0x80;
    local_30 = 0;
    local_2c = 1;
    local_28 = 0;
    iVar2 = (*(code *)PTR_fcntl_00107498)(iVar2,0xd,&local_38);
    if (iVar2 == -1) {
      iVar4 = 5;
    }
  }
LAB_00039f01:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    FUN_000d1450();
  }
  return iVar4;
}

