LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: cellSizePtr
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
  u8 *pIter = &pCell[pPage->childPtrSize];
  u32 nSize;

#ifdef SQLITE_DEBUG
  /* The value returned by this function should always be the same as
  ** the (CellInfo.nSize) value found by doing a full parse of the
  ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
  ** this function verifies that this invariant is not violated. */
  CellInfo debuginfo;
  btreeParseCellPtr(pPage, pCell, &debuginfo);
#endif

  if( pPage->intKey ){
    u8 *pEnd;
    if( pPage->hasData ){
      pIter += getVarint32(pIter, nSize);
    }else{
      nSize = 0;
    }

    /* pIter now points at the 64-bit integer key value, a variable length 
    ** integer. The following block moves pIter to point at the first byte
    ** past the end of the key value. */
    pEnd = &pIter[9];
    while( (*pIter++)&0x80 && pIter<pEnd );
  }else{
    pIter += getVarint32(pIter, nSize);
  }

  testcase( nSize==pPage->maxLocal );
  testcase( nSize==pPage->maxLocal+1 );
  if( nSize>pPage->maxLocal ){
    int minLocal = pPage->minLocal;
    nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
    testcase( nSize==pPage->maxLocal );
    testcase( nSize==pPage->maxLocal+1 );
    if( nSize>pPage->maxLocal ){
      nSize = minLocal;
    }
    nSize += 4;
  }
  nSize += (u32)(pIter - pCell);

  /* The minimum size of any cell is 4 bytes. */
  if( nSize<4 ){
    nSize = 4;
  }

  assert( nSize==debuginfo.nSize );
  return (u16)nSize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movzbl 0x6(%rdi), %ebx
addq %rsi, %rbx
cmpb $0x0, 0x2(%rdi)
je 0x2c1f7
cmpb $0x0, 0x4(%r15)
je 0x2c206
movsbl (%rbx), %eax
testl %eax, %eax
js 0x2c20c
movl %eax, -0x1c(%rbp)
pushq $0x1
popq %rax
jmp 0x2c21b
movsbl (%rbx), %eax
testl %eax, %eax
js 0x2c238
movl %eax, -0x1c(%rbp)
pushq $0x1
popq %rax
jmp 0x2c247
andl $0x0, -0x1c(%rbp)
jmp 0x2c21e
leaq -0x1c(%rbp), %rsi
movq %rbx, %rdi
callq 0x1e561
movzbl %al, %eax
addq %rax, %rbx
xorl %eax, %eax
leaq 0x1(%rax), %rcx
cmpq $0x7, %rax
ja 0x2c233
cmpb $0x0, (%rbx,%rax)
movq %rcx, %rax
js 0x2c220
addq %rcx, %rbx
jmp 0x2c24a
leaq -0x1c(%rbp), %rsi
movq %rbx, %rdi
callq 0x1e561
movzbl %al, %eax
addq %rax, %rbx
movl -0x1c(%rbp), %eax
movzwl 0x8(%r15), %ecx
cmpl %ecx, %eax
jbe 0x2c277
movzwl 0xa(%r15), %esi
subl %esi, %eax
movq 0x48(%r15), %rdx
movl 0x34(%rdx), %edi
addl $-0x4, %edi
xorl %edx, %edx
divl %edi
movl %edx, %eax
addl %esi, %eax
cmpl %ecx, %eax
cmoval %esi, %eax
addl $0x4, %eax
subl %r14d, %ebx
addl %eax, %ebx
cmpl $0x5, %ebx
pushq $0x4
popq %rax
cmovael %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x1c915
movq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x2dcd2
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rsi
movq %rdx, 0x50(%rsi)
movq %rcx, 0x68(%rsi)
movq %r14, 0x48(%rsi)
movl %ebx, 0x70(%rsi)
cmpl $0x1, %ebx
pushq $0x64
popq %rcx
cmovel %ecx, %eax
movb %al, 0x5(%rsi)
movq %rsi, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2e0f4
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 0x82c0
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 0x82c0
movb $0x0, (%r14)
movq %r14, %rdi
callq 0x1a4b5
testl %eax, %eax
jne 0x2e190
movq -0x30(%rbp), %rax
cmpb $0x0, 0x21(%rax)
je 0x2e192
movq %r14, %rdi
callq 0x1f719
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_O2/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 %rcx, -0x50(%rbp)
movq %rdx, %r15
movq 0x48(%rdi), %rax
movq 0x50(%rdi), %r14
movzbl 0x5(%rdi), %ecx
movq %rcx, -0x38(%rbp)
movl 0x34(%rax), %r8d
movq %rdi, -0x40(%rbp)
movq 0x60(%rdi), %rcx
leal (%rsi,%rsi), %eax
movl %eax, -0x2c(%rbp)
movslq %eax, %rdx
movq %rsi, -0x48(%rbp)
movl %esi, %eax
leaq (%rdx,%rcx), %r12
decq %r12
movl %r8d, -0x30(%rbp)
movl %r8d, %ebx
testl %eax, %eax
jle 0x2e22e
leaq -0x1(%rax), %r13
movq -0x50(%rbp), %rcx
movzwl -0x2(%rcx,%rax,2), %edx
movslq %ebx, %rbx
subq %rdx, %rbx
movl %ebx, %ecx
rolw $0x8, %cx
movw %cx, -0x1(%r12)
movq %rbx, %rdi
addq %r14, %rdi
movq -0x8(%r15,%rax,8), %rsi
callq 0x82c0
addq $-0x2, %r12
movq %r13, %rax
jmp 0x2e1f2
movq -0x48(%rbp), %rax
movq %r14, %rcx
movq -0x38(%rbp), %rdx
movb %ah, 0x3(%rcx,%rdx)
movb %al, 0x4(%r14,%rdx)
movb %bh, 0x5(%rcx,%rdx)
movb %bl, 0x6(%r14,%rdx)
movl -0x30(%rbp), %ecx
addl -0x2c(%rbp), %ecx
subl %ecx, %ebx
movq -0x40(%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_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeSorterRowkey
static void *vdbeSorterRowkey(
  const VdbeSorter *pSorter,      /* Sorter object */
  int *pnKey                      /* OUT: Size of current key in bytes */
){
  void *pKey;
  if( pSorter->aTree ){
    VdbeSorterIter *pIter;
    pIter = &pSorter->aIter[ pSorter->aTree[1] ];
    *pnKey = pIter->nKey;
    pKey = pIter->aKey;
  }else{
    *pnKey = pSorter->pRecord->nVal;
    pKey = pSorter->pRecord->pVal;
  }
  return pKey;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x2e2be
movq 0x28(%rdi), %rdx
movslq 0x4(%rax), %rax
shlq $0x6, %rax
leaq (%rdx,%rax), %rcx
addq $0x14, %rcx
addq %rdx, %rax
addq $0x28, %rax
jmp 0x2e2c6
movq 0x40(%rdi), %rax
leaq 0x8(%rax), %rcx
movl (%rcx), %ecx
movl %ecx, (%rsi)
movq (%rax), %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2e308
movq %r12, %rdi
movl %r9d, %esi
movq %r8, %rdx
movq %r15, %rcx
callq 0x2abd6
movq 0x10(%rbp), %r8
testl %r13d, %r13d
je 0x2e347
movzwl 0xa(%r12), %eax
movw %ax, 0x8(%r15)
imulq $0x38, %rax, %rcx
addq $0x38, %rcx
xorl %edx, %edx
pushq $-0x1
popq %rax
leaq 0x38(%rdx), %rsi
cmpq %rsi, %rcx
je 0x2e342
movq 0x18(%r15), %rdi
testb $0x1, 0x24(%rdi,%rdx)
movq %rsi, %rdx
je 0x2e329
jmp 0x2e35b
orb $0x2, 0xa(%r15)
movl %r14d, %edi
movq %rbx, %rsi
movq %r15, %rdx
movq %r8, %rbx
callq 0x2bfb3
movq %rbx, %r8
movl %eax, (%r8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xbeb2
testq %rax, %rax
je 0x2e422
movq %rax, %r12
movq %r14, -0x38(%rbp)
movq 0x40(%r14), %rax
leaq -0x30(%rbp), %r15
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x2e3e5
movq 0x10(%rax), %r13
andq $0x0, 0x10(%rax)
movq %r12, %r14
movq (%r14), %rdx
movq -0x30(%rbp), %rsi
testq %rdx, %rdx
je 0x2e3dd
movq %rbx, %rdi
movq %r15, %rcx
callq 0x2e6fb
andq $0x0, (%r14)
addq $0x8, %r14
jmp 0x2e3bc
movq %rsi, (%r14)
movq %r13, %rax
jmp 0x2e3a7
leaq -0x30(%rbp), %r15
andq $0x0, (%r15)
xorl %r14d, %r14d
movq -0x30(%rbp), %rsi
cmpq $0x40, %r14
je 0x2e40e
movq (%r12,%r14,8), %rdx
movq %rbx, %rdi
movq %r15, %rcx
callq 0x2e6fb
incq %r14
jmp 0x2e3f0
movq -0x38(%rbp), %rax
movq %rsi, 0x40(%rax)
movq %r12, %rdi
callq 0x9c7b
xorl %eax, %eax
jmp 0x2e425
pushq $0x7
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %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 0x2e4d7
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2e36d
testl %eax, %eax
jne 0x2e504
movq 0x38(%rbx), %rsi
testq %rsi, %rsi
je 0x2e4f1
movq (%rbx), %rcx
leaq -0x60(%rbp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x2e53f
incl 0x18(%rbx)
movslq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x2e5b3
movq 0x40(%rbx), %r12
testq %r12, %r12
je 0x2e4db
movq 0x10(%r12), %r13
movslq 0x8(%r12), %rsi
movq %r15, %rdi
callq 0x2e5b3
movq (%r12), %rsi
movl 0x8(%r12), %edx
movq %r15, %rdi
callq 0x2e5e3
movq %r14, %rdi
movq %r12, %rsi
callq 0x968b
movq %r13, %r12
jmp 0x2e49f
xorl %eax, %eax
jmp 0x2e504
andq $0x0, 0x40(%rbx)
leaq -0x60(%rbp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2e686
jmp 0x2e504
leaq 0x38(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2e51b
testl %eax, %eax
je 0x2e513
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rsi
jmp 0x2e47a
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: fileWriterInit
static void fileWriterInit(
  sqlite3 *db,                    /* Database (for malloc) */
  sqlite3_file *pFile,            /* File to write to */
  FileWriter *p,                  /* Object to populate */
  i64 iStart                      /* Offset of pFile to begin writing at */
){
  int nBuf = sqlite3BtreeGetPageSize(db->aDb[0].pBt);

  memset(p, 0, sizeof(FileWriter));
  p->aBuffer = (u8 *)sqlite3DbMallocRaw(db, nBuf);
  if( !p->aBuffer ){
    p->eFWErr = SQLITE_NOMEM;
  }else{
    p->iBufEnd = p->iBufStart = (iStart % nBuf);
    p->iWriteOff = iStart - p->iBufStart;
    p->nBuffer = nBuf;
    p->pFile = pFile;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r14
movq 0x20(%rdi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movl 0x30(%rax), %r12d
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdx)
movups %xmm0, 0x10(%rdx)
movups %xmm0, (%rdx)
movl %r12d, %esi
callq 0x103b4
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x2e5a4
movslq %r12d, %rcx
movq %r15, %rax
cqto
idivq %rcx
movl %edx, 0x14(%rbx)
movl %edx, 0x18(%rbx)
subq %rdx, %r15
movq %r15, 0x20(%rbx)
movl %r12d, 0x10(%rbx)
movq %r14, 0x28(%rbx)
jmp 0x2e5aa
movl $0x7, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
movl %edx, %ebx
movq %rsi, -0x30(%rbp)
movq %rdi, %r15
movl %edx, %r13d
testl %r13d, %r13d
jle 0x2e677
cmpl $0x0, (%r15)
jne 0x2e677
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 0x82c0
addl 0x18(%r15), %r12d
movl %r12d, 0x18(%r15)
cmpl 0x10(%r15), %r12d
jne 0x2e672
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)
andq $0x0, 0x14(%r15)
movslq 0x10(%r15), %rax
addq %rax, 0x20(%r15)
subl %r14d, %r13d
jmp 0x2e5fd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2e6d0
movslq 0x18(%rbx), %rax
addq 0x20(%rbx), %rax
movq %rax, (%r15)
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x968b
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 0x2e69e
movl 0x18(%rbx), %edx
movslq 0x14(%rbx), %rcx
cmpl %ecx, %edx
jle 0x2e69e
movq 0x28(%rbx), %rdi
addq %rcx, %rsi
subl %ecx, %edx
addq 0x20(%rbx), %rcx
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, (%rbx)
jmp 0x2e69e
// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rsi, %r15
movq %rdi, %r12
andq $0x0, -0x38(%rbp)
testq %rdx, %rdx
je 0x2e728
movq (%r14), %r8
jmp 0x2e72b
xorl %r8d, %r8d
leaq -0x38(%rbp), %rbx
leaq -0x2c(%rbp), %r13
testq %r15, %r15
je 0x2e78a
testq %r14, %r14
je 0x2e78a
movq (%r15), %rdx
movl 0x8(%r15), %ecx
movl 0x8(%r14), %r9d
movq %r13, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
callq 0x2e2cf
cmpl $0x0, -0x2c(%rbp)
jle 0x2e777
movq %r14, (%rbx)
movq 0x10(%r14), %rax
addq $0x10, %r14
testq %rax, %rax
je 0x2e792
movq (%rax), %r8
movq %r14, %rbx
movq %rax, %r14
jmp 0x2e733
movq %r15, (%rbx)
movq %r15, %rbx
movq 0x10(%r15), %r15
addq $0x10, %rbx
xorl %r8d, %r8d
jmp 0x2e733
movq %r14, %rax
movq %rbx, %r14
jmp 0x2e794
xorl %eax, %eax
testq %r15, %r15
cmovneq %r15, %rax
movq %rax, (%r14)
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_O2/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
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %esi, %ecx
movl %esi, %r14d
subl %eax, %ecx
jge 0x2e7f0
movq 0x30(%rbx), %rax
addl %esi, %esi
movl (%rax,%rsi,4), %r12d
movl 0x4(%rax,%r14,8), %r15d
jmp 0x2e7fe
movl %ecx, %r12d
addl %ecx, %r12d
leal 0x1(,%rcx,2), %r15d
movq 0x28(%rbx), %rax
movslq %r12d, %rcx
shlq $0x6, %rcx
cmpq $0x0, 0x18(%rax,%rcx)
je 0x2e851
movslq %r15d, %rsi
shlq $0x6, %rsi
addq %rax, %rsi
cmpq $0x0, 0x18(%rsi)
je 0x2e84e
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 0x2e2cf
cmpl $0x0, (%r13)
cmovlel %r12d, %r15d
jmp 0x2e851
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_O2/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 $0x28, %rsp
movq %rdx, %r8
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 0x2e8b7
addq 0x30(%rbx), %rdx
movq %rdx, %rdi
movq %r8, %rsi
callq 0x1e5d0
movzbl %al, %eax
addq %rax, (%rbx)
jmp 0x2e905
movq %rdi, %r15
movq %r8, -0x30(%rbp)
xorl %r14d, %r14d
pushq $0x1
popq %r12
leaq -0x38(%rbp), %r13
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movq %r13, %rcx
callq 0x2e978
testl %eax, %eax
jne 0x2e907
movq -0x38(%rbp), %rax
movb (%rax), %al
leal 0x1(%r14), %ecx
andl $0xf, %r14d
movb %al, -0x50(%rbp,%r14)
movl %ecx, %r14d
testb %al, %al
js 0x2e8c9
leaq -0x50(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x1e5d0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, -0x18(%rbp)
movq %rdi, %r14
movq (%rsi), %rax
cmpq 0x8(%rsi), %rax
jge 0x2e962
leaq -0x18(%rbp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2e868
testl %eax, %eax
jne 0x2e96f
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 0x2e978
movq %r14, %rdi
movq %rbx, %rsi
callq 0x20c4e
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x157c3
movq %rax, %r15
testq %rax, %rax
jne 0x2eae9
movq %r14, %rdi
movq %rbx, %rsi
callq 0x968b
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: clearDatabasePage
static int clearDatabasePage(
  BtShared *pBt,           /* The BTree that contains the table */
  Pgno pgno,               /* Page number to clear */
  int freePageFlag,        /* Deallocate page if true */
  int *pnChange            /* Add number of Cells freed to this counter */
){
  MemPage *pPage;
  int rc;
  unsigned char *pCell;
  int i;

  assert( sqlite3_mutex_held(pBt->mutex) );
  if( pgno>btreePagecount(pBt) ){
    return SQLITE_CORRUPT_BKPT;
  }

  rc = getAndInitPage(pBt, pgno, &pPage, 0);
  if( rc ) return rc;
  for(i=0; i<pPage->nCell; i++){
    pCell = findCell(pPage, i);
    if( !pPage->leaf ){
      rc = clearDatabasePage(pBt, get4byte(pCell), 1, pnChange);
      if( rc ) goto cleardatabasepage_out;
    }
    rc = clearCell(pPage, pCell);
    if( rc ) goto cleardatabasepage_out;
  }
  if( !pPage->leaf ){
    rc = clearDatabasePage(pBt, get4byte(&pPage->aData[8]), 1, pnChange);
    if( rc ) goto cleardatabasepage_out;
  }else if( pnChange ){
    assert( pPage->intKey );
    *pnChange += pPage->nCell;
  }
  if( freePageFlag ){
    freePage(pPage, &rc);
  }else if( (rc = sqlite3PagerWrite(pPage->pDbPage))==0 ){
    zeroPage(pPage, pPage->aData[0] | PTF_LEAF);
  }

cleardatabasepage_out:
  releasePage(pPage);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl %esi, 0x3c(%rdi)
jae 0x2eb20
movl $0xde85, %edi           # imm = 0xDE85
callq 0x1a1fc
pushq $0xb
popq %r13
jmp 0x2ec0b
movq %rcx, %r14
movl %edx, %ebx
movq %rdi, %r12
leaq -0x48(%rbp), %rdx
xorl %ecx, %ecx
callq 0x2bd80
movl %eax, %r13d
testl %eax, %eax
jne 0x2ec0b
movq %r14, -0x38(%rbp)
movl %ebx, -0x3c(%rbp)
movq -0x48(%rbp), %rbx
xorl %r15d, %r15d
movzwl 0x10(%rbx), %eax
cmpq %rax, %r15
jae 0x2ebaf
movzwl 0x12(%rbx), %eax
movq 0x60(%rbx), %rcx
movzbl (%rcx,%r15,2), %edx
shll $0x8, %edx
movzbl 0x1(%rcx,%r15,2), %r14d
orl %edx, %r14d
andl %eax, %r14d
addq 0x50(%rbx), %r14
cmpb $0x0, 0x3(%rbx)
jne 0x2eb98
movq %r14, %rdi
callq 0x180a3
movq %r12, %rdi
movl %eax, %esi
pushq $0x1
popq %rdx
movq -0x38(%rbp), %rcx
callq 0x2eaf7
testl %eax, %eax
jne 0x2ebaa
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2c290
incq %r15
testl %eax, %eax
je 0x2eb4c
movl %eax, %r13d
jmp 0x2ec03
andl $0x0, -0x2c(%rbp)
cmpb $0x0, 0x3(%rbx)
je 0x2ebc6
movq -0x38(%rbp), %rcx
testq %rcx, %rcx
je 0x2ebeb
addl %eax, (%rcx)
jmp 0x2ebeb
movq 0x50(%rbx), %rdi
addq $0x8, %rdi
callq 0x180a3
pushq $0x1
popq %rdx
movq %r12, %rdi
movl %eax, %esi
movq -0x38(%rbp), %rcx
callq 0x2eaf7
movl %eax, -0x2c(%rbp)
testl %eax, %eax
jne 0x2ebaa
cmpl $0x0, -0x3c(%rbp)
je 0x2ec1d
leaq -0x2c(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2e26e
movl (%r14), %r13d
movq %rbx, %rdi
callq 0x1d90e
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x68(%rbx), %rdi
callq 0xd10b
testl %eax, %eax
jne 0x2ebaa
movq 0x50(%rbx), %rax
movzbl (%rax), %esi
orl $0x8, %esi
movq %rbx, %rdi
callq 0x1db70
xorl %r13d, %r13d
jmp 0x2ec03
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
pushq $0x7
popq %r12
cmpb $0x0, 0x50(%r14)
jne 0x2ecc9
testb $0x1, 0x2e(%r14)
jne 0x2ecb4
movq %rdx, %r15
testq %rsi, %rsi
leaq 0x3ccc5(%rip), %rcx     # 0x6b936
cmovneq %rsi, %rcx
movq 0x8(%rbx), %rdi
leaq 0x3d3cd(%rip), %rdx     # 0x6c04d
movq %r14, %rsi
xorl %eax, %eax
callq 0x20d5f
testq %r15, %r15
je 0x2ecb4
movq 0x8(%rbx), %rax
movq (%rax), %rcx
leaq 0x3d3cf(%rip), %rdx     # 0x6c06c
movq %r14, %rdi
movq %rcx, %rsi
movq %r15, %r8
xorl %eax, %eax
callq 0x2ee1d
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
cmpb $0x0, 0x50(%r14)
jne 0x2ecc9
movl $0x1757b, %edi          # imm = 0x1757B
callq 0x1a1fc
pushq $0xb
popq %r12
movl %r12d, 0x14(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, %r15
movq %rsi, -0x38(%rbp)
movq %rsi, %rdi
callq 0x8f8e
movl %eax, -0x2c(%rbp)
movl 0x28(%r15), %r13d
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
xorl %r14d, %r14d
xorl %eax, %eax
cmpl %r14d, %r13d
je 0x2ed86
cmpl $0x2, %r14d
setb %al
xorl %r14d, %eax
movq 0x20(%r15), %rcx
shlq $0x5, %rax
movq 0x18(%rcx,%rax), %r12
testq %rbx, %rbx
je 0x2ed69
addq %rax, %rcx
movq (%rcx), %rsi
movq %rbx, %rdi
callq 0xb1bf
testl %eax, %eax
jne 0x2ed81
addq $0x20, %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0x2eeba
testq %rax, %rax
jne 0x2ed86
incl %r14d
jmp 0x2ed34
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2eda6
xorl %edx, %edx
cmpb $0x2d, %cl
sete %dl
negq %rdx
xorl %eax, %eax
xorl %r8d, %r8d
cmpq $0xb, %rax
je 0x2ede8
movzbl -0x1(%rdi,%rax), %r9d
leal -0x30(%r9), %r10d
cmpb $0x9, %r10b
ja 0x2eded
imulq $0xa, %r8, %r8
andl $0xf, %r9d
addq %r8, %r9
incq %rax
movq %r9, %r8
jmp 0x2edbf
movb $0x1, %dil
jmp 0x2edf5
cmpq $0xb, %rax
setae %dil
xorl %eax, %eax
testb %dil, %dil
jne 0x2ee1b
addq %r8, %rdx
cmpq $0x7fffffff, %rdx       # imm = 0x7FFFFFFF
jg 0x2ee1b
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_O2/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 0x2ee73
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 0x174b9
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x968b
movq %r15, %rax
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
cmpq $0x0, 0x10(%rdi)
je 0x2eee6
movq %r14, %rdi
movl %ebx, %esi
callq 0x2ef0d
xorl %edx, %edx
divl (%r15)
movl %edx, %ecx
jmp 0x2eee8
xorl %ecx, %ecx
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x2ef3e
testq %rax, %rax
je 0x2ef00
movq 0x10(%rax), %rax
jmp 0x2ef02
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: strHash
static unsigned int strHash(const char *z, int nKey){
  int h = 0;
  assert( nKey>=0 );
  while( nKey > 0  ){
    h = (h<<3) ^ h ^ sqlite3UpperToLower[(unsigned char)*z++];
    nKey--;
  }
  return h;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
leaq 0x39156(%rip), %rcx     # 0x68070
testl %esi, %esi
jle 0x2ef3c
leal (,%rax,8), %edx
movzbl (%rdi), %r8d
incq %rdi
movzbl (%r8,%rcx), %r8d
xorl %eax, %edx
xorl %r8d, %edx
decl %esi
movl %edx, %eax
jmp 0x2ef1a
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%rdi), %rax
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rax, %rcx
leaq 0x4(%rdi), %rdx
testq %rax, %rax
cmovneq %rcx, %r15
cmovneq %rcx, %rdx
movl (%rdx), %r12d
addq $0x8, %r15
addl $-0x1, %r12d
jae 0x2efa6
movq (%r15), %r15
movl $0x0, %eax
testq %r15, %r15
je 0x2efa8
cmpl %ebx, 0x20(%r15)
jne 0x2ef74
movq 0x18(%r15), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x8f45
movl %eax, %ecx
movq %r15, %rax
testl %ecx, %ecx
jne 0x2ef74
jmp 0x2efa8
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
xorl %esi, %esi
cmpq %rsi, %rcx
je 0x2efe7
movl %edx, 0x4(%rax,%rsi,4)
cmpl $0x6, %edx
adcl $-0x1, %edx
incq %rsi
jmp 0x2efd3
cmpb $0x0, 0x56(%rdi)
je 0x2eff4
movl $0x1, (%rax,%rcx,4)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rsi, -0x38(%rbp)
movq %rsi, %rdi
callq 0x8f8e
movl %eax, -0x2c(%rbp)
movq %r14, -0x40(%rbp)
movl 0x28(%r14), %r12d
xorl %eax, %eax
testl %r12d, %r12d
cmovlel %eax, %r12d
xorl %r13d, %r13d
cmpl %r13d, %r12d
je 0x2f08a
xorl %r14d, %r14d
cmpl $0x2, %r13d
setb %r14b
xorl %r13d, %r14d
movq -0x40(%rbp), %rax
movq 0x20(%rax), %r15
testq %rbx, %rbx
je 0x2f067
movq %r14, %rax
shlq $0x5, %rax
movq (%r15,%rax), %rsi
movq %rbx, %rdi
callq 0xb1bf
testl %eax, %eax
jne 0x2f085
shlq $0x5, %r14
movq 0x18(%r15,%r14), %rdi
addq $0x8, %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0x2eeba
testq %rax, %rax
jne 0x2f08c
incl %r13d
jmp 0x2f030
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_O2/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 0x2f1a4
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq (%rdx), %rsi
testq %rsi, %rsi
je 0x2f196
movq 0x10(%r15), %rbx
testq %rbx, %rbx
je 0x2f196
movq (%rdi), %r13
movq 0x8(%rdi), %r12
movq %r13, %rdi
movq %r12, %rdx
callq 0x2eff6
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x2f196
movq 0x8(%r15), %rsi
movb $0x1, %r14b
testq %rsi, %rsi
je 0x2f116
movq %r13, %rdi
movq %r12, %rdx
callq 0x2ecfe
testq %rax, %rax
je 0x2f116
movq %rax, %r15
movzwl 0x54(%rax), %r13d
xorl %r14d, %r14d
jmp 0x2f11c
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %r12d, %r12d
movb (%rbx), %cl
testb %cl, %cl
je 0x2f196
cmpq %r13, %r12
ja 0x2f196
xorl %eax, %eax
leal -0x30(%rcx), %edx
cmpb $0x9, %dl
ja 0x2f147
movzbl %cl, %ecx
imull $0xa, %eax, %eax
addl %ecx, %eax
addl $-0x30, %eax
movb 0x1(%rbx), %cl
incq %rbx
jmp 0x2f12c
testq %r12, %r12
jne 0x2f168
testb %r14b, %r14b
jne 0x2f158
cmpq $0x0, 0x48(%r15)
jne 0x2f168
testl %eax, %eax
je 0x2f163
movq -0x30(%rbp), %rcx
movl %eax, 0x38(%rcx)
testb %r14b, %r14b
jne 0x2f196
movq 0x10(%r15), %rcx
movl %eax, (%rcx,%r12,4)
xorl %eax, %eax
cmpb $0x20, (%rbx)
sete %al
addq %rax, %rbx
movq %rbx, %rdi
leaq 0x3cf18(%rip), %rsi     # 0x6c09d
callq 0x8510
incq %r12
testl %eax, %eax
jne 0x2f11f
orb $0x4, 0x57(%r15)
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_O2/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 0x2f427
movl (%rsi), %ecx
testl %ecx, %ecx
je 0x2f3f6
movq 0x8(%rsi), %rax
jmp 0x2f3f8
xorl %eax, %eax
incl %ecx
movl %ecx, (%rsi)
movq %rdx, 0x8(%rsi)
testq %rax, %rax
je 0x2f427
movq %rax, (%rdx)
movq 0x8(%rax), %rcx
addq $0x8, %rax
movq %rcx, 0x8(%rdx)
addq $0x8, %rdi
testq %rcx, %rcx
cmovneq %rcx, %rdi
movq %rdx, (%rdi)
movq %rax, %rdi
jmp 0x2f440
movq 0x8(%rdi), %rax
movq %rax, (%rdx)
testq %rax, %rax
je 0x2f437
movq %rdx, 0x8(%rax)
addq $0x8, %rdi
andq $0x0, 0x8(%rdx)
movq %rdx, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2f476
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x968b
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x968b
// File: /workspace/github_c_makefile_star2_O2/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 0x2f4fb
movq %rsi, %rbx
movq %rdi, %r14
movzwl 0x2(%rsi), %eax
btl $0xe, %eax
jb 0x2f4e7
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x2f476
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x2f476
movzwl 0x2(%rbx), %eax
btl $0xd, %eax
jb 0x2f4ca
testb $0x1, 0x36(%rbx)
je 0x2f4ca
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x968b
movzwl 0x2(%rbx), %eax
btl $0xb, %eax
movq 0x20(%rbx), %rsi
movq %r14, %rdi
jb 0x2f4de
callq 0x2f527
jmp 0x2f4e3
callq 0x2f500
movzwl 0x2(%rbx), %eax
testw %ax, %ax
js 0x2f4fb
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x968b
popq %rbx
popq %r14
popq %rbp
retq