LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerPagecount
static int pagerPagecount(Pager *pPager, Pgno *pnPage){
  Pgno nPage;                     /* Value to return via *pnPage */

  /* Query the WAL sub-system for the database size. The WalDbsize()
  ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or
  ** if the database size is not available. The database size is not
  ** available from the WAL sub-system if the log file is empty or
  ** contains no valid committed transactions.
  */
  assert( pPager->eState==PAGER_OPEN );
  assert( pPager->eLock>=SHARED_LOCK );
  nPage = sqlite3WalDbsize(pPager->pWal);

  /* If the database size was not available from the WAL sub-system,
  ** determine it based on the size of the database file. If the size
  ** of the database file is not an integer multiple of the page-size,
  ** round down to the nearest page. Except, any file larger than 0
  ** bytes in size is considered to contain at least one page.
  */
  if( nPage==0 ){
    i64 n = 0;                    /* Size of db file in bytes */
    assert( isOpen(pPager->fd) || pPager->tempFile );
    if( isOpen(pPager->fd) ){
      int rc = sqlite3OsFileSize(pPager->fd, &n);
      if( rc!=SQLITE_OK ){
        return rc;
      }
    }
    nPage = (Pgno)((n+pPager->pageSize-1) / pPager->pageSize);
  }

  /* If the current number of pages in the file is greater than the
  ** configured maximum pager number, increase the allowed limit so
  ** that the file can be read.
  */
  if( nPage>pPager->mxPgno ){
    pPager->mxPgno = (Pgno)nPage;
  }

  *pnPage = nPage;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rdi
callq 0x2a4a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x2a2bc
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, (%rax)
je 0x2a293
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x23e00
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x2a291
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2a2e8
jmp 0x2a293
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0xbc(%rcx), %rcx
addq %rcx, %rax
subq $0x1, %rax
movq -0x10(%rbp), %rcx
movslq 0xbc(%rcx), %rcx
cqto
idivq %rcx
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc0(%rcx), %eax
jbe 0x2a2d8
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc0(%rax)
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerOpenWalIfPresent
static int pagerOpenWalIfPresent(Pager *pPager){
  int rc = SQLITE_OK;
  assert( pPager->eState==PAGER_OPEN );
  assert( pPager->eLock>=SHARED_LOCK );

  if( !pPager->tempFile ){
    int isWal;                    /* True if WAL file exists */
    Pgno nPage;                   /* Size of the database file */

    rc = pagerPagecount(pPager, &nPage);
    if( rc ) return rc;
    if( nPage==0 ){
      rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);
      if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK;
      isWal = 0;
    }else{
      rc = sqlite3OsAccess(
          pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal
      );
    }
    if( rc==SQLITE_OK ){
      if( isWal ){
        testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );
        rc = sqlite3PagerOpenWal(pPager, 0);
      }else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){
        pPager->journalMode = PAGER_JOURNALMODE_DELETE;
      }
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x10(%rax)
jne 0x2a3d6
movq -0x10(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x2a230
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x2a342
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2a3dc
cmpl $0x0, -0x1c(%rbp)
jne 0x2a37d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x120(%rax), %rsi
xorl %edx, %edx
callq 0x259d0
movl %eax, -0x14(%rbp)
cmpl $0x170a, -0x14(%rbp)    # imm = 0x170A
jne 0x2a374
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
jmp 0x2a39d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x120(%rax), %rsi
xorl %edx, %edx
leaq -0x18(%rbp), %rcx
callq 0x28b70
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x2a3d4
cmpl $0x0, -0x18(%rbp)
je 0x2a3bb
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29f40
movl %eax, -0x14(%rbp)
jmp 0x2a3d2
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x5, %eax
jne 0x2a3d0
movq -0x10(%rbp), %rax
movb $0x0, 0x9(%rax)
jmp 0x2a3d2
jmp 0x2a3d4
jmp 0x2a3d6
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerBeginReadTransaction
static int pagerBeginReadTransaction(Pager *pPager){
  int rc;                         /* Return code */
  int changed = 0;                /* True if cache must be reset */

  assert( pagerUseWal(pPager) );
  assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER );

  /* sqlite3WalEndReadTransaction() was not called for the previous
  ** transaction in locking_mode=EXCLUSIVE.  So call it now.  If we
  ** are in locking_mode=NORMAL and EndRead() was previously called,
  ** the duplicate call is harmless.
  */
  sqlite3WalEndReadTransaction(pPager->pWal);

  rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed);
  if( rc!=SQLITE_OK || changed ){
    pager_reset(pPager);
    if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x118(%rax), %rdi
callq 0x26740
movq -0x8(%rbp), %rax
movq 0x118(%rax), %rdi
leaq -0x10(%rbp), %rsi
callq 0x2a4e0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x2a436
cmpl $0x0, -0x10(%rbp)
je 0x2a462
movq -0x8(%rbp), %rdi
callq 0x24fc0
movq -0x8(%rbp), %rax
cmpb $0x0, 0x94(%rax)
je 0x2a460
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x25a70
jmp 0x2a462
movl -0xc(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3WalBeginReadTransaction
SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
  int rc;                         /* Return code */
  int cnt = 0;                    /* Number of TryBeginRead attempts */

  do{
    rc = walTryBeginRead(pWal, pChanged, 0, ++cnt);
  }while( rc==WAL_RETRY );
  testcase( (rc&0xff)==SQLITE_BUSY );
  testcase( (rc&0xff)==SQLITE_IOERR );
  testcase( rc==SQLITE_PROTOCOL );
  testcase( rc==SQLITE_OK );
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
xorl %edx, %edx
callq 0x230f0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
je 0x2a4f7
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreePageFromDbPage
static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){
  MemPage *pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);
  pPage->aData = sqlite3PagerGetData(pDbPage);
  pPage->pDbPage = pDbPage;
  pPage->pBt = pBt;
  pPage->pgno = pgno;
  pPage->hdrOffset = pPage->pgno==1 ? 100 : 0;
  return pPage; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x24a20
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0xec10
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x70(%rax)
movq -0x20(%rbp), %rax
movl 0x70(%rax), %edx
xorl %eax, %eax
movl $0x64, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x5(%rax)
movq -0x20(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x8(%rax)
je 0x2a639
movq -0x8(%rbp), %rdi
callq 0x2a6a0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x2a67f
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x120(%rax), %rdx
movq -0x8(%rbp), %rax
movzbl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %r8
movq -0x8(%rbp), %r9
addq $0x118, %r9             # imm = 0x118
callq 0x2a6e0
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x24e80
movl -0xc(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4, %esi
callq 0x247e0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x2a6d1
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x26790
movl -0xc(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3WalBeginWriteTransaction
SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal){
  int rc;

  /* Cannot start a write transaction without first holding a read
  ** transaction. */
  assert( pWal->readLock>=0 );

  if( pWal->readOnly ){
    return SQLITE_READONLY;
  }

  /* Only one writer allowed at a time.  Get the write lock.  Return
  ** SQLITE_BUSY if unable.
  */
  rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1);
  if( rc ){
    return rc;
  }
  pWal->writeLock = 1;

  /* If another connection has written to the database file since the
  ** time the read transaction on this connection was started, then
  ** the write is disallowed.
  */
  if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){
    walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);
    pWal->writeLock = 0;
    rc = SQLITE_BUSY_SNAPSHOT;
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x42(%rax)
je 0x2a88f
movl $0x8, -0x4(%rbp)
jmp 0x2a908
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x23020
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x2a8b0
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2a908
movq -0x10(%rbp), %rax
movb $0x1, 0x40(%rax)
movq -0x10(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x23680
movq -0x20(%rbp), %rdi
movq %rax, %rsi
movl $0x30, %edx
callq 0x81c0
cmpl $0x0, %eax
je 0x2a902
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x23070
movq -0x10(%rbp), %rax
movb $0x0, 0x40(%rax)
movl $0x205, -0x14(%rbp)     # imm = 0x205
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3WalSavepoint
SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData){
  assert( pWal->writeLock );
  aWalData[0] = pWal->hdr.mxFrame;
  aWalData[1] = pWal->hdr.aFrameCksum[0];
  aWalData[2] = pWal->hdr.aFrameCksum[1];
  aWalData[3] = pWal->nCkpt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x58(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl 0x60(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x64(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl 0x80(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0x2abeb
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rcx
movq %rcx, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movzwl 0xb0(%rax), %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x8200
jmp 0x2ac79
movq -0x10(%rbp), %rax
movzwl 0xb0(%rax), %eax
addq $0x48, %rax
movl %eax, %edi
callq 0xd860
movq %rax, %rcx
movq %rcx, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x30(%rbp)
jne 0x2ac49
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
movq -0x10(%rbp), %rax
movslq 0xbc(%rax), %rax
imulq %rax, %rsi
movq -0x20(%rbp), %rdx
callq 0x25a70
movl $0x7, -0x4(%rbp)
jmp 0x2aca9
movq -0x30(%rbp), %rcx
addq $0x48, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movw $0x40, 0x2c(%rax)
movq -0x30(%rbp), %rax
movw $0x1, 0x2e(%rax)
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x14(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x98(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x98(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerReleaseMapPage
static void pagerReleaseMapPage(PgHdr *pPg){
  Pager *pPager = pPg->pPager;
  pPager->nMmapOut--;
  pPg->pDirty = pPager->pMmapFreelist;
  pPager->pMmapFreelist = pPg;

  assert( pPager->fd->pMethods->iVersion>=3 );
  sqlite3OsUnfetch(pPager->fd, (i64)(pPg->pgno-1)*pPager->pageSize, pPg->pData);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x98(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x98(%rax)
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x28(%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
movq -0x10(%rbp), %rax
movslq 0xbc(%rax), %rax
imulq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x25a70
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PagerCommitPhaseTwo
SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){
  int rc = SQLITE_OK;                  /* Return code */

  /* This routine should not be called if a prior error has occurred.
  ** But if (due to a coding error elsewhere in the system) it does get
  ** called, just return the same error code without doing anything. */
  if( NEVER(pPager->errCode) ) return pPager->errCode;

  assert( pPager->eState==PAGER_WRITER_LOCKED
       || pPager->eState==PAGER_WRITER_FINISHED
       || (pagerUseWal(pPager) && pPager->eState==PAGER_WRITER_CACHEMOD)
  );
  assert( assert_pager_state(pPager) );

  /* An optimization. If the database was not actually modified during
  ** this transaction, the pager is running in exclusive-mode and is
  ** using persistent journals, then this function is a no-op.
  **
  ** The start of the journal file currently contains a single journal 
  ** header with the nRec field set to 0. If such a journal is used as
  ** a hot-journal during hot-journal rollback, 0 changes will be made
  ** to the database file. So there is no need to zero the journal 
  ** header. Since the pager is in exclusive mode, there is no need
  ** to drop any locks either.
  */
  if( pPager->eState==PAGER_WRITER_LOCKED 
   && pPager->exclusiveMode 
   && pPager->journalMode==PAGER_JOURNALMODE_PERSIST
  ){
    assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) || !pPager->journalOff );
    pPager->eState = PAGER_READER;
    return SQLITE_OK;
  }

  PAGERTRACE(("COMMIT %d\n", PAGERID(pPager)));
  rc = pager_end_transaction(pPager, pPager->setMaster, 1);
  return pager_error(pPager, rc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x2b4a9
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2b509
movq -0x10(%rbp), %rax
movzbl 0x13(%rax), %eax
cmpl $0x2, %eax
jne 0x2b4e1
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x0, %eax
je 0x2b4e1
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x1, %eax
jne 0x2b4e1
movq -0x10(%rbp), %rax
movb $0x1, 0x13(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2b509
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x16(%rax), %esi
movl $0x1, %edx
callq 0x26960
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x21960
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0x23(%rax)
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x0, %eax
jle 0x2b5a8
movq -0x18(%rbp), %rax
cmpl $0x1, 0xa0(%rax)
jle 0x2b5a8
movq -0x8(%rbp), %rdi
callq 0x2b600
movq -0x8(%rbp), %rax
movb $0x1, 0x10(%rax)
jmp 0x2b5f1
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x0, %eax
je 0x2b5e0
movq -0x8(%rbp), %rdi
callq 0x2b670
movq -0x10(%rbp), %rax
movl 0x38(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x38(%rax)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpl 0x38(%rcx), %eax
jne 0x2b5de
movq -0x10(%rbp), %rax
movb $0x0, 0x24(%rax)
jmp 0x2b5e0
movq -0x8(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0x29920
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: downgradeAllSharedCacheTableLocks
static void downgradeAllSharedCacheTableLocks(Btree *p){
  BtShared *pBt = p->pBt;
  if( pBt->pWriter==p ){
    BtLock *pLock;
    pBt->pWriter = 0;
    pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING);
    for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){
      assert( pLock->eLock==READ_LOCK || pLock->pBtree==p );
      pLock->eLock = READ_LOCK;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x2b668
movq -0x10(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x10(%rbp), %rax
movzwl 0x26(%rax), %ecx
andl $-0x61, %ecx
movw %cx, 0x26(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x2b666
movq -0x18(%rbp), %rax
movb $0x1, 0xc(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x2b649
jmp 0x2b668
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: clearAllSharedCacheTableLocks
static void clearAllSharedCacheTableLocks(Btree *p){
  BtShared *pBt = p->pBt;
  BtLock **ppIter = &pBt->pLock;

  assert( sqlite3BtreeHoldsMutex(p) );
  assert( p->sharable || 0==*ppIter );
  assert( p->inTrans>0 );

  while( *ppIter ){
    BtLock *pLock = *ppIter;
    assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree );
    assert( pLock->pBtree->inTrans>=pLock->eLock );
    if( pLock->pBtree==p ){
      *ppIter = pLock->pNext;
      assert( pLock->iTable!=1 || pLock==&p->lock );
      if( pLock->iTable!=1 ){
        sqlite3_free(pLock);
      }
    }else{
      ppIter = &pLock->pNext;
    }
  }

  assert( (pBt->btsFlags & BTS_PENDING)==0 || pBt->pWriter );
  if( pBt->pWriter==p ){
    pBt->pWriter = 0;
    pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING);
  }else if( pBt->nTransaction==2 ){
    /* This function is called when Btree p is concluding its 
    ** transaction. If there currently exists a writer, and p is not
    ** that writer, then the number of locks held by connections other
    ** than the writer must be about to drop to zero. In this case
    ** set the BTS_PENDING flag to 0.
    **
    ** If there is not currently a writer, then BTS_PENDING must
    ** be zero already. So this next line is harmless in that case.
    */
    pBt->btsFlags &= ~BTS_PENDING;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x70, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2b6e8
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x2b6da
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpl $0x1, 0x8(%rax)
je 0x2b6d8
movq -0x20(%rbp), %rdi
callq 0xa420
jmp 0x2b6e6
movq -0x20(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x18(%rbp)
jmp 0x2b694
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x2b713
movq -0x10(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x10(%rbp), %rax
movzwl 0x26(%rax), %ecx
andl $-0x61, %ecx
movw %cx, 0x26(%rax)
jmp 0x2b72e
movq -0x10(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x2b72c
movq -0x10(%rbp), %rax
movzwl 0x26(%rax), %ecx
andl $-0x41, %ecx
movw %cx, 0x26(%rax)
jmp 0x2b72e
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: invalidateAllOverflowCache
static void invalidateAllOverflowCache(BtShared *pBt){
  BtCursor *p;
  assert( sqlite3_mutex_held(pBt->mutex) );
  for(p=pBt->pCursor; p; p=p->pNext){
    invalidateOverflowCache(p);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2b946
movq -0x10(%rbp), %rdi
callq 0x2bdd0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x2b928
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: ptrmapPageno
static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){
  int nPagesPerMapPage;
  Pgno iPtrMap, ret;
  assert( sqlite3_mutex_held(pBt->mutex) );
  if( pgno<2 ) return 0;
  nPagesPerMapPage = (pBt->usableSize/5)+1;
  iPtrMap = (pgno-2)/nPagesPerMapPage;
  ret = (iPtrMap*nPagesPerMapPage) + 2; 
  if( ret==PENDING_BYTE_PAGE(pBt) ){
    ret++;
  }
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpl $0x2, -0x14(%rbp)
jae 0x2b96a
movl $0x0, -0x4(%rbp)
jmp 0x2b9cb
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl $0x5, %ecx
xorl %edx, %edx
divl %ecx
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
subl $0x2, %eax
xorl %edx, %edx
divl -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
imull -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movl 0xa4f29(%rip), %eax     # 0xd08d0
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divl 0x30(%rcx)
movl %eax, %ecx
movl -0x24(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2b9c5
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
movl $0x5, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x14(%rbp)
movl -0x10(%rbp), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x2b950
movl %eax, %ecx
movl -0x24(%rbp), %eax
addl %ecx, %eax
addl -0x14(%rbp), %eax
xorl %edx, %edx
divl -0x14(%rbp)
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
subl -0x10(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
movl 0xa4e9c(%rip), %eax     # 0xd08d0
movq -0x8(%rbp), %rcx
xorl %edx, %edx
divl 0x30(%rcx)
movl %eax, %ecx
movl -0x20(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jbe 0x2ba73
movl -0x1c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl 0xa4e7b(%rip), %eax     # 0xd08d0
movq -0x8(%rbp), %rcx
xorl %edx, %edx
divl 0x30(%rcx)
movl %eax, %ecx
movl -0x28(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jae 0x2ba73
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2ba75
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x2b950
movl %eax, %ecx
movb $0x1, %al
cmpl -0x1c(%rbp), %ecx
movb %al, -0x29(%rbp)
je 0x2bab2
movl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl 0xa4e37(%rip), %eax     # 0xd08d0
movq -0x8(%rbp), %rcx
xorl %edx, %edx
divl 0x30(%rcx)
movl %eax, %ecx
movl -0x30(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x2babb
jmp 0x2bac6
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2ba75
movl -0x1c(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x2bb58
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x2bb48
xorl %eax, %eax
cmpl -0x14(%rbp), %eax
je 0x2bb13
movq -0x28(%rbp), %rax
movl 0x30(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x2bb48
movq -0x28(%rbp), %rax
movzbl 0x77(%rax), %eax
cmpl $0x1, %eax
jne 0x2bb3d
movq -0x28(%rbp), %rdi
callq 0x2be00
movl %eax, -0x2c(%rbp)
xorl %eax, %eax
cmpl -0x2c(%rbp), %eax
je 0x2bb3b
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2bb5f
jmp 0x2bb46
movq -0x28(%rbp), %rdi
callq 0x2bec0
jmp 0x2bb48
jmp 0x2bb4a
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x2baef
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: saveCursorPosition
static int saveCursorPosition(BtCursor *pCur){
  int rc;

  assert( CURSOR_VALID==pCur->eState );
  assert( 0==pCur->pKey );
  assert( cursorHoldsMutex(pCur) );

  rc = sqlite3BtreeKeySize(pCur, &pCur->nKey);
  assert( rc==SQLITE_OK );  /* KeySize() cannot fail */

  /* If this is an intKey table, then the above call to BtreeKeySize()
  ** stores the integer key in pCur->nKey. In this case this value is
  ** all that is required. Otherwise, if pCur is not open on an intKey
  ** table, then malloc space for and store the pCur->nKey bytes of key 
  ** data.
  */
  if( 0==pCur->apPage[0]->intKey ){
    void *pKey = sqlite3Malloc( (int)pCur->nKey );
    if( pKey ){
      rc = sqlite3BtreeKey(pCur, 0, (int)pCur->nKey, pKey);
      if( rc==SQLITE_OK ){
        pCur->pKey = pKey;
      }else{
        sqlite3_free(pKey);
      }
    }else{
      rc = SQLITE_NOMEM;
    }
  }
  assert( !pCur->apPage[0]->intKey || !pCur->pKey );

  if( rc==SQLITE_OK ){
    btreeReleaseAllCursorPages(pCur);
    pCur->eState = CURSOR_REQUIRESEEK;
  }

  invalidateOverflowCache(pCur);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x60, %rsi
callq 0x2bf30
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movzbl 0x2(%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2be93
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movl %eax, %edi
callq 0xa3c0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x2be8a
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movl %eax, %edx
movq -0x18(%rbp), %rcx
xorl %esi, %esi
callq 0x2bfc0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x2be7f
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x68(%rax)
jmp 0x2be88
movq -0x18(%rbp), %rdi
callq 0xa420
jmp 0x2be91
movl $0x7, -0xc(%rbp)
jmp 0x2be93
cmpl $0x0, -0xc(%rbp)
jne 0x2beaa
movq -0x8(%rbp), %rdi
callq 0x2bec0
movq -0x8(%rbp), %rax
movb $0x3, 0x77(%rax)
movq -0x8(%rbp), %rdi
callq 0x2bdd0
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl 0x7a(%rcx), %ecx
cmpl %ecx, %eax
jg 0x2bf16
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0xa8(%rax,%rcx,8), %rdi
callq 0x29fd0
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq $0x0, 0xa8(%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2bed3
movq -0x8(%rbp), %rax
movw $0xffff, 0x7a(%rax)     # imm = 0xFFFF
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x77(%rax), %eax
cmpl $0x1, %eax
je 0x2bf5a
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
jmp 0x2bfb7
movq -0x8(%rbp), %rax
movzwl 0x5e(%rax), %eax
cmpl $0x0, %eax
jne 0x2bfa6
movq -0x8(%rbp), %rax
movswl 0x7a(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0xa8(%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movzwl 0x7c(%rax,%rcx,2), %esi
movq -0x8(%rbp), %rdx
addq $0x40, %rdx
callq 0x2c000
movq -0x8(%rbp), %rax
movb $0x1, 0x76(%rax)
jmp 0x2bfa8
jmp 0x2bfa8
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: copyPayload
static int copyPayload(
  void *pPayload,           /* Pointer to page data */
  void *pBuf,               /* Pointer to buffer */
  int nByte,                /* Number of bytes to copy */
  int eOp,                  /* 0 -> copy from page, 1 -> copy to page */
  DbPage *pDbPage           /* Page containing pPayload */
){
  if( eOp ){
    /* Copy data from buffer to page (a write operation) */
    int rc = sqlite3PagerWrite(pDbPage);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    memcpy(pPayload, pBuf, nByte);
  }else{
    /* Copy data from page to buffer (a read operation) */
    memcpy(pBuf, pPayload, nByte);
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x2cc4d
movq -0x28(%rbp), %rdi
callq 0xef80
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x2cc3a
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2cc65
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x82f0
jmp 0x2cc5e
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x82f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x2b950
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x34(%rbp), %esi
leaq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0xe5f0
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
je 0x2ce3f
movl -0x48(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2cee4
movq -0x30(%rbp), %rdi
callq 0xec10
movq %rax, -0x40(%rbp)
movl -0x14(%rbp), %eax
subl -0x34(%rbp), %eax
subl $0x1, %eax
imull $0x5, %eax, %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jge 0x2ce79
movq -0x30(%rbp), %rdi
callq 0xec30
movl $0xc510, %edi           # imm = 0xC510
callq 0x24410
movl %eax, -0x4(%rbp)
jmp 0x2cee4
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movb (%rax,%rcx), %cl
movq -0x20(%rbp), %rax
movb %cl, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x2cead
movq -0x40(%rbp), %rdi
movl -0x44(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
callq 0x20a50
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rdi
callq 0xec30
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jl 0x2cece
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5, %eax
jle 0x2cedd
movl $0xc518, %edi           # imm = 0xC518
callq 0x24410
movl %eax, -0x4(%rbp)
jmp 0x2cee4
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movb (%rax), %al
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x24a60
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x2dc32
jmp 0x2dd2d
movq -0x8(%rbp), %rax
movzwl 0x10(%rax), %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x2dce9
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x8(%rbp), %rcx
movzwl 0x12(%rcx), %ecx
movq -0x8(%rbp), %rdx
movq 0x60(%rdx), %rdx
movl -0xc(%rbp), %esi
shll %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
shll $0x8, %edx
movq -0x8(%rbp), %rsi
movq 0x60(%rsi), %rsi
movl -0xc(%rbp), %edi
shll %edi
movslq %edi, %rdi
movzbl 0x1(%rsi,%rdi), %esi
orl %esi, %edx
andl %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x14(%rbp), %rdx
callq 0x2e2c0
movq -0x8(%rbp), %rax
cmpb $0x0, 0x3(%rax)
jne 0x2dcd9
movq -0x30(%rbp), %rdi
callq 0x20a50
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x28(%rbp), %ecx
movl $0x5, %edx
leaq -0x14(%rbp), %r8
callq 0x2dd40
jmp 0x2dcdb
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2dc44
movq -0x8(%rbp), %rax
cmpb $0x0, 0x3(%rax)
jne 0x2dd2b
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x8(%rbp), %rax
movzbl 0x5(%rax), %eax
addl $0x8, %eax
cltq
addq %rax, %rdi
callq 0x20a50
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movl -0x38(%rbp), %esi
movl -0x28(%rbp), %ecx
movl $0x5, %edx
leaq -0x14(%rbp), %r8
callq 0x2dd40
jmp 0x2dd2d
movb -0x21(%rbp), %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movl -0x14(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x18(%rbp)
movq 0xa24ce(%rip), %rax     # 0xd0580
movq -0x18(%rbp), %rcx
movq 0x40(%rcx), %rdi
movq -0x8(%rbp), %rcx
movq (%rcx), %rsi
movq -0x8(%rbp), %rcx
movl 0x28(%rcx), %edx
movl -0xc(%rbp), %ecx
callq *%rax
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rax
movzwl 0x2c(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2e109
movq -0x8(%rbp), %rax
movzwl 0x2c(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2e109
movq -0x8(%rbp), %rdi
callq 0x248d0
movq -0x8(%rbp), %rdi
callq 0x28980
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2e2df
jmp 0x2e32a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x2c070
cmpw $0x0, -0x1c(%rbp)
je 0x2e32a
movq -0x10(%rbp), %rdi
movzwl -0x1c(%rbp), %eax
addq %rax, %rdi
callq 0x20a50
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x3c(%rbp), %esi
movq -0x8(%rbp), %rax
movl 0x70(%rax), %ecx
movq -0x18(%rbp), %r8
movl $0x3, %edx
callq 0x2dd40
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x2e34b
jmp 0x2e3e0
movq -0x8(%rbp), %rdi
callq 0xe0f0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x2e3e0
movq -0x18(%rbp), %rdi
callq 0x2e3f0
movq -0x18(%rbp), %rax
movb $0x4, 0x77(%rax)
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x70(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x7a(%rcx), %ecx
cmpl %ecx, %eax
jg 0x2e3d0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq 0xa8(%rax,%rcx,8), %rdi
callq 0x29fd0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq $0x0, 0xa8(%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2e38d
jmp 0x2e3d2
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x2e364
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeClearCursor
SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *pCur){
  assert( cursorHoldsMutex(pCur) );
  sqlite3_free(pCur->pKey);
  pCur->pKey = 0;
  pCur->eState = CURSOR_INVALID;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0xa420
movq -0x8(%rbp), %rax
movq $0x0, 0x68(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x77(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)