LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeSetPageSize
SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){
  int rc = SQLITE_OK;
  BtShared *pBt = p->pBt;
  assert( nReserve>=-1 && nReserve<=255 );
  sqlite3BtreeEnter(p);
  if( pBt->btsFlags & BTS_PAGESIZE_FIXED ){
    sqlite3BtreeLeave(p);
    return SQLITE_READONLY;
  }
  if( nReserve<0 ){
    nReserve = pBt->pageSize - pBt->usableSize;
  }
  assert( nReserve>=0 && nReserve<=255 );
  if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&
        ((pageSize-1)&pageSize)==0 ){
    assert( (pageSize & 7)==0 );
    assert( !pBt->pPage1 && !pBt->pCursor );
    pBt->pageSize = (u32)pageSize;
    freeTempSpace(pBt);
  }
  rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);
  pBt->usableSize = pBt->pageSize - (u16)nReserve;
  if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED;
  sqlite3BtreeLeave(p);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rax
movq 0x8(%rdi), %r15
movq %rax, 0x8(%r15)
movl $0x8, %eax
testb $0x2, 0x26(%r15)
jne 0x16cc3
movl %ecx, %ebx
movl %edx, %r14d
testl %edx, %edx
jns 0x16c6b
movl 0x30(%r15), %r14d
subl 0x34(%r15), %r14d
leal -0x200(%rsi), %eax
cmpl $0xfe00, %eax           # imm = 0xFE00
ja 0x16c9d
leal 0x1ffff(%rsi), %eax
testl %esi, %eax
jne 0x16c9d
movl %esi, 0x30(%r15)
movq 0x80(%r15), %rdi
callq 0x1cf8c
movq $0x0, 0x80(%r15)
movq (%r15), %rdi
leaq 0x30(%r15), %rsi
movl %r14d, %edx
callq 0x1a405
movl 0x30(%r15), %ecx
movzwl %r14w, %edx
subl %edx, %ecx
movl %ecx, 0x34(%r15)
testl %ebx, %ebx
je 0x16cc3
orb $0x2, 0x26(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3ScratchMalloc
SQLITE_PRIVATE void *sqlite3ScratchMalloc(int n){
  void *p;
  assert( n>0 );

  sqlite3_mutex_enter(mem0.mutex);
  if( mem0.nScratchFree && sqlite3GlobalConfig.szScratch>=n ){
    p = mem0.pScratchFree;
    mem0.pScratchFree = mem0.pScratchFree->pNext;
    mem0.nScratchFree--;
    sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1);
    sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    if( sqlite3GlobalConfig.bMemstat ){
      sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
      n = mallocWithAlarm(n, &p);
      if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n);
      sqlite3_mutex_leave(mem0.mutex);
    }else{
      sqlite3_mutex_leave(mem0.mutex);
      p = sqlite3GlobalConfig.m.xMalloc(n);
    }
    sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH);
  }
  assert( sqlite3_mutex_notheld(mem0.mutex) );


#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
  /* Verify that no more than two scratch allocations per thread
  ** are 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 );
  if( p ) scratchAllocOut++;
#endif

  return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0x7f08e(%rip), %eax     # 0x95d68
testl %eax, %eax
je 0x16d36
cmpl %edi, 0x7d85c(%rip)     # 0x94540
jl 0x16d36
movq 0x7f073(%rip), %rcx     # 0x95d60
movq %rcx, -0x10(%rbp)
movq (%rcx), %rcx
movq %rcx, 0x7f065(%rip)     # 0x95d60
decl %eax
movl %eax, 0x7f065(%rip)     # 0x95d68
movl 0x7efe3(%rip), %ecx     # 0x95cec
leal 0x1(%rcx), %eax
movl %eax, 0x7efda(%rip)     # 0x95cec
cmpl 0x7effc(%rip), %ecx     # 0x95d14
jl 0x16d20
movl %eax, 0x7eff4(%rip)     # 0x95d14
movl %edi, 0x7efda(%rip)     # 0x95d00
cmpl %edi, 0x7effc(%rip)     # 0x95d28
jge 0x16d8b
movl %edi, 0x7eff4(%rip)     # 0x95d28
jmp 0x16d8b
cmpl $0x0, 0x7d6c3(%rip)     # 0x94400
je 0x16d81
movl %edi, 0x7efbb(%rip)     # 0x95d00
cmpl %edi, 0x7efdd(%rip)     # 0x95d28
jge 0x16d53
movl %edi, 0x7efd5(%rip)     # 0x95d28
leaq -0x10(%rbp), %rbx
movq %rbx, %rsi
callq 0x171f3
cmpq $0x0, (%rbx)
je 0x16d8b
addl 0x7ef85(%rip), %eax     # 0x95cf0
movl %eax, 0x7ef7f(%rip)     # 0x95cf0
cmpl 0x7efa1(%rip), %eax     # 0x95d18
jle 0x16d8b
movl %eax, 0x7ef99(%rip)     # 0x95d18
jmp 0x16d8b
callq *0x7d699(%rip)          # 0x94420
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x16de9
movq %rdi, %rbx
cmpq %rdi, 0x7d78d(%rip)     # 0x94538
ja 0x16df0
cmpq %rbx, 0x7efa4(%rip)     # 0x95d58
jbe 0x16df0
movq 0x7efa3(%rip), %rax     # 0x95d60
movq %rax, (%rbx)
movq %rbx, 0x7ef99(%rip)     # 0x95d60
incl 0x7ef9b(%rip)           # 0x95d68
movl 0x7ef19(%rip), %eax     # 0x95cec
decl %eax
movl %eax, 0x7ef11(%rip)     # 0x95cec
cmpl 0x7ef33(%rip), %eax     # 0x95d14
jle 0x16de9
movl %eax, 0x7ef2b(%rip)     # 0x95d14
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x0, 0x7d609(%rip)     # 0x94400
je 0x16e56
movq %rbx, %rdi
callq *0x7d636(%rip)          # 0x94438
movl 0x7eee8(%rip), %ecx     # 0x95cf0
subl %eax, %ecx
movl %ecx, 0x7eee0(%rip)     # 0x95cf0
cmpl 0x7ef02(%rip), %ecx     # 0x95d18
jle 0x16e1e
movl %ecx, 0x7eefa(%rip)     # 0x95d18
movl 0x7eebc(%rip), %ecx     # 0x95ce0
subl %eax, %ecx
movl %ecx, 0x7eeb4(%rip)     # 0x95ce0
cmpl 0x7eed6(%rip), %ecx     # 0x95d08
jle 0x16e3a
movl %ecx, 0x7eece(%rip)     # 0x95d08
movl 0x7eec4(%rip), %eax     # 0x95d04
decl %eax
movl %eax, 0x7eebc(%rip)     # 0x95d04
cmpl 0x7eede(%rip), %eax     # 0x95d2c
jle 0x16e56
movl %eax, 0x7eed6(%rip)     # 0x95d2c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *0x7d5c3(%rip)          # 0x94428
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x16f08
movq %rsi, %rbx
movq $-0x1, %rax
cmpb $0x0, 0x1(%rdi,%rax)
leaq 0x1(%rax), %rax
jne 0x16e82
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
leaq (%rdi,%rax), %r15
incq %r15
cmpb $0x0, (%r15)
je 0x16f08
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8530
movq $-0x1, %rdx
cmpb $0x0, 0x1(%r15,%rdx)
leaq 0x1(%rdx), %rdx
jne 0x16eb1
movl %edx, %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addq %r15, %rcx
incq %rcx
testl %eax, %eax
je 0x16efc
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
leaq (%r15,%rdx), %rsi
incq %rsi
movq $-0x1, %rdx
cmpb $0x0, 0x1(%rsi,%rdx)
leaq 0x1(%rdx), %rdx
jne 0x16ee3
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
addq %rdx, %rcx
incq %rcx
jmp 0x16eff
movq %rcx, %r14
movq %rcx, %r15
testl %eax, %eax
jne 0x16e99
jmp 0x16f0b
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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
pushq %rbx
pushq %rax
movq %rdx, %rbx
callq 0x16e65
testq %rax, %rax
je 0x16f91
xorl %edx, %edx
cmpb $0x0, (%rax,%rdx)
leaq 0x1(%rdx), %rdx
jne 0x16f66
decl %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
leaq -0x10(%rbp), %rsi
movq %rax, %rdi
movl $0x1, %ecx
callq 0x16f9b
testl %eax, %eax
jne 0x16f91
movq -0x10(%rbp), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %r15d
callq *0x7d236(%rip)          # 0x94440
movl %eax, %r14d
movl %r15d, 0x7eae0(%rip)    # 0x95cf4
cmpl %r15d, 0x7eb01(%rip)    # 0x95d1c
jge 0x17224
movl %r15d, 0x7eaf8(%rip)    # 0x95d1c
movq 0x7eb1d(%rip), %r12     # 0x95d48
testq %r12, %r12
je 0x17288
movslq 0x7eaa9(%rip), %rsi     # 0x95ce0
movq 0x7eb02(%rip), %rax     # 0x95d40
movslq %r14d, %rcx
subq %rcx, %rax
cmpq %rsi, %rax
jle 0x17255
movl $0x0, 0x7eb19(%rip)     # 0x95d6c
jmp 0x17288
movl $0x1, 0x7eb0d(%rip)     # 0x95d6c
movq 0x7eaea(%rip), %r15     # 0x95d50
movq $0x0, 0x7ead7(%rip) # 0x95d48
movq %r15, %rdi
movl %r14d, %edx
callq *%r12
movq %r12, 0x7eac7(%rip)     # 0x95d48
movq %r15, 0x7eac8(%rip)     # 0x95d50
movl %r14d, %edi
callq *0x7d18f(%rip)          # 0x94420
movq %rax, %r15
testq %rax, %rax
je 0x172df
movq %r15, %rdi
callq *0x7d196(%rip)          # 0x94438
movl %eax, %r14d
movl 0x7ea35(%rip), %eax     # 0x95ce0
addl %r14d, %eax
movl %eax, 0x7ea2c(%rip)     # 0x95ce0
cmpl 0x7ea4e(%rip), %eax     # 0x95d08
jle 0x172c2
movl %eax, 0x7ea46(%rip)     # 0x95d08
movl 0x7ea3c(%rip), %ecx     # 0x95d04
leal 0x1(%rcx), %eax
movl %eax, 0x7ea33(%rip)     # 0x95d04
cmpl 0x7ea55(%rip), %ecx     # 0x95d2c
jl 0x172df
movl %eax, 0x7ea4d(%rip)     # 0x95d2c
movq %r15, (%rbx)
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3StrAccumAppend
SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum *p, const char *z, int N){
  assert( z!=0 || N==0 );
  if( p->accError ){
    testcase(p->accError==STRACCUM_TOOBIG);
    testcase(p->accError==STRACCUM_NOMEM);
    return;
  }
  assert( p->zText!=0 || p->nChar==0 );
  if( N<=0 ){
    if( N==0 || z[0]==0 ) return;
    N = sqlite3Strlen30(z);
  }
  if( p->nChar+N >= p->nAlloc ){
    char *zNew;
    if( !p->useMalloc ){
      p->accError = STRACCUM_TOOBIG;
      N = p->nAlloc - p->nChar - 1;
      if( N<=0 ){
        return;
      }
    }else{
      char *zOld = (p->zText==p->zBase ? 0 : p->zText);
      i64 szNew = p->nChar;
      szNew += N + 1;
      if( szNew > p->mxAlloc ){
        sqlite3StrAccumReset(p);
        p->accError = STRACCUM_TOOBIG;
        return;
      }else{
        p->nAlloc = (int)szNew;
      }
      if( p->useMalloc==1 ){
        zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc);
      }else{
        zNew = sqlite3_realloc(zOld, p->nAlloc);
      }
      if( zNew ){
        if( zOld==0 && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
        p->zText = zNew;
      }else{
        p->accError = STRACCUM_NOMEM;
        sqlite3StrAccumReset(p);
        return;
      }
    }
  }
  assert( p->zText );
  memcpy(&p->zText[p->nChar], z, N);
  p->nChar += N;
}

// Assembly:
cmpb $0x0, 0x25(%rdi)
je 0x172f5
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
jle 0x1735d
movslq 0x18(%rbx), %rax
leal (%rax,%r15), %ecx
movl 0x1c(%rbx), %edx
cmpl %edx, %ecx
jl 0x1740b
movb 0x24(%rbx), %cl
testb %cl, %cl
je 0x1738b
movq 0x10(%rbx), %rdx
xorl %r12d, %r12d
cmpq 0x8(%rbx), %rdx
cmovneq %rdx, %r12
movl %r15d, %edx
leaq (%rdx,%rax), %r13
incq %r13
movslq 0x20(%rbx), %rax
cmpq %rax, %r13
jle 0x1739d
movq %rbx, %rdi
callq 0x1749a
movb $0x2, 0x25(%rbx)
jmp 0x17405
je 0x17425
cmpb $0x0, (%r14)
je 0x17425
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %r14, %rax
incl %r15d
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x17376
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
jmp 0x17310
movb $0x2, 0x25(%rbx)
notl %eax
addl %eax, %edx
testl %edx, %edx
setg %al
movl %edx, %r15d
jmp 0x17407
movl %r13d, 0x1c(%rbx)
cmpb $0x1, %cl
jne 0x173b6
movq (%rbx), %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x174d4
jmp 0x173cf
callq 0x9d1f
testl %eax, %eax
je 0x173c4
xorl %r13d, %r13d
jmp 0x173d2
movq %r12, %rdi
movl %r13d, %esi
callq 0xa37d
movq %rax, %r13
testq %r13, %r13
je 0x173f9
testq %r12, %r12
jne 0x173f1
movslq 0x18(%rbx), %rdx
testq %rdx, %rdx
jle 0x173f1
movq 0x10(%rbx), %rsi
movq %r13, %rdi
callq 0x82f0
movq %r13, 0x10(%rbx)
movb $0x1, %al
jmp 0x17407
movb $0x1, 0x25(%rbx)
movq %rbx, %rdi
callq 0x1749a
xorl %eax, %eax
testb %al, %al
je 0x17425
movslq 0x18(%rbx), %rdi
addq 0x10(%rbx), %rdi
movslq %r15d, %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x82f0
addl %r15d, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x1d, %esi
jl 0x1746f
leaq 0x5eed0(%rip), %r15     # 0x76320
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1d, %edx
callq 0x172ee
leal -0x1d(%r14), %edx
cmpl $0x39, %r14d
movl %edx, %r14d
jg 0x17450
jmp 0x17472
movl %r14d, %edx
testl %edx, %edx
jle 0x1748f
leaq 0x5eea3(%rip), %rsi     # 0x76320
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x172ee
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rsi
cmpq 0x8(%rdi), %rsi
je 0x174c5
cmpb $0x1, 0x24(%rbx)
jne 0x174bd
movq (%rbx), %rdi
callq 0x9c3a
jmp 0x174c5
movq %rsi, %rdi
callq 0xa2e8
movq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x174f4
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 0x17564
cmpq %rbx, 0x170(%r14)
ja 0x17557
cmpq %rbx, 0x178(%r14)
jbe 0x17557
movzwl 0x150(%r14), %eax
cmpl %r15d, %eax
jge 0x174e6
movq %r14, %rdi
movl %r15d, %esi
callq 0x115e9
testq %rax, %rax
je 0x174e4
movq %rax, %r15
movzwl 0x150(%r14), %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x82f0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9c3a
movq %r15, %rbx
jmp 0x174e6
callq 0x9d1f
testl %eax, %eax
je 0x17579
xorl %ebx, %ebx
jmp 0x17587
movq %r14, %rdi
movl %r15d, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x115e9
movq %rbx, %rdi
movl %r15d, %esi
callq 0xa37d
movq %rax, %rbx
testq %rbx, %rbx
jne 0x174e6
movb $0x1, 0x50(%r14)
jmp 0x174e4
// File: /workspace/github_c_makefile_star2_O1/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 0x18b74
movq %rbx, %rdi
xorl %esi, %esi
callq 0x17cae
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0x17638
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)
testq %r14, %r14
je 0x17638
decl 0x18(%r14)
jne 0x17638
movq %rbx, %rdi
callq 0x18f08
movq 0x40(%r14), %rax
leaq 0x38(%rax), %rcx
testq %rax, %rax
leaq 0x7e93c(%rip), %rax     # 0x95f50
cmovneq %rcx, %rax
movq 0x38(%r14), %rcx
movq %rcx, (%rax)
movq 0x38(%r14), %rax
testq %rax, %rax
je 0x17630
movq 0x40(%r14), %rcx
movq %rcx, 0x40(%rax)
movq %r14, %rdi
callq 0xa2e8
movq %rbx, %rdi
callq 0x18c22
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x48(%rdi), %eax
testl %eax, %eax
jle 0x178cc
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 *0x7d00c(%rip)          # 0x948e8
movl %eax, %r12d
testl %eax, %eax
jns 0x178ed
callq 0x8060
cmpl $0x4, (%rax)
je 0x178d0
testl %r12d, %r12d
je 0x1791e
callq 0x8060
movl (%rax), %eax
movl %eax, 0x20(%rbx)
movq 0x38(%rbx), %rdx
leaq 0x61d3c(%rip), %rsi     # 0x79643
movl $0x60a, %r15d           # imm = 0x60A
movl $0x60a, %edi            # imm = 0x60A
movl $0x680a, %ecx           # imm = 0x680A
callq 0x18ea3
jmp 0x1792b
xorl %r15d, %r15d
cmpq 0x50(%rbx), %r14
jge 0x1792b
movq %r14, 0x50(%rbx)
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x1797d
callq 0x8060
movl (%rax), %eax
movl %eax, 0x20(%rbx)
movq 0x38(%rbx), %rdx
leaq 0x61d9d(%rip), %rsi     # 0x79703
movl $0x40a, %r14d           # imm = 0x40A
movl $0x40a, %edi            # imm = 0x40A
movl $0x67de, %ecx           # imm = 0x67DE
callq 0x18ea3
jmp 0x179f3
xorl %r14d, %r14d
testb $0x8, 0x1e(%rbx)
je 0x179f3
movq 0x38(%rbx), %rdi
leaq -0x14(%rbp), %r14
movq %r14, %rsi
callq *0x7d059(%rip)          # 0x949f0
testl %eax, %eax
sete %cl
movl (%r14), %edi
testl %edi, %edi
setns %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x179cb
callq 0x8330
movl -0x14(%rbp), %edi
callq *0x7ceb7(%rip)          # 0x94870
xorl %r14d, %r14d
testl %eax, %eax
je 0x179ef
testq %rbx, %rbx
je 0x179d7
movq 0x38(%rbx), %rdx
jmp 0x179d9
xorl %r14d, %r14d
cmpl $0xe, %eax
cmovnel %eax, %r14d
jmp 0x179ef
xorl %edx, %edx
leaq 0x61c49(%rip), %rsi     # 0x79629
movl $0x100a, %edi           # imm = 0x100A
movl $0x67ec, %ecx           # imm = 0x67EC
callq 0x18ea3
andb $-0x9, 0x1e(%rbx)
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 *0x7cead(%rip)          # 0x948d0
testl %eax, %eax
je 0x17a39
callq 0x8060
movl (%rax), %eax
movl %eax, 0x20(%r14)
movl $0x70a, %eax            # imm = 0x70A
jmp 0x17a4f
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_O1/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 0x17e5b
xorl %r15d, %r15d
cmpb $0x0, 0x15(%rax)
movl $0x0, %eax
jne 0x17e63
movq %rdi, %r14
movslq 0x7ca27(%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 *0x7cabb(%rip)          # 0x94900
testl %eax, %eax
je 0x17e71
callq 0x8060
movl (%rax), %eax
movl %eax, 0x20(%r14)
movl $0xe0a, %eax            # imm = 0xE0A
jmp 0x17e63
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 0x17e63
// File: /workspace/github_c_makefile_star2_O1/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 0x18b17
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 0x18b1a
movslq %r12d, %rax
addq %r15, %rax
cmpq %rax, 0x50(%r14)
jl 0x18b13
addq 0x68(%r14), %r15
movq %r15, (%rbx)
incl 0x4c(%r14)
xorl %eax, %eax
jmp 0x18b2d
xorl %eax, %eax
retq
movq %r14, %rdi
movq $-0x1, %rsi
callq 0x19275
testl %eax, %eax
je 0x18afc
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x18b49
decl 0x4c(%rbx)
jmp 0x18b6b
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x18b6b
movq 0x58(%rbx), %rsi
callq *0x7bf0c(%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_O1/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 0x18bc1
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movl 0x18(%rdi), %edi
leaq -0x98(%rbp), %rsi
callq *0x7bd37(%rip)          # 0x948d0
testl %eax, %eax
je 0x18bc2
leaq 0x60a14(%rip), %rsi     # 0x795b8
movq 0x38(%rbx), %rdx
movl $0x1c, %edi
xorl %eax, %eax
callq 0xb8cc
orb $0x1, 0x1f(%rbx)
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
movq -0x88(%rbp), %rax
testq %rax, %rax
jne 0x18bdd
testb $0x20, 0x1e(%rbx)
jne 0x18bdd
leaq 0x609f5(%rip), %rsi     # 0x795d0
jmp 0x18ba4
cmpq $0x2, %rax
jb 0x18bec
leaq 0x60a03(%rip), %rsi     # 0x795ed
jmp 0x18ba4
cmpq $0x0, 0x10(%rbx)
je 0x18bb8
movq 0x38(%rbx), %rdi
leaq -0x98(%rbp), %rsi
callq *0x7bcb4(%rip)          # 0x948b8
leaq 0x609fd(%rip), %rsi     # 0x79608
testl %eax, %eax
jne 0x18ba4
movq -0x90(%rbp), %rax
movq 0x10(%rbx), %rcx
cmpq 0x8(%rcx), %rax
jne 0x18ba4
jmp 0x18bb8
// File: /workspace/github_c_makefile_star2_O1/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 0x18c4d
movq 0x58(%rbx), %rsi
callq *0x7be2a(%rip)          # 0x94a68
movq $0x0, 0x68(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbx)
movl 0x18(%rbx), %edi
testl %edi, %edi
js 0x18c88
callq *0x7bc16(%rip)          # 0x94870
testl %eax, %eax
je 0x18c81
testq %rbx, %rbx
je 0x18c69
movq 0x38(%rbx), %rdx
jmp 0x18c6b
xorl %edx, %edx
leaq 0x609b7(%rip), %rsi     # 0x79629
movl $0x100a, %edi           # imm = 0x100A
movl $0x6173, %ecx           # imm = 0x6173
callq 0x18ea3
movl $0xffffffff, 0x18(%rbx) # imm = 0xFFFFFFFF
movq 0x30(%rbx), %rdi
callq 0xa2e8
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_O1/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 0x609fa(%rip), %rdx     # 0x796d9
leaq -0x220(%rbp), %r14
movl $0x200, %edi            # imm = 0x200
movq %r14, %rsi
xorl %eax, %eax
callq 0xb859
movq %r14, %rdi
callq 0x8190
cmpl $0x2, %eax
jl 0x18d1d
movl %eax, %ecx
cmpb $0x2f, -0x220(%rbp,%rcx)
je 0x18d1d
leal -0x1(%rax), %ecx
cmpl $0x2, %eax
movl %ecx, %eax
jg 0x18d02
movl $0x1, %eax
testl %eax, %eax
jle 0x18d58
movl %eax, %eax
movb $0x0, -0x220(%rbp,%rax)
leaq -0x220(%rbp), %r14
movq %r14, %rdi
movl $0x80000, %esi          # imm = 0x80000
movl $0x1a4, %edx            # imm = 0x1A4
callq *0x7bb13(%rip)          # 0x94858
movl %eax, %r15d
testl %eax, %eax
jns 0x18d5e
callq 0x8060
cmpl $0x4, (%rax)
je 0x18d32
jmp 0x18d5e
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, (%rbx)
xorl %ebx, %ebx
testl %r15d, %r15d
jns 0x18da9
leaq 0x6096d(%rip), %rsi     # 0x796dc
leaq 0x607c3(%rip), %rcx     # 0x79539
movl $0xe, %ebx
movl $0xe, %edi
movl $0x67b5, %edx           # imm = 0x67B5
xorl %eax, %eax
callq 0xb8cc
leaq 0x60891(%rip), %rsi     # 0x79624
leaq -0x220(%rbp), %rdx
movl $0xe, %edi
movl $0x67b5, %ecx           # imm = 0x67B5
callq 0x18ea3
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 *0x7ba22(%rip)          # 0x94858
movl %eax, %r14d
testl %eax, %eax
jns 0x18e47
callq 0x8060
cmpl $0x4, (%rax)
je 0x18e27
testl %ebx, %ebx
sete %al
testl %r14d, %r14d
sets %cl
orb %al, %cl
jne 0x18e8e
leaq -0xb8(%rbp), %rsi
movl %r14d, %edi
callq *0x7ba6a(%rip)          # 0x948d0
testl %eax, %eax
jne 0x18e8e
cmpq $0x0, -0x88(%rbp)
jne 0x18e8e
movl $0x1ff, %eax            # imm = 0x1FF
andl -0xa0(%rbp), %eax
cmpl %ebx, %eax
je 0x18e8e
movl %r14d, %edi
movl %ebx, %esi
callq *0x7bb1a(%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_O1/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 0x18f6e
movq %rdi, %rbx
leaq 0x606fb(%rip), %r15     # 0x79629
movq 0x8(%r14), %r13
movl (%r14), %edi
callq *0x7b935(%rip)          # 0x94870
testl %eax, %eax
je 0x18f5e
testq %rbx, %rbx
je 0x18f4a
movq 0x38(%rbx), %rdx
jmp 0x18f4c
xorl %edx, %edx
movl $0x100a, %edi           # imm = 0x100A
movq %r15, %rsi
movl $0x5ea1, %ecx           # imm = 0x5EA1
callq 0x18ea3
movq %r14, %rdi
callq 0xa2e8
movq %r13, %r14
testq %r13, %r13
jne 0x18f2e
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_O1/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
subq $0x18, %rsp
movq %r8, %rbx
movq %rdx, -0x30(%rbp)
movq %rsi, %r13
movl %edi, %r12d
andl $0x1ffff, %ecx          # imm = 0x1FFFF
movq %rcx, -0x38(%rbp)
xorl %r14d, %r14d
movl %r12d, %edi
movq %r13, %rsi
xorl %edx, %edx
callq 0x8320
movq %rax, %r15
cmpq %r13, %rax
jne 0x18fdc
movl %r12d, %edi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0x7b989(%rip)          # 0x94960
movq %rax, %r14
jmp 0x18ff2
testq %rbx, %rbx
je 0x18ff2
xorl %eax, %eax
cmpq $-0x1, %r15
jne 0x18ff0
callq 0x8060
movl (%rax), %eax
movl %eax, (%rbx)
cmpq %r13, %r15
jne 0x1901b
testl %r14d, %r14d
jns 0x19006
callq 0x8060
cmpl $0x4, (%rax)
je 0x18fb1
testq %rbx, %rbx
je 0x19021
testl %r14d, %r14d
jns 0x19021
callq 0x8060
movl (%rax), %eax
movl %eax, (%rbx)
jmp 0x19021
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x190a0
testb $0x2, %al
jne 0x190a4
cmpb $0x0, 0x15(%rbx)
je 0x190a4
xorl %eax, %eax
cmpb $0x0, 0x15(%rbx)
jne 0x19099
movslq 0x7b7dc(%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 *0x7b872(%rip)          # 0x94900
testl %eax, %eax
js 0x19099
movb $0x1, 0x15(%rbx)
incl 0x28(%rbx)
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
testb $0x2, %al
je 0x19055
movq 0x7b855(%rip), %rcx     # 0x94900
movl 0x18(%rdi), %edi
movl $0x6, %esi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
jmpq *%rcx
// File: /workspace/github_c_makefile_star2_O1/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 0x7cd6f(%rip), %rax     # 0x95e88
movq %rax, 0x7b970(%rip)     # 0x94a90
cmpq $0x0, 0x7b970(%rip)     # 0x94a98
jne 0x1913d
leaq 0x605fa(%rip), %rdi     # 0x7972b
callq 0x84d0
movq %rax, 0x7b95b(%rip)     # 0x94a98
xorl %r14d, %r14d
leaq 0x7b949(%rip), %r13     # 0x94a90
leaq -0xc0(%rbp), %r15
xorl %r12d, %r12d
testq %r12, %r12
je 0x1918c
movq %r12, %rdi
movq %r15, %rsi
callq *0x7b756(%rip)          # 0x948b8
testl %eax, %eax
jne 0x1918c
movl -0xa8(%rbp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x1918c
movq %r12, %rdi
movl $0x7, %esi
callq *0x7b700(%rip)          # 0x94888
testl %eax, %eax
je 0x1919a
movq (%r14,%r13), %r12
addq $0x8, %r14
cmpq $0x30, %r14
jne 0x19151
testq %r12, %r12
leaq 0x64388(%rip), %r15     # 0x7d52c
cmovneq %r12, %r15
movq %r15, %rdi
callq 0x8190
addq $0x19, %rax
movslq -0x2c(%rbp), %rcx
movl $0x1, %r12d
cmpq %rcx, %rax
jae 0x19260
addl $-0x12, -0x2c(%rbp)
leaq 0x6427e(%rip), %r14     # 0x7d450
movl -0x2c(%rbp), %edi
movq %rbx, %rsi
leaq 0x6052f(%rip), %rdx     # 0x7970e
movq %r15, %rcx
xorl %eax, %eax
callq 0xb859
movq %rbx, %rdi
callq 0x8190
movq %rax, %r13
movl %r13d, %esi
addq %rbx, %rsi
movl $0xf, %r12d
movl $0xf, %edi
callq 0xb9d9
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 0x1920a
movl %r13d, %eax
xorl %r12d, %r12d
movb %r12b, (%rbx,%rax)
incl %r13d
movb %r12b, (%rbx,%r13)
movq %rbx, %rdi
xorl %esi, %esi
callq *0x7b630(%rip)          # 0x94888
testl %eax, %eax
je 0x191d2
movl %r12d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq