
int history_do_write(char *filename,int nelements,int overwrite)

{
  char cVar1;
  long lVar2;
  bool bVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  char *__filename;
  HIST_ENTRY **ppHVar8;
  void *__buf;
  ssize_t sVar9;
  int *piVar10;
  long lVar11;
  HIST_ENTRY **ppHVar12;
  int iVar13;
  int iVar14;
  char *pcVar15;
  long in_FS_OFFSET;
  bool bVar16;
  byte bVar17;
  char *local_f8;
  stat finfo;
  
  bVar17 = 0;
  lVar2 = *(long *)(in_FS_OFFSET + 0x28);
  __filename = history_filename(filename);
  if (__filename == (char *)0x0) {
    piVar10 = __errno_location();
    iVar4 = *piVar10;
    local_f8 = (char *)0x0;
  }
  else {
    iVar4 = __xstat(1,__filename,(stat *)&finfo);
    bVar16 = iVar4 == 0;
    bVar3 = overwrite != 0 && bVar16;
    if (overwrite != 0 && bVar16) {
      bVar16 = bVar3;
      if (((finfo.st_mode & 0xf000) != 0x8000) ||
         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {
        local_f8 = (char *)0x0;
        pcVar15 = __filename;
      }
    }
    else {
      local_f8 = (char *)0x0;
      pcVar15 = __filename;
    }
    iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180);
    if (iVar5 != -1) {
      if (history_length <= nelements) {
        nelements = history_length;
      }
      ppHVar8 = history_list();
      iVar4 = history_length - nelements;
      if (iVar4 < history_length) {
        ppHVar12 = ppHVar8 + iVar4;
        iVar14 = 0;
        do {
          if (((history_write_timestamps != 0) &&
              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {
            lVar11 = -1;
            do {
              if (lVar11 == 0) break;
              lVar11 = lVar11 + -1;
              cVar1 = *pcVar15;
              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;
            } while (cVar1 != '\0');
            iVar14 = iVar14 + ~(uint)lVar11;
          }
          lVar11 = -1;
          pcVar15 = (*ppHVar12)->line;
          do {
            if (lVar11 == 0) break;
            lVar11 = lVar11 + -1;
            cVar1 = *pcVar15;
            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;
          } while (cVar1 != '\0');
          iVar14 = iVar14 + ~(uint)lVar11;
          ppHVar12 = ppHVar12 + 1;
        } while (ppHVar12 !=
                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));
      }
      else {
        iVar14 = 0;
      }
      __buf = malloc((long)iVar14);
      if (__buf == (void *)0x0) {
        piVar10 = __errno_location();
        iVar4 = *piVar10;
        close(iVar5);
        if (local_f8 == (char *)0x0) {
          if (__filename != (char *)0x0) {
            free(__filename);
          }
        }
        else {
          unlink(local_f8);
          if (__filename != (char *)0x0) {
            free(__filename);
          }
          free(local_f8);
        }
        goto LAB_001ce570;
      }
      iVar4 = history_length - nelements;
      if (iVar4 < history_length) {
        ppHVar12 = ppHVar8 + iVar4;
        iVar6 = history_length + -1;
        iVar13 = 0;
        do {
          if (((history_write_timestamps != 0) &&
              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {
            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);
            lVar11 = -1;
            pcVar15 = (*ppHVar12)->timestamp;
            do {
              if (lVar11 == 0) break;
              lVar11 = lVar11 + -1;
              cVar1 = *pcVar15;
              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;
            } while (cVar1 != '\0');
            iVar7 = iVar13 + -1 + ~(uint)lVar11;
            iVar13 = iVar7 + 1;
            *(undefined1 *)((long)__buf + (long)iVar7) = 10;
          }
          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);
          lVar11 = -1;
          pcVar15 = (*ppHVar12)->line;
          do {
            if (lVar11 == 0) break;
            lVar11 = lVar11 + -1;
            cVar1 = *pcVar15;
            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;
          } while (cVar1 != '\0');
          iVar7 = iVar13 + -1 + ~(uint)lVar11;
          iVar13 = iVar7 + 1;
          *(undefined1 *)((long)__buf + (long)iVar7) = 10;
          ppHVar12 = ppHVar12 + 1;
        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);
      }
      sVar9 = write(iVar5,__buf,(long)iVar14);
      iVar4 = 0;
      if (sVar9 < 0) {
        piVar10 = __errno_location();
        iVar4 = *piVar10;
      }
      xfree(__buf);
      history_lines_written_to_file = nelements;
      iVar5 = close(iVar5);
      if ((iVar5 < 0) && (iVar4 == 0)) {
        piVar10 = __errno_location();
        iVar4 = *piVar10;
      }
      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {
        if (iVar4 != 0) {
          if (local_f8 != (char *)0x0) goto LAB_001ce53d;
          goto LAB_001ce547;
        }
        if (bVar16) goto LAB_001ce5d9;
LAB_001ce551:
        if (__filename != (char *)0x0) goto LAB_001ce556;
      }
      else {
        iVar4 = histfile_restore(local_f8,__filename);
        if (iVar4 != 0) {
LAB_001ce53d:
          unlink(local_f8);
LAB_001ce547:
          history_lines_written_to_file = 0;
          goto LAB_001ce551;
        }
        if (bVar16) {
LAB_001ce5d9:
          chown(__filename,finfo.st_uid,finfo.st_gid);
          iVar4 = 0;
          goto LAB_001ce551;
        }
LAB_001ce556:
        free(__filename);
      }
      if (local_f8 != (char *)0x0) {
        free(local_f8);
      }
      goto LAB_001ce570;
    }
    piVar10 = __errno_location();
    iVar4 = *piVar10;
    free(__filename);
  }
  if (local_f8 != (char *)0x0) {
    free(local_f8);
  }
LAB_001ce570:
  if (lVar2 != *(long *)(in_FS_OFFSET + 0x28)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return iVar4;
}



int FUN_001ce234(undefined8 param_1,int param_2,int param_3)

{
  char cVar1;
  bool bVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  char *__filename;
  long lVar7;
  void *__buf;
  ssize_t sVar8;
  int *piVar9;
  long lVar10;
  long *plVar11;
  int iVar12;
  int iVar13;
  char *pcVar14;
  long in_FS_OFFSET;
  bool bVar15;
  byte bVar16;
  char *local_f8;
  stat local_d8;
  long local_40;
  
  bVar16 = 0;
  local_40 = *(long *)(in_FS_OFFSET + 0x28);
  __filename = (char *)FUN_001cdf95();
  if (__filename == (char *)0x0) {
    piVar9 = __errno_location();
    iVar3 = *piVar9;
    local_f8 = (char *)0x0;
  }
  else {
    iVar3 = __xstat(1,__filename,&local_d8);
    bVar15 = iVar3 == 0;
    bVar2 = param_3 != 0 && bVar15;
    if (param_3 != 0 && bVar15) {
      bVar15 = bVar2;
      if (((local_d8.st_mode & 0xf000) != 0x8000) ||
         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))
      {
        local_f8 = (char *)0x0;
        pcVar14 = __filename;
      }
    }
    else {
      local_f8 = (char *)0x0;
      pcVar14 = __filename;
    }
    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);
    if (iVar4 != -1) {
      if (history_length <= param_2) {
        param_2 = history_length;
      }
      lVar7 = history_list();
      iVar3 = history_length - param_2;
      if (iVar3 < history_length) {
        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);
        iVar13 = 0;
        do {
          if (((history_write_timestamps != 0) &&
              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {
            lVar10 = -1;
            do {
              if (lVar10 == 0) break;
              lVar10 = lVar10 + -1;
              cVar1 = *pcVar14;
              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;
            } while (cVar1 != '\0');
            iVar13 = iVar13 + ~(uint)lVar10;
          }
          lVar10 = -1;
          pcVar14 = *(char **)*plVar11;
          do {
            if (lVar10 == 0) break;
            lVar10 = lVar10 + -1;
            cVar1 = *pcVar14;
            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;
          } while (cVar1 != '\0');
          iVar13 = iVar13 + ~(uint)lVar10;
          plVar11 = plVar11 + 1;
        } while (plVar11 !=
                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *
                                  8));
      }
      else {
        iVar13 = 0;
      }
      __buf = malloc((long)iVar13);
      if (__buf == (void *)0x0) {
        piVar9 = __errno_location();
        iVar3 = *piVar9;
        close(iVar4);
        if (local_f8 == (char *)0x0) {
          if (__filename != (char *)0x0) {
            free(__filename);
          }
        }
        else {
          unlink(local_f8);
          if (__filename != (char *)0x0) {
            free(__filename);
          }
          free(local_f8);
        }
        goto LAB_001ce570;
      }
      iVar3 = history_length - param_2;
      if (iVar3 < history_length) {
        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);
        iVar5 = history_length + -1;
        iVar12 = 0;
        do {
          if (((history_write_timestamps != 0) &&
              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {
            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);
            lVar10 = -1;
            pcVar14 = *(char **)(*plVar11 + 8);
            do {
              if (lVar10 == 0) break;
              lVar10 = lVar10 + -1;
              cVar1 = *pcVar14;
              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;
            } while (cVar1 != '\0');
            iVar6 = iVar12 + -1 + ~(uint)lVar10;
            iVar12 = iVar6 + 1;
            *(undefined1 *)((long)__buf + (long)iVar6) = 10;
          }
          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);
          lVar10 = -1;
          pcVar14 = *(char **)*plVar11;
          do {
            if (lVar10 == 0) break;
            lVar10 = lVar10 + -1;
            cVar1 = *pcVar14;
            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;
          } while (cVar1 != '\0');
          iVar6 = iVar12 + -1 + ~(uint)lVar10;
          iVar12 = iVar6 + 1;
          *(undefined1 *)((long)__buf + (long)iVar6) = 10;
          plVar11 = plVar11 + 1;
        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);
      }
      sVar8 = write(iVar4,__buf,(long)iVar13);
      iVar3 = 0;
      if (sVar8 < 0) {
        piVar9 = __errno_location();
        iVar3 = *piVar9;
      }
      xfree(__buf);
      history_lines_written_to_file = param_2;
      iVar4 = close(iVar4);
      if ((iVar4 < 0) && (iVar3 == 0)) {
        piVar9 = __errno_location();
        iVar3 = *piVar9;
      }
      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {
        if (iVar3 != 0) {
          if (local_f8 != (char *)0x0) goto LAB_001ce53d;
          goto LAB_001ce547;
        }
        if (bVar15) goto LAB_001ce5d9;
LAB_001ce551:
        if (__filename != (char *)0x0) goto LAB_001ce556;
      }
      else {
        iVar3 = FUN_001ce1bf(local_f8,__filename);
        if (iVar3 != 0) {
LAB_001ce53d:
          unlink(local_f8);
LAB_001ce547:
          history_lines_written_to_file = 0;
          goto LAB_001ce551;
        }
        if (bVar15) {
LAB_001ce5d9:
          chown(__filename,local_d8.st_uid,local_d8.st_gid);
          iVar3 = 0;
          goto LAB_001ce551;
        }
LAB_001ce556:
        free(__filename);
      }
      if (local_f8 != (char *)0x0) {
        free(local_f8);
      }
      goto LAB_001ce570;
    }
    piVar9 = __errno_location();
    iVar3 = *piVar9;
    free(__filename);
  }
  if (local_f8 != (char *)0x0) {
    free(local_f8);
  }
LAB_001ce570:
  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return iVar3;
}


PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0xd8
MOV EBP,ESI
MOV R12D,EDX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0xc8],RAX
XOR EAX,EAX
CMP EDX,0x1
SBB EBX,EBX
AND EBX,0x1c0
ADD EBX,0x241
CALL 0x001cdf95
MOV R14,RAX
TEST RAX,RAX
JZ 0x001ce645
LEA RDX,[RSP + 0x30]
MOV RSI,RAX
MOV EDI,0x1
CALL 0x0012d740
TEST EAX,EAX
SETZ DL
TEST R12D,R12D
SETNZ AL
AND AL,DL
MOV byte ptr [RSP + 0x2f],AL
JZ 0x001ce630
MOV EAX,dword ptr [RSP + 0x48]
AND EAX,0xf000
CMP EAX,0x8000
JZ 0x001ce344
MOV RDI,R14
MOV qword ptr [RSP + 0x10],0x0
MOV EDX,0x180
MOV ESI,EBX
MOV EAX,0x0
CALL 0x0012da80
MOV dword ptr [RSP + 0x1c],EAX
CMP EAX,-0x1
JZ 0x001ce609
CMP dword ptr [0x0021c988],EBP
CMOVLE EBP,dword ptr [0x0021c988]
MOV EBX,EBP
MOV dword ptr [RSP + 0x28],EBP
CALL 0x001caaaa
MOV RBP,RAX
MOV EAX,dword ptr [0x0021c988]
MOV ECX,EAX
SUB ECX,EBX
CMP EAX,ECX
JLE 0x001ce3a1
MOV R10D,dword ptr [0x00217758]
MOVSXD RSI,ECX
LEA RDX,[RBP + RSI*0x8]
SUB EAX,0x1
SUB EAX,ECX
LEA RAX,[RSI + RAX*0x1 + 0x1]
LEA R9,[RBP + RAX*0x8]
MOV ESI,0x0
MOV R8,-0x1
MOV EAX,0x0
JMP 0x001ce37b
MOV RDI,R14
CALL 0x001ce03d
MOV RDI,RAX
MOV qword ptr [RSP + 0x10],RAX
TEST RAX,RAX
JNZ 0x001ce2c8
JMP 0x001ce2bc
MOV RCX,qword ptr [RDX]
MOV RDI,qword ptr [RCX]
MOV RCX,R8
SCASB.REPNE RDI
NOT RCX
ADD ESI,ECX
ADD RDX,0x8
CMP RDX,R9
JZ 0x001ce3a6
TEST R10D,R10D
JZ 0x001ce362
MOV RCX,qword ptr [RDX]
MOV RDI,qword ptr [RCX + 0x8]
TEST RDI,RDI
JZ 0x001ce362
CMP byte ptr [RDI],0x0
JZ 0x001ce362
MOV RCX,R8
SCASB.REPNE RDI
MOV RDI,RCX
NOT RDI
LEA ESI,[RSI + RDI*0x1]
JMP 0x001ce362
MOV ESI,0x0
MOVSXD RAX,ESI
MOV qword ptr [RSP + 0x20],RAX
MOV RDI,RAX
CALL 0x0012d7a0
MOV R12,RAX
TEST RAX,RAX
JZ 0x001ce3f7
MOV EAX,dword ptr [0x0021c988]
MOV EDX,EAX
SUB EDX,dword ptr [RSP + 0x28]
CMP EAX,EDX
JLE 0x001ce4ca
MOVSXD RCX,EDX
LEA RBX,[RBP + RCX*0x8]
SUB EAX,0x1
SUB EAX,EDX
LEA RAX,[RCX + RAX*0x1 + 0x1]
LEA R15,[RBP + RAX*0x8]
MOV EBP,0x0
MOV R13,-0x1
JMP 0x001ce474
CALL 0x0012d120
MOV EBX,dword ptr [RAX]
MOV EDI,dword ptr [RSP + 0x1c]
CALL 0x0012ddb8
MOV RAX,qword ptr [RSP + 0x10]
TEST RAX,RAX
JZ 0x001ce5f3
MOV RDI,RAX
CALL 0x0012ddb0
TEST R14,R14
JZ 0x001ce42a
MOV RDI,R14
CALL 0x0012d080
MOV RDI,qword ptr [RSP + 0x10]
CALL 0x0012d080
JMP 0x001ce570
MOV RAX,qword ptr [RBX]
MOVSXD RDI,EBP
ADD RDI,R12
MOV RSI,qword ptr [RAX]
CALL 0x0012d160
MOV RAX,qword ptr [RBX]
MOV RDI,qword ptr [RAX]
MOV RCX,R13
MOV EAX,0x0
SCASB.REPNE RDI
NOT RCX
LEA EAX,[RBP + RCX*0x1 + -0x1]
LEA EBP,[RAX + 0x1]
CDQE
MOV byte ptr [R12 + RAX*0x1],0xa
ADD RBX,0x8
CMP R15,RBX
JZ 0x001ce4ca
CMP dword ptr [0x00217758],0x0
JZ 0x001ce439
MOV qword ptr [RSP + 0x8],RBX
MOV RAX,qword ptr [RBX]
MOV RSI,qword ptr [RAX + 0x8]
TEST RSI,RSI
JZ 0x001ce439
CMP byte ptr [RSI],0x0
JZ 0x001ce439
MOVSXD RDI,EBP
ADD RDI,R12
CALL 0x0012d160
MOV RAX,qword ptr [RSP + 0x8]
MOV RAX,qword ptr [RAX]
MOV RDI,qword ptr [RAX + 0x8]
MOV RCX,R13
MOV EAX,0x0
SCASB.REPNE RDI
NOT RCX
LEA EAX,[RBP + RCX*0x1 + -0x1]
LEA EBP,[RAX + 0x1]
CDQE
MOV byte ptr [R12 + RAX*0x1],0xa
JMP 0x001ce439
MOV RDX,qword ptr [RSP + 0x20]
MOV RSI,R12
MOV EDI,dword ptr [RSP + 0x1c]
CALL 0x0012d270
MOV EBX,0x0
TEST RAX,RAX
JS 0x001ce59b
MOV RDI,R12
CALL 0x00188201
MOV EAX,dword ptr [RSP + 0x28]
MOV dword ptr [0x0021774c],EAX
MOV EDI,dword ptr [RSP + 0x1c]
CALL 0x0012ddb8
TEST EAX,EAX
JNS 0x001ce510
TEST EBX,EBX
JZ 0x001ce5a7
TEST R14,R14
SETNZ DL
MOV RDI,qword ptr [RSP + 0x10]
TEST RDI,RDI
SETNZ AL
TEST DL,AL
JZ 0x001ce52d
TEST EBX,EBX
JZ 0x001ce5b3
TEST EBX,EBX
JZ 0x001ce5ce
CMP qword ptr [RSP + 0x10],0x0
JZ 0x001ce547
MOV RDI,qword ptr [RSP + 0x10]
CALL 0x0012ddb0
MOV dword ptr [0x0021774c],0x0
TEST R14,R14
JZ 0x001ce55e
MOV RDI,R14
CALL 0x0012d080
MOV RAX,qword ptr [RSP + 0x10]
TEST RAX,RAX
JZ 0x001ce570
MOV RDI,RAX
CALL 0x0012d080
MOV EAX,EBX
MOV RSI,qword ptr [RSP + 0xc8]
XOR RSI,qword ptr FS:[0x28]
JNZ 0x001ce653
ADD RSP,0xd8
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
CALL 0x0012d120
MOV EBX,dword ptr [RAX]
JMP 0x001ce4e9
CALL 0x0012d120
MOV EBX,dword ptr [RAX]
JMP 0x001ce510
MOV RSI,R14
CALL 0x001ce1bf
MOV EBX,EAX
TEST EAX,EAX
JNZ 0x001ce53d
CMP byte ptr [RSP + 0x2f],0x0
JNZ 0x001ce5d9
JMP 0x001ce556
CMP byte ptr [RSP + 0x2f],0x0
JZ 0x001ce551
MOV EDX,dword ptr [RSP + 0x50]
MOV ESI,dword ptr [RSP + 0x4c]
MOV RDI,R14
CALL 0x0012d910
MOV EBX,0x0
JMP 0x001ce551
TEST R14,R14
JZ 0x001ce570
MOV RDI,R14
CALL 0x0012d080
JMP 0x001ce570
CALL 0x0012d120
MOV EBX,dword ptr [RAX]
MOV RDI,R14
CALL 0x0012d080
MOV RDI,qword ptr [RSP + 0x10]
TEST RDI,RDI
JZ 0x001ce570
CALL 0x0012d080
JMP 0x001ce570
MOV RDI,R14
MOV byte ptr [RSP + 0x2f],DL
MOV qword ptr [RSP + 0x10],0x0
JMP 0x001ce2c8
CALL 0x0012d120
MOV EBX,dword ptr [RAX]
MOV qword ptr [RSP + 0x10],R14
JMP 0x001ce618
CALL 0x0012d3b0
(translation_unit "int FUN_001ce234(undefined8 param_1,int param_2,int param_3)\n\n{\n  char cVar1;\n  bool bVar2;\n  int iVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  char *__filename;\n  long lVar7;\n  void *__buf;\n  ssize_t sVar8;\n  int *piVar9;\n  long lVar10;\n  long *plVar11;\n  int iVar12;\n  int iVar13;\n  char *pcVar14;\n  long in_FS_OFFSET;\n  bool bVar15;\n  byte bVar16;\n  char *local_f8;\n  stat local_d8;\n  long local_40;\n  \n  bVar16 = 0;\n  local_40 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = (char *)FUN_001cdf95();\n  if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }\n  return iVar3;\n}\n\n" (function_definition "int FUN_001ce234(undefined8 param_1,int param_2,int param_3)\n\n{\n  char cVar1;\n  bool bVar2;\n  int iVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  char *__filename;\n  long lVar7;\n  void *__buf;\n  ssize_t sVar8;\n  int *piVar9;\n  long lVar10;\n  long *plVar11;\n  int iVar12;\n  int iVar13;\n  char *pcVar14;\n  long in_FS_OFFSET;\n  bool bVar15;\n  byte bVar16;\n  char *local_f8;\n  stat local_d8;\n  long local_40;\n  \n  bVar16 = 0;\n  local_40 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = (char *)FUN_001cdf95();\n  if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }\n  return iVar3;\n}" primitive_type (function_declarator "FUN_001ce234(undefined8 param_1,int param_2,int param_3)" identifier (parameter_list "(undefined8 param_1,int param_2,int param_3)" ( (parameter_declaration "undefined8 param_1" type_identifier identifier) , (parameter_declaration "int param_2" primitive_type identifier) , (parameter_declaration "int param_3" primitive_type identifier) ))) (compound_statement "{\n  char cVar1;\n  bool bVar2;\n  int iVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  char *__filename;\n  long lVar7;\n  void *__buf;\n  ssize_t sVar8;\n  int *piVar9;\n  long lVar10;\n  long *plVar11;\n  int iVar12;\n  int iVar13;\n  char *pcVar14;\n  long in_FS_OFFSET;\n  bool bVar15;\n  byte bVar16;\n  char *local_f8;\n  stat local_d8;\n  long local_40;\n  \n  bVar16 = 0;\n  local_40 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = (char *)FUN_001cdf95();\n  if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }\n  return iVar3;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "bool bVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "int iVar6;" primitive_type identifier ;) (declaration "char *__filename;" primitive_type (pointer_declarator "*__filename" * identifier) ;) (declaration "long lVar7;" (sized_type_specifier "long" long) identifier ;) (declaration "void *__buf;" primitive_type (pointer_declarator "*__buf" * identifier) ;) (declaration "ssize_t sVar8;" primitive_type identifier ;) (declaration "int *piVar9;" primitive_type (pointer_declarator "*piVar9" * identifier) ;) (declaration "long lVar10;" (sized_type_specifier "long" long) identifier ;) (declaration "long *plVar11;" (sized_type_specifier "long" long) (pointer_declarator "*plVar11" * identifier) ;) (declaration "int iVar12;" primitive_type identifier ;) (declaration "int iVar13;" primitive_type identifier ;) (declaration "char *pcVar14;" primitive_type (pointer_declarator "*pcVar14" * identifier) ;) (declaration "long in_FS_OFFSET;" (sized_type_specifier "long" long) identifier ;) (declaration "bool bVar15;" primitive_type identifier ;) (declaration "byte bVar16;" type_identifier identifier ;) (declaration "char *local_f8;" primitive_type (pointer_declarator "*local_f8" * identifier) ;) (declaration "stat local_d8;" type_identifier identifier ;) (declaration "long local_40;" (sized_type_specifier "long" long) identifier ;) (expression_statement "bVar16 = 0;" (assignment_expression "bVar16 = 0" identifier = number_literal) ;) (expression_statement "local_40 = *(long *)(in_FS_OFFSET + 0x28);" (assignment_expression "local_40 = *(long *)(in_FS_OFFSET + 0x28)" identifier = (pointer_expression "*(long *)(in_FS_OFFSET + 0x28)" * (cast_expression "(long *)(in_FS_OFFSET + 0x28)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_FS_OFFSET + 0x28)" ( (binary_expression "in_FS_OFFSET + 0x28" identifier + number_literal) ))))) ;) (expression_statement "__filename = (char *)FUN_001cdf95();" (assignment_expression "__filename = (char *)FUN_001cdf95()" identifier = (cast_expression "(char *)FUN_001cdf95()" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_001cdf95()" identifier (argument_list "()" ( ))))) ;) (if_statement "if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" if (parenthesized_expression "(__filename == (char *)0x0)" ( (binary_expression "__filename == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }" { (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) }) (else_clause "else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" else (compound_statement "{\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" { (expression_statement "iVar3 = __xstat(1,__filename,&local_d8);" (assignment_expression "iVar3 = __xstat(1,__filename,&local_d8)" identifier = (call_expression "__xstat(1,__filename,&local_d8)" identifier (argument_list "(1,__filename,&local_d8)" ( number_literal , identifier , (pointer_expression "&local_d8" & identifier) )))) ;) (expression_statement "bVar15 = iVar3 == 0;" (assignment_expression "bVar15 = iVar3 == 0" identifier = (binary_expression "iVar3 == 0" identifier == number_literal)) ;) (expression_statement "bVar2 = param_3 != 0 && bVar15;" (assignment_expression "bVar2 = param_3 != 0 && bVar15" identifier = (binary_expression "param_3 != 0 && bVar15" (binary_expression "param_3 != 0" identifier != number_literal) && identifier)) ;) (if_statement "if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" if (parenthesized_expression "(param_3 != 0 && bVar15)" ( (binary_expression "param_3 != 0 && bVar15" (binary_expression "param_3 != 0" identifier != number_literal) && identifier) )) (compound_statement "{\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }" { (expression_statement "bVar15 = bVar2;" (assignment_expression "bVar15 = bVar2" identifier = identifier) ;) (if_statement "if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }" if (parenthesized_expression "(((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))" ( (binary_expression "((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0)" (parenthesized_expression "((local_d8.st_mode & 0xf000) != 0x8000)" ( (binary_expression "(local_d8.st_mode & 0xf000) != 0x8000" (parenthesized_expression "(local_d8.st_mode & 0xf000)" ( (binary_expression "local_d8.st_mode & 0xf000" (field_expression "local_d8.st_mode" identifier . field_identifier) & number_literal) )) != number_literal) )) || (parenthesized_expression "(local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0)" ( (comma_expression "local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0" (assignment_expression "local_f8 = (char *)FUN_001ce03d(__filename)" identifier = (cast_expression "(char *)FUN_001ce03d(__filename)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_001ce03d(__filename)" identifier (argument_list "(__filename)" ( identifier ))))) , (comma_expression "pcVar14 = local_f8, local_f8 == (char *)0x0" (assignment_expression "pcVar14 = local_f8" identifier = identifier) , (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)))) ))) )) (compound_statement "{\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }" { (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (expression_statement "pcVar14 = __filename;" (assignment_expression "pcVar14 = __filename" identifier = identifier) ;) })) }) (else_clause "else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" else (compound_statement "{\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" { (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (expression_statement "pcVar14 = __filename;" (assignment_expression "pcVar14 = __filename" identifier = identifier) ;) }))) (expression_statement "iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);" (assignment_expression "iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" identifier = (call_expression "open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" identifier (argument_list "(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" ( identifier , (binary_expression "(-(uint)(param_3 == 0) & 0x1c0) + 0x241" (parenthesized_expression "(-(uint)(param_3 == 0) & 0x1c0)" ( (binary_expression "-(uint)(param_3 == 0) & 0x1c0" (unary_expression "-(uint)(param_3 == 0)" - (call_expression "(uint)(param_3 == 0)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(param_3 == 0)" ( (binary_expression "param_3 == 0" identifier == number_literal) )))) & number_literal) )) + number_literal) , number_literal )))) ;) (if_statement "if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }" if (parenthesized_expression "(iVar4 != -1)" ( (binary_expression "iVar4 != -1" identifier != number_literal) )) (compound_statement "{\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }" { (if_statement "if (history_length <= param_2) {\n        param_2 = history_length;\n      }" if (parenthesized_expression "(history_length <= param_2)" ( (binary_expression "history_length <= param_2" identifier <= identifier) )) (compound_statement "{\n        param_2 = history_length;\n      }" { (expression_statement "param_2 = history_length;" (assignment_expression "param_2 = history_length" identifier = identifier) ;) })) (expression_statement "lVar7 = history_list();" (assignment_expression "lVar7 = history_list()" identifier = (call_expression "history_list()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = history_length - param_2;" (assignment_expression "iVar3 = history_length - param_2" identifier = (binary_expression "history_length - param_2" identifier - identifier)) ;) (if_statement "if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }" if (parenthesized_expression "(iVar3 < history_length)" ( (binary_expression "iVar3 < history_length" identifier < identifier) )) (compound_statement "{\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }" { (expression_statement "plVar11 = (long *)(lVar7 + (long)iVar3 * 8);" (assignment_expression "plVar11 = (long *)(lVar7 + (long)iVar3 * 8)" identifier = (cast_expression "(long *)(lVar7 + (long)iVar3 * 8)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar7 + (long)iVar3 * 8)" ( (binary_expression "lVar7 + (long)iVar3 * 8" identifier + (binary_expression "(long)iVar3 * 8" (cast_expression "(long)iVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) * number_literal)) )))) ;) (expression_statement "iVar13 = 0;" (assignment_expression "iVar13 = 0" identifier = number_literal) ;) (do_statement "do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));" do (compound_statement "{\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        }" { (if_statement "if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }" if (parenthesized_expression "(((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0'))" ( (binary_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')" (parenthesized_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0))" ( (binary_expression "(history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" (parenthesized_expression "(history_write_timestamps != 0)" ( (binary_expression "history_write_timestamps != 0" identifier != number_literal) )) && (parenthesized_expression "(pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" ( (comma_expression "pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" identifier = (pointer_expression "*(char **)(*plVar11 + 8)" * (cast_expression "(char **)(*plVar11 + 8)" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*plVar11 + 8)" ( (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" * identifier) + number_literal) ))))) , (binary_expression "pcVar14 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) ))) )) && (parenthesized_expression "(*pcVar14 != '\0')" ( (binary_expression "*pcVar14 != '\0'" (pointer_expression "*pcVar14" * identifier) != (char_literal "'\0'" ' escape_sequence ')) ))) )) (compound_statement "{\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }" { (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" identifier = number_literal) ;) (do_statement "do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');" do (compound_statement "{\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            }" { (if_statement "if (lVar10 == 0) break;" if (parenthesized_expression "(lVar10 == 0)" ( (binary_expression "lVar10 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" identifier = (binary_expression "lVar10 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" identifier = (pointer_expression "*pcVar14" * identifier)) ;) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" identifier = (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" identifier + (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar13 = iVar13 + ~(uint)lVar10;" (assignment_expression "iVar13 = iVar13 + ~(uint)lVar10" identifier = (binary_expression "iVar13 + ~(uint)lVar10" identifier + (unary_expression "~(uint)lVar10" ~ (cast_expression "(uint)lVar10" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) })) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" identifier = number_literal) ;) (expression_statement "pcVar14 = *(char **)*plVar11;" (assignment_expression "pcVar14 = *(char **)*plVar11" identifier = (pointer_expression "*(char **)*plVar11" * (cast_expression "(char **)*plVar11" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (pointer_expression "*plVar11" * identifier)))) ;) (do_statement "do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');" do (compound_statement "{\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          }" { (if_statement "if (lVar10 == 0) break;" if (parenthesized_expression "(lVar10 == 0)" ( (binary_expression "lVar10 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" identifier = (binary_expression "lVar10 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" identifier = (pointer_expression "*pcVar14" * identifier)) ;) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" identifier = (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" identifier + (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar13 = iVar13 + ~(uint)lVar10;" (assignment_expression "iVar13 = iVar13 + ~(uint)lVar10" identifier = (binary_expression "iVar13 + ~(uint)lVar10" identifier + (unary_expression "~(uint)lVar10" ~ (cast_expression "(uint)lVar10" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "plVar11 = plVar11 + 1;" (assignment_expression "plVar11 = plVar11 + 1" identifier = (binary_expression "plVar11 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8))" ( (binary_expression "plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" identifier != (cast_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" ( (binary_expression "lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8" identifier + (binary_expression "((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8" (parenthesized_expression "((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3))" ( (binary_expression "(long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)" (binary_expression "(long)iVar3 + 1" (cast_expression "(long)iVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + number_literal) + (call_expression "(ulong)(uint)((history_length + -1) - iVar3)" (call_expression "(ulong)(uint)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(uint)" ( identifier ))) (argument_list "((history_length + -1) - iVar3)" ( (binary_expression "(history_length + -1) - iVar3" (parenthesized_expression "(history_length + -1)" ( (binary_expression "history_length + -1" identifier + number_literal) )) - identifier) )))) )) * number_literal)) )))) )) ;) }) (else_clause "else {\n        iVar13 = 0;\n      }" else (compound_statement "{\n        iVar13 = 0;\n      }" { (expression_statement "iVar13 = 0;" (assignment_expression "iVar13 = 0" identifier = number_literal) ;) }))) (expression_statement "__buf = malloc((long)iVar13);" (assignment_expression "__buf = malloc((long)iVar13)" identifier = (call_expression "malloc((long)iVar13)" identifier (argument_list "((long)iVar13)" ( (cast_expression "(long)iVar13" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) )))) ;) (if_statement "if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }" if (parenthesized_expression "(__buf == (void *)0x0)" ( (binary_expression "__buf == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }" { (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) (expression_statement "close(iVar4);" (call_expression "close(iVar4)" identifier (argument_list "(iVar4)" ( identifier ))) ;) (if_statement "if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" if (parenthesized_expression "(local_f8 == (char *)0x0)" ( (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }" { (if_statement "if (__filename != (char *)0x0) {\n            free(__filename);\n          }" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n            free(__filename);\n          }" { (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) })) }) (else_clause "else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" else (compound_statement "{\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" { (expression_statement "unlink(local_f8);" (call_expression "unlink(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) (if_statement "if (__filename != (char *)0x0) {\n            free(__filename);\n          }" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n            free(__filename);\n          }" { (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) })) (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) }))) (goto_statement "goto LAB_001ce570;" goto statement_identifier ;) })) (expression_statement "iVar3 = history_length - param_2;" (assignment_expression "iVar3 = history_length - param_2" identifier = (binary_expression "history_length - param_2" identifier - identifier)) ;) (if_statement "if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }" if (parenthesized_expression "(iVar3 < history_length)" ( (binary_expression "iVar3 < history_length" identifier < identifier) )) (compound_statement "{\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }" { (expression_statement "plVar11 = (long *)(lVar7 + (long)iVar3 * 8);" (assignment_expression "plVar11 = (long *)(lVar7 + (long)iVar3 * 8)" identifier = (cast_expression "(long *)(lVar7 + (long)iVar3 * 8)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar7 + (long)iVar3 * 8)" ( (binary_expression "lVar7 + (long)iVar3 * 8" identifier + (binary_expression "(long)iVar3 * 8" (cast_expression "(long)iVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) * number_literal)) )))) ;) (expression_statement "iVar5 = history_length + -1;" (assignment_expression "iVar5 = history_length + -1" identifier = (binary_expression "history_length + -1" identifier + number_literal)) ;) (expression_statement "iVar12 = 0;" (assignment_expression "iVar12 = 0" identifier = number_literal) ;) (do_statement "do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);" do (compound_statement "{\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        }" { (if_statement "if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }" if (parenthesized_expression "(((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0'))" ( (binary_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')" (parenthesized_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0))" ( (binary_expression "(history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" (parenthesized_expression "(history_write_timestamps != 0)" ( (binary_expression "history_write_timestamps != 0" identifier != number_literal) )) && (parenthesized_expression "(pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" ( (comma_expression "pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" identifier = (pointer_expression "*(char **)(*plVar11 + 8)" * (cast_expression "(char **)(*plVar11 + 8)" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*plVar11 + 8)" ( (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" * identifier) + number_literal) ))))) , (binary_expression "pcVar14 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) ))) )) && (parenthesized_expression "(*pcVar14 != '\0')" ( (binary_expression "*pcVar14 != '\0'" (pointer_expression "*pcVar14" * identifier) != (char_literal "'\0'" ' escape_sequence ')) ))) )) (compound_statement "{\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }" { (expression_statement "strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);" (call_expression "strcpy((char *)((long)iVar12 + (long)__buf),pcVar14)" identifier (argument_list "((char *)((long)iVar12 + (long)__buf),pcVar14)" ( (cast_expression "(char *)((long)iVar12 + (long)__buf)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)iVar12 + (long)__buf)" ( (binary_expression "(long)iVar12 + (long)__buf" (cast_expression "(long)iVar12" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , identifier ))) ;) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" identifier = number_literal) ;) (expression_statement "pcVar14 = *(char **)(*plVar11 + 8);" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" identifier = (pointer_expression "*(char **)(*plVar11 + 8)" * (cast_expression "(char **)(*plVar11 + 8)" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*plVar11 + 8)" ( (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" * identifier) + number_literal) ))))) ;) (do_statement "do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');" do (compound_statement "{\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            }" { (if_statement "if (lVar10 == 0) break;" if (parenthesized_expression "(lVar10 == 0)" ( (binary_expression "lVar10 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" identifier = (binary_expression "lVar10 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" identifier = (pointer_expression "*pcVar14" * identifier)) ;) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" identifier = (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" identifier + (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar6 = iVar12 + -1 + ~(uint)lVar10;" (assignment_expression "iVar6 = iVar12 + -1 + ~(uint)lVar10" identifier = (binary_expression "iVar12 + -1 + ~(uint)lVar10" (binary_expression "iVar12 + -1" identifier + number_literal) + (unary_expression "~(uint)lVar10" ~ (cast_expression "(uint)lVar10" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "iVar12 = iVar6 + 1;" (assignment_expression "iVar12 = iVar6 + 1" identifier = (binary_expression "iVar6 + 1" identifier + number_literal)) ;) (expression_statement "*(undefined1 *)((long)__buf + (long)iVar6) = 10;" (assignment_expression "*(undefined1 *)((long)__buf + (long)iVar6) = 10" (pointer_expression "*(undefined1 *)((long)__buf + (long)iVar6)" * (cast_expression "(undefined1 *)((long)__buf + (long)iVar6)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)__buf + (long)iVar6)" ( (binary_expression "(long)__buf + (long)iVar6" (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) = number_literal) ;) })) (expression_statement "strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);" (call_expression "strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11)" identifier (argument_list "((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11)" ( (cast_expression "(char *)((long)iVar12 + (long)__buf)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)iVar12 + (long)__buf)" ( (binary_expression "(long)iVar12 + (long)__buf" (cast_expression "(long)iVar12" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , (pointer_expression "*(char **)*plVar11" * (cast_expression "(char **)*plVar11" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (pointer_expression "*plVar11" * identifier))) ))) ;) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" identifier = number_literal) ;) (expression_statement "pcVar14 = *(char **)*plVar11;" (assignment_expression "pcVar14 = *(char **)*plVar11" identifier = (pointer_expression "*(char **)*plVar11" * (cast_expression "(char **)*plVar11" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (pointer_expression "*plVar11" * identifier)))) ;) (do_statement "do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');" do (compound_statement "{\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          }" { (if_statement "if (lVar10 == 0) break;" if (parenthesized_expression "(lVar10 == 0)" ( (binary_expression "lVar10 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" identifier = (binary_expression "lVar10 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" identifier = (pointer_expression "*pcVar14" * identifier)) ;) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" identifier = (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" identifier + (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar6 = iVar12 + -1 + ~(uint)lVar10;" (assignment_expression "iVar6 = iVar12 + -1 + ~(uint)lVar10" identifier = (binary_expression "iVar12 + -1 + ~(uint)lVar10" (binary_expression "iVar12 + -1" identifier + number_literal) + (unary_expression "~(uint)lVar10" ~ (cast_expression "(uint)lVar10" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "iVar12 = iVar6 + 1;" (assignment_expression "iVar12 = iVar6 + 1" identifier = (binary_expression "iVar6 + 1" identifier + number_literal)) ;) (expression_statement "*(undefined1 *)((long)__buf + (long)iVar6) = 10;" (assignment_expression "*(undefined1 *)((long)__buf + (long)iVar6) = 10" (pointer_expression "*(undefined1 *)((long)__buf + (long)iVar6)" * (cast_expression "(undefined1 *)((long)__buf + (long)iVar6)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)__buf + (long)iVar6)" ( (binary_expression "(long)__buf + (long)iVar6" (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) = number_literal) ;) (expression_statement "plVar11 = plVar11 + 1;" (assignment_expression "plVar11 = plVar11 + 1" identifier = (binary_expression "plVar11 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11)" ( (binary_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11" (cast_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8)" ( (binary_expression "lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8" identifier + (binary_expression "((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8" (parenthesized_expression "((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3))" ( (binary_expression "(long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)" (binary_expression "(long)iVar3 + 1" (cast_expression "(long)iVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + number_literal) + (call_expression "(ulong)(uint)(iVar5 - iVar3)" (call_expression "(ulong)(uint)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(uint)" ( identifier ))) (argument_list "(iVar5 - iVar3)" ( (binary_expression "iVar5 - iVar3" identifier - identifier) )))) )) * number_literal)) ))) != identifier) )) ;) })) (expression_statement "sVar8 = write(iVar4,__buf,(long)iVar13);" (assignment_expression "sVar8 = write(iVar4,__buf,(long)iVar13)" identifier = (call_expression "write(iVar4,__buf,(long)iVar13)" identifier (argument_list "(iVar4,__buf,(long)iVar13)" ( identifier , identifier , (cast_expression "(long)iVar13" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) )))) ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (if_statement "if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" if (parenthesized_expression "(sVar8 < 0)" ( (binary_expression "sVar8 < 0" identifier < number_literal) )) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" { (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) })) (expression_statement "xfree(__buf);" (call_expression "xfree(__buf)" identifier (argument_list "(__buf)" ( identifier ))) ;) (expression_statement "history_lines_written_to_file = param_2;" (assignment_expression "history_lines_written_to_file = param_2" identifier = identifier) ;) (expression_statement "iVar4 = close(iVar4);" (assignment_expression "iVar4 = close(iVar4)" identifier = (call_expression "close(iVar4)" identifier (argument_list "(iVar4)" ( identifier )))) ;) (if_statement "if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" if (parenthesized_expression "((iVar4 < 0) && (iVar3 == 0))" ( (binary_expression "(iVar4 < 0) && (iVar3 == 0)" (parenthesized_expression "(iVar4 < 0)" ( (binary_expression "iVar4 < 0" identifier < number_literal) )) && (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) ))) )) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" { (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) })) (if_statement "if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" if (parenthesized_expression "((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0))" ( (binary_expression "(__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)" (parenthesized_expression "(__filename == (char *)0x0 || local_f8 == (char *)0x0)" ( (binary_expression "__filename == (char *)0x0 || local_f8 == (char *)0x0" (binary_expression "__filename == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) || (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) )) || (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) ))) )) (compound_statement "{\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }" { (if_statement "if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }" { (if_statement "if (local_f8 != (char *)0x0) goto LAB_001ce53d;" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (goto_statement "goto LAB_001ce53d;" goto statement_identifier ;)) (goto_statement "goto LAB_001ce547;" goto statement_identifier ;) })) (if_statement "if (bVar15) goto LAB_001ce5d9;" if (parenthesized_expression "(bVar15)" ( identifier )) (goto_statement "goto LAB_001ce5d9;" goto statement_identifier ;)) (labeled_statement "LAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;" statement_identifier : (if_statement "if (__filename != (char *)0x0) goto LAB_001ce556;" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (goto_statement "goto LAB_001ce556;" goto statement_identifier ;))) }) (else_clause "else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" else (compound_statement "{\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" { (expression_statement "iVar3 = FUN_001ce1bf(local_f8,__filename);" (assignment_expression "iVar3 = FUN_001ce1bf(local_f8,__filename)" identifier = (call_expression "FUN_001ce1bf(local_f8,__filename)" identifier (argument_list "(local_f8,__filename)" ( identifier , identifier )))) ;) (if_statement "if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }" { (labeled_statement "LAB_001ce53d:\n          unlink(local_f8);" statement_identifier : (expression_statement "unlink(local_f8);" (call_expression "unlink(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;)) (labeled_statement "LAB_001ce547:\n          history_lines_written_to_file = 0;" statement_identifier : (expression_statement "history_lines_written_to_file = 0;" (assignment_expression "history_lines_written_to_file = 0" identifier = number_literal) ;)) (goto_statement "goto LAB_001ce551;" goto statement_identifier ;) })) (if_statement "if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }" if (parenthesized_expression "(bVar15)" ( identifier )) (compound_statement "{\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }" { (labeled_statement "LAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);" statement_identifier : (expression_statement "chown(__filename,local_d8.st_uid,local_d8.st_gid);" (call_expression "chown(__filename,local_d8.st_uid,local_d8.st_gid)" identifier (argument_list "(__filename,local_d8.st_uid,local_d8.st_gid)" ( identifier , (field_expression "local_d8.st_uid" identifier . field_identifier) , (field_expression "local_d8.st_gid" identifier . field_identifier) ))) ;)) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_001ce551;" goto statement_identifier ;) })) (labeled_statement "LAB_001ce556:\n        free(__filename);" statement_identifier : (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;)) }))) (if_statement "if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        free(local_f8);\n      }" { (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) })) (goto_statement "goto LAB_001ce570;" goto statement_identifier ;) })) (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) }))) (if_statement "if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    free(local_f8);\n  }" { (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) })) (labeled_statement "LAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }" statement_identifier : (if_statement "if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }" if (parenthesized_expression "(local_40 != *(long *)(in_FS_OFFSET + 0x28))" ( (binary_expression "local_40 != *(long *)(in_FS_OFFSET + 0x28)" identifier != (pointer_expression "*(long *)(in_FS_OFFSET + 0x28)" * (cast_expression "(long *)(in_FS_OFFSET + 0x28)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_FS_OFFSET + 0x28)" ( (binary_expression "in_FS_OFFSET + 0x28" identifier + number_literal) ))))) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }" { comment (expression_statement "__stack_chk_fail();" (call_expression "__stack_chk_fail()" identifier (argument_list "()" ( ))) ;) }))) (return_statement "return iVar3;" return identifier ;) })))
(translation_unit "int history_do_write(char *filename,int nelements,int overwrite)\n\n{\n  char cVar1;\n  long lVar2;\n  bool bVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  int iVar7;\n  char *__filename;\n  HIST_ENTRY **ppHVar8;\n  void *__buf;\n  ssize_t sVar9;\n  int *piVar10;\n  long lVar11;\n  HIST_ENTRY **ppHVar12;\n  int iVar13;\n  int iVar14;\n  char *pcVar15;\n  long in_FS_OFFSET;\n  bool bVar16;\n  byte bVar17;\n  char *local_f8;\n  stat finfo;\n  \n  bVar17 = 0;\n  lVar2 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = history_filename(filename);\n  if (__filename == (char *)0x0) {\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar4 = __xstat(1,__filename,(stat *)&finfo);\n    bVar16 = iVar4 == 0;\n    bVar3 = overwrite != 0 && bVar16;\n    if (overwrite != 0 && bVar16) {\n      bVar16 = bVar3;\n      if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }\n    iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar5 != -1) {\n      if (history_length <= nelements) {\n        nelements = history_length;\n      }\n      ppHVar8 = history_list();\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }\n      __buf = malloc((long)iVar14);\n      if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }\n      sVar9 = write(iVar5,__buf,(long)iVar14);\n      iVar4 = 0;\n      if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = nelements;\n      iVar5 = close(iVar5);\n      if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (lVar2 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }\n  return iVar4;\n}\n\n" (function_definition "int history_do_write(char *filename,int nelements,int overwrite)\n\n{\n  char cVar1;\n  long lVar2;\n  bool bVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  int iVar7;\n  char *__filename;\n  HIST_ENTRY **ppHVar8;\n  void *__buf;\n  ssize_t sVar9;\n  int *piVar10;\n  long lVar11;\n  HIST_ENTRY **ppHVar12;\n  int iVar13;\n  int iVar14;\n  char *pcVar15;\n  long in_FS_OFFSET;\n  bool bVar16;\n  byte bVar17;\n  char *local_f8;\n  stat finfo;\n  \n  bVar17 = 0;\n  lVar2 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = history_filename(filename);\n  if (__filename == (char *)0x0) {\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar4 = __xstat(1,__filename,(stat *)&finfo);\n    bVar16 = iVar4 == 0;\n    bVar3 = overwrite != 0 && bVar16;\n    if (overwrite != 0 && bVar16) {\n      bVar16 = bVar3;\n      if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }\n    iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar5 != -1) {\n      if (history_length <= nelements) {\n        nelements = history_length;\n      }\n      ppHVar8 = history_list();\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }\n      __buf = malloc((long)iVar14);\n      if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }\n      sVar9 = write(iVar5,__buf,(long)iVar14);\n      iVar4 = 0;\n      if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = nelements;\n      iVar5 = close(iVar5);\n      if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (lVar2 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }\n  return iVar4;\n}" primitive_type (function_declarator "history_do_write(char *filename,int nelements,int overwrite)" identifier (parameter_list "(char *filename,int nelements,int overwrite)" ( (parameter_declaration "char *filename" primitive_type (pointer_declarator "*filename" * identifier)) , (parameter_declaration "int nelements" primitive_type identifier) , (parameter_declaration "int overwrite" primitive_type identifier) ))) (compound_statement "{\n  char cVar1;\n  long lVar2;\n  bool bVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  int iVar7;\n  char *__filename;\n  HIST_ENTRY **ppHVar8;\n  void *__buf;\n  ssize_t sVar9;\n  int *piVar10;\n  long lVar11;\n  HIST_ENTRY **ppHVar12;\n  int iVar13;\n  int iVar14;\n  char *pcVar15;\n  long in_FS_OFFSET;\n  bool bVar16;\n  byte bVar17;\n  char *local_f8;\n  stat finfo;\n  \n  bVar17 = 0;\n  lVar2 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = history_filename(filename);\n  if (__filename == (char *)0x0) {\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar4 = __xstat(1,__filename,(stat *)&finfo);\n    bVar16 = iVar4 == 0;\n    bVar3 = overwrite != 0 && bVar16;\n    if (overwrite != 0 && bVar16) {\n      bVar16 = bVar3;\n      if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }\n    iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar5 != -1) {\n      if (history_length <= nelements) {\n        nelements = history_length;\n      }\n      ppHVar8 = history_list();\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }\n      __buf = malloc((long)iVar14);\n      if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }\n      sVar9 = write(iVar5,__buf,(long)iVar14);\n      iVar4 = 0;\n      if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = nelements;\n      iVar5 = close(iVar5);\n      if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (lVar2 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }\n  return iVar4;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "long lVar2;" (sized_type_specifier "long" long) identifier ;) (declaration "bool bVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "int iVar6;" primitive_type identifier ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "char *__filename;" primitive_type (pointer_declarator "*__filename" * identifier) ;) (declaration "HIST_ENTRY **ppHVar8;" type_identifier (pointer_declarator "**ppHVar8" * (pointer_declarator "*ppHVar8" * identifier)) ;) (declaration "void *__buf;" primitive_type (pointer_declarator "*__buf" * identifier) ;) (declaration "ssize_t sVar9;" primitive_type identifier ;) (declaration "int *piVar10;" primitive_type (pointer_declarator "*piVar10" * identifier) ;) (declaration "long lVar11;" (sized_type_specifier "long" long) identifier ;) (declaration "HIST_ENTRY **ppHVar12;" type_identifier (pointer_declarator "**ppHVar12" * (pointer_declarator "*ppHVar12" * identifier)) ;) (declaration "int iVar13;" primitive_type identifier ;) (declaration "int iVar14;" primitive_type identifier ;) (declaration "char *pcVar15;" primitive_type (pointer_declarator "*pcVar15" * identifier) ;) (declaration "long in_FS_OFFSET;" (sized_type_specifier "long" long) identifier ;) (declaration "bool bVar16;" primitive_type identifier ;) (declaration "byte bVar17;" type_identifier identifier ;) (declaration "char *local_f8;" primitive_type (pointer_declarator "*local_f8" * identifier) ;) (declaration "stat finfo;" type_identifier identifier ;) (expression_statement "bVar17 = 0;" (assignment_expression "bVar17 = 0" identifier = number_literal) ;) (expression_statement "lVar2 = *(long *)(in_FS_OFFSET + 0x28);" (assignment_expression "lVar2 = *(long *)(in_FS_OFFSET + 0x28)" identifier = (pointer_expression "*(long *)(in_FS_OFFSET + 0x28)" * (cast_expression "(long *)(in_FS_OFFSET + 0x28)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_FS_OFFSET + 0x28)" ( (binary_expression "in_FS_OFFSET + 0x28" identifier + number_literal) ))))) ;) (expression_statement "__filename = history_filename(filename);" (assignment_expression "__filename = history_filename(filename)" identifier = (call_expression "history_filename(filename)" identifier (argument_list "(filename)" ( identifier )))) ;) (if_statement "if (__filename == (char *)0x0) {\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar4 = __xstat(1,__filename,(stat *)&finfo);\n    bVar16 = iVar4 == 0;\n    bVar3 = overwrite != 0 && bVar16;\n    if (overwrite != 0 && bVar16) {\n      bVar16 = bVar3;\n      if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }\n    iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar5 != -1) {\n      if (history_length <= nelements) {\n        nelements = history_length;\n      }\n      ppHVar8 = history_list();\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }\n      __buf = malloc((long)iVar14);\n      if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }\n      sVar9 = write(iVar5,__buf,(long)iVar14);\n      iVar4 = 0;\n      if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = nelements;\n      iVar5 = close(iVar5);\n      if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    free(__filename);\n  }" if (parenthesized_expression "(__filename == (char *)0x0)" ( (binary_expression "__filename == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    local_f8 = (char *)0x0;\n  }" { (expression_statement "piVar10 = __errno_location();" (assignment_expression "piVar10 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar4 = *piVar10;" (assignment_expression "iVar4 = *piVar10" identifier = (pointer_expression "*piVar10" * identifier)) ;) (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) }) (else_clause "else {\n    iVar4 = __xstat(1,__filename,(stat *)&finfo);\n    bVar16 = iVar4 == 0;\n    bVar3 = overwrite != 0 && bVar16;\n    if (overwrite != 0 && bVar16) {\n      bVar16 = bVar3;\n      if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }\n    iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar5 != -1) {\n      if (history_length <= nelements) {\n        nelements = history_length;\n      }\n      ppHVar8 = history_list();\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }\n      __buf = malloc((long)iVar14);\n      if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }\n      sVar9 = write(iVar5,__buf,(long)iVar14);\n      iVar4 = 0;\n      if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = nelements;\n      iVar5 = close(iVar5);\n      if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    free(__filename);\n  }" else (compound_statement "{\n    iVar4 = __xstat(1,__filename,(stat *)&finfo);\n    bVar16 = iVar4 == 0;\n    bVar3 = overwrite != 0 && bVar16;\n    if (overwrite != 0 && bVar16) {\n      bVar16 = bVar3;\n      if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }\n    iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar5 != -1) {\n      if (history_length <= nelements) {\n        nelements = history_length;\n      }\n      ppHVar8 = history_list();\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }\n      __buf = malloc((long)iVar14);\n      if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }\n      sVar9 = write(iVar5,__buf,(long)iVar14);\n      iVar4 = 0;\n      if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = nelements;\n      iVar5 = close(iVar5);\n      if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar10 = __errno_location();\n    iVar4 = *piVar10;\n    free(__filename);\n  }" { (expression_statement "iVar4 = __xstat(1,__filename,(stat *)&finfo);" (assignment_expression "iVar4 = __xstat(1,__filename,(stat *)&finfo)" identifier = (call_expression "__xstat(1,__filename,(stat *)&finfo)" identifier (argument_list "(1,__filename,(stat *)&finfo)" ( number_literal , identifier , (cast_expression "(stat *)&finfo" ( (type_descriptor "stat *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&finfo" & identifier)) )))) ;) (expression_statement "bVar16 = iVar4 == 0;" (assignment_expression "bVar16 = iVar4 == 0" identifier = (binary_expression "iVar4 == 0" identifier == number_literal)) ;) (expression_statement "bVar3 = overwrite != 0 && bVar16;" (assignment_expression "bVar3 = overwrite != 0 && bVar16" identifier = (binary_expression "overwrite != 0 && bVar16" (binary_expression "overwrite != 0" identifier != number_literal) && identifier)) ;) (if_statement "if (overwrite != 0 && bVar16) {\n      bVar16 = bVar3;\n      if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }" if (parenthesized_expression "(overwrite != 0 && bVar16)" ( (binary_expression "overwrite != 0 && bVar16" (binary_expression "overwrite != 0" identifier != number_literal) && identifier) )) (compound_statement "{\n      bVar16 = bVar3;\n      if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }\n    }" { (expression_statement "bVar16 = bVar3;" (assignment_expression "bVar16 = bVar3" identifier = identifier) ;) (if_statement "if (((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)) {\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }" if (parenthesized_expression "(((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0))" ( (binary_expression "((finfo.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)" (parenthesized_expression "((finfo.st_mode & 0xf000) != 0x8000)" ( (binary_expression "(finfo.st_mode & 0xf000) != 0x8000" (parenthesized_expression "(finfo.st_mode & 0xf000)" ( (binary_expression "finfo.st_mode & 0xf000" (field_expression "finfo.st_mode" identifier . field_identifier) & number_literal) )) != number_literal) )) || (parenthesized_expression "(local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0)" ( (comma_expression "local_f8 = history_tempfile(__filename), pcVar15 = local_f8, local_f8 == (char *)0x0" (assignment_expression "local_f8 = history_tempfile(__filename)" identifier = (call_expression "history_tempfile(__filename)" identifier (argument_list "(__filename)" ( identifier )))) , (comma_expression "pcVar15 = local_f8, local_f8 == (char *)0x0" (assignment_expression "pcVar15 = local_f8" identifier = identifier) , (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)))) ))) )) (compound_statement "{\n        local_f8 = (char *)0x0;\n        pcVar15 = __filename;\n      }" { (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (expression_statement "pcVar15 = __filename;" (assignment_expression "pcVar15 = __filename" identifier = identifier) ;) })) }) (else_clause "else {\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }" else (compound_statement "{\n      local_f8 = (char *)0x0;\n      pcVar15 = __filename;\n    }" { (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (expression_statement "pcVar15 = __filename;" (assignment_expression "pcVar15 = __filename" identifier = identifier) ;) }))) (expression_statement "iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180);" (assignment_expression "iVar5 = open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180)" identifier = (call_expression "open(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180)" identifier (argument_list "(pcVar15,(-(uint)(overwrite == 0) & 0x1c0) + 0x241,0x180)" ( identifier , (binary_expression "(-(uint)(overwrite == 0) & 0x1c0) + 0x241" (parenthesized_expression "(-(uint)(overwrite == 0) & 0x1c0)" ( (binary_expression "-(uint)(overwrite == 0) & 0x1c0" (unary_expression "-(uint)(overwrite == 0)" - (call_expression "(uint)(overwrite == 0)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(overwrite == 0)" ( (binary_expression "overwrite == 0" identifier == number_literal) )))) & number_literal) )) + number_literal) , number_literal )))) ;) (if_statement "if (iVar5 != -1) {\n      if (history_length <= nelements) {\n        nelements = history_length;\n      }\n      ppHVar8 = history_list();\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }\n      __buf = malloc((long)iVar14);\n      if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }\n      sVar9 = write(iVar5,__buf,(long)iVar14);\n      iVar4 = 0;\n      if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = nelements;\n      iVar5 = close(iVar5);\n      if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }" if (parenthesized_expression "(iVar5 != -1)" ( (binary_expression "iVar5 != -1" identifier != number_literal) )) (compound_statement "{\n      if (history_length <= nelements) {\n        nelements = history_length;\n      }\n      ppHVar8 = history_list();\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }\n      __buf = malloc((long)iVar14);\n      if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar4 = history_length - nelements;\n      if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }\n      sVar9 = write(iVar5,__buf,(long)iVar14);\n      iVar4 = 0;\n      if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = nelements;\n      iVar5 = close(iVar5);\n      if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }" { (if_statement "if (history_length <= nelements) {\n        nelements = history_length;\n      }" if (parenthesized_expression "(history_length <= nelements)" ( (binary_expression "history_length <= nelements" identifier <= identifier) )) (compound_statement "{\n        nelements = history_length;\n      }" { (expression_statement "nelements = history_length;" (assignment_expression "nelements = history_length" identifier = identifier) ;) })) (expression_statement "ppHVar8 = history_list();" (assignment_expression "ppHVar8 = history_list()" identifier = (call_expression "history_list()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar4 = history_length - nelements;" (assignment_expression "iVar4 = history_length - nelements" identifier = (binary_expression "history_length - nelements" identifier - identifier)) ;) (if_statement "if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }\n      else {\n        iVar14 = 0;\n      }" if (parenthesized_expression "(iVar4 < history_length)" ( (binary_expression "iVar4 < history_length" identifier < identifier) )) (compound_statement "{\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar14 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));\n      }" { (expression_statement "ppHVar12 = ppHVar8 + iVar4;" (assignment_expression "ppHVar12 = ppHVar8 + iVar4" identifier = (binary_expression "ppHVar8 + iVar4" identifier + identifier)) ;) (expression_statement "iVar14 = 0;" (assignment_expression "iVar14 = 0" identifier = number_literal) ;) (do_statement "do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4));" do (compound_statement "{\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar14 = iVar14 + ~(uint)lVar11;\n          ppHVar12 = ppHVar12 + 1;\n        }" { (if_statement "if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }" if (parenthesized_expression "(((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0'))" ( (binary_expression "((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')" (parenthesized_expression "((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0))" ( (binary_expression "(history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)" (parenthesized_expression "(history_write_timestamps != 0)" ( (binary_expression "history_write_timestamps != 0" identifier != number_literal) )) && (parenthesized_expression "(pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)" ( (comma_expression "pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0" (assignment_expression "pcVar15 = (*ppHVar12)->timestamp" identifier = (field_expression "(*ppHVar12)->timestamp" (parenthesized_expression "(*ppHVar12)" ( (pointer_expression "*ppHVar12" * identifier) )) -> field_identifier)) , (binary_expression "pcVar15 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) ))) )) && (parenthesized_expression "(*pcVar15 != '\0')" ( (binary_expression "*pcVar15 != '\0'" (pointer_expression "*pcVar15" * identifier) != (char_literal "'\0'" ' escape_sequence ')) ))) )) (compound_statement "{\n            lVar11 = -1;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar14 = iVar14 + ~(uint)lVar11;\n          }" { (expression_statement "lVar11 = -1;" (assignment_expression "lVar11 = -1" identifier = number_literal) ;) (do_statement "do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');" do (compound_statement "{\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            }" { (if_statement "if (lVar11 == 0) break;" if (parenthesized_expression "(lVar11 == 0)" ( (binary_expression "lVar11 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar11 = lVar11 + -1;" (assignment_expression "lVar11 = lVar11 + -1" identifier = (binary_expression "lVar11 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar15;" (assignment_expression "cVar1 = *pcVar15" identifier = (pointer_expression "*pcVar15" * identifier)) ;) (expression_statement "pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;" (assignment_expression "pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1" identifier = (binary_expression "pcVar15 + (ulong)bVar17 * -2 + 1" (binary_expression "pcVar15 + (ulong)bVar17 * -2" identifier + (binary_expression "(ulong)bVar17 * -2" (cast_expression "(ulong)bVar17" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar14 = iVar14 + ~(uint)lVar11;" (assignment_expression "iVar14 = iVar14 + ~(uint)lVar11" identifier = (binary_expression "iVar14 + ~(uint)lVar11" identifier + (unary_expression "~(uint)lVar11" ~ (cast_expression "(uint)lVar11" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) })) (expression_statement "lVar11 = -1;" (assignment_expression "lVar11 = -1" identifier = number_literal) ;) (expression_statement "pcVar15 = (*ppHVar12)->line;" (assignment_expression "pcVar15 = (*ppHVar12)->line" identifier = (field_expression "(*ppHVar12)->line" (parenthesized_expression "(*ppHVar12)" ( (pointer_expression "*ppHVar12" * identifier) )) -> field_identifier)) ;) (do_statement "do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');" do (compound_statement "{\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          }" { (if_statement "if (lVar11 == 0) break;" if (parenthesized_expression "(lVar11 == 0)" ( (binary_expression "lVar11 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar11 = lVar11 + -1;" (assignment_expression "lVar11 = lVar11 + -1" identifier = (binary_expression "lVar11 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar15;" (assignment_expression "cVar1 = *pcVar15" identifier = (pointer_expression "*pcVar15" * identifier)) ;) (expression_statement "pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;" (assignment_expression "pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1" identifier = (binary_expression "pcVar15 + (ulong)bVar17 * -2 + 1" (binary_expression "pcVar15 + (ulong)bVar17 * -2" identifier + (binary_expression "(ulong)bVar17 * -2" (cast_expression "(ulong)bVar17" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar14 = iVar14 + ~(uint)lVar11;" (assignment_expression "iVar14 = iVar14 + ~(uint)lVar11" identifier = (binary_expression "iVar14 + ~(uint)lVar11" identifier + (unary_expression "~(uint)lVar11" ~ (cast_expression "(uint)lVar11" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "ppHVar12 = ppHVar12 + 1;" (assignment_expression "ppHVar12 = ppHVar12 + 1" identifier = (binary_expression "ppHVar12 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4))" ( (binary_expression "ppHVar12 !=\n                 ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4)" identifier != (binary_expression "ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)((history_length + -1) - iVar4)" (binary_expression "ppHVar8 + (long)iVar4 + 1" (binary_expression "ppHVar8 + (long)iVar4" identifier + (cast_expression "(long)iVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) + number_literal) + (call_expression "(ulong)(uint)((history_length + -1) - iVar4)" (call_expression "(ulong)(uint)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(uint)" ( identifier ))) (argument_list "((history_length + -1) - iVar4)" ( (binary_expression "(history_length + -1) - iVar4" (parenthesized_expression "(history_length + -1)" ( (binary_expression "history_length + -1" identifier + number_literal) )) - identifier) ))))) )) ;) }) (else_clause "else {\n        iVar14 = 0;\n      }" else (compound_statement "{\n        iVar14 = 0;\n      }" { (expression_statement "iVar14 = 0;" (assignment_expression "iVar14 = 0" identifier = number_literal) ;) }))) (expression_statement "__buf = malloc((long)iVar14);" (assignment_expression "__buf = malloc((long)iVar14)" identifier = (call_expression "malloc((long)iVar14)" identifier (argument_list "((long)iVar14)" ( (cast_expression "(long)iVar14" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) )))) ;) (if_statement "if (__buf == (void *)0x0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }" if (parenthesized_expression "(__buf == (void *)0x0)" ( (binary_expression "__buf == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n        close(iVar5);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }" { (expression_statement "piVar10 = __errno_location();" (assignment_expression "piVar10 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar4 = *piVar10;" (assignment_expression "iVar4 = *piVar10" identifier = (pointer_expression "*piVar10" * identifier)) ;) (expression_statement "close(iVar5);" (call_expression "close(iVar5)" identifier (argument_list "(iVar5)" ( identifier ))) ;) (if_statement "if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" if (parenthesized_expression "(local_f8 == (char *)0x0)" ( (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }" { (if_statement "if (__filename != (char *)0x0) {\n            free(__filename);\n          }" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n            free(__filename);\n          }" { (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) })) }) (else_clause "else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" else (compound_statement "{\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" { (expression_statement "unlink(local_f8);" (call_expression "unlink(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) (if_statement "if (__filename != (char *)0x0) {\n            free(__filename);\n          }" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n            free(__filename);\n          }" { (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) })) (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) }))) (goto_statement "goto LAB_001ce570;" goto statement_identifier ;) })) (expression_statement "iVar4 = history_length - nelements;" (assignment_expression "iVar4 = history_length - nelements" identifier = (binary_expression "history_length - nelements" identifier - identifier)) ;) (if_statement "if (iVar4 < history_length) {\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }" if (parenthesized_expression "(iVar4 < history_length)" ( (binary_expression "iVar4 < history_length" identifier < identifier) )) (compound_statement "{\n        ppHVar12 = ppHVar8 + iVar4;\n        iVar6 = history_length + -1;\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);\n      }" { (expression_statement "ppHVar12 = ppHVar8 + iVar4;" (assignment_expression "ppHVar12 = ppHVar8 + iVar4" identifier = (binary_expression "ppHVar8 + iVar4" identifier + identifier)) ;) (expression_statement "iVar6 = history_length + -1;" (assignment_expression "iVar6 = history_length + -1" identifier = (binary_expression "history_length + -1" identifier + number_literal)) ;) (expression_statement "iVar13 = 0;" (assignment_expression "iVar13 = 0" identifier = number_literal) ;) (do_statement "do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        } while (ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12);" do (compound_statement "{\n          if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }\n          strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);\n          lVar11 = -1;\n          pcVar15 = (*ppHVar12)->line;\n          do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar7 = iVar13 + -1 + ~(uint)lVar11;\n          iVar13 = iVar7 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          ppHVar12 = ppHVar12 + 1;\n        }" { (if_statement "if (((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')) {\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }" if (parenthesized_expression "(((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0'))" ( (binary_expression "((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)) && (*pcVar15 != '\0')" (parenthesized_expression "((history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0))" ( (binary_expression "(history_write_timestamps != 0) &&\n              (pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)" (parenthesized_expression "(history_write_timestamps != 0)" ( (binary_expression "history_write_timestamps != 0" identifier != number_literal) )) && (parenthesized_expression "(pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0)" ( (comma_expression "pcVar15 = (*ppHVar12)->timestamp, pcVar15 != (char *)0x0" (assignment_expression "pcVar15 = (*ppHVar12)->timestamp" identifier = (field_expression "(*ppHVar12)->timestamp" (parenthesized_expression "(*ppHVar12)" ( (pointer_expression "*ppHVar12" * identifier) )) -> field_identifier)) , (binary_expression "pcVar15 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) ))) )) && (parenthesized_expression "(*pcVar15 != '\0')" ( (binary_expression "*pcVar15 != '\0'" (pointer_expression "*pcVar15" * identifier) != (char_literal "'\0'" ' escape_sequence ')) ))) )) (compound_statement "{\n            strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);\n            lVar11 = -1;\n            pcVar15 = (*ppHVar12)->timestamp;\n            do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar7 = iVar13 + -1 + ~(uint)lVar11;\n            iVar13 = iVar7 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar7) = 10;\n          }" { (expression_statement "strcpy((char *)((long)iVar13 + (long)__buf),pcVar15);" (call_expression "strcpy((char *)((long)iVar13 + (long)__buf),pcVar15)" identifier (argument_list "((char *)((long)iVar13 + (long)__buf),pcVar15)" ( (cast_expression "(char *)((long)iVar13 + (long)__buf)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)iVar13 + (long)__buf)" ( (binary_expression "(long)iVar13 + (long)__buf" (cast_expression "(long)iVar13" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , identifier ))) ;) (expression_statement "lVar11 = -1;" (assignment_expression "lVar11 = -1" identifier = number_literal) ;) (expression_statement "pcVar15 = (*ppHVar12)->timestamp;" (assignment_expression "pcVar15 = (*ppHVar12)->timestamp" identifier = (field_expression "(*ppHVar12)->timestamp" (parenthesized_expression "(*ppHVar12)" ( (pointer_expression "*ppHVar12" * identifier) )) -> field_identifier)) ;) (do_statement "do {\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            } while (cVar1 != '\0');" do (compound_statement "{\n              if (lVar11 == 0) break;\n              lVar11 = lVar11 + -1;\n              cVar1 = *pcVar15;\n              pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n            }" { (if_statement "if (lVar11 == 0) break;" if (parenthesized_expression "(lVar11 == 0)" ( (binary_expression "lVar11 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar11 = lVar11 + -1;" (assignment_expression "lVar11 = lVar11 + -1" identifier = (binary_expression "lVar11 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar15;" (assignment_expression "cVar1 = *pcVar15" identifier = (pointer_expression "*pcVar15" * identifier)) ;) (expression_statement "pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;" (assignment_expression "pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1" identifier = (binary_expression "pcVar15 + (ulong)bVar17 * -2 + 1" (binary_expression "pcVar15 + (ulong)bVar17 * -2" identifier + (binary_expression "(ulong)bVar17 * -2" (cast_expression "(ulong)bVar17" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar7 = iVar13 + -1 + ~(uint)lVar11;" (assignment_expression "iVar7 = iVar13 + -1 + ~(uint)lVar11" identifier = (binary_expression "iVar13 + -1 + ~(uint)lVar11" (binary_expression "iVar13 + -1" identifier + number_literal) + (unary_expression "~(uint)lVar11" ~ (cast_expression "(uint)lVar11" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "iVar13 = iVar7 + 1;" (assignment_expression "iVar13 = iVar7 + 1" identifier = (binary_expression "iVar7 + 1" identifier + number_literal)) ;) (expression_statement "*(undefined1 *)((long)__buf + (long)iVar7) = 10;" (assignment_expression "*(undefined1 *)((long)__buf + (long)iVar7) = 10" (pointer_expression "*(undefined1 *)((long)__buf + (long)iVar7)" * (cast_expression "(undefined1 *)((long)__buf + (long)iVar7)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)__buf + (long)iVar7)" ( (binary_expression "(long)__buf + (long)iVar7" (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar7" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) = number_literal) ;) })) (expression_statement "strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line);" (call_expression "strcpy((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line)" identifier (argument_list "((char *)((long)iVar13 + (long)__buf),(*ppHVar12)->line)" ( (cast_expression "(char *)((long)iVar13 + (long)__buf)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)iVar13 + (long)__buf)" ( (binary_expression "(long)iVar13 + (long)__buf" (cast_expression "(long)iVar13" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , (field_expression "(*ppHVar12)->line" (parenthesized_expression "(*ppHVar12)" ( (pointer_expression "*ppHVar12" * identifier) )) -> field_identifier) ))) ;) (expression_statement "lVar11 = -1;" (assignment_expression "lVar11 = -1" identifier = number_literal) ;) (expression_statement "pcVar15 = (*ppHVar12)->line;" (assignment_expression "pcVar15 = (*ppHVar12)->line" identifier = (field_expression "(*ppHVar12)->line" (parenthesized_expression "(*ppHVar12)" ( (pointer_expression "*ppHVar12" * identifier) )) -> field_identifier)) ;) (do_statement "do {\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          } while (cVar1 != '\0');" do (compound_statement "{\n            if (lVar11 == 0) break;\n            lVar11 = lVar11 + -1;\n            cVar1 = *pcVar15;\n            pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;\n          }" { (if_statement "if (lVar11 == 0) break;" if (parenthesized_expression "(lVar11 == 0)" ( (binary_expression "lVar11 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar11 = lVar11 + -1;" (assignment_expression "lVar11 = lVar11 + -1" identifier = (binary_expression "lVar11 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar15;" (assignment_expression "cVar1 = *pcVar15" identifier = (pointer_expression "*pcVar15" * identifier)) ;) (expression_statement "pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1;" (assignment_expression "pcVar15 = pcVar15 + (ulong)bVar17 * -2 + 1" identifier = (binary_expression "pcVar15 + (ulong)bVar17 * -2 + 1" (binary_expression "pcVar15 + (ulong)bVar17 * -2" identifier + (binary_expression "(ulong)bVar17 * -2" (cast_expression "(ulong)bVar17" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar7 = iVar13 + -1 + ~(uint)lVar11;" (assignment_expression "iVar7 = iVar13 + -1 + ~(uint)lVar11" identifier = (binary_expression "iVar13 + -1 + ~(uint)lVar11" (binary_expression "iVar13 + -1" identifier + number_literal) + (unary_expression "~(uint)lVar11" ~ (cast_expression "(uint)lVar11" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "iVar13 = iVar7 + 1;" (assignment_expression "iVar13 = iVar7 + 1" identifier = (binary_expression "iVar7 + 1" identifier + number_literal)) ;) (expression_statement "*(undefined1 *)((long)__buf + (long)iVar7) = 10;" (assignment_expression "*(undefined1 *)((long)__buf + (long)iVar7) = 10" (pointer_expression "*(undefined1 *)((long)__buf + (long)iVar7)" * (cast_expression "(undefined1 *)((long)__buf + (long)iVar7)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)__buf + (long)iVar7)" ( (binary_expression "(long)__buf + (long)iVar7" (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar7" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) = number_literal) ;) (expression_statement "ppHVar12 = ppHVar12 + 1;" (assignment_expression "ppHVar12 = ppHVar12 + 1" identifier = (binary_expression "ppHVar12 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12)" ( (binary_expression "ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4) != ppHVar12" (binary_expression "ppHVar8 + (long)iVar4 + 1 + (ulong)(uint)(iVar6 - iVar4)" (binary_expression "ppHVar8 + (long)iVar4 + 1" (binary_expression "ppHVar8 + (long)iVar4" identifier + (cast_expression "(long)iVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) + number_literal) + (call_expression "(ulong)(uint)(iVar6 - iVar4)" (call_expression "(ulong)(uint)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(uint)" ( identifier ))) (argument_list "(iVar6 - iVar4)" ( (binary_expression "iVar6 - iVar4" identifier - identifier) )))) != identifier) )) ;) })) (expression_statement "sVar9 = write(iVar5,__buf,(long)iVar14);" (assignment_expression "sVar9 = write(iVar5,__buf,(long)iVar14)" identifier = (call_expression "write(iVar5,__buf,(long)iVar14)" identifier (argument_list "(iVar5,__buf,(long)iVar14)" ( identifier , identifier , (cast_expression "(long)iVar14" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) )))) ;) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (if_statement "if (sVar9 < 0) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }" if (parenthesized_expression "(sVar9 < 0)" ( (binary_expression "sVar9 < 0" identifier < number_literal) )) (compound_statement "{\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }" { (expression_statement "piVar10 = __errno_location();" (assignment_expression "piVar10 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar4 = *piVar10;" (assignment_expression "iVar4 = *piVar10" identifier = (pointer_expression "*piVar10" * identifier)) ;) })) (expression_statement "xfree(__buf);" (call_expression "xfree(__buf)" identifier (argument_list "(__buf)" ( identifier ))) ;) (expression_statement "history_lines_written_to_file = nelements;" (assignment_expression "history_lines_written_to_file = nelements" identifier = identifier) ;) (expression_statement "iVar5 = close(iVar5);" (assignment_expression "iVar5 = close(iVar5)" identifier = (call_expression "close(iVar5)" identifier (argument_list "(iVar5)" ( identifier )))) ;) (if_statement "if ((iVar5 < 0) && (iVar4 == 0)) {\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }" if (parenthesized_expression "((iVar5 < 0) && (iVar4 == 0))" ( (binary_expression "(iVar5 < 0) && (iVar4 == 0)" (parenthesized_expression "(iVar5 < 0)" ( (binary_expression "iVar5 < 0" identifier < number_literal) )) && (parenthesized_expression "(iVar4 == 0)" ( (binary_expression "iVar4 == 0" identifier == number_literal) ))) )) (compound_statement "{\n        piVar10 = __errno_location();\n        iVar4 = *piVar10;\n      }" { (expression_statement "piVar10 = __errno_location();" (assignment_expression "piVar10 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar4 = *piVar10;" (assignment_expression "iVar4 = *piVar10" identifier = (pointer_expression "*piVar10" * identifier)) ;) })) (if_statement "if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)) {\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" if (parenthesized_expression "((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0))" ( (binary_expression "(__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar4 != 0)" (parenthesized_expression "(__filename == (char *)0x0 || local_f8 == (char *)0x0)" ( (binary_expression "__filename == (char *)0x0 || local_f8 == (char *)0x0" (binary_expression "__filename == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) || (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) )) || (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) ))) )) (compound_statement "{\n        if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar16) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }" { (if_statement "if (iVar4 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }" if (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) )) (compound_statement "{\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }" { (if_statement "if (local_f8 != (char *)0x0) goto LAB_001ce53d;" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (goto_statement "goto LAB_001ce53d;" goto statement_identifier ;)) (goto_statement "goto LAB_001ce547;" goto statement_identifier ;) })) (if_statement "if (bVar16) goto LAB_001ce5d9;" if (parenthesized_expression "(bVar16)" ( identifier )) (goto_statement "goto LAB_001ce5d9;" goto statement_identifier ;)) (labeled_statement "LAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;" statement_identifier : (if_statement "if (__filename != (char *)0x0) goto LAB_001ce556;" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (goto_statement "goto LAB_001ce556;" goto statement_identifier ;))) }) (else_clause "else {\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" else (compound_statement "{\n        iVar4 = histfile_restore(local_f8,__filename);\n        if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" { (expression_statement "iVar4 = histfile_restore(local_f8,__filename);" (assignment_expression "iVar4 = histfile_restore(local_f8,__filename)" identifier = (call_expression "histfile_restore(local_f8,__filename)" identifier (argument_list "(local_f8,__filename)" ( identifier , identifier )))) ;) (if_statement "if (iVar4 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }" if (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }" { (labeled_statement "LAB_001ce53d:\n          unlink(local_f8);" statement_identifier : (expression_statement "unlink(local_f8);" (call_expression "unlink(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;)) (labeled_statement "LAB_001ce547:\n          history_lines_written_to_file = 0;" statement_identifier : (expression_statement "history_lines_written_to_file = 0;" (assignment_expression "history_lines_written_to_file = 0" identifier = number_literal) ;)) (goto_statement "goto LAB_001ce551;" goto statement_identifier ;) })) (if_statement "if (bVar16) {\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }" if (parenthesized_expression "(bVar16)" ( identifier )) (compound_statement "{\nLAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);\n          iVar4 = 0;\n          goto LAB_001ce551;\n        }" { (labeled_statement "LAB_001ce5d9:\n          chown(__filename,finfo.st_uid,finfo.st_gid);" statement_identifier : (expression_statement "chown(__filename,finfo.st_uid,finfo.st_gid);" (call_expression "chown(__filename,finfo.st_uid,finfo.st_gid)" identifier (argument_list "(__filename,finfo.st_uid,finfo.st_gid)" ( identifier , (field_expression "finfo.st_uid" identifier . field_identifier) , (field_expression "finfo.st_gid" identifier . field_identifier) ))) ;)) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_001ce551;" goto statement_identifier ;) })) (labeled_statement "LAB_001ce556:\n        free(__filename);" statement_identifier : (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;)) }))) (if_statement "if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        free(local_f8);\n      }" { (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) })) (goto_statement "goto LAB_001ce570;" goto statement_identifier ;) })) (expression_statement "piVar10 = __errno_location();" (assignment_expression "piVar10 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar4 = *piVar10;" (assignment_expression "iVar4 = *piVar10" identifier = (pointer_expression "*piVar10" * identifier)) ;) (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) }))) (if_statement "if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    free(local_f8);\n  }" { (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) })) (labeled_statement "LAB_001ce570:\n  if (lVar2 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }" statement_identifier : (if_statement "if (lVar2 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }" if (parenthesized_expression "(lVar2 != *(long *)(in_FS_OFFSET + 0x28))" ( (binary_expression "lVar2 != *(long *)(in_FS_OFFSET + 0x28)" identifier != (pointer_expression "*(long *)(in_FS_OFFSET + 0x28)" * (cast_expression "(long *)(in_FS_OFFSET + 0x28)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_FS_OFFSET + 0x28)" ( (binary_expression "in_FS_OFFSET + 0x28" identifier + number_literal) ))))) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail();\n  }" { comment (expression_statement "__stack_chk_fail();" (call_expression "__stack_chk_fail()" identifier (argument_list "()" ( ))) ;) }))) (return_statement "return iVar4;" return identifier ;) })))
(translation_unit "int FUN_001ce234(undefined8 param_1,int param_2,int param_3)\n\n{\n  char cVar1;\n  bool bVar2;\n  int iVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  char *__filename;\n  long lVar7;\n  void *__buf;\n  ssize_t sVar8;\n  int *piVar9;\n  long lVar10;\n  long *plVar11;\n  int iVar12;\n  int iVar13;\n  char *pcVar14;\n  long in_FS_OFFSET;\n  bool bVar15;\n  byte bVar16;\n  char *local_f8;\n  stat local_d8;\n  long local_40;\n  \n  bVar16 = 0;\n  local_40 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = (char *)FUN_001cdf95();\n  if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }\n  return iVar3;\n}\n\n" (function_definition "int FUN_001ce234(undefined8 param_1,int param_2,int param_3)\n\n{\n  char cVar1;\n  bool bVar2;\n  int iVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  char *__filename;\n  long lVar7;\n  void *__buf;\n  ssize_t sVar8;\n  int *piVar9;\n  long lVar10;\n  long *plVar11;\n  int iVar12;\n  int iVar13;\n  char *pcVar14;\n  long in_FS_OFFSET;\n  bool bVar15;\n  byte bVar16;\n  char *local_f8;\n  stat local_d8;\n  long local_40;\n  \n  bVar16 = 0;\n  local_40 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = (char *)FUN_001cdf95();\n  if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }\n  return iVar3;\n}" primitive_type (function_declarator "FUN_001ce234(undefined8 param_1,int param_2,int param_3)" identifier (parameter_list "(undefined8 param_1,int param_2,int param_3)" ( (parameter_declaration "undefined8 param_1" type_identifier identifier) , (parameter_declaration "int param_2" primitive_type identifier) , (parameter_declaration "int param_3" primitive_type identifier) ))) (compound_statement "{\n  char cVar1;\n  bool bVar2;\n  int iVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  char *__filename;\n  long lVar7;\n  void *__buf;\n  ssize_t sVar8;\n  int *piVar9;\n  long lVar10;\n  long *plVar11;\n  int iVar12;\n  int iVar13;\n  char *pcVar14;\n  long in_FS_OFFSET;\n  bool bVar15;\n  byte bVar16;\n  char *local_f8;\n  stat local_d8;\n  long local_40;\n  \n  bVar16 = 0;\n  local_40 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = (char *)FUN_001cdf95();\n  if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }\n  return iVar3;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "bool bVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "int iVar6;" primitive_type identifier ;) (declaration "char *__filename;" primitive_type (pointer_declarator "*__filename" * identifier) ;) (declaration "long lVar7;" (sized_type_specifier "long" long) identifier ;) (declaration "void *__buf;" primitive_type (pointer_declarator "*__buf" * identifier) ;) (declaration "ssize_t sVar8;" primitive_type identifier ;) (declaration "int *piVar9;" primitive_type (pointer_declarator "*piVar9" * identifier) ;) (declaration "long lVar10;" (sized_type_specifier "long" long) identifier ;) (declaration "long *plVar11;" (sized_type_specifier "long" long) (pointer_declarator "*plVar11" * identifier) ;) (declaration "int iVar12;" primitive_type identifier ;) (declaration "int iVar13;" primitive_type identifier ;) (declaration "char *pcVar14;" primitive_type (pointer_declarator "*pcVar14" * identifier) ;) (declaration "long in_FS_OFFSET;" (sized_type_specifier "long" long) identifier ;) (declaration "bool bVar15;" primitive_type identifier ;) (declaration "byte bVar16;" type_identifier identifier ;) (declaration "char *local_f8;" primitive_type (pointer_declarator "*local_f8" * identifier) ;) (declaration "stat local_d8;" type_identifier identifier ;) (declaration "long local_40;" (sized_type_specifier "long" long) identifier ;) (expression_statement "bVar16 = 0;" (assignment_expression "bVar16 = 0" identifier = number_literal) ;) (expression_statement "local_40 = *(long *)(in_FS_OFFSET + 0x28);" (assignment_expression "local_40 = *(long *)(in_FS_OFFSET + 0x28)" identifier = (pointer_expression "*(long *)(in_FS_OFFSET + 0x28)" * (cast_expression "(long *)(in_FS_OFFSET + 0x28)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_FS_OFFSET + 0x28)" ( (binary_expression "in_FS_OFFSET + 0x28" identifier + number_literal) ))))) ;) (expression_statement "__filename = (char *)FUN_001cdf95();" (assignment_expression "__filename = (char *)FUN_001cdf95()" identifier = (cast_expression "(char *)FUN_001cdf95()" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_001cdf95()" identifier (argument_list "()" ( ))))) ;) (if_statement "if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" if (parenthesized_expression "(__filename == (char *)0x0)" ( (binary_expression "__filename == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }" { (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) }) (else_clause "else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" else (compound_statement "{\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" { (expression_statement "iVar3 = __xstat(1,__filename,&local_d8);" (assignment_expression "iVar3 = __xstat(1,__filename,&local_d8)" identifier = (call_expression "__xstat(1,__filename,&local_d8)" identifier (argument_list "(1,__filename,&local_d8)" ( number_literal , identifier , (pointer_expression "&local_d8" & identifier) )))) ;) (expression_statement "bVar15 = iVar3 == 0;" (assignment_expression "bVar15 = iVar3 == 0" identifier = (binary_expression "iVar3 == 0" identifier == number_literal)) ;) (expression_statement "bVar2 = param_3 != 0 && bVar15;" (assignment_expression "bVar2 = param_3 != 0 && bVar15" identifier = (binary_expression "param_3 != 0 && bVar15" (binary_expression "param_3 != 0" identifier != number_literal) && identifier)) ;) (if_statement "if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" if (parenthesized_expression "(param_3 != 0 && bVar15)" ( (binary_expression "param_3 != 0 && bVar15" (binary_expression "param_3 != 0" identifier != number_literal) && identifier) )) (compound_statement "{\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }" { (expression_statement "bVar15 = bVar2;" (assignment_expression "bVar15 = bVar2" identifier = identifier) ;) (if_statement "if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }" if (parenthesized_expression "(((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))" ( (binary_expression "((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0)" (parenthesized_expression "((local_d8.st_mode & 0xf000) != 0x8000)" ( (binary_expression "(local_d8.st_mode & 0xf000) != 0x8000" (parenthesized_expression "(local_d8.st_mode & 0xf000)" ( (binary_expression "local_d8.st_mode & 0xf000" (field_expression "local_d8.st_mode" identifier . field_identifier) & number_literal) )) != number_literal) )) || (parenthesized_expression "(local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0)" ( (comma_expression "local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0" (assignment_expression "local_f8 = (char *)FUN_001ce03d(__filename)" identifier = (cast_expression "(char *)FUN_001ce03d(__filename)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_001ce03d(__filename)" identifier (argument_list "(__filename)" ( identifier ))))) , (comma_expression "pcVar14 = local_f8, local_f8 == (char *)0x0" (assignment_expression "pcVar14 = local_f8" identifier = identifier) , (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)))) ))) )) (compound_statement "{\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }" { (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (expression_statement "pcVar14 = __filename;" (assignment_expression "pcVar14 = __filename" identifier = identifier) ;) })) }) (else_clause "else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" else (compound_statement "{\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" { (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" identifier = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (expression_statement "pcVar14 = __filename;" (assignment_expression "pcVar14 = __filename" identifier = identifier) ;) }))) (expression_statement "iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);" (assignment_expression "iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" identifier = (call_expression "open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" identifier (argument_list "(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" ( identifier , (binary_expression "(-(uint)(param_3 == 0) & 0x1c0) + 0x241" (parenthesized_expression "(-(uint)(param_3 == 0) & 0x1c0)" ( (binary_expression "-(uint)(param_3 == 0) & 0x1c0" (unary_expression "-(uint)(param_3 == 0)" - (call_expression "(uint)(param_3 == 0)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(param_3 == 0)" ( (binary_expression "param_3 == 0" identifier == number_literal) )))) & number_literal) )) + number_literal) , number_literal )))) ;) (if_statement "if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }" if (parenthesized_expression "(iVar4 != -1)" ( (binary_expression "iVar4 != -1" identifier != number_literal) )) (compound_statement "{\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }" { (if_statement "if (history_length <= param_2) {\n        param_2 = history_length;\n      }" if (parenthesized_expression "(history_length <= param_2)" ( (binary_expression "history_length <= param_2" identifier <= identifier) )) (compound_statement "{\n        param_2 = history_length;\n      }" { (expression_statement "param_2 = history_length;" (assignment_expression "param_2 = history_length" identifier = identifier) ;) })) (expression_statement "lVar7 = history_list();" (assignment_expression "lVar7 = history_list()" identifier = (call_expression "history_list()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = history_length - param_2;" (assignment_expression "iVar3 = history_length - param_2" identifier = (binary_expression "history_length - param_2" identifier - identifier)) ;) (if_statement "if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }" if (parenthesized_expression "(iVar3 < history_length)" ( (binary_expression "iVar3 < history_length" identifier < identifier) )) (compound_statement "{\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }" { (expression_statement "plVar11 = (long *)(lVar7 + (long)iVar3 * 8);" (assignment_expression "plVar11 = (long *)(lVar7 + (long)iVar3 * 8)" identifier = (cast_expression "(long *)(lVar7 + (long)iVar3 * 8)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar7 + (long)iVar3 * 8)" ( (binary_expression "lVar7 + (long)iVar3 * 8" identifier + (binary_expression "(long)iVar3 * 8" (cast_expression "(long)iVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) * number_literal)) )))) ;) (expression_statement "iVar13 = 0;" (assignment_expression "iVar13 = 0" identifier = number_literal) ;) (do_statement "do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));" do (compound_statement "{\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        }" { (if_statement "if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }" if (parenthesized_expression "(((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0'))" ( (binary_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')" (parenthesized_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0))" ( (binary_expression "(history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" (parenthesized_expression "(history_write_timestamps != 0)" ( (binary_expression "history_write_timestamps != 0" identifier != number_literal) )) && (parenthesized_expression "(pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" ( (comma_expression "pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" identifier = (pointer_expression "*(char **)(*plVar11 + 8)" * (cast_expression "(char **)(*plVar11 + 8)" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*plVar11 + 8)" ( (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" * identifier) + number_literal) ))))) , (binary_expression "pcVar14 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) ))) )) && (parenthesized_expression "(*pcVar14 != '\0')" ( (binary_expression "*pcVar14 != '\0'" (pointer_expression "*pcVar14" * identifier) != (char_literal "'\0'" ' escape_sequence ')) ))) )) (compound_statement "{\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }" { (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" identifier = number_literal) ;) (do_statement "do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');" do (compound_statement "{\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            }" { (if_statement "if (lVar10 == 0) break;" if (parenthesized_expression "(lVar10 == 0)" ( (binary_expression "lVar10 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" identifier = (binary_expression "lVar10 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" identifier = (pointer_expression "*pcVar14" * identifier)) ;) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" identifier = (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" identifier + (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar13 = iVar13 + ~(uint)lVar10;" (assignment_expression "iVar13 = iVar13 + ~(uint)lVar10" identifier = (binary_expression "iVar13 + ~(uint)lVar10" identifier + (unary_expression "~(uint)lVar10" ~ (cast_expression "(uint)lVar10" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) })) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" identifier = number_literal) ;) (expression_statement "pcVar14 = *(char **)*plVar11;" (assignment_expression "pcVar14 = *(char **)*plVar11" identifier = (pointer_expression "*(char **)*plVar11" * (cast_expression "(char **)*plVar11" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (pointer_expression "*plVar11" * identifier)))) ;) (do_statement "do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');" do (compound_statement "{\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          }" { (if_statement "if (lVar10 == 0) break;" if (parenthesized_expression "(lVar10 == 0)" ( (binary_expression "lVar10 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" identifier = (binary_expression "lVar10 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" identifier = (pointer_expression "*pcVar14" * identifier)) ;) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" identifier = (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" identifier + (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar13 = iVar13 + ~(uint)lVar10;" (assignment_expression "iVar13 = iVar13 + ~(uint)lVar10" identifier = (binary_expression "iVar13 + ~(uint)lVar10" identifier + (unary_expression "~(uint)lVar10" ~ (cast_expression "(uint)lVar10" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "plVar11 = plVar11 + 1;" (assignment_expression "plVar11 = plVar11 + 1" identifier = (binary_expression "plVar11 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8))" ( (binary_expression "plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" identifier != (cast_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" ( (binary_expression "lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8" identifier + (binary_expression "((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8" (parenthesized_expression "((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3))" ( (binary_expression "(long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)" (binary_expression "(long)iVar3 + 1" (cast_expression "(long)iVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + number_literal) + (call_expression "(ulong)(uint)((history_length + -1) - iVar3)" (call_expression "(ulong)(uint)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(uint)" ( identifier ))) (argument_list "((history_length + -1) - iVar3)" ( (binary_expression "(history_length + -1) - iVar3" (parenthesized_expression "(history_length + -1)" ( (binary_expression "history_length + -1" identifier + number_literal) )) - identifier) )))) )) * number_literal)) )))) )) ;) }) (else_clause "else {\n        iVar13 = 0;\n      }" else (compound_statement "{\n        iVar13 = 0;\n      }" { (expression_statement "iVar13 = 0;" (assignment_expression "iVar13 = 0" identifier = number_literal) ;) }))) (expression_statement "__buf = malloc((long)iVar13);" (assignment_expression "__buf = malloc((long)iVar13)" identifier = (call_expression "malloc((long)iVar13)" identifier (argument_list "((long)iVar13)" ( (cast_expression "(long)iVar13" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) )))) ;) (if_statement "if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }" if (parenthesized_expression "(__buf == (void *)0x0)" ( (binary_expression "__buf == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }" { (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) (expression_statement "close(iVar4);" (call_expression "close(iVar4)" identifier (argument_list "(iVar4)" ( identifier ))) ;) (if_statement "if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" if (parenthesized_expression "(local_f8 == (char *)0x0)" ( (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }" { (if_statement "if (__filename != (char *)0x0) {\n            free(__filename);\n          }" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n            free(__filename);\n          }" { (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) })) }) (else_clause "else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" else (compound_statement "{\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" { (expression_statement "unlink(local_f8);" (call_expression "unlink(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) (if_statement "if (__filename != (char *)0x0) {\n            free(__filename);\n          }" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n            free(__filename);\n          }" { (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) })) (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) }))) (goto_statement "goto LAB_001ce570;" goto statement_identifier ;) })) (expression_statement "iVar3 = history_length - param_2;" (assignment_expression "iVar3 = history_length - param_2" identifier = (binary_expression "history_length - param_2" identifier - identifier)) ;) (if_statement "if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }" if (parenthesized_expression "(iVar3 < history_length)" ( (binary_expression "iVar3 < history_length" identifier < identifier) )) (compound_statement "{\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }" { (expression_statement "plVar11 = (long *)(lVar7 + (long)iVar3 * 8);" (assignment_expression "plVar11 = (long *)(lVar7 + (long)iVar3 * 8)" identifier = (cast_expression "(long *)(lVar7 + (long)iVar3 * 8)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar7 + (long)iVar3 * 8)" ( (binary_expression "lVar7 + (long)iVar3 * 8" identifier + (binary_expression "(long)iVar3 * 8" (cast_expression "(long)iVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) * number_literal)) )))) ;) (expression_statement "iVar5 = history_length + -1;" (assignment_expression "iVar5 = history_length + -1" identifier = (binary_expression "history_length + -1" identifier + number_literal)) ;) (expression_statement "iVar12 = 0;" (assignment_expression "iVar12 = 0" identifier = number_literal) ;) (do_statement "do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);" do (compound_statement "{\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        }" { (if_statement "if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }" if (parenthesized_expression "(((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0'))" ( (binary_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')" (parenthesized_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0))" ( (binary_expression "(history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" (parenthesized_expression "(history_write_timestamps != 0)" ( (binary_expression "history_write_timestamps != 0" identifier != number_literal) )) && (parenthesized_expression "(pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" ( (comma_expression "pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" identifier = (pointer_expression "*(char **)(*plVar11 + 8)" * (cast_expression "(char **)(*plVar11 + 8)" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*plVar11 + 8)" ( (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" * identifier) + number_literal) ))))) , (binary_expression "pcVar14 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) ))) )) && (parenthesized_expression "(*pcVar14 != '\0')" ( (binary_expression "*pcVar14 != '\0'" (pointer_expression "*pcVar14" * identifier) != (char_literal "'\0'" ' escape_sequence ')) ))) )) (compound_statement "{\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }" { (expression_statement "strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);" (call_expression "strcpy((char *)((long)iVar12 + (long)__buf),pcVar14)" identifier (argument_list "((char *)((long)iVar12 + (long)__buf),pcVar14)" ( (cast_expression "(char *)((long)iVar12 + (long)__buf)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)iVar12 + (long)__buf)" ( (binary_expression "(long)iVar12 + (long)__buf" (cast_expression "(long)iVar12" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , identifier ))) ;) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" identifier = number_literal) ;) (expression_statement "pcVar14 = *(char **)(*plVar11 + 8);" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" identifier = (pointer_expression "*(char **)(*plVar11 + 8)" * (cast_expression "(char **)(*plVar11 + 8)" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*plVar11 + 8)" ( (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" * identifier) + number_literal) ))))) ;) (do_statement "do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');" do (compound_statement "{\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            }" { (if_statement "if (lVar10 == 0) break;" if (parenthesized_expression "(lVar10 == 0)" ( (binary_expression "lVar10 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" identifier = (binary_expression "lVar10 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" identifier = (pointer_expression "*pcVar14" * identifier)) ;) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" identifier = (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" identifier + (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar6 = iVar12 + -1 + ~(uint)lVar10;" (assignment_expression "iVar6 = iVar12 + -1 + ~(uint)lVar10" identifier = (binary_expression "iVar12 + -1 + ~(uint)lVar10" (binary_expression "iVar12 + -1" identifier + number_literal) + (unary_expression "~(uint)lVar10" ~ (cast_expression "(uint)lVar10" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "iVar12 = iVar6 + 1;" (assignment_expression "iVar12 = iVar6 + 1" identifier = (binary_expression "iVar6 + 1" identifier + number_literal)) ;) (expression_statement "*(undefined1 *)((long)__buf + (long)iVar6) = 10;" (assignment_expression "*(undefined1 *)((long)__buf + (long)iVar6) = 10" (pointer_expression "*(undefined1 *)((long)__buf + (long)iVar6)" * (cast_expression "(undefined1 *)((long)__buf + (long)iVar6)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)__buf + (long)iVar6)" ( (binary_expression "(long)__buf + (long)iVar6" (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) = number_literal) ;) })) (expression_statement "strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);" (call_expression "strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11)" identifier (argument_list "((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11)" ( (cast_expression "(char *)((long)iVar12 + (long)__buf)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)iVar12 + (long)__buf)" ( (binary_expression "(long)iVar12 + (long)__buf" (cast_expression "(long)iVar12" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ))) , (pointer_expression "*(char **)*plVar11" * (cast_expression "(char **)*plVar11" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (pointer_expression "*plVar11" * identifier))) ))) ;) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" identifier = number_literal) ;) (expression_statement "pcVar14 = *(char **)*plVar11;" (assignment_expression "pcVar14 = *(char **)*plVar11" identifier = (pointer_expression "*(char **)*plVar11" * (cast_expression "(char **)*plVar11" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (pointer_expression "*plVar11" * identifier)))) ;) (do_statement "do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');" do (compound_statement "{\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          }" { (if_statement "if (lVar10 == 0) break;" if (parenthesized_expression "(lVar10 == 0)" ( (binary_expression "lVar10 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" identifier = (binary_expression "lVar10 + -1" identifier + number_literal)) ;) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" identifier = (pointer_expression "*pcVar14" * identifier)) ;) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" identifier = (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" identifier + (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" ( (type_descriptor "ulong" type_identifier) ) identifier) * number_literal)) + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "iVar6 = iVar12 + -1 + ~(uint)lVar10;" (assignment_expression "iVar6 = iVar12 + -1 + ~(uint)lVar10" identifier = (binary_expression "iVar12 + -1 + ~(uint)lVar10" (binary_expression "iVar12 + -1" identifier + number_literal) + (unary_expression "~(uint)lVar10" ~ (cast_expression "(uint)lVar10" ( (type_descriptor "uint" type_identifier) ) identifier)))) ;) (expression_statement "iVar12 = iVar6 + 1;" (assignment_expression "iVar12 = iVar6 + 1" identifier = (binary_expression "iVar6 + 1" identifier + number_literal)) ;) (expression_statement "*(undefined1 *)((long)__buf + (long)iVar6) = 10;" (assignment_expression "*(undefined1 *)((long)__buf + (long)iVar6) = 10" (pointer_expression "*(undefined1 *)((long)__buf + (long)iVar6)" * (cast_expression "(undefined1 *)((long)__buf + (long)iVar6)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((long)__buf + (long)iVar6)" ( (binary_expression "(long)__buf + (long)iVar6" (cast_expression "(long)__buf" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + (cast_expression "(long)iVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )))) = number_literal) ;) (expression_statement "plVar11 = plVar11 + 1;" (assignment_expression "plVar11 = plVar11 + 1" identifier = (binary_expression "plVar11 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11)" ( (binary_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11" (cast_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8)" ( (binary_expression "lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8" identifier + (binary_expression "((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8" (parenthesized_expression "((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3))" ( (binary_expression "(long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)" (binary_expression "(long)iVar3 + 1" (cast_expression "(long)iVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) + number_literal) + (call_expression "(ulong)(uint)(iVar5 - iVar3)" (call_expression "(ulong)(uint)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(uint)" ( identifier ))) (argument_list "(iVar5 - iVar3)" ( (binary_expression "iVar5 - iVar3" identifier - identifier) )))) )) * number_literal)) ))) != identifier) )) ;) })) (expression_statement "sVar8 = write(iVar4,__buf,(long)iVar13);" (assignment_expression "sVar8 = write(iVar4,__buf,(long)iVar13)" identifier = (call_expression "write(iVar4,__buf,(long)iVar13)" identifier (argument_list "(iVar4,__buf,(long)iVar13)" ( identifier , identifier , (cast_expression "(long)iVar13" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) )))) ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (if_statement "if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" if (parenthesized_expression "(sVar8 < 0)" ( (binary_expression "sVar8 < 0" identifier < number_literal) )) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" { (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) })) (expression_statement "xfree(__buf);" (call_expression "xfree(__buf)" identifier (argument_list "(__buf)" ( identifier ))) ;) (expression_statement "history_lines_written_to_file = param_2;" (assignment_expression "history_lines_written_to_file = param_2" identifier = identifier) ;) (expression_statement "iVar4 = close(iVar4);" (assignment_expression "iVar4 = close(iVar4)" identifier = (call_expression "close(iVar4)" identifier (argument_list "(iVar4)" ( identifier )))) ;) (if_statement "if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" if (parenthesized_expression "((iVar4 < 0) && (iVar3 == 0))" ( (binary_expression "(iVar4 < 0) && (iVar3 == 0)" (parenthesized_expression "(iVar4 < 0)" ( (binary_expression "iVar4 < 0" identifier < number_literal) )) && (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) ))) )) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" { (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) })) (if_statement "if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" if (parenthesized_expression "((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0))" ( (binary_expression "(__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)" (parenthesized_expression "(__filename == (char *)0x0 || local_f8 == (char *)0x0)" ( (binary_expression "__filename == (char *)0x0 || local_f8 == (char *)0x0" (binary_expression "__filename == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) || (binary_expression "local_f8 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) )) || (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) ))) )) (compound_statement "{\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }" { (if_statement "if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }" { (if_statement "if (local_f8 != (char *)0x0) goto LAB_001ce53d;" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (goto_statement "goto LAB_001ce53d;" goto statement_identifier ;)) (goto_statement "goto LAB_001ce547;" goto statement_identifier ;) })) (if_statement "if (bVar15) goto LAB_001ce5d9;" if (parenthesized_expression "(bVar15)" ( identifier )) (goto_statement "goto LAB_001ce5d9;" goto statement_identifier ;)) (labeled_statement "LAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;" statement_identifier : (if_statement "if (__filename != (char *)0x0) goto LAB_001ce556;" if (parenthesized_expression "(__filename != (char *)0x0)" ( (binary_expression "__filename != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (goto_statement "goto LAB_001ce556;" goto statement_identifier ;))) }) (else_clause "else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" else (compound_statement "{\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" { (expression_statement "iVar3 = FUN_001ce1bf(local_f8,__filename);" (assignment_expression "iVar3 = FUN_001ce1bf(local_f8,__filename)" identifier = (call_expression "FUN_001ce1bf(local_f8,__filename)" identifier (argument_list "(local_f8,__filename)" ( identifier , identifier )))) ;) (if_statement "if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }" { (labeled_statement "LAB_001ce53d:\n          unlink(local_f8);" statement_identifier : (expression_statement "unlink(local_f8);" (call_expression "unlink(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;)) (labeled_statement "LAB_001ce547:\n          history_lines_written_to_file = 0;" statement_identifier : (expression_statement "history_lines_written_to_file = 0;" (assignment_expression "history_lines_written_to_file = 0" identifier = number_literal) ;)) (goto_statement "goto LAB_001ce551;" goto statement_identifier ;) })) (if_statement "if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }" if (parenthesized_expression "(bVar15)" ( identifier )) (compound_statement "{\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }" { (labeled_statement "LAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);" statement_identifier : (expression_statement "chown(__filename,local_d8.st_uid,local_d8.st_gid);" (call_expression "chown(__filename,local_d8.st_uid,local_d8.st_gid)" identifier (argument_list "(__filename,local_d8.st_uid,local_d8.st_gid)" ( identifier , (field_expression "local_d8.st_uid" identifier . field_identifier) , (field_expression "local_d8.st_gid" identifier . field_identifier) ))) ;)) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_001ce551;" goto statement_identifier ;) })) (labeled_statement "LAB_001ce556:\n        free(__filename);" statement_identifier : (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;)) }))) (if_statement "if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        free(local_f8);\n      }" { (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) })) (goto_statement "goto LAB_001ce570;" goto statement_identifier ;) })) (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" identifier = (pointer_expression "*piVar9" * identifier)) ;) (expression_statement "free(__filename);" (call_expression "free(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) }))) (if_statement "if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }" if (parenthesized_expression "(local_f8 != (char *)0x0)" ( (binary_expression "local_f8 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    free(local_f8);\n  }" { (expression_statement "free(local_f8);" (call_expression "free(local_f8)" identifier (argument_list "(local_f8)" ( identifier ))) ;) })) (labeled_statement "LAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }" statement_identifier : (if_statement "if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }" if (parenthesized_expression "(local_40 != *(long *)(in_FS_OFFSET + 0x28))" ( (binary_expression "local_40 != *(long *)(in_FS_OFFSET + 0x28)" identifier != (pointer_expression "*(long *)(in_FS_OFFSET + 0x28)" * (cast_expression "(long *)(in_FS_OFFSET + 0x28)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_FS_OFFSET + 0x28)" ( (binary_expression "in_FS_OFFSET + 0x28" identifier + number_literal) ))))) )) (compound_statement "{\n                    \n    __stack_chk_fail();\n  }" { (expression_statement "__stack_chk_fail();" (call_expression "__stack_chk_fail()" identifier (argument_list "()" ( ))) ;) }))) (return_statement "return iVar3;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration (sized_type_specifier long) IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration (sized_type_specifier long) IDENT ;) (declaration (sized_type_specifier long) (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration (sized_type_specifier long) IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration (sized_type_specifier long) IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( LIT , IDENT , (pointer_expression & IDENT) )))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT == LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT != LIT) && IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT != LIT) && IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (field_expression IDENT . field_identifier) & LIT) )) != LIT) )) || (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( IDENT ))))) , (comma_expression (assignment_expression IDENT = IDENT) , (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)))) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) })) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) }))) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , (binary_expression (parenthesized_expression ( (binary_expression (unary_expression - (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression IDENT == LIT) )))) & LIT) )) + LIT) , LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) * LIT)) )))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != LIT) )) && (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) + LIT) ))))) , (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT))) ))) )) && (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) != (char_literal ' escape_sequence ')) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) * LIT)) + LIT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + (unary_expression ~ (cast_expression ( (type_descriptor TYPE) ) IDENT)))) ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (pointer_expression * IDENT)))) ;) (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) * LIT)) + LIT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + (unary_expression ~ (cast_expression ( (type_descriptor TYPE) ) IDENT)))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + (binary_expression (parenthesized_expression ( (binary_expression (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + LIT) + (call_expression (call_expression (parenthesized_expression ( IDENT )) (argument_list ( IDENT ))) (argument_list ( (binary_expression (parenthesized_expression ( (binary_expression IDENT + LIT) )) - IDENT) )))) )) * LIT)) )))) )) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) }))) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) })) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) })) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) }))) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) * LIT)) )))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != LIT) )) && (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) + LIT) ))))) , (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT))) ))) )) && (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) != (char_literal ' escape_sequence ')) ))) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) ))) , IDENT ))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) + LIT) ))))) ;) (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) * LIT)) + LIT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + LIT) + (unary_expression ~ (cast_expression ( (type_descriptor TYPE) ) IDENT)))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) )))) = LIT) ;) })) (expression_statement (call_expression IDENT (argument_list ( (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) ))) , (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (pointer_expression * IDENT))) ))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (pointer_expression * IDENT)))) ;) (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) * LIT)) + LIT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + LIT) + (unary_expression ~ (cast_expression ( (type_descriptor TYPE) ) IDENT)))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) )))) = LIT) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) }) while (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long) (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + (binary_expression (parenthesized_expression ( (binary_expression (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) + LIT) + (call_expression (call_expression (parenthesized_expression ( IDENT )) (argument_list ( IDENT ))) (argument_list ( (binary_expression IDENT - IDENT) )))) )) * LIT)) ))) != IDENT) )) ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) )))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) })) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT < LIT) )) && (parenthesized_expression ( (binary_expression IDENT == LIT) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) })) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) || (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT))) )) || (parenthesized_expression ( (binary_expression IDENT != LIT) ))) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (goto_statement goto statement_identifier ;)) (goto_statement goto statement_identifier ;) })) (if_statement if (parenthesized_expression ( IDENT )) (goto_statement goto statement_identifier ;)) (labeled_statement statement_identifier : (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (goto_statement goto statement_identifier ;))) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (labeled_statement statement_identifier : (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;)) (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = LIT) ;)) (goto_statement goto statement_identifier ;) })) (if_statement if (parenthesized_expression ( IDENT )) (compound_statement { (labeled_statement statement_identifier : (expression_statement (call_expression IDENT (argument_list ( IDENT , (field_expression IDENT . field_identifier) , (field_expression IDENT . field_identifier) ))) ;)) (expression_statement (assignment_expression IDENT = LIT) ;) (goto_statement goto statement_identifier ;) })) (labeled_statement statement_identifier : (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;)) }))) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) })) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) }))) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) })) (labeled_statement statement_identifier : (if_statement if (parenthesized_expression ( (binary_expression IDENT != (pointer_expression * (cast_expression ( (type_descriptor (sized_type_specifier long) (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 FUN_001ce234(undefined8 param_1,int param_2,int param_3)\n\n{\n  char cVar1;\n  bool bVar2;\n  int iVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  char *__filename;\n  long lVar7;\n  void *__buf;\n  ssize_t sVar8;\n  int *piVar9;\n  long lVar10;\n  long *plVar11;\n  int iVar12;\n  int iVar13;\n  char *pcVar14;\n  long in_FS_OFFSET;\n  bool bVar15;\n  byte bVar16;\n  char *local_f8;\n  stat local_d8;\n  long local_40;\n  \n  bVar16 = 0;\n  local_40 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = (char *)FUN_001cdf95();\n  if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }\n  return iVar3;\n}" (primitive_type "int") (function_declarator "FUN_001ce234(undefined8 param_1,int param_2,int param_3)" (identifier "FUN_001ce234") (parameter_list "(undefined8 param_1,int param_2,int param_3)" (( "(") (parameter_declaration "undefined8 param_1" (type_identifier "undefined8") (identifier "param_1")) (, ",") (parameter_declaration "int param_2" (primitive_type "int") (identifier "param_2")) (, ",") (parameter_declaration "int param_3" (primitive_type "int") (identifier "param_3")) () ")"))) (compound_statement "{\n  char cVar1;\n  bool bVar2;\n  int iVar3;\n  int iVar4;\n  int iVar5;\n  int iVar6;\n  char *__filename;\n  long lVar7;\n  void *__buf;\n  ssize_t sVar8;\n  int *piVar9;\n  long lVar10;\n  long *plVar11;\n  int iVar12;\n  int iVar13;\n  char *pcVar14;\n  long in_FS_OFFSET;\n  bool bVar15;\n  byte bVar16;\n  char *local_f8;\n  stat local_d8;\n  long local_40;\n  \n  bVar16 = 0;\n  local_40 = *(long *)(in_FS_OFFSET + 0x28);\n  __filename = (char *)FUN_001cdf95();\n  if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }\n  if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }\nLAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }\n  return iVar3;\n}" ({ "{") (declaration "char cVar1;" (primitive_type "char") (identifier "cVar1") (; ";")) (declaration "bool bVar2;" (primitive_type "bool") (identifier "bVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "int iVar4;" (primitive_type "int") (identifier "iVar4") (; ";")) (declaration "int iVar5;" (primitive_type "int") (identifier "iVar5") (; ";")) (declaration "int iVar6;" (primitive_type "int") (identifier "iVar6") (; ";")) (declaration "char *__filename;" (primitive_type "char") (pointer_declarator "*__filename" (* "*") (identifier "__filename")) (; ";")) (declaration "long lVar7;" (sized_type_specifier "long" (long "long")) (identifier "lVar7") (; ";")) (declaration "void *__buf;" (primitive_type "void") (pointer_declarator "*__buf" (* "*") (identifier "__buf")) (; ";")) (declaration "ssize_t sVar8;" (primitive_type "ssize_t") (identifier "sVar8") (; ";")) (declaration "int *piVar9;" (primitive_type "int") (pointer_declarator "*piVar9" (* "*") (identifier "piVar9")) (; ";")) (declaration "long lVar10;" (sized_type_specifier "long" (long "long")) (identifier "lVar10") (; ";")) (declaration "long *plVar11;" (sized_type_specifier "long" (long "long")) (pointer_declarator "*plVar11" (* "*") (identifier "plVar11")) (; ";")) (declaration "int iVar12;" (primitive_type "int") (identifier "iVar12") (; ";")) (declaration "int iVar13;" (primitive_type "int") (identifier "iVar13") (; ";")) (declaration "char *pcVar14;" (primitive_type "char") (pointer_declarator "*pcVar14" (* "*") (identifier "pcVar14")) (; ";")) (declaration "long in_FS_OFFSET;" (sized_type_specifier "long" (long "long")) (identifier "in_FS_OFFSET") (; ";")) (declaration "bool bVar15;" (primitive_type "bool") (identifier "bVar15") (; ";")) (declaration "byte bVar16;" (type_identifier "byte") (identifier "bVar16") (; ";")) (declaration "char *local_f8;" (primitive_type "char") (pointer_declarator "*local_f8" (* "*") (identifier "local_f8")) (; ";")) (declaration "stat local_d8;" (type_identifier "stat") (identifier "local_d8") (; ";")) (declaration "long local_40;" (sized_type_specifier "long" (long "long")) (identifier "local_40") (; ";")) (expression_statement "bVar16 = 0;" (assignment_expression "bVar16 = 0" (identifier "bVar16") (= "=") (number_literal "0")) (; ";")) (expression_statement "local_40 = *(long *)(in_FS_OFFSET + 0x28);" (assignment_expression "local_40 = *(long *)(in_FS_OFFSET + 0x28)" (identifier "local_40") (= "=") (pointer_expression "*(long *)(in_FS_OFFSET + 0x28)" (* "*") (cast_expression "(long *)(in_FS_OFFSET + 0x28)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_FS_OFFSET + 0x28)" (( "(") (binary_expression "in_FS_OFFSET + 0x28" (identifier "in_FS_OFFSET") (+ "+") (number_literal "0x28")) () ")"))))) (; ";")) (expression_statement "__filename = (char *)FUN_001cdf95();" (assignment_expression "__filename = (char *)FUN_001cdf95()" (identifier "__filename") (= "=") (cast_expression "(char *)FUN_001cdf95()" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_001cdf95()" (identifier "FUN_001cdf95") (argument_list "()" (( "(") () ")"))))) (; ";")) (if_statement "if (__filename == (char *)0x0) {\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }\n  else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" (if "if") (parenthesized_expression "(__filename == (char *)0x0)" (( "(") (binary_expression "__filename == (char *)0x0" (identifier "__filename") (== "==") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    local_f8 = (char *)0x0;\n  }" ({ "{") (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" (identifier "piVar9") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" (identifier "iVar3") (= "=") (pointer_expression "*piVar9" (* "*") (identifier "piVar9"))) (; ";")) (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" (identifier "local_f8") (= "=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) (; ";")) (} "}")) (else_clause "else {\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" (else "else") (compound_statement "{\n    iVar3 = __xstat(1,__filename,&local_d8);\n    bVar15 = iVar3 == 0;\n    bVar2 = param_3 != 0 && bVar15;\n    if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }\n    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);\n    if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }\n    piVar9 = __errno_location();\n    iVar3 = *piVar9;\n    free(__filename);\n  }" ({ "{") (expression_statement "iVar3 = __xstat(1,__filename,&local_d8);" (assignment_expression "iVar3 = __xstat(1,__filename,&local_d8)" (identifier "iVar3") (= "=") (call_expression "__xstat(1,__filename,&local_d8)" (identifier "__xstat") (argument_list "(1,__filename,&local_d8)" (( "(") (number_literal "1") (, ",") (identifier "__filename") (, ",") (pointer_expression "&local_d8" (& "&") (identifier "local_d8")) () ")")))) (; ";")) (expression_statement "bVar15 = iVar3 == 0;" (assignment_expression "bVar15 = iVar3 == 0" (identifier "bVar15") (= "=") (binary_expression "iVar3 == 0" (identifier "iVar3") (== "==") (number_literal "0"))) (; ";")) (expression_statement "bVar2 = param_3 != 0 && bVar15;" (assignment_expression "bVar2 = param_3 != 0 && bVar15" (identifier "bVar2") (= "=") (binary_expression "param_3 != 0 && bVar15" (binary_expression "param_3 != 0" (identifier "param_3") (!= "!=") (number_literal "0")) (&& "&&") (identifier "bVar15"))) (; ";")) (if_statement "if (param_3 != 0 && bVar15) {\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }\n    else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" (if "if") (parenthesized_expression "(param_3 != 0 && bVar15)" (( "(") (binary_expression "param_3 != 0 && bVar15" (binary_expression "param_3 != 0" (identifier "param_3") (!= "!=") (number_literal "0")) (&& "&&") (identifier "bVar15")) () ")")) (compound_statement "{\n      bVar15 = bVar2;\n      if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }\n    }" ({ "{") (expression_statement "bVar15 = bVar2;" (assignment_expression "bVar15 = bVar2" (identifier "bVar15") (= "=") (identifier "bVar2")) (; ";")) (if_statement "if (((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))\n      {\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }" (if "if") (parenthesized_expression "(((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))" (( "(") (binary_expression "((local_d8.st_mode & 0xf000) != 0x8000) ||\n         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0)" (parenthesized_expression "((local_d8.st_mode & 0xf000) != 0x8000)" (( "(") (binary_expression "(local_d8.st_mode & 0xf000) != 0x8000" (parenthesized_expression "(local_d8.st_mode & 0xf000)" (( "(") (binary_expression "local_d8.st_mode & 0xf000" (field_expression "local_d8.st_mode" (identifier "local_d8") (. ".") (field_identifier "st_mode")) (& "&") (number_literal "0xf000")) () ")")) (!= "!=") (number_literal "0x8000")) () ")")) (|| "||") (parenthesized_expression "(local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0)" (( "(") (comma_expression "local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0" (assignment_expression "local_f8 = (char *)FUN_001ce03d(__filename)" (identifier "local_f8") (= "=") (cast_expression "(char *)FUN_001ce03d(__filename)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_001ce03d(__filename)" (identifier "FUN_001ce03d") (argument_list "(__filename)" (( "(") (identifier "__filename") () ")"))))) (, ",") (comma_expression "pcVar14 = local_f8, local_f8 == (char *)0x0" (assignment_expression "pcVar14 = local_f8" (identifier "pcVar14") (= "=") (identifier "local_f8")) (, ",") (binary_expression "local_f8 == (char *)0x0" (identifier "local_f8") (== "==") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))))) () ")"))) () ")")) (compound_statement "{\n        local_f8 = (char *)0x0;\n        pcVar14 = __filename;\n      }" ({ "{") (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" (identifier "local_f8") (= "=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) (; ";")) (expression_statement "pcVar14 = __filename;" (assignment_expression "pcVar14 = __filename" (identifier "pcVar14") (= "=") (identifier "__filename")) (; ";")) (} "}"))) (} "}")) (else_clause "else {\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" (else "else") (compound_statement "{\n      local_f8 = (char *)0x0;\n      pcVar14 = __filename;\n    }" ({ "{") (expression_statement "local_f8 = (char *)0x0;" (assignment_expression "local_f8 = (char *)0x0" (identifier "local_f8") (= "=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) (; ";")) (expression_statement "pcVar14 = __filename;" (assignment_expression "pcVar14 = __filename" (identifier "pcVar14") (= "=") (identifier "__filename")) (; ";")) (} "}")))) (expression_statement "iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);" (assignment_expression "iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" (identifier "iVar4") (= "=") (call_expression "open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" (identifier "open") (argument_list "(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180)" (( "(") (identifier "pcVar14") (, ",") (binary_expression "(-(uint)(param_3 == 0) & 0x1c0) + 0x241" (parenthesized_expression "(-(uint)(param_3 == 0) & 0x1c0)" (( "(") (binary_expression "-(uint)(param_3 == 0) & 0x1c0" (unary_expression "-(uint)(param_3 == 0)" (- "-") (call_expression "(uint)(param_3 == 0)" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (argument_list "(param_3 == 0)" (( "(") (binary_expression "param_3 == 0" (identifier "param_3") (== "==") (number_literal "0")) () ")")))) (& "&") (number_literal "0x1c0")) () ")")) (+ "+") (number_literal "0x241")) (, ",") (number_literal "0x180") () ")")))) (; ";")) (if_statement "if (iVar4 != -1) {\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }" (if "if") (parenthesized_expression "(iVar4 != -1)" (( "(") (binary_expression "iVar4 != -1" (identifier "iVar4") (!= "!=") (number_literal "-1")) () ")")) (compound_statement "{\n      if (history_length <= param_2) {\n        param_2 = history_length;\n      }\n      lVar7 = history_list();\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }\n      __buf = malloc((long)iVar13);\n      if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }\n      iVar3 = history_length - param_2;\n      if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }\n      sVar8 = write(iVar4,__buf,(long)iVar13);\n      iVar3 = 0;\n      if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      xfree(__buf);\n      history_lines_written_to_file = param_2;\n      iVar4 = close(iVar4);\n      if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }\n      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }\n      if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }\n      goto LAB_001ce570;\n    }" ({ "{") (if_statement "if (history_length <= param_2) {\n        param_2 = history_length;\n      }" (if "if") (parenthesized_expression "(history_length <= param_2)" (( "(") (binary_expression "history_length <= param_2" (identifier "history_length") (<= "<=") (identifier "param_2")) () ")")) (compound_statement "{\n        param_2 = history_length;\n      }" ({ "{") (expression_statement "param_2 = history_length;" (assignment_expression "param_2 = history_length" (identifier "param_2") (= "=") (identifier "history_length")) (; ";")) (} "}"))) (expression_statement "lVar7 = history_list();" (assignment_expression "lVar7 = history_list()" (identifier "lVar7") (= "=") (call_expression "history_list()" (identifier "history_list") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar3 = history_length - param_2;" (assignment_expression "iVar3 = history_length - param_2" (identifier "iVar3") (= "=") (binary_expression "history_length - param_2" (identifier "history_length") (- "-") (identifier "param_2"))) (; ";")) (if_statement "if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }\n      else {\n        iVar13 = 0;\n      }" (if "if") (parenthesized_expression "(iVar3 < history_length)" (( "(") (binary_expression "iVar3 < history_length" (identifier "iVar3") (< "<") (identifier "history_length")) () ")")) (compound_statement "{\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar13 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));\n      }" ({ "{") (expression_statement "plVar11 = (long *)(lVar7 + (long)iVar3 * 8);" (assignment_expression "plVar11 = (long *)(lVar7 + (long)iVar3 * 8)" (identifier "plVar11") (= "=") (cast_expression "(long *)(lVar7 + (long)iVar3 * 8)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(lVar7 + (long)iVar3 * 8)" (( "(") (binary_expression "lVar7 + (long)iVar3 * 8" (identifier "lVar7") (+ "+") (binary_expression "(long)iVar3 * 8" (cast_expression "(long)iVar3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar3")) (* "*") (number_literal "8"))) () ")")))) (; ";")) (expression_statement "iVar13 = 0;" (assignment_expression "iVar13 = 0" (identifier "iVar13") (= "=") (number_literal "0")) (; ";")) (do_statement "do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        } while (plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8));" (do "do") (compound_statement "{\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar13 = iVar13 + ~(uint)lVar10;\n          plVar11 = plVar11 + 1;\n        }" ({ "{") (if_statement "if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }" (if "if") (parenthesized_expression "(((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0'))" (( "(") (binary_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')" (parenthesized_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0))" (( "(") (binary_expression "(history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" (parenthesized_expression "(history_write_timestamps != 0)" (( "(") (binary_expression "history_write_timestamps != 0" (identifier "history_write_timestamps") (!= "!=") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" (( "(") (comma_expression "pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" (identifier "pcVar14") (= "=") (pointer_expression "*(char **)(*plVar11 + 8)" (* "*") (cast_expression "(char **)(*plVar11 + 8)" (( "(") (type_descriptor "char **" (primitive_type "char") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(*plVar11 + 8)" (( "(") (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" (* "*") (identifier "plVar11")) (+ "+") (number_literal "8")) () ")"))))) (, ",") (binary_expression "pcVar14 != (char *)0x0" (identifier "pcVar14") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")))) () ")"))) () ")")) (&& "&&") (parenthesized_expression "(*pcVar14 != '\0')" (( "(") (binary_expression "*pcVar14 != '\0'" (pointer_expression "*pcVar14" (* "*") (identifier "pcVar14")) (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")"))) () ")")) (compound_statement "{\n            lVar10 = -1;\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar13 = iVar13 + ~(uint)lVar10;\n          }" ({ "{") (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" (identifier "lVar10") (= "=") (number_literal "-1")) (; ";")) (do_statement "do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');" (do "do") (compound_statement "{\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            }" ({ "{") (if_statement "if (lVar10 == 0) break;" (if "if") (parenthesized_expression "(lVar10 == 0)" (( "(") (binary_expression "lVar10 == 0" (identifier "lVar10") (== "==") (number_literal "0")) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" (identifier "lVar10") (= "=") (binary_expression "lVar10 + -1" (identifier "lVar10") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" (identifier "cVar1") (= "=") (pointer_expression "*pcVar14" (* "*") (identifier "pcVar14"))) (; ";")) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" (identifier "pcVar14") (= "=") (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" (identifier "pcVar14") (+ "+") (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" (( "(") (type_descriptor "ulong" (type_identifier "ulong")) () ")") (identifier "bVar16")) (* "*") (number_literal "-2"))) (+ "+") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(cVar1 != '\0')" (( "(") (binary_expression "cVar1 != '\0'" (identifier "cVar1") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (; ";")) (expression_statement "iVar13 = iVar13 + ~(uint)lVar10;" (assignment_expression "iVar13 = iVar13 + ~(uint)lVar10" (identifier "iVar13") (= "=") (binary_expression "iVar13 + ~(uint)lVar10" (identifier "iVar13") (+ "+") (unary_expression "~(uint)lVar10" (~ "~") (cast_expression "(uint)lVar10" (( "(") (type_descriptor "uint" (type_identifier "uint")) () ")") (identifier "lVar10"))))) (; ";")) (} "}"))) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" (identifier "lVar10") (= "=") (number_literal "-1")) (; ";")) (expression_statement "pcVar14 = *(char **)*plVar11;" (assignment_expression "pcVar14 = *(char **)*plVar11" (identifier "pcVar14") (= "=") (pointer_expression "*(char **)*plVar11" (* "*") (cast_expression "(char **)*plVar11" (( "(") (type_descriptor "char **" (primitive_type "char") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (pointer_expression "*plVar11" (* "*") (identifier "plVar11"))))) (; ";")) (do_statement "do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');" (do "do") (compound_statement "{\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          }" ({ "{") (if_statement "if (lVar10 == 0) break;" (if "if") (parenthesized_expression "(lVar10 == 0)" (( "(") (binary_expression "lVar10 == 0" (identifier "lVar10") (== "==") (number_literal "0")) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" (identifier "lVar10") (= "=") (binary_expression "lVar10 + -1" (identifier "lVar10") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" (identifier "cVar1") (= "=") (pointer_expression "*pcVar14" (* "*") (identifier "pcVar14"))) (; ";")) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" (identifier "pcVar14") (= "=") (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" (identifier "pcVar14") (+ "+") (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" (( "(") (type_descriptor "ulong" (type_identifier "ulong")) () ")") (identifier "bVar16")) (* "*") (number_literal "-2"))) (+ "+") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(cVar1 != '\0')" (( "(") (binary_expression "cVar1 != '\0'" (identifier "cVar1") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (; ";")) (expression_statement "iVar13 = iVar13 + ~(uint)lVar10;" (assignment_expression "iVar13 = iVar13 + ~(uint)lVar10" (identifier "iVar13") (= "=") (binary_expression "iVar13 + ~(uint)lVar10" (identifier "iVar13") (+ "+") (unary_expression "~(uint)lVar10" (~ "~") (cast_expression "(uint)lVar10" (( "(") (type_descriptor "uint" (type_identifier "uint")) () ")") (identifier "lVar10"))))) (; ";")) (expression_statement "plVar11 = plVar11 + 1;" (assignment_expression "plVar11 = plVar11 + 1" (identifier "plVar11") (= "=") (binary_expression "plVar11 + 1" (identifier "plVar11") (+ "+") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8))" (( "(") (binary_expression "plVar11 !=\n                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" (identifier "plVar11") (!= "!=") (cast_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8)" (( "(") (binary_expression "lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8" (identifier "lVar7") (+ "+") (binary_expression "((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *\n                                  8" (parenthesized_expression "((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3))" (( "(") (binary_expression "(long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)" (binary_expression "(long)iVar3 + 1" (cast_expression "(long)iVar3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar3")) (+ "+") (number_literal "1")) (+ "+") (call_expression "(ulong)(uint)((history_length + -1) - iVar3)" (call_expression "(ulong)(uint)" (parenthesized_expression "(ulong)" (( "(") (identifier "ulong") () ")")) (argument_list "(uint)" (( "(") (identifier "uint") () ")"))) (argument_list "((history_length + -1) - iVar3)" (( "(") (binary_expression "(history_length + -1) - iVar3" (parenthesized_expression "(history_length + -1)" (( "(") (binary_expression "history_length + -1" (identifier "history_length") (+ "+") (number_literal "-1")) () ")")) (- "-") (identifier "iVar3")) () ")")))) () ")")) (* "*") (number_literal "8"))) () ")")))) () ")")) (; ";")) (} "}")) (else_clause "else {\n        iVar13 = 0;\n      }" (else "else") (compound_statement "{\n        iVar13 = 0;\n      }" ({ "{") (expression_statement "iVar13 = 0;" (assignment_expression "iVar13 = 0" (identifier "iVar13") (= "=") (number_literal "0")) (; ";")) (} "}")))) (expression_statement "__buf = malloc((long)iVar13);" (assignment_expression "__buf = malloc((long)iVar13)" (identifier "__buf") (= "=") (call_expression "malloc((long)iVar13)" (identifier "malloc") (argument_list "((long)iVar13)" (( "(") (cast_expression "(long)iVar13" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar13")) () ")")))) (; ";")) (if_statement "if (__buf == (void *)0x0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }" (if "if") (parenthesized_expression "(__buf == (void *)0x0)" (( "(") (binary_expression "__buf == (void *)0x0" (identifier "__buf") (== "==") (cast_expression "(void *)0x0" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n        close(iVar4);\n        if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }\n        goto LAB_001ce570;\n      }" ({ "{") (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" (identifier "piVar9") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" (identifier "iVar3") (= "=") (pointer_expression "*piVar9" (* "*") (identifier "piVar9"))) (; ";")) (expression_statement "close(iVar4);" (call_expression "close(iVar4)" (identifier "close") (argument_list "(iVar4)" (( "(") (identifier "iVar4") () ")"))) (; ";")) (if_statement "if (local_f8 == (char *)0x0) {\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }\n        else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" (if "if") (parenthesized_expression "(local_f8 == (char *)0x0)" (( "(") (binary_expression "local_f8 == (char *)0x0" (identifier "local_f8") (== "==") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n        }" ({ "{") (if_statement "if (__filename != (char *)0x0) {\n            free(__filename);\n          }" (if "if") (parenthesized_expression "(__filename != (char *)0x0)" (( "(") (binary_expression "__filename != (char *)0x0" (identifier "__filename") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n            free(__filename);\n          }" ({ "{") (expression_statement "free(__filename);" (call_expression "free(__filename)" (identifier "free") (argument_list "(__filename)" (( "(") (identifier "__filename") () ")"))) (; ";")) (} "}"))) (} "}")) (else_clause "else {\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" (else "else") (compound_statement "{\n          unlink(local_f8);\n          if (__filename != (char *)0x0) {\n            free(__filename);\n          }\n          free(local_f8);\n        }" ({ "{") (expression_statement "unlink(local_f8);" (call_expression "unlink(local_f8)" (identifier "unlink") (argument_list "(local_f8)" (( "(") (identifier "local_f8") () ")"))) (; ";")) (if_statement "if (__filename != (char *)0x0) {\n            free(__filename);\n          }" (if "if") (parenthesized_expression "(__filename != (char *)0x0)" (( "(") (binary_expression "__filename != (char *)0x0" (identifier "__filename") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n            free(__filename);\n          }" ({ "{") (expression_statement "free(__filename);" (call_expression "free(__filename)" (identifier "free") (argument_list "(__filename)" (( "(") (identifier "__filename") () ")"))) (; ";")) (} "}"))) (expression_statement "free(local_f8);" (call_expression "free(local_f8)" (identifier "free") (argument_list "(local_f8)" (( "(") (identifier "local_f8") () ")"))) (; ";")) (} "}")))) (goto_statement "goto LAB_001ce570;" (goto "goto") (statement_identifier "LAB_001ce570") (; ";")) (} "}"))) (expression_statement "iVar3 = history_length - param_2;" (assignment_expression "iVar3 = history_length - param_2" (identifier "iVar3") (= "=") (binary_expression "history_length - param_2" (identifier "history_length") (- "-") (identifier "param_2"))) (; ";")) (if_statement "if (iVar3 < history_length) {\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }" (if "if") (parenthesized_expression "(iVar3 < history_length)" (( "(") (binary_expression "iVar3 < history_length" (identifier "iVar3") (< "<") (identifier "history_length")) () ")")) (compound_statement "{\n        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);\n        iVar5 = history_length + -1;\n        iVar12 = 0;\n        do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);\n      }" ({ "{") (expression_statement "plVar11 = (long *)(lVar7 + (long)iVar3 * 8);" (assignment_expression "plVar11 = (long *)(lVar7 + (long)iVar3 * 8)" (identifier "plVar11") (= "=") (cast_expression "(long *)(lVar7 + (long)iVar3 * 8)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(lVar7 + (long)iVar3 * 8)" (( "(") (binary_expression "lVar7 + (long)iVar3 * 8" (identifier "lVar7") (+ "+") (binary_expression "(long)iVar3 * 8" (cast_expression "(long)iVar3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar3")) (* "*") (number_literal "8"))) () ")")))) (; ";")) (expression_statement "iVar5 = history_length + -1;" (assignment_expression "iVar5 = history_length + -1" (identifier "iVar5") (= "=") (binary_expression "history_length + -1" (identifier "history_length") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "iVar12 = 0;" (assignment_expression "iVar12 = 0" (identifier "iVar12") (= "=") (number_literal "0")) (; ";")) (do_statement "do {\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);" (do "do") (compound_statement "{\n          if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }\n          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);\n          lVar10 = -1;\n          pcVar14 = *(char **)*plVar11;\n          do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');\n          iVar6 = iVar12 + -1 + ~(uint)lVar10;\n          iVar12 = iVar6 + 1;\n          *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          plVar11 = plVar11 + 1;\n        }" ({ "{") (if_statement "if (((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }" (if "if") (parenthesized_expression "(((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0'))" (( "(") (binary_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')" (parenthesized_expression "((history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0))" (( "(") (binary_expression "(history_write_timestamps != 0) &&\n              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" (parenthesized_expression "(history_write_timestamps != 0)" (( "(") (binary_expression "history_write_timestamps != 0" (identifier "history_write_timestamps") (!= "!=") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)" (( "(") (comma_expression "pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" (identifier "pcVar14") (= "=") (pointer_expression "*(char **)(*plVar11 + 8)" (* "*") (cast_expression "(char **)(*plVar11 + 8)" (( "(") (type_descriptor "char **" (primitive_type "char") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(*plVar11 + 8)" (( "(") (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" (* "*") (identifier "plVar11")) (+ "+") (number_literal "8")) () ")"))))) (, ",") (binary_expression "pcVar14 != (char *)0x0" (identifier "pcVar14") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")))) () ")"))) () ")")) (&& "&&") (parenthesized_expression "(*pcVar14 != '\0')" (( "(") (binary_expression "*pcVar14 != '\0'" (pointer_expression "*pcVar14" (* "*") (identifier "pcVar14")) (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")"))) () ")")) (compound_statement "{\n            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);\n            lVar10 = -1;\n            pcVar14 = *(char **)(*plVar11 + 8);\n            do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');\n            iVar6 = iVar12 + -1 + ~(uint)lVar10;\n            iVar12 = iVar6 + 1;\n            *(undefined1 *)((long)__buf + (long)iVar6) = 10;\n          }" ({ "{") (expression_statement "strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);" (call_expression "strcpy((char *)((long)iVar12 + (long)__buf),pcVar14)" (identifier "strcpy") (argument_list "((char *)((long)iVar12 + (long)__buf),pcVar14)" (( "(") (cast_expression "(char *)((long)iVar12 + (long)__buf)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((long)iVar12 + (long)__buf)" (( "(") (binary_expression "(long)iVar12 + (long)__buf" (cast_expression "(long)iVar12" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar12")) (+ "+") (cast_expression "(long)__buf" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "__buf"))) () ")"))) (, ",") (identifier "pcVar14") () ")"))) (; ";")) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" (identifier "lVar10") (= "=") (number_literal "-1")) (; ";")) (expression_statement "pcVar14 = *(char **)(*plVar11 + 8);" (assignment_expression "pcVar14 = *(char **)(*plVar11 + 8)" (identifier "pcVar14") (= "=") (pointer_expression "*(char **)(*plVar11 + 8)" (* "*") (cast_expression "(char **)(*plVar11 + 8)" (( "(") (type_descriptor "char **" (primitive_type "char") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(*plVar11 + 8)" (( "(") (binary_expression "*plVar11 + 8" (pointer_expression "*plVar11" (* "*") (identifier "plVar11")) (+ "+") (number_literal "8")) () ")"))))) (; ";")) (do_statement "do {\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            } while (cVar1 != '\0');" (do "do") (compound_statement "{\n              if (lVar10 == 0) break;\n              lVar10 = lVar10 + -1;\n              cVar1 = *pcVar14;\n              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n            }" ({ "{") (if_statement "if (lVar10 == 0) break;" (if "if") (parenthesized_expression "(lVar10 == 0)" (( "(") (binary_expression "lVar10 == 0" (identifier "lVar10") (== "==") (number_literal "0")) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" (identifier "lVar10") (= "=") (binary_expression "lVar10 + -1" (identifier "lVar10") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" (identifier "cVar1") (= "=") (pointer_expression "*pcVar14" (* "*") (identifier "pcVar14"))) (; ";")) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" (identifier "pcVar14") (= "=") (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" (identifier "pcVar14") (+ "+") (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" (( "(") (type_descriptor "ulong" (type_identifier "ulong")) () ")") (identifier "bVar16")) (* "*") (number_literal "-2"))) (+ "+") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(cVar1 != '\0')" (( "(") (binary_expression "cVar1 != '\0'" (identifier "cVar1") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (; ";")) (expression_statement "iVar6 = iVar12 + -1 + ~(uint)lVar10;" (assignment_expression "iVar6 = iVar12 + -1 + ~(uint)lVar10" (identifier "iVar6") (= "=") (binary_expression "iVar12 + -1 + ~(uint)lVar10" (binary_expression "iVar12 + -1" (identifier "iVar12") (+ "+") (number_literal "-1")) (+ "+") (unary_expression "~(uint)lVar10" (~ "~") (cast_expression "(uint)lVar10" (( "(") (type_descriptor "uint" (type_identifier "uint")) () ")") (identifier "lVar10"))))) (; ";")) (expression_statement "iVar12 = iVar6 + 1;" (assignment_expression "iVar12 = iVar6 + 1" (identifier "iVar12") (= "=") (binary_expression "iVar6 + 1" (identifier "iVar6") (+ "+") (number_literal "1"))) (; ";")) (expression_statement "*(undefined1 *)((long)__buf + (long)iVar6) = 10;" (assignment_expression "*(undefined1 *)((long)__buf + (long)iVar6) = 10" (pointer_expression "*(undefined1 *)((long)__buf + (long)iVar6)" (* "*") (cast_expression "(undefined1 *)((long)__buf + (long)iVar6)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((long)__buf + (long)iVar6)" (( "(") (binary_expression "(long)__buf + (long)iVar6" (cast_expression "(long)__buf" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "__buf")) (+ "+") (cast_expression "(long)iVar6" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar6"))) () ")")))) (= "=") (number_literal "10")) (; ";")) (} "}"))) (expression_statement "strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);" (call_expression "strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11)" (identifier "strcpy") (argument_list "((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11)" (( "(") (cast_expression "(char *)((long)iVar12 + (long)__buf)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((long)iVar12 + (long)__buf)" (( "(") (binary_expression "(long)iVar12 + (long)__buf" (cast_expression "(long)iVar12" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar12")) (+ "+") (cast_expression "(long)__buf" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "__buf"))) () ")"))) (, ",") (pointer_expression "*(char **)*plVar11" (* "*") (cast_expression "(char **)*plVar11" (( "(") (type_descriptor "char **" (primitive_type "char") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (pointer_expression "*plVar11" (* "*") (identifier "plVar11")))) () ")"))) (; ";")) (expression_statement "lVar10 = -1;" (assignment_expression "lVar10 = -1" (identifier "lVar10") (= "=") (number_literal "-1")) (; ";")) (expression_statement "pcVar14 = *(char **)*plVar11;" (assignment_expression "pcVar14 = *(char **)*plVar11" (identifier "pcVar14") (= "=") (pointer_expression "*(char **)*plVar11" (* "*") (cast_expression "(char **)*plVar11" (( "(") (type_descriptor "char **" (primitive_type "char") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (pointer_expression "*plVar11" (* "*") (identifier "plVar11"))))) (; ";")) (do_statement "do {\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          } while (cVar1 != '\0');" (do "do") (compound_statement "{\n            if (lVar10 == 0) break;\n            lVar10 = lVar10 + -1;\n            cVar1 = *pcVar14;\n            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;\n          }" ({ "{") (if_statement "if (lVar10 == 0) break;" (if "if") (parenthesized_expression "(lVar10 == 0)" (( "(") (binary_expression "lVar10 == 0" (identifier "lVar10") (== "==") (number_literal "0")) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "lVar10 = lVar10 + -1;" (assignment_expression "lVar10 = lVar10 + -1" (identifier "lVar10") (= "=") (binary_expression "lVar10 + -1" (identifier "lVar10") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "cVar1 = *pcVar14;" (assignment_expression "cVar1 = *pcVar14" (identifier "cVar1") (= "=") (pointer_expression "*pcVar14" (* "*") (identifier "pcVar14"))) (; ";")) (expression_statement "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;" (assignment_expression "pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1" (identifier "pcVar14") (= "=") (binary_expression "pcVar14 + (ulong)bVar16 * -2 + 1" (binary_expression "pcVar14 + (ulong)bVar16 * -2" (identifier "pcVar14") (+ "+") (binary_expression "(ulong)bVar16 * -2" (cast_expression "(ulong)bVar16" (( "(") (type_descriptor "ulong" (type_identifier "ulong")) () ")") (identifier "bVar16")) (* "*") (number_literal "-2"))) (+ "+") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(cVar1 != '\0')" (( "(") (binary_expression "cVar1 != '\0'" (identifier "cVar1") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (; ";")) (expression_statement "iVar6 = iVar12 + -1 + ~(uint)lVar10;" (assignment_expression "iVar6 = iVar12 + -1 + ~(uint)lVar10" (identifier "iVar6") (= "=") (binary_expression "iVar12 + -1 + ~(uint)lVar10" (binary_expression "iVar12 + -1" (identifier "iVar12") (+ "+") (number_literal "-1")) (+ "+") (unary_expression "~(uint)lVar10" (~ "~") (cast_expression "(uint)lVar10" (( "(") (type_descriptor "uint" (type_identifier "uint")) () ")") (identifier "lVar10"))))) (; ";")) (expression_statement "iVar12 = iVar6 + 1;" (assignment_expression "iVar12 = iVar6 + 1" (identifier "iVar12") (= "=") (binary_expression "iVar6 + 1" (identifier "iVar6") (+ "+") (number_literal "1"))) (; ";")) (expression_statement "*(undefined1 *)((long)__buf + (long)iVar6) = 10;" (assignment_expression "*(undefined1 *)((long)__buf + (long)iVar6) = 10" (pointer_expression "*(undefined1 *)((long)__buf + (long)iVar6)" (* "*") (cast_expression "(undefined1 *)((long)__buf + (long)iVar6)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((long)__buf + (long)iVar6)" (( "(") (binary_expression "(long)__buf + (long)iVar6" (cast_expression "(long)__buf" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "__buf")) (+ "+") (cast_expression "(long)iVar6" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar6"))) () ")")))) (= "=") (number_literal "10")) (; ";")) (expression_statement "plVar11 = plVar11 + 1;" (assignment_expression "plVar11 = plVar11 + 1" (identifier "plVar11") (= "=") (binary_expression "plVar11 + 1" (identifier "plVar11") (+ "+") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11)" (( "(") (binary_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11" (cast_expression "(long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8)" (( "(") (binary_expression "lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8" (identifier "lVar7") (+ "+") (binary_expression "((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8" (parenthesized_expression "((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3))" (( "(") (binary_expression "(long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)" (binary_expression "(long)iVar3 + 1" (cast_expression "(long)iVar3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar3")) (+ "+") (number_literal "1")) (+ "+") (call_expression "(ulong)(uint)(iVar5 - iVar3)" (call_expression "(ulong)(uint)" (parenthesized_expression "(ulong)" (( "(") (identifier "ulong") () ")")) (argument_list "(uint)" (( "(") (identifier "uint") () ")"))) (argument_list "(iVar5 - iVar3)" (( "(") (binary_expression "iVar5 - iVar3" (identifier "iVar5") (- "-") (identifier "iVar3")) () ")")))) () ")")) (* "*") (number_literal "8"))) () ")"))) (!= "!=") (identifier "plVar11")) () ")")) (; ";")) (} "}"))) (expression_statement "sVar8 = write(iVar4,__buf,(long)iVar13);" (assignment_expression "sVar8 = write(iVar4,__buf,(long)iVar13)" (identifier "sVar8") (= "=") (call_expression "write(iVar4,__buf,(long)iVar13)" (identifier "write") (argument_list "(iVar4,__buf,(long)iVar13)" (( "(") (identifier "iVar4") (, ",") (identifier "__buf") (, ",") (cast_expression "(long)iVar13" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar13")) () ")")))) (; ";")) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" (identifier "iVar3") (= "=") (number_literal "0")) (; ";")) (if_statement "if (sVar8 < 0) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" (if "if") (parenthesized_expression "(sVar8 < 0)" (( "(") (binary_expression "sVar8 < 0" (identifier "sVar8") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" ({ "{") (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" (identifier "piVar9") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" (identifier "iVar3") (= "=") (pointer_expression "*piVar9" (* "*") (identifier "piVar9"))) (; ";")) (} "}"))) (expression_statement "xfree(__buf);" (call_expression "xfree(__buf)" (identifier "xfree") (argument_list "(__buf)" (( "(") (identifier "__buf") () ")"))) (; ";")) (expression_statement "history_lines_written_to_file = param_2;" (assignment_expression "history_lines_written_to_file = param_2" (identifier "history_lines_written_to_file") (= "=") (identifier "param_2")) (; ";")) (expression_statement "iVar4 = close(iVar4);" (assignment_expression "iVar4 = close(iVar4)" (identifier "iVar4") (= "=") (call_expression "close(iVar4)" (identifier "close") (argument_list "(iVar4)" (( "(") (identifier "iVar4") () ")")))) (; ";")) (if_statement "if ((iVar4 < 0) && (iVar3 == 0)) {\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" (if "if") (parenthesized_expression "((iVar4 < 0) && (iVar3 == 0))" (( "(") (binary_expression "(iVar4 < 0) && (iVar3 == 0)" (parenthesized_expression "(iVar4 < 0)" (( "(") (binary_expression "iVar4 < 0" (identifier "iVar4") (< "<") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(iVar3 == 0)" (( "(") (binary_expression "iVar3 == 0" (identifier "iVar3") (== "==") (number_literal "0")) () ")"))) () ")")) (compound_statement "{\n        piVar9 = __errno_location();\n        iVar3 = *piVar9;\n      }" ({ "{") (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" (identifier "piVar9") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" (identifier "iVar3") (= "=") (pointer_expression "*piVar9" (* "*") (identifier "piVar9"))) (; ";")) (} "}"))) (if_statement "if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }\n      else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" (if "if") (parenthesized_expression "((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0))" (( "(") (binary_expression "(__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)" (parenthesized_expression "(__filename == (char *)0x0 || local_f8 == (char *)0x0)" (( "(") (binary_expression "__filename == (char *)0x0 || local_f8 == (char *)0x0" (binary_expression "__filename == (char *)0x0" (identifier "__filename") (== "==") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) (|| "||") (binary_expression "local_f8 == (char *)0x0" (identifier "local_f8") (== "==") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")))) () ")")) (|| "||") (parenthesized_expression "(iVar3 != 0)" (( "(") (binary_expression "iVar3 != 0" (identifier "iVar3") (!= "!=") (number_literal "0")) () ")"))) () ")")) (compound_statement "{\n        if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }\n        if (bVar15) goto LAB_001ce5d9;\nLAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;\n      }" ({ "{") (if_statement "if (iVar3 != 0) {\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }" (if "if") (parenthesized_expression "(iVar3 != 0)" (( "(") (binary_expression "iVar3 != 0" (identifier "iVar3") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n          if (local_f8 != (char *)0x0) goto LAB_001ce53d;\n          goto LAB_001ce547;\n        }" ({ "{") (if_statement "if (local_f8 != (char *)0x0) goto LAB_001ce53d;" (if "if") (parenthesized_expression "(local_f8 != (char *)0x0)" (( "(") (binary_expression "local_f8 != (char *)0x0" (identifier "local_f8") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (goto_statement "goto LAB_001ce53d;" (goto "goto") (statement_identifier "LAB_001ce53d") (; ";"))) (goto_statement "goto LAB_001ce547;" (goto "goto") (statement_identifier "LAB_001ce547") (; ";")) (} "}"))) (if_statement "if (bVar15) goto LAB_001ce5d9;" (if "if") (parenthesized_expression "(bVar15)" (( "(") (identifier "bVar15") () ")")) (goto_statement "goto LAB_001ce5d9;" (goto "goto") (statement_identifier "LAB_001ce5d9") (; ";"))) (labeled_statement "LAB_001ce551:\n        if (__filename != (char *)0x0) goto LAB_001ce556;" (statement_identifier "LAB_001ce551") (: ":") (if_statement "if (__filename != (char *)0x0) goto LAB_001ce556;" (if "if") (parenthesized_expression "(__filename != (char *)0x0)" (( "(") (binary_expression "__filename != (char *)0x0" (identifier "__filename") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (goto_statement "goto LAB_001ce556;" (goto "goto") (statement_identifier "LAB_001ce556") (; ";")))) (} "}")) (else_clause "else {\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" (else "else") (compound_statement "{\n        iVar3 = FUN_001ce1bf(local_f8,__filename);\n        if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }\n        if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }\nLAB_001ce556:\n        free(__filename);\n      }" ({ "{") (expression_statement "iVar3 = FUN_001ce1bf(local_f8,__filename);" (assignment_expression "iVar3 = FUN_001ce1bf(local_f8,__filename)" (identifier "iVar3") (= "=") (call_expression "FUN_001ce1bf(local_f8,__filename)" (identifier "FUN_001ce1bf") (argument_list "(local_f8,__filename)" (( "(") (identifier "local_f8") (, ",") (identifier "__filename") () ")")))) (; ";")) (if_statement "if (iVar3 != 0) {\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }" (if "if") (parenthesized_expression "(iVar3 != 0)" (( "(") (binary_expression "iVar3 != 0" (identifier "iVar3") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\nLAB_001ce53d:\n          unlink(local_f8);\nLAB_001ce547:\n          history_lines_written_to_file = 0;\n          goto LAB_001ce551;\n        }" ({ "{") (labeled_statement "LAB_001ce53d:\n          unlink(local_f8);" (statement_identifier "LAB_001ce53d") (: ":") (expression_statement "unlink(local_f8);" (call_expression "unlink(local_f8)" (identifier "unlink") (argument_list "(local_f8)" (( "(") (identifier "local_f8") () ")"))) (; ";"))) (labeled_statement "LAB_001ce547:\n          history_lines_written_to_file = 0;" (statement_identifier "LAB_001ce547") (: ":") (expression_statement "history_lines_written_to_file = 0;" (assignment_expression "history_lines_written_to_file = 0" (identifier "history_lines_written_to_file") (= "=") (number_literal "0")) (; ";"))) (goto_statement "goto LAB_001ce551;" (goto "goto") (statement_identifier "LAB_001ce551") (; ";")) (} "}"))) (if_statement "if (bVar15) {\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }" (if "if") (parenthesized_expression "(bVar15)" (( "(") (identifier "bVar15") () ")")) (compound_statement "{\nLAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);\n          iVar3 = 0;\n          goto LAB_001ce551;\n        }" ({ "{") (labeled_statement "LAB_001ce5d9:\n          chown(__filename,local_d8.st_uid,local_d8.st_gid);" (statement_identifier "LAB_001ce5d9") (: ":") (expression_statement "chown(__filename,local_d8.st_uid,local_d8.st_gid);" (call_expression "chown(__filename,local_d8.st_uid,local_d8.st_gid)" (identifier "chown") (argument_list "(__filename,local_d8.st_uid,local_d8.st_gid)" (( "(") (identifier "__filename") (, ",") (field_expression "local_d8.st_uid" (identifier "local_d8") (. ".") (field_identifier "st_uid")) (, ",") (field_expression "local_d8.st_gid" (identifier "local_d8") (. ".") (field_identifier "st_gid")) () ")"))) (; ";"))) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" (identifier "iVar3") (= "=") (number_literal "0")) (; ";")) (goto_statement "goto LAB_001ce551;" (goto "goto") (statement_identifier "LAB_001ce551") (; ";")) (} "}"))) (labeled_statement "LAB_001ce556:\n        free(__filename);" (statement_identifier "LAB_001ce556") (: ":") (expression_statement "free(__filename);" (call_expression "free(__filename)" (identifier "free") (argument_list "(__filename)" (( "(") (identifier "__filename") () ")"))) (; ";"))) (} "}")))) (if_statement "if (local_f8 != (char *)0x0) {\n        free(local_f8);\n      }" (if "if") (parenthesized_expression "(local_f8 != (char *)0x0)" (( "(") (binary_expression "local_f8 != (char *)0x0" (identifier "local_f8") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n        free(local_f8);\n      }" ({ "{") (expression_statement "free(local_f8);" (call_expression "free(local_f8)" (identifier "free") (argument_list "(local_f8)" (( "(") (identifier "local_f8") () ")"))) (; ";")) (} "}"))) (goto_statement "goto LAB_001ce570;" (goto "goto") (statement_identifier "LAB_001ce570") (; ";")) (} "}"))) (expression_statement "piVar9 = __errno_location();" (assignment_expression "piVar9 = __errno_location()" (identifier "piVar9") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar3 = *piVar9;" (assignment_expression "iVar3 = *piVar9" (identifier "iVar3") (= "=") (pointer_expression "*piVar9" (* "*") (identifier "piVar9"))) (; ";")) (expression_statement "free(__filename);" (call_expression "free(__filename)" (identifier "free") (argument_list "(__filename)" (( "(") (identifier "__filename") () ")"))) (; ";")) (} "}")))) (if_statement "if (local_f8 != (char *)0x0) {\n    free(local_f8);\n  }" (if "if") (parenthesized_expression "(local_f8 != (char *)0x0)" (( "(") (binary_expression "local_f8 != (char *)0x0" (identifier "local_f8") (!= "!=") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n    free(local_f8);\n  }" ({ "{") (expression_statement "free(local_f8);" (call_expression "free(local_f8)" (identifier "free") (argument_list "(local_f8)" (( "(") (identifier "local_f8") () ")"))) (; ";")) (} "}"))) (labeled_statement "LAB_001ce570:\n  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }" (statement_identifier "LAB_001ce570") (: ":") (if_statement "if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {\n                    \n    __stack_chk_fail();\n  }" (if "if") (parenthesized_expression "(local_40 != *(long *)(in_FS_OFFSET + 0x28))" (( "(") (binary_expression "local_40 != *(long *)(in_FS_OFFSET + 0x28)" (identifier "local_40") (!= "!=") (pointer_expression "*(long *)(in_FS_OFFSET + 0x28)" (* "*") (cast_expression "(long *)(in_FS_OFFSET + 0x28)" (( "(") (type_descriptor "long *" (sized_type_specifier "long" (long "long")) (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_FS_OFFSET + 0x28)" (( "(") (binary_expression "in_FS_OFFSET + 0x28" (identifier "in_FS_OFFSET") (+ "+") (number_literal "0x28")) () ")"))))) () ")")) (compound_statement "{\n                    \n    __stack_chk_fail();\n  }" ({ "{") (expression_statement "__stack_chk_fail();" (call_expression "__stack_chk_fail()" (identifier "__stack_chk_fail") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}")))) (return_statement "return iVar3;" (return "return") (identifier "iVar3") (; ";")) (} "}")))

int function_1(char *filename,int var_14,int var_7)

{
  char var_20;
  long var_37;
  bool bVar3;
  int var_6;
  int var_12;
  int var_31;
  int var_30;
  char *var_3;
  type_1 **var_16;
  void *var_24;
  ssize_t var_33;
  int *piVar10;
  long var_19;
  type_1 **var_22;
  int var_29;
  int var_21;
  char *var_18;
  long var_1;
  bool var_8;
  type_2 bVar17;
  char *var_10;
  type_3 finfo;
  
  bVar17 = 0;
  var_37 = *(long *)(var_1 + 0x28);
  var_3 = var_2(filename);
  if (var_3 == (char *)0x0) {
    piVar10 = var_4();
    var_6 = *piVar10;
    var_10 = (char *)0x0;
  }
  else {
    var_6 = var_5(1,var_3,(type_3 *)&finfo);
    var_8 = var_6 == 0;
    bVar3 = var_7 != 0 && var_8;
    if (var_7 != 0 && var_8) {
      var_8 = bVar3;
      if (((finfo.st_mode & 0xf000) != 0x8000) ||
         (var_10 = var_9(var_3), var_18 = var_10, var_10 == (char *)0x0)) {
        var_10 = (char *)0x0;
        var_18 = var_3;
      }
    }
    else {
      var_10 = (char *)0x0;
      var_18 = var_3;
    }
    var_12 = var_11(var_18,(-(type_5)(var_7 == 0) & 0x1c0) + 0x241,0x180);
    if (var_12 != -1) {
      if (var_13 <= var_14) {
        var_14 = var_13;
      }
      var_16 = var_15();
      var_6 = var_13 - var_14;
      if (var_6 < var_13) {
        var_22 = var_16 + var_6;
        var_21 = 0;
        do {
          if (((var_17 != 0) &&
              (var_18 = (*var_22)->timestamp, var_18 != (char *)0x0)) && (*var_18 != '\0')) {
            var_19 = -1;
            do {
              if (var_19 == 0) break;
              var_19 = var_19 + -1;
              var_20 = *var_18;
              var_18 = var_18 + (type_4)bVar17 * -2 + 1;
            } while (var_20 != '\0');
            var_21 = var_21 + ~(type_5)var_19;
          }
          var_19 = -1;
          var_18 = (*var_22)->line;
          do {
            if (var_19 == 0) break;
            var_19 = var_19 + -1;
            var_20 = *var_18;
            var_18 = var_18 + (type_4)bVar17 * -2 + 1;
          } while (var_20 != '\0');
          var_21 = var_21 + ~(type_5)var_19;
          var_22 = var_22 + 1;
        } while (var_22 !=
                 var_16 + (long)var_6 + 1 + (type_4)(type_5)((var_13 + -1) - var_6));
      }
      else {
        var_21 = 0;
      }
      var_24 = var_23((long)var_21);
      if (var_24 == (void *)0x0) {
        piVar10 = var_4();
        var_6 = *piVar10;
        var_25(var_12);
        if (var_10 == (char *)0x0) {
          if (var_3 != (char *)0x0) {
            var_26(var_3);
          }
        }
        else {
          var_27(var_10);
          if (var_3 != (char *)0x0) {
            var_26(var_3);
          }
          var_26(var_10);
        }
        goto LAB_001ce570;
      }
      var_6 = var_13 - var_14;
      if (var_6 < var_13) {
        var_22 = var_16 + var_6;
        var_31 = var_13 + -1;
        var_29 = 0;
        do {
          if (((var_17 != 0) &&
              (var_18 = (*var_22)->timestamp, var_18 != (char *)0x0)) && (*var_18 != '\0')) {
            var_28((char *)((long)var_29 + (long)var_24),var_18);
            var_19 = -1;
            var_18 = (*var_22)->timestamp;
            do {
              if (var_19 == 0) break;
              var_19 = var_19 + -1;
              var_20 = *var_18;
              var_18 = var_18 + (type_4)bVar17 * -2 + 1;
            } while (var_20 != '\0');
            var_30 = var_29 + -1 + ~(type_5)var_19;
            var_29 = var_30 + 1;
            *(type_6 *)((long)var_24 + (long)var_30) = 10;
          }
          var_28((char *)((long)var_29 + (long)var_24),(*var_22)->line);
          var_19 = -1;
          var_18 = (*var_22)->line;
          do {
            if (var_19 == 0) break;
            var_19 = var_19 + -1;
            var_20 = *var_18;
            var_18 = var_18 + (type_4)bVar17 * -2 + 1;
          } while (var_20 != '\0');
          var_30 = var_29 + -1 + ~(type_5)var_19;
          var_29 = var_30 + 1;
          *(type_6 *)((long)var_24 + (long)var_30) = 10;
          var_22 = var_22 + 1;
        } while (var_16 + (long)var_6 + 1 + (type_4)(type_5)(var_31 - var_6) != var_22);
      }
      var_33 = var_32(var_12,var_24,(long)var_21);
      var_6 = 0;
      if (var_33 < 0) {
        piVar10 = var_4();
        var_6 = *piVar10;
      }
      var_34(var_24);
      history_lines_written_to_file = var_14;
      var_12 = var_25(var_12);
      if ((var_12 < 0) && (var_6 == 0)) {
        piVar10 = var_4();
        var_6 = *piVar10;
      }
      if ((var_3 == (char *)0x0 || var_10 == (char *)0x0) || (var_6 != 0)) {
        if (var_6 != 0) {
          if (var_10 != (char *)0x0) goto LAB_001ce53d;
          goto LAB_001ce547;
        }
        if (var_8) goto LAB_001ce5d9;
LAB_001ce551:
        if (var_3 != (char *)0x0) goto LAB_001ce556;
      }
      else {
        var_6 = var_35(var_10,var_3);
        if (var_6 != 0) {
LAB_001ce53d:
          var_27(var_10);
LAB_001ce547:
          history_lines_written_to_file = 0;
          goto LAB_001ce551;
        }
        if (var_8) {
LAB_001ce5d9:
          var_36(var_3,finfo.st_uid,finfo.st_gid);
          var_6 = 0;
          goto LAB_001ce551;
        }
LAB_001ce556:
        var_26(var_3);
      }
      if (var_10 != (char *)0x0) {
        var_26(var_10);
      }
      goto LAB_001ce570;
    }
    piVar10 = var_4();
    var_6 = *piVar10;
    var_26(var_3);
  }
  if (var_10 != (char *)0x0) {
    var_26(var_10);
  }
LAB_001ce570:
  if (var_37 != *(long *)(var_1 + 0x28)) {
                    /* WARNING: Subroutine does not return */
    var_38();
  }
  return var_6;
}


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

int MASKED(undefined8 param_1,int param_2,int param_3)

{
  char cVar1;
  bool bVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  char *__filename;
  long lVar7;
  void *__buf;
  ssize_t sVar8;
  int *piVar9;
  long lVar10;
  long *plVar11;
  int iVar12;
  int iVar13;
  char *pcVar14;
  long in_FS_OFFSET;
  bool bVar15;
  byte bVar16;
  char *local_f8;
  stat local_d8;
  long local_40;
  
  bVar16 = 0;
  local_40 = *(long *)(in_FS_OFFSET + 0x28);
  __filename = (char *)FUN_001cdf95();
  if (__filename == (char *)0x0) {
    piVar9 = __errno_location();
    iVar3 = *piVar9;
    local_f8 = (char *)0x0;
  }
  else {
    iVar3 = __xstat(1,__filename,&local_d8);
    bVar15 = iVar3 == 0;
    bVar2 = param_3 != 0 && bVar15;
    if (param_3 != 0 && bVar15) {
      bVar15 = bVar2;
      if (((local_d8.st_mode & 0xf000) != 0x8000) ||
         (local_f8 = (char *)FUN_001ce03d(__filename), pcVar14 = local_f8, local_f8 == (char *)0x0))
      {
        local_f8 = (char *)0x0;
        pcVar14 = __filename;
      }
    }
    else {
      local_f8 = (char *)0x0;
      pcVar14 = __filename;
    }
    iVar4 = open(pcVar14,(-(uint)(param_3 == 0) & 0x1c0) + 0x241,0x180);
    if (iVar4 != -1) {
      if (history_length <= param_2) {
        param_2 = history_length;
      }
      lVar7 = history_list();
      iVar3 = history_length - param_2;
      if (iVar3 < history_length) {
        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);
        iVar13 = 0;
        do {
          if (((history_write_timestamps != 0) &&
              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {
            lVar10 = -1;
            do {
              if (lVar10 == 0) break;
              lVar10 = lVar10 + -1;
              cVar1 = *pcVar14;
              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;
            } while (cVar1 != '\0');
            iVar13 = iVar13 + ~(uint)lVar10;
          }
          lVar10 = -1;
          pcVar14 = *(char **)*plVar11;
          do {
            if (lVar10 == 0) break;
            lVar10 = lVar10 + -1;
            cVar1 = *pcVar14;
            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;
          } while (cVar1 != '\0');
          iVar13 = iVar13 + ~(uint)lVar10;
          plVar11 = plVar11 + 1;
        } while (plVar11 !=
                 (long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)((history_length + -1) - iVar3)) *
                                  8));
      }
      else {
        iVar13 = 0;
      }
      __buf = malloc((long)iVar13);
      if (__buf == (void *)0x0) {
        piVar9 = __errno_location();
        iVar3 = *piVar9;
        close(iVar4);
        if (local_f8 == (char *)0x0) {
          if (__filename != (char *)0x0) {
            free(__filename);
          }
        }
        else {
          unlink(local_f8);
          if (__filename != (char *)0x0) {
            free(__filename);
          }
          free(local_f8);
        }
        goto LAB_001ce570;
      }
      iVar3 = history_length - param_2;
      if (iVar3 < history_length) {
        plVar11 = (long *)(lVar7 + (long)iVar3 * 8);
        iVar5 = history_length + -1;
        iVar12 = 0;
        do {
          if (((history_write_timestamps != 0) &&
              (pcVar14 = *(char **)(*plVar11 + 8), pcVar14 != (char *)0x0)) && (*pcVar14 != '\0')) {
            strcpy((char *)((long)iVar12 + (long)__buf),pcVar14);
            lVar10 = -1;
            pcVar14 = *(char **)(*plVar11 + 8);
            do {
              if (lVar10 == 0) break;
              lVar10 = lVar10 + -1;
              cVar1 = *pcVar14;
              pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;
            } while (cVar1 != '\0');
            iVar6 = iVar12 + -1 + ~(uint)lVar10;
            iVar12 = iVar6 + 1;
            *(undefined1 *)((long)__buf + (long)iVar6) = 10;
          }
          strcpy((char *)((long)iVar12 + (long)__buf),*(char **)*plVar11);
          lVar10 = -1;
          pcVar14 = *(char **)*plVar11;
          do {
            if (lVar10 == 0) break;
            lVar10 = lVar10 + -1;
            cVar1 = *pcVar14;
            pcVar14 = pcVar14 + (ulong)bVar16 * -2 + 1;
          } while (cVar1 != '\0');
          iVar6 = iVar12 + -1 + ~(uint)lVar10;
          iVar12 = iVar6 + 1;
          *(undefined1 *)((long)__buf + (long)iVar6) = 10;
          plVar11 = plVar11 + 1;
        } while ((long *)(lVar7 + ((long)iVar3 + 1 + (ulong)(uint)(iVar5 - iVar3)) * 8) != plVar11);
      }
      sVar8 = write(iVar4,__buf,(long)iVar13);
      iVar3 = 0;
      if (sVar8 < 0) {
        piVar9 = __errno_location();
        iVar3 = *piVar9;
      }
      xfree(__buf);
      history_lines_written_to_file = param_2;
      iVar4 = close(iVar4);
      if ((iVar4 < 0) && (iVar3 == 0)) {
        piVar9 = __errno_location();
        iVar3 = *piVar9;
      }
      if ((__filename == (char *)0x0 || local_f8 == (char *)0x0) || (iVar3 != 0)) {
        if (iVar3 != 0) {
          if (local_f8 != (char *)0x0) goto LAB_001ce53d;
          goto LAB_001ce547;
        }
        if (bVar15) goto LAB_001ce5d9;
LAB_001ce551:
        if (__filename != (char *)0x0) goto LAB_001ce556;
      }
      else {
        iVar3 = FUN_001ce1bf(local_f8,__filename);
        if (iVar3 != 0) {
LAB_001ce53d:
          unlink(local_f8);
LAB_001ce547:
          history_lines_written_to_file = 0;
          goto LAB_001ce551;
        }
        if (bVar15) {
LAB_001ce5d9:
          chown(__filename,local_d8.st_uid,local_d8.st_gid);
          iVar3 = 0;
          goto LAB_001ce551;
        }
LAB_001ce556:
        free(__filename);
      }
      if (local_f8 != (char *)0x0) {
        free(local_f8);
      }
      goto LAB_001ce570;
    }
    piVar9 = __errno_location();
    iVar3 = *piVar9;
    free(__filename);
  }
  if (local_f8 != (char *)0x0) {
    free(local_f8);
  }
LAB_001ce570:
  if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return iVar3;
}

