LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3DbRealloc
SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){
  void *pNew = 0;
  assert( db!=0 );
  assert( sqlite3_mutex_held(db->mutex) );
  if( db->mallocFailed==0 ){
    if( p==0 ){
      return sqlite3DbMallocRaw(db, n);
    }
    if( isLookaside(db, p) ){
      if( n<=db->lookaside.sz ){
        return p;
      }
      pNew = sqlite3DbMallocRaw(db, n);
      if( pNew ){
        memcpy(pNew, p, db->lookaside.sz);
        sqlite3DbFree(db, p);
      }
    }else{
      assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );
      assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) );
      sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
      pNew = sqlite3_realloc(p, n);
      if( !pNew ){
        sqlite3MemdebugSetType(p, MEMTYPE_DB|MEMTYPE_HEAP);
        db->mallocFailed = 1;
      }
      sqlite3MemdebugSetType(pNew, MEMTYPE_DB | 
            (db->lookaside.bEnabled ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP));
    }
  }
  return pNew;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x0, 0x50(%rdi)
je 0x174f6
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x1756c
cmpq %rbx, 0x170(%r14)
ja 0x17559
cmpq %rbx, 0x178(%r14)
jbe 0x17559
movzwl 0x150(%r14), %eax
cmpl %r15d, %eax
jge 0x174e8
movq %r14, %rdi
movl %r15d, %esi
callq 0x11721
testq %rax, %rax
je 0x174e6
movq %rax, %r15
movzwl 0x150(%r14), %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x82f0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9ca4
movq %r15, %rbx
jmp 0x174e8
callq 0x9d86
testl %eax, %eax
je 0x17581
movb $0x1, 0x50(%r14)
jmp 0x174e6
movq %r14, %rdi
movl %r15d, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x11721
movq %rbx, %rdi
movl %r15d, %esi
callq 0xa45c
movq %rax, %rbx
testq %rax, %rax
jne 0x174e8
jmp 0x17562
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixClose
static int unixClose(sqlite3_file *id){
  int rc = SQLITE_OK;
  unixFile *pFile = (unixFile *)id;
  verifyDbFile(pFile);
  unixUnlock(id, NO_LOCK);
  unixEnterMutex();

  /* unixFile.pInode is always valid here. Otherwise, a different close
  ** routine (e.g. nolockClose()) would be called instead.
  */
  assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );
  if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){
    /* If there are outstanding locks, do not actually close the file just
    ** yet because that would clear those locks.  Instead, add the file
    ** descriptor to pInode->pUnused list.  It will be automatically closed 
    ** when the last lock is cleared.
    */
    setPendingFd(pFile);
  }
  releaseInodeInfo(pFile);
  rc = closeUnixFile(id);
  unixLeaveMutex();
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x18a1a
movq %rbx, %rdi
xorl %esi, %esi
callq 0x17c7f
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0x1762b
cmpl $0x0, 0x28(%r14)
je 0x175ef
movq 0x30(%rbx), %rax
movq 0x30(%r14), %rcx
movq %rcx, 0x8(%rax)
movq %rax, 0x30(%r14)
movl $0xffffffff, 0x18(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x30(%rbx)
decl 0x18(%r14)
jne 0x1762b
movq %rbx, %rdi
callq 0x18da0
movq 0x38(%r14), %rax
movq 0x40(%r14), %rcx
leaq 0x38(%rcx), %rdx
testq %rcx, %rcx
leaq 0x7e93d(%rip), %rsi     # 0x95f50
cmovneq %rdx, %rsi
movq %rax, (%rsi)
testq %rax, %rax
je 0x17623
movq %rcx, 0x40(%rax)
movq %r14, %rdi
callq 0xa3c7
movq %rbx, %rdi
callq 0x18ac8
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixTruncate
static int unixTruncate(sqlite3_file *id, i64 nByte){
  unixFile *pFile = (unixFile *)id;
  int rc;
  assert( pFile );
  SimulateIOError( return SQLITE_IOERR_TRUNCATE );

  /* If the user has configured a chunk-size for this file, truncate the
  ** file so that it consists of an integer number of chunks (i.e. the
  ** actual file size after the operation may be larger than the requested
  ** size).
  */
  if( pFile->szChunk>0 ){
    nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;
  }

  rc = robust_ftruncate(pFile->h, (off_t)nByte);
  if( rc ){
    pFile->lastErrno = errno;
    return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
  }else{
#ifdef SQLITE_DEBUG
    /* If we are doing a normal write to a database file (as opposed to
    ** doing a hot-journal rollback or a write to some file other than a
    ** normal database file) and we truncate the file to zero length,
    ** that effectively updates the change counter.  This might happen
    ** when restoring a database using the backup API from a zero-length
    ** source.
    */
    if( pFile->inNormalWrite && nByte==0 ){
      pFile->transCntrChng = 1;
    }
#endif

    /* If the file was just truncated to a size smaller than the currently
    ** mapped region, reduce the effective mapping size as well. SQLite will
    ** use read() and write() to access data beyond this point from now on.  
    */
    if( nByte<pFile->mmapSize ){
      pFile->mmapSize = nByte;
    }

    return SQLITE_OK;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x48(%rdi), %eax
testl %eax, %eax
jle 0x178a3
movl %eax, %ecx
addq %rcx, %r14
decq %r14
movq %r14, %rax
cqto
idivq %rcx
subq %rdx, %r14
movl 0x18(%rbx), %r15d
movl %r15d, %edi
movq %r14, %rsi
callq *0x7d035(%rip)          # 0x948e8
testl %eax, %eax
jns 0x178c3
callq 0x8060
cmpl $0x4, (%rax)
je 0x178a7
jmp 0x178ca
je 0x178fd
callq 0x8060
movl (%rax), %eax
movl %eax, 0x20(%rbx)
movq 0x38(%rbx), %rdx
leaq 0x61d69(%rip), %rsi     # 0x79643
movl $0x60a, %r15d           # imm = 0x60A
movl $0x60a, %edi            # imm = 0x60A
movl $0x680a, %ecx           # imm = 0x680A
callq 0x18d3b
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
cmpq 0x50(%rbx), %r14
jge 0x178ef
movq %r14, 0x50(%rbx)
jmp 0x178ef
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixSync
static int unixSync(sqlite3_file *id, int flags){
  int rc;
  unixFile *pFile = (unixFile*)id;

  int isDataOnly = (flags&SQLITE_SYNC_DATAONLY);
  int isFullsync = (flags&0x0F)==SQLITE_SYNC_FULL;

  /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */
  assert((flags&0x0F)==SQLITE_SYNC_NORMAL
      || (flags&0x0F)==SQLITE_SYNC_FULL
  );

  /* Unix cannot, but some systems may return SQLITE_FULL from here. This
  ** line is to test that doing so does not cause any problems.
  */
  SimulateDiskfullError( return SQLITE_FULL );

  assert( pFile );
  OSTRACE(("SYNC    %-3d\n", pFile->h));
  rc = full_fsync(pFile->h, isFullsync, isDataOnly);
  SimulateIOError( rc=1 );
  if( rc ){
    pFile->lastErrno = errno;
    return unixLogError(SQLITE_IOERR_FSYNC, "full_fsync", pFile->zPath);
  }

  /* Also fsync the directory containing the file if the DIRSYNC flag
  ** is set.  This is a one-time occurrence.  Many systems (examples: AIX)
  ** are unable to fsync a directory, so ignore errors on the fsync.
  */
  if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){
    int dirfd;
    OSTRACE(("DIRSYNC %s (have_fullfsync=%d fullsync=%d)\n", pFile->zPath,
            HAVE_FULLFSYNC, isFullsync));
    rc = osOpenDirectory(pFile->zPath, &dirfd);
    if( rc==SQLITE_OK && dirfd>=0 ){
      full_fsync(dirfd, 0, 0);
      robust_close(pFile, dirfd, __LINE__);
    }else if( rc==SQLITE_CANTOPEN ){
      rc = SQLITE_OK;
    }
    pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC;
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x18(%rdi), %edi
callq 0x8330
testl %eax, %eax
je 0x17952
callq 0x8060
movl (%rax), %eax
movl %eax, 0x20(%rbx)
movq 0x38(%rbx), %rdx
leaq 0x61dc8(%rip), %rsi     # 0x79703
movl $0x40a, %r14d           # imm = 0x40A
movl $0x40a, %edi            # imm = 0x40A
movl $0x67de, %ecx           # imm = 0x67DE
callq 0x18d3b
jmp 0x179bf
xorl %r14d, %r14d
testb $0x8, 0x1e(%rbx)
je 0x179bf
movq 0x38(%rbx), %rdi
leaq -0x14(%rbp), %r14
movq %r14, %rsi
callq *0x7d084(%rip)          # 0x949f0
testl %eax, %eax
sete %cl
movl (%r14), %edi
testl %edi, %edi
setns %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x179b1
callq 0x8330
movl -0x14(%rbp), %edi
callq *0x7cee2(%rip)          # 0x94870
xorl %r14d, %r14d
testl %eax, %eax
je 0x179bb
movq 0x38(%rbx), %rdx
leaq 0x61c89(%rip), %rsi     # 0x79629
movl $0x100a, %edi           # imm = 0x100A
movl $0x67ec, %ecx           # imm = 0x67EC
callq 0x18d3b
jmp 0x179bb
xorl %r14d, %r14d
cmpl $0xe, %eax
cmovnel %eax, %r14d
andb $-0x9, 0x1e(%rbx)
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixFileSize
static int unixFileSize(sqlite3_file *id, i64 *pSize){
  int rc;
  struct stat buf;
  assert( id );
  rc = osFstat(((unixFile*)id)->h, &buf);
  SimulateIOError( rc=1 );
  if( rc!=0 ){
    ((unixFile*)id)->lastErrno = errno;
    return SQLITE_IOERR_FSTAT;
  }
  *pSize = buf.st_size;

  /* When opening a zero-size database, the findInodeInfo() procedure
  ** writes a single byte into that file in order to work around a bug
  ** in the OS-X msdos filesystem.  In order to avoid problems with upper
  ** layers, we need to report this file size as zero even though it is
  ** really 1.   Ticket #3260.
  */
  if( *pSize==1 ) *pSize = 0;


  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x18(%rdi), %edi
leaq -0xa0(%rbp), %rsi
callq *0x7cee1(%rip)          # 0x948d0
testl %eax, %eax
je 0x17a05
callq 0x8060
movl (%rax), %eax
movl %eax, 0x20(%r14)
movl $0x70a, %eax            # imm = 0x70A
jmp 0x17a1b
movq -0x70(%rbp), %rcx
xorl %eax, %eax
cmpq $0x1, %rcx
movl $0x0, %edx
cmovneq %rcx, %rdx
movq %rdx, (%rbx)
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixCheckReservedLock
static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){
  int rc = SQLITE_OK;
  int reserved = 0;
  unixFile *pFile = (unixFile*)id;

  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );

  assert( pFile );
  unixEnterMutex(); /* Because pFile->pInode is shared across threads */

  /* Check if a thread in this process holds such a lock */
  if( pFile->pInode->eFileLock>SHARED_LOCK ){
    reserved = 1;
  }

  /* Otherwise see if some other process holds it.
  */
#ifndef __DJGPP__
  if( !reserved && !pFile->pInode->bProcessLock ){
    struct flock lock;
    lock.l_whence = SEEK_SET;
    lock.l_start = RESERVED_BYTE;
    lock.l_len = 1;
    lock.l_type = F_WRLCK;
    if( osFcntl(pFile->h, F_GETLK, &lock) ){
      rc = SQLITE_IOERR_CHECKRESERVEDLOCK;
      pFile->lastErrno = errno;
    } else if( lock.l_type!=F_UNLCK ){
      reserved = 1;
    }
  }
#endif
  
  unixLeaveMutex();
  OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved));

  *pResOut = reserved;
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq 0x10(%rdi), %rax
cmpb $0x1, 0x14(%rax)
ja 0x17e44
xorl %r15d, %r15d
cmpb $0x0, 0x15(%rax)
movl $0x0, %eax
jne 0x17e4c
movq %rdi, %r14
movslq 0x7ca3e(%rip), %rax     # 0x94840
incq %rax
leaq -0x38(%rbp), %rdx
movq %rax, 0x8(%rdx)
movq $0x1, 0x10(%rdx)
movl $0x1, (%rdx)
movl 0x18(%rdi), %edi
xorl %r15d, %r15d
movl $0x5, %esi
xorl %eax, %eax
callq *0x7cad2(%rip)          # 0x94900
testl %eax, %eax
je 0x17e5a
callq 0x8060
movl (%rax), %eax
movl %eax, 0x20(%r14)
movl $0xe0a, %eax            # imm = 0xE0A
jmp 0x17e4c
xorl %eax, %eax
movl $0x1, %r15d
movl %r15d, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
cmpw $0x2, -0x38(%rbp)
setne %r15b
xorl %eax, %eax
jmp 0x17e4c
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixFetch
static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
#if SQLITE_MAX_MMAP_SIZE>0
  unixFile *pFd = (unixFile *)fd;   /* The underlying database file */
#endif
  *pp = 0;

#if SQLITE_MAX_MMAP_SIZE>0
  if( pFd->mmapSizeMax>0 ){
    if( pFd->pMapRegion==0 ){
      int rc = unixMapfile(pFd, -1);
      if( rc!=SQLITE_OK ) return rc;
    }
    if( pFd->mmapSize >= iOff+nAmt ){
      *pp = &((u8 *)pFd->pMapRegion)[iOff];
      pFd->nFetchOut++;
    }
  }
#endif
  return SQLITE_OK;
}

// Assembly:
movq $0x0, (%rcx)
cmpq $0x0, 0x60(%rdi)
jle 0x189bd
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r14
cmpq $0x0, 0x68(%rdi)
je 0x189c0
movslq %r12d, %rax
addq %r15, %rax
cmpq %rax, 0x50(%r14)
jl 0x189b9
addq 0x68(%r14), %r15
movq %r15, (%rbx)
incl 0x4c(%r14)
xorl %eax, %eax
jmp 0x189d3
xorl %eax, %eax
retq
movq %r14, %rdi
movq $-0x1, %rsi
callq 0x190ef
testl %eax, %eax
je 0x189a2
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixUnfetch
static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
  unixFile *pFd = (unixFile *)fd;   /* The underlying database file */
  UNUSED_PARAMETER(iOff);

  /* If p==0 (unmap the entire file) then there must be no outstanding 
  ** xFetch references. Or, if p!=0 (meaning it is an xFetch reference),
  ** then there must be at least one outstanding.  */
  assert( (p==0)==(pFd->nFetchOut==0) );

  /* If p!=0, it must match the iOff value. */
  assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );

  if( p ){
    pFd->nFetchOut--;
  }else{
    unixUnmapfile(pFd);
  }

  assert( pFd->nFetchOut>=0 );
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdx, %rdx
je 0x189ef
decl 0x4c(%rbx)
jmp 0x18a11
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x18a11
movq 0x58(%rbx), %rsi
callq *0x7c066(%rip)          # 0x94a68
movq $0x0, 0x68(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: verifyDbFile
static void verifyDbFile(unixFile *pFile){
  struct stat buf;
  int rc;
  if( pFile->ctrlFlags & UNIXFILE_WARNED ){
    /* One or more of the following warnings have already been issued.  Do not
    ** repeat them so as not to clutter the error log */
    return;
  }
  rc = osFstat(pFile->h, &buf);
  if( rc!=0 ){
    sqlite3_log(SQLITE_WARNING, "cannot fstat db file %s", pFile->zPath);
    pFile->ctrlFlags |= UNIXFILE_WARNED;
    return;
  }
  if( buf.st_nlink==0 && (pFile->ctrlFlags & UNIXFILE_DELETE)==0 ){
    sqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath);
    pFile->ctrlFlags |= UNIXFILE_WARNED;
    return;
  }
  if( buf.st_nlink>1 ){
    sqlite3_log(SQLITE_WARNING, "multiple links to file: %s", pFile->zPath);
    pFile->ctrlFlags |= UNIXFILE_WARNED;
    return;
  }
  if( pFile->pInode!=0
   && ((rc = osStat(pFile->zPath, &buf))!=0
       || buf.st_ino!=pFile->pInode->fileId.ino)
  ){
    sqlite3_log(SQLITE_WARNING, "file renamed while open: %s", pFile->zPath);
    pFile->ctrlFlags |= UNIXFILE_WARNED;
    return;
  }
}

// Assembly:
testb $0x1, 0x1f(%rdi)
jne 0x18a67
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movl 0x18(%rdi), %edi
leaq -0x98(%rbp), %rsi
callq *0x7be91(%rip)          # 0x948d0
testl %eax, %eax
je 0x18a68
leaq 0x60b6e(%rip), %rsi     # 0x795b8
movq 0x38(%rbx), %rdx
movl $0x1c, %edi
xorl %eax, %eax
callq 0xb9c7
orb $0x1, 0x1f(%rbx)
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
movq -0x88(%rbp), %rax
cmpq $0x1, %rax
je 0x18a89
testq %rax, %rax
jne 0x18abf
testb $0x20, 0x1e(%rbx)
jne 0x18a89
leaq 0x60b49(%rip), %rsi     # 0x795d0
jmp 0x18a4a
cmpq $0x0, 0x10(%rbx)
je 0x18a5e
movq 0x38(%rbx), %rdi
leaq -0x98(%rbp), %rsi
callq *0x7be17(%rip)          # 0x948b8
leaq 0x60b60(%rip), %rsi     # 0x79608
testl %eax, %eax
jne 0x18a4a
movq -0x90(%rbp), %rax
movq 0x10(%rbx), %rcx
cmpq 0x8(%rcx), %rax
jne 0x18a4a
jmp 0x18a5e
leaq 0x60b27(%rip), %rsi     # 0x795ed
jmp 0x18a4a
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: closeUnixFile
static int closeUnixFile(sqlite3_file *id){
  unixFile *pFile = (unixFile*)id;
  unixUnmapfile(pFile);
  if( pFile->h>=0 ){
    robust_close(pFile, pFile->h, __LINE__);
    pFile->h = -1;
  }
#if OS_VXWORKS
  if( pFile->pId ){
    if( pFile->ctrlFlags & UNIXFILE_DELETE ){
      osUnlink(pFile->pId->zCanonicalName);
    }
    vxworksReleaseFileId(pFile->pId);
    pFile->pId = 0;
  }
#endif
  OSTRACE(("CLOSE   %-3d\n", pFile->h));
  OpenCounter(-1);
  sqlite3_free(pFile->pUnused);
  memset(pFile, 0, sizeof(unixFile));
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x68(%rdi), %rdi
testq %rdi, %rdi
je 0x18af3
movq 0x58(%rbx), %rsi
callq *0x7bf84(%rip)          # 0x94a68
movq $0x0, 0x68(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbx)
movl 0x18(%rbx), %edi
testl %edi, %edi
js 0x18b25
callq *0x7bd70(%rip)          # 0x94870
testl %eax, %eax
je 0x18b1e
movq 0x38(%rbx), %rdx
leaq 0x60b1a(%rip), %rsi     # 0x79629
movl $0x100a, %edi           # imm = 0x100A
movl $0x6173, %ecx           # imm = 0x6173
callq 0x18d3b
movl $0xffffffff, 0x18(%rbx) # imm = 0xFFFFFFFF
movq 0x30(%rbx), %rdi
callq 0xa3c7
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rbx)
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: openDirectory
static int openDirectory(const char *zFilename, int *pFd){
  int ii;
  int fd = -1;
  char zDirname[MAX_PATHNAME+1];

  sqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename);
  for(ii=(int)strlen(zDirname); ii>1 && zDirname[ii]!='/'; ii--);
  if( ii>0 ){
    zDirname[ii] = '\0';
    fd = robust_open(zDirname, O_RDONLY|O_BINARY, 0);
    if( fd>=0 ){
      OSTRACE(("OPENDIR %-3d %s\n", fd, zDirname));
    }
  }
  *pFd = fd;
  return (fd>=0?SQLITE_OK:unixLogError(SQLITE_CANTOPEN_BKPT, "open", zDirname));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %rbx
movq %rdi, %rcx
leaq 0x60b5d(%rip), %rdx     # 0x796d9
leaq -0x220(%rbp), %r14
movl $0x200, %edi            # imm = 0x200
movq %r14, %rsi
xorl %eax, %eax
callq 0xb954
movq %r14, %rdi
callq 0x8190
cmpl $0x2, %eax
jl 0x18bbc
movl %eax, %ecx
cmpb $0x2f, -0x220(%rbp,%rcx)
je 0x18bcc
leal -0x1(%rax), %ecx
cmpl $0x2, %eax
movl %ecx, %eax
jg 0x18b9f
movl $0x1, %ecx
jmp 0x18bcc
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl $0x1, %eax
jne 0x18bff
movb $0x0, -0x220(%rbp,%rcx)
leaq -0x220(%rbp), %r15
movq %r15, %rdi
movl $0x80000, %esi          # imm = 0x80000
movl $0x1a4, %edx            # imm = 0x1A4
callq *0x7bc6a(%rip)          # 0x94858
movl %eax, %r14d
testl %eax, %eax
jns 0x18c45
callq 0x8060
cmpl $0x4, (%rax)
je 0x18bdb
movl %r14d, (%rbx)
leaq 0x60ad3(%rip), %rsi     # 0x796dc
leaq 0x60929(%rip), %rcx     # 0x79539
movl $0xe, %ebx
movl $0xe, %edi
movl $0x67b5, %edx           # imm = 0x67B5
xorl %eax, %eax
callq 0xb9c7
leaq 0x609f7(%rip), %rsi     # 0x79624
leaq -0x220(%rbp), %rdx
movl $0xe, %edi
movl $0x67b5, %ecx           # imm = 0x67B5
callq 0x18d3b
jmp 0x18c4a
movl %r14d, (%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: robust_open
static int robust_open(const char *z, int f, mode_t m){
  int fd;
  mode_t m2 = m ? m : SQLITE_DEFAULT_FILE_PERMISSIONS;
  do{
#if defined(O_CLOEXEC)
    fd = osOpen(z,f|O_CLOEXEC,m2);
#else
    fd = osOpen(z,f,m2);
#endif
  }while( fd<0 && errno==EINTR );
  if( fd>=0 ){
    if( m!=0 ){
      struct stat statbuf;
      if( osFstat(fd, &statbuf)==0 
       && statbuf.st_size==0
       && (statbuf.st_mode&0777)!=m 
      ){
        osFchmod(fd, m);
      }
    }
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
    osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
#endif
  }
  return fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edx, %ebx
movl %esi, %r15d
movq %rdi, %r12
testl %edx, %edx
movl $0x1a4, %r13d           # imm = 0x1A4
cmovnel %edx, %r13d
orl $0x80000, %r15d         # imm = 0x80000
movq %r12, %rdi
movl %r15d, %esi
movl %r13d, %edx
callq *0x7bb81(%rip)          # 0x94858
movl %eax, %r14d
testl %eax, %eax
jns 0x18cea
callq 0x8060
cmpl $0x4, (%rax)
je 0x18cc8
jmp 0x18d26
testl %ebx, %ebx
je 0x18d26
leaq -0xb8(%rbp), %rsi
movl %r14d, %edi
callq *0x7bbd2(%rip)          # 0x948d0
testl %eax, %eax
jne 0x18d26
cmpq $0x0, -0x88(%rbp)
jne 0x18d26
movl $0x1ff, %eax            # imm = 0x1FF
andl -0xa0(%rbp), %eax
cmpl %ebx, %eax
je 0x18d26
movl %r14d, %edi
movl %ebx, %esi
callq *0x7bc82(%rip)          # 0x949a8
movl %r14d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: closePendingFds
static void closePendingFds(unixFile *pFile){
  unixInodeInfo *pInode = pFile->pInode;
  UnixUnusedFd *p;
  UnixUnusedFd *pNext;
  for(p=pInode->pUnused; p; p=pNext){
    pNext = p->pNext;
    robust_close(pFile, p->fd, __LINE__);
    sqlite3_free(p);
  }
  pInode->pUnused = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x10(%rdi), %r12
movq 0x30(%r12), %r14
testq %r14, %r14
je 0x18dfd
movq %rdi, %rbx
leaq 0x60863(%rip), %r15     # 0x79629
movq 0x8(%r14), %r13
movl (%r14), %edi
callq *0x7ba9d(%rip)          # 0x94870
testl %eax, %eax
je 0x18ded
movq 0x38(%rbx), %rdx
movl $0x100a, %edi           # imm = 0x100A
movq %r15, %rsi
movl $0x5ea1, %ecx           # imm = 0x5EA1
callq 0x18d3b
movq %r14, %rdi
callq 0xa3c7
movq %r13, %r14
testq %r13, %r13
jne 0x18dc6
movq $0x0, 0x30(%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: seekAndWriteFd
static int seekAndWriteFd(
  int fd,                         /* File descriptor to write to */
  i64 iOff,                       /* File offset to begin writing at */
  const void *pBuf,               /* Copy data from this buffer to the file */
  int nBuf,                       /* Size of buffer pBuf in bytes */
  int *piErrno                    /* OUT: Error number if error occurs */
){
  int rc = 0;                     /* Value returned by system call */

  assert( nBuf==(nBuf&0x1ffff) );
  nBuf &= 0x1ffff;
  TIMER_START;

#if defined(USE_PREAD)
  do{ rc = osPwrite(fd, pBuf, nBuf, iOff); }while( rc<0 && errno==EINTR );
#elif defined(USE_PREAD64)
  do{ rc = osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
#else
  do{
    i64 iSeek = lseek(fd, iOff, SEEK_SET);
    SimulateIOError( iSeek-- );

    if( iSeek!=iOff ){
      if( piErrno ) *piErrno = (iSeek==-1 ? errno : 0);
      return -1;
    }
    rc = osWrite(fd, pBuf, nBuf);
  }while( rc<0 && errno==EINTR );
#endif

  TIMER_END;
  OSTRACE(("WRITE   %-3d %5d %7lld %llu\n", fd, rc, iOff, TIMER_ELAPSED));

  if( rc<0 && piErrno ) *piErrno = errno;
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, -0x30(%rbp)
movl %ecx, %r15d
movq %rdx, %r12
movq %rsi, %r13
movl %edi, %ebx
andl $0x1ffff, %r15d         # imm = 0x1FFFF
movl %ebx, %edi
movq %r13, %rsi
xorl %edx, %edx
callq 0x8320
cmpq %r13, %rax
jne 0x18e77
movl %ebx, %edi
movq %r12, %rsi
movq %r15, %rdx
callq *0x7bb08(%rip)          # 0x94960
movq %rax, %r14
testl %r14d, %r14d
jns 0x18e97
callq 0x8060
movl (%rax), %ecx
cmpl $0x4, %ecx
je 0x18e39
movq -0x30(%rbp), %rbx
testq %rbx, %rbx
jne 0x18e95
jmp 0x18e97
movq -0x30(%rbp), %rbx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x18e97
xorl %ecx, %ecx
cmpq $-0x1, %rax
jne 0x18e95
callq 0x8060
movl (%rax), %ecx
movl %ecx, (%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixFileLock
static int unixFileLock(unixFile *pFile, struct flock *pLock){
  int rc;
  unixInodeInfo *pInode = pFile->pInode;
  assert( unixMutexHeld() );
  assert( pInode!=0 );
  if( ((pFile->ctrlFlags & UNIXFILE_EXCL)!=0 || pInode->bProcessLock)
   && ((pFile->ctrlFlags & UNIXFILE_RDONLY)==0)
  ){
    if( pInode->bProcessLock==0 ){
      struct flock lock;
      assert( pInode->nLock==0 );
      lock.l_whence = SEEK_SET;
      lock.l_start = SHARED_FIRST;
      lock.l_len = SHARED_SIZE;
      lock.l_type = F_WRLCK;
      rc = osFcntl(pFile->h, F_SETLK, &lock);
      if( rc<0 ) return rc;
      pInode->bProcessLock = 1;
      pInode->nLock++;
    }else{
      rc = 0;
    }
  }else{
    rc = osFcntl(pFile->h, F_SETLK, pLock);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rdx
movq 0x10(%rdi), %rbx
movzwl 0x1e(%rdi), %eax
testb $0x1, %al
jne 0x18ecd
testb $0x2, %al
jne 0x18ee0
cmpb $0x0, 0x15(%rbx)
jne 0x18ed7
jmp 0x18ee0
testb $0x2, %al
jne 0x18ee0
cmpb $0x0, 0x15(%rbx)
je 0x18ef9
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movq 0x7ba19(%rip), %rcx     # 0x94900
movl 0x18(%rdi), %edi
movl $0x6, %esi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
jmpq *%rcx
movslq 0x7b940(%rip), %rax     # 0x94840
addq $0x2, %rax
leaq -0x28(%rbp), %rdx
movq %rax, 0x8(%rdx)
movq $0x1fe, 0x10(%rdx)      # imm = 0x1FE
movl $0x1, (%rdx)
movl 0x18(%rdi), %edi
movl $0x6, %esi
xorl %eax, %eax
callq *0x7b9d6(%rip)          # 0x94900
testl %eax, %eax
js 0x18ed9
movb $0x1, 0x15(%rbx)
incl 0x28(%rbx)
jmp 0x18ed9
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixGetTempname
static int unixGetTempname(int nBuf, char *zBuf){
  static const unsigned char zChars[] =
    "abcdefghijklmnopqrstuvwxyz"
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "0123456789";
  unsigned int i, j;
  const char *zDir;

  /* It's odd to simulate an io-error here, but really this is just
  ** using the io-error infrastructure to test that SQLite handles this
  ** function failing. 
  */
  SimulateIOError( return SQLITE_IOERR );

  zDir = unixTempFileDir();
  if( zDir==0 ) zDir = ".";

  /* Check that the output buffer is large enough for the temporary file 
  ** name. If it is not, return SQLITE_ERROR.
  */
  if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){
    return SQLITE_ERROR;
  }

  do{
    sqlite3_snprintf(nBuf-18, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
    j = (int)strlen(zBuf);
    sqlite3_randomness(15, &zBuf[j]);
    for(i=0; i<15; i++, j++){
      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
    }
    zBuf[j] = 0;
    zBuf[j+1] = 0;
  }while( osAccess(zBuf,0)==0 );
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %rbx
movl %edi, -0x2c(%rbp)
movq 0x7cef5(%rip), %rax     # 0x95e88
movq %rax, 0x7baf6(%rip)     # 0x94a90
cmpq $0x0, 0x7baf6(%rip)     # 0x94a98
jne 0x18fb7
leaq 0x60780(%rip), %rdi     # 0x7972b
callq 0x84d0
movq %rax, 0x7bae1(%rip)     # 0x94a98
xorl %r14d, %r14d
leaq 0x7bacf(%rip), %r13     # 0x94a90
leaq -0xc0(%rbp), %r15
xorl %r12d, %r12d
testq %r12, %r12
je 0x19006
movq %r12, %rdi
movq %r15, %rsi
callq *0x7b8dc(%rip)          # 0x948b8
testl %eax, %eax
jne 0x19006
movl -0xa8(%rbp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x19006
movq %r12, %rdi
movl $0x7, %esi
callq *0x7b886(%rip)          # 0x94888
testl %eax, %eax
je 0x19014
movq (%r14,%r13), %r12
addq $0x8, %r14
cmpq $0x30, %r14
jne 0x18fcb
testq %r12, %r12
leaq 0x6455e(%rip), %r15     # 0x7d57c
cmovneq %r12, %r15
movq %r15, %rdi
callq 0x8190
addq $0x19, %rax
movslq -0x2c(%rbp), %rcx
movl $0x1, %r12d
cmpq %rcx, %rax
jae 0x190da
addl $-0x12, -0x2c(%rbp)
leaq 0x64404(%rip), %r14     # 0x7d450
movl -0x2c(%rbp), %edi
movq %rbx, %rsi
leaq 0x606b5(%rip), %rdx     # 0x7970e
movq %r15, %rcx
xorl %eax, %eax
callq 0xb954
movq %rbx, %rdi
callq 0x8190
movq %rax, %r13
movl %r13d, %esi
addq %rbx, %rsi
movl $0xf, %r12d
movl $0xf, %edi
callq 0xbad4
movl %r13d, %eax
movb (%rbx,%rax), %cl
movl %ecx, %edx
shrb %dl
movzbl %dl, %edx
imull $0x85, %edx, %edx
shrl $0xc, %edx
leal (%rdx,%rdx), %esi
shll $0x6, %edx
subl %esi, %edx
subb %dl, %cl
movzbl %cl, %ecx
movb (%rcx,%r14), %cl
movb %cl, (%rbx,%rax)
incl %r13d
decl %r12d
jne 0x19084
movl %r13d, %eax
xorl %r12d, %r12d
movb %r12b, (%rbx,%rax)
incl %r13d
movb %r12b, (%rbx,%r13)
movq %rbx, %rdi
xorl %esi, %esi
callq *0x7b7b6(%rip)          # 0x94888
testl %eax, %eax
je 0x1904c
movl %r12d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x190f8
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
testq %rsi, %rsi
js 0x191c4
movq 0x50(%rbx), %r12
movq 0x60(%rbx), %r14
cmpq %r14, %rsi
cmovlq %rsi, %r14
cmpq %r12, %r14
je 0x1927d
testq %r14, %r14
jle 0x191ef
movl 0x18(%rbx), %r8d
movq 0x68(%rbx), %r15
xorl %eax, %eax
testb $0x2, 0x1e(%rbx)
sete %cl
testq %r15, %r15
je 0x1921b
movb %cl, -0x29(%rbp)
movl %r8d, -0x30(%rbp)
movq 0x58(%rbx), %rsi
andq $-0x200, %r12           # imm = 0xFE00
subq %r12, %rsi
je 0x19174
leaq (%r15,%r12), %rdi
callq *0x7b8f4(%rip)          # 0x94a68
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movl $0x1, %ecx
xorl %eax, %eax
callq *0x7b8f6(%rip)          # 0x94a80
movq %rax, %r13
incq %rax
cmpq $0x1, %rax
ja 0x19243
movq %r15, %rdi
movq %r12, %rsi
callq *0x7b8c2(%rip)          # 0x94a68
leaq 0x60509(%rip), %r12     # 0x796b6
testq %r13, %r13
movl -0x30(%rbp), %r8d
movl $0x0, %eax
movb -0x29(%rbp), %cl
jne 0x1924a
jmp 0x19222
movl 0x18(%rbx), %edi
leaq -0xc0(%rbp), %rsi
callq *0x7b6fc(%rip)          # 0x948d0
movl %eax, %ecx
movl $0x70a, %eax            # imm = 0x70A
testl %ecx, %ecx
jne 0x1927f
movq -0x90(%rbp), %rsi
jmp 0x19118
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x1927d
leaq 0x50(%rbx), %r14
movq 0x58(%rbx), %rsi
callq *0x7b85e(%rip)          # 0x94a68
movq $0x0, 0x68(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
jmp 0x1927d
leaq 0x60488(%rip), %r12     # 0x796aa
movb %cl, %al
leal 0x1(,%rax,2), %edx
xorl %edi, %edi
movq %r14, %rsi
movl $0x1, %ecx
xorl %r9d, %r9d
callq *0x7b812(%rip)          # 0x94a50
movq %rax, %r13
jmp 0x1924a
leaq 0x6046c(%rip), %r12     # 0x796b6
cmpq $-0x1, %r13
jne 0x19271
movq 0x38(%rbx), %rdx
xorl %r13d, %r13d
xorl %edi, %edi
movq %r12, %rsi
movl $0x6c6c, %ecx           # imm = 0x6C6C
callq 0x18d3b
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_O3/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 0x192ae
cmpl $0x0, 0x30(%rbx)
je 0x192b9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r14
cmpw $0x0, 0x20(%rbx)
je 0x192f9
xorl %r15d, %r15d
cmpl $0x0, 0x18(%rbx)
js 0x192e0
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
movslq 0x1c(%rbx), %rsi
callq *0x7b78a(%rip)          # 0x94a68
jmp 0x192ed
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0xa3c7
incq %r15
movzwl 0x20(%rbx), %eax
cmpq %rax, %r15
jb 0x192c6
movq 0x28(%rbx), %rdi
callq 0xa3c7
movl 0x18(%rbx), %edi
testl %edi, %edi
js 0x1933d
callq *0x7b561(%rip)          # 0x94870
testl %eax, %eax
je 0x19336
testq %r14, %r14
je 0x1931e
movq 0x38(%r14), %rdx
jmp 0x19320
xorl %edx, %edx
leaq 0x60302(%rip), %rsi     # 0x79629
movl $0x100a, %edi           # imm = 0x100A
movl $0x6a18, %ecx           # imm = 0x6A18
callq 0x18d3b
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 0xa3c7
// File: /workspace/github_c_makefile_star2_O3/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 0x193b1
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0x1942c
movq 0x28(%rbx), %rdi
callq 0xa3c7
movq %rbx, %rdi
callq 0x18ac8
addq $0x8, %rsp
popq %rbx
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x193de
movb %r15b, 0x1c(%rbx)
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x8280
jmp 0x1941e
movl $0x1ff, %esi            # imm = 0x1FF
callq *0x7b61f(%rip)          # 0x94a08
testl %eax, %eax
js 0x193f6
movl %eax, %r14d
movb %r15b, 0x1c(%rbx)
jmp 0x1941e
callq 0x8060
movl (%rax), %r15d
movl $0x5, %r14d
cmpl $0x11, %r15d
je 0x1941e
movl %r15d, %edi
callq 0x18f37
cmpl $0x5, %eax
je 0x1941e
movl %r15d, 0x20(%rbx)
movl %eax, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x19466
movq %rdi, %r14
cmpl $0x1, %esi
jne 0x19450
movb $0x1, 0x1c(%r14)
jmp 0x19466
movq 0x28(%r14), %r15
movq %r15, %rdi
callq *0x7b5c3(%rip)          # 0x94a20
testl %eax, %eax
js 0x19471
movb $0x0, 0x1c(%r14)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x8060
movq %rax, %r12
movl (%rax), %eax
cmpl $0x14, %eax
jne 0x19491
movq %r15, %rdi
callq *0x7b54f(%rip)          # 0x949d8
testl %eax, %eax
jns 0x19461
movl (%r12), %eax
cmpl $0x2, %eax
je 0x19466
movl %eax, 0x20(%r14)
movl $0x80a, %ebx            # imm = 0x80A
jmp 0x19466
// File: /workspace/github_c_makefile_star2_O3/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 0xa684
movq %r14, %rdi
callq 0xb7d6
cmpb $0x1, 0x25(%r14)
jne 0x19550
movb $0x1, 0x50(%rbx)
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x195ed
movq %rdi, %r14
cmpb $0x0, 0x200(%rdi)
jne 0x195ed
movq (%rbx), %rdi
leaq -0x20(%rbp), %rcx
xorl %esi, %esi
movq %rbx, %rdx
xorl %r8d, %r8d
movl $0x21e, %r9d            # imm = 0x21E
callq 0x195fb
testl %eax, %eax
je 0x195b8
movl %eax, %r15d
leaq 0x601de(%rip), %rsi     # 0x79786
movq %r14, %rdi
xorl %eax, %eax
callq 0x11842
movl %r15d, 0x18(%r14)
jmp 0x195e7
movq -0x20(%rbp), %rax
movq 0x20(%rbx), %rcx
movq %rax, 0x28(%rcx)
movl 0x58(%rbx), %edx
movq (%rax), %rdi
movq 0x8(%rax), %rsi
xorl %r15d, %r15d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
callq 0x16c9b
cmpl $0x7, %eax
jne 0x195ed
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_O3/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 0x1a263
movl 0x2b8(%rbx), %esi
testl %esi, %esi
js 0x1a263
movq 0x2b0(%rbx), %rdi
callq *%rcx
testl %eax, %eax
je 0x1a258
movl 0x2b8(%rbx), %ecx
incl %ecx
jmp 0x1a25d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x2b8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x1a54c
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
btl $0xc, %eax
jb 0x1a54c
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x1a546
callq *%rax
movl $0x10000, %ecx          # imm = 0x10000
cmpl %ecx, %eax
cmovbl %eax, %ecx
cmpl $0x20, %eax
cmovgel %ecx, %r14d
jmp 0x1a54c
movl $0x1000, %r14d          # imm = 0x1000
movl %r14d, 0xb8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1a691
testl %ecx, %ecx
jle 0x1a691
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 0x1a67f
movq 0x10(%r14,%r12), %rdi
movl %ebx, %esi
callq 0x1b0b1
testl %eax, %eax
je 0x1a68c
addq $0x30, %r12
cmpq %r12, %r15
jne 0x1a668
xorl %eax, %eax
jmp 0x1a691
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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), %al
cmpb $0x2, %al
jne 0x1a6cb
incl 0x38(%rbx)
movl 0x28(%r14), %esi
movq %rbx, %rdi
callq 0x1b14d
jmp 0x1a75a
movq 0x58(%rbx), %rdx
cmpq $0x0, (%rdx)
jne 0x1a700
cmpb $0x4, %al
je 0x1a6e3
cmpb $0x0, 0x18(%rbx)
je 0x1a767
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdx)
movups %xmm0, 0x8(%rdx)
movq $0x0, 0x28(%rdx)
leaq 0x78753(%rip), %rax     # 0x92e50
movq %rax, (%rdx)
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 0x1a75a
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
je 0x1a6b7
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)
testl %eax, %eax
jne 0x1a75a
jmp 0x1a700
// File: /workspace/github_c_makefile_star2_O3/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 0x1b07a
movq %rdi, %rbx
callq 0x1c946
andb $-0x7, 0x2c(%rbx)
cmpw $0x0, 0x2e(%rbx)
je 0x1b081
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq 0x30(%rbx), %rax
cmpl $0x0, 0x28(%rax)
je 0x1b07a
cmpl $0x1, 0x28(%rbx)
jne 0x1b099
movq $0x0, 0x48(%rax)
movq 0x79448(%rip), %rcx     # 0x944e8
movq 0x40(%rax), %rdi
movq (%rbx), %rsi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rcx