LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerUndoCallback
static int pagerUndoCallback(void *pCtx, Pgno iPg){
  int rc = SQLITE_OK;
  Pager *pPager = (Pager *)pCtx;
  PgHdr *pPg;

  assert( pagerUseWal(pPager) );
  pPg = sqlite3PagerLookup(pPager, iPg);
  if( pPg ){
    if( sqlite3PcachePageRefcount(pPg)==1 ){
      sqlite3PcacheDrop(pPg);
    }else{
      u32 iFrame = 0;
      rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame);
      if( rc==SQLITE_OK ){
        rc = readDbPage(pPg, iFrame);
      }
      if( rc==SQLITE_OK ){
        pPager->xReiniter(pPg);
      }
      sqlite3PagerUnref(pPg);
    }
  }

  /* Normally, if a transaction is rolled back, any backup processes are
  ** updated as data is copied out of the rollback journal and into the
  ** database. This is not generally possible with a WAL database, as
  ** rollback involves simply truncating the log file. Therefore, if one
  ** or more frames have already been written to the log (and therefore 
  ** also copied into the backup databases) as part of this transaction,
  ** the backups must be restarted.
  */
  sqlite3BackupRestart(pPager->pBackup);

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x1c915
xorl %r15d, %r15d
testq %rax, %rax
je 0x1c823
movq %rax, %r14
cmpw $0x1, 0x2e(%rax)
jne 0x1c7ee
movq %r14, %rdi
callq 0x1c93e
jmp 0x1c823
leaq -0x1c(%rbp), %rdx
andl $0x0, (%rdx)
movq 0x118(%rbx), %rdi
movl 0x28(%r14), %esi
callq 0x1c980
testl %eax, %eax
jne 0x1c818
movl -0x1c(%rbp), %esi
movq %r14, %rdi
callq 0x1ca94
testl %eax, %eax
je 0x1c83a
movl %eax, %r15d
movq %r14, %rdi
callq 0xcf6e
movq 0x70(%rbx), %rdi
callq 0x1a7a0
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq *0x100(%rbx)
xorl %r15d, %r15d
jmp 0x1c81b
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PcacheDirtyList
SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache *pCache){
  PgHdr *p;
  for(p=pCache->pDirty; p; p=p->pDirtyNext){
    p->pDirty = p->pDirtyNext;
  }
  return pcacheSortDirtyList(pCache->pDirty);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq (%rdi), %rbx
movq %rbx, %rax
testq %rax, %rax
je 0x1c870
movq 0x38(%rax), %rcx
movq %rcx, 0x18(%rax)
movq %rcx, %rax
jmp 0x1c85e
leaq -0x120(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x81e0
testq %rbx, %rbx
je 0x1c8e2
movq 0x18(%rbx), %r14
andq $0x0, 0x18(%rbx)
xorl %r15d, %r15d
cmpq $0x1f, %r15
je 0x1c8c0
movq -0x120(%rbp,%r15,8), %rdi
testq %rdi, %rdi
je 0x1c8d5
movq %rbx, %rsi
callq 0x1cd5e
movq %rax, %rbx
andq $0x0, -0x120(%rbp,%r15,8)
incq %r15
jmp 0x1c894
movq -0x28(%rbp), %rdi
movq %rbx, %rsi
callq 0x1cd5e
movq %rax, -0x28(%rbp)
movq %r14, %rbx
jmp 0x1c883
movq %rbx, -0x120(%rbp,%r15,8)
movq %r14, %rbx
jmp 0x1c883
pushq $0x1
popq %rbx
movq -0x120(%rbp), %rax
cmpq $0x20, %rbx
je 0x1c907
movq -0x120(%rbp,%rbx,8), %rsi
movq %rax, %rdi
callq 0x1cd5e
incq %rbx
jmp 0x1c8ec
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PagerLookup
SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
  PgHdr *pPg = 0;
  assert( pPager!=0 );
  assert( pgno!=0 );
  assert( pPager->pPCache!=0 );
  assert( pPager->eState>=PAGER_READER && pPager->eState!=PAGER_ERROR );
  sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg);
  return pPg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq -0x10(%rbp), %rbx
andq $0x0, (%rbx)
movq 0x110(%rdi), %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x1cb4c
movq (%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PcacheDrop
SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr *p){
  PCache *pCache;
  assert( p->nRef==1 );
  if( p->flags&PGHDR_DIRTY ){
    pcacheRemoveFromDirtyList(p);
  }
  pCache = p->pCache;
  pCache->nRef--;
  if( p->pgno==1 ){
    pCache->pPage1 = 0;
  }
  sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, p->pPage, 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb $0x2, 0x2c(%rdi)
je 0x1c955
movq %rbx, %rdi
callq 0x1a42f
movq 0x30(%rbx), %rax
decl 0x18(%rax)
cmpl $0x1, 0x28(%rbx)
jne 0x1c967
andq $0x0, 0x48(%rax)
movq 0x6ab7a(%rip), %rcx     # 0x874e8
movq 0x40(%rax), %rdi
movq (%rbx), %rsi
pushq $0x1
popq %rdx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: readDbPage
static int readDbPage(PgHdr *pPg, u32 iFrame){
  Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */
  Pgno pgno = pPg->pgno;       /* Page number to read */
  int rc = SQLITE_OK;          /* Return code */
  int pgsz = pPager->pageSize; /* Number of bytes to read */

  assert( pPager->eState>=PAGER_READER && !MEMDB );
  assert( isOpen(pPager->fd) );

#ifndef SQLITE_OMIT_WAL
  if( iFrame ){
    /* Try to pull the page from the write-ahead log. */
    rc = sqlite3WalReadFrame(pPager->pWal, iFrame, pgsz, pPg->pData);
  }else
#endif
  {
    i64 iOffset = (pgno-1)*(i64)pPager->pageSize;
    rc = sqlite3OsRead(pPager->fd, pPg->pData, pgsz, iOffset);
    if( rc==SQLITE_IOERR_SHORT_READ ){
      rc = SQLITE_OK;
    }
  }

  if( pgno==1 ){
    if( rc ){
      /* If the read is unsuccessful, set the dbFileVers[] to something
      ** that will never be a valid file version.  dbFileVers[] is a copy
      ** of bytes 24..39 of the database.  Bytes 28..31 should always be
      ** zero or the size of the database in page. Bytes 32..35 and 35..39
      ** should be page numbers which are never 0xffffffff.  So filling
      ** pPager->dbFileVers[] with all 0xff bytes should suffice.
      **
      ** For an encrypted database, the situation is more complex:  bytes
      ** 24..39 of the database are white noise.  But the probability of
      ** white noising equaling 16 bytes of 0xff is vanishingly small so
      ** we should still be ok.
      */
      memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));
    }else{
      u8 *dbFileVers = &((u8*)pPg->pData)[24];
      memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
    }
  }
  CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);

  PAGER_INCR(sqlite3_pager_readdb_count);
  PAGER_INCR(pPager->nRead);
  IOTRACE(("PGIN %p %d\n", pPager, pgno));
  PAGERTRACE(("FETCH %d page %d hash(%08x)\n",
               PAGERID(pPager), pgno, pager_pagehash(pPg)));

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %r14
movl 0x28(%rdi), %r15d
movslq 0xbc(%r14), %rdx
testl %esi, %esi
je 0x1cafc
movq 0x118(%r14), %rdi
movq 0x8(%rbx), %rax
movzwl 0x56(%rdi), %ecx
movl %ecx, %r8d
shll $0x10, %r8d
orl %ecx, %r8d
andl $0x1fe00, %r8d          # imm = 0x1FE00
decl %esi
leal 0x18(%r8), %ecx
imulq %rsi, %rcx
addq $0x38, %rcx
movq 0x10(%rdi), %rdi
cmpl %edx, %r8d
cmovgel %edx, %r8d
movq (%rdi), %r9
movq %rax, %rsi
movl %r8d, %edx
callq *0x10(%r9)
jmp 0x1cb1f
leal -0x1(%r15), %ecx
imulq %rdx, %rcx
movq 0x48(%r14), %rdi
movq 0x8(%rbx), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x20a, %ecx            # imm = 0x20A
cmovnel %ecx, %eax
cmpl $0x1, %r15d
jne 0x1cb41
testl %eax, %eax
je 0x1cb2f
pcmpeqd %xmm0, %xmm0
jmp 0x1cb38
movq 0x8(%rbx), %rcx
movdqu 0x18(%rcx), %xmm0
movdqu %xmm0, 0x84(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pcacheMergeDirtyList
static PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){
  PgHdr result, *pTail;
  pTail = &result;
  while( pA && pB ){
    if( pA->pgno<pB->pgno ){
      pTail->pDirty = pA;
      pTail = pA;
      pA = pA->pDirty;
    }else{
      pTail->pDirty = pB;
      pTail = pB;
      pB = pB->pDirty;
    }
  }
  if( pA ){
    pTail->pDirty = pA;
  }else if( pB ){
    pTail->pDirty = pB;
  }else{
    pTail->pDirty = 0;
  }
  return result.pDirty;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq -0x48(%rbp), %rax
movq %rax, %rcx
movq %rdi, %rax
testq %rax, %rax
je 0x1cd95
testq %rsi, %rsi
je 0x1cd95
movl 0x28(%rax), %edx
cmpl 0x28(%rsi), %edx
jb 0x1cd8b
movq %rsi, 0x18(%rcx)
movq %rsi, %rcx
movq 0x18(%rsi), %rsi
jmp 0x1cd6c
movq %rax, 0x18(%rcx)
movq 0x18(%rax), %rdi
jmp 0x1cd66
testq %rax, %rax
cmovneq %rax, %rsi
movq %rsi, 0x18(%rcx)
movq -0x30(%rbp), %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: read32bits
static int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){
  unsigned char ac[4];
  int rc = sqlite3OsRead(fd, ac, sizeof(ac), offset);
  if( rc==SQLITE_OK ){
    *pRes = sqlite3Get4byte(ac);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %rcx
movq (%rdi), %rax
leaq -0xc(%rbp), %rsi
pushq $0x4
popq %rdx
callq *0x10(%rax)
testl %eax, %eax
jne 0x1cdca
movl -0xc(%rbp), %ecx
bswapl %ecx
movl %ecx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pager_cksum
static u32 pager_cksum(Pager *pPager, const u8 *aData){
  u32 cksum = pPager->cksumInit;         /* Checksum value to return */
  int i = pPager->pageSize-200;          /* Loop counter */
  while( i>0 ){
    cksum += aData[i];
    i -= 200;
  }
  return cksum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x34(%rdi), %eax
movl 0xbc(%rdi), %ecx
cmpl $0xc9, %ecx
jl 0x1cdf9
movzbl -0xc8(%rsi,%rcx), %edx
addq $-0xc8, %rcx
addl %edx, %eax
jmp 0x1cdde
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pager_lookup
static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){
  PgHdr *p;                         /* Return value */

  /* It is not possible for a call to PcacheFetch() with createFlag==0 to
  ** fail, since no attempt to allocate dynamic memory will be made.
  */
  (void)sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &p);
  return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x110(%rdi), %rdi
leaq -0x10(%rbp), %rbx
xorl %edx, %edx
movq %rbx, %rcx
callq 0x1cb4c
movq (%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PcacheMakeDirty
SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){
  p->flags &= ~PGHDR_DONT_WRITE;
  assert( p->nRef>0 );
  if( 0==(p->flags & PGHDR_DIRTY) ){
    p->flags |= PGHDR_DIRTY;
    pcacheAddToDirtyList( p);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzwl 0x2c(%rdi), %ecx
movl %ecx, %eax
andl $-0x21, %eax
movw %ax, 0x2c(%rdi)
testb $0x2, %cl
jne 0x1ce40
orl $0x2, %eax
movw %ax, 0x2c(%rdi)
popq %rbp
jmp 0x1ce86
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PcacheRelease
SQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr *p){
  assert( p->nRef>0 );
  p->nRef--;
  if( p->nRef==0 ){
    PCache *pCache = p->pCache;
    pCache->nRef--;
    if( (p->flags&PGHDR_DIRTY)==0 ){
      pcacheUnpin(p);
    }else{
      /* Move the page to the head of the dirty list. */
      pcacheRemoveFromDirtyList(p);
      pcacheAddToDirtyList(p);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
decw 0x2e(%rdi)
je 0x1ce55
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rdi, %rbx
movq 0x30(%rdi), %rax
decl 0x18(%rax)
testb $0x2, 0x2c(%rdi)
jne 0x1ce73
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1a484
movq %rbx, %rdi
callq 0x1a42f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1ce86
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pcacheAddToDirtyList
static void pcacheAddToDirtyList(PgHdr *pPage){
  PCache *p = pPage->pCache;

  assert( pPage->pDirtyNext==0 && pPage->pDirtyPrev==0 && p->pDirty!=pPage );

  pPage->pDirtyNext = p->pDirty;
  if( pPage->pDirtyNext ){
    assert( pPage->pDirtyNext->pDirtyPrev==0 );
    pPage->pDirtyNext->pDirtyPrev = pPage;
  }
  p->pDirty = pPage;
  if( !p->pDirtyTail ){
    p->pDirtyTail = pPage;
  }
  if( !p->pSynced && 0==(pPage->flags&PGHDR_NEED_SYNC) ){
    p->pSynced = pPage;
  }
  expensive_assert( pcacheCheckSynced(p) );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x30(%rdi), %rax
movq (%rax), %rcx
movq %rcx, 0x38(%rdi)
testq %rcx, %rcx
je 0x1ce9e
movq %rdi, 0x40(%rcx)
movq %rdi, (%rax)
cmpq $0x0, 0x8(%rax)
jne 0x1ceac
movq %rdi, 0x8(%rax)
cmpq $0x0, 0x10(%rax)
jne 0x1cebd
testb $0x4, 0x2c(%rdi)
jne 0x1cebd
movq %rdi, 0x10(%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: readMasterJournal
static int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, u32 nMaster){
  int rc;                    /* Return code */
  u32 len;                   /* Length in bytes of master journal name */
  i64 szJ;                   /* Total size in bytes of journal file pJrnl */
  u32 cksum;                 /* MJ checksum value read from journal */
  u32 u;                     /* Unsigned loop counter */
  unsigned char aMagic[8];   /* A buffer to hold the magic header */
  zMaster[0] = '\0';

  if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ))
   || szJ<16
   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len))
   || len>=nMaster 
   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum))
   || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8))
   || memcmp(aMagic, aJournalMagic, 8)
   || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len))
  ){
    return rc;
  }

  /* See if the checksum matches the master journal name */
  for(u=0; u<len; u++){
    cksum -= zMaster[u];
  }
  if( cksum ){
    /* If the checksum doesn't add up, then one or more of the disk sectors
    ** containing the master journal filename is corrupted. This means
    ** definitely roll back, so just return SQLITE_OK and report a (nul)
    ** master-journal filename.
    */
    len = 0;
  }
  zMaster[len] = '\0';
   
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r13d
movq %rsi, %rbx
movq %rdi, %r15
movb $0x0, (%rsi)
movq (%rdi), %rax
leaq -0x30(%rbp), %r14
movq %r14, %rsi
callq *0x30(%rax)
movl %eax, %r12d
testl %eax, %eax
setne %al
movq (%r14), %rsi
cmpq $0x10, %rsi
setl %cl
orb %al, %cl
jne 0x1cf16
addq $-0x10, %rsi
leaq -0x38(%rbp), %rdx
movq %r15, %rdi
callq 0x1cda6
testl %eax, %eax
je 0x1cf28
movl %eax, %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x38(%rbp), %r14d
xorl %r12d, %r12d
cmpl %r13d, %r14d
jae 0x1cf16
movq -0x30(%rbp), %rsi
addq $-0xc, %rsi
leaq -0x34(%rbp), %rdx
movq %r15, %rdi
callq 0x1cda6
testl %eax, %eax
jne 0x1cf13
movq -0x30(%rbp), %rcx
addq $-0x8, %rcx
movq (%r15), %rax
leaq -0x40(%rbp), %rsi
pushq $0x8
popq %rdx
movq %r15, %rdi
callq *0x10(%rax)
testl %eax, %eax
jne 0x1cf13
movabsq $-0x289c5edf06fa2a27, %rax # imm = 0xD763A120F905D5D9
cmpq %rax, -0x40(%rbp)
jne 0x1cf16
movq -0x30(%rbp), %rcx
subq %r14, %rcx
addq $-0x10, %rcx
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq *0x10(%rax)
testl %eax, %eax
jne 0x1cf13
movl -0x34(%rbp), %eax
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x1cfaf
movsbl (%rbx,%rcx), %edx
subl %edx, %eax
incq %rcx
jmp 0x1cf9f
xorl %r12d, %r12d
testl %eax, %eax
cmovnel %r12d, %r14d
movb $0x0, (%rbx,%r14)
jmp 0x1cf16
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pager_truncate
static int pager_truncate(Pager *pPager, Pgno nPage){
  int rc = SQLITE_OK;
  assert( pPager->eState!=PAGER_ERROR );
  assert( pPager->eState!=PAGER_READER );
  
  if( isOpen(pPager->fd) 
   && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) 
  ){
    i64 currentSize, newSize;
    int szPage = pPager->pageSize;
    assert( pPager->eLock==EXCLUSIVE_LOCK );
    /* TODO: Is it safe to use Pager.dbFileSize here? */
    rc = sqlite3OsFileSize(pPager->fd, &currentSize);
    newSize = szPage*(i64)nPage;
    if( rc==SQLITE_OK && currentSize!=newSize ){
      if( currentSize>newSize ){
        rc = sqlite3OsTruncate(pPager->fd, newSize);
      }else if( (currentSize+szPage)<=newSize ){
        char *pTmp = pPager->pTmpSpace;
        memset(pTmp, 0, szPage);
        testcase( (newSize-szPage) == currentSize );
        testcase( (newSize-szPage) >  currentSize );
        rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, newSize-szPage);
      }
      if( rc==SQLITE_OK ){
        pPager->dbFileSize = nPage;
      }
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x48(%rdi), %rdi
movq (%rdi), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x1d060
movb 0x13(%r14), %dl
addb $-0x4, %dl
cmpb $-0x4, %dl
ja 0x1d060
movl %esi, %ebx
movslq 0xbc(%r14), %r15
leaq -0x30(%rbp), %rsi
callq *0x30(%rcx)
testl %eax, %eax
jne 0x1d060
movl %ebx, %r12d
imulq %r15, %r12
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq %r12, %rcx
je 0x1d060
jle 0x1d024
movq 0x48(%r14), %rdi
movq (%rdi), %rax
movq %r12, %rsi
callq *0x20(%rax)
jmp 0x1d056
addq %r15, %rcx
cmpq %r12, %rcx
jg 0x1d05a
movq 0x108(%r14), %r13
movq %r13, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x81e0
movq 0x48(%r14), %rdi
subq %r15, %r12
movq (%rdi), %rax
movq %r13, %rsi
movl %r15d, %edx
movq %r12, %rcx
callq *0x18(%rax)
testl %eax, %eax
jne 0x1d060
movl %ebx, 0x24(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: newDatabase
static int newDatabase(BtShared *pBt){
  MemPage *pP1;
  unsigned char *data;
  int rc;

  assert( sqlite3_mutex_held(pBt->mutex) );
  if( pBt->nPage>0 ){
    return SQLITE_OK;
  }
  pP1 = pBt->pPage1;
  assert( pP1!=0 );
  data = pP1->aData;
  rc = sqlite3PagerWrite(pP1->pDbPage);
  if( rc ) return rc;
  memcpy(data, zMagicHeader, sizeof(zMagicHeader));
  assert( sizeof(zMagicHeader)==16 );
  data[16] = (u8)((pBt->pageSize>>8)&0xff);
  data[17] = (u8)((pBt->pageSize>>16)&0xff);
  data[18] = 1;
  data[19] = 1;
  assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);
  data[20] = (u8)(pBt->pageSize - pBt->usableSize);
  data[21] = 64;
  data[22] = 32;
  data[23] = 32;
  memset(&data[24], 0, 100-24);
  zeroPage(pP1, PTF_INTKEY|PTF_LEAF|PTF_LEAFDATA );
  pBt->btsFlags |= BTS_PAGESIZE_FIXED;
#ifndef SQLITE_OMIT_AUTOVACUUM
  assert( pBt->autoVacuum==1 || pBt->autoVacuum==0 );
  assert( pBt->incrVacuum==1 || pBt->incrVacuum==0 );
  put4byte(&data[36 + 4*4], pBt->autoVacuum);
  put4byte(&data[36 + 7*4], pBt->incrVacuum);
#endif
  pBt->nPage = 1;
  data[31] = 1;
  return SQLITE_OK;
}

// Assembly:
xorl %eax, %eax
cmpl $0x0, 0x3c(%rdi)
je 0x1d14a
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %r14
movq 0x50(%r14), %r15
movq 0x68(%r14), %rdi
callq 0xd10b
testl %eax, %eax
jne 0x1d201
movaps 0x4b219(%rip), %xmm0    # 0x68390
movups %xmm0, (%r15)
movb 0x31(%rbx), %al
movb %al, 0x10(%r15)
movb 0x32(%rbx), %al
movb %al, 0x11(%r15)
movw $0x101, 0x12(%r15)      # imm = 0x101
movl 0x30(%rbx), %eax
subl 0x34(%rbx), %eax
movb %al, 0x14(%r15)
movw $0x2040, 0x15(%r15)     # imm = 0x2040
movb $0x20, 0x17(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r15)
movups %xmm0, 0x28(%r15)
movups %xmm0, 0x38(%r15)
movups %xmm0, 0x48(%r15)
movups %xmm0, 0x54(%r15)
pushq $0xd
popq %rsi
movq %r14, %rdi
callq 0x1db70
orb $0x2, 0x26(%rbx)
movb 0x21(%rbx), %cl
andw $0x0, 0x34(%r15)
xorl %eax, %eax
movb %al, 0x36(%r15)
movb %cl, 0x37(%r15)
movb 0x22(%rbx), %cl
andw $0x0, 0x40(%r15)
movb %al, 0x42(%r15)
movb %cl, 0x43(%r15)
movl $0x1, 0x3c(%rbx)
movb $0x1, 0x1f(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unlockBtreeIfUnused
static void unlockBtreeIfUnused(BtShared *pBt){
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( countValidCursors(pBt,0)==0 || pBt->inTransaction>TRANS_NONE );
  if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){
    assert( pBt->pPage1->aData );
    assert( sqlite3PagerRefcount(pBt->pPager)==1 );
    assert( pBt->pPage1->aData );
    releasePage(pBt->pPage1);
    pBt->pPage1 = 0;
  }
}

// Assembly:
cmpb $0x0, 0x24(%rdi)
je 0x1d213
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x1d22f
callq 0x1d90e
andq $0x0, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreeGetPage
static int btreeGetPage(
  BtShared *pBt,       /* The btree */
  Pgno pgno,           /* Number of the page to fetch */
  MemPage **ppPage,    /* Return the page in this parameter */
  int flags            /* PAGER_GET_NOCONTENT or PAGER_GET_READONLY */
){
  int rc;
  DbPage *pDbPage;

  assert( flags==0 || flags==PAGER_GET_NOCONTENT || flags==PAGER_GET_READONLY );
  assert( sqlite3_mutex_held(pBt->mutex) );
  rc = sqlite3PagerAcquire(pBt->pPager, pgno, (DbPage**)&pDbPage, flags);
  if( rc ) return rc;
  *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
movq (%rdi), %rdi
leaq -0x20(%rbp), %rdx
callq 0xca7d
testl %eax, %eax
jne 0x1d89f
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rsi
movq %rdx, 0x50(%rsi)
movq %rcx, 0x68(%rsi)
movq %r15, 0x48(%rsi)
movl %r14d, 0x70(%rsi)
xorl %ecx, %ecx
cmpl $0x1, %r14d
pushq $0x64
popq %rdx
cmovnel %ecx, %edx
movb %dl, 0x5(%rsi)
movq %rsi, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PagerOpenWal
SQLITE_PRIVATE int sqlite3PagerOpenWal(
  Pager *pPager,                  /* Pager object */
  int *pbOpen                     /* OUT: Set to true if call is a no-op */
){
  int rc = SQLITE_OK;             /* Return code */

  assert( assert_pager_state(pPager) );
  assert( pPager->eState==PAGER_OPEN   || pbOpen );
  assert( pPager->eState==PAGER_READER || !pbOpen );
  assert( pbOpen==0 || *pbOpen==0 );
  assert( pbOpen!=0 || (!pPager->tempFile && !pPager->pWal) );

  if( !pPager->tempFile && !pPager->pWal ){
    if( !sqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN;

    /* Close any rollback journal previously open */
    sqlite3OsClose(pPager->jfd);

    rc = pagerOpenWal(pPager);
    if( rc==SQLITE_OK ){
      pPager->journalMode = PAGER_JOURNALMODE_WAL;
      pPager->eState = PAGER_OPEN;
    }
  }else{
    *pbOpen = 1;
  }

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpb $0x0, 0x10(%rdi)
jne 0x1d8c4
movq %rdi, %rbx
cmpq $0x0, 0x118(%rdi)
je 0x1d8d1
movl $0x1, (%rsi)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
callq 0x1d9c6
testl %eax, %eax
je 0x1d909
movq 0x50(%rbx), %r14
movq (%r14), %rax
testq %rax, %rax
je 0x1d8f3
movq %r14, %rdi
callq *0x8(%rax)
andq $0x0, (%r14)
movq %rbx, %rdi
callq 0x1d9f0
testl %eax, %eax
jne 0x1d8cc
movb $0x5, 0x9(%rbx)
movb $0x0, 0x13(%rbx)
jmp 0x1d8ca
pushq $0xe
popq %rax
jmp 0x1d8cc
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x118(%rdi), %rax
testq %rax, %rax
je 0x1d972
cmpw $0x0, 0x3c(%rax)
js 0x1d972
movl 0x5c(%rax), %eax
testl %eax, %eax
jne 0x1d9a9
andq $0x0, -0x18(%rbp)
movq 0x48(%r14), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x1d997
leaq -0x18(%rbp), %rsi
callq *0x30(%rax)
testl %eax, %eax
jne 0x1d9bd
movq -0x18(%rbp), %rax
decq %rax
jmp 0x1d99a
pushq $-0x1
popq %rax
movslq 0xbc(%r14), %rcx
addq %rcx, %rax
cqto
idivq %rcx
cmpl 0xc0(%r14), %eax
jbe 0x1d9b9
movl %eax, 0xc0(%r14)
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x1da2a
movq %rbx, %rdi
callq 0x1db44
movl %eax, %r15d
testl %eax, %eax
jne 0x1db2a
cmpb $0x0, 0x8(%rbx)
setne %r13b
addb %r13b, %r13b
jmp 0x1da2d
xorl %r13d, %r13d
movq (%rbx), %r15
movq 0x48(%rbx), %rax
movq %rax, -0x40(%rbp)
movq 0x120(%rbx), %r12
movq 0xc8(%rbx), %rax
movq %rax, -0x38(%rbp)
andq $0x0, 0x118(%rbx)
movl $0x88, %edi
addl 0x4(%r15), %edi
callq 0xbeb2
testq %rax, %rax
je 0x1daef
movq %rax, %r14
movq %r15, (%rax)
movq %rax, %rdx
addq $0x88, %rdx
movq %rdx, 0x10(%rax)
movq -0x40(%rbp), %rax
movq %rax, 0x8(%r14)
orw $-0x1, 0x3c(%r14)
movq -0x38(%rbp), %rax
movq %rax, 0x20(%r14)
movq %r12, 0x78(%r14)
movw $0x101, 0x44(%r14)      # imm = 0x101
movb %r13b, 0x3f(%r14)
leaq -0x2c(%rbp), %r8
movl $0x80006, (%r8)         # imm = 0x80006
movq %r15, %rdi
movq %r12, %rsi
movl $0x80006, %ecx          # imm = 0x80006
callq *0x28(%r15)
testl %eax, %eax
je 0x1daf5
movl %eax, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x1b3ce
movq 0x10(%r14), %r12
movq (%r12), %rax
testq %rax, %rax
je 0x1dae5
movq %r12, %rdi
callq *0x8(%rax)
andq $0x0, (%r12)
movq %r14, %rdi
callq 0x9c7b
jmp 0x1db2a
pushq $0x7
popq %r15
jmp 0x1db2a
testb $0x1, -0x2c(%rbp)
je 0x1db00
movb $0x1, 0x42(%r14)
movq 0x10(%r14), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
btl $0xa, %eax
jae 0x1db15
movb $0x0, 0x44(%r14)
btl $0xc, %eax
jae 0x1db20
movb $0x0, 0x45(%r14)
movq %r14, 0x118(%rbx)
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x1a685
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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
pushq $0x4
popq %rsi
callq 0x1a3e8
movl %eax, %r14d
testl %eax, %eax
je 0x1db68
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1b646
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1dbaf
leaq (%r12,%r13), %rdi
movl 0x34(%r15), %edx
subl %r13d, %edx
movl %esi, %r14d
xorl %esi, %esi
callq 0x81e0
movl %r14d, %esi
movb %sil, (%r12,%r13)
movl %esi, %r14d
shrl %r14d
andl $0x4, %r14d
xorl $0xc, %r14d
addl %r13d, %r14d
andl $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 0x1a617
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)
andw $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_O2/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), %rax
movq 0x8(%rdi), %r14
movb $0x0, 0x23(%r14)
cmpb $0x0, 0x10(%rdi)
je 0x1dfa1
cmpl $0x2, 0xa0(%rax)
jl 0x1df1b
cmpq %rbx, 0x78(%r14)
je 0x1df61
movb $0x1, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x70(%r14), %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0x1df49
cmpq %rbx, (%rdi)
jne 0x1df40
movq 0x10(%rdi), %rax
movq %rax, (%r15)
cmpl $0x1, 0x8(%rdi)
je 0x1df1f
callq 0x9c7b
jmp 0x1df1f
addq $0x10, %rdi
movq %rdi, %r15
jmp 0x1df1f
cmpq %rbx, 0x78(%r14)
je 0x1df82
movl 0x38(%r14), %eax
cmpl $0x2, %eax
jne 0x1df94
movw $0xffbf, %cx            # imm = 0xFFBF
pushq $0x2
popq %rax
jmp 0x1df8f
andq $0x0, 0x78(%r14)
andb $-0x61, 0x26(%r14)
addq $0x70, %r14
movq (%r14), %r14
testq %r14, %r14
je 0x1df0c
movb $0x1, 0xc(%r14)
addq $0x10, %r14
jmp 0x1df6f
andq $0x0, 0x78(%r14)
movl 0x38(%r14), %eax
movw $0xff9f, %cx            # imm = 0xFF9F
andw %cx, 0x26(%r14)
decl %eax
movl %eax, 0x38(%r14)
jne 0x1dfa1
movb $0x0, 0x24(%r14)
movb $0x0, 0x10(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1d20c
// File: /workspace/github_c_makefile_star2_O2/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
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x1dfd3
movq %rbx, %rdi
callq 0x1e351
jmp 0x1dfc0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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:
xorl %eax, %eax
cmpl $0x2, %esi
jb 0x1e01c
pushq %rbp
movq %rsp, %rbp
movl 0x34(%rdi), %eax
movl $0x5, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
incl %ecx
addl $-0x2, %esi
movl %esi, %eax
xorl %edx, %edx
divl %ecx
subl %edx, %esi
movl 0x6983a(%rip), %eax     # 0x87840
xorl %edx, %edx
divl 0x30(%rdi)
leal 0x1(%rsi), %ecx
xorl %edx, %edx
cmpl %eax, %ecx
sete %dl
leal (%rsi,%rdx), %eax
addl $0x2, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %r14d
movq %rdi, %rbx
movl 0x34(%rdi), %eax
pushq $0x5
popq %rcx
xorl %edx, %edx
divl %ecx
movl %eax, %r12d
movl %r15d, %r13d
subl %esi, %r13d
callq 0x1dfda
addl %r13d, %eax
addl %r12d, %eax
xorl %edx, %edx
divl %r12d
addl %r15d, %eax
movl %r14d, %ecx
subl %eax, %ecx
movl 0x697db(%rip), %eax     # 0x87840
xorl %edx, %edx
divl 0x30(%rbx)
movl %eax, %r15d
incl %r15d
cmpl %r14d, %r15d
setb %al
cmpl %r15d, %ecx
setb %dl
andb %al, %dl
movzbl %dl, %eax
subl %eax, %ecx
movl %ecx, %r14d
movq %rbx, %rdi
movl %ecx, %esi
callq 0x1dfda
cmpl %eax, %r14d
sete %al
cmpl %r15d, %r14d
sete %dl
orb %al, %dl
leal -0x1(%r14), %ecx
testb %dl, %dl
jne 0x1e083
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
movq 0x10(%r15), %r15
testq %r15, %r15
je 0x1e175
cmpq %rbx, %r15
je 0x1e0cf
testl %r14d, %r14d
je 0x1e0ec
cmpl %r14d, 0x30(%r15)
jne 0x1e0cf
cmpb $0x1, 0x77(%r15)
jne 0x1e12e
leaq 0x60(%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x1e3ab
movq 0xa8(%r15), %rax
cmpb $0x0, 0x2(%rax)
je 0x1e138
movq %r15, %rdi
callq 0x1e36f
movb $0x3, 0x77(%r15)
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x1e351
testl %r12d, %r12d
je 0x1e0cf
jmp 0x1e178
movq %r15, %rdi
callq 0x1e36f
jmp 0x1e0cf
movl (%r12), %edi
callq 0x9c40
pushq $0x7
popq %r12
testq %rax, %rax
je 0x1e11f
movq %rax, %r13
movl 0x60(%r15), %edx
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x1e401
testl %eax, %eax
je 0x1e16f
movl %eax, %r12d
movq %r13, %rdi
callq 0x9c7b
jmp 0x1e11f
movq %r13, 0x68(%r15)
jmp 0x1e10f
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_O2/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
xorl %r14d, %r14d
movswq 0x7a(%rbx), %rax
cmpq %rax, %r14
jg 0x1e3a1
movq 0xa8(%rbx,%r14,8), %rdi
callq 0x1d90e
andq $0x0, 0xa8(%rbx,%r14,8)
incq %r14
jmp 0x1e37c
orw $-0x1, 0x7a(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1e3f1
movq %rdi, %r14
leaq 0x40(%rdi), %r15
cmpw $0x0, 0x5e(%rdi)
jne 0x1e3ec
movswq 0x7a(%r14), %rax
movq 0xa8(%r14,%rax,8), %rdi
movzwl 0x7c(%r14,%rax,2), %esi
movq %r15, %rdx
callq 0x1e40e
movb $0x1, 0x76(%r14)
movq (%r15), %rax
jmp 0x1e3f3
xorl %eax, %eax
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
testl %ecx, %ecx
je 0x1ea94
movq %r8, %rdi
callq 0xd10b
testl %eax, %eax
jne 0x1eaa4
movslq %r15d, %rdx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0x1ea9d
movslq %r15d, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x82c0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: getOverflowPage
static int getOverflowPage(
  BtShared *pBt,               /* The database file */
  Pgno ovfl,                   /* Current overflow page number */
  MemPage **ppPage,            /* OUT: MemPage handle (may be NULL) */
  Pgno *pPgnoNext              /* OUT: Next overflow page number */
){
  Pgno next = 0;
  MemPage *pPage = 0;
  int rc = SQLITE_OK;

  assert( sqlite3_mutex_held(pBt->mutex) );
  assert(pPgnoNext);

#ifndef SQLITE_OMIT_AUTOVACUUM
  /* Try to find the next page in the overflow list using the
  ** autovacuum pointer-map pages. Guess that the next page in 
  ** the overflow list is page number (ovfl+1). If that guess turns 
  ** out to be wrong, fall back to loading the data of page 
  ** number ovfl to determine the next page number.
  */
  if( pBt->autoVacuum ){
    Pgno pgno;
    Pgno iGuess = ovfl+1;
    u8 eType;

    while( PTRMAP_ISPAGE(pBt, iGuess) || iGuess==PENDING_BYTE_PAGE(pBt) ){
      iGuess++;
    }

    if( iGuess<=btreePagecount(pBt) ){
      rc = ptrmapGet(pBt, iGuess, &eType, &pgno);
      if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){
        next = iGuess;
        rc = SQLITE_DONE;
      }
    }
  }
#endif

  assert( next==0 || rc==SQLITE_DONE );
  if( rc==SQLITE_OK ){
    rc = btreeGetPage(pBt, ovfl, &pPage, (ppPage==0) ? PAGER_GET_READONLY : 0);
    assert( rc==SQLITE_OK || pPage==0 );
    if( rc==SQLITE_OK ){
      next = get4byte(pPage->aData);
    }
  }

  *pPgnoNext = next;
  if( ppPage ){
    *ppPage = pPage;
  }else{
    releasePage(pPage);
  }
  return (rc==SQLITE_DONE ? SQLITE_OK : rc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, -0x50(%rbp)
movq %rdx, %r15
andq $0x0, -0x38(%rbp)
movl %esi, %ebx
movq %rdi, %r12
cmpb $0x0, 0x21(%rdi)
je 0x1eb19
movq %r15, -0x48(%rbp)
movl 0x68d5e(%rip), %r14d    # 0x87840
movl %ebx, %r15d
movl %r15d, %r13d
leal 0x1(%r13), %r15d
movq %r12, %rdi
movl %r15d, %esi
callq 0x1dfda
cmpl %eax, %r15d
je 0x1eae5
movl %r14d, %eax
xorl %edx, %edx
divl 0x30(%r12)
cmpl %eax, %r13d
je 0x1eae5
incl %r13d
cmpl 0x3c(%r12), %r13d
movq -0x48(%rbp), %r15
jbe 0x1eb3d
xorl %ecx, %ecx
testq %r15, %r15
sete %cl
addl %ecx, %ecx
leaq -0x38(%rbp), %rdx
movq %r12, %rdi
movl %ebx, %esi
callq 0x1d84e
testl %eax, %eax
je 0x1eb68
movl %eax, %r14d
xorl %r13d, %r13d
jmp 0x1eb7b
leaq -0x29(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
movq %r12, %rdi
movl %r13d, %esi
callq 0x1ebb8
movl %eax, %r14d
testl %eax, %eax
jne 0x1ebae
cmpb $0x4, -0x29(%rbp)
jne 0x1ebae
cmpl %ebx, -0x3c(%rbp)
jne 0x1eb19
pushq $0x65
popq %r14
jmp 0x1eb7b
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x180a3
movl %eax, %r13d
xorl %r14d, %r14d
movq -0x50(%rbp), %rax
movl %r13d, (%rax)
movq -0x38(%rbp), %rdi
testq %r15, %r15
je 0x1eb90
movq %rdi, (%r15)
jmp 0x1eb95
callq 0x1d90e
xorl %eax, %eax
cmpl $0x65, %r14d
cmovnel %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r14d, %r14d
jne 0x1eb38
jmp 0x1eb19
// File: /workspace/github_c_makefile_star2_O2/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, %r12d
movq %rdi, %r15
callq 0x1dfda
movl %eax, %r13d
movq (%r15), %rdi
leaq -0x30(%rbp), %rdx
movl %eax, %esi
xorl %ecx, %ecx
callq 0xca7d
testl %eax, %eax
jne 0x1ec4f
movq -0x30(%rbp), %r15
notl %r13d
addl %r12d, %r13d
leal (%r13,%r13,4), %eax
testl %eax, %eax
js 0x1ec3a
movq 0x8(%r15), %rdi
movl %eax, %eax
movb (%rdi,%rax), %cl
movb %cl, (%rbx)
testq %r14, %r14
je 0x1ec1f
addq %rax, %rdi
incq %rdi
callq 0x180a3
movl %eax, (%r14)
movq %r15, %rdi
callq 0xcf6e
movb (%rbx), %cl
addb $-0x6, %cl
xorl %eax, %eax
movl $0xc518, %edi           # imm = 0xC518
cmpb $-0x6, %cl
jbe 0x1ec47
jmp 0x1ec4f
movq %r15, %rdi
callq 0xcf6e
movl $0xc510, %edi           # imm = 0xC510
callq 0x1a1fc
pushq $0xb
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq