LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VtabCallDestroy
SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){
  int rc = SQLITE_OK;
  Table *pTab;

  pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
  if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){
    VTable *p = vtabDisconnectAll(db, pTab);

    assert( rc==SQLITE_OK );
    rc = p->pMod->pModule->xDestroy(p->pVtab);

    /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
    if( rc==SQLITE_OK ){
      assert( pTab->pVTable==p && p->pNext==0 );
      p->pVtab = 0;
      pTab->pVTable = 0;
      sqlite3VtabUnlock(p);
    }
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movq 0x20(%rdi), %rax
movslq %esi, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rax
movq %rdx, %rsi
movq %rax, %rdx
callq 0x341ce
xorl %r12d, %r12d
testq %rax, %rax
je 0x303cb
movq %rax, %rbx
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x303cb
addq $0x58, %rbx
movq $0x0, (%rbx)
xorl %r15d, %r15d
movq (%rax), %rcx
cmpq %r14, %rcx
je 0x30389
movq 0x1d0(%rcx), %rdx
addq $0x1d0, %rcx            # imm = 0x1D0
jmp 0x30391
movq %rbx, %rcx
xorl %edx, %edx
movq %rax, %r15
movq 0x28(%rax), %rsi
movq %rax, (%rcx)
movq %rdx, 0x28(%rax)
movq %rsi, %rax
testq %rsi, %rsi
jne 0x30371
movq 0x8(%r15), %rax
movq 0x10(%r15), %rdi
movq (%rax), %rax
callq *0x28(%rax)
movl %eax, %r12d
testl %eax, %eax
jne 0x303cb
xorl %r12d, %r12d
movq %r12, 0x10(%r15)
movq %r12, (%rbx)
movq %r15, %rdi
callq 0x22dc8
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreeRestoreCursorPosition
static int btreeRestoreCursorPosition(BtCursor *pCur){
  int rc;
  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState>=CURSOR_REQUIRESEEK );
  if( pCur->eState==CURSOR_FAULT ){
    return pCur->skipNext;
  }
  pCur->eState = CURSOR_INVALID;
  rc = btreeMoveto(pCur, pCur->pKey, pCur->nKey, 0, &pCur->skipNext);
  if( rc==SQLITE_OK ){
    sqlite3_free(pCur->pKey);
    pCur->pKey = 0;
    assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID );
    if( pCur->skipNext && pCur->eState==CURSOR_VALID ){
      pCur->eState = CURSOR_SKIPNEXT;
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x4, 0x77(%rdi)
jne 0x30749
movl 0x70(%rbx), %eax
jmp 0x3078a
movb $0x0, 0x77(%rbx)
movq 0x60(%rbx), %rdx
movq 0x68(%rbx), %rsi
leaq 0x70(%rbx), %r8
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x30791
testl %eax, %eax
jne 0x3078a
movq 0x68(%rbx), %rdi
callq 0xa3c7
movq $0x0, 0x68(%rbx)
cmpl $0x0, 0x70(%rbx)
je 0x30788
cmpb $0x1, 0x77(%rbx)
jne 0x30788
movb $0x2, 0x77(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreeMoveto
static int btreeMoveto(
  BtCursor *pCur,     /* Cursor open on the btree to be searched */
  const void *pKey,   /* Packed key if the btree is an index */
  i64 nKey,           /* Integer key for tables.  Size of pKey for indices */
  int bias,           /* Bias search to the high end */
  int *pRes           /* Write search results here */
){
  int rc;                    /* Status code */
  UnpackedRecord *pIdxKey;   /* Unpacked index key */
  char aSpace[150];          /* Temp space for pIdxKey - to avoid a malloc */
  char *pFree = 0;

  if( pKey ){
    assert( nKey==(i64)(int)nKey );
    pIdxKey = sqlite3VdbeAllocUnpackedRecord(
        pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree
    );
    if( pIdxKey==0 ) return SQLITE_NOMEM;
    sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey);
  }else{
    pIdxKey = 0;
  }
  rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);
  if( pFree ){
    sqlite3DbFree(pCur->pKeyInfo->db, pFree);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %ecx, %r15d
movq %rdx, %r12
movq %rdi, %rbx
movq $0x0, -0x30(%rbp)
testq %rsi, %rsi
je 0x30827
movq %rsi, %r13
movq %r8, -0x38(%rbp)
movq 0x20(%rbx), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x30(%rbp), %rcx
movl $0x96, %edx
callq 0x2dd4f
testq %rax, %rax
je 0x30848
movq %rax, %r14
movq 0x20(%rbx), %rdi
movl %r12d, %esi
movq %r13, %rdx
movq %rax, %rcx
callq 0x2ddb2
movq -0x30(%rbp), %r13
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movl %r15d, %ecx
movq -0x38(%rbp), %r8
callq 0x2d79a
movl %eax, %r14d
testq %r13, %r13
je 0x3084e
movq 0x20(%rbx), %rax
movq (%rax), %rdi
movq %r13, %rsi
callq 0x9ca4
jmp 0x3084e
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
movl %r15d, %ecx
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d79a
movl $0x7, %r14d
movl %r14d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: fetchPayload
static const unsigned char *fetchPayload(
  BtCursor *pCur,      /* Cursor pointing to entry to read from */
  int *pAmt,           /* Write the number of available bytes here */
  int skipKey          /* read beginning at data if this is true */
){
  unsigned char *aPayload;
  MemPage *pPage;
  u32 nKey;
  u32 nLocal;

  assert( pCur!=0 && pCur->iPage>=0 && pCur->apPage[pCur->iPage]);
  assert( pCur->eState==CURSOR_VALID );
  assert( cursorHoldsMutex(pCur) );
  pPage = pCur->apPage[pCur->iPage];
  assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );
  if( NEVER(pCur->info.nSize==0) ){
    btreeParseCell(pCur->apPage[pCur->iPage], pCur->aiIdx[pCur->iPage],
                   &pCur->info);
  }
  aPayload = pCur->info.pCell;
  aPayload += pCur->info.nHeader;
  if( pPage->intKey ){
    nKey = 0;
  }else{
    nKey = (int)pCur->info.nKey;
  }
  if( skipKey ){
    aPayload += nKey;
    nLocal = pCur->info.nLocal - nKey;
  }else{
    nLocal = pCur->info.nLocal;
    assert( nLocal<=nKey );
  }
  *pAmt = nLocal;
  return aPayload;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movswq 0x7a(%rdi), %rax
movq 0xa8(%rdi,%rax,8), %r13
leaq 0x40(%rdi), %r12
cmpw $0x0, 0x5e(%rdi)
jne 0x308c0
movzwl 0x7c(%r14,%rax,2), %eax
movzwl 0x12(%r13), %ecx
movq 0x60(%r13), %rdx
movzbl (%rdx,%rax,2), %edi
shll $0x8, %edi
movzbl 0x1(%rdx,%rax,2), %esi
orl %edi, %esi
andl %ecx, %esi
addq 0x50(%r13), %rsi
movq %r13, %rdi
movq %r12, %rdx
callq 0x2121e
movzwl 0x58(%r14), %eax
xorl %ecx, %ecx
cmpb $0x0, 0x2(%r13)
jne 0x308d2
movl (%r12), %ecx
addq 0x48(%r14), %rax
testl %r15d, %r15d
je 0x308e9
movl %ecx, %edx
addq %rdx, %rax
movzwl 0x5a(%r14), %edx
subl %ecx, %edx
jmp 0x308ee
movzwl 0x5a(%r14), %edx
movl %edx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PutVarint
SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){
  int i, j, n;
  u8 buf[10];
  if( v & (((u64)0xff000000)<<32) ){
    p[8] = (u8)v;
    v >>= 8;
    for(i=7; i>=0; i--){
      p[i] = (u8)((v & 0x7f) | 0x80);
      v >>= 7;
    }
    return 9;
  }    
  n = 0;
  do{
    buf[n++] = (u8)((v & 0x7f) | 0x80);
    v >>= 7;
  }while( v!=0 );
  buf[0] &= 0x7f;
  assert( n<=9 );
  for(i=0, j=n-1; j>=0; j--, i++){
    p[i] = buf[j];
  }
  return n;
}

// Assembly:
movq %rsi, %rax
shrq $0x38, %rax
jne 0x3094a
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
movq %rsi, %rcx
movl %esi, %edx
orb $-0x80, %dl
movb %dl, -0xa(%rbp,%rax)
incq %rax
shrq $0x7, %rcx
cmpq $0x7f, %rsi
movq %rcx, %rsi
ja 0x30911
andb $0x7f, -0xa(%rbp)
leaq 0x1(%rax), %rcx
movq %rax, %rdx
movb -0xc(%rbp,%rcx), %sil
movb %sil, (%rdi)
incq %rdi
decq %rcx
decq %rdx
jne 0x30935
popq %rbp
retq
movb %sil, 0x8(%rdi)
shrq $0x8, %rsi
movl $0x8, %eax
movl %esi, %ecx
orb $-0x80, %cl
movb %cl, -0x1(%rdi,%rax)
shrq $0x7, %rsi
decq %rax
jne 0x30957
movl $0x9, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: moveToChild
static int moveToChild(BtCursor *pCur, u32 newPgno){
  int rc;
  int i = pCur->iPage;
  MemPage *pNewPage;
  BtShared *pBt = pCur->pBt;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  assert( pCur->iPage<BTCURSOR_MAX_DEPTH );
  assert( pCur->iPage>=0 );
  if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){
    return SQLITE_CORRUPT_BKPT;
  }
  rc = getAndInitPage(pBt, newPgno, &pNewPage,
               pCur->wrFlag==0 ? PAGER_GET_READONLY : 0);
  if( rc ) return rc;
  pCur->apPage[i+1] = pNewPage;
  pCur->aiIdx[i+1] = 0;
  pCur->iPage++;

  pCur->info.nSize = 0;
  pCur->validNKey = 0;
  if( pNewPage->nCell<1 || pNewPage->intKey!=pCur->apPage[i]->intKey ){
    return SQLITE_CORRUPT_BKPT;
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movswq 0x7a(%rdi), %r15
movl $0xd26b, %edx           # imm = 0xD26B
cmpq $0x12, %r15
jle 0x30b5e
leaq 0x48cd1(%rip), %rsi     # 0x79814
leaq 0x489ef(%rip), %rcx     # 0x79539
movl $0xb, %r14d
movl $0xb, %edi
xorl %eax, %eax
callq 0xb9c7
jmp 0x30b80
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
xorl %ecx, %ecx
cmpb $0x0, 0x74(%rbx)
sete %cl
addl %ecx, %ecx
leaq -0x20(%rbp), %rdx
callq 0x30bd2
movl %eax, %r14d
testl %eax, %eax
je 0x30b8e
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq -0x20(%rbp), %rax
movq %rax, 0xb0(%rbx,%r15,8)
xorl %r14d, %r14d
movw %r14w, 0x7e(%rbx,%r15,2)
incw 0x7a(%rbx)
movw %r14w, 0x5e(%rbx)
movb $0x0, 0x76(%rbx)
movl $0xd277, %edx           # imm = 0xD277
cmpw %r14w, 0x10(%rax)
je 0x30b3c
movb 0x2(%rax), %al
movq 0xa8(%rbx,%r15,8), %rcx
cmpb 0x2(%rcx), %al
jne 0x30b3c
jmp 0x30b80
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: getAndInitPage
static int getAndInitPage(
  BtShared *pBt,                  /* The database file */
  Pgno pgno,                      /* Number of the page to get */
  MemPage **ppPage,               /* Write the page pointer here */
  int bReadonly                   /* PAGER_GET_READONLY or 0 */
){
  int rc;
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( bReadonly==PAGER_GET_READONLY || bReadonly==0 );

  if( pgno>btreePagecount(pBt) ){
    rc = SQLITE_CORRUPT_BKPT;
  }else{
    rc = btreeGetPage(pBt, pgno, ppPage, bReadonly);
    if( rc==SQLITE_OK ){
      rc = btreeInitPage(*ppPage);
      if( rc!=SQLITE_OK ){
        releasePage(*ppPage);
      }
    }
  }

  testcase( pgno==0 );
  assert( pgno!=0 || rc==SQLITE_CORRUPT );
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpl %esi, 0x3c(%rdi)
jae 0x30c04
leaq 0x48c2f(%rip), %rsi     # 0x79814
leaq 0x4894d(%rip), %rcx     # 0x79539
movl $0xb, %ebx
movl $0xb, %edi
movl $0xc81c, %edx           # imm = 0xC81C
xorl %eax, %eax
callq 0xb9c7
jmp 0x30c12
movq %rdx, %r14
callq 0x20068
movl %eax, %ebx
testl %eax, %eax
je 0x30c19
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq (%r14), %rdi
callq 0x1c99b
testl %eax, %eax
je 0x30c3a
movl %eax, %ebx
movq (%r14), %rax
testq %rax, %rax
je 0x30c12
movq 0x68(%rax), %rdi
callq 0xddd3
jmp 0x30c12
xorl %ebx, %ebx
jmp 0x30c12
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3SchemaClear
SQLITE_PRIVATE void sqlite3SchemaClear(void *p){
  Hash temp1;
  Hash temp2;
  HashElem *pElem;
  Schema *pSchema = (Schema *)p;

  temp1 = pSchema->tblHash;
  temp2 = pSchema->trigHash;
  sqlite3HashInit(&pSchema->trigHash);
  sqlite3HashClear(&pSchema->idxHash);
  for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){
    sqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem));
  }
  sqlite3HashClear(&temp2);
  sqlite3HashInit(&pSchema->tblHash);
  for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
    Table *pTab = sqliteHashData(pElem);
    sqlite3DeleteTable(0, pTab);
  }
  sqlite3HashClear(&temp1);
  sqlite3HashClear(&pSchema->fkeyHash);
  pSchema->pSeqTab = 0;
  if( pSchema->flags & DB_SchemaLoaded ){
    pSchema->iGeneration++;
    pSchema->flags &= ~DB_SchemaLoaded;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movups 0x8(%rdi), %xmm0
movaps %xmm0, -0x50(%rbp)
movq 0x18(%rdi), %rax
movq %rax, -0x40(%rbp)
movq 0x48(%rdi), %rax
movq %rax, -0x20(%rbp)
movups 0x38(%rdi), %xmm0
movaps %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rdi)
movq $0x0, 0x48(%rdi)
addq $0x20, %rdi
callq 0x30d0d
movq -0x28(%rbp), %r15
testq %r15, %r15
je 0x30ca3
movq 0x10(%r15), %rsi
xorl %edi, %edi
callq 0x991b
movq (%r15), %r15
jmp 0x30c8e
leaq -0x30(%rbp), %rdi
callq 0x30d0d
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movq -0x48(%rbp), %r14
testq %r14, %r14
je 0x30cd4
movq 0x10(%r14), %rsi
xorl %edi, %edi
callq 0x9975
movq (%r14), %r14
jmp 0x30cbf
leaq -0x50(%rbp), %rdi
callq 0x30d0d
leaq 0x50(%rbx), %rdi
callq 0x30d0d
movq $0x0, 0x68(%rbx)
movzwl 0x72(%rbx), %eax
testb $0x1, %al
je 0x30d02
incl 0x4(%rbx)
andl $0xfffe, %eax           # imm = 0xFFFE
movw %ax, 0x72(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3HashClear
SQLITE_PRIVATE void sqlite3HashClear(Hash *pH){
  HashElem *elem;         /* For looping over all elements of the table */

  assert( pH!=0 );
  elem = pH->first;
  pH->first = 0;
  sqlite3_free(pH->ht);
  pH->ht = 0;
  pH->htsize = 0;
  while( elem ){
    HashElem *next_elem = elem->next;
    sqlite3_free(elem);
    elem = next_elem;
  }
  pH->count = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq 0x10(%rdi), %rdi
xorl %r15d, %r15d
movq %r15, 0x8(%rbx)
callq 0xa3c7
movq %r15, 0x10(%rbx)
movl $0x0, (%rbx)
testq %r14, %r14
je 0x30d50
movq (%r14), %r15
movq %r14, %rdi
callq 0xa3c7
movq %r15, %r14
testq %r15, %r15
jne 0x30d3d
movl $0x0, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: moveToLeftmost
static int moveToLeftmost(BtCursor *pCur){
  Pgno pgno;
  int rc = SQLITE_OK;
  MemPage *pPage;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  while( rc==SQLITE_OK && !(pPage = pCur->apPage[pCur->iPage])->leaf ){
    assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );
    pgno = get4byte(findCell(pPage, pCur->aiIdx[pCur->iPage]));
    rc = moveToChild(pCur, pgno);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movswq 0x7a(%rbx), %rax
movq 0xa8(%rbx,%rax,8), %rcx
cmpb $0x0, 0x3(%rcx)
jne 0x30db2
movzwl 0x12(%rcx), %edx
movq 0x50(%rcx), %rsi
movq 0x60(%rcx), %rcx
movzwl 0x7c(%rbx,%rax,2), %eax
movzbl (%rcx,%rax,2), %edi
shll $0x8, %edi
movzbl 0x1(%rcx,%rax,2), %eax
orl %edi, %eax
andl %edx, %eax
movl (%rsi,%rax), %esi
bswapl %esi
movq %rbx, %rdi
callq 0x30b22
testl %eax, %eax
je 0x30d6b
jmp 0x30db4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: moveToRightmost
static int moveToRightmost(BtCursor *pCur){
  Pgno pgno;
  int rc = SQLITE_OK;
  MemPage *pPage = 0;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  while( rc==SQLITE_OK && !(pPage = pCur->apPage[pCur->iPage])->leaf ){
    pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
    pCur->aiIdx[pCur->iPage] = pPage->nCell;
    rc = moveToChild(pCur, pgno);
  }
  if( rc==SQLITE_OK ){
    pCur->aiIdx[pCur->iPage] = pPage->nCell-1;
    pCur->info.nSize = 0;
    pCur->validNKey = 0;
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movswq 0x7a(%rbx), %rax
movq 0xa8(%rbx,%rax,8), %rcx
cmpb $0x0, 0x3(%rcx)
jne 0x30dfc
movq 0x50(%rcx), %rdx
movzbl 0x5(%rcx), %esi
movl 0x8(%rdx,%rsi), %esi
bswapl %esi
movzwl 0x10(%rcx), %ecx
movw %cx, 0x7c(%rbx,%rax,2)
movq %rbx, %rdi
callq 0x30b22
testl %eax, %eax
je 0x30dc4
jmp 0x30e12
movl 0x10(%rcx), %ecx
decl %ecx
movw %cx, 0x7c(%rbx,%rax,2)
movw $0x0, 0x5e(%rbx)
movb $0x0, 0x76(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x31019
cmpb $0x0, 0x4(%r15)
je 0x3102a
movsbl (%rbx), %eax
testl %eax, %eax
js 0x31033
movl %eax, -0x1c(%rbp)
movl $0x1, %eax
jmp 0x31042
movsbl (%rbx), %eax
testl %eax, %eax
js 0x3105f
movl %eax, -0x1c(%rbp)
movl $0x1, %eax
jmp 0x3106e
movl $0x0, -0x1c(%rbp)
jmp 0x31045
leaq -0x1c(%rbp), %rsi
movq %rbx, %rdi
callq 0x2134f
movzbl %al, %eax
addq %rax, %rbx
xorl %eax, %eax
leaq 0x1(%rax), %rcx
cmpq $0x7, %rax
ja 0x3105a
cmpb $0x0, (%rbx,%rax)
movq %rcx, %rax
js 0x31047
addq %rcx, %rbx
jmp 0x31071
leaq -0x1c(%rbp), %rsi
movq %rbx, %rdi
callq 0x2134f
movzbl %al, %eax
addq %rax, %rbx
movl -0x1c(%rbp), %eax
movzwl 0x8(%r15), %ecx
cmpl %ecx, %eax
jbe 0x3109e
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
movl $0x4, %eax
cmovael %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq 0x110(%rax), %rdi
leaq -0x28(%rbp), %r12
movq $0x0, (%r12)
xorl %ebx, %ebx
xorl %edx, %edx
movq %r12, %rcx
callq 0x1f4e2
movq (%r12), %rax
testq %rax, %rax
je 0x32d80
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_O3/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 %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq 0x58(%rdi), %rdi
testq %rdi, %rdi
jne 0x3304d
movl 0x3c(%r14), %edi
callq 0x1b61e
movq %rax, %rdi
movq %rax, 0x58(%r14)
testq %rax, %rax
je 0x3305e
xorl %eax, %eax
cmpl %ebx, (%rdi)
jb 0x33063
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x1b472
movl $0x7, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x3321c
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 0x1c99b
testl %eax, %eax
jne 0x332b8
movq -0x30(%rbp), %rax
cmpb $0x0, 0x21(%rax)
je 0x332ba
movq %r14, %rdi
callq 0x22623
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_O3/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, %r15
movq %rdx, %r14
movl %esi, %edx
movq 0x48(%rdi), %rax
movq 0x50(%rdi), %rbx
movzbl 0x5(%rdi), %ecx
movq %rcx, -0x50(%rbp)
movl 0x34(%rax), %esi
leal (%rdx,%rdx), %r9d
testl %edx, %edx
jle 0x3337b
movq %rdi, -0x40(%rbp)
movq 0x60(%rdi), %rax
movl %r9d, -0x2c(%rbp)
movl %r9d, %ecx
movq %rdx, -0x48(%rbp)
movl %edx, %r13d
incq %r13
movq %rbx, -0x38(%rbp)
leaq (%rcx,%rax), %rbx
decq %rbx
movl %esi, -0x30(%rbp)
movl %esi, %r12d
movzwl -0x4(%r15,%r13,2), %edx
movslq %r12d, %r12
subq %rdx, %r12
movl %r12d, %eax
rolw $0x8, %ax
movw %ax, -0x1(%rbx)
movq -0x38(%rbp), %rax
leaq (%rax,%r12), %rdi
movq -0x10(%r14,%r13,8), %rsi
callq 0x82f0
decq %r13
addq $-0x2, %rbx
cmpq $0x1, %r13
ja 0x33327
movl %r12d, %eax
shrl $0x8, %eax
movl %r12d, %r8d
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rdi
movl -0x30(%rbp), %esi
movq -0x38(%rbp), %rbx
movl -0x2c(%rbp), %r9d
jmp 0x33386
movl %esi, %eax
shrl $0x8, %eax
movl %esi, %r8d
movl %esi, %r12d
movq -0x50(%rbp), %rcx
movb %dh, 0x3(%rbx,%rcx)
movb %dl, 0x4(%rbx,%rcx)
movb %al, 0x5(%rbx,%rcx)
movb %r8b, 0x6(%rbx,%rcx)
addl %r9d, %esi
subl %esi, %r12d
addw %r12w, 0xe(%rdi)
movw %dx, 0x10(%rdi)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r8d, %r14d
movq %rcx, %rbx
movl %edx, %r13d
movq %rsi, %r15
movq %rdi, %r12
testq %r9, %r9
je 0x333ec
movl 0x10(%rbp), %esi
movq %r12, %rdi
movq %r9, %rdx
movq %r15, %rcx
callq 0x2ddb2
movq 0x18(%rbp), %rsi
testl %r13d, %r13d
je 0x33424
movzwl 0xa(%r12), %ecx
movw %cx, 0x8(%r15)
testq %rcx, %rcx
je 0x3341f
movq 0x18(%r15), %rax
imulq $0x38, %rcx, %rcx
xorl %edx, %edx
testb $0x1, 0x24(%rax,%rdx)
jne 0x33449
addq $0x38, %rdx
cmpq %rdx, %rcx
jne 0x3340f
orb $0x2, 0xa(%r15)
movl %r14d, %edi
movq %rsi, %r14
movq %rbx, %rsi
movq %r15, %rdx
callq 0x30e19
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 0x33438
// File: /workspace/github_c_makefile_star2_O3/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), %r15
cmpl $0x0, 0x60f91(%rip)     # 0x94400
je 0x33487
leaq -0x30(%rbp), %r14
movl $0x200, %edi            # imm = 0x200
movq %r14, %rsi
callq 0x171f8
movq (%r14), %r12
jmp 0x33495
movl $0x200, %edi            # imm = 0x200
callq *0x60f8e(%rip)          # 0x94420
movq %rax, %r12
testq %r12, %r12
je 0x33555
movl $0x200, %edx            # imm = 0x200
movq %r12, %rdi
xorl %esi, %esi
callq 0x8200
movq %r15, -0x38(%rbp)
movq 0x40(%r15), %r13
movq %r13, -0x30(%rbp)
testq %r13, %r13
je 0x33513
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 0x33507
movq %r12, %r14
movq -0x30(%rbp), %rsi
movq %rbx, %rdi
movq %r15, %rcx
callq 0x337ea
movq $0x0, (%r14)
movq 0x8(%r14), %rdx
addq $0x8, %r14
testq %rdx, %rdx
jne 0x334e0
movq -0x30(%rbp), %rax
movq %rax, (%r14)
movq %r13, -0x30(%rbp)
testq %r13, %r13
jne 0x334c2
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 0x337ea
incq %r14
cmpq $0x40, %r14
jne 0x33521
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rax, 0x40(%rcx)
movq %r12, %rdi
callq 0xa3c7
xorl %eax, %eax
jmp 0x3355a
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_O3/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
cmpl $0x0, 0x10(%rbx)
je 0x335f8
movq %rdi, %r14
movq %rsi, %rdi
callq 0x33450
testl %eax, %eax
jne 0x336bd
movq 0x38(%rbx), %r13
testq %r13, %r13
je 0x335ff
movq (%rbx), %r15
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 0x11721
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x33629
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 0x33630
xorl %eax, %eax
jmp 0x336bd
leaq 0x38(%rbx), %r15
movq (%r14), %rdi
leaq -0x60(%rbp), %r8
xorl %esi, %esi
movq %r15, %rdx
movl $0x101e, %ecx           # imm = 0x101E
callq 0x241c9
testl %eax, %eax
jne 0x336bd
movq (%r15), %r13
jmp 0x335a0
movl $0x7, -0x60(%rbp)
incl 0x18(%rbx)
movslq 0x10(%rbx), %rsi
leaq -0x72(%rbp), %r15
movq %r15, %rdi
callq 0x308ff
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x336cc
movq %rbx, -0x68(%rbp)
movq 0x40(%rbx), %r15
testq %r15, %r15
je 0x336a5
leaq -0x72(%rbp), %r12
leaq -0x60(%rbp), %r13
movq 0x10(%r15), %rbx
movslq 0x8(%r15), %rsi
movq %r12, %rdi
callq 0x308ff
movq %r13, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x336cc
movq (%r15), %rsi
movl 0x8(%r15), %edx
movq %r13, %rdi
callq 0x336cc
movq %r14, %rdi
movq %r15, %rsi
callq 0x9ca4
movq %rbx, %r15
testq %rbx, %rbx
jne 0x33666
movq -0x68(%rbp), %rdx
movq $0x0, 0x40(%rdx)
leaq -0x60(%rbp), %rsi
movq %r14, %rdi
callq 0x33775
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x33766
movl %edx, %ebx
movq %rdi, %r15
movl %edx, %r13d
cmpl $0x0, (%r15)
jne 0x33766
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 0x33761
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 0x336ee
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x337bf
movslq 0x18(%rbx), %rax
addq 0x20(%rbx), %rax
movq %rax, (%r15)
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x9ca4
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 0x3378d
movl 0x18(%rbx), %edx
movslq 0x14(%rbx), %rcx
cmpl %ecx, %edx
jle 0x3378d
movq 0x28(%rbx), %rdi
addq %rcx, %rsi
subl %ecx, %edx
addq 0x20(%rbx), %rcx
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, (%rbx)
jmp 0x3378d
// File: /workspace/github_c_makefile_star2_O3/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, -0x48(%rbp)
leaq -0x40(%rbp), %rcx
movq $0x0, (%rcx)
testq %rdx, %rdx
je 0x338b5
movq %rdx, %r12
testq %rsi, %rsi
je 0x338b9
movq %rdi, %r14
movq (%r12), %rdx
movq %rdi, -0x50(%rbp)
movq %rcx, -0x30(%rbp)
movq (%rsi), %r13
movq %rsi, -0x38(%rbp)
movl 0x8(%rsi), %ebx
movq 0x58(%r14), %rax
movq 0x48(%rax), %r15
testq %rdx, %rdx
je 0x33856
movq 0x10(%r14), %rdi
movl 0x8(%r12), %esi
movq %r15, %rcx
callq 0x2ddb2
movl %ebx, %edi
movq %r13, %rsi
movq %r15, %rdx
callq 0x30e19
testl %eax, %eax
jle 0x33885
movq -0x30(%rbp), %rax
movq %r12, (%rax)
movq 0x10(%r12), %rax
addq $0x10, %r12
testq %rax, %rax
movq -0x38(%rbp), %rsi
je 0x338be
movq (%rax), %rdx
jmp 0x338a0
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rax
movq %rdx, (%rax)
movq 0x10(%rdx), %rsi
movq %r12, %rax
movq %rdx, %r12
addq $0x10, %r12
xorl %edx, %edx
movq %r12, %rcx
movq %rax, %r12
testq %rsi, %rsi
movq -0x50(%rbp), %r14
jne 0x3382a
jmp 0x338c3
xorl %eax, %eax
jmp 0x338c3
movq %r12, %rax
jmp 0x338c3
xorl %eax, %eax
movq %r12, %rcx
testq %rsi, %rsi
cmovneq %rsi, %rax
movq %rax, (%rcx)
movq -0x40(%rbp), %rax
movq -0x48(%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_O3/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), %r12
movl 0x14(%r12), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl %esi, %eax
movl %esi, %r13d
subl %ecx, %eax
jge 0x33924
movq 0x30(%r12), %rax
addl %esi, %esi
movl (%rax,%rsi,4), %ebx
movl 0x4(%rax,%r13,8), %r14d
jmp 0x33930
movl %eax, %ebx
addl %eax, %ebx
leal 0x1(,%rax,2), %r14d
movq 0x28(%r12), %rcx
movslq %ebx, %rdx
shlq $0x6, %rdx
cmpq $0x0, 0x18(%rcx,%rdx)
je 0x3399f
movslq %r14d, %rax
shlq $0x6, %rax
addq %rcx, %rax
cmpq $0x0, 0x18(%rax)
je 0x3399c
addq %rdx, %rcx
movq 0x28(%rcx), %rsi
movl 0x14(%rcx), %ecx
movq 0x28(%rax), %rdx
movq 0x48(%r12), %r15
testq %rdx, %rdx
je 0x3398a
movq 0x10(%rdi), %rdi
movq %rsi, -0x38(%rbp)
movl 0x14(%rax), %esi
movl %ecx, -0x2c(%rbp)
movq %r15, %rcx
callq 0x2ddb2
movl -0x2c(%rbp), %ecx
movq -0x38(%rbp), %rsi
movl %ecx, %edi
movq %r15, %rdx
callq 0x30e19
testl %eax, %eax
cmovlel %ebx, %r14d
jmp 0x3399f
movl %ebx, %r14d
movq 0x30(%r12), %rax
movl %r14d, (%rax,%r13,4)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x33a06
addq 0x30(%rbx), %rdx
movq %rdx, %rdi
movq %r14, %rsi
callq 0x213be
movzbl %al, %eax
addq %rax, (%rbx)
jmp 0x33a4d
movq %rdi, %r15
xorl %r13d, %r13d
leaq -0x30(%rbp), %r12
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1, %edx
movq %r12, %rcx
callq 0x33ae2
testl %eax, %eax
jne 0x33a4f
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 0x33a10
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x213be
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_O3/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 0x33aad
leaq -0x18(%rbp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x339b7
testl %eax, %eax
jne 0x33ad9
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 0x33ae2
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x9ca4
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0x9ca4
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_O3/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 0x174d6
movq %rax, %r15
testq %rax, %rax
jne 0x33c47
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9ca4
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x7, %r12d
cmpb $0x0, 0x50(%r14)
jne 0x33e5c
testb $0x1, 0x2e(%r14)
jne 0x33e30
movq %rdx, %r15
testq %rsi, %rsi
leaq 0x45b29(%rip), %rcx     # 0x79916
cmovneq %rsi, %rcx
movq 0x8(%rbx), %rdi
leaq 0x46231(%rip), %rdx     # 0x7a02d
movq %r14, %rsi
xorl %eax, %eax
callq 0x24129
testq %r15, %r15
je 0x33e30
movq 0x8(%rbx), %rax
movq (%rax), %rcx
leaq 0x46233(%rip), %rdx     # 0x7a04c
movq %r14, %rdi
movq %rcx, %rsi
movq %r15, %r8
xorl %eax, %eax
callq 0x33fcf
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
cmpb $0x0, 0x50(%r14)
jne 0x33e5c
leaq 0x459d6(%rip), %rsi     # 0x79814
leaq 0x456f4(%rip), %rcx     # 0x79539
movl $0xb, %r12d
movl $0xb, %edi
movl $0x1757b, %edx          # imm = 0x1757B
xorl %eax, %eax
callq 0xb9c7
movl %r12d, 0x14(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %rsi, %rbx
testq %rsi, %rsi
je 0x33ea3
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %rbx, %rax
incl %r15d
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x33e8e
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
jmp 0x33ea6
xorl %r15d, %r15d
movl 0x28(%rdi), %ecx
xorl %eax, %eax
movl %ecx, -0x2c(%rbp)
testl %ecx, %ecx
jle 0x33f4c
movq 0x20(%rdi), %r11
leaq 0x1(%r12), %rax
movq %rax, -0x38(%rbp)
leaq 0x421e6(%rip), %r14     # 0x760b0
xorl %r13d, %r13d
movq %r11, -0x40(%rbp)
xorl %eax, %eax
cmpl $0x2, %r13d
setb %al
xorl %r13d, %eax
shlq $0x5, %rax
movq 0x18(%r11,%rax), %rdi
testq %r12, %r12
je 0x33f29
addq %r11, %rax
movq (%rax), %rax
movb (%r12), %dl
testb %dl, %dl
je 0x33f1a
movq -0x38(%rbp), %rcx
movzbl %dl, %edx
movb (%rdx,%r14), %r9b
movzbl (%rax), %r8d
cmpb (%r8,%r14), %r9b
jne 0x33f1c
incq %rax
movb (%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0x33efd
xorl %edx, %edx
movb (%rdx,%r14), %cl
movzbl (%rax), %eax
cmpb (%rax,%r14), %cl
jne 0x33f41
addq $0x20, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x3406c
movq -0x40(%rbp), %r11
testq %rax, %rax
jne 0x33f4c
incl %r13d
cmpl -0x2c(%rbp), %r13d
jne 0x33ed1
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq