LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixMapfile
static int unixMapfile(unixFile *pFd, i64 nByte){
#if SQLITE_MAX_MMAP_SIZE>0
  i64 nMap = nByte;
  int rc;

  assert( nMap>=0 || pFd->nFetchOut==0 );
  if( pFd->nFetchOut>0 ) return SQLITE_OK;

  if( nMap<0 ){
    struct stat statbuf;          /* Low-level file information */
    rc = osFstat(pFd->h, &statbuf);
    if( rc!=SQLITE_OK ){
      return SQLITE_IOERR_FSTAT;
    }
    nMap = statbuf.st_size;
  }
  if( nMap>pFd->mmapSizeMax ){
    nMap = pFd->mmapSizeMax;
  }

  if( nMap!=pFd->mmapSize ){
    if( nMap>0 ){
      unixRemapfile(pFd, nMap);
    }else{
      unixUnmapfile(pFd);
    }
  }
#endif

  return SQLITE_OK;
}

// Assembly:
cmpl $0x0, 0x4c(%rdi)
jle 0x1927e
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r12
movq %rdi, %rbx
testq %rsi, %rsi
js 0x1933d
movq 0x50(%rbx), %r15
movq 0x60(%rbx), %r14
cmpq %r14, %r12
cmovlq %r12, %r14
cmpq %r15, %r14
je 0x193f5
testq %r14, %r14
jle 0x19368
movl 0x18(%rbx), %r8d
movq 0x68(%rbx), %r12
xorl %eax, %eax
testb $0x2, 0x1e(%rbx)
sete %cl
testq %r12, %r12
je 0x19394
movb %cl, -0x29(%rbp)
movl %r8d, -0x30(%rbp)
movq 0x58(%rbx), %rsi
andq $-0x200, %r15           # imm = 0xFE00
subq %r15, %rsi
je 0x192fd
leaq (%r12,%r15), %rdi
callq *0x7b76b(%rip)          # 0x94a68
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x1, %ecx
xorl %eax, %eax
callq *0x7b76d(%rip)          # 0x94a80
movq %rax, %r13
incq %rax
cmpq $0x1, %rax
ja 0x1932b
movq %r12, %rdi
movq %r15, %rsi
callq *0x7b73d(%rip)          # 0x94a68
movl -0x30(%rbp), %r8d
xorl %eax, %eax
movb -0x29(%rbp), %cl
leaq 0x6037b(%rip), %r15     # 0x796b6
jmp 0x1939e
movl 0x18(%rbx), %edi
leaq -0xc0(%rbp), %rsi
callq *0x7b583(%rip)          # 0x948d0
testl %eax, %eax
jne 0x19358
movq -0x90(%rbp), %r12
movl $0x70a, %eax            # imm = 0x70A
jne 0x193f7
jmp 0x192a1
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x193f5
leaq 0x50(%rbx), %r14
movq 0x58(%rbx), %rsi
callq *0x7b6e5(%rip)          # 0x94a68
movq $0x0, 0x68(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
jmp 0x193f5
leaq 0x6030f(%rip), %r15     # 0x796aa
xorl %r13d, %r13d
testq %r13, %r13
jne 0x193c2
movb %cl, %al
leal 0x1(,%rax,2), %edx
xorl %edi, %edi
movq %r14, %rsi
movl $0x1, %ecx
xorl %r9d, %r9d
callq *0x7b691(%rip)          # 0x94a50
movq %rax, %r13
cmpq $-0x1, %r13
jne 0x193e9
movq 0x38(%rbx), %rdx
xorl %r13d, %r13d
xorl %edi, %edi
movq %r15, %rsi
movl $0x6c6c, %ecx           # imm = 0x6C6C
callq 0x18ea3
movq $0x0, 0x60(%rbx)
xorl %r14d, %r14d
movq %r13, 0x68(%rbx)
movq %r14, 0x58(%rbx)
movq %r14, 0x50(%rbx)
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixShmPurge
static void unixShmPurge(unixFile *pFd){
  unixShmNode *p = pFd->pInode->pShmNode;
  assert( unixMutexHeld() );
  if( p && p->nRef==0 ){
    int i;
    assert( p->pInode==pFd->pInode );
    sqlite3_mutex_free(p->mutex);
    for(i=0; i<p->nRegion; i++){
      if( p->h>=0 ){
        osMunmap(p->apRegion[i], p->szRegion);
      }else{
        sqlite3_free(p->apRegion[i]);
      }
    }
    sqlite3_free(p->apRegion);
    if( p->h>=0 ){
      robust_close(pFd, p->h, __LINE__);
      p->h = -1;
    }
    p->pInode->pShmNode = 0;
    sqlite3_free(p);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x10(%rdi), %rax
movq 0x20(%rax), %rbx
testq %rbx, %rbx
je 0x19426
cmpl $0x0, 0x30(%rbx)
je 0x19431
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r14
cmpw $0x0, 0x20(%rbx)
je 0x19471
xorl %r15d, %r15d
cmpl $0x0, 0x18(%rbx)
js 0x19458
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
movslq 0x1c(%rbx), %rsi
callq *0x7b612(%rip)          # 0x94a68
jmp 0x19465
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0xa2e8
incq %r15
movzwl 0x20(%rbx), %eax
cmpq %rax, %r15
jb 0x1943e
movq 0x28(%rbx), %rdi
callq 0xa2e8
movl 0x18(%rbx), %edi
testl %edi, %edi
js 0x194b5
callq *0x7b3e9(%rip)          # 0x94870
testl %eax, %eax
je 0x194ae
testq %r14, %r14
je 0x19496
movq 0x38(%r14), %rdx
jmp 0x19498
xorl %edx, %edx
leaq 0x6018a(%rip), %rsi     # 0x79629
movl $0x100a, %edi           # imm = 0x100A
movl $0x6a18, %ecx           # imm = 0x6A18
callq 0x18ea3
movl $0xffffffff, 0x18(%rbx) # imm = 0xFFFFFFFF
movq (%rbx), %rax
movq $0x0, 0x20(%rax)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa2e8
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: dotlockClose
static int dotlockClose(sqlite3_file *id) {
  int rc = SQLITE_OK;
  if( id ){
    unixFile *pFile = (unixFile*)id;
    dotlockUnlock(id, NO_LOCK);
    sqlite3_free(pFile->lockingContext);
    rc = closeUnixFile(id);
  }
  return rc;
}

// Assembly:
testq %rdi, %rdi
je 0x19529
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0x195a4
movq 0x28(%rbx), %rdi
callq 0xa2e8
movq %rbx, %rdi
callq 0x18c22
addq $0x8, %rsp
popq %rbx
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: dotlockLock
static int dotlockLock(sqlite3_file *id, int eFileLock) {
  unixFile *pFile = (unixFile*)id;
  char *zLockFile = (char *)pFile->lockingContext;
  int rc = SQLITE_OK;


  /* If we have any lock, then the lock file already exists.  All we have
  ** to do is adjust our internal record of the lock level.
  */
  if( pFile->eFileLock > NO_LOCK ){
    pFile->eFileLock = eFileLock;
    /* Always update the timestamp on the old file */
#ifdef HAVE_UTIME
    utime(zLockFile, NULL);
#else
    utimes(zLockFile, NULL);
#endif
    return SQLITE_OK;
  }
  
  /* grab an exclusive lock */
  rc = osMkdir(zLockFile, 0777);
  if( rc<0 ){
    /* failed to open/create the lock directory */
    int tErrno = errno;
    if( EEXIST == tErrno ){
      rc = SQLITE_BUSY;
    } else {
      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
      if( IS_LOCK_ERROR(rc) ){
        pFile->lastErrno = tErrno;
      }
    }
    return rc;
  } 
  
  /* got it, set the type and return ok */
  pFile->eFileLock = eFileLock;
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r15d
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
cmpb $0x0, 0x1c(%rbx)
je 0x19556
movb %r15b, 0x1c(%rbx)
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x8280
jmp 0x19596
movl $0x1ff, %esi            # imm = 0x1FF
callq *0x7b4a7(%rip)          # 0x94a08
testl %eax, %eax
js 0x1956e
movl %eax, %r14d
movb %r15b, 0x1c(%rbx)
jmp 0x19596
callq 0x8060
movl (%rax), %r15d
movl $0x5, %r14d
cmpl $0x11, %r15d
je 0x19596
movl %r15d, %edi
callq 0x190bd
movl %eax, %r14d
cmpl $0x5, %eax
je 0x19596
movl %r15d, 0x20(%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: dotlockUnlock
static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
  unixFile *pFile = (unixFile*)id;
  char *zLockFile = (char *)pFile->lockingContext;
  int rc;

  assert( pFile );
  OSTRACE(("UNLOCK  %d %d was %d pid=%d (dotlock)\n", pFile->h, eFileLock,
           pFile->eFileLock, getpid()));
  assert( eFileLock<=SHARED_LOCK );
  
  /* no-op if possible */
  if( pFile->eFileLock==eFileLock ){
    return SQLITE_OK;
  }

  /* To downgrade to shared, simply update our internal notion of the
  ** lock state.  No need to mess with the file on disk.
  */
  if( eFileLock==SHARED_LOCK ){
    pFile->eFileLock = SHARED_LOCK;
    return SQLITE_OK;
  }
  
  /* To fully unlock the database, delete the lock file */
  assert( eFileLock==NO_LOCK );
  rc = osRmdir(zLockFile);
  if( rc<0 && errno==ENOTDIR ) rc = osUnlink(zLockFile);
  if( rc<0 ){
    int tErrno = errno;
    rc = 0;
    if( ENOENT != tErrno ){
      rc = SQLITE_IOERR_UNLOCK;
    }
    if( IS_LOCK_ERROR(rc) ){
      pFile->lastErrno = tErrno;
    }
    return rc; 
  }
  pFile->eFileLock = NO_LOCK;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movzbl 0x1c(%rdi), %eax
xorl %ebx, %ebx
cmpl %esi, %eax
je 0x195de
movq %rdi, %r14
cmpl $0x1, %esi
jne 0x195c8
movb $0x1, 0x1c(%r14)
jmp 0x195de
movq 0x28(%r14), %r15
movq %r15, %rdi
callq *0x7b44b(%rip)          # 0x94a20
testl %eax, %eax
js 0x195e9
movb $0x0, 0x1c(%r14)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x8060
movq %rax, %r12
cmpl $0x14, (%rax)
jne 0x19603
movq %r15, %rdi
callq *0x7b3d9(%rip)          # 0x949d8
testl %eax, %eax
jns 0x195d9
movl (%r12), %eax
xorl %ecx, %ecx
movl $0x80a, %ebx            # imm = 0x80A
cmpl $0x2, %eax
cmovel %ecx, %ebx
je 0x195de
movl %eax, 0x20(%r14)
jmp 0x195de
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VMPrintf
SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, va_list ap){
  char *z;
  char zBase[SQLITE_PRINT_BUF_SIZE];
  StrAccum acc;
  assert( db!=0 );
  sqlite3StrAccumInit(&acc, zBase, sizeof(zBase),
                      db->aLimit[SQLITE_LIMIT_LENGTH]);
  acc.db = db;
  sqlite3VXPrintf(&acc, 1, zFormat, ap);
  z = sqlite3StrAccumFinish(&acc);
  if( acc.accError==STRACCUM_NOMEM ){
    db->mallocFailed = 1;
  }
  return z;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdx, %rcx
movq %rsi, %rdx
movq %rdi, %rbx
movl 0x68(%rdi), %eax
leaq -0x80(%rbp), %rsi
leaq -0x38(%rbp), %r14
movq %rsi, 0x8(%r14)
movq %rsi, 0x10(%r14)
movabsq $0x4600000000, %rsi     # imm = 0x4600000000
movq %rsi, 0x18(%r14)
movl %eax, 0x20(%r14)
movw $0x1, 0x24(%r14)
movq %rdi, (%r14)
movq %r14, %rdi
movl $0x1, %esi
callq 0xa5a5
movq %r14, %rdi
callq 0xb6e7
cmpb $0x1, 0x25(%r14)
jne 0x196cb
movb $0x1, 0x50(%rbx)
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3OpenTempDatabase
SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *pParse){
  sqlite3 *db = pParse->db;
  if( db->aDb[1].pBt==0 && !pParse->explain ){
    int rc;
    Btree *pBt;
    static const int flags = 
          SQLITE_OPEN_READWRITE |
          SQLITE_OPEN_CREATE |
          SQLITE_OPEN_EXCLUSIVE |
          SQLITE_OPEN_DELETEONCLOSE |
          SQLITE_OPEN_TEMP_DB;

    rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pBt, 0, flags);
    if( rc!=SQLITE_OK ){
      sqlite3ErrorMsg(pParse, "unable to open a temporary database "
        "file for storing temporary tables");
      pParse->rc = rc;
      return 1;
    }
    db->aDb[1].pBt = pBt;
    assert( db->aDb[1].pSchema );
    if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){
      db->mallocFailed = 1;
      return 1;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rbx
movq 0x20(%rbx), %rax
xorl %r15d, %r15d
cmpq $0x0, 0x28(%rax)
jne 0x19760
movq %rdi, %r14
cmpb $0x0, 0x200(%rdi)
jne 0x19760
movq (%rbx), %rdi
leaq -0x20(%rbp), %rcx
xorl %esi, %esi
movq %rbx, %rdx
xorl %r8d, %r8d
movl $0x21e, %r9d            # imm = 0x21E
callq 0x1976e
testl %eax, %eax
je 0x19733
movl %eax, %r15d
leaq 0x60063(%rip), %rsi     # 0x79786
movq %r14, %rdi
xorl %eax, %eax
callq 0x11724
movl %r15d, 0x18(%r14)
jmp 0x1975a
movq -0x20(%rbp), %rdi
movq 0x20(%rbx), %rax
movq %rdi, 0x28(%rax)
movl 0x58(%rbx), %esi
xorl %r15d, %r15d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x16c39
cmpl $0x7, %eax
jne 0x19760
movb $0x1, 0x50(%rbx)
movl $0x1, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: btreeInvokeBusyHandler
static int btreeInvokeBusyHandler(void *pArg){
  BtShared *pBt = (BtShared*)pArg;
  assert( pBt->db );
  assert( sqlite3_mutex_held(pBt->db->mutex) );
  return sqlite3InvokeBusyHandler(&pBt->db->busyHandler);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x8(%rdi), %rbx
movq 0x2a8(%rbx), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x1a3fe
movl 0x2b8(%rbx), %esi
testl %esi, %esi
js 0x1a3fe
movq 0x2b0(%rbx), %rdi
callq *%rcx
testl %eax, %eax
je 0x1a3f3
movl 0x2b8(%rbx), %ecx
incl %ecx
jmp 0x1a3f8
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x2b8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: setSectorSize
static void setSectorSize(Pager *pPager){
  assert( isOpen(pPager->fd) || pPager->tempFile );

  if( pPager->tempFile
   || (sqlite3OsDeviceCharacteristics(pPager->fd) & 
              SQLITE_IOCAP_POWERSAFE_OVERWRITE)!=0
  ){
    /* Sector size doesn't matter for temporary files. Also, the file
    ** may not have been opened yet, in which case the OsSectorSize()
    ** call will segfault. */
    pPager->sectorSize = 512;
  }else{
    pPager->sectorSize = sqlite3SectorSize(pPager->fd);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x200, %r14d           # imm = 0x200
cmpb $0x0, 0x10(%rdi)
jne 0x1a703
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
btl $0xc, %eax
jb 0x1a703
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x1a6ed
callq *%rax
jmp 0x1a6f2
movl $0x1000, %eax           # imm = 0x1000
movl $0x10000, %ecx          # imm = 0x10000
cmpl %ecx, %eax
cmovll %eax, %ecx
cmpl $0x20, %eax
cmovgel %ecx, %r14d
movl %r14d, 0xb8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: subjRequiresPage
static int subjRequiresPage(PgHdr *pPg){
  Pager *pPager = pPg->pPager;
  PagerSavepoint *p;
  Pgno pgno;
  int i;
  if( pPager->nSavepoint ){
    pgno = pPg->pgno;
    for(i=0; i<pPager->nSavepoint; i++){
      p = &pPager->aSavepoint[i];
      if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){
        return 1;
      }
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x20(%rdi), %rdx
movl 0x80(%rdx), %ecx
xorl %eax, %eax
testq %rcx, %rcx
je 0x1a86f
testl %ecx, %ecx
jle 0x1a86f
movl 0x28(%rdi), %ebx
movq 0x78(%rdx), %r14
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %r15
xorl %r12d, %r12d
cmpl %ebx, 0x18(%r14,%r12)
jb 0x1a85d
movq 0x10(%r14,%r12), %rdi
movl %ebx, %esi
callq 0x1b2c2
testl %eax, %eax
je 0x1a86a
addq $0x30, %r12
cmpq %r12, %r15
jne 0x1a846
xorl %eax, %eax
jmp 0x1a86f
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: subjournalPage
static int subjournalPage(PgHdr *pPg){
  int rc = SQLITE_OK;
  Pager *pPager = pPg->pPager;
  if( pPager->journalMode!=PAGER_JOURNALMODE_OFF ){

    /* Open the sub-journal, if it has not already been opened */
    assert( pPager->useJournal );
    assert( isOpen(pPager->jfd) || pagerUseWal(pPager) );
    assert( isOpen(pPager->sjfd) || pPager->nSubRec==0 );
    assert( pagerUseWal(pPager) 
         || pageInJournal(pPg) 
         || pPg->pgno>pPager->dbOrigSize 
    );
    rc = openSubJournal(pPager);

    /* If the sub-journal was opened successfully (or was already open),
    ** write the journal record into the file.  */
    if( rc==SQLITE_OK ){
      void *pData = pPg->pData;
      i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);
      char *pData2;
  
      CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
      PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
      rc = write32bits(pPager->sjfd, offset, pPg->pgno);
      if( rc==SQLITE_OK ){
        rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4);
      }
    }
  }
  if( rc==SQLITE_OK ){
    pPager->nSubRec++;
    assert( pPager->nSavepoint>0 );
    rc = addToSavepointBitvecs(pPager, pPg->pgno);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movq 0x20(%rdi), %rbx
movb 0x9(%rbx), %cl
xorl %eax, %eax
cmpb $0x2, %cl
je 0x1a925
movq 0x58(%rbx), %rdx
xorl %eax, %eax
cmpq $0x0, (%rdx)
jne 0x1a8cf
cmpb $0x4, %cl
je 0x1a8b7
cmpb $0x0, 0x18(%rbx)
je 0x1a945
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movups %xmm0, 0x20(%rdx)
movups %xmm0, 0x10(%rdx)
leaq 0x78584(%rip), %rcx     # 0x92e50
movq %rcx, (%rdx)
testl %eax, %eax
jne 0x1a925
movq 0x8(%r14), %r15
movl 0x38(%rbx), %eax
movslq 0xbc(%rbx), %r12
addq $0x4, %r12
imulq %rax, %r12
movq 0x58(%rbx), %rdi
movl 0x28(%r14), %eax
bswapl %eax
leaq -0x24(%rbp), %rsi
movl %eax, (%rsi)
movq (%rdi), %rax
movl $0x4, %edx
movq %r12, %rcx
callq *0x18(%rax)
testl %eax, %eax
jne 0x1a925
movq 0x58(%rbx), %rdi
movl 0xbc(%rbx), %edx
addq $0x4, %r12
movq (%rdi), %rax
movq %r15, %rsi
movq %r12, %rcx
callq *0x18(%rax)
testl %eax, %eax
jne 0x1a938
incl 0x38(%rbx)
movl 0x28(%r14), %esi
movq %rbx, %rdi
callq 0x1b35e
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
xorl %esi, %esi
movl $0x201e, %ecx           # imm = 0x201E
xorl %r8d, %r8d
callq *0x28(%rdi)
jmp 0x1a8cf
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PcacheMakeClean
SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr *p){
  if( (p->flags & PGHDR_DIRTY) ){
    pcacheRemoveFromDirtyList(p);
    p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC);
    if( p->nRef==0 ){
      pcacheUnpin(p);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testb $0x2, 0x2c(%rdi)
je 0x1b28b
movq %rdi, %rbx
callq 0x1cae8
andb $-0x7, 0x2c(%rbx)
cmpw $0x0, 0x2e(%rbx)
je 0x1b292
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq 0x30(%rbx), %rax
cmpl $0x0, 0x28(%rax)
je 0x1b28b
cmpl $0x1, 0x28(%rbx)
jne 0x1b2aa
movq $0x0, 0x48(%rax)
movq 0x79237(%rip), %rcx     # 0x944e8
movq 0x40(%rax), %rdi
movq (%rbx), %rsi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BitvecTest
SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec *p, u32 i){
  if( p==0 ) return 0;
  if( i>p->iSize || i==0 ) return 0;
  i--;
  while( p->iDivisor ){
    u32 bin = i/p->iDivisor;
    i = i%p->iDivisor;
    p = p->u.apSub[bin];
    if (!p) {
      return 0;
    }
  }
  if( p->iSize<=BITVEC_NBIT ){
    return (p->u.aBitmap[i/BITVEC_SZELEM] & (1<<(i&(BITVEC_SZELEM-1))))!=0;
  } else{
    u32 h = BITVEC_HASH(i++);
    while( p->u.aHash[h] ){
      if( p->u.aHash[h]==i ) return 1;
      h = (h+1) % BITVEC_NINT;
    }
    return 0;
  }
}

// Assembly:
xorl %eax, %eax
testq %rdi, %rdi
je 0x1b35d
movl %esi, %edx
decl %edx
cmpl (%rdi), %edx
jae 0x1b35d
pushq %rbp
movq %rsp, %rbp
movl 0x8(%rdi), %ecx
testl %ecx, %ecx
je 0x1b2fa
movl %edx, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
xorl %eax, %eax
movq 0x10(%rdi,%rcx,8), %rdi
testq %rdi, %rdi
jne 0x1b2dd
jmp 0x1b35c
cmpl $0xf80, (%rdi)          # imm = 0xF80
ja 0x1b319
movl %edx, %eax
shrl $0x3, %eax
movzbl 0x10(%rdi,%rax), %ecx
andl $0x7, %edx
xorl %eax, %eax
btl %edx, %ecx
setb %al
jmp 0x1b35c
movl %edx, %eax
shrl $0x2, %eax
imulq $0x21084211, %rax, %rax # imm = 0x21084211
shrq $0x22, %rax
imull $0x7c, %eax, %eax
movl %edx, %ecx
subl %eax, %ecx
movl 0x10(%rdi,%rcx,4), %esi
movl $0x0, %eax
testl %esi, %esi
je 0x1b35c
incl %edx
xorl %eax, %eax
cmpl %edx, %esi
je 0x1b357
incl %ecx
cmpl $0x7c, %ecx
cmovel %eax, %ecx
movl 0x10(%rdi,%rcx,4), %esi
testl %esi, %esi
jne 0x1b341
jmp 0x1b35c
movl $0x1, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: addToSavepointBitvecs
static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
  int ii;                   /* Loop counter */
  int rc = SQLITE_OK;       /* Result code */

  for(ii=0; ii<pPager->nSavepoint; ii++){
    PagerSavepoint *p = &pPager->aSavepoint[ii];
    if( pgno<=p->nOrig ){
      rc |= sqlite3BitvecSet(p->pInSavepoint, pgno);
      testcase( rc==SQLITE_NOMEM );
      assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x80(%rdi)
jle 0x1b3b4
movl %esi, %ebx
movq %rdi, %r14
xorl %r12d, %r12d
movl $0x18, %r13d
xorl %r15d, %r15d
movq 0x78(%r14), %rax
cmpl %ebx, (%rax,%r13)
jb 0x1b39f
movq -0x8(%rax,%r13), %rdi
movl %ebx, %esi
callq 0x1b642
orl %eax, %r15d
incq %r12
movslq 0x80(%r14), %rax
addq $0x30, %r13
cmpq %rax, %r12
jl 0x1b386
jmp 0x1b3b7
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: memjrnlRead
static int memjrnlRead(
  sqlite3_file *pJfd,    /* The journal file from which to read */
  void *zBuf,            /* Put the results here */
  int iAmt,              /* Number of bytes to read */
  sqlite_int64 iOfst     /* Begin reading at this offset */
){
  MemJournal *p = (MemJournal *)pJfd;
  u8 *zOut = zBuf;
  int nRead = iAmt;
  int iChunkOffset;
  FileChunk *pChunk;

  /* SQLite never tries to read past the end of a rollback journal file */
  assert( iOfst+iAmt<=p->endpoint.iOffset );

  if( p->readpoint.iOffset!=iOfst || iOfst==0 ){
    sqlite3_int64 iOff = 0;
    for(pChunk=p->pFirst; 
        ALWAYS(pChunk) && (iOff+JOURNAL_CHUNKSIZE)<=iOfst;
        pChunk=pChunk->pNext
    ){
      iOff += JOURNAL_CHUNKSIZE;
    }
  }else{
    pChunk = p->readpoint.pChunk;
  }

  iChunkOffset = (int)(iOfst%JOURNAL_CHUNKSIZE);
  do {
    int iSpace = JOURNAL_CHUNKSIZE - iChunkOffset;
    int nCopy = MIN(nRead, (JOURNAL_CHUNKSIZE - iChunkOffset));
    memcpy(zOut, &pChunk->zChunk[iChunkOffset], nCopy);
    zOut += nCopy;
    nRead -= iSpace;
    iChunkOffset = 0;
  } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );
  p->readpoint.iOffset = iOfst+iAmt;
  p->readpoint.pChunk = pChunk;

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r8
movl %edx, %r14d
movq %rsi, %r12
testq %rcx, %rcx
je 0x1b436
cmpq %r8, 0x20(%rdi)
jne 0x1b436
movq 0x28(%rdi), %r15
jmp 0x1b456
leaq 0x8(%rdi), %r15
movl $0x3f8, %eax            # imm = 0x3F8
movq (%r15), %r15
testq %r15, %r15
je 0x1b456
leaq 0x3f8(%rax), %rcx
cmpq %r8, %rax
movq %rcx, %rax
jle 0x1b43f
movq %rdi, -0x38(%rbp)
movabsq $0x4081020408102041, %rcx # imm = 0x4081020408102041
movq %r8, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x8, %rdx
addl %eax, %edx
imull $0x3f8, %edx, %ecx      # imm = 0x3F8
movq %r8, -0x40(%rbp)
movl %r8d, %eax
subl %ecx, %eax
movl %r14d, -0x2c(%rbp)
movl $0x3f8, %ebx            # imm = 0x3F8
subl %eax, %ebx
cmpl %ebx, %r14d
movl %ebx, %ecx
cmovll %r14d, %ecx
cltq
leaq (%r15,%rax), %rsi
addq $0x8, %rsi
movslq %ecx, %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x82f0
subl %ebx, %r14d
js 0x1b4c6
movq (%r15), %r15
je 0x1b4c6
addq %r13, %r12
xorl %eax, %eax
testq %r15, %r15
jne 0x1b48a
movslq -0x2c(%rbp), %rax
addq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rax, 0x20(%rcx)
movq %r15, 0x28(%rcx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: memjrnlWrite
static int memjrnlWrite(
  sqlite3_file *pJfd,    /* The journal file into which to write */
  const void *zBuf,      /* Take data to be written from here */
  int iAmt,              /* Number of bytes to write */
  sqlite_int64 iOfst     /* Begin writing at this offset into the file */
){
  MemJournal *p = (MemJournal *)pJfd;
  int nWrite = iAmt;
  u8 *zWrite = (u8 *)zBuf;

  /* An in-memory journal file should only ever be appended to. Random
  ** access writes are not required by sqlite.
  */
  assert( iOfst==p->endpoint.iOffset );
  UNUSED_PARAMETER(iOfst);

  while( nWrite>0 ){
    FileChunk *pChunk = p->endpoint.pChunk;
    int iChunkOffset = (int)(p->endpoint.iOffset%JOURNAL_CHUNKSIZE);
    int iSpace = MIN(nWrite, JOURNAL_CHUNKSIZE - iChunkOffset);

    if( iChunkOffset==0 ){
      /* New chunk is required to extend the file. */
      FileChunk *pNew = sqlite3_malloc(sizeof(FileChunk));
      if( !pNew ){
        return SQLITE_IOERR_NOMEM;
      }
      pNew->pNext = 0;
      if( pChunk ){
        assert( p->pFirst );
        pChunk->pNext = pNew;
      }else{
        assert( !p->pFirst );
        p->pFirst = pNew;
      }
      p->endpoint.pChunk = pNew;
    }

    memcpy(&p->endpoint.pChunk->zChunk[iChunkOffset], zWrite, iSpace);
    zWrite += iSpace;
    nWrite -= iSpace;
    p->endpoint.iOffset += iSpace;
  }

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
leaq 0x8(%rdi), %rax
movq %rax, -0x38(%rbp)
testl %r14d, %r14d
jle 0x1b5d1
movq 0x10(%r12), %r13
movq %r13, %rax
movabsq $0x4081020408102041, %rcx # imm = 0x4081020408102041
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x8, %rdx
addq %rax, %rdx
imulq $0x3f8, %rdx, %rax      # imm = 0x3F8
subq %rax, %r13
movl $0x3f8, %ebx            # imm = 0x3F8
subl %r13d, %ebx
cmpl %ebx, %r14d
cmovll %r14d, %ebx
testq %r13, %r13
jne 0x1b597
movq %r15, -0x30(%rbp)
movq 0x18(%r12), %r15
callq 0x9d1f
testl %eax, %eax
je 0x1b56d
xorl %eax, %eax
jmp 0x1b577
movl $0x400, %edi            # imm = 0x400
callq 0xa2a2
testq %rax, %rax
je 0x1b5c9
movq $0x0, (%rax)
testq %r15, %r15
cmoveq -0x38(%rbp), %r15
movq %rax, (%r15)
movq %rax, 0x18(%r12)
movq -0x30(%rbp), %r15
movq 0x18(%r12), %rax
leaq (%rax,%r13), %rdi
addq $0x8, %rdi
movl %ebx, %r13d
movq %r15, %rsi
movq %r13, %rdx
callq 0x82f0
addq %r13, %r15
subl %ebx, %r14d
addq %r13, 0x10(%r12)
movb $0x1, %al
testb %al, %al
jne 0x1b50d
jmp 0x1b5d5
xorl %eax, %eax
movq -0x30(%rbp), %r15
jmp 0x1b5bf
xorl %eax, %eax
jmp 0x1b5da
movl $0xc0a, %eax            # imm = 0xC0A
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: memjrnlTruncate
static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){
  MemJournal *p = (MemJournal *)pJfd;
  FileChunk *pChunk;
  assert(size==0);
  UNUSED_PARAMETER(size);
  pChunk = p->pFirst;
  while( pChunk ){
    FileChunk *pTmp = pChunk;
    pChunk = pChunk->pNext;
    sqlite3_free(pTmp);
  }
  sqlite3MemJournalOpen(pJfd);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x1b60c
movq (%rdi), %r14
callq 0xa2e8
movq %r14, %rdi
testq %r14, %r14
jne 0x1b5fc
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
leaq 0x7782f(%rip), %rax     # 0x92e50
movq %rax, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pager_write_changecounter
static void pager_write_changecounter(PgHdr *pPg){
  u32 change_counter;

  /* Increment the value just read and write it back to byte 24. */
  change_counter = sqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1;
  put32bits(((char*)pPg->pData)+24, change_counter);

  /* Also store the SQLite version number in bytes 96..99 and in
  ** bytes 92..95 store the change counter for which the version number
  ** is valid. */
  put32bits(((char*)pPg->pData)+92, change_counter);
  put32bits(((char*)pPg->pData)+96, SQLITE_VERSION_NUMBER);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rax
movq 0x20(%rdi), %rcx
movl 0x84(%rcx), %ecx
bswapl %ecx
incl %ecx
bswapl %ecx
movl %ecx, 0x18(%rax)
movq 0x8(%rdi), %rax
movl %ecx, 0x5c(%rax)
movq 0x8(%rdi), %rax
movl $0xe62d00, 0x60(%rax)   # imm = 0xE62D00
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BackupUpdate
SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iPage, const u8 *aData){
  sqlite3_backup *p;                   /* Iterator variable */
  for(p=pBackup; p; p=p->pNext){
    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;
      }
    }
  }
}

// Assembly:
testq %rdi, %rdi
je 0x1b886
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
movl $0x61, %r12d
movl 0x30(%r15), %eax
cmpl $0x6, %eax
ja 0x1b875
btl %eax, %r12d
jae 0x1b875
cmpl %r14d, 0x18(%r15)
jbe 0x1b875
movq %r15, %rdi
movl %r14d, %esi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0xdb66
testl %eax, %eax
je 0x1b875
movl %eax, 0x30(%r15)
movq 0x40(%r15), %r15
testq %r15, %r15
jne 0x1b845
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: walChecksumBytes
static void walChecksumBytes(
  int nativeCksum, /* True for native byte-order, false for non-native */
  u8 *a,           /* Content to be checksummed */
  int nByte,       /* Bytes of content in a[].  Must be a multiple of 8. */
  const u32 *aIn,  /* Initial checksum value input */
  u32 *aOut        /* OUT: Final checksum value output */
){
  u32 s1, s2;
  u32 *aData = (u32 *)a;
  u32 *aEnd = (u32 *)&a[nByte];

  if( aIn ){
    s1 = aIn[0];
    s2 = aIn[1];
  }else{
    s1 = s2 = 0;
  }

  assert( nByte>=8 );
  assert( (nByte&0x00000007)==0 );

  if( nativeCksum ){
    do {
      s1 += *aData++ + s2;
      s2 += *aData++ + s1;
    }while( aData<aEnd );
  }else{
    do {
      s1 += BYTESWAP32(aData[0]) + s2;
      s2 += BYTESWAP32(aData[1]) + s1;
      aData += 2;
    }while( aData<aEnd );
  }

  aOut[0] = s1;
  aOut[1] = s2;
}

// Assembly:
movslq %edx, %rax
testq %rcx, %rcx
je 0x1b897
movl (%rcx), %edx
movl 0x4(%rcx), %r9d
jmp 0x1b89c
xorl %r9d, %r9d
xorl %edx, %edx
pushq %rbp
movq %rsp, %rbp
addq %rsi, %rax
testl %edi, %edi
je 0x1b8be
movl %r9d, %ecx
addl %ecx, %edx
addl (%rsi), %edx
addl 0x4(%rsi), %ecx
addq $0x8, %rsi
addl %edx, %ecx
cmpq %rax, %rsi
jb 0x1b8aa
jmp 0x1b8dd
movl (%rsi), %edi
movl 0x4(%rsi), %ecx
bswapl %edi
addl %r9d, %edx
addl %edi, %edx
bswapl %ecx
addl %r9d, %ecx
addl %edx, %ecx
addq $0x8, %rsi
movl %ecx, %r9d
cmpq %rax, %rsi
jb 0x1b8be
movl %edx, (%r8)
movl %ecx, 0x4(%r8)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: walWriteOneFrame
static int walWriteOneFrame(
  WalWriter *p,               /* Where to write the frame */
  PgHdr *pPage,               /* The page of the frame to be written */
  int nTruncate,              /* The commit flag.  Usually 0.  >0 for commit */
  sqlite3_int64 iOffset       /* Byte offset at which to write */
){
  int rc;                         /* Result code from subfunctions */
  void *pData;                    /* Data actually written */
  u8 aFrame[WAL_FRAME_HDRSIZE];   /* Buffer to assemble frame-header in */
#if defined(SQLITE_HAS_CODEC)
  if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM;
#else
  pData = pPage->pData;
#endif
  walEncodeFrame(p->pWal, pPage->pgno, nTruncate, pData, aFrame);
  rc = walWriteToLog(p, aFrame, sizeof(aFrame), iOffset);
  if( rc ) return rc;
  /* Write the page data */
  rc = walWriteToLog(p, pData, p->szPage, iOffset+sizeof(aFrame));
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, -0x38(%rbp)
movq %rdi, %r15
movq 0x8(%rsi), %rax
movq %rax, -0x30(%rbp)
movq (%rdi), %rbx
movl 0x28(%rsi), %eax
leaq 0x60(%rbx), %r13
movl %eax, %ecx
shrl $0x18, %ecx
leaq -0x50(%rbp), %r12
movb %cl, (%r12)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x1(%r12)
movb %ah, -0x4e(%rbp)
movb %al, 0x3(%r12)
movl %edx, %eax
shrl $0x18, %eax
movb %al, 0x4(%r12)
movl %edx, %eax
shrl $0x10, %eax
movb %al, 0x5(%r12)
movb %dh, -0x4a(%rbp)
movb %dl, 0x7(%r12)
movq 0x68(%rbx), %rax
movq %rax, 0x8(%r12)
xorl %r14d, %r14d
cmpb $0x0, 0x55(%rbx)
sete %r14b
movl %r14d, %edi
movq %r12, %rsi
movl $0x8, %edx
movq %r13, %rcx
movq %r13, %r8
callq 0x1b887
movl 0x38(%rbx), %edx
movl %r14d, %edi
movq -0x30(%rbp), %r14
movq %r14, %rsi
movq %r13, %rcx
movq %r13, %r8
callq 0x1b887
movl 0x60(%rbx), %eax
bswapl %eax
movl %eax, 0x10(%r12)
movl 0x64(%rbx), %eax
movq -0x38(%rbp), %rbx
bswapl %eax
movl %eax, 0x14(%r12)
movq %r15, %rdi
movq %r12, %rsi
movl $0x18, %edx
movq %rbx, %rcx
callq 0x1c7c3
testl %eax, %eax
jne 0x1b9d2
movl 0x1c(%r15), %edx
addq $0x18, %rbx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rcx
callq 0x1c7c3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: walLimitSize
static void walLimitSize(Wal *pWal, i64 nMax){
  i64 sz;
  int rx;
  sqlite3BeginBenignMalloc();
  rx = sqlite3OsFileSize(pWal->pWalFd, &sz);
  if( rx==SQLITE_OK && (sz > nMax ) ){
    rx = sqlite3OsTruncate(pWal->pWalFd, nMax);
  }
  sqlite3EndBenignMalloc();
  if( rx ){
    sqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x7a568(%rip), %rax     # 0x95f60
testq %rax, %rax
je 0x1b9ff
callq *%rax
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
leaq -0x20(%rbp), %rsi
callq *0x30(%rax)
movl %eax, %r15d
testl %eax, %eax
jne 0x1ba2d
xorl %r15d, %r15d
cmpq %r14, -0x20(%rbp)
jle 0x1ba2d
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x20(%rax)
movl %eax, %r15d
movq 0x7a534(%rip), %rax     # 0x95f68
testq %rax, %rax
je 0x1ba3b
callq *%rax
testl %r15d, %r15d
je 0x1ba55
movq 0x78(%rbx), %rdx
leaq 0x5ddaf(%rip), %rsi     # 0x797fa
movl %r15d, %edi
xorl %eax, %eax
callq 0xb8cc
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: walIndexWriteHdr
static void walIndexWriteHdr(Wal *pWal){
  volatile WalIndexHdr *aHdr = walIndexHdr(pWal);
  const int nCksum = offsetof(WalIndexHdr, aCksum);

  assert( pWal->writeLock );
  pWal->hdr.isInit = 1;
  pWal->hdr.iVersion = WALINDEX_MAX_VERSION;
  walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);
  memcpy((void *)&aHdr[1], (void *)&pWal->hdr, sizeof(WalIndexHdr));
  walShmBarrier(pWal);
  memcpy((void *)&aHdr[0], (void *)&pWal->hdr, sizeof(WalIndexHdr));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x30(%rdi), %rax
movq (%rax), %rbx
leaq 0x48(%rdi), %r14
movb $0x1, 0x54(%rdi)
movl $0x2de218, 0x48(%rdi)   # imm = 0x2DE218
xorl %eax, %eax
movl $0x40, %ecx
xorl %edx, %edx
addl %eax, %edx
addl 0x8(%rdi,%rcx), %edx
addl 0xc(%rdi,%rcx), %eax
addl %edx, %eax
addq $0x8, %rcx
cmpq $0x68, %rcx
jb 0x1bbde
movl %edx, 0x70(%rdi)
movl %eax, 0x74(%rdi)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x50(%rbx)
movups %xmm1, 0x40(%rbx)
movups %xmm0, 0x30(%rbx)
cmpb $0x2, 0x3f(%rdi)
je 0x1bc24
movq 0x8(%rdi), %rdi
movq (%rdi), %rax
callq *0x78(%rax)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%rbx)
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: walIndexPage
static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){
  int rc = SQLITE_OK;

  /* Enlarge the pWal->apWiData[] array if required */
  if( pWal->nWiData<=iPage ){
    int nByte = sizeof(u32*)*(iPage+1);
    volatile u32 **apNew;
    apNew = (volatile u32 **)sqlite3_realloc((void *)pWal->apWiData, nByte);
    if( !apNew ){
      *ppPage = 0;
      return SQLITE_NOMEM;
    }
    memset((void*)&apNew[pWal->nWiData], 0,
           sizeof(u32*)*(iPage+1-pWal->nWiData));
    pWal->apWiData = apNew;
    pWal->nWiData = iPage+1;
  }

  /* Request a pointer to the required page from the VFS */
  if( pWal->apWiData[iPage]==0 ){
    if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){
      pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ);
      if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM;
    }else{
      rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, 
          pWal->writeLock, (void volatile **)&pWal->apWiData[iPage]
      );
      if( rc==SQLITE_READONLY ){
        pWal->readOnly |= WAL_SHM_RDONLY;
        rc = SQLITE_OK;
      }
    }
  }

  *ppPage = pWal->apWiData[iPage];
  assert( iPage==0 || *ppPage || rc!=SQLITE_OK );
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movslq %esi, %r15
cmpl %esi, 0x28(%rdi)
jg 0x1c136
leaq 0x1(%r15), %r13
movq 0x30(%r14), %r12
callq 0x9d1f
testl %eax, %eax
je 0x1c0ef
xorl %r12d, %r12d
jmp 0x1c102
leal (,%r13,8), %esi
movq %r12, %rdi
callq 0xa37d
movq %rax, %r12
testq %r12, %r12
je 0x1c12a
movslq 0x28(%r14), %rax
leaq (%r12,%rax,8), %rdi
movq %r13, %rdx
subq %rax, %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x8200
movq %r12, 0x30(%r14)
movl %r13d, 0x28(%r14)
jmp 0x1c131
movq $0x0, (%rbx)
testq %r12, %r12
je 0x1c188
movq 0x30(%r14), %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx,%r15,8)
jne 0x1c1b6
cmpb $0x2, 0x3f(%r14)
jne 0x1c18f
movl $0x8000, %edi           # imm = 0x8000
callq 0xa2a2
movq %rax, %r12
testq %rax, %rax
je 0x1c16b
movl $0x8000, %edx           # imm = 0x8000
movq %r12, %rdi
xorl %esi, %esi
callq 0x8200
movq 0x30(%r14), %rax
movq %r12, (%rax,%r15,8)
movq 0x30(%r14), %rax
xorl %ecx, %ecx
cmpq $0x0, (%rax,%r15,8)
movl $0x7, %eax
cmovnel %ecx, %eax
jmp 0x1c1b6
movl $0x7, %eax
jmp 0x1c1c1
leaq (%rcx,%r15,8), %r8
movq 0x8(%r14), %rdi
movzbl 0x40(%r14), %ecx
movq (%rdi), %rax
movl %r15d, %esi
movl $0x8000, %edx           # imm = 0x8000
callq *0x68(%rax)
cmpl $0x8, %eax
jne 0x1c1b6
orb $0x2, 0x42(%r14)
xorl %eax, %eax
movq 0x30(%r14), %rcx
movq (%rcx,%r15,8), %rcx
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: walDecodeFrame
static int walDecodeFrame(
  Wal *pWal,                      /* The write-ahead log */
  u32 *piPage,                    /* OUT: Database page number for frame */
  u32 *pnTruncate,                /* OUT: New db size (or 0 if not commit) */
  u8 *aData,                      /* Pointer to page data (for checksum) */
  u8 *aFrame                      /* Frame data */
){
  int nativeCksum;                /* True for native byte-order checksums */
  u32 *aCksum = pWal->hdr.aFrameCksum;
  u32 pgno;                       /* Page number of the frame */
  assert( WAL_FRAME_HDRSIZE==24 );

  /* A frame is only valid if the salt values in the frame-header
  ** match the salt values in the wal-header. 
  */
  if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){
    return 0;
  }

  /* A frame is only valid if the page number is creater than zero.
  */
  pgno = sqlite3Get4byte(&aFrame[0]);
  if( pgno==0 ){
    return 0;
  }

  /* A frame is only valid if a checksum of the WAL header,
  ** all prior frams, the first 16 bytes of this frame-header, 
  ** and the frame-data matches the checksum in the last 8 
  ** bytes of this frame-header.
  */
  nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
  walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
  walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);
  if( aCksum[0]!=sqlite3Get4byte(&aFrame[16]) 
   || aCksum[1]!=sqlite3Get4byte(&aFrame[20]) 
  ){
    /* Checksum failed. */
    return 0;
  }

  /* If we reach this point, the frame is valid.  Return the page number
  ** and the new database size.
  */
  *piPage = pgno;
  *pnTruncate = sqlite3Get4byte(&aFrame[4]);
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x68(%rdi), %rax
xorl %ebx, %ebx
cmpq 0x8(%r8), %rax
je 0x1c72f
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r8, %r15
movl (%r8), %eax
bswapl %eax
testl %eax, %eax
je 0x1c71e
movq %rdi, %r13
movl %eax, -0x2c(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
leaq 0x60(%rdi), %r12
xorl %r14d, %r14d
cmpb $0x0, 0x55(%rdi)
sete %r14b
movl %r14d, %edi
movq %r15, %rsi
movl $0x8, %edx
movq %rcx, -0x48(%rbp)
movq %r12, %rcx
movq %r12, %r8
callq 0x1b887
movl 0x38(%r13), %edx
movl %r14d, %edi
movq -0x48(%rbp), %rsi
movq %r12, %rcx
movq %r12, %r8
callq 0x1b887
movl 0x10(%r15), %eax
bswapl %eax
cmpl %eax, 0x60(%r13)
jne 0x1c71e
movl 0x14(%r15), %eax
bswapl %eax
cmpl %eax, 0x64(%r13)
jne 0x1c71e
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, (%rax)
movl 0x4(%r15), %eax
bswapl %eax
movq -0x40(%rbp), %rcx
movl %eax, (%rcx)
movl $0x1, %ebx
jmp 0x1c71e
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: walWriteToLog
static int walWriteToLog(
  WalWriter *p,              /* WAL to write to */
  void *pContent,            /* Content to be written */
  int iAmt,                  /* Number of bytes to write */
  sqlite3_int64 iOffset      /* Start writing at this offset */
){
  int rc;
  if( iOffset<p->iSyncPoint && iOffset+iAmt>=p->iSyncPoint ){
    int iFirstAmt = (int)(p->iSyncPoint - iOffset);
    rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset);
    if( rc ) return rc;
    iOffset += iFirstAmt;
    iAmt -= iFirstAmt;
    pContent = (void*)(iFirstAmt + (char*)pContent);
    assert( p->syncFlags & (SQLITE_SYNC_NORMAL|SQLITE_SYNC_FULL) );
    rc = sqlite3OsSync(p->pFd, p->syncFlags);
    if( iAmt==0 || rc ) return rc;
  }
  rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
movq 0x10(%rdi), %rax
movq %rax, %r13
subq %rcx, %r13
jle 0x1c83a
movslq %r14d, %rcx
addq %rbx, %rcx
cmpq %rax, %rcx
jl 0x1c83a
movq 0x8(%r12), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movl %r13d, %edx
movq %rbx, %rcx
callq *0x18(%rax)
testl %eax, %eax
je 0x1c810
xorl %ecx, %ecx
jmp 0x1c836
movslq %r13d, %rax
addq %rax, %rbx
addq %rax, %r15
movq 0x8(%r12), %rdi
movl 0x18(%r12), %esi
movq (%rdi), %rax
callq *0x28(%rax)
subl %r13d, %r14d
setne %dl
testl %eax, %eax
sete %cl
andb %dl, %cl
testb %cl, %cl
je 0x1c85f
movq 0x8(%r12), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
movq %r15, %rsi
movl %r14d, %edx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PagerExclusiveLock
SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){
  int 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
movq %rsp, %rbp
pushq %r14
pushq %rbx
xorl %r14d, %r14d
cmpq $0x0, 0x118(%rdi)
jne 0x1c97f
movq %rdi, %rbx
movzbl 0x14(%rbx), %eax
xorl %r14d, %r14d
cmpl $0x4, %eax
jb 0x1c94b
cmpl $0x5, %eax
jne 0x1c968
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
movl $0x4, %esi
callq *0x38(%rax)
movl %eax, %r14d
testl %eax, %eax
jne 0x1c968
movb $0x4, 0x14(%rbx)
xorl %r14d, %r14d
cmpl $0x5, %r14d
jne 0x1c97f
movq 0xe8(%rbx), %rdi
callq *0xe0(%rbx)
testl %eax, %eax
jne 0x1c93a
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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;
  pBt = pPage->pBt;
  if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){
    pPage->intKey = 1;
    pPage->hasData = pPage->leaf;
    pPage->maxLocal = pBt->maxLeaf;
    pPage->minLocal = pBt->minLeaf;
  }else if( flagByte==PTF_ZERODATA ){
    pPage->intKey = 0;
    pPage->hasData = 0;
    pPage->maxLocal = pBt->maxLocal;
    pPage->minLocal = pBt->minLocal;
  }else{
    return SQLITE_CORRUPT_BKPT;
  }
  pPage->max1bytePayload = pBt->max1bytePayload;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %ecx
shrl $0x3, %ecx
movb %cl, 0x3(%rdi)
andl $-0x9, %esi
movl %ecx, %eax
shll $0x2, %eax
movb $0x4, %dl
subb %al, %dl
movb %dl, 0x6(%rdi)
movq 0x48(%rdi), %rax
cmpl $0x2, %esi
je 0x1cd8a
cmpl $0x5, %esi
jne 0x1cdb4
movb $0x1, 0x2(%rdi)
movb %cl, 0x4(%rdi)
leaq 0x2c(%rax), %rcx
movl $0x2e, %edx
jmp 0x1cd9b
xorl %ecx, %ecx
movb %cl, 0x2(%rdi)
movb %cl, 0x4(%rdi)
leaq 0x28(%rax), %rcx
movl $0x2a, %edx
movzwl (%rcx), %ecx
movw %cx, 0x8(%rdi)
movzwl (%rax,%rdx), %ecx
movw %cx, 0xa(%rdi)
movb 0x25(%rax), %al
movb %al, 0x7(%rdi)
xorl %ebx, %ebx
jmp 0x1cdd8
leaq 0x5ca59(%rip), %rsi     # 0x79814
leaq 0x5c777(%rip), %rcx     # 0x79539
movl $0xb, %ebx
movl $0xb, %edi
movl $0xc723, %edx           # imm = 0xC723
xorl %eax, %eax
callq 0xb8cc
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerFixMaplimit
static void pagerFixMaplimit(Pager *pPager){
#if SQLITE_MAX_MMAP_SIZE>0
  sqlite3_file *fd = pPager->fd;
  if( isOpen(fd) && fd->pMethods->iVersion>=3 ){
    sqlite3_int64 sz;
    sz = pPager->szMmap;
    pPager->bUseFetch = (sz>0);
    sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_SIZE, &sz);
  }
#endif
}

// Assembly:
movq %rdi, %rax
movq 0x48(%rdi), %rdi
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x1ce25
cmpl $0x3, (%rcx)
jl 0x1ce25
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0xa0(%rax), %rcx
leaq -0x8(%rbp), %rdx
movq %rcx, (%rdx)
testq %rcx, %rcx
setg 0x94(%rax)
movq (%rdi), %rax
movl $0x12, %esi
callq *0x50(%rax)
addq $0x10, %rsp
popq %rbp
retq