LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeSerialType
SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
  int flags = pMem->flags;
  int n;

  if( flags&MEM_Null ){
    return 0;
  }
  if( flags&MEM_Int ){
    /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
#   define MAX_6BYTE ((((i64)0x00008000)<<32)-1)
    i64 i = pMem->u.i;
    u64 u;
    if( i<0 ){
      if( i<(-MAX_6BYTE) ) return 6;
      /* Previous test prevents:  u = -(-9223372036854775808) */
      u = -i;
    }else{
      u = i;
    }
    if( u<=127 ){
      return ((i&1)==i && file_format>=4) ? 8+(u32)u : 1;
    }
    if( u<=32767 ) return 2;
    if( u<=8388607 ) return 3;
    if( u<=2147483647 ) return 4;
    if( u<=MAX_6BYTE ) return 5;
    return 6;
  }
  if( flags&MEM_Real ){
    return 7;
  }
  assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );
  n = pMem->n;
  if( flags & MEM_Zero ){
    n += pMem->u.nZero;
  }
  assert( n>=0 );
  return ((n*2) + 12 + ((flags&MEM_Str)!=0));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzwl 0x24(%rdi), %ecx
xorl %eax, %eax
testb $0x1, %cl
jne 0x2d07d
testb $0x4, %cl
jne 0x2cffe
movl $0x7, %eax
testb $0x8, %cl
jne 0x2d07d
movl 0x20(%rdi), %eax
btl $0xe, %ecx
jae 0x2cff1
addl 0x18(%rdi), %eax
shrl %ecx
andl $0x1, %ecx
leal (%rcx,%rax,2), %eax
addl $0xc, %eax
jmp 0x2d07d
movq 0x18(%rdi), %rdx
movq %rdx, %rcx
testq %rdx, %rdx
jns 0x2d024
movl $0x6, %eax
movabsq $-0x7fffffffffff, %rcx  # imm = 0xFFFF800000000001
cmpq %rcx, %rdx
jb 0x2d07d
movq %rdx, %rcx
negq %rcx
cmpq $0x7f, %rcx
ja 0x2d043
addl $0x8, %ecx
cmpq $0x2, %rdx
movl $0x1, %eax
cmovael %eax, %ecx
cmpl $0x4, %esi
cmovll %eax, %ecx
movl %ecx, %eax
jmp 0x2d07d
movl $0x2, %eax
cmpq $0x8000, %rcx           # imm = 0x8000
jb 0x2d07d
movl $0x3, %eax
cmpq $0x800000, %rcx         # imm = 0x800000
jb 0x2d07d
movq %rcx, %rax
shrq $0x1f, %rax
movl $0x4, %eax
je 0x2d07d
shrq $0x2f, %rcx
cmpq $0x1, %rcx
movl $0x6, %eax
sbbl $0x0, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3ResetOneSchema
SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3 *db, int iDb){
  Db *pDb;
  assert( iDb<db->nDb );

  /* Case 1:  Reset the single schema identified by iDb */
  pDb = &db->aDb[iDb];
  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
  assert( pDb->pSchema!=0 );
  sqlite3SchemaClear(pDb->pSchema);

  /* If any database other than TEMP is reset, then also reset TEMP
  ** since TEMP might be holding triggers that reference tables in the
  ** other database.
  */
  if( iDb!=1 ){
    pDb = &db->aDb[1];
    assert( pDb->pSchema!=0 );
    sqlite3SchemaClear(pDb->pSchema);
  }
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movslq %esi, %r14
movq %r14, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rdi
callq 0x30c3e
cmpl $0x1, %r14d
jne 0x2d1c9
popq %rbx
popq %r14
popq %rbp
retq
movq 0x20(%rbx), %rax
movq 0x38(%rax), %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x30c3e
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeCursor
SQLITE_PRIVATE int sqlite3BtreeCursor(
  Btree *p,                                   /* The btree */
  int iTable,                                 /* Root page of table to open */
  int wrFlag,                                 /* 1 to write. 0 read-only */
  struct KeyInfo *pKeyInfo,                   /* First arg to xCompare() */
  BtCursor *pCur                              /* Write new cursor here */
){
  int rc;
  sqlite3BtreeEnter(p);
  rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur);
  sqlite3BtreeLeave(p);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
movq 0x8(%rdi), %r9
movq %rax, 0x8(%r9)
testl %edx, %edx
je 0x2d305
movl $0x8, %eax
testb $0x1, 0x26(%r9)
jne 0x2d353
cmpl $0x1, %esi
jne 0x2d315
xorl %esi, %esi
cmpl $0x0, 0x3c(%r9)
setne %sil
movl %esi, 0x30(%r8)
movw $0xffff, 0x7a(%r8)      # imm = 0xFFFF
movq %rcx, 0x20(%r8)
movq %rdi, (%r8)
movq %r9, 0x8(%r8)
movb %dl, 0x74(%r8)
movq 0x10(%r9), %rax
movq %rax, 0x10(%r8)
testq %rax, %rax
je 0x2d340
movq %r8, 0x18(%rax)
movq %r8, 0x10(%r9)
movb $0x0, 0x77(%r8)
movq $0x0, 0x38(%r8)
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeSorterInit
SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *db, VdbeCursor *pCsr){
  int pgsz;                       /* Page size of main database */
  int mxCache;                    /* Cache size */
  VdbeSorter *pSorter;            /* The new sorter */
  char *d;                        /* Dummy */

  assert( pCsr->pKeyInfo && pCsr->pBt==0 );
  pCsr->pSorter = pSorter = sqlite3DbMallocZero(db, sizeof(VdbeSorter));
  if( pSorter==0 ){
    return SQLITE_NOMEM;
  }
  
  pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pCsr->pKeyInfo, 0, 0, &d);
  if( pSorter->pUnpacked==0 ) return SQLITE_NOMEM;
  assert( pSorter->pUnpacked==(UnpackedRecord *)d );

  if( !sqlite3TempInMemory(db) ){
    pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
    pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
    mxCache = db->aDb[0].pSchema->cache_size;
    if( mxCache<SORTER_MIN_WORKING ) mxCache = SORTER_MIN_WORKING;
    pSorter->mxPmaSize = mxCache * pgsz;
  }

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movl $0x50, %esi
callq 0x11721
testq %rax, %rax
je 0x2d6ee
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, 0x58(%r14)
movq 0x10(%r14), %rdi
xorl %r14d, %r14d
leaq -0x20(%rbp), %rcx
xorl %esi, %esi
xorl %edx, %edx
callq 0x2dd4f
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x2d6f6
cmpb $0x2, 0x4f(%r15)
je 0x2d6fc
movq 0x20(%r15), %rax
movq 0x8(%rax), %rcx
movq 0x8(%rcx), %rcx
movl 0x30(%rcx), %ecx
leal (%rcx,%rcx), %edx
leal (%rdx,%rdx,4), %edx
movl %edx, 0x1c(%rbx)
movq 0x18(%rax), %rax
movl 0x74(%rax), %eax
cmpl $0xb, %eax
movl $0xa, %edx
cmovgel %eax, %edx
imull %ecx, %edx
movl %edx, 0x20(%rbx)
jmp 0x2d6fc
movq $0x0, 0x58(%r14)
movl $0x7, %r14d
movl %r14d, %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: sqlite3BtreeFirst
SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
  int rc;

  assert( cursorHoldsMutex(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
  rc = moveToRoot(pCur);
  if( rc==SQLITE_OK ){
    if( pCur->eState==CURSOR_INVALID ){
      assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );
      *pRes = 1;
    }else{
      assert( pCur->apPage[pCur->iPage]->nCell>0 );
      *pRes = 0;
      rc = moveToLeftmost(pCur);
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x3096f
testl %eax, %eax
je 0x2d725
popq %rbx
popq %r14
popq %rbp
retq
cmpb $0x0, 0x77(%r14)
je 0x2d73e
movl $0x0, (%rbx)
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x30d62
movl $0x1, (%rbx)
xorl %eax, %eax
jmp 0x2d720
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeAllocUnpackedRecord
SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
  KeyInfo *pKeyInfo,              /* Description of the record */
  char *pSpace,                   /* Unaligned space available */
  int szSpace,                    /* Size of pSpace[] in bytes */
  char **ppFree                   /* OUT: Caller should free this pointer */
){
  UnpackedRecord *p;              /* Unpacked record to return */
  int nOff;                       /* Increment pSpace by nOff to align it */
  int nByte;                      /* Number of bytes required for *p */

  /* We want to shift the pointer pSpace up such that it is 8-byte aligned.
  ** Thus, we need to calculate a value, nOff, between 0 and 7, to shift 
  ** it by.  If pSpace is already 8-byte aligned, nOff should be zero.
  */
  nOff = (8 - (SQLITE_PTR_TO_INT(pSpace) & 7)) & 7;
  nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);
  if( nByte>szSpace+nOff ){
    p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
    *ppFree = (char *)p;
    if( !p ) return 0;
  }else{
    p = (UnpackedRecord*)&pSpace[nOff];
    *ppFree = 0;
  }

  p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
  assert( pKeyInfo->aSortOrder!=0 );
  p->pKeyInfo = pKeyInfo;
  p->nField = pKeyInfo->nField + 1;
  return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rcx, %r14
movq %rsi, %rax
movq %rdi, %rbx
movl %eax, %edi
negl %edi
andl $0x7, %edi
movzwl 0xa(%rbx), %ecx
imull $0x38, %ecx, %esi
addl $0x58, %esi
addl %edi, %edx
cmpl %edx, %esi
jle 0x2dd8c
movq (%rbx), %rdi
callq 0x11721
movq %rax, (%r14)
testq %rax, %rax
je 0x2ddae
movzwl 0xa(%rbx), %ecx
jmp 0x2dd98
movl %edi, %edx
addq %rdx, %rax
movq $0x0, (%r14)
leaq 0x20(%rax), %rdx
movq %rdx, 0x18(%rax)
movq %rbx, (%rax)
incl %ecx
movw %cx, 0x8(%rax)
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
jmp 0x2dda9
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeRecordUnpack
SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
  KeyInfo *pKeyInfo,     /* Information about the record format */
  int nKey,              /* Size of the binary record */
  const void *pKey,      /* The binary record */
  UnpackedRecord *p      /* Populate this structure before returning. */
){
  const unsigned char *aKey = (const unsigned char *)pKey;
  int d; 
  u32 idx;                        /* Offset in aKey[] to read from */
  u16 u;                          /* Unsigned loop counter */
  u32 szHdr;
  Mem *pMem = p->aMem;

  p->flags = 0;
  assert( EIGHT_BYTE_ALIGNMENT(pMem) );
  idx = getVarint32(aKey, szHdr);
  d = szHdr;
  u = 0;
  while( idx<szHdr && u<p->nField && d<=nKey ){
    u32 serial_type;

    idx += getVarint32(&aKey[idx], serial_type);
    pMem->enc = pKeyInfo->enc;
    pMem->db = pKeyInfo->db;
    /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */
    pMem->zMalloc = 0;
    d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
    pMem++;
    u++;
  }
  assert( u<=pKeyInfo->nField + 1 );
  p->nField = u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, -0x2c(%rbp)
movq %rdi, -0x48(%rbp)
movq 0x18(%rcx), %r13
movq %rcx, -0x38(%rbp)
movb $0x0, 0xa(%rcx)
movsbl (%rdx), %r14d
testl %r14d, %r14d
movq %rdx, -0x40(%rbp)
js 0x2ddea
movl $0x1, %ebx
jmp 0x2ddff
leaq -0x4c(%rbp), %r14
movq %rdx, %rdi
movq %r14, %rsi
callq 0x2134f
movzbl %al, %ebx
movl (%r14), %r14d
xorl %r15d, %r15d
cmpl %r14d, %ebx
jae 0x2de7f
movl %r14d, %r12d
movq -0x38(%rbp), %rax
cmpw 0x8(%rax), %r15w
jae 0x2de7f
cmpl -0x2c(%rbp), %r12d
jg 0x2de7f
movl %ebx, %edi
movq -0x40(%rbp), %rdx
movsbl (%rdx,%rdi), %esi
testl %esi, %esi
js 0x2de30
movl $0x1, %eax
jmp 0x2de46
addq %rdx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x2134f
movq -0x40(%rbp), %rdx
movzbl %al, %eax
movl -0x30(%rbp), %esi
addl %eax, %ebx
movq -0x48(%rbp), %rcx
movb 0x8(%rcx), %al
movb %al, 0x27(%r13)
movq (%rcx), %rax
movq %rax, (%r13)
movq $0x0, 0x30(%r13)
movslq %r12d, %rdi
addq %rdx, %rdi
movq %r13, %rdx
callq 0x2ce53
addl %eax, %r12d
addq $0x38, %r13
incl %r15d
cmpl %r14d, %ebx
jb 0x2de0a
movq -0x38(%rbp), %rax
movw %r15w, 0x8(%rax)
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: sqlite3VdbeSorterCompare
SQLITE_PRIVATE int sqlite3VdbeSorterCompare(
  const VdbeCursor *pCsr,         /* Sorter cursor */
  Mem *pVal,                      /* Value to compare to current sorter key */
  int *pRes                       /* OUT: Result of comparison */
){
  VdbeSorter *pSorter = pCsr->pSorter;
  void *pKey; int nKey;           /* Sorter key to compare pVal with */

  pKey = vdbeSorterRowkey(pSorter, &nKey);
  vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes);
  return SQLITE_OK;
}

// Assembly:
movq %rdx, %rax
movq 0x58(%rdi), %rdx
movq 0x30(%rdx), %rcx
testq %rcx, %rcx
je 0x2e6d1
movq 0x28(%rdx), %r9
movslq 0x4(%rcx), %rcx
shlq $0x6, %rcx
leaq (%r9,%rcx), %r8
addq $0x14, %r8
addq %r9, %rcx
addq $0x28, %rcx
jmp 0x2e6d9
movq 0x40(%rdx), %rcx
leaq 0x8(%rcx), %r8
pushq %rbp
movq %rsp, %rbp
movl (%r8), %r10d
movq (%rcx), %r9
movq 0x8(%rsi), %rcx
movl 0x20(%rsi), %r8d
movq 0x10(%rdi), %rdi
movq 0x48(%rdx), %rsi
movl $0x1, %edx
pushq %rax
pushq %r10
callq 0x333b9
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeSorterRowkey
SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){
  VdbeSorter *pSorter = pCsr->pSorter;
  void *pKey; int nKey;           /* Sorter key to copy into pOut */

  pKey = vdbeSorterRowkey(pSorter, &nKey);
  if( sqlite3VdbeMemGrow(pOut, nKey, 0) ){
    return SQLITE_NOMEM;
  }
  pOut->n = nKey;
  MemSetTypeFlag(pOut, MEM_Blob);
  memcpy(pOut->z, pKey, nKey);

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x2e739
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 0x2e741
movq 0x40(%rdi), %rax
leaq 0x8(%rax), %rcx
movl (%rcx), %r15d
movq (%rax), %r14
movq %rbx, %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x1034d
movl %eax, %ecx
movl $0x7, %eax
testl %ecx, %ecx
jne 0x2e783
movl %r15d, 0x20(%rbx)
movl $0xffffbe00, %eax       # imm = 0xFFFFBE00
andl 0x24(%rbx), %eax
movslq %r15d, %rdx
orl $0x10, %eax
movw %ax, 0x24(%rbx)
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x82f0
xorl %eax, %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: sqlite3VdbeSorterNext
SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){
  VdbeSorter *pSorter = pCsr->pSorter;
  int rc;                         /* Return code */

  if( pSorter->aTree ){
    int iPrev = pSorter->aTree[1];/* Index of iterator to advance */
    int i;                        /* Index of aTree[] to recalculate */

    rc = vdbeSorterIterNext(db, &pSorter->aIter[iPrev]);
    for(i=(pSorter->nTree+iPrev)/2; rc==SQLITE_OK && i>0; i=i/2){
      rc = vdbeSorterDoCompare(pCsr, i);
    }

    *pbEof = (pSorter->aIter[pSorter->aTree[1]].pFile==0);
  }else{
    SorterRecord *pFree = pSorter->pRecord;
    pSorter->pRecord = pFree->pNext;
    pFree->pNext = 0;
    vdbeSorterRecordFree(db, pFree);
    *pbEof = !pSorter->pRecord;
    rc = SQLITE_OK;
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r15
movq 0x58(%rsi), %r12
movq 0x30(%r12), %rax
testq %rax, %rax
je 0x2e812
movq %rsi, %r14
movslq 0x4(%rax), %r13
movq %r13, %rsi
shlq $0x6, %rsi
addq 0x28(%r12), %rsi
movq %r15, %rdi
callq 0x33a5e
testl %eax, %eax
jne 0x2e7f6
addl 0x14(%r12), %r13d
cmpl $0x2, %r13d
jl 0x2e7f6
movl %r13d, %r15d
shrl %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x338e7
cmpl $0x3, %r13d
movl %r15d, %r13d
ja 0x2e7dd
xorl %eax, %eax
movq 0x28(%r12), %rcx
movq 0x30(%r12), %rdx
movslq 0x4(%rdx), %rdx
shlq $0x6, %rdx
leaq (%rcx,%rdx), %r14
addq $0x18, %r14
jmp 0x2e843
leaq 0x40(%r12), %r14
movq 0x40(%r12), %rsi
movq 0x10(%rsi), %rax
movq %rax, 0x40(%r12)
movq $0x0, 0x10(%rsi)
movq 0x10(%rsi), %r12
movq %r15, %rdi
callq 0x9ca4
movq %r12, %rsi
testq %r12, %r12
jne 0x2e82d
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x0, (%r14)
sete %cl
movl %ecx, (%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: sqlite3VdbeSorterWrite
SQLITE_PRIVATE int sqlite3VdbeSorterWrite(
  sqlite3 *db,                    /* Database handle */
  const VdbeCursor *pCsr,               /* Sorter cursor */
  Mem *pVal                       /* Memory cell containing record */
){
  VdbeSorter *pSorter = pCsr->pSorter;
  int rc = SQLITE_OK;             /* Return Code */
  SorterRecord *pNew;             /* New list element */

  assert( pSorter );
  pSorter->nInMemory += sqlite3VarintLen(pVal->n) + pVal->n;

  pNew = (SorterRecord *)sqlite3DbMallocRaw(db, pVal->n + sizeof(SorterRecord));
  if( pNew==0 ){
    rc = SQLITE_NOMEM;
  }else{
    pNew->pVal = (void *)&pNew[1];
    memcpy(pNew->pVal, pVal->z, pVal->n);
    pNew->nVal = pVal->n;
    pNew->pNext = pSorter->pRecord;
    pSorter->pRecord = pNew;
  }

  /* See if the contents of the sorter should now be written out. They
  ** are written out when either of the following are true:
  **
  **   * The total memory allocated for the in-memory list is greater 
  **     than (page-size * cache-size), or
  **
  **   * The total memory allocated for the in-memory list is greater 
  **     than (page-size * 10) and sqlite3HeapNearlyFull() returns true.
  */
  if( rc==SQLITE_OK && pSorter->mxPmaSize>0 && (
        (pSorter->nInMemory>pSorter->mxPmaSize)
     || (pSorter->nInMemory>pSorter->mnPmaSize && sqlite3HeapNearlyFull())
  )){
#ifdef SQLITE_DEBUG
    i64 nExpect = pSorter->iWriteOff
                + sqlite3VarintLen(pSorter->nInMemory)
                + pSorter->nInMemory;
#endif
    rc = vdbeSorterListToPMA(db, pCsr);
    pSorter->nInMemory = 0;
    assert( rc!=SQLITE_OK || (nExpect==pSorter->iWriteOff) );
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x58(%rsi), %r13
movslq 0x20(%rdx), %rsi
xorl %edx, %edx
movq %rsi, %rcx
leal 0x1(%rdx), %eax
cmpq $0x80, %rcx
jb 0x2e898
shrq $0x7, %rcx
cmpl $0x8, %edx
movl %eax, %edx
jb 0x2e881
movl 0x10(%r13), %ecx
addl %esi, %ecx
addl %eax, %ecx
movl %ecx, 0x10(%r13)
addl $0x18, %esi
movq %r14, %rdi
callq 0x11721
testq %rax, %rax
je 0x2e91a
movq %rax, %r12
movq %rax, %rdi
addq $0x18, %rdi
movq %rdi, (%rax)
movq 0x8(%r15), %rsi
movslq 0x20(%r15), %rdx
callq 0x82f0
movl 0x20(%r15), %eax
movl %eax, 0x8(%r12)
movq 0x40(%r13), %rax
movq %rax, 0x10(%r12)
movq %r12, 0x40(%r13)
movl 0x20(%r13), %ecx
xorl %eax, %eax
testl %ecx, %ecx
jle 0x2e91f
movl 0x10(%r13), %edx
cmpl %ecx, %edx
jg 0x2e905
cmpl 0x1c(%r13), %edx
jle 0x2e91f
cmpl $0x0, 0x67469(%rip)     # 0x95d6c
je 0x2e91f
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33569
movl $0x0, 0x10(%r13)
jmp 0x2e91f
movl $0x7, %eax
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: sqlite3VdbeIdxKeyCompare
SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(
  VdbeCursor *pC,             /* The cursor to compare against */
  UnpackedRecord *pUnpacked,  /* Unpacked version of key to compare against */
  int *res                    /* Write the comparison result here */
){
  i64 nCellKey = 0;
  int rc;
  BtCursor *pCur = pC->pCursor;
  Mem m;

  assert( sqlite3BtreeCursorIsValid(pCur) );
  VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey);
  assert( rc==SQLITE_OK );    /* pCur is always valid so KeySize cannot fail */
  /* nCellKey will always be between 0 and 0xffffffff because of the say
  ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */
  if( nCellKey<=0 || nCellKey>0x7fffffff ){
    *res = 0;
    return SQLITE_CORRUPT_BKPT;
  }
  memset(&m, 0, sizeof(m));
  rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, (int)nCellKey, 1, &m);
  if( rc ){
    return rc;
  }
  assert( pUnpacked->flags & UNPACKED_PREFIX_MATCH );
  *res = sqlite3VdbeRecordCompare(m.n, m.z, pUnpacked);
  sqlite3VdbeMemRelease(&m);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq -0x28(%rbp), %r12
movq $0x0, (%r12)
movq (%rdi), %rdi
movq %r12, %rsi
callq 0x211a9
movq (%r12), %rdx
movq $-0x80000000, %rax      # imm = 0x80000000
leaq (%rdx,%rax), %rcx
cmpq %rax, %rcx
ja 0x2eae6
movl $0x0, (%rbx)
leaq 0x4ad4e(%rip), %rsi     # 0x79814
leaq 0x4aa6c(%rip), %rcx     # 0x79539
movl $0xb, %r15d
movl $0xb, %edi
movl $0xf6ea, %edx           # imm = 0xF6EA
xorl %eax, %eax
callq 0xb9c7
jmp 0x2eb3a
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %r8
movaps %xmm0, 0x20(%r8)
movaps %xmm0, 0x10(%r8)
movaps %xmm0, (%r8)
movq $0x0, 0x30(%r8)
movq (%r15), %rdi
xorl %esi, %esi
movl $0x1, %ecx
callq 0x2cd65
movl %eax, %r15d
testl %eax, %eax
jne 0x2eb3a
leaq -0x60(%rbp), %r15
movl 0x20(%r15), %edi
movq 0x8(%r15), %rsi
movq %r14, %rdx
callq 0x30e19
movl %eax, (%rbx)
movq %r15, %rdi
callq 0xecfd
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x40, %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: sqlite3RootPageMoved
SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom, int iTo){
  HashElem *pElem;
  Hash *pHash;
  Db *pDb;

  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
  pDb = &db->aDb[iDb];
  pHash = &pDb->pSchema->tblHash;
  for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){
    Table *pTab = sqliteHashData(pElem);
    if( pTab->tnum==iFrom ){
      pTab->tnum = iTo;
    }
  }
  pHash = &pDb->pSchema->idxHash;
  for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){
    Index *pIdx = sqliteHashData(pElem);
    if( pIdx->tnum==iFrom ){
      pIdx->tnum = iTo;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq %esi, %rax
shlq $0x5, %rax
movq 0x18(%rdi,%rax), %rax
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x2ee47
movq 0x10(%rsi), %rdi
cmpl %edx, 0x3c(%rdi)
jne 0x2ee42
movl %ecx, 0x3c(%rdi)
movq (%rsi), %rsi
jmp 0x2ee31
movq 0x28(%rax), %rax
testq %rax, %rax
je 0x2ee61
movq 0x10(%rax), %rsi
cmpl %edx, 0x50(%rsi)
jne 0x2ee5c
movl %ecx, 0x50(%rsi)
movq (%rax), %rax
jmp 0x2ee4b
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeClearTable
SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){
  int rc;
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  assert( p->inTrans==TRANS_WRITE );

  rc = saveAllCursors(pBt, (Pgno)iTable, 0);

  if( SQLITE_OK==rc ){
    /* Invalidate all incrblob cursors open on table iTable (assuming iTable
    ** is the root of a table b-tree - if it is not, the following call is
    ** a no-op).  */
    invalidateIncrblobCursors(p, 0, 1);
    rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);
  }
  sqlite3BtreeLeave(p);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r12
movq (%rdi), %rax
movq 0x8(%rdi), %r15
movq %rax, 0x8(%r15)
movq %r15, %rdi
xorl %edx, %edx
callq 0x20df0
testl %eax, %eax
je 0x2ee99
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r12), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x2eeb3
cmpb $0x0, 0x78(%rax)
je 0x2ee9e
movb $0x0, 0x77(%rax)
jmp 0x2ee9e
movq %r15, %rdi
movl %r14d, %esi
xorl %edx, %edx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x33c55
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3AnalysisLoad
SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
  analysisInfo sInfo;
  HashElem *i;
  char *zSql;
  int rc;

  assert( iDb>=0 && iDb<db->nDb );
  assert( db->aDb[iDb].pBt!=0 );

  /* Clear any prior statistics */
  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
  for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
    Index *pIdx = sqliteHashData(i);
    sqlite3DefaultRowEst(pIdx);
#ifdef SQLITE_ENABLE_STAT3
    sqlite3DeleteIndexSamples(db, pIdx);
    pIdx->aSample = 0;
#endif
  }

  /* Check to make sure the sqlite_stat1 table exists */
  sInfo.db = db;
  sInfo.zDatabase = db->aDb[iDb].zName;
  if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)==0 ){
    return SQLITE_ERROR;
  }

  /* Load new statistics out of the sqlite_stat1 table */
  zSql = sqlite3MPrintf(db, 
      "SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase);
  if( zSql==0 ){
    rc = SQLITE_NOMEM;
  }else{
    rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);
    sqlite3DbFree(db, zSql);
  }


  /* Load the statistics from the sqlite_stat3 table. */
#ifdef SQLITE_ENABLE_STAT3
  if( rc==SQLITE_OK ){
    int lookasideEnabled = db->lookaside.bEnabled;
    db->lookaside.bEnabled = 0;
    rc = loadStat3(db, sInfo.zDatabase);
    db->lookaside.bEnabled = lookasideEnabled;
  }
#endif

  if( rc==SQLITE_NOMEM ){
    db->mallocFailed = 1;
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movslq %esi, %r14
shlq $0x5, %r14
movq 0x18(%rax,%r14), %rcx
movq 0x28(%rcx), %r15
testq %r15, %r15
je 0x2f0ac
movq 0x10(%r15), %rdi
callq 0x34186
movq (%r15), %r15
testq %r15, %r15
jne 0x2f097
movq 0x20(%rbx), %rax
movq %rbx, -0x28(%rbp)
movq (%rax,%r14), %r14
movq %r14, -0x20(%rbp)
leaq 0x4afb1(%rip), %rsi     # 0x7a070
movq %rbx, %rdi
movq %r14, %rdx
callq 0x341ce
testq %rax, %rax
je 0x2f124
leaq 0x4af7e(%rip), %rsi     # 0x7a054
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x11900
testq %rax, %rax
je 0x2f118
movq %rax, %r14
leaq 0x51de(%rip), %rdx      # 0x342d0
leaq -0x28(%rbp), %rcx
movq %rbx, %rdi
movq %rax, %rsi
xorl %r8d, %r8d
callq 0x1286d
movl %eax, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9ca4
cmpl $0x7, %r15d
jne 0x2f12a
movb $0x1, 0x50(%rbx)
movl $0x7, %r15d
jmp 0x2f12a
movl $0x1, %r15d
movl %r15d, %eax
addq $0x18, %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: sqlite3UnlinkAndDeleteTable
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){
  Table *p;
  Db *pDb;

  assert( db!=0 );
  assert( iDb>=0 && iDb<db->nDb );
  assert( zTabName );
  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
  testcase( zTabName[0]==0 );  /* Zero-length table names are allowed */
  pDb = &db->aDb[iDb];
  p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName,
                        sqlite3Strlen30(zTabName),0);
  sqlite3DeleteTable(db, p);
  db->flags |= SQLITE_InternChanges;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movslq %esi, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rdi
testq %rdx, %rdx
je 0x2f170
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rdx, %rcx
incl %eax
cmpb $0x0, (%rcx)
leaq 0x1(%rcx), %rcx
jne 0x2f15e
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
jmp 0x2f172
xorl %eax, %eax
addq $0x8, %rdi
movq %rdx, %rsi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x34400
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9975
orb $0x2, 0x2c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3UnlinkAndDeleteIndex
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char *zIdxName){
  Index *pIndex;
  int len;
  Hash *pHash;

  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
  pHash = &db->aDb[iDb].pSchema->idxHash;
  len = sqlite3Strlen30(zIdxName);
  pIndex = sqlite3HashInsert(pHash, zIdxName, len, 0);
  if( ALWAYS(pIndex) ){
    if( pIndex->pTable->pIndex==pIndex ){
      pIndex->pTable->pIndex = pIndex->pNext;
    }else{
      Index *p;
      /* Justification of ALWAYS();  The index must be on the list of
      ** indices. */
      p = pIndex->pTable->pIndex;
      while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }
      if( ALWAYS(p && p->pNext==pIndex) ){
        p->pNext = pIndex->pNext;
      }
    }
    freeIndex(db, pIndex);
  }
  db->flags |= SQLITE_InternChanges;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movslq %esi, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rdi
addq $0x20, %rdi
testq %rdx, %rdx
je 0x2f1d4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rdx, %rcx
incl %eax
cmpb $0x0, (%rcx)
leaq 0x1(%rcx), %rcx
jne 0x2f1c2
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
jmp 0x2f1d6
xorl %eax, %eax
movq %rdx, %rsi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x34400
testq %rax, %rax
je 0x2f221
movq 0x18(%rax), %rcx
movq 0x10(%rcx), %rdx
cmpq %rax, %rdx
je 0x2f20b
testq %rdx, %rdx
je 0x2f216
movq %rdx, %rcx
movq 0x28(%rdx), %rdx
cmpq %rax, %rdx
jne 0x2f1f4
addq $0x28, %rcx
jmp 0x2f20f
addq $0x10, %rcx
movq 0x28(%rax), %rdx
movq %rdx, (%rcx)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3476c
orb $0x2, 0x2c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3UnlinkAndDeleteTrigger
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){
  Trigger *pTrigger;
  Hash *pHash;

  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
  pHash = &(db->aDb[iDb].pSchema->trigHash);
  pTrigger = sqlite3HashInsert(pHash, zName, sqlite3Strlen30(zName), 0);
  if( ALWAYS(pTrigger) ){
    if( pTrigger->pSchema==pTrigger->pTabSchema ){
      Table *pTab = tableOfTrigger(pTrigger);
      Trigger **pp;
      for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext));
      *pp = (*pp)->pNext;
    }
    sqlite3DeleteTrigger(db, pTrigger);
    db->flags |= SQLITE_InternChanges;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movslq %esi, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rdi
addq $0x38, %rdi
testq %rdx, %rdx
je 0x2f269
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rdx, %rcx
incl %eax
cmpb $0x0, (%rcx)
leaq 0x1(%rcx), %rcx
jne 0x2f257
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
jmp 0x2f26b
xorl %eax, %eax
movq %rdx, %rsi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x34400
testq %rax, %rax
je 0x2f2b9
movq %rax, %r14
movq 0x28(%rax), %rax
cmpq 0x30(%r14), %rax
jne 0x2f2aa
movq %r14, %rdi
callq 0x34a43
addq $0x60, %rax
movq %rax, %rcx
movq (%rax), %rdx
leaq 0x40(%rdx), %rax
cmpq %r14, %rdx
jne 0x2f295
movq (%rax), %rax
movq %rax, (%rcx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x991b
orb $0x2, 0x2c(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeMemSetRowSet
SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){
  sqlite3 *db = pMem->db;
  assert( db!=0 );
  assert( (pMem->flags & MEM_RowSet)==0 );
  sqlite3VdbeMemRelease(pMem);
  pMem->zMalloc = sqlite3DbMallocRaw(db, 64);
  if( db->mallocFailed ){
    pMem->flags = MEM_Null;
  }else{
    assert( pMem->zMalloc );
    pMem->u.pRowSet = sqlite3RowSetInit(db, pMem->zMalloc, 
                                       sqlite3DbMallocSize(db, pMem->zMalloc));
    assert( pMem->u.pRowSet!=0 );
    pMem->flags = MEM_RowSet;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r15
callq 0xecfd
movq %r15, %rdi
movl $0x40, %esi
callq 0x11721
movq %rax, %r14
movq %rax, 0x30(%rbx)
movw $0x1, %ax
cmpb $0x0, 0x50(%r15)
jne 0x2f6c3
testq %r14, %r14
je 0x2f670
cmpq %r14, 0x170(%r15)
ja 0x2f670
cmpq %r14, 0x178(%r15)
jbe 0x2f670
movzwl 0x150(%r15), %eax
jmp 0x2f679
movq %r14, %rdi
callq *0x64dbf(%rip)          # 0x94438
xorl %ecx, %ecx
movq %rcx, (%r14)
movq %r15, 0x8(%r14)
movq %rcx, 0x28(%r14)
movq %r14, %rcx
addq $0x38, %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
movq %rcx, 0x20(%r14)
movl %eax, %eax
addq $-0x38, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shrl $0x4, %edx
movw %dx, 0x30(%r14)
movw $0x1, 0x32(%r14)
movq %r14, 0x18(%rbx)
movw $0x20, %ax
movw %ax, 0x24(%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: sqlite3RowSetInsert
SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
  struct RowSetEntry *pEntry;  /* The new entry */
  struct RowSetEntry *pLast;   /* The last prior entry */

  /* This routine is never called after sqlite3RowSetNext() */
  assert( p!=0 && (p->rsFlags & ROWSET_NEXT)==0 );

  pEntry = rowSetEntryAlloc(p);
  if( pEntry==0 ) return;
  pEntry->v = rowid;
  pEntry->pRight = 0;
  pLast = p->pLast;
  if( pLast ){
    if( (p->rsFlags & ROWSET_SORTED)!=0 && rowid<=pLast->v ){
      p->rsFlags &= ~ROWSET_SORTED;
    }
    pLast->pRight = pEntry;
  }else{
    p->pEntry = pEntry;
  }
  p->pLast = pEntry;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0x35598
testq %rax, %rax
je 0x2f721
movq %r14, (%rax)
movq $0x0, 0x8(%rax)
movq 0x18(%rbx), %rcx
testq %rcx, %rcx
je 0x2f716
movb 0x32(%rbx), %dl
testb $0x1, %dl
je 0x2f710
cmpq %r14, (%rcx)
jl 0x2f710
andb $-0x2, %dl
movb %dl, 0x32(%rbx)
addq $0x8, %rcx
jmp 0x2f71a
leaq 0x10(%rbx), %rcx
movq %rax, (%rcx)
movq %rax, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3RowSetNext
SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){
  assert( p!=0 );

  /* Merge the forest into a single sorted list on first call */
  if( (p->rsFlags & ROWSET_NEXT)==0 ) rowSetToList(p);

  /* Return the next entry on the list */
  if( p->pEntry ){
    *pRowid = p->pEntry->v;
    p->pEntry = p->pEntry->pRight;
    if( p->pEntry==0 ){
      sqlite3RowSetClear(p);
    }
    return 1;
  }else{
    return 0;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movb 0x32(%rdi), %al
testb $0x2, %al
jne 0x2f753
testb $0x1, %al
jne 0x2f74e
movq 0x10(%rbx), %rdi
callq 0x355ed
movq %rax, 0x10(%rbx)
movb 0x32(%rbx), %al
orb $0x2, %al
movb %al, 0x32(%rbx)
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x2f77f
movq (%rax), %rcx
movq %rcx, (%r14)
movq 0x8(%rax), %rax
movq %rax, 0x10(%rbx)
movl $0x1, %r14d
testq %rax, %rax
jne 0x2f782
movq %rbx, %rdi
callq 0x25025
jmp 0x2f782
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeMemFinalize
SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
  int rc = SQLITE_OK;
  if( ALWAYS(pFunc && pFunc->xFinalize) ){
    sqlite3_context ctx;
    assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );
    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
    memset(&ctx, 0, sizeof(ctx));
    ctx.s.flags = MEM_Null;
    ctx.s.db = pMem->db;
    ctx.pMem = pMem;
    ctx.pFunc = pFunc;
    pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */
    assert( 0==(pMem->flags&MEM_Dyn) && !pMem->xDel );
    sqlite3DbFree(pMem->db, pMem->zMalloc);
    memcpy(pMem, &ctx.s, sizeof(ctx.s));
    rc = ctx.isError;
  }
  return rc;
}

// Assembly:
xorl %eax, %eax
testq %rsi, %rsi
je 0x2f953
movq 0x28(%rsi), %rcx
testq %rcx, %rcx
je 0x2f953
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq -0x78(%rbp), %r14
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x50(%r14)
movups %xmm0, 0x40(%r14)
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x10(%r14)
movq $0x0, 0x60(%r14)
movw $0x1, 0x2c(%r14)
movq (%rdi), %rax
movq %rax, 0x8(%r14)
movq %rdi, 0x40(%r14)
movq %rsi, (%r14)
movq %r14, %rdi
callq *%rcx
movq (%rbx), %rdi
movq 0x30(%rbx), %rsi
callq 0x9ca4
movq 0x38(%r14), %rax
movq %rax, 0x30(%rbx)
movups 0x8(%r14), %xmm0
movups 0x18(%r14), %xmm1
movups 0x28(%r14), %xmm2
movups %xmm2, 0x20(%rbx)
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
movl 0x5c(%r14), %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PagerCloseWal
SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager){
  int rc = SQLITE_OK;

  assert( pPager->journalMode==PAGER_JOURNALMODE_WAL );

  /* If the log file is not already open, but does exist in the file-system,
  ** it may need to be checkpointed before the connection can switch to
  ** rollback mode. Open it now so this can happen.
  */
  if( !pPager->pWal ){
    int logexists = 0;
    rc = pagerLockDb(pPager, SHARED_LOCK);
    if( rc==SQLITE_OK ){
      rc = sqlite3OsAccess(
          pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &logexists
      );
    }
    if( rc==SQLITE_OK && logexists ){
      rc = pagerOpenWal(pPager);
    }
  }
    
  /* Checkpoint and close the log. Because an EXCLUSIVE lock is held on
  ** the database file, the log and log-summary files will be deleted.
  */
  if( rc==SQLITE_OK && pPager->pWal ){
    rc = pagerExclusiveLock(pPager);
    if( rc==SQLITE_OK ){
      rc = sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags,
                           pPager->pageSize, (u8*)pPager->pTmpSpace);
      pPager->pWal = 0;
      pagerFixMaplimit(pPager);
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpq $0x0, 0x118(%rdi)
je 0x2f9b4
movq %rbx, %rdi
callq 0x205a1
movl %eax, %r14d
testl %eax, %eax
jne 0x2fa1a
movq 0x118(%rbx), %rdi
movzbl 0xd(%rbx), %esi
movl 0xbc(%rbx), %edx
movq 0x108(%rbx), %rcx
callq 0x1ce6f
movl %eax, %r14d
movq $0x0, 0x118(%rbx)
movq %rbx, %rdi
callq 0x1cc2a
jmp 0x2fa1a
movl $0x0, -0x14(%rbp)
movzbl 0x14(%rbx), %eax
cmpl $0x5, %eax
je 0x2f9c8
testl %eax, %eax
jne 0x2f9ea
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x38(%rax)
testl %eax, %eax
je 0x2f9e0
movl %eax, %r14d
jmp 0x2fa1a
cmpb $0x5, 0x14(%rbx)
je 0x2f9ea
movb $0x1, 0x14(%rbx)
movq (%rbx), %rdi
movq 0x120(%rbx), %rsi
leaq -0x14(%rbp), %rcx
xorl %edx, %edx
callq *0x38(%rdi)
movl %eax, %r14d
testl %eax, %eax
jne 0x2fa15
cmpl $0x0, -0x14(%rbp)
je 0x2fa15
movq %rbx, %rdi
callq 0x2042b
movl %eax, %r14d
testl %r14d, %r14d
je 0x2fa26
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
cmpq $0x0, 0x118(%rbx)
jne 0x2f96c
xorl %r14d, %r14d
jmp 0x2fa1a
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeIncrVacuum
SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){
  int rc;
  BtShared *pBt = p->pBt;

  sqlite3BtreeEnter(p);
  assert( pBt->inTransaction==TRANS_WRITE && p->inTrans==TRANS_WRITE );
  if( !pBt->autoVacuum ){
    rc = SQLITE_DONE;
  }else{
    Pgno nOrig = btreePagecount(pBt);
    Pgno nFree = get4byte(&pBt->pPage1->aData[36]);
    Pgno nFin = finalDbSize(pBt, nOrig, nFree);

    if( nOrig<nFin ){
      rc = SQLITE_CORRUPT_BKPT;
    }else if( nFree>0 ){
      rc = saveAllCursors(pBt, 0, 0);
      if( rc==SQLITE_OK ){
        invalidateAllOverflowCache(pBt);
        rc = incrVacuumStep(pBt, nFin, nOrig, 0);
      }
      if( rc==SQLITE_OK ){
        rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
        put4byte(&pBt->pPage1->aData[28], pBt->nPage);
      }
    }else{
      rc = SQLITE_DONE;
    }
  }
  sqlite3BtreeLeave(p);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, 0x8(%rsi)
movl $0x65, %r15d
cmpb $0x0, 0x21(%rsi)
je 0x3006c
movq %rsi, %rbx
movl 0x3c(%rsi), %r14d
movq 0x18(%rsi), %rax
movq 0x50(%rax), %rax
movl 0x24(%rax), %r13d
bswapl %r13d
movq %rsi, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x20d20
cmpl %eax, %r14d
jae 0x3001d
leaq 0x49817(%rip), %rsi     # 0x79814
leaq 0x49535(%rip), %rcx     # 0x79539
movl $0xb, %r15d
movl $0xb, %edi
movl $0xcdef, %edx           # imm = 0xCDEF
xorl %eax, %eax
callq 0xb9c7
jmp 0x3006c
testl %r13d, %r13d
je 0x3006c
movl %eax, %r12d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x20df0
testl %eax, %eax
jne 0x30069
movq 0x10(%rbx), %r15
testq %r15, %r15
je 0x30055
movq 0x28(%r15), %rdi
callq 0xa3c7
movq $0x0, 0x28(%r15)
movq 0x10(%r15), %r15
jmp 0x30039
movq %rbx, %rdi
movl %r12d, %esi
movl %r14d, %edx
xorl %ecx, %ecx
callq 0x20ed8
testl %eax, %eax
je 0x3007e
movl %eax, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rbx), %rax
movq 0x68(%rax), %rdi
callq 0xdfbf
movq 0x18(%rbx), %rcx
movq 0x50(%rcx), %rcx
movl 0x3c(%rbx), %edx
bswapl %edx
movl %edx, 0x1c(%rcx)
jmp 0x3006f
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeLockTable
SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){
  int rc = SQLITE_OK;
  assert( p->inTrans!=TRANS_NONE );
  if( p->sharable ){
    u8 lockType = READ_LOCK + isWriteLock;
    assert( READ_LOCK+1==WRITE_LOCK );
    assert( isWriteLock==0 || isWriteLock==1 );

    sqlite3BtreeEnter(p);
    rc = querySharedCacheTableLock(p, iTab, lockType);
    if( rc==SQLITE_OK ){
      rc = setSharedCacheTableLock(p, iTab, lockType);
    }
    sqlite3BtreeLeave(p);
  }
  return rc;
}

// Assembly:
cmpb $0x0, 0x11(%rdi)
je 0x300f4
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r15d
movq %rdi, %r14
incb %bl
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rax, 0x8(%rcx)
movzbl %bl, %edx
callq 0x1fa4b
testl %eax, %eax
jne 0x30160
movq 0x8(%r14), %r13
movq 0x70(%r13), %rax
testq %rax, %rax
je 0x300f7
cmpl %r15d, 0x8(%rax)
jne 0x300ee
cmpq %r14, (%rax)
je 0x30154
movq 0x10(%rax), %rax
jmp 0x300de
xorl %eax, %eax
retq
cmpl $0x0, 0x64302(%rip)     # 0x94400
je 0x30117
leaq -0x30(%rbp), %r12
movl $0x18, %edi
movq %r12, %rsi
callq 0x171f8
movq (%r12), %rax
jmp 0x30122
movl $0x18, %edi
callq *0x642fe(%rip)          # 0x94420
testq %rax, %rax
je 0x3014d
movl $0x0, 0x14(%rax)
movq $0x0, 0xc(%rax)
movl %r15d, 0x8(%rax)
movq %r14, (%rax)
movq 0x70(%r13), %rcx
movq %rcx, 0x10(%rax)
movq %rax, 0x70(%r13)
xorl %ecx, %ecx
jmp 0x30157
movl $0x7, %eax
jmp 0x30160
movb 0xc(%rax), %cl
cmpb %bl, %cl
jae 0x3015e
movb %bl, 0xc(%rax)
xorl %eax, %eax
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: sqlite3VtabBegin
SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){
  int rc = SQLITE_OK;
  const sqlite3_module *pModule;

  /* Special case: If db->aVTrans is NULL and db->nVTrans is greater
  ** than zero, then this function is being called from within a
  ** virtual module xSync() callback. It is illegal to write to 
  ** virtual module tables in this case, so return SQLITE_LOCKED.
  */
  if( sqlite3VtabInSync(db) ){
    return SQLITE_LOCKED;
  }
  if( !pVTab ){
    return SQLITE_OK;
  } 
  pModule = pVTab->pVtab->pModule;

  if( pModule->xBegin ){
    int i;

    /* If pVtab is already in the aVTrans array, return early */
    for(i=0; i<db->nVTrans; i++){
      if( db->aVTrans[i]==pVTab ){
        return SQLITE_OK;
      }
    }

    /* Invoke the xBegin method. If successful, add the vtab to the 
    ** sqlite3.aVTrans[] array. */
    rc = growVTrans(db);
    if( rc==SQLITE_OK ){
      rc = pModule->xBegin(pVTab->pVtab);
      if( rc==SQLITE_OK ){
        addToVTrans(db, pVTab);
      }
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movslq 0x1a4(%rdi), %rax
testq %rax, %rax
jle 0x30196
cmpq $0x0, 0x1c8(%r15)
je 0x301e4
xorl %ebx, %ebx
testq %r14, %r14
je 0x3020f
movq 0x10(%r14), %rcx
movq (%rcx), %r12
cmpq $0x0, 0x70(%r12)
je 0x3020f
testl %eax, %eax
jle 0x301c7
movq 0x1c8(%r15), %rcx
xorl %edx, %edx
cmpq %r14, (%rcx,%rdx,8)
je 0x301eb
incq %rdx
cmpq %rdx, %rax
jne 0x301b9
movq %r15, %rdi
callq 0x35b13
testl %eax, %eax
jne 0x301e0
movq 0x10(%r14), %rdi
callq *0x70(%r12)
testl %eax, %eax
je 0x301ef
movl %eax, %ebx
jmp 0x3020f
movl $0x6, %ebx
jmp 0x3020f
xorl %ebx, %ebx
jmp 0x3020f
movq 0x1c8(%r15), %rax
movslq 0x1a4(%r15), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x1a4(%r15)
movq %r14, (%rax,%rcx,8)
incl 0x18(%r14)
movl %ebx, %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: sqlite3VtabCallCreate
SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){
  int rc = SQLITE_OK;
  Table *pTab;
  Module *pMod;
  const char *zMod;

  pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
  assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable );

  /* Locate the required virtual table module */
  zMod = pTab->azModuleArg[0];
  pMod = (Module*)sqlite3HashFind(&db->aModule, zMod, sqlite3Strlen30(zMod));

  /* If the module has been registered and includes a Create method, 
  ** invoke it now. If the module has not been registered, return an 
  ** error. Otherwise, do nothing.
  */
  if( !pMod ){
    *pzErr = sqlite3MPrintf(db, "no such module: %s", zMod);
    rc = SQLITE_ERROR;
  }else{
    rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr);
  }

  /* Justification of ALWAYS():  The xConstructor method is required to
  ** create a valid sqlite3_vtab if it returns SQLITE_OK. */
  if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){
    rc = growVTrans(db);
    if( rc==SQLITE_OK ){
      addToVTrans(db, sqlite3GetVTable(db, pTab));
    }
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movslq %esi, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rax
movq %rdx, %rsi
movq %rax, %rdx
callq 0x341ce
movq %rax, %r14
movq 0x50(%rax), %rax
movq (%rax), %r12
leaq 0x1a8(%rbx), %rdi
testq %r12, %r12
je 0x30276
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rax
incl %edx
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x30263
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
jmp 0x30278
xorl %edx, %edx
movq %r12, %rsi
callq 0x3406c
testq %rax, %rax
je 0x302a6
movq (%rax), %rcx
movq 0x8(%rcx), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %r15, %r8
callq 0x35b82
testl %eax, %eax
je 0x302cf
movl %eax, %r15d
jmp 0x302c3
leaq 0x4a658(%rip), %rsi     # 0x7a905
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x11900
movq %rax, (%r15)
movl $0x1, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x58(%r14), %rax
xorl %r15d, %r15d
testq %rax, %rax
je 0x302c3
addq $0x58, %r14
cmpq %rbx, (%rax)
je 0x302ef
movq 0x28(%rax), %rax
testq %rax, %rax
jne 0x302df
jmp 0x302c3
movq %rbx, %rdi
callq 0x35b13
testl %eax, %eax
jne 0x302a1
movq (%r14), %rax
leaq 0x28(%rax), %r14
cmpq %rbx, (%rax)
jne 0x302fb
movq 0x1c8(%rbx), %rcx
movslq 0x1a4(%rbx), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x1a4(%rbx)
movq %rax, (%rcx,%rdx,8)
incl 0x18(%rax)
jmp 0x302c3