LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreePageLookup
static MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){
  DbPage *pDbPage;
  assert( sqlite3_mutex_held(pBt->mutex) );
  pDbPage = sqlite3PagerLookup(pBt->pPager, pgno);
  if( pDbPage ){
    return btreePageFromDbPage(pDbPage, pgno, pBt);
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movq %rdi, %r15
movq (%rdi), %rax
leaq -0x28(%rbp), %r12
movq $0x0, (%r12)
movq 0x110(%rax), %rdi
xorl %ebx, %ebx
xorl %edx, %edx
movq %r12, %rcx
callq 0x1f6fc
movq (%r12), %rax
testq %rax, %rax
je 0x32637
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rdx
movq %rcx, 0x50(%rdx)
movq %rax, 0x68(%rdx)
movq %r15, 0x48(%rdx)
movl %r14d, 0x70(%rdx)
cmpl $0x1, %r14d
movl $0x64, %eax
cmovel %eax, %ebx
movb %bl, 0x5(%rdx)
movq %rdx, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreeSetHasContent
static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
  int rc = SQLITE_OK;
  if( !pBt->pHasContent ){
    assert( pgno<=pBt->nPage );
    pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage);
    if( !pBt->pHasContent ){
      rc = SQLITE_NOMEM;
    }
  }
  if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
    rc = sqlite3BitvecSet(pBt->pHasContent, pgno);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
cmpq $0x0, 0x58(%rdi)
je 0x328ef
xorl %r15d, %r15d
movb $0x1, %r13b
jmp 0x32932
movl 0x3c(%r14), %r15d
movl $0x200, %edi            # imm = 0x200
callq 0xa2a2
movq %rax, %r12
testq %rax, %rax
setne %r13b
je 0x32928
movl %r15d, -0x2c(%rbp)
xorl %r15d, %r15d
movl $0x200, %edx            # imm = 0x200
movq %r12, %rdi
xorl %esi, %esi
callq 0x8200
movl -0x2c(%rbp), %eax
movl %eax, (%r12)
jmp 0x3292e
movl $0x7, %r15d
movq %r12, 0x58(%r14)
testb %r13b, %r13b
je 0x32942
movq 0x58(%r14), %rdi
xorl %r15d, %r15d
cmpl %ebx, (%rdi)
jae 0x32954
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1b642
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: copyNodeContent
static void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){
  if( (*pRC)==SQLITE_OK ){
    BtShared * const pBt = pFrom->pBt;
    u8 * const aFrom = pFrom->aData;
    u8 * const aTo = pTo->aData;
    int const iFromHdr = pFrom->hdrOffset;
    int const iToHdr = ((pTo->pgno==1) ? 100 : 0);
    int rc;
    int iData;
  
  
    assert( pFrom->isInit );
    assert( pFrom->nFree>=iToHdr );
    assert( get2byte(&aFrom[iFromHdr+5]) <= (int)pBt->usableSize );
  
    /* Copy the b-tree node content from page pFrom to page pTo. */
    iData = get2byte(&aFrom[iFromHdr+5]);
    memcpy(&aTo[iData], &aFrom[iData], pBt->usableSize-iData);
    memcpy(&aTo[iToHdr], &aFrom[iFromHdr], pFrom->cellOffset + 2*pFrom->nCell);
  
    /* Reinitialize page pTo so that the contents of the MemPage structure
    ** match the new data. The initialization of pTo can actually fail under
    ** fairly obscure circumstances, even though it is a copy of initialized 
    ** page pFrom.
    */
    pTo->isInit = 0;
    rc = btreeInitPage(pTo);
    if( rc!=SQLITE_OK ){
      *pRC = rc;
      return;
    }
  
    /* If this is an auto-vacuum database, update the pointer-map entries
    ** for any b-tree or overflow pages that pTo now contains the pointers to.
    */
    if( ISAUTOVACUUM ){
      *pRC = setChildPtrmaps(pTo);
    }
  }
}

// Assembly:
cmpl $0x0, (%rdx)
je 0x32b3c
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rcx
movq 0x50(%rdi), %rsi
movq 0x50(%r14), %r13
movzbl 0x5(%rdi), %eax
movl 0x70(%r14), %r12d
leaq (%rsi,%rax), %rdx
movq %rdx, -0x38(%rbp)
movzwl 0x5(%rsi,%rax), %eax
rolw $0x8, %ax
movzwl %ax, %eax
leaq (%rax,%r13), %rdi
addq %rax, %rsi
movq %rcx, -0x30(%rbp)
movl 0x34(%rcx), %edx
subl %eax, %edx
callq 0x82f0
leaq 0x64(%r13), %rdi
cmpl $0x1, %r12d
cmovneq %r13, %rdi
movzwl 0xc(%r15), %eax
movzwl 0x10(%r15), %ecx
leaq (%rax,%rcx,2), %rdx
movq -0x38(%rbp), %rsi
callq 0x82f0
movb $0x0, (%r14)
movq %r14, %rdi
callq 0x1cb41
testl %eax, %eax
jne 0x32bd8
movq -0x30(%rbp), %rax
cmpb $0x0, 0x21(%rax)
je 0x32bda
movq %r14, %rdi
callq 0x22a27
movl %eax, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: assemblePage
static void assemblePage(
  MemPage *pPage,   /* The page to be assemblied */
  int nCell,        /* The number of cells to add to this page */
  u8 **apCell,      /* Pointers to cell bodies */
  u16 *aSize        /* Sizes of the cells */
){
  int i;            /* Loop counter */
  u8 *pCellptr;     /* Address of next cell pointer */
  int cellbody;     /* Address of next cell body */
  u8 * const data = pPage->aData;             /* Pointer to data for pPage */
  const int hdr = pPage->hdrOffset;           /* Offset of header on pPage */
  const int nUsable = pPage->pBt->usableSize; /* Usable size of page */

  assert( pPage->nOverflow==0 );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( nCell>=0 && nCell<=(int)MX_CELL(pPage->pBt)
            && (int)MX_CELL(pPage->pBt)<=10921);
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );

  /* Check that the page has just been zeroed by zeroPage() */
  assert( pPage->nCell==0 );
  assert( get2byteNotZero(&data[hdr+5])==nUsable );

  pCellptr = &pPage->aCellIdx[nCell*2];
  cellbody = nUsable;
  for(i=nCell-1; i>=0; i--){
    u16 sz = aSize[i];
    pCellptr -= 2;
    cellbody -= sz;
    put2byte(pCellptr, cellbody);
    memcpy(&data[cellbody], apCell[i], sz);
  }
  put2byte(&data[hdr+3], nCell);
  put2byte(&data[hdr+5], cellbody);
  pPage->nFree -= (nCell*2 + nUsable - cellbody);
  pPage->nCell = (u16)nCell;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movl %esi, %r8d
movq 0x48(%rdi), %rax
movq 0x50(%rdi), %rsi
movq %rdi, -0x38(%rbp)
movzbl 0x5(%rdi), %edx
movq %rdx, -0x50(%rbp)
movl 0x34(%rax), %eax
leal (%r8,%r8), %edx
movl %edx, -0x2c(%rbp)
movl %eax, -0x30(%rbp)
movl %eax, %ebx
movq %r8, -0x40(%rbp)
testl %r8d, %r8d
jle 0x32c8d
movq %rcx, %r15
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rax
movq %rsi, -0x48(%rbp)
movl -0x2c(%rbp), %edx
movl -0x40(%rbp), %r12d
incq %r12
leaq (%rdx,%rax), %r13
decq %r13
movq -0x48(%rbp), %rsi
movl -0x30(%rbp), %eax
movl %eax, %ebx
movzwl -0x4(%r15,%r12,2), %edx
movslq %ebx, %rbx
subq %rdx, %rbx
movl %ebx, %eax
rolw $0x8, %ax
movw %ax, -0x1(%r13)
movq %rbx, %rdi
addq %rsi, %rdi
movq -0x10(%r14,%r12,8), %rsi
callq 0x82f0
movq -0x48(%rbp), %rsi
decq %r12
addq $-0x2, %r13
cmpq $0x1, %r12
jg 0x32c55
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rdx
movb %ah, 0x3(%rsi,%rdx)
movb %al, 0x4(%rsi,%rdx)
movb %bh, 0x5(%rsi,%rdx)
movb %bl, 0x6(%rsi,%rdx)
movl -0x30(%rbp), %ecx
addl -0x2c(%rbp), %ecx
subl %ecx, %ebx
movq -0x38(%rbp), %rcx
addw %bx, 0xe(%rcx)
movw %ax, 0x10(%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeSorterCompare
static void vdbeSorterCompare(
  const VdbeCursor *pCsr,         /* Cursor object (for pKeyInfo) */
  int bOmitRowid,                 /* Ignore rowid field at end of keys */
  const void *pKey1, int nKey1,   /* Left side of comparison */
  const void *pKey2, int nKey2,   /* Right side of comparison */
  int *pRes                       /* OUT: Result of comparison */
){
  KeyInfo *pKeyInfo = pCsr->pKeyInfo;
  VdbeSorter *pSorter = pCsr->pSorter;
  UnpackedRecord *r2 = pSorter->pUnpacked;
  int i;

  if( pKey2 ){
    sqlite3VdbeRecordUnpack(pKeyInfo, nKey2, pKey2, r2);
  }

  if( bOmitRowid ){
    r2->nField = pKeyInfo->nField;
    assert( r2->nField>0 );
    for(i=0; i<r2->nField; i++){
      if( r2->aMem[i].flags & MEM_Null ){
        *pRes = -1;
        return;
      }
    }
    r2->flags |= UNPACKED_PREFIX_MATCH;
  }

  *pRes = sqlite3VdbeRecordCompare(nKey1, pKey1, r2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movq %rdx, %rbx
movl %esi, %r13d
movq 0x10(%rdi), %r12
movq 0x58(%rdi), %rax
movq 0x48(%rax), %r15
testq %r8, %r8
je 0x32d01
movq %r12, %rdi
movl %r9d, %esi
movq %r8, %rdx
movq %r15, %rcx
callq 0x2d56a
movq 0x10(%rbp), %rsi
testl %r13d, %r13d
je 0x32d39
movzwl 0xa(%r12), %ecx
movw %cx, 0x8(%r15)
testq %rcx, %rcx
je 0x32d34
movq 0x18(%r15), %rax
imulq $0x38, %rcx, %rcx
xorl %edx, %edx
testb $0x1, 0x24(%rax,%rdx)
jne 0x32d5e
addq $0x38, %rdx
cmpq %rdx, %rcx
jne 0x32d24
orb $0x2, 0xa(%r15)
movl %r14d, %edi
movq %rsi, %r14
movq %rbx, %rsi
movq %r15, %rdx
callq 0x30545
movq %r14, %rsi
movl %eax, (%rsi)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x32d4d
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeSorterSort
static int vdbeSorterSort(const VdbeCursor *pCsr){
  int i;
  SorterRecord **aSlot;
  SorterRecord *p;
  VdbeSorter *pSorter = pCsr->pSorter;

  aSlot = (SorterRecord **)sqlite3MallocZero(64 * sizeof(SorterRecord *));
  if( !aSlot ){
    return SQLITE_NOMEM;
  }

  p = pSorter->pRecord;
  while( p ){
    SorterRecord *pNext = p->pNext;
    p->pNext = 0;
    for(i=0; aSlot[i]; i++){
      vdbeSorterMerge(pCsr, p, aSlot[i], &p);
      aSlot[i] = 0;
    }
    aSlot[i] = p;
    p = pNext;
  }

  p = 0;
  for(i=0; i<64; i++){
    vdbeSorterMerge(pCsr, p, aSlot[i], &p);
  }
  pSorter->pRecord = p;

  sqlite3_free(aSlot);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %r14
movl $0x200, %edi            # imm = 0x200
callq 0xa2a2
testq %rax, %rax
je 0x32e4a
movq %rax, %r12
movl $0x200, %edx            # imm = 0x200
movq %rax, %rdi
xorl %esi, %esi
callq 0x8200
movq %r14, -0x38(%rbp)
movq 0x40(%r14), %r13
movq %r13, -0x30(%rbp)
testq %r13, %r13
je 0x32e08
leaq -0x30(%rbp), %r15
movq %r13, %rax
movq 0x10(%r13), %r13
movq $0x0, 0x10(%rax)
movq (%r12), %rdx
movq %r12, %r14
testq %rdx, %rdx
je 0x32df8
movq %r12, %r14
movq -0x30(%rbp), %rsi
movq %rbx, %rdi
movq %r15, %rcx
callq 0x330e7
movq $0x0, (%r14)
movq 0x8(%r14), %rdx
addq $0x8, %r14
testq %rdx, %rdx
jne 0x32dd5
movq -0x30(%rbp), %rax
movq %rax, (%r14)
movq %r13, -0x30(%rbp)
testq %r13, %r13
jne 0x32db7
leaq -0x30(%rbp), %r15
movq $0x0, (%r15)
xorl %r14d, %r14d
movq -0x30(%rbp), %rsi
movq (%r12,%r14,8), %rdx
movq %rbx, %rdi
movq %r15, %rcx
callq 0x330e7
incq %r14
cmpq $0x40, %r14
jne 0x32e16
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rax, 0x40(%rcx)
movq %r12, %rdi
callq 0xa2e8
xorl %eax, %eax
jmp 0x32e4f
movl $0x7, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeSorterListToPMA
static int vdbeSorterListToPMA(sqlite3 *db, const VdbeCursor *pCsr){
  int rc = SQLITE_OK;             /* Return code */
  VdbeSorter *pSorter = pCsr->pSorter;
  FileWriter writer;

  memset(&writer, 0, sizeof(FileWriter));

  if( pSorter->nInMemory==0 ){
    assert( pSorter->pRecord==0 );
    return rc;
  }

  rc = vdbeSorterSort(pCsr);

  /* If the first temporary PMA file has not been opened, open it now. */
  if( rc==SQLITE_OK && pSorter->pTemp1==0 ){
    rc = vdbeSorterOpenTempFile(db, &pSorter->pTemp1);
    assert( rc!=SQLITE_OK || pSorter->pTemp1 );
    assert( pSorter->iWriteOff==0 );
    assert( pSorter->nPMA==0 );
  }

  if( rc==SQLITE_OK ){
    SorterRecord *p;
    SorterRecord *pNext = 0;

    fileWriterInit(db, pSorter->pTemp1, &writer, pSorter->iWriteOff);
    pSorter->nPMA++;
    fileWriterWriteVarint(&writer, pSorter->nInMemory);
    for(p=pSorter->pRecord; p; p=pNext){
      pNext = p->pNext;
      fileWriterWriteVarint(&writer, p->nVal);
      fileWriterWrite(&writer, p->pVal, p->nVal);
      sqlite3DbFree(db, p);
    }
    pSorter->pRecord = p;
    rc = fileWriterFinish(db, &writer, &pSorter->iWriteOff);
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq 0x58(%rsi), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
cmpl $0x0, 0x10(%rbx)
je 0x32f1f
movq %rdi, %r14
movq %rsi, %rdi
callq 0x32d65
testl %eax, %eax
jne 0x32ebb
xorl %eax, %eax
cmpq $0x0, 0x38(%rbx)
jne 0x32ebb
leaq 0x38(%rbx), %rdx
movq (%r14), %rdi
leaq -0x6c(%rbp), %r8
xorl %esi, %esi
movl $0x101e, %ecx           # imm = 0x101E
callq 0x246b6
testl %eax, %eax
jne 0x32fba
movq (%rbx), %r15
movq 0x38(%rbx), %r13
movq 0x20(%r14), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movl 0x30(%rax), %r12d
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movq %r14, %rdi
movl %r12d, %esi
callq 0x115e9
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x32f26
movslq %r12d, %rcx
movq %r15, %rax
cqto
idivq %rcx
movl %edx, -0x4c(%rbp)
movl %edx, -0x48(%rbp)
subq %rdx, %r15
movq %r15, -0x40(%rbp)
movl %r12d, -0x50(%rbp)
movq %r13, -0x38(%rbp)
jmp 0x32f2d
xorl %eax, %eax
jmp 0x32fba
movl $0x7, -0x60(%rbp)
incl 0x18(%rbx)
movslq 0x10(%rbx), %rsi
leaq -0x6c(%rbp), %r15
movq %r15, %rdi
callq 0x2fffb
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x32fc9
movq %rbx, -0x78(%rbp)
movq 0x40(%rbx), %r15
testq %r15, %r15
je 0x32fa2
leaq -0x6c(%rbp), %r12
leaq -0x60(%rbp), %r13
movq 0x10(%r15), %rbx
movslq 0x8(%r15), %rsi
movq %r12, %rdi
callq 0x2fffb
movq %r13, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x32fc9
movq (%r15), %rsi
movl 0x8(%r15), %edx
movq %r13, %rdi
callq 0x32fc9
movq %r14, %rdi
movq %r15, %rsi
callq 0x9c3a
movq %rbx, %r15
testq %rbx, %rbx
jne 0x32f63
movq -0x78(%rbp), %rdx
movq $0x0, 0x40(%rdx)
leaq -0x60(%rbp), %rsi
movq %r14, %rdi
callq 0x33072
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: fileWriterWrite
static void fileWriterWrite(FileWriter *p, u8 *pData, int nData){
  int nRem = nData;
  while( nRem>0 && p->eFWErr==0 ){
    int nCopy = nRem;
    if( nCopy>(p->nBuffer - p->iBufEnd) ){
      nCopy = p->nBuffer - p->iBufEnd;
    }

    memcpy(&p->aBuffer[p->iBufEnd], &pData[nData-nRem], nCopy);
    p->iBufEnd += nCopy;
    if( p->iBufEnd==p->nBuffer ){
      p->eFWErr = sqlite3OsWrite(p->pFile, 
          &p->aBuffer[p->iBufStart], p->iBufEnd - p->iBufStart, 
          p->iWriteOff + p->iBufStart
      );
      p->iBufStart = p->iBufEnd = 0;
      p->iWriteOff += p->nBuffer;
    }
    assert( p->iBufEnd<p->nBuffer );

    nRem -= nCopy;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, -0x30(%rbp)
testl %edx, %edx
jle 0x33063
movl %edx, %ebx
movq %rdi, %r15
movl %edx, %r13d
cmpl $0x0, (%r15)
jne 0x33063
movl 0x10(%r15), %r14d
movslq 0x18(%r15), %rdi
subl %edi, %r14d
cmpl %r14d, %r13d
cmovll %r13d, %r14d
addq 0x8(%r15), %rdi
movl %ebx, %eax
subl %r13d, %eax
movslq %eax, %rsi
addq -0x30(%rbp), %rsi
movslq %r14d, %r12
movq %r12, %rdx
callq 0x82f0
addl 0x18(%r15), %r12d
movl %r12d, 0x18(%r15)
cmpl 0x10(%r15), %r12d
jne 0x3305e
movq 0x28(%r15), %rdi
movslq 0x14(%r15), %rcx
movq 0x8(%r15), %rsi
addq %rcx, %rsi
subl %ecx, %r12d
addq 0x20(%r15), %rcx
movq (%rdi), %rax
movl %r12d, %edx
callq *0x18(%rax)
movl %eax, (%r15)
movq $0x0, 0x14(%r15)
movslq 0x10(%r15), %rax
addq %rax, 0x20(%r15)
subl %r14d, %r13d
jg 0x32feb
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: fileWriterFinish
static int fileWriterFinish(sqlite3 *db, FileWriter *p, i64 *piEof){
  int rc;
  if( p->eFWErr==0 && ALWAYS(p->aBuffer) && p->iBufEnd>p->iBufStart ){
    p->eFWErr = sqlite3OsWrite(p->pFile, 
        &p->aBuffer[p->iBufStart], p->iBufEnd - p->iBufStart, 
        p->iWriteOff + p->iBufStart
    );
  }
  *piEof = (p->iWriteOff + p->iBufEnd);
  sqlite3DbFree(db, p->aBuffer);
  rc = p->eFWErr;
  memset(p, 0, sizeof(FileWriter));
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, (%rsi)
je 0x330bc
movslq 0x18(%rbx), %rax
addq 0x20(%rbx), %rax
movq %rax, (%r15)
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
movl (%rbx), %eax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x3308a
movl 0x18(%rbx), %edx
movslq 0x14(%rbx), %rcx
cmpl %ecx, %edx
jle 0x3308a
movq 0x28(%rbx), %rdi
addq %rcx, %rsi
subl %ecx, %edx
addq 0x20(%rbx), %rcx
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, (%rbx)
jmp 0x3308a
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeSorterMerge
static void vdbeSorterMerge(
  const VdbeCursor *pCsr,         /* For pKeyInfo */
  SorterRecord *p1,               /* First list to merge */
  SorterRecord *p2,               /* Second list to merge */
  SorterRecord **ppOut            /* OUT: Head of merged list */
){
  SorterRecord *pFinal = 0;
  SorterRecord **pp = &pFinal;
  void *pVal2 = p2 ? p2->pVal : 0;

  while( p1 && p2 ){
    int res;
    vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res);
    if( res<=0 ){
      *pp = p1;
      pp = &p1->pNext;
      p1 = p1->pNext;
      pVal2 = 0;
    }else{
      *pp = p2;
       pp = &p2->pNext;
      p2 = p2->pNext;
      if( p2==0 ) break;
      pVal2 = p2->pVal;
    }
  }
  *pp = p1 ? p1 : p2;
  *ppOut = pFinal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, -0x40(%rbp)
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
movq $0x0, -0x38(%rbp)
testq %rdx, %rdx
je 0x33118
movq (%r12), %r13
jmp 0x3311b
xorl %r13d, %r13d
leaq -0x38(%rbp), %rbx
testq %r14, %r14
je 0x33193
testq %r12, %r12
je 0x33193
movq (%r14), %rdx
movl 0x8(%r14), %ecx
movl 0x8(%r12), %r9d
leaq -0x2c(%rbp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
xorl %esi, %esi
movq %r13, %r8
callq 0x32cc8
cmpl $0x0, -0x2c(%rbp)
jle 0x33168
movq %r12, (%rbx)
movq 0x10(%r12), %rax
addq $0x10, %r12
testq %rax, %rax
je 0x33183
movq (%rax), %r13
movb $0x1, %cl
jmp 0x33187
movq %r14, (%rbx)
movq 0x10(%r14), %rdx
movq %r12, %rax
movq %r14, %r12
addq $0x10, %r12
movb $0x1, %cl
movq %rdx, %r14
xorl %r13d, %r13d
jmp 0x33187
xorl %eax, %eax
xorl %ecx, %ecx
movq %r12, %rbx
movq %rax, %r12
testb %cl, %cl
jne 0x3311f
jmp 0x33196
movq %r12, %rax
testq %r14, %r14
cmovneq %r14, %rax
movq %rax, (%rbx)
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rax, (%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeSorterDoCompare
static int vdbeSorterDoCompare(const VdbeCursor *pCsr, int iOut){
  VdbeSorter *pSorter = pCsr->pSorter;
  int i1;
  int i2;
  int iRes;
  VdbeSorterIter *p1;
  VdbeSorterIter *p2;

  assert( iOut<pSorter->nTree && iOut>0 );

  if( iOut>=(pSorter->nTree/2) ){
    i1 = (iOut - pSorter->nTree/2) * 2;
    i2 = i1 + 1;
  }else{
    i1 = pSorter->aTree[iOut*2];
    i2 = pSorter->aTree[iOut*2+1];
  }

  p1 = &pSorter->aIter[i1];
  p2 = &pSorter->aIter[i2];

  if( p1->pFile==0 ){
    iRes = i2;
  }else if( p2->pFile==0 ){
    iRes = i1;
  }else{
    int res;
    assert( pCsr->pSorter->pUnpacked!=0 );  /* allocated in vdbeSorterMerge() */
    vdbeSorterCompare(
        pCsr, 0, p1->aKey, p1->nKey, p2->aKey, p2->nKey, &res
    );
    if( res<=0 ){
      iRes = i1;
    }else{
      iRes = i2;
    }
  }

  pSorter->aTree[iOut] = iRes;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x58(%rdi), %rbx
movl 0x14(%rbx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl %esi, %eax
movl %esi, %r14d
subl %ecx, %eax
jge 0x331f5
movq 0x30(%rbx), %rax
addl %esi, %esi
movl (%rax,%rsi,4), %r12d
movl 0x4(%rax,%r14,8), %r15d
jmp 0x33203
movl %eax, %r12d
addl %eax, %r12d
leal 0x1(,%rax,2), %r15d
movq 0x28(%rbx), %rax
movslq %r12d, %rcx
shlq $0x6, %rcx
cmpq $0x0, 0x18(%rax,%rcx)
je 0x33256
movslq %r15d, %rsi
shlq $0x6, %rsi
addq %rax, %rsi
cmpq $0x0, 0x18(%rsi)
je 0x33253
addq %rcx, %rax
movq 0x28(%rax), %rdx
movl 0x14(%rax), %ecx
movq 0x28(%rsi), %r8
movl 0x14(%rsi), %r9d
leaq -0x2c(%rbp), %r13
movq %r13, (%rsp)
xorl %esi, %esi
callq 0x32cc8
cmpl $0x0, (%r13)
cmovlel %r12d, %r15d
jmp 0x33256
movl %r12d, %r15d
movq 0x30(%rbx), %rax
movl %r15d, (%rax,%r14,4)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeSorterIterVarint
static int vdbeSorterIterVarint(sqlite3 *db, VdbeSorterIter *p, u64 *pnOut){
  int iBuf;

  iBuf = p->iReadOff % p->nBuffer;
  if( iBuf && (p->nBuffer-iBuf)>=9 ){
    p->iReadOff += sqlite3GetVarint(&p->aBuffer[iBuf], pnOut);
  }else{
    u8 aVarint[16], *a;
    int i = 0, rc;
    do{
      rc = vdbeSorterIterRead(db, p, 1, &a);
      if( rc ) return rc;
      aVarint[(i++)&0xf] = a[0];
    }while( (a[0]&0x80)!=0 );
    sqlite3GetVarint(aVarint, pnOut);
  }

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq (%rsi), %rax
movslq 0x38(%rsi), %rcx
cqto
idivq %rcx
testq %rdx, %rdx
setne %al
subl %edx, %ecx
cmpl $0x9, %ecx
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x332bc
addq 0x30(%rbx), %rdx
movq %rdx, %rdi
movq %r14, %rsi
callq 0x2171c
movzbl %al, %eax
addq %rax, (%rbx)
jmp 0x33303
movq %rdi, %r15
xorl %r13d, %r13d
leaq -0x30(%rbp), %r12
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1, %edx
movq %r12, %rcx
callq 0x33398
testl %eax, %eax
jne 0x33305
movq -0x30(%rbp), %rax
movb (%rax), %al
leal 0x1(%r13), %ecx
andl $0xf, %r13d
movb %al, -0x40(%rbp,%r13)
movl %ecx, %r13d
testb %al, %al
js 0x332c6
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x2171c
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeSorterIterNext
static int vdbeSorterIterNext(
  sqlite3 *db,                    /* Database handle (for sqlite3DbMalloc() ) */
  VdbeSorterIter *pIter           /* Iterator to advance */
){
  int rc;                         /* Return Code */
  u64 nRec = 0;                   /* Size of record in bytes */

  if( pIter->iReadOff>=pIter->iEof ){
    /* This is an EOF condition */
    vdbeSorterIterZero(db, pIter);
    return SQLITE_OK;
  }

  rc = vdbeSorterIterVarint(db, pIter, &nRec);
  if( rc==SQLITE_OK ){
    pIter->nKey = (int)nRec;
    rc = vdbeSorterIterRead(db, pIter, (int)nRec, &pIter->aKey);
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq $0x0, -0x18(%rbp)
movq (%rsi), %rax
cmpq 0x8(%rsi), %rax
jge 0x33363
leaq -0x18(%rbp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3326d
testl %eax, %eax
jne 0x3338f
movl -0x18(%rbp), %edx
movl %edx, 0x14(%rbx)
leaq 0x28(%rbx), %rcx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x33398
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3DbReallocOrFree
SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *db, void *p, int n){
  void *pNew;
  pNew = sqlite3DbRealloc(db, p, n);
  if( !pNew ){
    sqlite3DbFree(db, p);
  }
  return pNew;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x174d4
movq %rax, %r15
testq %rax, %rax
jne 0x3352c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9c3a
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: corruptSchema
static void corruptSchema(
  InitData *pData,     /* Initialization context */
  const char *zObj,    /* Object being parsed at the point of error */
  const char *zExtra   /* Error information */
){
  sqlite3 *db = pData->db;
  if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){
    if( zObj==0 ) zObj = "?";
    sqlite3SetString(pData->pzErrMsg, db,
      "malformed database schema (%s)", zObj);
    if( zExtra ){
      *pData->pzErrMsg = sqlite3MAppendf(db, *pData->pzErrMsg, 
                                 "%s - %s", *pData->pzErrMsg, zExtra);
    }
  }
  pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
cmpb $0x0, 0x50(%r14)
jne 0x3371d
testb $0x1, 0x2e(%r14)
jne 0x3371d
movq %rdx, %r15
testq %rsi, %rsi
leaq 0x4623c(%rip), %rcx     # 0x79916
cmovneq %rsi, %rcx
movq 0x8(%rbx), %rdi
leaq 0x46944(%rip), %rdx     # 0x7a02d
movq %r14, %rsi
xorl %eax, %eax
callq 0x24616
testq %r15, %r15
je 0x3371d
movq 0x8(%rbx), %rax
movq (%rax), %rcx
leaq 0x46946(%rip), %rdx     # 0x7a04c
movq %r14, %rdi
movq %rcx, %rsi
movq %r15, %r8
xorl %eax, %eax
callq 0x338d2
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movl $0x7, %r15d
cmpb $0x0, 0x50(%r14)
jne 0x3374f
leaq 0x460e3(%rip), %rsi     # 0x79814
leaq 0x45e01(%rip), %rcx     # 0x79539
movl $0xb, %r15d
movl $0xb, %edi
movl $0x1757b, %edx          # imm = 0x1757B
xorl %eax, %eax
callq 0xb8cc
movl %r15d, 0x14(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3FindIndex
SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){
  Index *p = 0;
  int i;
  int nName = sqlite3Strlen30(zName);
  /* All mutexes are required for schema access.  Make sure we hold them. */
  assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) );
  for(i=OMIT_TEMPDB; i<db->nDb; i++){
    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */
    Schema *pSchema = db->aDb[j].pSchema;
    assert( pSchema );
    if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue;
    assert( sqlite3SchemaMutexHeld(db, j, 0) );
    p = sqlite3HashFind(&pSchema->idxHash, zName, nName);
    if( p ) break;
  }
  return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
testq %rsi, %rsi
je 0x33795
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %rsi, %rax
incl %r15d
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x33780
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
jmp 0x33798
xorl %r15d, %r15d
movl 0x28(%rdi), %eax
xorl %r13d, %r13d
movl %eax, -0x2c(%rbp)
testl %eax, %eax
jle 0x33843
movq %rsi, -0x40(%rbp)
movq 0x20(%rdi), %r14
leaq 0x1(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq 0x428a0(%rip), %r12     # 0x76060
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x2, %r13d
setb %cl
xorl %r13d, %ecx
shlq $0x5, %rcx
movq 0x18(%r14,%rcx), %rdi
testq %rbx, %rbx
je 0x3381a
addq %r14, %rcx
movq (%rcx), %rcx
movb (%rbx), %dl
testb %dl, %dl
je 0x3380a
movq -0x38(%rbp), %rsi
movzbl %dl, %r8d
movb (%r8,%r12), %r8b
movzbl (%rcx), %r9d
cmpb (%r9,%r12), %r8b
jne 0x3380a
incq %rcx
movb (%rsi), %dl
incq %rsi
testb %dl, %dl
jne 0x337ec
movzbl %dl, %edx
movb (%rdx,%r12), %dl
movzbl (%rcx), %ecx
cmpb (%rcx,%r12), %dl
jne 0x33832
addq $0x20, %rdi
movq -0x40(%rbp), %rsi
movl %r15d, %edx
callq 0x3396f
testq %rax, %rax
setne %cl
jmp 0x33834
xorl %ecx, %ecx
testb %cl, %cl
jne 0x33845
incl %r13d
cmpl -0x2c(%rbp), %r13d
jne 0x337c2
jmp 0x33845
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3GetInt32
SQLITE_PRIVATE int sqlite3GetInt32(const char *zNum, int *pValue){
  sqlite_int64 v = 0;
  int i, c;
  int neg = 0;
  if( zNum[0]=='-' ){
    neg = 1;
    zNum++;
  }else if( zNum[0]=='+' ){
    zNum++;
  }
  while( zNum[0]=='0' ) zNum++;
  for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
    v = v*10 + c;
  }

  /* The longest decimal representation of a 32 bit integer is 10 digits:
  **
  **             1234567890
  **     2^31 -> 2147483648
  */
  testcase( i==10 );
  if( i>10 ){
    return 0;
  }
  testcase( v-neg==2147483647 );
  if( v-neg>2147483647 ){
    return 0;
  }
  if( neg ){
    v = -v;
  }
  *pValue = (int)v;
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb (%rdi), %cl
leal -0x2b(%rcx), %eax
andb $-0x3, %al
cmpb $0x1, %al
adcq $0x0, %rdi
cmpb $0x30, (%rdi)
leaq 0x1(%rdi), %rdi
je 0x33865
xorl %edx, %edx
cmpb $0x2d, %cl
sete %dl
negq %rdx
xorl %r9d, %r9d
xorl %r8d, %r8d
movzbl -0x1(%rdi,%r9), %eax
leal -0x30(%rax), %r10d
cmpb $0x9, %r10b
ja 0x338a9
leaq (%r8,%r8,4), %r8
andl $0xf, %eax
leaq (%rax,%r8,2), %r8
incq %r9
cmpq $0xb, %r9
jne 0x3387f
movl $0xb, %r9d
xorl %eax, %eax
cmpl $0xa, %r9d
ja 0x338d0
addq %r8, %rdx
cmpq $0x7fffffff, %rdx       # imm = 0x7FFFFFFF
jg 0x338d0
movl %r8d, %eax
negl %eax
cmpb $0x2d, %cl
cmovnel %r8d, %eax
movl %eax, (%rsi)
movl $0x1, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3MAppendf
SQLITE_PRIVATE char *sqlite3MAppendf(sqlite3 *db, char *zStr, const char *zFormat, ...){
  va_list ap;
  char *z;
  va_start(ap, zFormat);
  z = sqlite3VMPrintf(db, zFormat, ap);
  va_end(ap);
  sqlite3DbFree(db, zStr);
  return z;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0xe0(%rbp), %rsi
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x33928
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq -0x30(%rbp), %rax
movq %rsi, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movabsq $0x3000000018, %rcx     # imm = 0x3000000018
movq %rcx, (%rax)
movq %rdx, %rsi
movq %rax, %rdx
callq 0x19668
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9c3a
movq %r15, %rax
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3HashFind
SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey, int nKey){
  HashElem *elem;    /* The element that matches key */
  unsigned int h;    /* A hash on key */

  assert( pH!=0 );
  assert( pKey!=0 );
  assert( nKey>=0 );
  if( pH->ht ){
    h = strHash(pKey, nKey) % pH->htsize;
  }else{
    h = 0;
  }
  elem = findElementGivenHash(pH, pKey, nKey, h);
  return elem ? elem->data : 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edx, %r8d
cmpq $0x0, 0x10(%rdi)
je 0x339b9
testl %r8d, %r8d
jle 0x339bd
leal 0x1(%r8), %ecx
xorl %r10d, %r10d
leaq 0x426d0(%rip), %rdx     # 0x76060
movq %rsi, %r9
leal (,%r10,8), %eax
movzbl (%r9), %r11d
incq %r9
movzbl (%r11,%rdx), %r11d
xorl %r10d, %eax
xorl %r11d, %eax
decl %ecx
movl %eax, %r10d
cmpl $0x1, %ecx
jg 0x33993
jmp 0x339bf
xorl %ecx, %ecx
jmp 0x339c5
xorl %eax, %eax
xorl %edx, %edx
divl (%rdi)
movl %edx, %ecx
movl %r8d, %edx
callq 0x339dc
testq %rax, %rax
je 0x339d8
movq 0x10(%rax), %rax
jmp 0x339da
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: findElementGivenHash
static HashElem *findElementGivenHash(
  const Hash *pH,     /* The pH to be searched */
  const char *pKey,   /* The key we are searching for */
  int nKey,           /* Bytes in key (not counting zero terminator) */
  unsigned int h      /* The hash for this key. */
){
  HashElem *elem;                /* Used to loop thru the element list */
  int count;                     /* Number of elements left to test */

  if( pH->ht ){
    struct _ht *pEntry = &pH->ht[h];
    elem = pEntry->chain;
    count = pEntry->count;
  }else{
    elem = pH->first;
    count = pH->count;
  }
  while( count-- && ALWAYS(elem) ){
    if( elem->nKey==nKey && sqlite3StrNICmp(elem->pKey,pKey,nKey)==0 ){ 
      return elem;
    }
    elem = elem->next;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq 0x10(%rdi), %rax
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rax, %rcx
leaq 0x4(%rdi), %rdx
testq %rax, %rax
cmovneq %rcx, %rdi
cmovneq %rcx, %rdx
movl (%rdx), %r12d
xorl %r14d, %r14d
testl %r12d, %r12d
je 0x33a51
movq 0x8(%rdi), %r13
testq %r13, %r13
je 0x33a51
movq %rsi, %r15
decl %r12d
xorl %r14d, %r14d
cmpl %ebx, 0x20(%r13)
jne 0x33a3d
movq 0x18(%r13), %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x9454
testl %eax, %eax
je 0x33a4e
addl $-0x1, %r12d
jae 0x33a51
movq (%r13), %r13
testq %r13, %r13
jne 0x33a25
jmp 0x33a51
movq %r13, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3DefaultRowEst
SQLITE_PRIVATE void sqlite3DefaultRowEst(Index *pIdx){
  tRowcnt *a = pIdx->aiRowEst;
  int i;
  tRowcnt n;
  assert( a!=0 );
  a[0] = pIdx->pTable->nRowEst;
  if( a[0]<10 ) a[0] = 10;
  n = 10;
  for(i=1; i<=pIdx->nColumn; i++){
    a[i] = n;
    if( n>5 ) n--;
  }
  if( pIdx->onError!=OE_None ){
    a[pIdx->nColumn] = 1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x18(%rdi), %rax
movl 0x38(%rax), %ecx
cmpl $0xb, %ecx
movl $0xa, %edx
cmovbl %edx, %ecx
movq 0x10(%rdi), %rax
movl %ecx, (%rax)
movzwl 0x54(%rdi), %ecx
testq %rcx, %rcx
je 0x33a9c
xorl %esi, %esi
movl %edx, 0x4(%rax,%rsi,4)
cmpl $0x6, %edx
adcl $-0x1, %edx
incq %rsi
cmpq %rsi, %rcx
jne 0x33a8a
cmpb $0x0, 0x56(%rdi)
je 0x33aa9
movl $0x1, (%rax,%rcx,4)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3FindTable
SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
  Table *p = 0;
  int i;
  int nName;
  assert( zName!=0 );
  nName = sqlite3Strlen30(zName);
  /* All mutexes are required for schema access.  Make sure we hold them. */
  assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );
  for(i=OMIT_TEMPDB; i<db->nDb; i++){
    int j = (i<2) ? i^1 : i;   /* Search TEMP before MAIN */
    if( zDatabase!=0 && sqlite3StrICmp(zDatabase, db->aDb[j].zName) ) continue;
    assert( sqlite3SchemaMutexHeld(db, j, 0) );
    p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName, nName);
    if( p ) break;
  }
  return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rdi, %r15
testq %rsi, %rsi
je 0x33ae5
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq %rsi, %rax
incl %r12d
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x33ad0
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
jmp 0x33ae8
xorl %r12d, %r12d
movl 0x28(%r15), %eax
xorl %r14d, %r14d
movl %eax, -0x2c(%rbp)
testl %eax, %eax
jle 0x33ba8
movq %rsi, -0x40(%rbp)
leaq 0x1(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq 0x42553(%rip), %r13     # 0x76060
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x2, %r14d
setb %cl
xorl %r14d, %ecx
movl %ecx, %ecx
testq %rbx, %rbx
je 0x33b6e
movq 0x20(%r15), %rdx
movq %rcx, %rsi
shlq $0x5, %rsi
movq (%rdx,%rsi), %rdx
movb (%rbx), %sil
testb %sil, %sil
je 0x33b5d
movq -0x38(%rbp), %rdi
movzbl %sil, %r8d
movb (%r8,%r13), %r8b
movzbl (%rdx), %r9d
cmpb (%r9,%r13), %r8b
jne 0x33b5d
incq %rdx
movb (%rdi), %sil
incq %rdi
testb %sil, %sil
jne 0x33b3d
movzbl %sil, %esi
movb (%rsi,%r13), %sil
movzbl (%rdx), %edx
cmpb (%rdx,%r13), %sil
jne 0x33b93
movq 0x20(%r15), %rax
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rdi
addq $0x8, %rdi
movq -0x40(%rbp), %rsi
movl %r12d, %edx
callq 0x3396f
testq %rax, %rax
setne %cl
jmp 0x33b95
xorl %ecx, %ecx
testb %cl, %cl
jne 0x33baa
incl %r14d
cmpl -0x2c(%rbp), %r14d
jne 0x33b0f
jmp 0x33baa
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: analysisLoader
static int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){
  analysisInfo *pInfo = (analysisInfo*)pData;
  Index *pIndex;
  Table *pTable;
  int i, c, n;
  tRowcnt v;
  const char *z;

  assert( argc==3 );
  UNUSED_PARAMETER2(NotUsed, argc);

  if( argv==0 || argv[0]==0 || argv[2]==0 ){
    return 0;
  }
  pTable = sqlite3FindTable(pInfo->db, argv[0], pInfo->zDatabase);
  if( pTable==0 ){
    return 0;
  }
  if( argv[1] ){
    pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase);
  }else{
    pIndex = 0;
  }
  n = pIndex ? pIndex->nColumn : 0;
  z = argv[2];
  for(i=0; *z && i<=n; i++){
    v = 0;
    while( (c=z[0])>='0' && c<='9' ){
      v = v*10 + c - '0';
      z++;
    }
    if( i==0 && (pIndex==0 || pIndex->pPartIdxWhere==0) ){
      if( v>0 ) pTable->nRowEst = v;
      if( pIndex==0 ) break;
    }
    pIndex->aiRowEst[i] = v;
    if( *z==' ' ) z++;
    if( strcmp(z, "unordered")==0 ){
      pIndex->bUnordered = 1;
      break;
    }
  }
  return 0;
}

// Assembly:
testq %rdx, %rdx
je 0x33ce7
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq (%rdx), %rsi
testq %rsi, %rsi
je 0x33cd9
movq 0x10(%r14), %r15
testq %r15, %r15
je 0x33cd9
movq (%rdi), %r13
movq 0x8(%rdi), %r12
movq %r13, %rdi
movq %r12, %rdx
callq 0x33aab
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x33cd9
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0x33c24
movq %r13, %rdi
movq %r12, %rdx
callq 0x3375e
movq %rax, %r14
jmp 0x33c27
xorl %r14d, %r14d
testq %r14, %r14
je 0x33c33
movzwl 0x54(%r14), %r13d
jmp 0x33c36
xorl %r13d, %r13d
cmpb $0x0, (%r15)
je 0x33cd9
xorl %ebx, %ebx
leaq 0x46434(%rip), %r12     # 0x7a07d
movb (%r15), %dl
leal -0x30(%rdx), %eax
xorl %ecx, %ecx
cmpb $0x9, %al
ja 0x33c75
movq %r15, %rax
movzbl %dl, %edx
leal (%rcx,%rcx,4), %ecx
leal (%rdx,%rcx,2), %ecx
addl $-0x30, %ecx
movb 0x1(%rax), %dl
incq %rax
leal -0x30(%rdx), %esi
cmpb $0xa, %sil
jb 0x33c58
jmp 0x33c78
movq %r15, %rax
testq %rbx, %rbx
jne 0x33c99
testq %r14, %r14
je 0x33c89
cmpq $0x0, 0x48(%r14)
jne 0x33c99
testl %ecx, %ecx
je 0x33c94
movq -0x30(%rbp), %rdx
movl %ecx, 0x38(%rdx)
testq %r14, %r14
je 0x33cd9
movq 0x10(%r14), %rdx
movl %ecx, (%rdx,%rbx,4)
xorl %r15d, %r15d
cmpb $0x20, (%rax)
sete %r15b
addq %rax, %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x8530
testl %eax, %eax
je 0x33cd4
cmpb $0x0, (%r15)
je 0x33cd9
leaq 0x1(%rbx), %rax
cmpq %r13, %rbx
movq %rax, %rbx
jb 0x33c49
jmp 0x33cd9
orb $0x4, 0x57(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: insertElement
static void insertElement(
  Hash *pH,              /* The complete hash table */
  struct _ht *pEntry,    /* The entry into which pNew is inserted */
  HashElem *pNew         /* The element to be inserted */
){
  HashElem *pHead;       /* First element already in pEntry */
  if( pEntry ){
    pHead = pEntry->count ? pEntry->chain : 0;
    pEntry->count++;
    pEntry->chain = pNew;
  }else{
    pHead = 0;
  }
  if( pHead ){
    pNew->next = pHead;
    pNew->prev = pHead->prev;
    if( pHead->prev ){ pHead->prev->next = pNew; }
    else             { pH->first = pNew; }
    pHead->prev = pNew;
  }else{
    pNew->next = pH->first;
    if( pH->first ){ pH->first->prev = pNew; }
    pNew->prev = 0;
    pH->first = pNew;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rsi, %rsi
je 0x33fdd
movl (%rsi), %ecx
testl %ecx, %ecx
je 0x33fe1
movq 0x8(%rsi), %rax
jmp 0x33fe3
xorl %eax, %eax
jmp 0x33feb
xorl %eax, %eax
incl %ecx
movl %ecx, (%rsi)
movq %rdx, 0x8(%rsi)
testq %rax, %rax
je 0x34016
movq %rax, (%rdx)
leaq 0x8(%rax), %rcx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rdx)
movq 0x8(%rax), %rax
addq $0x8, %rdi
testq %rax, %rax
cmovneq %rax, %rdi
movq %rdx, (%rdi)
movq %rcx, %rdi
jmp 0x34032
movq 0x8(%rdi), %rax
movq %rax, (%rdx)
testq %rax, %rax
je 0x34026
movq %rdx, 0x8(%rax)
addq $0x8, %rdi
movq $0x0, 0x8(%rdx)
movq %rdx, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: freeIndex
static void freeIndex(sqlite3 *db, Index *p){
#ifndef SQLITE_OMIT_ANALYZE
  sqlite3DeleteIndexSamples(db, p);
#endif
  sqlite3ExprDelete(db, p->pPartIdxWhere);
  sqlite3DbFree(db, p->zColAff);
  sqlite3DbFree(db, p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x48(%rsi), %rsi
callq 0x34068
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x9c3a
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3ExprDelete
SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
  if( p==0 ) return;
  /* Sanity check: Assert that the IntValue is non-negative if it exists */
  assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 );
  if( !ExprHasAnyProperty(p, EP_TokenOnly) ){
    sqlite3ExprDelete(db, p->pLeft);
    sqlite3ExprDelete(db, p->pRight);
    if( !ExprHasProperty(p, EP_Reduced) && (p->flags2 & EP2_MallocedToken)!=0 ){
      sqlite3DbFree(db, p->u.zToken);
    }
    if( ExprHasProperty(p, EP_xIsSelect) ){
      sqlite3SelectDelete(db, p->x.pSelect);
    }else{
      sqlite3ExprListDelete(db, p->x.pList);
    }
  }
  if( !ExprHasProperty(p, EP_Static) ){
    sqlite3DbFree(db, p);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0x340df
movq %rsi, %rbx
movq %rdi, %r14
testb $0x40, 0x3(%rsi)
jne 0x340c9
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x34068
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x34068
testb $0x20, 0x3(%rbx)
jne 0x340b0
testb $0x1, 0x36(%rbx)
je 0x340b0
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
testb $0x8, 0x3(%rbx)
movq 0x20(%rbx), %rsi
movq %r14, %rdi
jne 0x340c4
callq 0x3410b
jmp 0x340c9
callq 0x340e4
cmpw $0x0, 0x2(%rbx)
js 0x340df
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x9c3a
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3ExprListDelete
SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
  int i;
  struct ExprList_item *pItem;
  if( pList==0 ) return;
  assert( pList->a!=0 || pList->nExpr==0 );
  for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){
    sqlite3ExprDelete(db, pItem->pExpr);
    sqlite3DbFree(db, pItem->zName);
    sqlite3DbFree(db, pItem->zSpan);
  }
  sqlite3DbFree(db, pList->a);
  sqlite3DbFree(db, pList);
}

// Assembly:
testq %rsi, %rsi
je 0x3417b
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, (%rsi)
jle 0x3415c
movq 0x8(%rbx), %r15
xorl %r12d, %r12d
movq (%r15), %rsi
movq %r14, %rdi
callq 0x34068
movq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x9c3a
movq 0x10(%r15), %rsi
movq %r14, %rdi
callq 0x9c3a
incl %r12d
addq $0x20, %r15
cmpl (%rbx), %r12d
jl 0x3412d
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9c3a
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: clearSelect
static void clearSelect(sqlite3 *db, Select *p){
  sqlite3ExprListDelete(db, p->pEList);
  sqlite3SrcListDelete(db, p->pSrc);
  sqlite3ExprDelete(db, p->pWhere);
  sqlite3ExprListDelete(db, p->pGroupBy);
  sqlite3ExprDelete(db, p->pHaving);
  sqlite3ExprListDelete(db, p->pOrderBy);
  sqlite3SelectDelete(db, p->pPrior);
  sqlite3ExprDelete(db, p->pLimit);
  sqlite3ExprDelete(db, p->pOffset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
callq 0x3410b
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x341f5
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0x34068
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x3410b
movq 0x40(%r14), %rsi
movq %rbx, %rdi
callq 0x34068
movq 0x48(%r14), %rsi
movq %rbx, %rdi
callq 0x3410b
movq 0x50(%r14), %rsi
movq %rbx, %rdi
callq 0x340e4
movq 0x68(%r14), %rsi
movq %rbx, %rdi
callq 0x34068
movq 0x70(%r14), %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x34068
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3SrcListDelete
SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
  int i;
  struct SrcList_item *pItem;
  if( pList==0 ) return;
  for(pItem=pList->a, i=0; i<pList->nSrc; i++, pItem++){
    sqlite3DbFree(db, pItem->zDatabase);
    sqlite3DbFree(db, pItem->zName);
    sqlite3DbFree(db, pItem->zAlias);
    sqlite3DbFree(db, pItem->zIndex);
    sqlite3DeleteTable(db, pItem->pTab);
    sqlite3SelectDelete(db, pItem->pSelect);
    sqlite3ExprDelete(db, pItem->pOn);
    sqlite3IdListDelete(db, pItem->pUsing);
  }
  sqlite3DbFree(db, pList);
}

// Assembly:
testq %rsi, %rsi
je 0x3429c
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, (%rsi)
je 0x34289
leaq 0x10(%rbx), %r15
xorl %r12d, %r12d
movq (%r15), %rsi
movq %r14, %rdi
callq 0x9c3a
movq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x9c3a
movq 0x10(%r15), %rsi
movq %r14, %rdi
callq 0x9c3a
movq 0x50(%r15), %rsi
movq %r14, %rdi
callq 0x9c3a
movq 0x18(%r15), %rsi
movq %r14, %rdi
callq 0x9939
movq 0x20(%r15), %rsi
movq %r14, %rdi
callq 0x340e4
movq 0x38(%r15), %rsi
movq %r14, %rdi
callq 0x34068
movq 0x40(%r15), %rsi
movq %r14, %rdi
callq 0x3429d
incl %r12d
movzbl (%rbx), %eax
addq $0x68, %r15
cmpl %eax, %r12d
jb 0x3421b
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9c3a
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3IdListDelete
SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){
  int i;
  if( pList==0 ) return;
  for(i=0; i<pList->nId; i++){
    sqlite3DbFree(db, pList->a[i].zName);
  }
  sqlite3DbFree(db, pList->a);
  sqlite3DbFree(db, pList);
}

// Assembly:
testq %rsi, %rsi
je 0x342fc
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0x8(%rsi)
jle 0x342de
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rbx), %rax
movq (%rax,%r15), %rsi
movq %r14, %rdi
callq 0x9c3a
incq %r12
movslq 0x8(%rbx), %rax
addq $0x10, %r15
cmpq %rax, %r12
jl 0x342bf
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9c3a
retq