LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerOpenWal
static int pagerOpenWal(Pager *pPager){
  int rc = SQLITE_OK;

  assert( pPager->pWal==0 && pPager->tempFile==0 );
  assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );

  /* If the pager is already in exclusive-mode, the WAL module will use 
  ** heap-memory for the wal-index instead of the VFS shared-memory 
  ** implementation. Take the exclusive lock now, before opening the WAL
  ** file, to make sure this is safe.
  */
  if( pPager->exclusiveMode ){
    rc = pagerExclusiveLock(pPager);
  }

  /* Open the connection to the log file. If this operation fails, 
  ** (e.g. due to malloc() failure), return an error code.
  */
  if( rc==SQLITE_OK ){
    rc = sqlite3WalOpen(pPager->pVfs,
        pPager->fd, pPager->zWal, pPager->exclusiveMode,
        pPager->journalSizeLimit, &pPager->pWal
    );
  }
  pagerFixMaplimit(pPager);

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x8(%rdi)
je 0x2074d
movq %rbx, %rdi
callq 0x2089d
movl %eax, %r15d
jmp 0x20750
xorl %r15d, %r15d
testl %r15d, %r15d
je 0x2076f
movq %rbx, %rdi
callq 0x1cde1
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %r15
movq 0x48(%rbx), %rax
movq %rax, -0x40(%rbp)
movq 0x120(%rbx), %r12
movb 0x8(%rbx), %al
movb %al, -0x29(%rbp)
movq 0xc8(%rbx), %rax
movq %rax, -0x38(%rbp)
movq $0x0, 0x118(%rbx)
movl $0x88, %r13d
addl 0x4(%r15), %r13d
movl %r13d, %edi
callq 0xa2a2
testq %rax, %rax
je 0x2085b
movq %rax, %r14
movslq %r13d, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x8200
movq %r15, (%r14)
movq %r14, %rdx
addq $0x88, %rdx
movq %rdx, 0x10(%r14)
movq -0x40(%rbp), %rax
movq %rax, 0x8(%r14)
movw $0xffff, 0x3c(%r14)     # imm = 0xFFFF
movq -0x38(%rbp), %rax
movq %rax, 0x20(%r14)
movq %r12, 0x78(%r14)
movw $0x101, 0x44(%r14)      # imm = 0x101
cmpb $0x0, -0x29(%rbp)
setne %al
addb %al, %al
movb %al, 0x3f(%r14)
leaq -0x30(%rbp), %r8
movl $0x80006, (%r8)         # imm = 0x80006
movq %r15, %rdi
movq %r12, %rsi
movl $0x80006, %ecx          # imm = 0x80006
callq *0x28(%r15)
movl %eax, %r15d
testl %eax, %eax
je 0x20866
movq %r14, %rdi
xorl %esi, %esi
callq 0x1ddee
movq 0x10(%r14), %r12
movq (%r12), %rax
testq %rax, %rax
je 0x2084e
movq %r12, %rdi
callq *0x8(%rax)
movq $0x0, (%r12)
movq %r14, %rdi
callq 0xa2e8
jmp 0x20755
movl $0x7, %r15d
jmp 0x20755
testb $0x1, -0x30(%rbp)
je 0x20871
movb $0x1, 0x42(%r14)
movq 0x10(%r14), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
btl $0xa, %eax
jae 0x20886
movb $0x0, 0x44(%r14)
btl $0xc, %eax
jae 0x20891
movb $0x0, 0x45(%r14)
movq %r14, 0x118(%rbx)
jmp 0x20755
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerExclusiveLock
static int pagerExclusiveLock(Pager *pPager){
  int rc;                         /* Return code */

  assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );
  rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);
  if( rc!=SQLITE_OK ){
    /* If the attempt to grab the exclusive lock failed, release the 
    ** pending lock that may have been obtained instead.  */
    pagerUnlockDb(pPager, SHARED_LOCK);
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzbl 0x14(%rdi), %eax
xorl %r14d, %r14d
cmpl $0x4, %eax
jb 0x208b8
cmpl $0x5, %eax
jne 0x208d5
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
movl $0x4, %esi
callq *0x38(%rax)
movl %eax, %r14d
testl %eax, %eax
jne 0x208d5
movb $0x4, 0x14(%rbx)
xorl %r14d, %r14d
testl %r14d, %r14d
je 0x208f8
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x208f8
movl $0x1, %esi
callq *0x40(%rax)
cmpb $0x5, 0x14(%rbx)
je 0x208f8
movb $0x1, 0x14(%rbx)
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: zeroPage
static void zeroPage(MemPage *pPage, int flags){
  unsigned char *data = pPage->aData;
  BtShared *pBt = pPage->pBt;
  u8 hdr = pPage->hdrOffset;
  u16 first;

  assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );
  assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
  assert( sqlite3PagerGetData(pPage->pDbPage) == data );
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  assert( sqlite3_mutex_held(pBt->mutex) );
  if( pBt->btsFlags & BTS_SECURE_DELETE ){
    memset(&data[hdr], 0, pBt->usableSize - hdr);
  }
  data[hdr] = (char)flags;
  first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0);
  memset(&data[hdr+1], 0, 4);
  data[hdr+7] = 0;
  put2byte(&data[hdr+5], pBt->usableSize);
  pPage->nFree = (u16)(pBt->usableSize - first);
  decodeFlags(pPage, flags);
  pPage->hdrOffset = hdr;
  pPage->cellOffset = first;
  pPage->aDataEnd = &data[pBt->usableSize];
  pPage->aCellIdx = &data[first];
  pPage->nOverflow = 0;
  assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
  pPage->maskPage = (u16)(pBt->pageSize - 1);
  pPage->nCell = 0;
  pPage->isInit = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x50(%rdi), %r12
movq 0x48(%rdi), %r15
movb 0x5(%rdi), %al
movzbl %al, %r13d
testb $0x4, 0x26(%r15)
je 0x2093f
leaq (%r12,%r13), %rdi
movl 0x34(%r15), %edx
subl %r13d, %edx
movl %esi, %r14d
xorl %esi, %esi
callq 0x8200
movl %r14d, %esi
movb %sil, (%r12,%r13)
movl %esi, %r14d
shrl %r14d
andl $0x4, %r14d
xorl $0xc, %r14d
addl %r13d, %r14d
movl $0x0, 0x1(%r12,%r13)
xorl %eax, %eax
movb %al, 0x7(%r12,%r13)
movb 0x35(%r15), %al
movb %al, 0x5(%r12,%r13)
movb 0x34(%r15), %al
movb %al, 0x6(%r12,%r13)
movl 0x34(%r15), %eax
subl %r14d, %eax
movw %ax, 0xe(%rbx)
movq %rbx, %rdi
callq 0x1cd4d
movb %r13b, 0x5(%rbx)
movw %r14w, 0xc(%rbx)
movl 0x34(%r15), %eax
addq %r12, %rax
movq %rax, 0x58(%rbx)
addq %r12, %r14
movq %r14, 0x60(%rbx)
xorl %eax, %eax
movb %al, 0x1(%rbx)
movl 0x30(%r15), %eax
decl %eax
movw %ax, 0x12(%rbx)
movw $0x0, 0x10(%rbx)
movb $0x1, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerAcquireMapPage
static int pagerAcquireMapPage(
  Pager *pPager,                  /* Pager object */
  Pgno pgno,                      /* Page number */
  void *pData,                    /* xFetch()'d data for this page */
  PgHdr **ppPage                  /* OUT: Acquired page object */
){
  PgHdr *p;                       /* Memory mapped page to return */

  if( pPager->pMmapFreelist ){
    *ppPage = p = pPager->pMmapFreelist;
    pPager->pMmapFreelist = p->pDirty;
    p->pDirty = 0;
    memset(p->pExtra, 0, pPager->nExtra);
  }else{
    *ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra);
    if( p==0 ){
      sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData);
      return SQLITE_NOMEM;
    }
    p->pExtra = (void *)&p[1];
    p->flags = PGHDR_MMAP;
    p->nRef = 1;
    p->pPager = pPager;
  }

  assert( p->pExtra==(void *)&p[1] );
  assert( p->pPage==0 );
  assert( p->flags==PGHDR_MMAP );
  assert( p->pPager==pPager );
  assert( p->nRef==1 );

  p->pgno = pgno;
  p->pData = pData;
  pPager->nMmapOut++;

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r13
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
movq 0xa8(%rdi), %r12
testq %r12, %r12
je 0x20a20
movq %r12, (%r13)
movq 0x18(%r12), %rax
movq %rax, 0xa8(%r15)
movq $0x0, 0x18(%r12)
movq 0x10(%r12), %rdi
movzwl 0xb0(%r15), %edx
xorl %esi, %esi
callq 0x8200
jmp 0x20a6e
movq %rbx, -0x30(%rbp)
movzwl 0xb0(%r15), %ebx
addq $0x48, %rbx
movl %ebx, %edi
callq 0xa2a2
movq %rax, %r12
testq %rax, %rax
je 0x20a90
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x8200
movq %r12, (%r13)
movq %r12, %rax
addq $0x48, %rax
movq %rax, 0x10(%r12)
movl $0x10040, 0x2c(%r12)    # imm = 0x10040
movq %r15, 0x20(%r12)
movq -0x30(%rbp), %rbx
movl %r14d, 0x28(%r12)
movq %rbx, 0x8(%r12)
incl 0x98(%r15)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, (%r13)
movq 0x48(%r15), %rdi
decl %r14d
movslq 0xbc(%r15), %rsi
imulq %r14, %rsi
movq (%rdi), %rax
movq -0x30(%rbp), %rdx
callq *0x90(%rax)
movl $0x7, %eax
jmp 0x20a81
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreeEndTransaction
static void btreeEndTransaction(Btree *p){
  BtShared *pBt = p->pBt;
  sqlite3 *db = p->db;
  assert( sqlite3BtreeHoldsMutex(p) );

#ifndef SQLITE_OMIT_AUTOVACUUM
  pBt->bDoTruncate = 0;
#endif
  if( p->inTrans>TRANS_NONE && db->nVdbeRead>1 ){
    /* If there are other active statements that belong to this database
    ** handle, downgrade to a read-only transaction. The other statements
    ** may still be reading from the database.  */
    downgradeAllSharedCacheTableLocks(p);
    p->inTrans = TRANS_READ;
  }else{
    /* If the handle had any kind of transaction open, decrement the 
    ** transaction count of the shared btree. If the transaction count 
    ** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused()
    ** call below will unlock the pager.  */
    if( p->inTrans!=TRANS_NONE ){
      clearAllSharedCacheTableLocks(p);
      pBt->nTransaction--;
      if( 0==pBt->nTransaction ){
        pBt->inTransaction = TRANS_NONE;
      }
    }

    /* Set the current transaction state to TRANS_NONE and unlock the 
    ** pager if this call closed the only read or write transaction.  */
    p->inTrans = TRANS_NONE;
    unlockBtreeIfUnused(pBt);
  }

  btreeIntegrity(p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rcx
movq 0x8(%rdi), %r14
movb $0x0, 0x23(%r14)
movb 0x10(%rdi), %al
testb %al, %al
je 0x2101d
cmpl $0x2, 0xa0(%rcx)
jl 0x20f91
cmpq %rbx, 0x78(%r14)
je 0x20fe1
movb $0x1, 0x10(%rbx)
jmp 0x21042
testb %al, %al
je 0x2101d
movq 0x70(%r14), %rdi
testq %rdi, %rdi
je 0x20fce
leaq 0x70(%r14), %r15
cmpq %rbx, (%rdi)
je 0x20fb4
addq $0x10, %rdi
movq %rdi, %r15
jmp 0x20fc6
movq 0x10(%rdi), %rax
movq %rax, (%r15)
cmpl $0x1, 0x8(%rdi)
je 0x20fc6
callq 0xa2e8
movq (%r15), %rdi
testq %rdi, %rdi
jne 0x20fa6
cmpq %rbx, 0x78(%r14)
je 0x21001
movw $0xffbf, %ax            # imm = 0xFFBF
cmpl $0x2, 0x38(%r14)
je 0x2100d
jmp 0x21012
movq $0x0, 0x78(%r14)
andb $-0x61, 0x26(%r14)
movq 0x70(%r14), %rax
testq %rax, %rax
je 0x20f88
movb $0x1, 0xc(%rax)
movq 0x10(%rax), %rax
jmp 0x20ff2
movq $0x0, 0x78(%r14)
movw $0xff9f, %ax            # imm = 0xFF9F
andw %ax, 0x26(%r14)
decl 0x38(%r14)
jne 0x2101d
movb $0x0, 0x24(%r14)
movb $0x0, 0x10(%rbx)
cmpb $0x0, 0x24(%r14)
jne 0x21042
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x21042
movq 0x68(%rax), %rdi
callq 0xdcd4
movq $0x0, 0x18(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: finalDbSize
static Pgno finalDbSize(BtShared *pBt, Pgno nOrig, Pgno nFree){
  int nEntry;                     /* Number of entries on one ptrmap page */
  Pgno nPtrmap;                   /* Number of PtrMap pages to be freed */
  Pgno nFin;                      /* Return value */

  nEntry = pBt->usableSize/5;
  nPtrmap = (nFree-nOrig+PTRMAP_PAGENO(pBt, nOrig)+nEntry)/nEntry;
  nFin = nOrig - nFree - nPtrmap;
  if( nOrig>PENDING_BYTE_PAGE(pBt) && nFin<PENDING_BYTE_PAGE(pBt) ){
    nFin--;
  }
  while( PTRMAP_ISPAGE(pBt, nFin) || nFin==PENDING_BYTE_PAGE(pBt) ){
    nFin--;
  }

  return nFin;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edx, %ecx
movl 0x34(%rdi), %eax
movl $0xcccccccd, %r10d      # imm = 0xCCCCCCCD
imulq %rax, %r10
shrq $0x22, %r10
movl %edx, %r8d
subl %esi, %r8d
xorl %eax, %eax
cmpl $0x2, %esi
jb 0x210a3
leal 0x1(%r10), %r11d
leal -0x2(%rsi), %r9d
movl %r9d, %eax
xorl %edx, %edx
divl %r11d
subl %edx, %r9d
movl 0x737b6(%rip), %eax     # 0x94840
xorl %edx, %edx
divl 0x30(%rdi)
leal 0x1(%r9), %edx
xorl %r11d, %r11d
cmpl %eax, %edx
sete %r11b
leal (%r9,%r11), %eax
addl $0x2, %eax
addl %r10d, %r8d
addl %eax, %r8d
movl %r8d, %eax
xorl %edx, %edx
divl %r10d
addl %ecx, %eax
movl %esi, %r9d
subl %eax, %r9d
movl 0x73781(%rip), %eax     # 0x94840
xorl %edx, %edx
divl 0x30(%rdi)
movl %eax, %ecx
leal 0x1(%rcx), %r8d
cmpl %esi, %r8d
setb %al
cmpl %r8d, %r9d
setb %dl
andb %al, %dl
movzbl %dl, %eax
subl %eax, %r9d
incl %r10d
movl %r9d, %esi
movl $0x0, %eax
cmpl $0x2, %r9d
jb 0x2110b
leal -0x2(%rsi), %edi
movl %edi, %eax
xorl %edx, %edx
divl %r10d
subl %edx, %edi
leal 0x1(%rdi), %eax
xorl %edx, %edx
cmpl %ecx, %eax
sete %dl
leal (%rdi,%rdx), %eax
addl $0x2, %eax
cmpl %eax, %esi
sete %al
cmpl %r8d, %esi
sete %dl
orb %al, %dl
leal -0x1(%rsi), %r9d
testb %dl, %dl
jne 0x210e1
movl %esi, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: saveAllCursors
static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
  BtCursor *p;
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( pExcept==0 || pExcept->pBt==pBt );
  for(p=pBt->pCursor; p; p=p->pNext){
    if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
      if( p->eState==CURSOR_VALID ){
        int rc = saveCursorPosition(p);
        if( SQLITE_OK!=rc ){
          return rc;
        }
      }else{
        testcase( p->iPage>0 );
        btreeReleaseAllCursorPages(p);
      }
    }
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x10(%rdi), %r15
testq %r15, %r15
je 0x2120d
movq %rdx, %rbx
movl %esi, %r14d
cmpq %rbx, %r15
je 0x211b8
testl %r14d, %r14d
je 0x21155
cmpl %r14d, 0x30(%r15)
jne 0x211b8
cmpb $0x1, 0x77(%r15)
jne 0x211b0
leaq 0x60(%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x21510
movq 0xa8(%r15), %rax
xorl %r13d, %r13d
cmpb $0x0, 0x2(%rax)
je 0x211c3
movl %r13d, %r12d
testl %r13d, %r13d
jne 0x21194
movq %r15, %rdi
callq 0x214be
movb $0x3, 0x77(%r15)
movl -0x2c(%rbp), %r12d
movq 0x28(%r15), %rdi
callq 0xa2e8
movq $0x0, 0x28(%r15)
movl %r12d, -0x2c(%rbp)
testl %r13d, %r13d
je 0x211b8
jmp 0x21210
movq %r15, %rdi
callq 0x214be
movq 0x10(%r15), %r15
testq %r15, %r15
jne 0x21145
jmp 0x2120d
movl (%r12), %edi
callq 0xa2a2
testq %rax, %rax
je 0x211f9
movq %rax, %r12
movl 0x60(%r15), %edx
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x2186f
testl %eax, %eax
je 0x21204
movq %r12, %rdi
movl %eax, %r13d
callq 0xa2e8
jmp 0x2117b
movl $0x7, %r13d
jmp 0x2117b
movq %r12, 0x68(%r15)
jmp 0x2117b
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreeReleaseAllCursorPages
static void btreeReleaseAllCursorPages(BtCursor *pCur){
  int i;
  for(i=0; i<=pCur->iPage; i++){
    releasePage(pCur->apPage[i]);
    pCur->apPage[i] = 0;
  }
  pCur->iPage = -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpw $0x0, 0x7a(%rdi)
js 0x21505
movq $-0x1, %r14
movq 0xb0(%rbx,%r14,8), %rax
testq %rax, %rax
je 0x214ec
movq 0x68(%rax), %rdi
callq 0xdcd4
movq $0x0, 0xb0(%rbx,%r14,8)
movswq 0x7a(%rbx), %rax
incq %r14
cmpq %rax, %r14
jl 0x214d6
movw $0xffff, 0x7a(%rbx)     # imm = 0xFFFF
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeKeySize
SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID );
  if( pCur->eState!=CURSOR_VALID ){
    *pSize = 0;
  }else{
    getCellInfo(pCur);
    *pSize = pCur->info.nKey;
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpb $0x1, 0x77(%rdi)
jne 0x21575
movq %rdi, %r14
leaq 0x40(%rdi), %r15
cmpw $0x0, 0x5e(%rdi)
jne 0x21570
movswq 0x7a(%r14), %rax
movq 0xa8(%r14,%rax,8), %rdi
movzwl 0x7c(%r14,%rax,2), %eax
movzwl 0x12(%rdi), %ecx
movq 0x60(%rdi), %rdx
movzbl (%rdx,%rax,2), %r8d
shll $0x8, %r8d
movzbl 0x1(%rdx,%rax,2), %esi
orl %r8d, %esi
andl %ecx, %esi
addq 0x50(%rdi), %rsi
movq %r15, %rdx
callq 0x21585
movb $0x1, 0x76(%r14)
movq (%r15), %rax
jmp 0x21577
xorl %eax, %eax
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: ptrmapGet
static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
  DbPage *pDbPage;   /* The pointer map page */
  int iPtrmap;       /* Pointer map page index */
  u8 *pPtrmap;       /* Pointer map page data */
  int offset;        /* Offset of entry in pointer map */
  int rc;

  assert( sqlite3_mutex_held(pBt->mutex) );

  iPtrmap = PTRMAP_PAGENO(pBt, key);
  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage);
  if( rc!=0 ){
    return rc;
  }
  pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);

  offset = PTRMAP_PTROFFSET(iPtrmap, key);
  if( offset<0 ){
    sqlite3PagerUnref(pDbPage);
    return SQLITE_CORRUPT_BKPT;
  }
  assert( offset <= (int)pBt->usableSize-5 );
  assert( pEType!=0 );
  *pEType = pPtrmap[offset];
  if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);

  sqlite3PagerUnref(pDbPage);
  if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %r15d
xorl %r12d, %r12d
cmpl $0x2, %esi
jb 0x21da9
movl 0x34(%rdi), %eax
movl $0xcccccccd, %esi       # imm = 0xCCCCCCCD
imulq %rax, %rsi
shrq $0x22, %rsi
incl %esi
leal -0x2(%r15), %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %esi
subl %edx, %ecx
movl 0x72aaf(%rip), %eax     # 0x94840
xorl %edx, %edx
divl 0x30(%rdi)
leal 0x1(%rcx), %edx
xorl %esi, %esi
cmpl %eax, %edx
sete %sil
leal (%rcx,%rsi), %r12d
addl $0x2, %r12d
movq (%rdi), %rdi
leaq -0x30(%rbp), %rdx
movl %r12d, %esi
xorl %ecx, %ecx
callq 0xd803
movl %eax, %r13d
testl %eax, %eax
jne 0x21e2d
movq -0x30(%rbp), %rdi
notl %r12d
addl %r15d, %r12d
leal (%r12,%r12,4), %ecx
testl %ecx, %ecx
js 0x21e03
movq 0x8(%rdi), %rax
movl %ecx, %ecx
movb (%rax,%rcx), %dl
movb %dl, (%rbx)
testq %r14, %r14
je 0x21dec
movl 0x1(%rax,%rcx), %eax
bswapl %eax
movl %eax, (%r14)
callq 0xdcd4
movb (%rbx), %al
addb $-0x6, %al
xorl %r13d, %r13d
movl $0xc518, %edx           # imm = 0xC518
cmpb $-0x6, %al
jbe 0x21e0d
jmp 0x21e2d
callq 0xdcd4
movl $0xc510, %edx           # imm = 0xC510
leaq 0x57a00(%rip), %rsi     # 0x79814
leaq 0x5771e(%rip), %rcx     # 0x79539
movl $0xb, %r13d
movl $0xb, %edi
xorl %eax, %eax
callq 0xb8cc
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: setChildPtrmaps
static int setChildPtrmaps(MemPage *pPage){
  int i;                             /* Counter variable */
  int nCell;                         /* Number of cells in page pPage */
  int rc;                            /* Return code */
  BtShared *pBt = pPage->pBt;
  u8 isInitOrig = pPage->isInit;
  Pgno pgno = pPage->pgno;

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  rc = btreeInitPage(pPage);
  if( rc!=SQLITE_OK ){
    goto set_child_ptrmaps_out;
  }
  nCell = pPage->nCell;

  for(i=0; i<nCell; i++){
    u8 *pCell = findCell(pPage, i);

    ptrmapPutOvflPtr(pPage, pCell, &rc);

    if( !pPage->leaf ){
      Pgno childPgno = get4byte(pCell);
      ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
    }
  }

  if( !pPage->leaf ){
    Pgno childPgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
    ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
  }

set_child_ptrmaps_out:
  pPage->isInit = isInitOrig;
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x48(%rdi), %rax
movq %rax, -0x40(%rbp)
movb (%rdi), %r14b
movl 0x70(%rdi), %eax
movl %eax, -0x34(%rbp)
callq 0x1cb41
movl %eax, -0x30(%rbp)
testl %eax, %eax
jne 0x22af4
movb %r14b, -0x29(%rbp)
movzwl 0x10(%rbx), %r14d
testq %r14, %r14
je 0x22ac7
xorl %r15d, %r15d
leaq -0x30(%rbp), %r12
movzwl 0x12(%rbx), %eax
movq 0x60(%rbx), %rcx
movzbl (%rcx,%r15,2), %edx
shll $0x8, %edx
movzbl 0x1(%rcx,%r15,2), %r13d
orl %edx, %r13d
andl %eax, %r13d
addq 0x50(%rbx), %r13
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x22f9e
cmpb $0x0, 0x3(%rbx)
jne 0x22abf
movl (%r13), %esi
bswapl %esi
movq -0x40(%rbp), %rdi
movl $0x5, %edx
movl -0x34(%rbp), %ecx
movq %r12, %r8
callq 0x22b09
incq %r15
cmpq %r15, %r14
jne 0x22a71
cmpb $0x0, 0x3(%rbx)
movb -0x29(%rbp), %r14b
jne 0x22af4
movq 0x50(%rbx), %rax
movzbl 0x5(%rbx), %ecx
movl 0x8(%rax,%rcx), %esi
bswapl %esi
leaq -0x30(%rbp), %r8
movq -0x40(%rbp), %rdi
movl $0x5, %edx
movl -0x34(%rbp), %ecx
callq 0x22b09
movb %r14b, (%rbx)
movl -0x30(%rbp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PcacheMove
SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
  PCache *pCache = p->pCache;
  assert( p->nRef>0 );
  assert( newPgno>0 );
  sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);
  p->pgno = newPgno;
  if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
    pcacheRemoveFromDirtyList(p);
    pcacheAddToDirtyList(p);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movq 0x30(%rdi), %rax
movq 0x40(%rax), %rdi
movq (%rbx), %rsi
movl 0x28(%rbx), %edx
movl %r14d, %ecx
callq *0x71670(%rip)          # 0x944f0
movl %r14d, 0x28(%rbx)
movl 0x2c(%rbx), %eax
notl %eax
testb $0x6, %al
jne 0x22ea1
movq %rbx, %rdi
callq 0x1cae8
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1fa07
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BitvecClear
SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){
  if( p==0 ) return;
  assert( i>0 );
  i--;
  while( p->iDivisor ){
    u32 bin = i/p->iDivisor;
    i = i%p->iDivisor;
    p = p->u.apSub[bin];
    if (!p) {
      return;
    }
  }
  if( p->iSize<=BITVEC_NBIT ){
    p->u.aBitmap[i/BITVEC_SZELEM] &= ~(1 << (i&(BITVEC_SZELEM-1)));
  }else{
    unsigned int j;
    u32 *aiValues = pBuf;
    memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));
    memset(p->u.aHash, 0, sizeof(p->u.aHash));
    p->nSet = 0;
    for(j=0; j<BITVEC_NINT; j++){
      if( aiValues[j] && aiValues[j]!=(i+1) ){
        u32 h = BITVEC_HASH(aiValues[j]-1);
        p->nSet++;
        while( p->u.aHash[h] ){
          h++;
          if( h>=BITVEC_NINT ) h = 0;
        }
        p->u.aHash[h] = aiValues[j];
      }
    }
  }
}

// Assembly:
testq %rdi, %rdi
je 0x22f9d
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %rbx
decl %r14d
movl 0x8(%rbx), %ecx
testl %ecx, %ecx
je 0x22ee9
movl %r14d, %eax
xorl %edx, %edx
divl %ecx
movq 0x10(%rbx,%rax,8), %rbx
movl %edx, %r14d
testq %rbx, %rbx
jne 0x22ec9
jmp 0x22f8f
cmpl $0xf80, (%rbx)          # imm = 0xF80
ja 0x22f0e
movl %r14d, %ecx
andb $0x7, %cl
movl $0x1, %eax
shll %cl, %eax
shrl $0x3, %r14d
notb %al
andb %al, 0x10(%rbx,%r14)
jmp 0x22f8f
leaq 0x10(%rbx), %r12
movl $0x1f0, %edx            # imm = 0x1F0
movq %r15, %rdi
movq %r12, %rsi
callq 0x82f0
xorl %r13d, %r13d
movl $0x1f0, %edx            # imm = 0x1F0
movq %r12, %rdi
xorl %esi, %esi
callq 0x8200
movl $0x0, 0x4(%rbx)
incl %r14d
xorl %eax, %eax
movl (%r15,%rax,4), %ecx
testl %ecx, %ecx
je 0x22f86
cmpl %r14d, %ecx
je 0x22f86
decl %ecx
movl %ecx, %edx
shrl $0x2, %edx
imulq $0x21084211, %rdx, %rdx # imm = 0x21084211
shrq $0x22, %rdx
incl 0x4(%rbx)
imull $0x7c, %edx, %edx
subl %edx, %ecx
cmpl $0x0, 0x10(%rbx,%rcx,4)
je 0x22f7e
incl %ecx
cmpl $0x7c, %ecx
cmovael %r13d, %ecx
cmpl $0x0, (%r12,%rcx,4)
jne 0x22f6e
movl (%r15,%rax,4), %edx
movl %edx, (%r12,%rcx,4)
incq %rax
cmpq $0x7c, %rax
jne 0x22f40
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: ptrmapPutOvflPtr
static void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){
  CellInfo info;
  if( *pRC ) return;
  assert( pCell!=0 );
  btreeParseCellPtr(pPage, pCell, &info);
  assert( (info.nData+(pPage->intKey?0:info.nKey))==info.nPayload );
  if( info.iOverflow ){
    Pgno ovfl = get4byte(&pCell[info.iOverflow]);
    ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
cmpl $0x0, (%rdx)
je 0x22fbf
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq -0x40(%rbp), %r12
movq %r12, %rdx
callq 0x21585
movzwl 0x1c(%r12), %eax
testq %rax, %rax
je 0x22fb2
movl (%r15,%rax), %esi
bswapl %esi
movq 0x48(%r14), %rdi
movl 0x70(%r14), %ecx
movl $0x3, %edx
movq %rbx, %r8
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x22b09
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeTripAllCursors
SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){
  BtCursor *p;
  if( pBtree==0 ) return;
  sqlite3BtreeEnter(pBtree);
  for(p=pBtree->pBt->pCursor; p; p=p->pNext){
    int i;
    sqlite3BtreeClearCursor(p);
    p->eState = CURSOR_FAULT;
    p->skipNext = errCode;
    for(i=0; i<=p->iPage; i++){
      releasePage(p->apPage[i]);
      p->apPage[i] = 0;
    }
  }
  sqlite3BtreeLeave(pBtree);
}

// Assembly:
testq %rdi, %rdi
je 0x2309a
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %r14
testq %r14, %r14
je 0x23090
movl %esi, %ebx
movq 0x68(%r14), %rdi
callq 0xa2e8
movq $0x0, 0x68(%r14)
movb $0x4, 0x77(%r14)
movl %ebx, 0x70(%r14)
cmpw $0x0, 0x7a(%r14)
js 0x23087
movq $-0x1, %r15
movq 0xb0(%r14,%r15,8), %rax
testq %rax, %rax
je 0x2306e
movq 0x68(%rax), %rdi
callq 0xdcd4
movq $0x0, 0xb0(%r14,%r15,8)
movswq 0x7a(%r14), %rax
incq %r15
cmpq %rax, %r15
jl 0x23058
movq 0x10(%r14), %r14
testq %r14, %r14
jne 0x2302f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: releaseMemArray
static void releaseMemArray(Mem *p, int N){
  if( p && N ){
    Mem *pEnd;
    sqlite3 *db = p->db;
    u8 malloc_failed = db->mallocFailed;
    if( db->pnBytesFreed ){
      for(pEnd=&p[N]; p<pEnd; p++){
        sqlite3DbFree(db, p->zMalloc);
      }
      return;
    }
    for(pEnd=&p[N]; p<pEnd; p++){
      assert( (&p[1])==pEnd || p[0].db==p[1].db );

      /* This block is really an inlined version of sqlite3VdbeMemRelease()
      ** that takes advantage of the fact that the memory cell value is 
      ** being set to NULL after releasing any dynamic resources.
      **
      ** The justification for duplicating code is that according to 
      ** callgrind, this causes a certain test case to hit the CPU 4.7 
      ** percent less (x86 linux, gcc version 4.1.2, -O6) than if 
      ** sqlite3MemRelease() were called from here. With -O2, this jumps
      ** to 6.6 percent. The test case is inserting 1000 rows into a table 
      ** with no indexes using a single prepared INSERT statement, bind() 
      ** and reset(). Inserts are grouped into a transaction.
      */
      if( p->flags&(MEM_Agg|MEM_Dyn|MEM_Frame|MEM_RowSet) ){
        sqlite3VdbeMemRelease(p);
      }else if( p->zMalloc ){
        sqlite3DbFree(db, p->zMalloc);
        p->zMalloc = 0;
      }

      p->flags = MEM_Invalid;
    }
    db->mallocFailed = malloc_failed;
  }
}

// Assembly:
testq %rdi, %rdi
sete %al
testl %esi, %esi
sete %cl
orb %al, %cl
jne 0x2313f
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movslq %esi, %rax
imulq $0x38, %rax, %r15
addq %rdi, %r15
cmpq $0x0, 0x328(%r14)
je 0x230ee
testl %esi, %esi
jle 0x23137
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
addq $0x38, %rbx
cmpq %r15, %rbx
jb 0x230d7
jmp 0x23137
movb 0x50(%r14), %r12b
testl %esi, %esi
jle 0x23133
movzwl 0x24(%rbx), %eax
testl $0x2460, %eax           # imm = 0x2460
je 0x2310b
movq %rbx, %rdi
callq 0xec23
jmp 0x23124
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x23124
movq %r14, %rdi
callq 0x9c3a
movq $0x0, 0x30(%rbx)
movw $0x80, 0x24(%rbx)
addq $0x38, %rbx
cmpq %r15, %rbx
jb 0x230f6
movb %r12b, 0x50(%r14)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: vdbeFreeOpArray
static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
  if( aOp ){
    Op *pOp;
    for(pOp=aOp; pOp<&aOp[nOp]; pOp++){
      freeP4(db, pOp->p4type, pOp->p4.p);
#ifdef SQLITE_DEBUG
      sqlite3DbFree(db, pOp->zComment);
#endif     
    }
  }
  sqlite3DbFree(db, aOp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x23184
testl %edx, %edx
jle 0x23184
movslq %edx, %rax
leaq (%rax,%rax,2), %rax
leaq (%rbx,%rax,8), %r15
movq %rbx, %r12
movsbl 0x1(%r12), %esi
movq 0x10(%r12), %rdx
movq %r14, %rdi
callq 0x23197
addq $0x18, %r12
cmpq %r15, %r12
jb 0x23168
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9c3a
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: freeP4
static void freeP4(sqlite3 *db, int p4type, void *p4){
  if( p4 ){
    assert( db );
    switch( p4type ){
      case P4_REAL:
      case P4_INT64:
      case P4_DYNAMIC:
      case P4_KEYINFO:
      case P4_INTARRAY:
      case P4_KEYINFO_HANDOFF: {
        sqlite3DbFree(db, p4);
        break;
      }
      case P4_MPRINTF: {
        if( db->pnBytesFreed==0 ) sqlite3_free(p4);
        break;
      }
      case P4_FUNCDEF: {
        freeEphemeralFunction(db, (FuncDef*)p4);
        break;
      }
      case P4_MEM: {
        if( db->pnBytesFreed==0 ){
          sqlite3ValueFree((sqlite3_value*)p4);
        }else{
          Mem *p = (Mem*)p4;
          sqlite3DbFree(db, p->zMalloc);
          sqlite3DbFree(db, p);
        }
        break;
      }
      case P4_VTAB : {
        if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4);
        break;
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdx, %rdx
je 0x231ff
addl $0x10, %esi
cmpl $0xf, %esi
ja 0x231ff
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x51ff0(%rip), %rax     # 0x751a8
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x9c3a
cmpq $0x0, 0x328(%r14)
jne 0x231ff
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xa2e8
cmpq $0x0, 0x328(%r14)
jne 0x231ff
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x23229
testb $0x4, 0x3(%rbx)
jne 0x231c1
popq %rbx
popq %r14
popq %rbp
retq
cmpq $0x0, 0x328(%r14)
je 0x2321c
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
jmp 0x231c1
movq %rbx, %rdi
callq 0xec23
movq (%rbx), %rdi
jmp 0x231c4
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VtabUnlock
SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *pVTab){
  sqlite3 *db = pVTab->db;

  assert( db );
  assert( pVTab->nRef>0 );
  assert( db->magic==SQLITE_MAGIC_OPEN || db->magic==SQLITE_MAGIC_ZOMBIE );

  pVTab->nRef--;
  if( pVTab->nRef==0 ){
    sqlite3_vtab *p = pVTab->pVtab;
    if( p ){
      p->pModule->xDisconnect(p);
    }
    sqlite3DbFree(db, pVTab);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq (%rdi), %r14
decl 0x18(%rdi)
je 0x2323d
popq %rbx
popq %r14
popq %rbp
retq
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x2324f
movq (%rdi), %rax
callq *0x20(%rax)
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x9c3a
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeDelete
SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){
  sqlite3 *db;

  if( NEVER(p==0) ) return;
  db = p->db;
  assert( sqlite3_mutex_held(db->mutex) );
  sqlite3VdbeClearObject(db, p);
  if( p->pPrev ){
    p->pPrev->pNext = p->pNext;
  }else{
    assert( db->pVdbe==p );
    db->pVdbe = p->pNext;
  }
  if( p->pNext ){
    p->pNext->pPrev = p->pPrev;
  }
  p->magic = VDBE_MAGIC_DEAD;
  p->db = 0;
  sqlite3DbFree(db, p);
}

// Assembly:
testq %rdi, %rdi
je 0x232bf
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9b5f
movq 0x60(%rbx), %rax
leaq 0x8(%r14), %rcx
leaq 0x68(%rax), %rdx
testq %rax, %rax
cmoveq %rcx, %rdx
movq 0x68(%rbx), %rcx
movq %rcx, (%rdx)
movq 0x68(%rbx), %rcx
testq %rcx, %rcx
je 0x232a2
movq %rax, 0x60(%rcx)
movl $0xb606c3c8, 0x50(%rbx) # imm = 0xB606C3C8
movq $0x0, (%rbx)
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x9c3a
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeTransferError
SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){
  sqlite3 *db = p->db;
  int rc = p->rc;
  if( p->zErrMsg ){
    u8 mallocFailed = db->mallocFailed;
    sqlite3BeginBenignMalloc();
    sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);
    sqlite3EndBenignMalloc();
    db->mallocFailed = mallocFailed;
    db->errCode = rc;
  }else{
    sqlite3Error(db, rc, 0);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq (%rdi), %r14
movl 0x94(%rdi), %ebx
cmpq $0x0, 0x58(%rdi)
je 0x237a0
movq %rdi, %r15
movb 0x50(%r14), %r12b
movq 0x72805(%rip), %rax     # 0x95f60
testq %rax, %rax
je 0x23762
callq *%rax
movq 0x130(%r14), %rdi
testq %rdi, %rdi
je 0x23788
movq 0x58(%r15), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq $-0x1, %r8
callq 0xeff4
movq 0x727d9(%rip), %rax     # 0x95f68
testq %rax, %rax
je 0x23796
callq *%rax
movb %r12b, 0x50(%r14)
movl %ebx, 0x44(%r14)
jmp 0x237ae
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xc8f4
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3RollbackAll
SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){
  int i;
  int inTrans = 0;
  assert( sqlite3_mutex_held(db->mutex) );
  sqlite3BeginBenignMalloc();

  /* Obtain all b-tree mutexes before making any calls to BtreeRollback(). 
  ** This is important in case the transaction being rolled back has
  ** modified the database schema. If the b-tree mutexes are not taken
  ** here, then another shared-cache connection might sneak in between
  ** the database rollback and schema reset, which can cause false
  ** corruption reports in some cases.  */
  sqlite3BtreeEnterAll(db);

  for(i=0; i<db->nDb; i++){
    Btree *p = db->aDb[i].pBt;
    if( p ){
      if( sqlite3BtreeIsInTrans(p) ){
        inTrans = 1;
      }
      sqlite3BtreeRollback(p, tripCode);
    }
  }
  sqlite3VtabRollback(db);
  sqlite3EndBenignMalloc();

  if( (db->flags&SQLITE_InternChanges)!=0 && db->init.busy==0 ){
    sqlite3ExpirePreparedStatements(db);
    sqlite3ResetAllSchemasOfConnection(db);
  }
  sqlite3BtreeLeaveAll(db);

  /* Any deferred constraint violations have now been resolved. */
  db->nDeferredCons = 0;
  db->nDeferredImmCons = 0;
  db->flags &= ~SQLITE_DeferFKs;

  /* If one has been configured, invoke the rollback-hook callback */
  if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){
    db->xRollbackCallback(db->pRollbackArg);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq 0x7278c(%rip), %rax     # 0x95f60
testq %rax, %rax
je 0x237db
callq *%rax
movslq 0x28(%rbx), %rax
testq %rax, %rax
jle 0x2380c
movq 0x20(%rbx), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x23803
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movq %rdi, 0x8(%rsi)
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x237ee
cmpl $0x0, 0x28(%rbx)
jle 0x23859
xorl %r15d, %r15d
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x20(%rbx), %rax
movq (%rax,%r12), %rdi
testq %rdi, %rdi
je 0x23840
cmpb $0x2, 0x10(%rdi)
movl $0x1, %eax
cmovel %eax, %r13d
movl %r14d, %esi
callq 0xe67c
incq %r15
movslq 0x28(%rbx), %rax
addq $0x20, %r12
cmpq %rax, %r15
jl 0x2381e
testl %r13d, %r13d
sete %r14b
jmp 0x2385c
movb $0x1, %r14b
movq %rbx, %rdi
movl $0x88, %esi
callq 0x2457d
movq 0x726f8(%rip), %rax     # 0x95f68
testq %rax, %rax
je 0x23877
callq *%rax
testb $0x2, 0x2c(%rbx)
je 0x238a4
cmpb $0x0, 0x99(%rbx)
jne 0x238a4
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x2389c
orb $0x20, 0x9a(%rax)
movq 0x68(%rax), %rax
jmp 0x2388a
movq %rbx, %rdi
callq 0xdda5
xorps %xmm0, %xmm0
movups %xmm0, 0x318(%rbx)
andb $-0x2, 0x2f(%rbx)
movq 0xf0(%rbx), %rax
testq %rax, %rax
je 0x238c9
testb %r14b, %r14b
je 0x238d8
cmpb $0x0, 0x4e(%rbx)
je 0x238d8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xe8(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3CloseSavepoints
SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *db){
  while( db->pSavepoint ){
    Savepoint *pTmp = db->pSavepoint;
    db->pSavepoint = pTmp->pNext;
    sqlite3DbFree(db, pTmp);
  }
  db->nSavepoint = 0;
  db->nStatement = 0;
  db->isTransactionSavepoint = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x300(%rdi), %rsi
testq %rsi, %rsi
je 0x23920
movq 0x18(%rsi), %rax
movq %rax, 0x300(%rbx)
movq %rbx, %rdi
callq 0x9c3a
movq 0x300(%rbx), %rsi
jmp 0x238ff
movq $0x0, 0x30c(%rbx)
movb $0x0, 0x55(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeCheckFk
SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){
  sqlite3 *db = p->db;
  if( (deferred && (db->nDeferredCons+db->nDeferredImmCons)>0) 
   || (!deferred && p->nFkConstraint>0) 
  ){
    p->rc = SQLITE_CONSTRAINT_FOREIGNKEY;
    p->errorAction = OE_Abort;
    sqlite3SetString(&p->zErrMsg, db, "foreign key constraint failed");
    return SQLITE_ERROR;
  }
  return SQLITE_OK;
}

// Assembly:
movl %esi, %eax
movq (%rdi), %rsi
testl %eax, %eax
je 0x2397d
movq 0x320(%rsi), %rax
addq 0x318(%rsi), %rax
jle 0x23987
pushq %rbp
movq %rsp, %rbp
movl $0x313, 0x94(%rdi)      # imm = 0x313
movb $0x2, 0x98(%rdi)
addq $0x58, %rdi
leaq 0x55f1b(%rip), %rdx     # 0x7988a
xorl %eax, %eax
callq 0x24616
movl $0x1, %eax
popq %rbp
retq
cmpq $0x0, 0xc8(%rdi)
jg 0x2394f
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeFrameRestore
SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){
  Vdbe *v = pFrame->v;
  v->aOnceFlag = pFrame->aOnceFlag;
  v->nOnceFlag = pFrame->nOnceFlag;
  v->aOp = pFrame->aOp;
  v->nOp = pFrame->nOp;
  v->aMem = pFrame->aMem;
  v->nMem = pFrame->nMem;
  v->apCsr = pFrame->apCsr;
  v->nCursor = pFrame->nCursor;
  v->db->lastRowid = pFrame->lastRowid;
  v->nChange = pFrame->nChange;
  return pFrame->pc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
movq 0x20(%rdi), %rcx
movq %rcx, 0x118(%rax)
movl 0x50(%rdi), %ecx
movl %ecx, 0x110(%rax)
movq 0x10(%rdi), %rcx
movq %rcx, 0x8(%rax)
movl 0x48(%rdi), %ecx
movl %ecx, 0x34(%rax)
movq 0x18(%rdi), %rcx
movq %rcx, 0x10(%rax)
movl 0x4c(%rdi), %ecx
movl %ecx, 0x30(%rax)
movq 0x28(%rdi), %rcx
movq %rcx, 0x70(%rax)
movl 0x40(%rdi), %ecx
movl %ecx, 0x4c(%rax)
movq 0x38(%rdi), %rcx
movq (%rax), %rdx
movq %rcx, 0x30(%rdx)
movl 0x5c(%rdi), %ecx
movl %ecx, 0x9c(%rax)
movl 0x44(%rdi), %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeFreeCursor
SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
  if( pCx==0 ){
    return;
  }
  sqlite3VdbeSorterClose(p->db, pCx);
  if( pCx->pBt ){
    sqlite3BtreeClose(pCx->pBt);
    /* The pCx->pCursor will be close automatically, if it exists, by
    ** the call above. */
  }else if( pCx->pCursor ){
    sqlite3BtreeCloseCursor(pCx->pCursor);
  }
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( pCx->pVtabCursor ){
    sqlite3_vtab_cursor *pVtabCursor = pCx->pVtabCursor;
    const sqlite3_module *pModule = pCx->pModule;
    p->inVtabMethod = 1;
    pModule->xClose(pVtabCursor);
    p->inVtabMethod = 0;
  }
#endif
}

// Assembly:
testq %rsi, %rsi
je 0x24324
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x58(%rsi), %r15
testq %r15, %r15
je 0x242cb
movq %rbx, -0x38(%rbp)
movq (%r14), %r12
cmpq $0x0, 0x28(%r15)
je 0x24263
movq %r14, -0x30(%rbp)
cmpl $0x0, 0x14(%r15)
jle 0x24253
movl $0x30, %r13d
xorl %ebx, %ebx
movq 0x28(%r15), %r14
movq -0x10(%r14,%r13), %rsi
movq %r12, %rdi
callq 0x9c3a
movq (%r14,%r13), %rsi
movq %r12, %rdi
callq 0x9c3a
xorps %xmm0, %xmm0
movups %xmm0, (%r14,%r13)
movups %xmm0, -0x10(%r14,%r13)
movups %xmm0, -0x20(%r14,%r13)
movups %xmm0, -0x30(%r14,%r13)
incq %rbx
movslq 0x14(%r15), %rax
addq $0x40, %r13
cmpq %rax, %rbx
jl 0x2420c
movq 0x28(%r15), %rsi
movq %r12, %rdi
callq 0x9c3a
movq -0x30(%rbp), %r14
movq 0x38(%r15), %r13
testq %r13, %r13
je 0x2428b
movq (%r13), %rax
testq %rax, %rax
je 0x24283
movq %r13, %rdi
callq *0x8(%rax)
movq $0x0, (%r13)
movq %r13, %rdi
callq 0xa2e8
movq 0x40(%r15), %rsi
testq %rsi, %rsi
je 0x242a8
movq 0x10(%rsi), %rbx
movq %r12, %rdi
callq 0x9c3a
movq %rbx, %rsi
testq %rbx, %rbx
jne 0x24294
movq 0x48(%r15), %rsi
movq %r12, %rdi
callq 0x9c3a
movq %r12, %rdi
movq %r15, %rsi
callq 0x9c3a
movq -0x38(%rbp), %rbx
movq $0x0, 0x58(%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x242db
callq 0x243ae
jmp 0x242e8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x242e8
callq 0x244af
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x24316
movq 0x38(%rbx), %rax
movzwl 0x9a(%r14), %ecx
andl $-0xd, %ecx
orl $0x4, %ecx
movw %cx, 0x9a(%r14)
callq *0x38(%rax)
andb $-0xd, 0x9a(%r14)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeDeleteAuxData
SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(Vdbe *pVdbe, int iOp, int mask){
  AuxData **pp = &pVdbe->pAuxData;
  while( *pp ){
    AuxData *pAux = *pp;
    if( (iOp<0)
     || (pAux->iOp==iOp && (pAux->iArg>31 || !(mask & ((u32)1<<pAux->iArg))))
    ){
      if( pAux->xDelete ){
        pAux->xDelete(pAux->pAux);
      }
      *pp = pAux->pNext;
      sqlite3DbFree(pVdbe->db, pAux);
    }else{
      pp= &pAux->pNext;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x120(%rdi), %r12
testq %r12, %r12
je 0x2439f
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
leaq 0x120(%rdi), %r13
testl %r14d, %r14d
js 0x24371
cmpl %r14d, (%r12)
jne 0x24368
movl 0x4(%r12), %eax
cmpl $0x1f, %eax
jg 0x24371
btl %eax, %ebx
jae 0x24371
addq $0x18, %r12
movq %r12, %r13
jmp 0x24396
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x24382
movq 0x8(%r12), %rdi
callq *%rax
movq 0x18(%r12), %rax
movq %rax, (%r13)
movq (%r15), %rdi
movq %r12, %rsi
callq 0x9c3a
movq (%r13), %r12
testq %r12, %r12
jne 0x2434e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeClose
SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){
  BtShared *pBt = p->pBt;
  BtCursor *pCur;

  /* Close all cursors opened via this handle.  */
  assert( sqlite3_mutex_held(p->db->mutex) );
  sqlite3BtreeEnter(p);
  pCur = pBt->pCursor;
  while( pCur ){
    BtCursor *pTmp = pCur;
    pCur = pCur->pNext;
    if( pTmp->pBtree==p ){
      sqlite3BtreeCloseCursor(pTmp);
    }
  }

  /* Rollback any active transaction and free the handle structure.
  ** The call to sqlite3BtreeRollback() drops any table-locks held by
  ** this handle.
  */
  sqlite3BtreeRollback(p, SQLITE_OK);
  sqlite3BtreeLeave(p);

  /* If there are still other outstanding references to the shared-btree
  ** structure, return now. The remainder of this procedure cleans 
  ** up the shared-btree.
  */
  assert( p->wantToLock==0 && p->locked==0 );
  if( !p->sharable || removeFromSharingList(pBt) ){
    /* The pBt is no longer on the sharing list, so we can access
    ** it without having to hold the mutex.
    **
    ** Clean out and delete the BtShared object.
    */
    assert( !pBt->pCursor );
    sqlite3PagerClose(pBt->pPager);
    if( pBt->xFreeSchema && pBt->pSchema ){
      pBt->xFreeSchema(pBt->pSchema);
    }
    sqlite3DbFree(0, pBt->pSchema);
    freeTempSpace(pBt);
    sqlite3_free(pBt);
  }

#ifndef SQLITE_OMIT_SHARED_CACHE
  assert( p->wantToLock==0 );
  assert( p->locked==0 );
  if( p->pPrev ) p->pPrev->pNext = p->pNext;
  if( p->pNext ) p->pNext->pPrev = p->pPrev;
#endif

  sqlite3_free(p);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %r14
movq %rax, 0x8(%r14)
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x243e5
movq 0x10(%rdi), %r15
cmpq %rbx, (%rdi)
jne 0x243dd
callq 0x244af
movq %r15, %rdi
testq %r15, %r15
jne 0x243cf
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe67c
cmpb $0x0, 0x11(%rbx)
je 0x2443b
movl 0x60(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x60(%r14)
cmpl $0x1, %eax
jg 0x2447f
movq 0x71b4c(%rip), %rdx     # 0x95f58
cmpq %r14, %rdx
je 0x24428
testq %rdx, %rdx
je 0x24436
movq %rdx, %rcx
movq 0x68(%rdx), %rdx
cmpq %r14, %rdx
jne 0x24411
addq $0x68, %rcx
jmp 0x2442f
leaq 0x71b29(%rip), %rcx     # 0x95f58
movq 0x68(%r14), %rdx
movq %rdx, (%rcx)
cmpl $0x1, %eax
jg 0x2447f
movq (%r14), %rdi
callq 0x1a57b
movq 0x48(%r14), %rax
testq %rax, %rax
je 0x24457
movq 0x40(%r14), %rdi
testq %rdi, %rdi
je 0x24457
callq *%rax
movq 0x40(%r14), %rdi
callq 0xa2e8
movq 0x80(%r14), %rdi
callq 0x1cf8c
movq $0x0, 0x80(%r14)
movq %r14, %rdi
callq 0xa2e8
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x24490
movq 0x20(%rbx), %rcx
movq %rcx, 0x20(%rax)
movq 0x20(%rbx), %rcx
testq %rcx, %rcx
je 0x2449d
movq %rax, 0x28(%rcx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa2e8