LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 0x1f293
movq %rbx, %rdi
callq 0x1c946
movq 0x30(%rbx), %rax
decl 0x18(%rax)
cmpl $0x1, 0x28(%rbx)
jne 0x1f2a8
movq $0x0, 0x48(%rax)
movq 0x75239(%rip), %rcx     # 0x944e8
movq 0x40(%rax), %rdi
movq (%rbx), %rsi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O3/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 0x1f492
movq 0x118(%r14), %rcx
movq 0x8(%rbx), %rax
movq 0x10(%rcx), %rdi
movzwl 0x56(%rcx), %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
cmpl %edx, %r8d
cmovgel %edx, %r8d
movq (%rdi), %r9
movq %rax, %rsi
movl %r8d, %edx
callq *0x10(%r9)
jmp 0x1f4b5
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 0x1f4d7
testl %eax, %eax
je 0x1f4c5
pcmpeqd %xmm0, %xmm0
jmp 0x1f4ce
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_O3/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
testq %rdi, %rdi
setne %cl
sete %al
testq %rsi, %rsi
sete %dl
orb %al, %dl
jne 0x1f738
leaq -0x48(%rbp), %rax
movq %rsi, %rdx
movq %rdi, %r8
movl 0x28(%r8), %ecx
cmpl 0x28(%rdx), %ecx
jae 0x1f715
movq %r8, 0x18(%rax)
movq 0x18(%r8), %rdi
movq %rdx, %rsi
movq %r8, %rax
jmp 0x1f723
movq %rdx, 0x18(%rax)
movq 0x18(%rdx), %rsi
movq %r8, %rdi
movq %rdx, %rax
testq %rdi, %rdi
setne %cl
je 0x1f73c
movq %rsi, %rdx
movq %rdi, %r8
testq %rsi, %rsi
jne 0x1f6fc
jmp 0x1f73c
leaq -0x48(%rbp), %rax
testb %cl, %cl
cmoveq %rsi, %rdi
movq %rdi, 0x18(%rax)
movq -0x30(%rbp), %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x4, %edx
callq *0x10(%rax)
testl %eax, %eax
jne 0x1f772
movl -0xc(%rbp), %ecx
bswapl %ecx
movl %ecx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x1f78c
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rdi, %rbx
movq 0x30(%rdi), %rax
decl 0x18(%rax)
testb $0x2, 0x2c(%rdi)
jne 0x1f7c8
cmpl $0x0, 0x28(%rax)
je 0x1f785
cmpl $0x1, 0x28(%rbx)
jne 0x1f7b0
movq $0x0, 0x48(%rax)
movq 0x74d31(%rip), %rcx     # 0x944e8
movq 0x40(%rax), %rdi
movq (%rbx), %rsi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rcx
movq %rbx, %rdi
callq 0x1c946
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1f7db
// File: /workspace/github_c_makefile_star2_O3/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 0x1f7f3
movq %rdi, 0x40(%rcx)
movq %rdi, (%rax)
cmpq $0x0, 0x8(%rax)
jne 0x1f801
movq %rdi, 0x8(%rax)
cmpq $0x0, 0x10(%rax)
jne 0x1f812
testb $0x4, 0x2c(%rdi)
jne 0x1f812
movq %rdi, 0x10(%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1f86b
addq $-0x10, %rsi
leaq -0x38(%rbp), %rdx
movq %r15, %rdi
callq 0x1f74c
testl %eax, %eax
je 0x1f87d
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 0x1f86b
movq -0x30(%rbp), %rsi
addq $-0xc, %rsi
leaq -0x34(%rbp), %rdx
movq %r15, %rdi
callq 0x1f74c
testl %eax, %eax
jne 0x1f868
movq -0x30(%rbp), %rcx
addq $-0x8, %rcx
movq (%r15), %rax
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
movl $0x8, %edx
callq *0x10(%rax)
testl %eax, %eax
jne 0x1f868
movabsq $-0x289c5edf06fa2a27, %rax # imm = 0xD763A120F905D5D9
cmpq %rax, -0x40(%rbp)
jne 0x1f86b
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 0x1f868
movl -0x34(%rbp), %eax
testq %r14, %r14
je 0x1f909
xorl %ecx, %ecx
movsbl (%rbx,%rcx), %edx
subl %edx, %eax
incq %rcx
cmpq %rcx, %r14
jne 0x1f8fb
xorl %r12d, %r12d
testl %eax, %eax
cmovnel %r12d, %r14d
movb $0x0, (%rbx,%r14)
jmp 0x1f86b
// File: /workspace/github_c_makefile_star2_O3/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 0x1f9ba
movb 0x13(%r14), %dl
addb $-0x4, %dl
cmpb $-0x4, %dl
ja 0x1f9ba
movl %esi, %ebx
movslq 0xbc(%r14), %r15
leaq -0x30(%rbp), %rsi
callq *0x30(%rcx)
testl %eax, %eax
jne 0x1f9ba
movl %ebx, %r12d
imulq %r15, %r12
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq %r12, %rcx
je 0x1f9ba
jle 0x1f97e
movq 0x48(%r14), %rdi
movq (%rdi), %rax
movq %r12, %rsi
callq *0x20(%rax)
jmp 0x1f9b0
addq %r15, %rcx
cmpq %r12, %rcx
jg 0x1f9b4
movq 0x108(%r14), %r13
movq %r13, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x8200
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 0x1f9ba
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_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3WalExclusiveMode
SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op){
  int rc;
  assert( pWal->writeLock==0 );
  assert( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE || op==-1 );

  /* pWal->readLock is usually set, but might be -1 if there was a 
  ** prior error while attempting to acquire are read-lock. This cannot 
  ** happen if the connection is actually in exclusive mode (as no xShmLock
  ** locks are taken in this case). Nor should the pager attempt to
  ** upgrade to exclusive-mode following such an error.
  */
  assert( pWal->readLock>=0 || pWal->lockError );
  assert( pWal->readLock>=0 || (op<=0 && pWal->exclusiveMode==0) );

  if( op==0 ){
    if( pWal->exclusiveMode ){
      pWal->exclusiveMode = 0;
      if( walLockShared(pWal, WAL_READ_LOCK(pWal->readLock))!=SQLITE_OK ){
        pWal->exclusiveMode = 1;
      }
      rc = pWal->exclusiveMode==0;
    }else{
      /* Already in locking_mode=NORMAL */
      rc = 0;
    }
  }else if( op>0 ){
    assert( pWal->exclusiveMode==0 );
    assert( pWal->readLock>=0 );
    walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));
    pWal->exclusiveMode = 1;
    rc = 1;
  }else{
    rc = pWal->exclusiveMode==0;
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x1fa09
movb 0x3f(%rbx), %cl
testb %cl, %cl
sete %al
testl %esi, %esi
jle 0x1fa41
testb %cl, %cl
jne 0x1fa01
movswl 0x3c(%rbx), %esi
addl $0x3, %esi
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movl $0x1, %edx
movl $0x5, %ecx
callq *0x70(%rax)
movb $0x1, 0x3f(%rbx)
movb $0x1, %al
jmp 0x1fa41
cmpb $0x0, 0x3f(%rbx)
je 0x1fa36
movb $0x0, 0x3f(%rbx)
movswl 0x3c(%rbx), %esi
addl $0x3, %esi
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movl $0x1, %edx
movl $0x6, %ecx
callq *0x70(%rax)
testl %eax, %eax
je 0x1fa3a
movb $0x1, 0x3f(%rbx)
xorl %eax, %eax
jmp 0x1fa41
cmpb $0x0, 0x3f(%rbx)
sete %al
movzbl %al, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x1faa8
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 0xdfbf
testl %eax, %eax
jne 0x1fb5f
movaps 0x568fb(%rip), %xmm0    # 0x763d0
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)
movq %r14, %rdi
movl $0xd, %esi
callq 0x20600
orb $0x2, 0x26(%rbx)
movb 0x21(%rbx), %cl
xorl %eax, %eax
movw %ax, 0x34(%r15)
movb %al, 0x36(%r15)
movb %cl, 0x37(%r15)
movb 0x22(%rbx), %cl
movw %ax, 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_O3/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 0xd8e2
testl %eax, %eax
jne 0x200bb
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
movl $0x64, %edx
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_O3/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 0x200e0
movq %rdi, %rbx
cmpq $0x0, 0x118(%rdi)
je 0x200ed
movl $0x1, (%rsi)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
cmpb $0x0, 0x8(%rbx)
je 0x20122
movq 0x50(%rbx), %r14
movq (%r14), %rax
testq %rax, %rax
je 0x2010c
movq %r14, %rdi
callq *0x8(%rax)
movq $0x0, (%r14)
movq %rbx, %rdi
callq 0x2042b
testl %eax, %eax
jne 0x200e8
movb $0x5, 0x9(%rbx)
movb $0x0, 0x13(%rbx)
jmp 0x200e6
movq 0x48(%rbx), %rax
movq (%rax), %rcx
movl $0xe, %eax
cmpl $0x2, (%rcx)
jl 0x200e8
cmpq $0x0, 0x68(%rcx)
jne 0x200f3
jmp 0x200e8
// File: /workspace/github_c_makefile_star2_O3/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 0x2035a
cmpw $0x0, 0x3c(%rax)
js 0x2035a
movl 0x5c(%rax), %eax
testl %eax, %eax
jne 0x20398
movq $0x0, -0x18(%rbp)
movq 0x48(%r14), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x20382
leaq -0x18(%rbp), %rsi
callq *0x30(%rax)
testl %eax, %eax
jne 0x203ac
movq -0x18(%rbp), %rax
decq %rax
jmp 0x20389
movq $-0x1, %rax
movslq 0xbc(%r14), %rcx
addq %rcx, %rax
cqto
idivq %rcx
cmpl 0xc0(%r14), %eax
jbe 0x203a8
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_O3/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:
xorl %eax, %eax
cmpb $0x0, 0x10(%rdi)
je 0x203be
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq -0x10(%rbp), %rsi
callq 0x2032f
testl %eax, %eax
jne 0x20424
cmpl $0x0, -0x10(%rbp)
movq (%rbx), %rdi
movq 0x120(%rbx), %rsi
je 0x203ef
leaq -0xc(%rbp), %rcx
xorl %edx, %edx
callq *0x38(%rdi)
jmp 0x20402
xorl %edx, %edx
callq *0x30(%rdi)
movl $0x0, -0xc(%rbp)
cmpl $0x170a, %eax           # imm = 0x170A
je 0x20418
testl %eax, %eax
jne 0x20424
cmpl $0x0, -0xc(%rbp)
je 0x20418
movq %rbx, %rdi
xorl %esi, %esi
callq 0x200c6
jmp 0x20424
xorl %eax, %eax
cmpb $0x5, 0x9(%rbx)
jne 0x20424
movb $0x0, 0x9(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x20466
movq %rbx, %rdi
callq 0x205a1
movl %eax, %r15d
testl %eax, %eax
jne 0x20587
cmpb $0x0, 0x8(%rbx)
setne %al
addb %al, %al
movl %eax, -0x2c(%rbp)
jmp 0x2046d
movl $0x0, -0x2c(%rbp)
movq (%rbx), %r15
movq 0x48(%rbx), %rax
movq %rax, -0x40(%rbp)
movq 0x120(%rbx), %r12
movq 0xc8(%rbx), %rax
movq %rax, -0x38(%rbp)
movq $0x0, 0x118(%rbx)
movl $0x88, %r13d
addl 0x4(%r15), %r13d
movl %r13d, %edi
callq 0xa38c
testq %rax, %rax
je 0x2054a
movq %rax, %r14
movslq %r13d, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x8200
movq %r15, (%r14)
movq %r14, %rdx
addq $0x88, %rdx
movq %rdx, 0x10(%r14)
movq -0x40(%rbp), %rax
movq %rax, 0x8(%r14)
movw $0xffff, 0x3c(%r14)     # imm = 0xFFFF
movq -0x38(%rbp), %rax
movq %rax, 0x20(%r14)
movq %r12, 0x78(%r14)
movw $0x101, 0x44(%r14)      # imm = 0x101
movl -0x2c(%rbp), %eax
movb %al, 0x3f(%r14)
leaq -0x30(%rbp), %r8
movl $0x80006, (%r8)         # imm = 0x80006
movq %r15, %rdi
movq %r12, %rsi
movl $0x80006, %ecx          # imm = 0x80006
callq *0x28(%r15)
testl %eax, %eax
je 0x20552
movl %eax, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x1dbba
movq 0x10(%r14), %r12
movq (%r12), %rax
testq %rax, %rax
je 0x20540
movq %r12, %rdi
callq *0x8(%rax)
movq $0x0, (%r12)
movq %r14, %rdi
callq 0xa3c7
jmp 0x20587
movl $0x7, %r15d
jmp 0x20587
testb $0x1, -0x30(%rbp)
je 0x2055d
movb $0x1, 0x42(%r14)
movq 0x10(%r14), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
btl $0xa, %eax
jae 0x20572
movb $0x0, 0x44(%r14)
btl $0xc, %eax
jae 0x2057d
movb $0x0, 0x45(%r14)
movq %r14, 0x118(%rbx)
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x1cc2a
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_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerExclusiveLock
static int pagerExclusiveLock(Pager *pPager){
  int rc;                         /* Return code */

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

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzbl 0x14(%rdi), %eax
cmpl $0x4, %eax
jb 0x205bc
xorl %r14d, %r14d
cmpl $0x5, %eax
jne 0x205f8
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
movl $0x4, %esi
callq *0x38(%rax)
testl %eax, %eax
je 0x205f0
movl %eax, %r14d
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x205f8
movl $0x1, %esi
callq *0x40(%rax)
movb $0x1, %al
cmpb $0x5, 0x14(%rbx)
jne 0x205f5
jmp 0x205f8
xorl %r14d, %r14d
movb $0x4, %al
movb %al, 0x14(%rbx)
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerAcquireMapPage
static int pagerAcquireMapPage(
  Pager *pPager,                  /* Pager object */
  Pgno pgno,                      /* Page number */
  void *pData,                    /* xFetch()'d data for this page */
  PgHdr **ppPage                  /* OUT: Acquired page object */
){
  PgHdr *p;                       /* Memory mapped page to return */

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

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

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

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r13
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
movq 0xa8(%rdi), %r12
testq %r12, %r12
je 0x20720
movq %r12, (%r13)
movq 0x18(%r12), %rax
movq %rax, 0xa8(%r15)
movq $0x0, 0x18(%r12)
movq 0x10(%r12), %rdi
movzwl 0xb0(%r15), %edx
xorl %esi, %esi
callq 0x8200
jmp 0x2076e
movq %rbx, -0x30(%rbp)
movzwl 0xb0(%r15), %ebx
addq $0x48, %rbx
movl %ebx, %edi
callq 0xa38c
testq %rax, %rax
je 0x20790
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x8200
movq %r12, (%r13)
movq %r12, %rax
addq $0x48, %rax
movq %rax, 0x10(%r12)
movl $0x10040, 0x2c(%r12)    # imm = 0x10040
movq %r15, 0x20(%r12)
movq -0x30(%rbp), %rbx
movl %r14d, 0x28(%r12)
movq %rbx, 0x8(%r12)
incl 0x98(%r15)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, (%r13)
movq 0x48(%r15), %rdi
decl %r14d
movslq 0xbc(%r15), %rsi
imulq %r14, %rsi
movq (%rdi), %rax
movq -0x30(%rbp), %rdx
callq *0x90(%rax)
movl $0x7, %eax
jmp 0x20781
// File: /workspace/github_c_makefile_star2_O3/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 0x20cf0
cmpl $0x2, 0xa0(%rax)
jl 0x20c5c
cmpq %rbx, 0x78(%r14)
je 0x20cae
movb $0x1, 0x10(%rbx)
jmp 0x20d15
movq 0x70(%r14), %rdi
testq %rdi, %rdi
je 0x20c94
leaq 0x70(%r14), %r15
cmpq %rbx, (%rdi)
je 0x20c77
addq $0x10, %rdi
movq %rdi, %r15
jmp 0x20c89
movq 0x10(%rdi), %rax
movq %rax, (%r15)
cmpl $0x1, 0x8(%rdi)
je 0x20c8c
callq 0xa3c7
movq (%r15), %rax
movq %rax, %rdi
testq %rax, %rax
jne 0x20c69
cmpq %rbx, 0x78(%r14)
je 0x20cce
movl 0x38(%r14), %eax
cmpl $0x2, %eax
jne 0x20ce3
movw $0xffbf, %cx            # imm = 0xFFBF
movl $0x2, %eax
jmp 0x20cde
movq $0x0, 0x78(%r14)
andb $-0x61, 0x26(%r14)
movq 0x70(%r14), %rax
testq %rax, %rax
je 0x20c53
movb $0x1, 0xc(%rax)
movq 0x10(%rax), %rax
jmp 0x20cbf
movq $0x0, 0x78(%r14)
movl 0x38(%r14), %eax
movw $0xff9f, %cx            # imm = 0xFF9F
andw %cx, 0x26(%r14)
decl %eax
movl %eax, 0x38(%r14)
jne 0x20cf0
movb $0x0, 0x24(%r14)
movb $0x0, 0x10(%rbx)
cmpb $0x0, 0x24(%r14)
jne 0x20d15
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x20d15
movq 0x68(%rax), %rdi
callq 0xddd3
movq $0x0, 0x18(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 %rbx
movl %edx, %r8d
movl 0x34(%rdi), %eax
movl $0xcccccccd, %ebx       # imm = 0xCCCCCCCD
imulq %rax, %rbx
shrq $0x22, %rbx
movl %edx, %r9d
subl %esi, %r9d
movl 0x73afc(%rip), %ecx     # 0x94840
cmpl $0x1, %esi
ja 0x20d5b
xorl %r10d, %r10d
movl %ecx, %eax
xorl %edx, %edx
divl 0x30(%rdi)
movl %eax, %ecx
leal 0x1(%rbx), %r11d
jmp 0x20d89
leal 0x1(%rbx), %r11d
leal -0x2(%rsi), %r10d
movl %r10d, %eax
xorl %edx, %edx
divl %r11d
subl %edx, %r10d
movl %ecx, %eax
xorl %edx, %edx
divl 0x30(%rdi)
movl %eax, %ecx
leal 0x1(%r10), %eax
xorl %edx, %edx
cmpl %ecx, %eax
sete %dl
addl %edx, %r10d
addl $0x2, %r10d
addl %ebx, %r9d
addl %r10d, %r9d
movl %r9d, %eax
xorl %edx, %edx
divl %ebx
addl %r8d, %eax
movl %esi, %edx
subl %eax, %edx
leal 0x1(%rcx), %r8d
cmpl %esi, %r8d
setb %al
cmpl %r8d, %edx
setb %sil
andb %al, %sil
movzbl %sil, %eax
subl %eax, %edx
movl %edx, %esi
movl $0x0, %eax
cmpl $0x2, %edx
jb 0x20ddf
leal -0x2(%rsi), %edi
movl %edi, %eax
xorl %edx, %edx
divl %r11d
subl %edx, %edi
leal 0x1(%rdi), %eax
xorl %edx, %edx
cmpl %ecx, %eax
sete %dl
leal (%rdi,%rdx), %eax
addl $0x2, %eax
leal -0x1(%rsi), %edx
cmpl %eax, %esi
je 0x20db7
cmpl %r8d, %esi
je 0x20db7
movl %esi, %eax
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: saveAllCursors
static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
  BtCursor *p;
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( pExcept==0 || pExcept->pBt==pBt );
  for(p=pBt->pCursor; p; p=p->pNext){
    if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
      if( p->eState==CURSOR_VALID ){
        int rc = saveCursorPosition(p);
        if( SQLITE_OK!=rc ){
          return rc;
        }
      }else{
        testcase( p->iPage>0 );
        btreeReleaseAllCursorPages(p);
      }
    }
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x10(%rdi), %r15
testq %r15, %r15
je 0x20ec3
movq %rdx, %rbx
movl %esi, %r14d
cmpq %rbx, %r15
je 0x20e74
testl %r14d, %r14d
je 0x20e21
cmpl %r14d, 0x30(%r15)
jne 0x20e74
cmpb $0x1, 0x77(%r15)
jne 0x20e6c
leaq 0x60(%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x211a9
movq 0xa8(%r15), %rax
cmpb $0x0, 0x2(%rax)
je 0x20e7f
movq %r15, %rdi
callq 0x21152
movb $0x3, 0x77(%r15)
xorl %r12d, %r12d
movq 0x28(%r15), %rdi
callq 0xa3c7
movq $0x0, 0x28(%r15)
testl %r12d, %r12d
je 0x20e74
jmp 0x20ec6
movq %r15, %rdi
callq 0x21152
movq 0x10(%r15), %r15
testq %r15, %r15
jne 0x20e11
jmp 0x20ec3
movl (%r12), %edi
callq 0xa38c
testq %rax, %rax
je 0x20eb5
movq %rax, %r13
movl 0x60(%r15), %edx
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x21511
testl %eax, %eax
je 0x20ebd
movl %eax, %r12d
movq %r13, %rdi
callq 0xa3c7
jmp 0x20e54
movl $0x7, %r12d
jmp 0x20e54
movq %r13, 0x68(%r15)
jmp 0x20e44
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_O3/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
movzwl 0x7a(%rdi), %eax
testw %ax, %ax
js 0x2119e
movq $-0x1, %r14
movq 0xb0(%rbx,%r14,8), %rcx
testq %rcx, %rcx
je 0x21186
movq 0x68(%rcx), %rdi
callq 0xddd3
movzwl 0x7a(%rbx), %eax
movq $0x0, 0xb0(%rbx,%r14,8)
movswq %ax, %rcx
incq %r14
cmpq %rcx, %r14
jl 0x2116c
movw $0xffff, 0x7a(%rbx)     # imm = 0xFFFF
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x2120e
movq %rdi, %r14
leaq 0x40(%rdi), %r15
cmpw $0x0, 0x5e(%rdi)
jne 0x21209
movswq 0x7a(%r14), %rax
movq 0xa8(%r14,%rax,8), %rdi
movzwl 0x7c(%r14,%rax,2), %eax
movzwl 0x12(%rdi), %ecx
movq 0x60(%rdi), %rdx
movzbl (%rdx,%rax,2), %r8d
shll $0x8, %r8d
movzbl 0x1(%rdx,%rax,2), %esi
orl %r8d, %esi
andl %ecx, %esi
addq 0x50(%rdi), %rsi
movq %r15, %rdx
callq 0x2121e
movb $0x1, 0x76(%r14)
movq (%r15), %rax
jmp 0x21210
xorl %eax, %eax
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: ptrmapGet
static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
  DbPage *pDbPage;   /* The pointer map page */
  int iPtrmap;       /* Pointer map page index */
  u8 *pPtrmap;       /* Pointer map page data */
  int offset;        /* Offset of entry in pointer map */
  int rc;

  assert( sqlite3_mutex_held(pBt->mutex) );

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

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

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

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

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

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

    ptrmapPutOvflPtr(pPage, pCell, &rc);

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

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

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

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

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

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

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

// Assembly:
testq %rdi, %rdi
je 0x22c32
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %r14
testq %r14, %r14
je 0x22c28
movl %esi, %ebx
movq 0x68(%r14), %rdi
callq 0xa3c7
movq $0x0, 0x68(%r14)
movb $0x4, 0x77(%r14)
movl %ebx, 0x70(%r14)
movzwl 0x7a(%r14), %eax
testw %ax, %ax
js 0x22c1f
movq $-0x1, %r15
movq 0xb0(%r14,%r15,8), %rcx
testq %rcx, %rcx
je 0x22c07
movq 0x68(%rcx), %rdi
callq 0xddd3
movzwl 0x7a(%r14), %eax
movq $0x0, 0xb0(%r14,%r15,8)
movswq %ax, %rcx
incq %r15
cmpq %rcx, %r15
jl 0x22bec
movq 0x10(%r14), %r14
testq %r14, %r14
jne 0x22bc1
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq