LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: walEncodeFrame
static void walEncodeFrame(
  Wal *pWal,                      /* The write-ahead log */
  u32 iPage,                      /* Database page number for frame */
  u32 nTruncate,                  /* New db size (or 0 for non-commit frames) */
  u8 *aData,                      /* Pointer to page data */
  u8 *aFrame                      /* OUT: Write encoded frame here */
){
  int nativeCksum;                /* True for native byte-order checksums */
  u32 *aCksum = pWal->hdr.aFrameCksum;
  assert( WAL_FRAME_HDRSIZE==24 );
  sqlite3Put4byte(&aFrame[0], iPage);
  sqlite3Put4byte(&aFrame[4], nTruncate);
  if( pWal->iReCksum==0 ){
    memcpy(&aFrame[8], pWal->hdr.aSalt, 8);

    nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
    walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
    walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);

    sqlite3Put4byte(&aFrame[16], aCksum[0]);
    sqlite3Put4byte(&aFrame[20], aCksum[1]);
  }else{
    memset(&aFrame[8], 0, 16);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r15
movl %esi, %eax
movl %esi, %ecx
shrl $0x18, %ecx
movb %cl, (%r8)
movl %esi, %ecx
shrl $0x10, %ecx
movb %cl, 0x1(%r8)
movb %ah, 0x2(%rbx)
movb %al, 0x3(%r8)
movl %edx, %eax
shrl $0x18, %eax
movb %al, 0x4(%r8)
movl %edx, %eax
shrl $0x10, %eax
movb %al, 0x5(%r8)
movb %dh, 0x6(%rbx)
movb %dl, 0x7(%r8)
cmpl $0x0, 0x7c(%rdi)
je 0x2926dd
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
jmp 0x292731
movq %rdi, %r14
leaq 0x60(%rdi), %r12
movq 0x68(%rdi), %rax
movq %rax, 0x8(%rbx)
xorl %ebp, %ebp
cmpb $0x0, 0x55(%rdi)
sete %bpl
movl %ebp, %edi
movq %rbx, %rsi
movl $0x8, %edx
movq %r12, %rcx
movq %r12, %r8
callq 0x290e69
movl 0x38(%r14), %edx
movl %ebp, %edi
movq %r15, %rsi
movq %r12, %rcx
movq %r12, %r8
callq 0x290e69
movl 0x60(%r14), %eax
bswapl %eax
movl %eax, 0x10(%rbx)
movl 0x64(%r14), %eax
bswapl %eax
movl %eax, 0x14(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: backupUpdate
static SQLITE_NOINLINE void backupUpdate(
  sqlite3_backup *p,
  Pgno iPage,
  const u8 *aData
){
  assert( p!=0 );
  do{
    assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
    if( !isFatalError(p->rc) && iPage<p->iNext ){
      /* The backup process p has already copied page iPage. But now it
      ** has been modified by a transaction on the source pager. Copy
      ** the new data into the backup.
      */
      int rc;
      assert( p->pDestDb );
      sqlite3_mutex_enter(p->pDestDb->mutex);
      rc = backupOnePage(p, iPage, aData, 1);
      sqlite3_mutex_leave(p->pDestDb->mutex);
      assert( rc!=SQLITE_BUSY && rc!=SQLITE_LOCKED );
      if( rc!=SQLITE_OK ){
        p->rc = rc;
      }
    }
  }while( (p = p->pNext)!=0 );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movl $0x61, %r15d
movl 0x30(%r14), %eax
cmpl $0x6, %eax
ja 0x2928b2
btl %eax, %r15d
jae 0x2928b2
cmpl %ebp, 0x18(%r14)
jbe 0x2928b2
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x280b5e
testl %eax, %eax
je 0x2928b2
movl %eax, 0x30(%r14)
movq 0x40(%r14), %r14
testq %r14, %r14
jne 0x292883
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3PagerExclusiveLock
SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){
  int rc = pPager->errCode;
  assert( assert_pager_state(pPager) );
  if( rc==SQLITE_OK ){
    assert( pPager->eState==PAGER_WRITER_CACHEMOD
         || pPager->eState==PAGER_WRITER_DBMOD
         || pPager->eState==PAGER_WRITER_LOCKED
    );
    assert( assert_pager_state(pPager) );
    if( 0==pagerUseWal(pPager) ){
      rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl 0x2c(%rdi), %ebp
testl %ebp, %ebp
jne 0x292906
movq %rdi, %rbx
xorl %ebp, %ebp
cmpq $0x0, 0x120(%rdi)
jne 0x292906
jmp 0x2928f2
movq 0xe8(%rbx), %rdi
callq *0xe0(%rbx)
testl %eax, %eax
je 0x292906
movq %rbx, %rdi
movl $0x4, %esi
callq 0x292a65
movl %eax, %ebp
cmpl $0x5, %eax
je 0x2928e1
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pagerLockDb
static int pagerLockDb(Pager *pPager, int eLock){
  int rc = SQLITE_OK;

  assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK );
  if( pPager->eLock<eLock || pPager->eLock==UNKNOWN_LOCK ){
    rc = pPager->noLock ? SQLITE_OK : sqlite3OsLock(pPager->fd, eLock);
    if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
      pPager->eLock = (u8)eLock;
      IOTRACE(("LOCK %p %d\n", pPager, eLock))
    }
  }
  return rc;
}

// Assembly:
movzbl 0x15(%rdi), %eax
cmpl $0x5, %eax
setne %cl
cmpl %esi, %eax
setge %dl
xorl %eax, %eax
testb %dl, %cl
jne 0x292ab4
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
xorl %eax, %eax
cmpb $0x0, 0x11(%rdi)
jne 0x292a97
movq 0x48(%r14), %rdi
movq (%rdi), %rax
movl %ebx, %esi
callq *0x38(%rax)
testl %eax, %eax
jne 0x292aad
xorl %eax, %eax
cmpl $0x4, %ebx
je 0x292aa9
cmpb $0x5, 0x15(%r14)
je 0x292aad
movb %bl, 0x15(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pcache1Free
static void pcache1Free(void *p){
  if( p==0 ) return;
  if( SQLITE_WITHIN(p, pcache1.pStart, pcache1.pEnd) ){
    PgFreeslot *pSlot;
    sqlite3_mutex_enter(pcache1.mutex);
    sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_USED, 1);
    pSlot = (PgFreeslot*)p;
    pSlot->pNext = pcache1.pFree;
    pcache1.pFree = pSlot;
    pcache1.nFreeSlot++;
    pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve;
    assert( pcache1.nFreeSlot<=pcache1.nSlot );
    sqlite3_mutex_leave(pcache1.mutex);
  }else{
    assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );
    sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
#ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
    {
      int nFreed = 0;
      nFreed = sqlite3MallocSize(p);
      sqlite3_mutex_enter(pcache1.mutex);
      sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_OVERFLOW, nFreed);
      sqlite3_mutex_leave(pcache1.mutex);
    }
#endif
    sqlite3_free(p);
  }
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x292b98
movq %rdi, %rbx
cmpq %rdi, 0x2372c2(%rip)    # 0x4c9e18
ja 0x292b9a
cmpq %rbx, 0x2372c1(%rip)    # 0x4c9e20
jbe 0x292b9a
decq 0x236f98(%rip)          # 0x4c9b00
movq 0x2372c1(%rip), %rax    # 0x4c9e30
movq %rax, (%rbx)
movq %rbx, 0x2372b7(%rip)    # 0x4c9e30
movl 0x2372b9(%rip), %eax    # 0x4c9e38
incl %eax
movl %eax, 0x2372b1(%rip)    # 0x4c9e38
xorl %ecx, %ecx
cmpl 0x237285(%rip), %eax    # 0x4c9e14
setl %cl
movl %ecx, 0x2372a4(%rip)    # 0x4c9e3c
popq %rbx
retq
movq %rbx, %rdi
callq *0x233af5(%rip)         # 0x4c6698
cltq
subq %rax, 0x236f5c(%rip)    # 0x4c9b08
movq %rbx, %rdi
popq %rbx
jmp 0x27c490
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3PagerLookup
SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
  sqlite3_pcache_page *pPage;
  assert( pPager!=0 );
  assert( pgno!=0 );
  assert( pPager->pPCache!=0 );
  pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0);
  assert( pPage==0 || pPager->hasHeldSharedLock );
  if( pPage==0 ) return 0;
  return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x118(%rdi), %rax
movq 0x40(%rax), %rdi
xorl %edx, %edx
callq *0x23367f(%rip)         # 0x4c6740
testq %rax, %rax
je 0x2930db
movq 0x118(%r14), %rdi
movl %ebx, %esi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2930e5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3PcacheDrop
SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr *p){
  assert( p->nRef==1 );
  assert( sqlite3PcachePageSanity(p) );
  if( p->flags&PGHDR_DIRTY ){
    pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);
  }
  p->pCache->nRefSum--;
  sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 1);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testb $0x2, 0x34(%rdi)
je 0x29321c
movq %rbx, %rdi
movl $0x1, %esi
callq 0x292ab5
movq 0x18(%rbx), %rax
decl 0x18(%rax)
movq 0x23351e(%rip), %rcx    # 0x4c6748
movq 0x40(%rax), %rdi
movq (%rbx), %rsi
movl $0x1, %edx
popq %rbx
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3PagerUnrefNotNull
SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage *pPg){
  TESTONLY( Pager *pPager = pPg->pPager; )
  assert( pPg!=0 );
  if( pPg->flags & PGHDR_MMAP ){
    assert( pPg->pgno!=1 );  /* Page1 is never memory mapped */
    pagerReleaseMapPage(pPg);
  }else{
    sqlite3PcacheRelease(pPg);
  }
  /* Do not use this routine to release the last reference to page1 */
  assert( sqlite3PcacheRefCount(pPager->pPCache)>0 );
}

// Assembly:
testb $0x20, 0x34(%rdi)
je 0x294a00
movq 0x28(%rdi), %rcx
decl 0x98(%rcx)
movq 0xa8(%rcx), %rax
movq %rax, 0x20(%rdi)
movq %rdi, 0xa8(%rcx)
movq 0x48(%rcx), %rax
movl 0x30(%rdi), %edx
decl %edx
movslq 0xbc(%rcx), %rsi
imulq %rdx, %rsi
movq 0x8(%rdi), %rdx
movq (%rax), %rcx
movq 0x90(%rcx), %rcx
movq %rax, %rdi
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3PcacheRelease
SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){
  assert( p->nRef>0 );
  p->pCache->nRefSum--;
  if( (--p->nRef)==0 ){
    if( p->flags&PGHDR_CLEAN ){
      pcacheUnpin(p);
    }else{
      pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
    }
  }
}

// Assembly:
movq 0x18(%rdi), %rax
decl 0x18(%rax)
decw 0x36(%rdi)
je 0x294a0e
retq
testb $0x1, 0x34(%rdi)
jne 0x294a1e
movl $0x3, %esi
jmp 0x292ab5
cmpb $0x0, 0x2c(%rax)
je 0x294a0d
movq 0x231d1d(%rip), %rcx    # 0x4c6748
movq 0x40(%rax), %rax
movq (%rdi), %rsi
movq %rax, %rdi
xorl %edx, %edx
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3PcacheMakeDirty
SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){
  assert( p->nRef>0 );
  assert( sqlite3PcachePageSanity(p) );
  if( p->flags & (PGHDR_CLEAN|PGHDR_DONT_WRITE) ){    /*OPTIMIZATION-IF-FALSE*/
    p->flags &= ~PGHDR_DONT_WRITE;
    if( p->flags & PGHDR_CLEAN ){
      p->flags ^= (PGHDR_DIRTY|PGHDR_CLEAN);
      pcacheTrace(("%p.DIRTY %d\n",p->pCache,p->pgno));
      assert( (p->flags & (PGHDR_DIRTY|PGHDR_CLEAN))==PGHDR_DIRTY );
      pcacheManageDirtyList(p, PCACHE_DIRTYLIST_ADD);
    }
    assert( sqlite3PcachePageSanity(p) );
  }
}

// Assembly:
movzwl 0x34(%rdi), %eax
testb $0x11, %al
je 0x294a7e
movl %eax, %ecx
andl $0xffef, %ecx           # imm = 0xFFEF
movw %cx, 0x34(%rdi)
testb $0x1, %al
jne 0x294a7f
retq
xorl $0x3, %ecx
movw %cx, 0x34(%rdi)
movl $0x2, %esi
jmp 0x292ab5
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: readSuperJournal
static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u32 nSuper){
  int rc;                    /* Return code */
  u32 len;                   /* Length in bytes of super-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 */
  zSuper[0] = '\0';

  if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ))
   || szJ<16
   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len))
   || len>=nSuper
   || len>szJ-16
   || len==0
   || 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, zSuper, len, szJ-16-len))
  ){
    return rc;
  }

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

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %r12d
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rsi)
movq (%rdi), %rax
leaq 0x10(%rsp), %r15
movq %r15, %rsi
callq *0x30(%rax)
movl %eax, %ebp
testl %eax, %eax
setne %al
movq (%r15), %rsi
cmpq $0x10, %rsi
setl %cl
orb %al, %cl
jne 0x294b09
addq $-0x10, %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x294a39
testl %eax, %eax
je 0x294ae4
movl %eax, %ebp
jmp 0x294b09
movl 0x8(%rsp), %r15d
xorl %ebp, %ebp
cmpl %r12d, %r15d
jae 0x294b09
movq 0x10(%rsp), %rsi
leaq -0x10(%rsi), %rax
cmpq %r15, %rax
setl %al
testq %r15, %r15
sete %cl
orb %al, %cl
je 0x294b18
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
addq $-0xc, %rsi
leaq 0xc(%rsp), %rdx
movq %r14, %rdi
callq 0x294a39
testl %eax, %eax
jne 0x294ae0
movq 0x10(%rsp), %rcx
addq $-0x8, %rcx
movq (%r14), %rax
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq *0x10(%rax)
testl %eax, %eax
jne 0x294ae0
movabsq $-0x289c5edf06fa2a27, %rax # imm = 0xD763A120F905D5D9
cmpq %rax, 0x18(%rsp)
jne 0x294b09
movq 0x10(%rsp), %rcx
subq %r15, %rcx
addq $-0x10, %rcx
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq *0x10(%rax)
testl %eax, %eax
jne 0x294ae0
movl 0xc(%rsp), %eax
testq %r15, %r15
je 0x294b9a
xorl %ecx, %ecx
movsbl (%rbx,%rcx), %edx
subl %edx, %eax
incq %rcx
cmpq %rcx, %r15
jne 0x294b8c
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x294baa
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
xorl %ebp, %ebp
movb %bpl, (%rbx,%rax)
incl %eax
movb %bpl, (%rbx,%rax)
jmp 0x294b09
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3PcacheTruncate
SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){
  if( pCache->pCache ){
    PgHdr *p;
    PgHdr *pNext;
    pcacheTrace(("%p.TRUNCATE %d\n",pCache,pgno));
    for(p=pCache->pDirty; p; p=pNext){
      pNext = p->pDirtyNext;
      /* This routine never gets call with a positive pgno except right
      ** after sqlite3PcacheCleanAll().  So if there are dirty pages,
      ** it must be that pgno==0.
      */
      assert( p->pgno>0 );
      if( p->pgno>pgno ){
        assert( p->flags&PGHDR_DIRTY );
        sqlite3PcacheMakeClean(p);
      }
    }
    if( pgno==0 && pCache->nRefSum ){
      sqlite3_pcache_page *pPage1;
      pPage1 = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache,1,0);
      if( ALWAYS(pPage1) ){  /* Page 1 is always available in cache, because
                             ** pCache->nRefSum>0 */
        memset(pPage1->pBuf, 0, pCache->szPage);
        pgno = 1;
      }
    }
    sqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1);
  }
}

// Assembly:
cmpq $0x0, 0x40(%rdi)
je 0x294ce1
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x294cc8
movq 0x38(%rdi), %r14
cmpl %ebp, 0x30(%rdi)
jbe 0x294cc0
callq 0x2906d5
movq %r14, %rdi
testq %r14, %r14
jne 0x294cb2
testl %ebp, %ebp
je 0x294ce2
movq 0x231a85(%rip), %rax    # 0x4c6758
movq 0x40(%rbx), %rdi
incl %ebp
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmpq *%rax
retq
cmpl $0x0, 0x18(%rbx)
je 0x294d15
movq 0x40(%rbx), %rdi
xorl %ebp, %ebp
movl $0x1, %esi
xorl %edx, %edx
callq *0x231a45(%rip)         # 0x4c6740
testq %rax, %rax
je 0x294ccc
movq (%rax), %rdi
movslq 0x24(%rbx), %rdx
xorl %esi, %esi
callq 0x173a0
movl $0x1, %ebp
jmp 0x294ccc
xorl %ebp, %ebp
jmp 0x294ccc
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: releaseAllSavepoints
static void releaseAllSavepoints(Pager *pPager){
  int ii;               /* Iterator for looping through Pager.aSavepoint */
  for(ii=0; ii<pPager->nSavepoint; ii++){
    sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint);
  }
  if( !pPager->exclusiveMode || sqlite3JournalIsInMemory(pPager->sjfd) ){
    sqlite3OsClose(pPager->sjfd);
  }
  sqlite3_free(pPager->aSavepoint);
  pPager->aSavepoint = 0;
  pPager->nSavepoint = 0;
  pPager->nSubRec = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x80(%rdi)
jle 0x294d53
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x78(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x294293
incq %r15
movslq 0x80(%rbx), %rax
addq $0x30, %r14
cmpq %rax, %r15
jl 0x294d33
cmpb $0x0, 0x8(%rbx)
je 0x294d69
movq 0x58(%rbx), %rax
leaq 0x22cdbc(%rip), %rcx    # 0x4c1b20
cmpq %rcx, (%rax)
jne 0x294d82
movq 0x58(%rbx), %r14
movq (%r14), %rax
testq %rax, %rax
je 0x294d82
movq %r14, %rdi
callq *0x8(%rax)
movq $0x0, (%r14)
movq 0x78(%rbx), %rdi
callq 0x27c490
movq $0x0, 0x78(%rbx)
xorl %eax, %eax
movl %eax, 0x80(%rbx)
movl %eax, 0x38(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pagerFlushOnCommit
static int pagerFlushOnCommit(Pager *pPager, int bCommit){
  if( pPager->tempFile==0 ) return 1;
  if( !bCommit ) return 0;
  if( !isOpen(pPager->fd) ) return 0;
  return (sqlite3PCachePercentDirty(pPager->pPCache)>=25);
}

// Assembly:
cmpb $0x0, 0x10(%rdi)
je 0x294dfd
xorl %eax, %eax
testl %esi, %esi
je 0x294e02
movq 0x48(%rdi), %rcx
cmpq $0x0, (%rcx)
je 0x294e02
movq 0x118(%rdi), %rsi
movslq 0x1c(%rsi), %rcx
testq %rcx, %rcx
jns 0x294de7
shlq $0xa, %rcx
negq %rcx
movslq 0x24(%rsi), %rax
movslq 0x28(%rsi), %rdi
addq %rax, %rdi
movq %rcx, %rax
cqto
idivq %rdi
movq %rax, %rcx
movq (%rsi), %rsi
xorl %eax, %eax
xorl %edx, %edx
testq %rsi, %rsi
je 0x294e03
movq 0x38(%rsi), %rsi
addq $0x64, %rdx
jmp 0x294dee
movl $0x1, %eax
retq
testl %ecx, %ecx
je 0x294e02
movslq %ecx, %rcx
movq %rdx, %rax
cqto
idivq %rcx
movq %rax, %rcx
xorl %eax, %eax
cmpl $0x19, %ecx
setge %al
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pagerUnlockDb
static int pagerUnlockDb(Pager *pPager, int eLock){
  int rc = SQLITE_OK;

  assert( !pPager->exclusiveMode || pPager->eLock==eLock );
  assert( eLock==NO_LOCK || eLock==SHARED_LOCK );
  assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 );
  if( isOpen(pPager->fd) ){
    assert( pPager->eLock>=eLock );
    rc = pPager->noLock ? SQLITE_OK : sqlite3OsUnlock(pPager->fd, eLock);
    if( pPager->eLock!=UNKNOWN_LOCK ){
      pPager->eLock = (u8)eLock;
    }
    IOTRACE(("UNLOCK %p %d\n", pPager, eLock))
  }
  pPager->changeCountDone = pPager->tempFile; /* ticket fb3b3024ea238d5c */
  return rc;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x294e47
movl %esi, %ebp
cmpb $0x0, 0x11(%rbx)
jne 0x294e3d
movl %ebp, %esi
callq *0x40(%rax)
cmpb $0x5, 0x15(%rbx)
je 0x294e47
movb %bpl, 0x15(%rbx)
movb 0x10(%rbx), %al
movb %al, 0x16(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: decodeFlags
static int decodeFlags(MemPage *pPage, int flagByte){
  BtShared *pBt;     /* A copy of pPage->pBt */

  assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  pPage->leaf = (u8)(flagByte>>3);  assert( PTF_LEAF == 1<<3 );
  flagByte &= ~PTF_LEAF;
  pPage->childPtrSize = 4-4*pPage->leaf;
  pPage->xCellSize = cellSizePtr;
  pBt = pPage->pBt;
  if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){
    /* EVIDENCE-OF: R-07291-35328 A value of 5 (0x05) means the page is an
    ** interior table b-tree page. */
    assert( (PTF_LEAFDATA|PTF_INTKEY)==5 );
    /* EVIDENCE-OF: R-26900-09176 A value of 13 (0x0d) means the page is a
    ** leaf table b-tree page. */
    assert( (PTF_LEAFDATA|PTF_INTKEY|PTF_LEAF)==13 );
    pPage->intKey = 1;
    if( pPage->leaf ){
      pPage->intKeyLeaf = 1;
      pPage->xParseCell = btreeParseCellPtr;
    }else{
      pPage->intKeyLeaf = 0;
      pPage->xCellSize = cellSizePtrNoPayload;
      pPage->xParseCell = btreeParseCellPtrNoPayload;
    }
    pPage->maxLocal = pBt->maxLeaf;
    pPage->minLocal = pBt->minLeaf;
  }else if( flagByte==PTF_ZERODATA ){
    /* EVIDENCE-OF: R-43316-37308 A value of 2 (0x02) means the page is an
    ** interior index b-tree page. */
    assert( (PTF_ZERODATA)==2 );
    /* EVIDENCE-OF: R-59615-42828 A value of 10 (0x0a) means the page is a
    ** leaf index b-tree page. */
    assert( (PTF_ZERODATA|PTF_LEAF)==10 );
    pPage->intKey = 0;
    pPage->intKeyLeaf = 0;
    pPage->xParseCell = btreeParseCellPtrIndex;
    pPage->maxLocal = pBt->maxLocal;
    pPage->minLocal = pBt->minLocal;
  }else{
    /* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is
    ** an error. */
    return SQLITE_CORRUPT_PAGE(pPage);
  }
  pPage->max1bytePayload = pBt->max1bytePayload;
  return SQLITE_OK;
}

// Assembly:
pushq %rbx
movl %esi, %ecx
shrl $0x3, %ecx
movb %cl, 0x8(%rdi)
andl $-0x9, %esi
movl %ecx, %eax
shll $0x2, %eax
movb $0x4, %dl
subb %al, %dl
movb %dl, 0xa(%rdi)
leaq 0x17a(%rip), %rax       # 0x2950fd
movq %rax, 0x78(%rdi)
movq 0x48(%rdi), %rax
cmpl $0x2, %esi
je 0x294faa
cmpl $0x5, %esi
jne 0x294fcc
movb $0x1, 0x2(%rdi)
testb %cl, %cl
je 0x294ff9
movb $0x1, 0x3(%rdi)
leaq 0x1ff(%rip), %rcx       # 0x2951a7
jmp 0x29500f
movw $0x0, 0x2(%rdi)
leaq 0x2fe(%rip), %rcx       # 0x2952b5
movq %rcx, 0x80(%rdi)
movzwl 0x2a(%rax), %ecx
movw %cx, 0xe(%rdi)
leaq 0x2c(%rax), %rcx
jmp 0x295022
leaq 0x14a34c(%rip), %rsi    # 0x3df31f
leaq 0x14a456(%rip), %rdx    # 0x3df430
leaq 0x14a1a4(%rip), %r8     # 0x3df185
movl $0xb, %ebx
movl $0xb, %edi
movl $0x10325, %ecx          # imm = 0x10325
xorl %eax, %eax
callq 0x27e637
jmp 0x295031
movb $0x0, 0x3(%rdi)
leaq 0x268(%rip), %rcx       # 0x29526c
movq %rcx, 0x78(%rdi)
leaq 0x276(%rip), %rcx       # 0x295285
movq %rcx, 0x80(%rdi)
movzwl 0x2e(%rax), %ecx
movw %cx, 0xe(%rdi)
leaq 0x30(%rax), %rcx
movzwl (%rcx), %ecx
movw %cx, 0x10(%rdi)
movb 0x25(%rax), %al
movb %al, 0xb(%rdi)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: btreeCellSizeCheck
static SQLITE_NOINLINE int btreeCellSizeCheck(MemPage *pPage){
  int iCellFirst;    /* First allowable cell or freeblock offset */
  int iCellLast;     /* Last possible cell or freeblock offset */
  int i;             /* Index into the cell pointer array */
  int sz;            /* Size of a cell */
  int pc;            /* Address of a freeblock within pPage->aData[] */
  u8 *data;          /* Equal to pPage->aData */
  int usableSize;    /* Maximum usable space on the page */
  int cellOffset;    /* Start of cell content area */

  iCellFirst = pPage->cellOffset + 2*pPage->nCell;
  usableSize = pPage->pBt->usableSize;
  iCellLast = usableSize - 4;
  data = pPage->aData;
  cellOffset = pPage->cellOffset;
  if( !pPage->leaf ) iCellLast--;
  for(i=0; i<pPage->nCell; i++){
    pc = get2byteAligned(&data[cellOffset+i*2]);
    testcase( pc==iCellFirst );
    testcase( pc==iCellLast );
    if( pc<iCellFirst || pc>iCellLast ){
      return SQLITE_CORRUPT_PAGE(pPage);
    }
    sz = pPage->xCellSize(pPage, &data[pc]);
    testcase( pc+sz==usableSize );
    if( pc+sz>usableSize ){
      return SQLITE_CORRUPT_PAGE(pPage);
    }
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movzwl 0x18(%rdi), %eax
movq 0x48(%rdi), %rcx
movl 0x38(%rcx), %r14d
cmpb $0x1, 0x8(%rdi)
movl %r14d, 0x4(%rsp)
sbbl $0x0, %r14d
testl %eax, %eax
je 0x2950bd
movq %rdi, %rbx
movzwl 0x12(%rdi), %ecx
addl $-0x4, %r14d
leal (%rcx,%rax,2), %eax
movl %eax, (%rsp)
movq 0x50(%rdi), %r12
leaq (%rcx,%r12), %r13
incq %r13
xorl %ebp, %ebp
movzwl -0x1(%r13,%rbp,2), %eax
rolw $0x8, %ax
movzwl %ax, %r15d
movl $0x10396, %ecx          # imm = 0x10396
cmpl (%rsp), %r15d
jb 0x2950c6
cmpl %r14d, %r15d
jg 0x2950c6
movl %r15d, %esi
addq %r12, %rsi
movq %rbx, %rdi
callq *0x78(%rbx)
movzwl %ax, %eax
addl %r15d, %eax
cmpl 0x4(%rsp), %eax
jg 0x2950c1
incq %rbp
movzwl 0x18(%rbx), %eax
cmpq %rax, %rbp
jb 0x29507b
xorl %ebx, %ebx
jmp 0x2950ec
movl $0x1039b, %ecx          # imm = 0x1039B
leaq 0x14a252(%rip), %rsi    # 0x3df31f
leaq 0x14a35c(%rip), %rdx    # 0x3df430
leaq 0x14a0aa(%rip), %r8     # 0x3df185
movl $0xb, %ebx
movl $0xb, %edi
xorl %eax, %eax
callq 0x27e637
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: cellSizePtr
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
  u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
  u8 *pEnd;                                /* End mark for a varint */
  u32 nSize;                               /* Size value to return */

#ifdef SQLITE_DEBUG
  /* The value returned by this function should always be the same as
  ** the (CellInfo.nSize) value found by doing a full parse of the
  ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
  ** this function verifies that this invariant is not violated. */
  CellInfo debuginfo;
  pPage->xParseCell(pPage, pCell, &debuginfo);
#endif

  nSize = *pIter;
  if( nSize>=0x80 ){
    pEnd = &pIter[8];
    nSize &= 0x7f;
    do{
      nSize = (nSize<<7) | (*++pIter & 0x7f);
    }while( *(pIter)>=0x80 && pIter<pEnd );
  }
  pIter++;
  if( pPage->intKey ){
    /* pIter now points at the 64-bit integer key value, a variable length
    ** integer. The following block moves pIter to point at the first byte
    ** past the end of the key value. */
    pEnd = &pIter[9];
    while( (*pIter++)&0x80 && pIter<pEnd );
  }
  testcase( nSize==pPage->maxLocal );
  testcase( nSize==pPage->maxLocal+1 );
  if( nSize<=pPage->maxLocal ){
    nSize += (u32)(pIter - pCell);
    if( nSize<4 ) nSize = 4;
  }else{
    int minLocal = pPage->minLocal;
    nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
    testcase( nSize==pPage->maxLocal );
    testcase( nSize==pPage->maxLocal+1 );
    if( nSize>pPage->maxLocal ){
      nSize = minLocal;
    }
    nSize += 4 + (u16)(pIter - pCell);
  }
  assert( nSize==debuginfo.nSize || CORRUPT_DB );
  return (u16)nSize;
}

// Assembly:
movzbl 0xa(%rdi), %eax
leaq (%rsi,%rax), %rcx
movzbl (%rsi,%rax), %eax
testb %al, %al
jns 0x29513c
andl $0x7f, %eax
xorl %edx, %edx
movq %rdx, %r9
movl %eax, %r10d
shll $0x7, %r10d
movzbl 0x1(%rcx,%rdx), %r8d
incq %rdx
movl %r8d, %eax
andl $0x7f, %eax
orl %r10d, %eax
cmpq $0x6, %r9
ja 0x295139
testb %r8b, %r8b
js 0x295112
addq %rdx, %rcx
cmpb $0x0, 0x2(%rdi)
je 0x29515f
movl $0x1, %edx
leaq 0x1(%rdx), %r8
cmpq $0x8, %rdx
ja 0x29515a
cmpb $0x0, (%rcx,%rdx)
movq %r8, %rdx
js 0x295147
addq %r8, %rcx
jmp 0x295162
incq %rcx
movzwl 0xe(%rdi), %r8d
cmpl %r8d, %eax
jbe 0x295195
movzwl 0x10(%rdi), %r9d
subl %r9d, %eax
movq 0x48(%rdi), %rdx
movl 0x38(%rdx), %edi
addl $-0x4, %edi
xorl %edx, %edx
divl %edi
addl %r9d, %edx
cmpl %r8d, %edx
cmoval %r9d, %edx
subl %esi, %ecx
addl %edx, %ecx
addl $0x4, %ecx
jmp 0x2951a4
subl %esi, %ecx
addl %ecx, %eax
cmpl $0x5, %eax
movl $0x4, %ecx
cmovael %eax, %ecx
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: btreeParseCellPtrIndex
static void btreeParseCellPtrIndex(
  MemPage *pPage,         /* Page containing the cell */
  u8 *pCell,              /* Pointer to the cell text. */
  CellInfo *pInfo         /* Fill in this structure */
){
  u8 *pIter;              /* For scanning through pCell */
  u32 nPayload;           /* Number of bytes of cell payload */

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( pPage->leaf==0 || pPage->leaf==1 );
  assert( pPage->intKeyLeaf==0 );
  pIter = pCell + pPage->childPtrSize;
  nPayload = *pIter;
  if( nPayload>=0x80 ){
    u8 *pEnd = &pIter[8];
    nPayload &= 0x7f;
    do{
      nPayload = (nPayload<<7) | (*++pIter & 0x7f);
    }while( *(pIter)>=0x80 && pIter<pEnd );
  }
  pIter++;
  pInfo->nKey = nPayload;
  pInfo->nPayload = nPayload;
  pInfo->pPayload = pIter;
  testcase( nPayload==pPage->maxLocal );
  testcase( nPayload==pPage->maxLocal+1 );
  if( nPayload<=pPage->maxLocal ){
    /* This is the (easy) common case where the entire payload fits
    ** on the local page.  No overflow is required.
    */
    pInfo->nSize = nPayload + (u16)(pIter - pCell);
    if( pInfo->nSize<4 ) pInfo->nSize = 4;
    pInfo->nLocal = (u16)nPayload;
  }else{
    btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
  }
}

// Assembly:
movzbl 0xa(%rdi), %ecx
leaq (%rsi,%rcx), %rax
movzbl (%rsi,%rcx), %ecx
testb %cl, %cl
jns 0x2952f5
andl $0x7f, %ecx
xorl %r8d, %r8d
movq %r8, %r10
movl %ecx, %r11d
shll $0x7, %r11d
movzbl 0x1(%rax,%r8), %r9d
incq %r8
movl %r9d, %ecx
andl $0x7f, %ecx
orl %r11d, %ecx
cmpq $0x6, %r10
ja 0x2952f2
testb %r9b, %r9b
js 0x2952cb
addq %r8, %rax
incq %rax
movl %ecx, %r8d
movq %r8, (%rdx)
movl %ecx, 0x10(%rdx)
movq %rax, 0x8(%rdx)
movzwl 0xe(%rdi), %r8d
cmpl %r8d, %ecx
ja 0x295329
subl %esi, %eax
addl %ecx, %eax
testl $0xfffc, %eax           # imm = 0xFFFC
movl $0x4, %esi
cmovnel %eax, %esi
movw %si, 0x16(%rdx)
movw %cx, 0x14(%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pcache1Alloc
static void *pcache1Alloc(int nByte){
  void *p = 0;
  assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
  if( nByte<=pcache1.szSlot ){
    sqlite3_mutex_enter(pcache1.mutex);
    p = (PgHdr1 *)pcache1.pFree;
    if( p ){
      pcache1.pFree = pcache1.pFree->pNext;
      pcache1.nFreeSlot--;
      pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve;
      assert( pcache1.nFreeSlot>=0 );
      sqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte);
      sqlite3StatusUp(SQLITE_STATUS_PAGECACHE_USED, 1);
    }
    sqlite3_mutex_leave(pcache1.mutex);
  }
  if( p==0 ){
    /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool.  Get
    ** it from sqlite3Malloc instead.
    */
    p = sqlite3Malloc(nByte);
#ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
    if( p ){
      int sz = sqlite3MallocSize(p);
      sqlite3_mutex_enter(pcache1.mutex);
      sqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte);
      sqlite3StatusUp(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz);
      sqlite3_mutex_leave(pcache1.mutex);
    }
#endif
    sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);
  }
  return p;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl %edi, 0x2348df(%rip)    # 0x4c9e0c
jl 0x29559c
movq 0x2348fa(%rip), %rbx    # 0x4c9e30
testq %rbx, %rbx
je 0x29559c
movq (%rbx), %rax
movq %rax, 0x2348eb(%rip)    # 0x4c9e30
movl 0x2348ed(%rip), %eax    # 0x4c9e38
leal -0x1(%rax), %ecx
movl %ecx, 0x2348e4(%rip)    # 0x4c9e38
xorl %ecx, %ecx
cmpl 0x2348b8(%rip), %eax    # 0x4c9e14
setle %cl
movl %ecx, 0x2348d7(%rip)    # 0x4c9e3c
movslq %edi, %rax
cmpq %rax, 0x234611(%rip)    # 0x4c9b80
jge 0x295578
movq %rax, 0x234608(%rip)    # 0x4c9b80
movq 0x234581(%rip), %rcx    # 0x4c9b00
leaq 0x1(%rcx), %rax
movq %rax, 0x234576(%rip)    # 0x4c9b00
cmpq 0x2345bf(%rip), %rcx    # 0x4c9b50
jl 0x29559e
movq %rax, 0x2345b6(%rip)    # 0x4c9b50
jmp 0x29559e
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x2955ae
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movslq %edi, %r14
movq %r14, %rdi
callq 0x27c381
testq %rax, %rax
je 0x2955fc
movq %rax, %rbx
movq %rax, %rdi
callq *0x2310ce(%rip)         # 0x4c6698
cmpq %r14, 0x2345af(%rip)    # 0x4c9b80
jge 0x2955da
movq %r14, 0x2345a6(%rip)    # 0x4c9b80
cltq
addq 0x234525(%rip), %rax    # 0x4c9b08
movq %rax, 0x23451e(%rip)    # 0x4c9b08
cmpq 0x234567(%rip), %rax    # 0x4c9b58
jle 0x2955a3
movq %rax, 0x23455e(%rip)    # 0x4c9b58
jmp 0x2955a3
xorl %ebx, %ebx
jmp 0x2955a3
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: databaseIsUnmoved
static int databaseIsUnmoved(Pager *pPager){
  int bHasMoved = 0;
  int rc;

  if( pPager->tempFile ) return SQLITE_OK;
  if( pPager->dbSize==0 ) return SQLITE_OK;
  assert( pPager->zFilename && pPager->zFilename[0] );
  rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_HAS_MOVED, &bHasMoved);
  if( rc==SQLITE_NOTFOUND ){
    /* If the HAS_MOVED file-control is unimplemented, assume that the file
    ** has not been moved.  That is the historical behavior of SQLite: prior to
    ** version 3.8.3, it never checked */
    rc = SQLITE_OK;
  }else if( rc==SQLITE_OK && bHasMoved ){
    rc = SQLITE_READONLY_DBMOVED;
  }
  return rc;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl $0x0, 0xc(%rsp)
xorl %ebx, %ebx
cmpb $0x0, 0x10(%rdi)
je 0x29561d
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
cmpl $0x0, 0x1c(%rdi)
je 0x295615
movq 0x48(%rdi), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x29563e
leaq 0xc(%rsp), %rdx
movl $0x14, %esi
callq *0x50(%rax)
jmp 0x295643
movl $0xc, %eax
cmpl $0xc, %eax
je 0x295615
cmpl $0x0, 0xc(%rsp)
movl $0x408, %ebx            # imm = 0x408
cmovel %eax, %ebx
testl %eax, %eax
cmovnel %eax, %ebx
jmp 0x295615
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3ConnectionBlocked
SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){
  enterMutex();
  if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){
    addToBlockedList(db);
  }
  db->pBlockingConnection = pBlocker;
  leaveMutex();
}

// Assembly:
cmpq $0x0, 0x2d8(%rdi)
jne 0x296569
cmpq $0x0, 0x2e0(%rdi)
jne 0x296569
movq 0x233934(%rip), %rax    # 0x4c9e58
leaq 0x23392d(%rip), %rcx    # 0x4c9e58
testq %rax, %rax
je 0x29655f
movq 0x2f0(%rdi), %rdx
cmpq %rdx, 0x2f0(%rax)
je 0x29655f
movq %rax, %rcx
movq 0x2f8(%rax), %rax
testq %rax, %rax
je 0x296558
cmpq %rdx, 0x2f0(%rax)
jne 0x296540
addq $0x2f8, %rcx            # imm = 0x2F8
movq %rax, 0x2f8(%rdi)
movq %rdi, (%rcx)
movq %rsi, 0x2d8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: releasePageOne
static void releasePageOne(MemPage *pPage){
  assert( pPage!=0 );
  assert( pPage->aData );
  assert( pPage->pBt );
  assert( pPage->pDbPage!=0 );
  assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
  assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  sqlite3PagerUnrefPageOne(pPage->pDbPage);
}

// Assembly:
pushq %rbx
movq 0x70(%rdi), %rdi
movq 0x28(%rdi), %rbx
callq 0x294a00
movq 0x118(%rbx), %rax
cmpl $0x0, 0x18(%rax)
je 0x296cab
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x293239
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/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 );
  assert( isOpen(pPager->fd) );
  assert( pPager->tempFile==0 );
  nPage = sqlite3WalDbsize(pPager->pWal);

  /* If the number of pages in the database is not available from the
  ** WAL sub-system, determine the page count 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 up the result.
  */
  if( nPage==0 && ALWAYS(isOpen(pPager->fd)) ){
    i64 n = 0;                    /* Size of db file in bytes */
    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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x120(%rdi), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x296d4f
cmpw $0x0, 0x3c(%rcx)
js 0x296d4f
movl 0x5c(%rcx), %eax
testl %eax, %eax
je 0x296d71
cmpl 0xc0(%r14), %eax
jbe 0x296d63
movl %eax, 0xc0(%r14)
movl %eax, (%rbx)
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x48(%r14), %rdi
cmpq $0x0, (%rdi)
je 0x296daf
movq %rsp, %rsi
movq $0x0, (%rsi)
movq (%rdi), %rax
callq *0x30(%rax)
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x296da9
movq (%rsp), %rax
movslq 0xbc(%r14), %rsi
addq %rsi, %rax
decq %rax
cqto
idivq %rsi
testl %ecx, %ecx
jne 0x296d67
jmp 0x296d53
xorl %eax, %eax
jmp 0x296d53
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/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_FAST_SECURE ){
    memset(&data[hdr], 0, pBt->usableSize - hdr);
  }
  data[hdr] = (char)flags;
  first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);
  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->cellOffset = first;
  pPage->aDataEnd = &data[pBt->usableSize];
  pPage->aCellIdx = &data[first];
  pPage->aDataOfst = &data[pPage->childPtrSize];
  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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movq 0x48(%rdi), %r14
movq 0x50(%rdi), %r15
movzbl 0x9(%rdi), %r12d
testb $0xc, 0x28(%r14)
je 0x296fa3
leaq (%r15,%r12), %rdi
movl 0x38(%r14), %edx
subl %r12d, %edx
xorl %esi, %esi
callq 0x173a0
movb %bpl, (%r15,%r12)
xorl %eax, %eax
testb $0x8, %bpl
sete %al
leal (%r12,%rax,4), %ecx
movq %rcx, (%rsp)
leal (%r12,%rax,4), %r13d
addl $0x8, %r13d
movl $0x0, 0x1(%r15,%r12)
xorl %eax, %eax
movb %al, 0x7(%r15,%r12)
movb 0x39(%r14), %al
movb %al, 0x5(%r15,%r12)
movb 0x38(%r14), %al
movb %al, 0x6(%r15,%r12)
movl 0x38(%r14), %eax
subl %r13d, %eax
movzwl %ax, %eax
movl %eax, 0x14(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x294f64
movw %r13w, 0x12(%rbx)
movl 0x38(%r14), %eax
addq %r15, %rax
movq %rax, 0x58(%rbx)
movq (%rsp), %rax
addq %r15, %rax
addq $0x8, %rax
movq %rax, 0x60(%rbx)
movzbl 0xa(%rbx), %eax
addq %r15, %rax
movq %rax, 0x68(%rbx)
xorl %eax, %eax
movb %al, 0xc(%rbx)
movl 0x34(%r14), %eax
decl %eax
movw %ax, 0x1a(%rbx)
movw $0x0, 0x18(%rbx)
movb $0x1, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/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) ) break;
  }
  if( p ) return saveCursorsOnList(p, iRoot, pExcept);
  if( pExcept ) pExcept->curFlags &= ~BTCF_Multiple;
  return SQLITE_OK;
}

// Assembly:
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x2979c6
cmpq %rdx, %rdi
je 0x2979c0
testl %esi, %esi
je 0x297c7e
cmpl %esi, 0x50(%rdi)
je 0x297c7e
movq 0x28(%rdi), %rdi
jmp 0x2979a5
testq %rdx, %rdx
je 0x2979cf
andb $-0x21, 0x1(%rdx)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: saveCursorsOnList
static int SQLITE_NOINLINE saveCursorsOnList(
  BtCursor *p,         /* The first cursor that needs saving */
  Pgno iRoot,          /* Only save cursor with this iRoot. Save all if zero */
  BtCursor *pExcept    /* Do not save this cursor */
){
  do{
    if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
      if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){
        int rc = saveCursorPosition(p);
        if( SQLITE_OK!=rc ){
          return rc;
        }
      }else{
        testcase( p->iPage>=0 );
        btreeReleaseAllCursorPages(p);
      }
    }
    p = p->pNext;
  }while( p );
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
cmpq %r14, %r15
je 0x297cba
testl %ebp, %ebp
je 0x297c9c
cmpl %ebp, 0x50(%r15)
jne 0x297cba
movzbl (%r15), %eax
movq %r15, %rdi
testb $-0x3, %al
jne 0x297cb5
callq 0x297cd2
testl %eax, %eax
cmovnel %eax, %ebx
je 0x297cba
jmp 0x297cc5
callq 0x297d1a
movq 0x28(%r15), %r15
testq %r15, %r15
jne 0x297c8d
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: saveCursorPosition
static int saveCursorPosition(BtCursor *pCur){
  int rc;

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

  if( pCur->curFlags & BTCF_Pinned ){
    return SQLITE_CONSTRAINT_PINNED;
  }
  if( pCur->eState==CURSOR_SKIPNEXT ){
    pCur->eState = CURSOR_VALID;
  }else{
    pCur->skipNext = 0;
  }

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

  pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl|BTCF_AtLast);
  return rc;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl $0xb13, %ebp            # imm = 0xB13
testb $0x40, 0x1(%rdi)
jne 0x297d11
movq %rdi, %rbx
cmpb $0x2, (%rdi)
jne 0x297ced
movb $0x0, (%rbx)
jmp 0x297cf4
movl $0x0, 0x4(%rbx)
movq %rbx, %rdi
callq 0x297d6a
movl %eax, %ebp
testl %eax, %eax
jne 0x297d0d
movq %rbx, %rdi
callq 0x297d1a
movb $0x3, (%rbx)
andb $-0xf, 0x1(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: btreeReleaseAllCursorPages
static void btreeReleaseAllCursorPages(BtCursor *pCur){
  int i;
  if( pCur->iPage>=0 ){
    for(i=0; i<pCur->iPage; i++){
      releasePageNotNull(pCur->apPage[i]);
    }
    releasePageNotNull(pCur->pPage);
    pCur->iPage = -1;
  }
}

// Assembly:
cmpb $0x0, 0x54(%rdi)
js 0x297d69
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x0, 0x54(%rdi)
jle 0x297d4e
xorl %r14d, %r14d
movq 0x90(%rbx,%r14,8), %rax
movq 0x70(%rax), %rdi
callq 0x2949b7
incq %r14
movsbq 0x54(%rbx), %rax
cmpq %rax, %r14
jl 0x297d30
movq 0x88(%rbx), %rax
movq 0x70(%rax), %rdi
callq 0x2949b7
movb $-0x1, 0x54(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: saveCursorKey
static int saveCursorKey(BtCursor *pCur){
  int rc = SQLITE_OK;
  assert( CURSOR_VALID==pCur->eState );
  assert( 0==pCur->pKey );
  assert( cursorHoldsMutex(pCur) );

  if( pCur->curIntKey ){
    /* Only the rowid is required for a table btree */
    pCur->nKey = sqlite3BtreeIntegerKey(pCur);
  }else{
    /* For an index btree, save the complete key content. It is possible
    ** that the current key is corrupt. In that case, it is possible that
    ** the sqlite3VdbeRecordUnpack() function may overread the buffer by
    ** up to the size of 1 varint plus 1 8-byte value when the cursor
    ** position is restored. Hence the 17 bytes of padding allocated
    ** below. */
    void *pKey;
    pCur->nKey = sqlite3BtreePayloadSize(pCur);
    pKey = sqlite3Malloc( pCur->nKey + 9 + 8 );
    if( pKey ){
      rc = sqlite3BtreePayload(pCur, 0, (int)pCur->nKey, pKey);
      if( rc==SQLITE_OK ){
        memset(((u8*)pKey)+pCur->nKey, 0, 9+8);
        pCur->pKey = pKey;
      }else{
        sqlite3_free(pKey);
      }
    }else{
      rc = SQLITE_NOMEM_BKPT;
    }
  }
  assert( !pCur->curIntKey || !pCur->pKey );
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x55(%rdi), %bpl
callq 0x297df9
testb %bpl, %bpl
je 0x297d99
movq 0x30(%rbx), %rax
movq %rax, 0x48(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl 0x40(%rbx), %edi
movq %rdi, 0x48(%rbx)
addq $0x11, %rdi
callq 0x27c381
testq %rax, %rax
je 0x297dda
movq %rax, %r14
movl 0x48(%rbx), %edx
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x297e3f
testl %eax, %eax
je 0x297de1
movl %eax, %r15d
movq %r14, %rdi
callq 0x27c490
movl %r15d, %ebp
jmp 0x297d8c
movl $0x7, %ebp
jmp 0x297d8c
movq 0x48(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%r14,%rax)
movb $0x0, 0x10(%r14,%rax)
movq %r14, 0x18(%rbx)
jmp 0x297d8c
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: getCellInfo
static SQLITE_NOINLINE void getCellInfo(BtCursor *pCur){
  if( pCur->info.nSize==0 ){
    pCur->curFlags |= BTCF_ValidNKey;
    btreeParseCell(pCur->pPage,pCur->ix,&pCur->info);
  }else{
    assertCellInfo(pCur);
  }
}

// Assembly:
cmpw $0x0, 0x46(%rdi)
je 0x297e01
retq
orb $0x2, 0x1(%rdi)
leaq 0x30(%rdi), %rdx
movq 0x88(%rdi), %rax
movzwl 0x56(%rdi), %ecx
movq 0x60(%rax), %rsi
movzwl 0x1a(%rax), %edi
movzbl (%rsi,%rcx,2), %r8d
shll $0x8, %r8d
movzbl 0x1(%rsi,%rcx,2), %esi
orl %r8d, %esi
andl %edi, %esi
addq 0x50(%rax), %rsi
movq 0x80(%rax), %rcx
movq %rax, %rdi
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: btreeGetUnusedPage
static int btreeGetUnusedPage(
  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 = btreeGetPage(pBt, pgno, ppPage, flags);
  if( rc==SQLITE_OK ){
    if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){
      releasePage(*ppPage);
      *ppPage = 0;
      return SQLITE_CORRUPT_BKPT;
    }
    (*ppPage)->isInit = 0;
  }else{
    *ppPage = 0;
  }
  return rc;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
callq 0x296bb1
movl %eax, %ebp
testl %eax, %eax
je 0x299091
movq $0x0, (%rbx)
jmp 0x2990e0
movq (%rbx), %rax
movq 0x70(%rax), %rdi
cmpw $0x2, 0x36(%rdi)
jl 0x2990dd
testq %rax, %rax
je 0x2990a9
callq 0x2949b7
movq $0x0, (%rbx)
leaq 0x146268(%rip), %rsi    # 0x3df31f
leaq 0x146372(%rip), %rdx    # 0x3df430
leaq 0x1460c0(%rip), %r8     # 0x3df185
movl $0xb, %ebp
movl $0xb, %edi
movl $0x104bb, %ecx          # imm = 0x104BB
xorl %eax, %eax
callq 0x27e637
jmp 0x2990e0
movb $0x0, (%rax)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq