LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: setupLookaside
static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
  void *pStart;
  if( db->lookaside.nOut ){
    return SQLITE_BUSY;
  }
  /* Free any existing lookaside buffer for this handle before
  ** allocating a new one so we don't have to have space for 
  ** both at the same time.
  */
  if( db->lookaside.bMalloced ){
    sqlite3_free(db->lookaside.pStart);
  }
  /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger
  ** than a pointer to be useful.
  */
  sz = ROUNDDOWN8(sz);  /* IMP: R-33038-09382 */
  if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0;
  if( cnt<0 ) cnt = 0;
  if( sz==0 || cnt==0 ){
    sz = 0;
    pStart = 0;
  }else if( pBuf==0 ){
    sqlite3BeginBenignMalloc();
    pStart = sqlite3Malloc( sz*cnt );  /* IMP: R-61949-35727 */
    sqlite3EndBenignMalloc();
    if( pStart ) cnt = sqlite3MallocSize(pStart)/sz;
  }else{
    pStart = pBuf;
  }
  db->lookaside.pStart = pStart;
  db->lookaside.pFree = 0;
  db->lookaside.sz = (u16)sz;
  if( pStart ){
    int i;
    LookasideSlot *p;
    assert( sz > (int)sizeof(LookasideSlot*) );
    p = (LookasideSlot*)pStart;
    for(i=cnt-1; i>=0; i--){
      p->pNext = db->lookaside.pFree;
      db->lookaside.pFree = p;
      p = (LookasideSlot*)&((u8*)p)[sz];
    }
    db->lookaside.pEnd = p;
    db->lookaside.bEnabled = 1;
    db->lookaside.bMalloced = pBuf==0 ?1:0;
  }else{
    db->lookaside.pEnd = 0;
    db->lookaside.bEnabled = 0;
    db->lookaside.bMalloced = 0;
  }
  return SQLITE_OK;
}

// Assembly:
movl $0x5, %eax
cmpl $0x0, 0x154(%rdi)
je 0x14be6
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r12d
movl %edx, %r15d
movq %rdi, %rbx
movq %rsi, -0x30(%rbp)
cmpb $0x0, 0x153(%rdi)
je 0x14c16
movq 0x170(%rbx), %rdi
callq 0xa3c7
andl $-0x8, %r15d
xorl %eax, %eax
cmpl $0x9, %r15d
setl %cl
movl %r15d, %r14d
cmovll %eax, %r14d
testl %r12d, %r12d
cmovlel %eax, %r12d
setle %dl
orb %cl, %dl
je 0x14c62
xorps %xmm0, %xmm0
movups %xmm0, 0x168(%rbx)
movw %ax, 0x150(%rbx)
movq $0x0, 0x178(%rbx)
movb $0x0, 0x152(%rbx)
xorl %eax, %eax
jmp 0x14d12
movq -0x30(%rbp), %rdx
testq %rdx, %rdx
je 0x14c70
movq %rdx, %r13
jmp 0x14cb7
movq 0x812e9(%rip), %rax     # 0x95f60
testq %rax, %rax
je 0x14c7e
callq *%rax
imull %r15d, %r12d
movl %r12d, %edi
callq 0xa38c
movq %rax, %r13
movq 0x812d4(%rip), %rax     # 0x95f68
testq %rax, %rax
je 0x14c9b
callq *%rax
movl %r14d, %eax
testq %r13, %r13
je 0x14c38
movq %r13, %rdi
callq *0x7f78c(%rip)          # 0x94438
cltd
idivl %r15d
movl %eax, %r12d
movq -0x30(%rbp), %rdx
movq %r13, 0x170(%rbx)
movq $0x0, 0x168(%rbx)
movw %r15w, 0x150(%rbx)
testl %r12d, %r12d
jle 0x14cfe
movl %r15d, %eax
incl %r12d
xorl %ecx, %ecx
movq %rcx, (%r13)
movq %r13, %rcx
addq %rax, %r13
decl %r12d
cmpl $0x1, %r12d
ja 0x14cde
movq %r13, %rax
subq %r15, %rax
movq %rax, 0x168(%rbx)
testq %rdx, %rdx
sete %al
movq %r13, 0x178(%rbx)
movb $0x1, 0x152(%rbx)
movb %al, 0x153(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_busy_timeout
SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){
  if( ms>0 ){
    sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
    db->busyTimeout = ms;
  }else{
    sqlite3_busy_handler(db, 0, 0);
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
testl %esi, %esi
leaq 0x2e(%rip), %rcx        # 0x14f76
cmovleq %rax, %rcx
movl $0x0, %edx
cmovgq %rdi, %rdx
cmovlel %eax, %esi
movq %rcx, 0x2a8(%rdi)
movq %rdx, 0x2b0(%rdi)
movl %eax, 0x2b8(%rdi)
movl %esi, 0x308(%rdi)
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_create_function_v2
SQLITE_API int sqlite3_create_function_v2(
  sqlite3 *db,
  const char *zFunc,
  int nArg,
  int enc,
  void *p,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value **),
  void (*xStep)(sqlite3_context*,int,sqlite3_value **),
  void (*xFinal)(sqlite3_context*),
  void (*xDestroy)(void *)
){
  int rc = SQLITE_ERROR;
  FuncDestructor *pArg = 0;
  sqlite3_mutex_enter(db->mutex);
  if( xDestroy ){
    pArg = (FuncDestructor *)sqlite3DbMallocZero(db, sizeof(FuncDestructor));
    if( !pArg ){
      xDestroy(p);
      goto out;
    }
    pArg->xDestroy = xDestroy;
    pArg->pUserData = p;
  }
  rc = sqlite3CreateFunc(db, zFunc, nArg, enc, p, xFunc, xStep, xFinal, pArg);
  if( pArg && pArg->nRef==0 ){
    assert( rc!=SQLITE_OK );
    xDestroy(p);
    sqlite3DbFree(db, pArg);
  }

 out:
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %rbx
movq 0x20(%rbp), %r14
movq 0x18(%rbp), %r10
movq 0x10(%rbp), %rax
testq %r14, %r14
je 0x15096
movl %ecx, -0x2c(%rbp)
movq %r10, -0x40(%rbp)
movq %rax, -0x48(%rbp)
movq %r9, -0x50(%rbp)
movq %r8, -0x38(%rbp)
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11721
testq %rax, %rax
je 0x150b6
movq %rax, %r13
movq $0x0, (%rax)
movq %r14, 0x8(%rax)
movq -0x38(%rbp), %rax
movq %rax, 0x10(%r13)
subq $0x8, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %r12
movl %r15d, %edx
movl -0x2c(%rbp), %ecx
movq %rax, %r8
movq -0x50(%rbp), %r9
pushq %r13
pushq -0x40(%rbp)
pushq -0x48(%rbp)
callq 0x150dc
addq $0x20, %rsp
movl %eax, %r15d
cmpl $0x0, (%r13)
jne 0x150c3
movq %r12, %rdi
callq *%r14
movq %rbx, %rdi
movq %r13, %rsi
callq 0x9ca4
jmp 0x150c3
subq $0x8, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movl %r15d, %edx
pushq $0x0
pushq %r10
pushq %rax
callq 0x150dc
addq $0x20, %rsp
movl %eax, %r15d
jmp 0x150c3
movq -0x38(%rbp), %rdi
callq *%r14
movl $0x1, %r15d
movq %rbx, %rdi
movl %r15d, %esi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xeaff
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_create_function16
SQLITE_API int sqlite3_create_function16(
  sqlite3 *db,
  const void *zFunctionName,
  int nArg,
  int eTextRep,
  void *p,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  void (*xFinal)(sqlite3_context*)
){
  int rc;
  char *zFunc8;
  sqlite3_mutex_enter(db->mutex);
  assert( !db->mallocFailed );
  zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);
  rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal,0);
  sqlite3DbFree(db, zFunc8);
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, -0x30(%rbp)
movq %r8, %r14
movl %ecx, %r15d
movl %edx, %r12d
movq %rdi, %r13
movaps 0x10(%rbp), %xmm0
movaps %xmm0, -0x40(%rbp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1538e
movq %rax, %rbx
movaps -0x40(%rbp), %xmm0
movups %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r13, %rdi
movq %rax, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movq %r14, %r8
movq -0x30(%rbp), %r9
callq 0x150dc
movl %eax, %r14d
movq %r13, %rdi
movq %rbx, %rsi
callq 0x9ca4
movq %r13, %rdi
movl %r14d, %esi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xeaff
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3Utf16to8
SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){
  Mem m;
  memset(&m, 0, sizeof(m));
  m.db = db;
  sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC);
  sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
  if( db->mallocFailed ){
    sqlite3VdbeMemRelease(&m);
    m.z = 0;
  }
  assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );
  assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );
  assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed );
  assert( m.z || db->mallocFailed );
  return m.z;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq -0x48(%rbp), %r14
movups %xmm0, 0x28(%r14)
movups %xmm0, 0x18(%r14)
movups %xmm0, 0x8(%r14)
movq %rdi, (%r14)
movq %r14, %rdi
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0xf0d7
movq %r14, %rdi
movl $0x1, %esi
callq 0x24930
cmpb $0x0, 0x50(%rbx)
je 0x153e5
leaq -0x48(%rbp), %rdi
callq 0xecfd
xorl %eax, %eax
jmp 0x153e9
movq -0x40(%rbp), %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_overload_function
SQLITE_API int sqlite3_overload_function(
  sqlite3 *db,
  const char *zName,
  int nArg
){
  int nName = sqlite3Strlen30(zName);
  int rc = SQLITE_OK;
  sqlite3_mutex_enter(db->mutex);
  if( sqlite3FindFunction(db, zName, nName, nArg, SQLITE_UTF8, 0)==0 ){
    rc = sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8,
                           0, sqlite3InvalidFunction, 0, 0, 0);
  }
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
xorl %r12d, %r12d
movl $0x0, %edx
testq %rsi, %rsi
je 0x15430
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r15, %rax
incl %edx
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x1541f
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x15493
testq %rax, %rax
jne 0x1547c
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x21b(%rip), %r9        # 0x1567e
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x150dc
movl %eax, %r12d
movq %rbx, %rdi
movl %r12d, %esi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xeaff
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3InvalidFunction
SQLITE_PRIVATE void sqlite3InvalidFunction(
  sqlite3_context *context,  /* The function calling context */
  int NotUsed,               /* Number of arguments to the function */
  sqlite3_value **NotUsed2   /* Value of each argument */
){
  const char *zName = context->pFunc->zName;
  char *zErr;
  UNUSED_PARAMETER2(NotUsed, NotUsed2);
  zErr = sqlite3_mprintf(
      "unable to use function %s in the requested context", zName);
  sqlite3_result_error(context, zErr, -1);
  sqlite3_free(zErr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x30(%rax), %rsi
leaq 0x67c97(%rip), %rdi     # 0x7d32d
xorl %eax, %eax
callq 0xb868
movq %rax, %r14
movl $0x1, 0x5c(%rbx)
movb $0x1, 0x61(%rbx)
addq $0x8, %rbx
movq %rbx, %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq $-0x1, %r8
callq 0xf0d7
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xa3c7
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_wal_autocheckpoint
SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
#ifdef SQLITE_OMIT_WAL
  UNUSED_PARAMETER(db);
  UNUSED_PARAMETER(nFrame);
#else
  if( nFrame>0 ){
    sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame));
  }else{
    sqlite3_wal_hook(db, 0, 0);
  }
#endif
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
testl %esi, %esi
movl %esi, %ecx
leaq 0x35(%rip), %rdx        # 0x157a4
cmovleq %rax, %rdx
cmovleq %rax, %rcx
movq %rdx, 0x108(%rdi)
movq %rcx, 0x110(%rdi)
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3WalDefaultHook
SQLITE_PRIVATE int sqlite3WalDefaultHook(
  void *pClientData,     /* Argument */
  sqlite3 *db,           /* Connection */
  const char *zDb,       /* Database */
  int nFrame             /* Size of WAL */
){
  if( nFrame>=SQLITE_PTR_TO_INT(pClientData) ){
    sqlite3BeginBenignMalloc();
    sqlite3_wal_checkpoint(db, zDb);
    sqlite3EndBenignMalloc();
  }
  return SQLITE_OK;
}

// Assembly:
cmpl %ecx, %edi
jg 0x157e7
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq 0x807a4(%rip), %rax     # 0x95f60
testq %rax, %rax
je 0x157c3
callq *%rax
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x157ea
movq 0x8078c(%rip), %rax     # 0x95f68
testq %rax, %rax
je 0x157e3
callq *%rax
popq %rbx
popq %r14
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_wal_checkpoint_v2
SQLITE_API int sqlite3_wal_checkpoint_v2(
  sqlite3 *db,                    /* Database handle */
  const char *zDb,                /* Name of attached database (or NULL) */
  int eMode,                      /* SQLITE_CHECKPOINT_* value */
  int *pnLog,                     /* OUT: Size of WAL log in frames */
  int *pnCkpt                     /* OUT: Total number of frames checkpointed */
){
#ifdef SQLITE_OMIT_WAL
  return SQLITE_OK;
#else
  int rc;                         /* Return code */
  int iDb = SQLITE_MAX_ATTACHED;  /* sqlite3.aDb[] index of db to checkpoint */

  /* Initialize the output variables to -1 in case an error occurs. */
  if( pnLog ) *pnLog = -1;
  if( pnCkpt ) *pnCkpt = -1;

  assert( SQLITE_CHECKPOINT_FULL>SQLITE_CHECKPOINT_PASSIVE );
  assert( SQLITE_CHECKPOINT_FULL<SQLITE_CHECKPOINT_RESTART );
  assert( SQLITE_CHECKPOINT_PASSIVE+2==SQLITE_CHECKPOINT_RESTART );
  if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_RESTART ){
    return SQLITE_MISUSE;
  }

  sqlite3_mutex_enter(db->mutex);
  if( zDb && zDb[0] ){
    iDb = sqlite3FindDbName(db, zDb);
  }
  if( iDb<0 ){
    rc = SQLITE_ERROR;
    sqlite3Error(db, SQLITE_ERROR, "unknown database: %s", zDb);
  }else{
    rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt);
    sqlite3Error(db, rc, 0);
  }
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %r15
movl %edx, %r13d
movq %rsi, %r12
movq %rdi, %rbx
testq %rcx, %rcx
je 0x15813
movl $0xffffffff, (%r15)     # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x1581f
movl $0xffffffff, (%r14)     # imm = 0xFFFFFFFF
cmpl $0x2, %r13d
jbe 0x15839
movl $0x15, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xa, %esi
testq %r12, %r12
je 0x1585b
cmpb $0x0, (%r12)
je 0x1585b
movq %rbx, %rdi
movq %r12, %rsi
callq 0x158b7
movl %eax, %esi
testl %eax, %eax
js 0x15896
movq %rbx, %rdi
movl %r13d, %edx
movq %r15, %rcx
movq %r14, %r8
callq 0x15996
movl %eax, %r14d
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xca2d
movq %rbx, %rdi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xeaff
leaq 0x63cc5(%rip), %rdx     # 0x79562
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
movq %r12, %rcx
xorl %eax, %eax
callq 0xca2d
jmp 0x1587d
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3FindDbName
SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *db, const char *zName){
  int i = -1;         /* Database number */
  if( zName ){
    Db *pDb;
    int n = sqlite3Strlen30(zName);
    for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){
      if( (!OMIT_TEMPDB || i!=1 ) && n==sqlite3Strlen30(pDb->zName) && 
          0==sqlite3StrICmp(pDb->zName, zName) ){
        break;
      }
    }
  }
  return i;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x1598e
xorl %ecx, %ecx
cmpb $0x0, (%rsi,%rcx)
leaq 0x1(%rcx), %rcx
jne 0x158c7
movl 0x28(%rdi), %r8d
leal -0x1(%r8), %edx
testl %r8d, %r8d
jle 0x1598c
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
decl %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movl %edx, %r8d
shlq $0x5, %r8
addq 0x20(%rdi), %r8
leaq 0x607ad(%rip), %rdi     # 0x760b0
movq (%r8), %r9
movl $0x0, %r10d
testq %r9, %r9
je 0x1592e
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movq %r9, %r11
incl %r10d
cmpb $0x0, (%r11)
leaq 0x1(%r11), %r11
jne 0x1591a
andl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
cmpl %r10d, %ecx
jne 0x15977
movb (%r9), %r11b
testb %r11b, %r11b
je 0x15963
incq %r9
movq %rsi, %r10
movzbl %r11b, %r11d
movb (%r11,%rdi), %bl
movzbl (%r10), %r14d
cmpb (%r14,%rdi), %bl
jne 0x15969
incq %r10
movb (%r9), %r11b
incq %r9
testb %r11b, %r11b
jne 0x15941
jmp 0x15966
movq %rsi, %r10
xorl %r11d, %r11d
movb (%r11,%rdi), %r9b
movzbl (%r10), %r10d
cmpb (%r10,%rdi), %r9b
je 0x1598f
leal -0x1(%rdx), %r9d
addq $-0x20, %r8
testl %edx, %edx
movl %r9d, %edx
jg 0x15903
jmp 0x15991
movl %edx, %eax
retq
movl %edx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3Checkpoint
SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){
  int rc = SQLITE_OK;             /* Return code */
  int i;                          /* Used to iterate through attached dbs */
  int bBusy = 0;                  /* True if SQLITE_BUSY has been encountered */

  assert( sqlite3_mutex_held(db->mutex) );
  assert( !pnLog || *pnLog==-1 );
  assert( !pnCkpt || *pnCkpt==-1 );

  for(i=0; i<db->nDb && rc==SQLITE_OK; i++){
    if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){
      rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt, eMode, pnLog, pnCkpt);
      pnLog = 0;
      pnCkpt = 0;
      if( rc==SQLITE_BUSY ){
        bBusy = 1;
        rc = SQLITE_OK;
      }
    }
  }

  return (rc==SQLITE_OK && bBusy) ? SQLITE_BUSY : rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, -0x2c(%rbp)
movl 0x28(%rdi), %r9d
testl %r9d, %r9d
jle 0x15aaa
movq %r8, %r10
movl %esi, %r14d
movq %rdi, %r8
movl %esi, %r12d
shlq $0x5, %r12
movl $0x1, %ebx
xorl %r13d, %r13d
xorl %r15d, %r15d
movq %rdi, -0x38(%rbp)
cmpl $0xa, %r14d
setne %al
cmpq %r13, %r12
setne %dl
testb %dl, %al
jne 0x15a0f
movq 0x20(%r8), %rax
movq 0x8(%rax,%r13), %rdx
xorl %eax, %eax
testq %rdx, %rdx
je 0x15a64
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
movq %rsi, 0x8(%rdx)
cmpb $0x0, 0x24(%rdx)
je 0x15a13
movl $0x6, %eax
jmp 0x15a64
xorl %eax, %eax
jmp 0x15a7d
movq %rcx, -0x40(%rbp)
movq (%rdx), %r11
movq 0x118(%r11), %rdi
testq %rdi, %rdi
je 0x15a64
movq 0xe0(%r11), %rdx
movq 0xe8(%r11), %rcx
movzbl 0xd(%r11), %r8d
movl 0xbc(%r11), %r9d
subq $0x8, %rsp
movl -0x2c(%rbp), %esi
pushq %r10
pushq -0x40(%rbp)
pushq 0x108(%r11)
callq 0x1d158
movq -0x38(%rbp), %r8
addq $0x20, %rsp
movl 0x28(%r8), %r9d
cmpl $0x5, %eax
movl $0x0, %ecx
cmovel %ecx, %eax
movl $0x1, %edx
cmovel %edx, %r15d
xorl %ecx, %ecx
xorl %r10d, %r10d
testl %eax, %eax
jne 0x15a98
movslq %r9d, %rdx
addq $0x20, %r13
leaq 0x1(%rbx), %rsi
cmpq %rdx, %rbx
movq %rsi, %rbx
jl 0x159d6
testl %r15d, %r15d
movl $0x5, %ecx
cmovel %eax, %ecx
testl %eax, %eax
cmovnel %eax, %ecx
jmp 0x15aac
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_errmsg16
SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){
  static const u16 outOfMem[] = {
    'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
  };
  static const u16 misuse[] = {
    'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ', 
    'r', 'o', 'u', 't', 'i', 'n', 'e', ' ', 
    'c', 'a', 'l', 'l', 'e', 'd', ' ', 
    'o', 'u', 't', ' ', 
    'o', 'f', ' ', 
    's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0
  };

  const void *z;
  if( !db ){
    return (void *)outOfMem;
  }
  if( !sqlite3SafetyCheckSickOrOk(db) ){
    return (void *)misuse;
  }
  sqlite3_mutex_enter(db->mutex);
  if( db->mallocFailed ){
    z = (void *)outOfMem;
  }else{
    z = sqlite3_value_text16(db->pErr);
    if( z==0 ){
      sqlite3ValueSetStr(db->pErr, -1, sqlite3ErrStr(db->errCode),
           SQLITE_UTF8, SQLITE_STATIC);
      z = sqlite3_value_text16(db->pErr);
    }
    /* A malloc() may have failed within the call to sqlite3_value_text16()
    ** above. If this is the case, then the db->mallocFailed flag needs to
    ** be cleared before returning. Do this directly, instead of via
    ** sqlite3ApiExit(), to avoid setting the database handle error message.
    */
    db->mallocFailed = 0;
  }
  sqlite3_mutex_leave(db->mutex);
  return z;
}

// Assembly:
leaq 0x6075b(%rip), %rax     # 0x76230
testq %rdi, %rdi
je 0x15bc2
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x5c(%rdi), %ecx
cmpl $0xa029a697, %ecx       # imm = 0xA029A697
je 0x15b02
cmpl $0xf03b7906, %ecx       # imm = 0xF03B7906
je 0x15b02
cmpl $0x4b771290, %ecx       # imm = 0x4B771290
jne 0x15b41
cmpb $0x0, 0x50(%rbx)
jne 0x15bbc
movq 0x130(%rbx), %rdi
movl $0x2, %esi
callq 0xef29
testq %rax, %rax
jne 0x15bb8
movq 0x130(%rbx), %rdi
movl 0x44(%rbx), %eax
cmpq $0x204, %rax            # imm = 0x204
jne 0x15b64
leaq 0x67799(%rip), %rsi     # 0x7d2d8
jmp 0x15b8c
leaq 0x64f6f(%rip), %rsi     # 0x7aab7
leaq 0x67811(%rip), %rdx     # 0x7d360
movl $0x15, %edi
xorl %eax, %eax
callq 0xb9c7
leaq 0x606ee(%rip), %rax     # 0x76250
jmp 0x15bbc
movzbl %al, %eax
cmpl $0x1b, %eax
setae %cl
cmpq $0x2, %rax
sete %dl
orb %cl, %dl
je 0x15b81
leaq 0x6774b(%rip), %rsi     # 0x7d2ca
jmp 0x15b8c
leaq 0x7dc78(%rip), %rcx     # 0x93800
movq (%rcx,%rax,8), %rsi
testq %rdi, %rdi
je 0x15bac
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0xf0d7
movq 0x130(%rbx), %rdi
jmp 0x15bae
xorl %edi, %edi
movl $0x2, %esi
callq 0xef29
movb $0x0, 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_extended_errcode
SQLITE_API int sqlite3_extended_errcode(sqlite3 *db){
  if( db && !sqlite3SafetyCheckSickOrOk(db) ){
    return SQLITE_MISUSE_BKPT;
  }
  if( !db || db->mallocFailed ){
    return SQLITE_NOMEM;
  }
  return db->errCode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0x7, %ebx
testq %rdi, %rdi
je 0x15c34
movl 0x5c(%rdi), %eax
cmpl $0xa029a697, %eax       # imm = 0xA029A697
je 0x15beb
cmpl $0xf03b7906, %eax       # imm = 0xF03B7906
je 0x15beb
cmpl $0x4b771290, %eax       # imm = 0x4B771290
jne 0x15bf6
cmpb $0x0, 0x50(%rdi)
jne 0x15c34
movl 0x44(%rdi), %ebx
jmp 0x15c34
leaq 0x64eba(%rip), %rsi     # 0x7aab7
leaq 0x6775c(%rip), %rdx     # 0x7d360
movl $0x15, %ebx
movl $0x15, %edi
xorl %eax, %eax
callq 0xb9c7
leaq 0x677c8(%rip), %rsi     # 0x7d3e4
leaq 0x63916(%rip), %rcx     # 0x79539
movl $0x15, %edi
movl $0x1cb17, %edx          # imm = 0x1CB17
xorl %eax, %eax
callq 0xb9c7
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_open16
SQLITE_API int sqlite3_open16(
  const void *zFilename, 
  sqlite3 **ppDb
){
  char const *zFilename8;   /* zFilename encoded in UTF-8 instead of UTF-16 */
  sqlite3_value *pVal;
  int rc;

  assert( zFilename );
  assert( ppDb );
  *ppDb = 0;
#ifndef SQLITE_OMIT_AUTOINIT
  rc = sqlite3_initialize();
  if( rc ) return rc;
#endif
  pVal = sqlite3ValueNew(0);
  sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC);
  zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8);
  if( zFilename8 ){
    rc = openDatabase(zFilename8, ppDb,
                      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
    assert( *ppDb || rc==SQLITE_NOMEM );
    if( rc==SQLITE_OK && !DbHasProperty(*ppDb, 0, DB_SchemaLoaded) ){
      ENC(*ppDb) = SQLITE_UTF16NATIVE;
    }
  }else{
    rc = SQLITE_NOMEM;
  }
  sqlite3ValueFree(pVal);

  return sqlite3ApiExit(0, rc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
movq $0x0, (%rsi)
callq 0x9d86
testl %eax, %eax
jne 0x16228
cmpl $0x0, 0x7e297(%rip)     # 0x94400
je 0x16181
leaq -0x20(%rbp), %r14
movl $0x38, %edi
movq %r14, %rsi
callq 0x171f8
movq (%r14), %r14
jmp 0x1618f
movl $0x38, %edi
callq *0x7e294(%rip)          # 0x94420
movq %rax, %r14
testq %r14, %r14
je 0x161d1
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r14)
movups %xmm0, 0x28(%r14)
movups %xmm0, 0x8(%r14)
movw $0x1, 0x24(%r14)
movb $0x5, 0x26(%r14)
movq $0x0, (%r14)
movq %r14, %rdi
movq %r15, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0xf0d7
movq %r14, %rdi
movl $0x1, %esi
callq 0xef29
testq %rax, %rax
je 0x16216
movq %rax, %rdi
movq %rbx, %rsi
movl $0x6, %edx
xorl %ecx, %ecx
callq 0x15cb9
movl %eax, %r15d
testl %eax, %eax
jne 0x1621c
movq (%rbx), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
testb $0x1, 0x72(%rax)
jne 0x16211
movb $0x2, 0x71(%rax)
xorl %r15d, %r15d
jmp 0x1621c
movl $0x7, %r15d
movq %r14, %rdi
callq 0x142f2
movzbl %r15b, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_create_collation16
SQLITE_API int sqlite3_create_collation16(
  sqlite3* db, 
  const void *zName,
  int enc, 
  void* pCtx,
  int(*xCompare)(void*,int,const void*,int,const void*)
){
  int rc = SQLITE_OK;
  char *zName8;
  sqlite3_mutex_enter(db->mutex);
  assert( !db->mallocFailed );
  zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);
  if( zName8 ){
    rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0);
    sqlite3DbFree(db, zName8);
  }
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %r15
movl %edx, %r13d
movq %rdi, %rbx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1538e
testq %rax, %rax
je 0x16483
movq %rax, %r12
movzbl %r13b, %edx
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0x16257
movl %eax, %r14d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9ca4
jmp 0x16486
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xeaff
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_sleep
SQLITE_API int sqlite3_sleep(int ms){
  sqlite3_vfs *pVfs;
  int rc;
  pVfs = sqlite3_vfs_find(0);
  if( pVfs==0 ) return 0;

  /* This function works in milliseconds, but the underlying OsSleep() 
  ** API uses microseconds. Hence the 1000's.
  */
  rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x9d86
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x16539
movq 0x7f81b(%rip), %rdi     # 0x95d30
testq %rdi, %rdi
je 0x16539
imull $0x3e8, %ebx, %esi      # imm = 0x3E8
callq *0x70(%rdi)
cltq
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x26, %rax
addl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_file_control
SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
  int rc = SQLITE_ERROR;
  Btree *pBtree;

  sqlite3_mutex_enter(db->mutex);
  pBtree = sqlite3DbNameToBtree(db, zDbName);
  if( pBtree ){
    Pager *pPager;
    sqlite3_file *fd;
    sqlite3BtreeEnter(pBtree);
    pPager = sqlite3BtreePager(pBtree);
    assert( pPager!=0 );
    fd = sqlite3PagerFile(pPager);
    assert( fd!=0 );
    if( op==SQLITE_FCNTL_FILE_POINTER ){
      *(sqlite3_file**)pArg = fd;
      rc = SQLITE_OK;
    }else if( fd->pMethods ){
      rc = sqlite3OsFileControl(fd, op, pArg);
    }else{
      rc = SQLITE_NOTFOUND;
    }
    sqlite3BtreeLeave(pBtree);
  }
  sqlite3_mutex_leave(db->mutex);
  return rc;   
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rcx, %rbx
movl %edx, %r14d
callq 0x165b5
testq %rax, %rax
je 0x1658c
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x8(%rax)
movq (%rax), %rax
movq 0x48(%rax), %rdi
cmpl $0x7, %r14d
jne 0x16593
movq %rdi, (%rbx)
xorl %eax, %eax
jmp 0x165b0
movl $0x1, %eax
jmp 0x165b0
movq (%rdi), %rax
testq %rax, %rax
je 0x165ab
movq 0x50(%rax), %rax
movl %r14d, %esi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %rbp
jmpq *%rax
movl $0xc, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3DbNameToBtree
SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){
  int i;
  for(i=0; i<db->nDb; i++){
    if( db->aDb[i].pBt
     && (zDbName==0 || sqlite3StrICmp(zDbName, db->aDb[i].zName)==0)
    ){
      return db->aDb[i].pBt;
    }
  }
  return 0;
}

// Assembly:
movslq 0x28(%rdi), %rcx
testq %rcx, %rcx
jle 0x1663d
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
movq 0x20(%rdi), %rdx
leaq 0x1(%rsi), %rdi
leaq 0x5fada(%rip), %r8      # 0x760b0
xorl %r9d, %r9d
movq %r9, %r10
shlq $0x5, %r10
movq 0x8(%rdx,%r10), %rax
testq %rax, %rax
je 0x1662c
testq %rsi, %rsi
je 0x16636
addq %rdx, %r10
movq (%r10), %r10
movb (%rsi), %bl
testb %bl, %bl
je 0x1661c
movq %rdi, %r11
movzbl %bl, %ebx
movb (%rbx,%r8), %r14b
movzbl (%r10), %r15d
cmpb (%r15,%r8), %r14b
jne 0x1661e
incq %r10
movb (%r11), %bl
incq %r11
testb %bl, %bl
jne 0x165fe
xorl %ebx, %ebx
movb (%rbx,%r8), %r11b
movzbl (%r10), %r10d
cmpb (%r10,%r8), %r11b
je 0x16636
incq %r9
cmpq %rcx, %r9
jne 0x165d9
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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:
movq %rdi, 0x8(%rsi)
movl $0x8, %eax
testb $0x2, 0x26(%rsi)
jne 0x16d28
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %r14d
movl %ecx, %r15d
movq %rsi, %rbx
testl %ecx, %ecx
jns 0x16cc9
movl 0x30(%rbx), %r15d
subl 0x34(%rbx), %r15d
leal -0x200(%rdx), %eax
cmpl $0xfe00, %eax           # imm = 0xFE00
ja 0x16cfa
leal 0x1ffff(%rdx), %eax
testl %edx, %eax
jne 0x16cfa
movl %edx, 0x30(%rbx)
movq 0x80(%rbx), %rdi
callq 0x1cdc9
movq $0x0, 0x80(%rbx)
movq (%rbx), %rdi
leaq 0x30(%rbx), %rsi
movl %r15d, %edx
callq 0x1a26a
movl 0x30(%rbx), %ecx
movzwl %r15w, %edx
subl %edx, %ecx
movl %ecx, 0x34(%rbx)
testl %r14d, %r14d
je 0x16d1e
orb $0x2, 0x26(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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:
movl 0x7f039(%rip), %ecx     # 0x95d68
testl %ecx, %ecx
je 0x16d86
cmpl %edi, 0x7d807(%rip)     # 0x94540
jl 0x16d86
movq 0x7f01e(%rip), %rax     # 0x95d60
movq (%rax), %rdx
movq %rdx, 0x7f014(%rip)     # 0x95d60
decl %ecx
movl %ecx, 0x7f014(%rip)     # 0x95d68
movl 0x7ef92(%rip), %edx     # 0x95cec
leal 0x1(%rdx), %ecx
movl %ecx, 0x7ef89(%rip)     # 0x95cec
cmpl 0x7efab(%rip), %edx     # 0x95d14
jl 0x16d71
movl %ecx, 0x7efa3(%rip)     # 0x95d14
movl %edi, 0x7ef89(%rip)     # 0x95d00
cmpl %edi, 0x7efab(%rip)     # 0x95d28
jge 0x16de0
movl %edi, 0x7efa3(%rip)     # 0x95d28
retq
cmpl $0x0, 0x7d673(%rip)     # 0x94400
je 0x16de1
movl %edi, 0x7ef6b(%rip)     # 0x95d00
cmpl %edi, 0x7ef8d(%rip)     # 0x95d28
jge 0x16da3
movl %edi, 0x7ef85(%rip)     # 0x95d28
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq -0x10(%rbp), %rbx
movq %rbx, %rsi
callq 0x171f8
movl %eax, %ecx
movq (%rbx), %rax
testq %rax, %rax
leaq 0x8(%rsp), %rsp
popq %rbx
popq %rbp
je 0x16de7
addl 0x7ef24(%rip), %ecx     # 0x95cf0
movl %ecx, 0x7ef1e(%rip)     # 0x95cf0
cmpl 0x7ef40(%rip), %ecx     # 0x95d18
jle 0x16de0
movl %ecx, 0x7ef38(%rip)     # 0x95d18
retq
jmpq *0x7d639(%rip)          # 0x94420
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x16e3d
movq %rdi, %rbx
cmpq %rdi, 0x7d739(%rip)     # 0x94538
ja 0x16e44
cmpq %rbx, 0x7ef50(%rip)     # 0x95d58
jbe 0x16e44
movq 0x7ef4f(%rip), %rax     # 0x95d60
movq %rax, (%rbx)
movq %rbx, 0x7ef45(%rip)     # 0x95d60
incl 0x7ef47(%rip)           # 0x95d68
movl 0x7eec5(%rip), %eax     # 0x95cec
decl %eax
movl %eax, 0x7eebd(%rip)     # 0x95cec
cmpl 0x7eedf(%rip), %eax     # 0x95d14
jle 0x16e3d
movl %eax, 0x7eed7(%rip)     # 0x95d14
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x0, 0x7d5b5(%rip)     # 0x94400
je 0x16eaa
movq %rbx, %rdi
callq *0x7d5e2(%rip)          # 0x94438
movl 0x7ee94(%rip), %ecx     # 0x95cf0
subl %eax, %ecx
movl %ecx, 0x7ee8c(%rip)     # 0x95cf0
cmpl 0x7eeae(%rip), %ecx     # 0x95d18
jle 0x16e72
movl %ecx, 0x7eea6(%rip)     # 0x95d18
movl 0x7ee68(%rip), %ecx     # 0x95ce0
subl %eax, %ecx
movl %ecx, 0x7ee60(%rip)     # 0x95ce0
cmpl 0x7ee82(%rip), %ecx     # 0x95d08
jle 0x16e8e
movl %ecx, 0x7ee7a(%rip)     # 0x95d08
movl 0x7ee70(%rip), %eax     # 0x95d04
decl %eax
movl %eax, 0x7ee68(%rip)     # 0x95d04
cmpl 0x7ee8a(%rip), %eax     # 0x95d2c
jle 0x16eaa
movl %eax, 0x7ee82(%rip)     # 0x95d2c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *0x7d56f(%rip)          # 0x94428
// File: /workspace/github_c_makefile_star2_O3/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:
testq %rdi, %rdi
je 0x16f55
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq $-0x1, %rax
cmpb $0x0, 0x1(%rdi,%rax)
leaq 0x1(%rax), %rax
jne 0x16ed3
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cmpb $0x0, 0x1(%rdi,%rax)
je 0x16f4e
leaq (%rdi,%rax), %r14
incq %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8530
movl %eax, %ecx
xorl %edx, %edx
cmpb $0x0, 0x1(%r14,%rdx)
leaq 0x1(%rdx), %rdx
jne 0x16f00
movl %edx, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
addq %r14, %rax
incq %rax
testl %ecx, %ecx
je 0x16f50
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
addq %r14, %rdx
incq %rdx
movq $-0x1, %rcx
cmpb $0x0, 0x1(%rdx,%rcx)
leaq 0x1(%rcx), %rcx
jne 0x16f30
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
leaq (%rax,%rcx), %r14
incq %r14
cmpb $0x0, (%r14)
jne 0x16ef1
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x16eb9
testq %rax, %rax
je 0x16fd0
xorl %edx, %edx
cmpb $0x0, (%rax,%rdx)
leaq 0x1(%rdx), %rdx
jne 0x16fa5
decl %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
leaq -0x10(%rbp), %rsi
movq %rax, %rdi
movl $0x1, %ecx
callq 0x16fda
testl %eax, %eax
jne 0x16fd0
movq -0x10(%rbp), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 *0x7d231(%rip)          # 0x94440
movl %eax, %r14d
movl %r15d, 0x7eadb(%rip)    # 0x95cf4
cmpl %r15d, 0x7eafc(%rip)    # 0x95d1c
jge 0x17229
movl %r15d, 0x7eaf3(%rip)    # 0x95d1c
movq 0x7eb18(%rip), %r12     # 0x95d48
testq %r12, %r12
je 0x1728d
movslq 0x7eaa4(%rip), %rsi     # 0x95ce0
movq 0x7eafd(%rip), %rax     # 0x95d40
movslq %r14d, %rcx
subq %rcx, %rax
cmpq %rsi, %rax
jle 0x1725a
movl $0x0, 0x7eb14(%rip)     # 0x95d6c
jmp 0x1728d
movl $0x1, 0x7eb08(%rip)     # 0x95d6c
movq 0x7eae5(%rip), %r15     # 0x95d50
movq $0x0, 0x7ead2(%rip) # 0x95d48
movq %r15, %rdi
movl %r14d, %edx
callq *%r12
movq %r12, 0x7eac2(%rip)     # 0x95d48
movq %r15, 0x7eac3(%rip)     # 0x95d50
movl %r14d, %edi
callq *0x7d18a(%rip)          # 0x94420
movq %rax, %r15
testq %rax, %rax
je 0x172e4
movq %r15, %rdi
callq *0x7d191(%rip)          # 0x94438
movl %eax, %r14d
movl 0x7ea30(%rip), %eax     # 0x95ce0
addl %r14d, %eax
movl %eax, 0x7ea27(%rip)     # 0x95ce0
cmpl 0x7ea49(%rip), %eax     # 0x95d08
jle 0x172c7
movl %eax, 0x7ea41(%rip)     # 0x95d08
movl 0x7ea37(%rip), %ecx     # 0x95d04
leal 0x1(%rcx), %eax
movl %eax, 0x7ea2e(%rip)     # 0x95d04
cmpl 0x7ea50(%rip), %ecx     # 0x95d2c
jl 0x172e4
movl %eax, 0x7ea48(%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_O3/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:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x0, 0x25(%rdi)
jne 0x173ac
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
jle 0x17377
movl 0x18(%rbx), %eax
movl 0x1c(%rbx), %edx
leal (%rax,%r15), %ecx
cmpl %edx, %ecx
jge 0x1733e
movslq %eax, %rdi
addq 0x10(%rbx), %rdi
movl %r15d, %edx
movq %r14, %rsi
callq 0x82f0
addl %r15d, 0x18(%rbx)
jmp 0x173ac
movb 0x24(%rbx), %cl
testb %cl, %cl
je 0x17397
cltq
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 0x173bb
movq %rbx, %rdi
callq 0x1749c
movb $0x2, 0x25(%rbx)
jmp 0x173ac
je 0x173ac
cmpb $0x0, (%r14)
je 0x173ac
xorl %r15d, %r15d
cmpb $0x0, 0x1(%r14,%r15)
leaq 0x1(%r15), %r15
jne 0x17382
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
jmp 0x17318
movb $0x2, 0x25(%rbx)
movl %eax, %ecx
notl %ecx
addl %ecx, %edx
movl %edx, %r15d
testl %edx, %edx
jg 0x17326
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r13d, 0x1c(%rbx)
cmpb $0x1, %cl
jne 0x173d4
movq (%rbx), %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x174d6
jmp 0x173e8
callq 0x9d86
testl %eax, %eax
jne 0x1741f
movq %r12, %rdi
movl %r13d, %esi
callq 0xa45c
movq %rax, %r13
testq %rax, %rax
je 0x1741f
testq %r12, %r12
sete %cl
movl 0x18(%rbx), %eax
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x17416
movl %eax, %edx
movq 0x10(%rbx), %rsi
movq %r13, %rdi
callq 0x82f0
movl 0x18(%rbx), %eax
movq %r13, 0x10(%rbx)
jmp 0x17326
movb $0x1, 0x25(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1749c
// File: /workspace/github_c_makefile_star2_O3/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 0x17471
leaq 0x5ef1e(%rip), %r15     # 0x76370
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1d, %edx
callq 0x172f3
leal -0x1d(%r14), %edx
cmpl $0x39, %r14d
movl %edx, %r14d
ja 0x17452
jmp 0x17474
movl %r14d, %edx
testl %edx, %edx
jle 0x17491
leaq 0x5eef1(%rip), %rsi     # 0x76370
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x172f3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: 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 0x174c7
cmpb $0x1, 0x24(%rbx)
jne 0x174bf
movq (%rbx), %rdi
callq 0x9ca4
jmp 0x174c7
movq %rsi, %rdi
callq 0xa3c7
movq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq