LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3ScratchFree
SQLITE_PRIVATE void sqlite3ScratchFree(void *p){
  if( p ){

#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
    /* Verify that no more than two scratch allocation per thread
    ** is outstanding at one time.  (This is only checked in the
    ** single-threaded case since checking in the multi-threaded case
    ** would be much more complicated.) */
    assert( scratchAllocOut>=1 && scratchAllocOut<=2 );
    scratchAllocOut--;
#endif

    if( p>=sqlite3GlobalConfig.pScratch && p<mem0.pScratchEnd ){
      /* Release memory from the SQLITE_CONFIG_SCRATCH allocation */
      ScratchFreeslot *pSlot;
      pSlot = (ScratchFreeslot*)p;
      sqlite3_mutex_enter(mem0.mutex);
      pSlot->pNext = mem0.pScratchFree;
      mem0.pScratchFree = pSlot;
      mem0.nScratchFree++;
      assert( mem0.nScratchFree <= (u32)sqlite3GlobalConfig.nScratch );
      sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1);
      sqlite3_mutex_leave(mem0.mutex);
    }else{
      /* Release memory back to the heap */
      assert( sqlite3MemdebugHasType(p, MEMTYPE_SCRATCH) );
      assert( sqlite3MemdebugNoType(p, ~MEMTYPE_SCRATCH) );
      sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
      if( sqlite3GlobalConfig.bMemstat ){
        int iSize = sqlite3MallocSize(p);
        sqlite3_mutex_enter(mem0.mutex);
        sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, -iSize);
        sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -iSize);
        sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, -1);
        sqlite3GlobalConfig.m.xFree(p);
        sqlite3_mutex_leave(mem0.mutex);
      }else{
        sqlite3GlobalConfig.m.xFree(p);
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1b2f1
movq -0x8(%rbp), %rax
cmpq 0xb5386(%rip), %rax     # 0xd05c8
jb 0x1b292
movq -0x8(%rbp), %rax
cmpq 0xb6c29(%rip), %rax     # 0xd1e78
jae 0x1b292
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq 0xb6c20(%rip), %rcx     # 0xd1e80
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq %rax, 0xb6c0e(%rip)     # 0xd1e80
movl 0xb6c10(%rip), %eax     # 0xd1e88
addl $0x1, %eax
movl %eax, 0xb6c07(%rip)     # 0xd1e88
movl $0x3, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xa490
jmp 0x1b2ef
cmpl $0x0, 0xb51f7(%rip)     # 0xd0490
je 0x1b2e0
movq -0x8(%rbp), %rdi
callq 0x9990
movl %eax, -0x14(%rbp)
xorl %esi, %esi
subl -0x14(%rbp), %esi
movl $0x4, %edi
callq 0xa490
xorl %esi, %esi
subl -0x14(%rbp), %esi
xorl %edi, %edi
callq 0xa490
movl $0x9, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xa490
movq 0xb51e0(%rip), %rax     # 0xd04b8
movq -0x8(%rbp), %rdi
callq *%rax
jmp 0x1b2ed
movq 0xb51d1(%rip), %rax     # 0xd04b8
movq -0x8(%rbp), %rdi
callq *%rax
jmp 0x1b2ef
jmp 0x1b2f1
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_uri_parameter
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){
  if( zFilename==0 ) return 0;
  zFilename += sqlite3Strlen30(zFilename) + 1;
  while( zFilename[0] ){
    int x = strcmp(zFilename, zParam);
    zFilename += sqlite3Strlen30(zFilename) + 1;
    if( x==0 ) return zFilename;
    zFilename += sqlite3Strlen30(zFilename) + 1;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1b324
movq $0x0, -0x8(%rbp)
jmp 0x1b3ab
movq -0x10(%rbp), %rdi
callq 0x92f0
movl %eax, %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x1b3a3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x85d0
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x92f0
movl %eax, %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x1b385
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1b3ab
movq -0x10(%rbp), %rdi
callq 0x92f0
movl %eax, %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x1b340
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_uri_int64
SQLITE_API sqlite3_int64 sqlite3_uri_int64(
  const char *zFilename,    /* Filename as passed to xOpen */
  const char *zParam,       /* URI parameter sought */
  sqlite3_int64 bDflt       /* return if parameter is missing */
){
  const char *z = sqlite3_uri_parameter(zFilename, zParam);
  sqlite3_int64 v;
  if( z && sqlite3Atoi64(z, &v, sqlite3Strlen30(z), SQLITE_UTF8)==SQLITE_OK ){
    bDflt = v;
  }
  return bDflt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1b300
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1b4be
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x92f0
movq -0x30(%rbp), %rdi
movl %eax, %edx
leaq -0x28(%rbp), %rsi
movl $0x1, %ecx
callq 0x1b4d0
cmpl $0x0, %eax
jne 0x1b4be
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: mallocWithAlarm
static int mallocWithAlarm(int n, void **pp){
  int nFull;
  void *p;
  assert( sqlite3_mutex_held(mem0.mutex) );
  nFull = sqlite3GlobalConfig.m.xRoundup(n);
  sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, n);
  if( mem0.alarmCallback!=0 ){
    int nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
    if( nUsed >= mem0.alarmThreshold - nFull ){
      mem0.nearlyFull = 1;
      sqlite3MallocAlarm(nFull);
    }else{
      mem0.nearlyFull = 0;
    }
  }
  p = sqlite3GlobalConfig.m.xMalloc(nFull);
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  if( p==0 && mem0.alarmCallback ){
    sqlite3MallocAlarm(nFull);
    p = sqlite3GlobalConfig.m.xMalloc(nFull);
  }
#endif
  if( p ){
    nFull = sqlite3MallocSize(p);
    sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nFull);
    sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, 1);
  }
  *pp = p;
  return nFull;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq 0xb4baa(%rip), %rax     # 0xd04d0
movl -0x4(%rbp), %edi
callq *%rax
movl %eax, -0x14(%rbp)
movl -0x4(%rbp), %esi
movl $0x5, %edi
callq 0x1b9e0
cmpq $0x0, 0xb6525(%rip)     # 0xd1e68
je 0x1b986
xorl %edi, %edi
callq 0x1b8f0
movl %eax, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq 0xb6506(%rip), %rcx     # 0xd1e60
movslq -0x14(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jl 0x1b97a
movl $0x1, 0xb651c(%rip)     # 0xd1e8c
movl -0x14(%rbp), %edi
callq 0x1ba40
jmp 0x1b984
movl $0x0, 0xb6508(%rip)     # 0xd1e8c
jmp 0x1b986
movq 0xb4b23(%rip), %rax     # 0xd04b0
movl -0x14(%rbp), %edi
callq *%rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1b9c2
movq -0x20(%rbp), %rdi
callq 0x9990
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
xorl %edi, %edi
callq 0xa490
movl $0x9, %edi
movl $0x1, %esi
callq 0xa490
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl -0x14(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3StatusSet
SQLITE_PRIVATE void sqlite3StatusSet(int op, int X){
  wsdStatInit;
  assert( op>=0 && op<ArraySize(wsdStat.nowValue) );
  wsdStat.nowValue[op] = X;
  if( wsdStat.nowValue[op]>wsdStat.mxValue[op] ){
    wsdStat.mxValue[op] = wsdStat.nowValue[op];
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl -0x8(%rbp), %edx
movslq -0x4(%rbp), %rcx
leaq 0xb6408(%rip), %rax     # 0xd1e00
movl %edx, (%rax,%rcx,4)
movslq -0x4(%rbp), %rcx
leaq 0xb63fa(%rip), %rax     # 0xd1e00
movl (%rax,%rcx,4), %eax
movslq -0x4(%rbp), %rdx
leaq 0xb63ec(%rip), %rcx     # 0xd1e00
cmpl 0x28(%rcx,%rdx,4), %eax
jle 0x1ba37
movslq -0x4(%rbp), %rcx
leaq 0xb63db(%rip), %rax     # 0xd1e00
movl (%rax,%rcx,4), %edx
movslq -0x4(%rbp), %rcx
leaq 0xb63cd(%rip), %rax     # 0xd1e00
movl %edx, 0x28(%rax,%rcx,4)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3MallocAlarm
static void sqlite3MallocAlarm(int nByte){
  void (*xCallback)(void*,sqlite3_int64,int);
  sqlite3_int64 nowUsed;
  void *pArg;
  if( mem0.alarmCallback==0 ) return;
  xCallback = mem0.alarmCallback;
  nowUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
  pArg = mem0.alarmArg;
  mem0.alarmCallback = 0;
  sqlite3_mutex_leave(mem0.mutex);
  xCallback(pArg, nowUsed, nByte);
  sqlite3_mutex_enter(mem0.mutex);
  mem0.alarmCallback = xCallback;
  mem0.alarmArg = pArg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
cmpq $0x0, 0xb6415(%rip)     # 0xd1e68
jne 0x1ba57
jmp 0x1baac
movq 0xb640a(%rip), %rax     # 0xd1e68
movq %rax, -0x10(%rbp)
xorl %edi, %edi
callq 0x1b8f0
cltq
movq %rax, -0x18(%rbp)
movq 0xb63fa(%rip), %rax     # 0xd1e70
movq %rax, -0x20(%rbp)
movq $0x0, 0xb63e3(%rip) # 0xd1e68
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x4(%rbp), %edx
callq *%rax
movq -0x10(%rbp), %rax
movq %rax, 0xb63c7(%rip)     # 0xd1e68
movq -0x20(%rbp), %rax
movq %rax, 0xb63c4(%rip)     # 0xd1e70
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3DbMallocSize
SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){
  assert( db==0 || sqlite3_mutex_held(db->mutex) );
  if( db && isLookaside(db, p) ){
    return db->lookaside.sz;
  }else{
    assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );
    assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) );
    assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );
    return sqlite3GlobalConfig.m.xSize(p);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1baf9
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1bb20
cmpl $0x0, %eax
je 0x1baf9
movq -0x10(%rbp), %rax
movzwl 0x150(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1bb09
movq 0xb49c8(%rip), %rax     # 0xd04c8
movq -0x18(%rbp), %rdi
callq *%rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: et_getdigit
static char et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){
  int digit;
  LONGDOUBLE_TYPE d;
  if( (*cnt)<=0 ) return '0';
  (*cnt)--;
  digit = (int)*val;
  d = digit;
  digit += '0';
  *val = (*val - d)*10.0;
  return (char)digit;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jg 0x1bdab
movb $0x30, -0x1(%rbp)
jmp 0x1be0a
movq -0x18(%rbp), %rax
movl (%rax), %ecx
decl %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
fldt (%rax)
fnstcw -0x3a(%rbp)
movzwl -0x3a(%rbp), %eax
orl $0xc00, %eax            # imm = 0xC00
movw %ax, -0x3c(%rbp)
fldcw -0x3c(%rbp)
fistpl -0x38(%rbp)
fldcw -0x3a(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
fildl -0x34(%rbp)
fstpt -0x30(%rbp)
movl -0x1c(%rbp), %eax
addl $0x30, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
fldt (%rax)
fldt -0x30(%rbp)
fsubrp %st, %st(1)
flds 0x920ec(%rip)           # 0xadeec
fmulp %st, %st(1)
fstpt (%rax)
movl -0x1c(%rbp), %eax
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3AppendSpace
SQLITE_PRIVATE void sqlite3AppendSpace(StrAccum *pAccum, int N){
  static const char zSpaces[] = "                             ";
  while( N>=(int)sizeof(zSpaces)-1 ){
    sqlite3StrAccumAppend(pAccum, zSpaces, sizeof(zSpaces)-1);
    N -= sizeof(zSpaces)-1;
  }
  if( N>0 ){
    sqlite3StrAccumAppend(pAccum, zSpaces, N);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x1d, -0xc(%rbp)
jl 0x1be47
movq -0x8(%rbp), %rdi
leaq 0x8f010(%rip), %rsi     # 0xaae40
movl $0x1d, %edx
callq 0x1bb70
movslq -0xc(%rbp), %rax
subq $0x1d, %rax
movl %eax, -0xc(%rbp)
jmp 0x1be1f
cmpl $0x0, -0xc(%rbp)
jle 0x1be60
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq 0x8efe5(%rip), %rsi     # 0xaae40
callq 0x1bb70
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3StrAccumReset
SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum *p){
  if( p->zText!=p->zBase ){
    if( p->useMalloc==1 ){
      sqlite3DbFree(p->db, p->zText);
    }else{
      sqlite3_free(p->zText);
    }
  }
  p->zText = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
je 0x1bec0
movq -0x8(%rbp), %rax
movzbl 0x24(%rax), %eax
cmpl $0x1, %eax
jne 0x1beb1
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x9cd0
jmp 0x1bebe
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa420
jmp 0x1bec0
movq -0x8(%rbp), %rax
movq $0x0, 0x10(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x50(%rax), %eax
cmpl $0x0, %eax
jne 0x1bfb9
cmpq $0x0, -0x18(%rbp)
jne 0x1bf28
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x134e0
movq %rax, -0x8(%rbp)
jmp 0x1bfc1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1bb20
cmpl $0x0, %eax
je 0x1bf96
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x150(%rcx), %ecx
cmpl %ecx, %eax
jg 0x1bf56
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1bfc1
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x134e0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1bf94
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rax
movzwl 0x150(%rax), %eax
movl %eax, %edx
callq 0x82f0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9cd0
jmp 0x1bfb7
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xa500
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1bfb5
movq -0x10(%rbp), %rax
movb $0x1, 0x50(%rax)
jmp 0x1bfb7
jmp 0x1bfb9
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1d3c0
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x1c870
callq 0x1d540
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1c046
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x0, 0x28(%rax)
je 0x1c046
movq -0x18(%rbp), %rdi
callq 0x1d550
movq -0x18(%rbp), %rdi
callq 0x1d5b0
movq -0x8(%rbp), %rdi
callq 0x1d650
movl %eax, -0xc(%rbp)
callq 0x1d6c0
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixRead
static int unixRead(
  sqlite3_file *id, 
  void *pBuf, 
  int amt,
  sqlite3_int64 offset
){
  unixFile *pFile = (unixFile *)id;
  int got;
  assert( id );
  assert( offset>=0 );
  assert( amt>0 );

  /* If this is a database file (not a journal, master-journal or temp
  ** file), the bytes in the locking range should never be read or written. */
#if 0
  assert( pFile->pUnused==0
       || offset>=PENDING_BYTE+512
       || offset+amt<=PENDING_BYTE 
  );
#endif

#if SQLITE_MAX_MMAP_SIZE>0
  /* Deal with as much of this read request as possible by transfering
  ** data from the memory mapping using memcpy().  */
  if( offset<pFile->mmapSize ){
    if( offset+amt <= pFile->mmapSize ){
      memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);
      return SQLITE_OK;
    }else{
      int nCopy = pFile->mmapSize - offset;
      memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);
      pBuf = &((u8 *)pBuf)[nCopy];
      amt -= nCopy;
      offset += nCopy;
    }
  }
#endif

  got = seekAndRead(pFile, offset, pBuf, amt);
  if( got==amt ){
    return SQLITE_OK;
  }else if( got<0 ){
    /* lastErrno set by seekAndRead */
    return SQLITE_IOERR_READ;
  }else{
    pFile->lastErrno = 0; /* not a system error */
    /* Unread parts of the buffer must be zero-filled */
    memset(&((char*)pBuf)[got], 0, amt-got);
    return SQLITE_IOERR_SHORT_READ;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jge 0x1c12b
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jg 0x1c0db
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x68(%rax), %rsi
addq -0x28(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x82f0
movl $0x0, -0x4(%rbp)
jmp 0x1c18f
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rax
subq -0x28(%rbp), %rax
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x68(%rax), %rsi
addq -0x28(%rbp), %rsi
movslq -0x38(%rbp), %rdx
callq 0x82f0
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl -0x38(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movslq -0x38(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c12b
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq 0x1db10
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x1c153
movl $0x0, -0x4(%rbp)
jmp 0x1c18f
cmpl $0x0, -0x34(%rbp)
jge 0x1c162
movl $0x10a, -0x4(%rbp)      # imm = 0x10A
jmp 0x1c18f
movq -0x30(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x18(%rbp), %rdi
movslq -0x34(%rbp), %rax
addq %rax, %rdi
movl -0x1c(%rbp), %eax
subl -0x34(%rbp), %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x8200
movl $0x20a, -0x4(%rbp)      # imm = 0x20A
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jle 0x1c362
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq 0x48(%rcx), %rcx
addq %rcx, %rax
subq $0x1, %rax
movq -0x20(%rbp), %rcx
movslq 0x48(%rcx), %rcx
cqto
idivq %rcx
movq -0x20(%rbp), %rcx
movslq 0x48(%rcx), %rcx
imulq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x18(%rbp), %rsi
callq 0x1dd60
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x1c3ac
callq 0x8060
movl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x60a, %edi            # imm = 0x60A
leaq 0x91d9d(%rip), %rsi     # 0xae13a
movl $0x680a, %ecx           # imm = 0x680A
callq 0x1d930
movl %eax, -0x4(%rbp)
jmp 0x1c3cd
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jge 0x1c3c6
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %eax
andl $0x10, %eax
movl %eax, -0x24(%rbp)
movl -0x14(%rbp), %eax
andl $0xf, %eax
cmpl $0x3, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0x18(%rax), %edi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x1ddb0
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x1c460
callq 0x8060
movl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x40a, %edi            # imm = 0x40A
leaq 0x91da9(%rip), %rsi     # 0xae1fa
movl $0x67de, %ecx           # imm = 0x67DE
callq 0x1d930
movl %eax, -0x4(%rbp)
jmp 0x1c4d7
movq -0x20(%rbp), %rax
movzwl 0x1e(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x1c4d1
movq 0xb4609(%rip), %rax     # 0xd0a80
movq -0x20(%rbp), %rcx
movq 0x38(%rcx), %rdi
leaq -0x2c(%rbp), %rsi
callq *%rax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x1c4b3
cmpl $0x0, -0x2c(%rbp)
jl 0x1c4b3
movl -0x2c(%rbp), %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x1ddb0
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x67ec, %edx           # imm = 0x67EC
callq 0x1da50
jmp 0x1c4c2
cmpl $0xe, -0x18(%rbp)
jne 0x1c4c0
movl $0x0, -0x18(%rbp)
jmp 0x1c4c2
movq -0x20(%rbp), %rax
movzwl 0x1e(%rax), %ecx
andl $-0x9, %ecx
movw %cx, 0x1e(%rax)
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq 0xb4466(%rip), %rax     # 0xd0960
movq -0x10(%rbp), %rcx
movl 0x18(%rcx), %edi
leaq -0xb0(%rbp), %rsi
callq *%rax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1c52a
callq 0x8060
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movl $0x70a, -0x4(%rbp)      # imm = 0x70A
jmp 0x1c551
movq -0x80(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x1, (%rax)
jne 0x1c54a
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
callq 0x1d540
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movzbl 0x14(%rax), %eax
cmpl $0x1, %eax
jle 0x1c8e3
movl $0x1, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x1c965
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
cmpb $0x0, 0x15(%rax)
jne 0x1c965
movw $0x0, -0x3e(%rbp)
movl 0xb3fcd(%rip), %eax     # 0xd08d0
addl $0x1, %eax
cltq
movq %rax, -0x38(%rbp)
movq $0x1, -0x30(%rbp)
movw $0x1, -0x40(%rbp)
movq 0xb406f(%rip), %rcx     # 0xd0990
movq -0x20(%rbp), %rax
movl 0x18(%rax), %edi
movl $0x5, %esi
leaq -0x40(%rbp), %rdx
movb $0x0, %al
callq *%rcx
cmpl $0x0, %eax
je 0x1c951
movl $0xe0a, -0x14(%rbp)     # imm = 0xE0A
callq 0x8060
movl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0x1c963
movswl -0x40(%rbp), %eax
cmpl $0x2, %eax
je 0x1c961
movl $0x1, -0x18(%rbp)
jmp 0x1c963
jmp 0x1c965
callq 0x1d6c0
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixDeviceCharacteristics
static int unixDeviceCharacteristics(sqlite3_file *id){
  unixFile *p = (unixFile*)id;
  int rc = 0;
#ifdef __QNXNTO__
  if( p->sectorSize==0 ) unixSectorSize(id);
  rc = p->deviceCharacteristics;
#endif
  if( p->ctrlFlags & UNIXFILE_PSOW ){
    rc |= SQLITE_IOCAP_POWERSAFE_OVERWRITE;
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x1e(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x1cbd2
movl -0x14(%rbp), %eax
orl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: unixShmUnmap
static int unixShmUnmap(
  sqlite3_file *fd,               /* The underlying database file */
  int deleteFlag                  /* Delete shared-memory if true */
){
  unixShm *p;                     /* The connection to be closed */
  unixShmNode *pShmNode;          /* The underlying shared-memory file */
  unixShm **pp;                   /* For looping over sibling connections */
  unixFile *pDbFd;                /* The underlying database file */

  pDbFd = (unixFile*)fd;
  p = pDbFd->pShm;
  if( p==0 ) return SQLITE_OK;
  pShmNode = p->pShmNode;

  assert( pShmNode==pDbFd->pInode->pShmNode );
  assert( pShmNode->pInode==pDbFd->pInode );

  /* Remove connection p from the set of connections associated
  ** with pShmNode */
  sqlite3_mutex_enter(pShmNode->mutex);
  for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){}
  *pp = p->pNext;

  /* Free the connection p */
  sqlite3_free(p);
  pDbFd->pShm = 0;
  sqlite3_mutex_leave(pShmNode->mutex);

  /* If pShmNode->nRef has reached 0, then close the underlying
  ** shared-memory file, too */
  unixEnterMutex();
  assert( pShmNode->nRef>0 );
  pShmNode->nRef--;
  if( pShmNode->nRef==0 ){
    if( deleteFlag && pShmNode->h>=0 ) osUnlink(pShmNode->zFilename);
    unixShmPurge(pDbFd);
  }
  unixLeaveMutex();

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x1d206
movl $0x0, -0x4(%rbp)
jmp 0x1d2b3
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x38, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
je 0x1d23d
jmp 0x1d22c
movq -0x30(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x1d21d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
callq 0xa420
movq -0x38(%rbp), %rax
movq $0x0, 0x40(%rax)
callq 0x1d540
movq -0x28(%rbp), %rax
movl 0x30(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x1d2a7
cmpl $0x0, -0x14(%rbp)
je 0x1d29e
movq -0x28(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jl 0x1d29e
movq 0xb37d4(%rip), %rax     # 0xd0a68
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rdi
callq *%rax
movq -0x38(%rbp), %rdi
callq 0x1ec20
callq 0x1d6c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jle 0x1d35d
movq -0x30(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jne 0x1d323
movq -0x30(%rbp), %rdi
movq $-0x1, %rsi
callq 0x1e4f0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1d321
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d364
jmp 0x1d323
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x18(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jl 0x1d35b
movq -0x30(%rbp), %rax
movq 0x68(%rax), %rcx
addq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movl 0x4c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4c(%rax)
jmp 0x1d35d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1d3a2
movq -0x20(%rbp), %rax
movl 0x4c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x4c(%rax)
jmp 0x1d3ab
movq -0x20(%rbp), %rdi
callq 0x1dab0
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movzwl 0x1e(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x1d3e6
jmp 0x1d533
movq 0xb3573(%rip), %rax     # 0xd0960
movq -0x8(%rbp), %rcx
movl 0x18(%rcx), %edi
leaq -0x98(%rbp), %rsi
callq *%rax
movl %eax, -0x9c(%rbp)
cmpl $0x0, -0x9c(%rbp)
je 0x1d43e
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x1c, %edi
leaq 0x90c8f(%rip), %rsi     # 0xae0af
movb $0x0, %al
callq 0xc5f0
movq -0x8(%rbp), %rax
movzwl 0x1e(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movw %cx, 0x1e(%rax)
jmp 0x1d533
cmpq $0x0, -0x88(%rbp)
jne 0x1d48a
movq -0x8(%rbp), %rax
movzwl 0x1e(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x1d48a
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x1c, %edi
leaq 0x90c5b(%rip), %rsi     # 0xae0c7
movb $0x0, %al
callq 0xc5f0
movq -0x8(%rbp), %rax
movzwl 0x1e(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movw %cx, 0x1e(%rax)
jmp 0x1d533
cmpq $0x1, -0x88(%rbp)
jbe 0x1d4c3
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x1c, %edi
leaq 0x90c3c(%rip), %rsi     # 0xae0e4
movb $0x0, %al
callq 0xc5f0
movq -0x8(%rbp), %rax
movzwl 0x1e(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movw %cx, 0x1e(%rax)
jmp 0x1d533
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1d533
movq 0xb3473(%rip), %rax     # 0xd0948
movq -0x8(%rbp), %rcx
movq 0x38(%rcx), %rdi
leaq -0x98(%rbp), %rsi
callq *%rax
movl %eax, -0x9c(%rbp)
cmpl $0x0, %eax
jne 0x1d506
movq -0x90(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpq 0x8(%rcx), %rax
je 0x1d533
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x1c, %edi
leaq 0x90be5(%rip), %rsi     # 0xae0ff
movb $0x0, %al
callq 0xc5f0
movq -0x8(%rbp), %rax
movzwl 0x1e(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movw %cx, 0x1e(%rax)
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: setPendingFd
static void setPendingFd(unixFile *pFile){
  unixInodeInfo *pInode = pFile->pInode;
  UnixUnusedFd *p = pFile->pUnused;
  p->pNext = pInode->pUnused;
  pInode->pUnused = p;
  pFile->h = -1;
  pFile->pUnused = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movq $0x0, 0x30(%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: releaseInodeInfo
static void releaseInodeInfo(unixFile *pFile){
  unixInodeInfo *pInode = pFile->pInode;
  assert( unixMutexHeld() );
  if( ALWAYS(pInode) ){
    pInode->nRef--;
    if( pInode->nRef==0 ){
      assert( pInode->pShmNode==0 );
      closePendingFds(pFile);
      if( pInode->pPrev ){
        assert( pInode->pPrev->pNext==pInode );
        pInode->pPrev->pNext = pInode->pNext;
      }else{
        assert( inodeList==pInode );
        inodeList = pInode->pNext;
      }
      if( pInode->pNext ){
        assert( pInode->pNext->pPrev==pInode );
        pInode->pNext->pPrev = pInode->pPrev;
      }
      sqlite3_free(pInode);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1d649
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x1d647
movq -0x8(%rbp), %rdi
callq 0x1d9e0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x1d610
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rcx, 0x38(%rax)
jmp 0x1d61f
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, 0xb4a51(%rip)     # 0xd2070
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x1d63e
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rdi
callq 0xa420
jmp 0x1d649
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1dab0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jl 0x1d697
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %esi
movl $0x6173, %edx           # imm = 0x6173
callq 0x1da50
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xa420
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x70, %edx
callq 0x8200
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
leaq -0x220(%rbp), %rsi
movq -0x8(%rbp), %rcx
movl $0x200, %edi            # imm = 0x200
leaq 0x90a9f(%rip), %rdx     # 0xae1d0
movb $0x0, %al
callq 0xc540
leaq -0x220(%rbp), %rdi
callq 0x81b0
movl %eax, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x1, -0x14(%rbp)
movb %al, -0x221(%rbp)
jle 0x1d76d
movslq -0x14(%rbp), %rax
movsbl -0x220(%rbp,%rax), %eax
cmpl $0x2f, %eax
setne %al
movb %al, -0x221(%rbp)
movb -0x221(%rbp), %al
testb $0x1, %al
jne 0x1d779
jmp 0x1d786
jmp 0x1d77b
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1d747
cmpl $0x0, -0x14(%rbp)
jle 0x1d7b5
movslq -0x14(%rbp), %rax
movb $0x0, -0x220(%rbp,%rax)
leaq -0x220(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x1d850
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jl 0x1d7b3
jmp 0x1d7b3
jmp 0x1d7b5
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x18(%rbp)
jl 0x1d7ce
xorl %eax, %eax
movl %eax, -0x228(%rbp)
jmp 0x1d7f8
movl $0x67b5, %edi           # imm = 0x67B5
callq 0x1d9a0
movl %eax, %edi
leaq -0x220(%rbp), %rdx
leaq 0x90933(%rip), %rsi     # 0xae11b
movl $0x67b5, %ecx           # imm = 0x67B5
callq 0x1d930
movl %eax, -0x228(%rbp)
movl -0x228(%rbp), %eax
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
je 0x1d876
movl -0x10(%rbp), %eax
movl %eax, -0xac(%rbp)
jmp 0x1d883
movl $0x1a4, %eax            # imm = 0x1A4
movl %eax, -0xac(%rbp)
jmp 0x1d883
movl -0xac(%rbp), %eax
movl %eax, -0x18(%rbp)
movq 0xb3055(%rip), %rax     # 0xd08e8
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
orl $0x80000, %esi          # imm = 0x80000
movl -0x18(%rbp), %edx
callq *%rax
movl %eax, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x14(%rbp)
movb %al, -0xad(%rbp)
jge 0x1d8c7
callq 0x8060
cmpl $0x4, (%rax)
sete %al
movb %al, -0xad(%rbp)
movb -0xad(%rbp), %al
testb $0x1, %al
jne 0x1d88c
cmpl $0x0, -0x14(%rbp)
jl 0x1d91f
cmpl $0x0, -0x10(%rbp)
je 0x1d91d
movq 0xb307c(%rip), %rax     # 0xd0960
movl -0x14(%rbp), %edi
leaq -0xa8(%rbp), %rsi
callq *%rax
cmpl $0x0, %eax
jne 0x1d91b
cmpq $0x0, -0x78(%rbp)
jne 0x1d91b
movl -0x90(%rbp), %eax
andl $0x1ff, %eax            # imm = 0x1FF
cmpl -0x10(%rbp), %eax
je 0x1d91b
movq 0xb3125(%rip), %rax     # 0xd0a38
movl -0x14(%rbp), %edi
movl -0x10(%rbp), %esi
callq *%rax
jmp 0x1d91d
jmp 0x1d91f
movl -0x14(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3CantopenError
SQLITE_PRIVATE int sqlite3CantopenError(int lineno){
  testcase( sqlite3GlobalConfig.xLog!=0 );
  sqlite3_log(SQLITE_CANTOPEN, 
              "cannot open file at line %d of [%.10s]",
              lineno, 20+sqlite3_sourceid());
  return SQLITE_CANTOPEN;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x8(%rbp)
callq 0x17070
movl -0x8(%rbp), %edx
movq %rax, %rcx
addq $0x14, %rcx
movl $0xe, %edi
leaq 0x90807(%rip), %rsi     # 0xae1d3
movb $0x0, %al
callq 0xc5f0
movl $0xe, %eax
addq $0x10, %rsp
popq %rbp
retq
nop