LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_db_release_memory
SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){
  int i;
  sqlite3_mutex_enter(db->mutex);
  sqlite3BtreeEnterAll(db);
  for(i=0; i<db->nDb; i++){
    Btree *pBt = db->aDb[i].pBt;
    if( pBt ){
      Pager *pPager = sqlite3BtreePager(pBt);
      sqlite3PagerShrink(pPager);
    }
  }
  sqlite3BtreeLeaveAll(db);
  sqlite3_mutex_leave(db->mutex);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x933b
pushq $0x8
popq %r14
xorl %r15d, %r15d
movslq 0x28(%rbx), %rax
cmpq %rax, %r15
jge 0x1311e
movq 0x20(%rbx), %rax
movq (%rax,%r14), %rax
testq %rax, %rax
je 0x13115
movq 0x8(%rax), %rax
movq (%rax), %rax
movq 0x110(%rax), %rax
movq 0x40(%rax), %rdi
testq %rdi, %rdi
je 0x13115
callq *0x743f3(%rip)          # 0x87508
incq %r15
addq $0x20, %r14
jmp 0x130e2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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:
cmpl $0x0, 0x154(%rdi)
je 0x132f3
pushq $0x5
popq %rax
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movl %edx, %r13d
movq %rdi, %rbx
cmpb $0x0, 0x153(%rdi)
je 0x13325
movq 0x170(%rbx), %rdi
movq %rsi, %r14
callq 0x9c7b
movq %r14, %rsi
andl $-0x8, %r13d
xorl %eax, %eax
cmpl $0x9, %r13d
setl %cl
movl %r13d, %r14d
cmovll %eax, %r14d
testl %r15d, %r15d
cmovlel %eax, %r15d
setle %dl
orb %cl, %dl
je 0x1334c
xorl %r12d, %r12d
jmp 0x133a9
testq %rsi, %rsi
je 0x13359
movl %r14d, %eax
movq %rsi, %r12
jmp 0x133a9
movq %rsi, -0x30(%rbp)
movq 0x75bfc(%rip), %rax     # 0x88f60
testq %rax, %rax
je 0x1336b
callq *%rax
movl %r15d, %edi
imull %r13d, %edi
callq 0x9c40
movq %rax, %r12
movq 0x75be7(%rip), %rax     # 0x88f68
testq %rax, %rax
je 0x13388
callq *%rax
testq %r12, %r12
je 0x1339f
movq %r12, %rdi
callq *0x740a2(%rip)          # 0x87438
cltd
idivl %r13d
movl %eax, %r15d
jmp 0x133a2
xorl %r12d, %r12d
movl %r14d, %eax
movq -0x30(%rbp), %rsi
movq %r12, 0x170(%rbx)
andq $0x0, 0x168(%rbx)
movw %ax, 0x150(%rbx)
testq %r12, %r12
je 0x133f9
movl %eax, %eax
xorl %ecx, %ecx
testl %r15d, %r15d
jle 0x133e3
decl %r15d
movq %rcx, (%r12)
movq %r12, 0x168(%rbx)
movq %r12, %rcx
addq %rax, %r12
jmp 0x133c8
movq %r12, 0x178(%rbx)
movb $0x1, 0x152(%rbx)
testq %rsi, %rsi
sete %al
jmp 0x1340a
andq $0x0, 0x178(%rbx)
movb $0x0, 0x152(%rbx)
xorl %eax, %eax
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_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3Close
static int sqlite3Close(sqlite3 *db, int forceZombie){
  if( !db ){
    return SQLITE_OK;
  }
  if( !sqlite3SafetyCheckSickOrOk(db) ){
    return SQLITE_MISUSE_BKPT;
  }
  sqlite3_mutex_enter(db->mutex);

  /* Force xDisconnect calls on all virtual tables */
  disconnectAllVtab(db);

  /* If a transaction is open, the disconnectAllVtab() call above
  ** will not have called the xDisconnect() method on any virtual
  ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback()
  ** call will do so. We need to do this before the check for active
  ** SQL statements below, as the v-table implementation may be storing
  ** some prepared statements internally.
  */
  sqlite3VtabRollback(db);

  /* Legacy behavior (sqlite3_close() behavior) is to return
  ** SQLITE_BUSY if the connection can not be closed immediately.
  */
  if( !forceZombie && connectionIsBusy(db) ){
    sqlite3Error(db, SQLITE_BUSY, "unable to close due to unfinalized "
       "statements or unfinished backups");
    sqlite3_mutex_leave(db->mutex);
    return SQLITE_BUSY;
  }

#ifdef SQLITE_ENABLE_SQLLOG
  if( sqlite3GlobalConfig.xSqllog ){
    /* Closing the handle. Fourth parameter is passed the value 2. */
    sqlite3GlobalConfig.xSqllog(sqlite3GlobalConfig.pSqllogArg, db, 0, 2);
  }
#endif

  /* Convert the connection into a zombie and then close it.
  */
  db->magic = SQLITE_MAGIC_ZOMBIE;
  sqlite3LeaveMutexAndCloseZombie(db);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x134f5
movl %esi, %r14d
movq %rdi, %rbx
callq 0x13f8a
testl %eax, %eax
je 0x134fa
movq %rbx, %rdi
callq 0x933b
xorl %r15d, %r15d
movslq 0x28(%rbx), %rax
cmpq %rax, %r15
jge 0x134d9
movq 0x20(%rbx), %rax
movq %r15, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %r12
testq %r12, %r12
je 0x134d4
addq $0x10, %r12
movq (%r12), %r12
testq %r12, %r12
je 0x134d4
movq 0x10(%r12), %rax
testb $0x10, 0x46(%rax)
je 0x1349a
addq $0x58, %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1349a
movq %rax, %rcx
leaq 0x28(%rdi), %rax
cmpq %rbx, (%rdi)
jne 0x134b2
movq 0x28(%rdi), %rax
movq %rax, (%rcx)
callq 0x1fc99
jmp 0x1349a
incq %r15
jmp 0x13478
movq %rbx, %rdi
callq 0x20cd5
testl %r14d, %r14d
je 0x1350a
movl $0x64cffc7f, 0x5c(%rbx) # imm = 0x64CFFC7F
movq %rbx, %rdi
callq 0xd97e
xorl %r14d, %r14d
jmp 0x1352e
movl $0x1c6c8, %edi          # imm = 0x1C6C8
callq 0x9008
pushq $0x15
popq %r14
jmp 0x1352e
movq %rbx, %rdi
callq 0x5b7db
testl %eax, %eax
je 0x134e6
leaq 0x5bb4d(%rip), %rdx     # 0x6f06a
pushq $0x5
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0xbdb1
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2f(%rip), %rcx        # 0x135dc
cmovleq %rax, %rcx
movl $0x0, %edx
cmovgq %rdi, %rdx
cmovlel %eax, %esi
movq %rcx, 0x2a8(%rdi)
movq %rdx, 0x2b0(%rdi)
andl $0x0, 0x2b8(%rdi)
movl %esi, 0x308(%rdi)
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
movq %r8, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq 0x20(%rbp), %r13
movq 0x18(%rbp), %r10
movq 0x10(%rbp), %rax
testq %r13, %r13
je 0x136a3
movl %edx, -0x2c(%rbp)
movq %r10, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movl %ecx, -0x30(%rbp)
movq %r9, -0x48(%rbp)
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0xf4ae
testq %rax, %rax
je 0x136e2
movq %rax, %r15
movq %r13, 0x8(%rax)
movq %r14, 0x10(%rax)
movq -0x48(%rbp), %r9
movl -0x30(%rbp), %ecx
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r10
movl -0x2c(%rbp), %edx
jmp 0x136a6
xorl %r15d, %r15d
subq $0x8, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %r8
pushq %r15
pushq %r10
pushq %rax
callq 0x13705
addq $0x20, %rsp
movl %eax, %r12d
testq %r15, %r15
je 0x136ec
cmpl $0x0, (%r15)
jne 0x136ec
movq %r14, %rdi
callq *%r13
movq %rbx, %rdi
movq %r15, %rsi
callq 0x968b
jmp 0x136ec
movq %r14, %rdi
callq *%r13
pushq $0x1
popq %r12
movq %rbx, %rdi
movl %r12d, %esi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdc59
// File: /workspace/github_c_makefile_star2_O2/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)
pushq $-0x1
popq %rdx
callq 0x1396d
movq %rax, %rbx
movaps -0x40(%rbp), %xmm0
movups %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
movq %r13, %rdi
movq %rax, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movq %r14, %r8
movq -0x30(%rbp), %r9
callq 0x13705
movl %eax, %r14d
movq %r13, %rdi
movq %rbx, %rsi
callq 0x968b
movq %r13, %rdi
movl %r14d, %esi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdc59
// File: /workspace/github_c_makefile_star2_O2/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)
pushq $0x2
popq %rcx
movq %r14, %rdi
xorl %r8d, %r8d
callq 0xe1d3
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x2144b
cmpb $0x0, 0x50(%rbx)
je 0x139c0
leaq -0x48(%rbp), %rdi
callq 0xde44
xorl %eax, %eax
jmp 0x139c4
movq -0x40(%rbp), %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
movq %rsi, %rdi
callq 0x8f8e
pushq $0x1
popq %r8
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r15, %rsi
movl %eax, %edx
movl %r14d, %ecx
xorl %r9d, %r9d
callq 0x13a4e
testq %rax, %rax
jne 0x13a37
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x1ab(%rip), %r9        # 0x13bcb
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
xorl %r8d, %r8d
callq 0x13705
movl %eax, %r12d
movq %rbx, %rdi
movl %r12d, %esi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xdc59
// File: /workspace/github_c_makefile_star2_O2/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 0x5b76a(%rip), %rdi     # 0x6f34d
xorl %eax, %eax
callq 0xae3e
movq %rax, %r14
pushq $-0x1
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xe1ae
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x9c7b
// File: /workspace/github_c_makefile_star2_O2/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        # 0x13cd4
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_O2/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 0x13d10
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq 0x75274(%rip), %rax     # 0x88f60
testq %rax, %rax
je 0x13cf3
callq *%rax
movq %r14, %rdi
movq %rbx, %rsi
callq 0x13f79
movq 0x75263(%rip), %rax     # 0x88f68
testq %rax, %rax
je 0x13d0c
callq *%rax
popq %rbx
popq %r14
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x13d39
orl $-0x1, (%r15)
testq %r14, %r14
je 0x13d42
orl $-0x1, (%r14)
cmpl $0x2, %r13d
jbe 0x13d5a
pushq $0x15
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0xa
popq %rsi
testq %r12, %r12
je 0x13d7a
cmpb $0x0, (%r12)
je 0x13d7a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13dd2
movl %eax, %esi
testl %eax, %eax
js 0x13db5
movq %rbx, %rdi
movl %r13d, %edx
movq %r15, %rcx
movq %r14, %r8
callq 0x13e61
movl %eax, %r14d
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xbdb1
movq %rbx, %rdi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdc59
leaq 0x577c6(%rip), %rdx     # 0x6b582
pushq $0x1
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
movq %r12, %rcx
xorl %eax, %eax
callq 0xbdb1
jmp 0x13d9c
// File: /workspace/github_c_makefile_star2_O2/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:
testq %rsi, %rsi
je 0x13e4b
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r12
movq %rsi, %rdi
callq 0x8f8e
movl %eax, %r14d
movl 0x28(%r12), %r13d
decl %r13d
movslq %r13d, %rax
movq %rax, %r15
shlq $0x5, %r15
addq 0x20(%r12), %r15
cmpl $-0x1, %eax
pushq $-0x1
popq %rcx
cmovll %eax, %ecx
movl %ecx, -0x2c(%rbp)
testl %r13d, %r13d
js 0x13e46
movq (%r15), %r12
movq %r12, %rdi
callq 0x8f8e
cmpl %eax, %r14d
jne 0x13e3d
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb1bf
testl %eax, %eax
je 0x13e4f
decl %r13d
addq $-0x20, %r15
jmp 0x13e19
movl -0x2c(%rbp), %eax
jmp 0x13e52
pushq $-0x1
popq %rax
retq
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
movq %r8, %r10
movl %edx, -0x2c(%rbp)
movl %esi, %r14d
movq %rdi, %r15
movl %esi, %esi
pushq $0x8
popq %rbx
pushq $0x1
popq %r9
xorl %r13d, %r13d
xorl %eax, %eax
xorl %r12d, %r12d
movq %rsi, -0x38(%rbp)
testl %eax, %eax
jne 0x13f5a
movslq 0x28(%r15), %rdx
cmpq %rdx, %r13
jge 0x13f5a
cmpl $0xa, %r14d
setne %dil
cmpq %r13, %rsi
setne %dl
xorl %eax, %eax
testb %dl, %dil
jne 0x13f4e
movq 0x20(%r15), %rax
movq (%rax,%rbx), %rdx
xorl %eax, %eax
testq %rdx, %rdx
je 0x13f3a
movq %rcx, -0x40(%rbp)
movq (%rdx), %rax
movq 0x8(%rdx), %rcx
movq %rax, 0x8(%rcx)
cmpb $0x0, 0x24(%rcx)
pushq $0x6
popq %rax
jne 0x13f3a
movq (%rcx), %r11
movq 0x118(%r11), %rdi
movl $0x0, %eax
testq %rdi, %rdi
je 0x13f3a
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 0x1ab79
pushq $0x1
popq %r9
movq -0x38(%rbp), %rsi
addq $0x20, %rsp
cmpl $0x5, %eax
movl $0x0, %ecx
cmovel %ecx, %eax
cmovel %r9d, %r12d
xorl %ecx, %ecx
xorl %r10d, %r10d
incq %r13
addq $0x20, %rbx
jmp 0x13e93
testl %r12d, %r12d
pushq $0x5
popq %rcx
cmovel %eax, %ecx
testl %eax, %eax
cmovnel %eax, %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_O2/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:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x54226(%rip), %r14     # 0x681f0
testq %rdi, %rdi
je 0x14034
movq %rdi, %rbx
callq 0x13f8a
testl %eax, %eax
je 0x1402d
cmpb $0x0, 0x50(%rbx)
jne 0x14034
movq 0x130(%rbx), %rdi
callq 0xe0ec
movq %rax, %r14
testq %rax, %rax
jne 0x14027
movq 0x130(%rbx), %r14
movl 0x44(%rbx), %edi
callq 0xe5c3
pushq $-0x1
popq %rsi
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %rax, %rdx
xorl %r8d, %r8d
callq 0x12a28
movq 0x130(%rbx), %rdi
callq 0xe0ec
movq %rax, %r14
movb $0x0, 0x50(%rbx)
jmp 0x14034
leaq 0x541dc(%rip), %r14     # 0x68210
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq $0x7
popq %rbx
testq %rdi, %rdi
je 0x14071
movq %rdi, %r14
callq 0x13f8a
testl %eax, %eax
je 0x14064
cmpb $0x0, 0x50(%r14)
jne 0x14071
movl 0x44(%r14), %ebx
jmp 0x14071
movl $0x1cb17, %edi          # imm = 0x1CB17
callq 0x9008
pushq $0x15
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, (%rsi)
callq 0x9740
testl %eax, %eax
jne 0x145e8
xorl %edi, %edi
callq 0x129fe
movq %rax, %r14
pushq $-0x1
popq %rsi
pushq $0x2
popq %rcx
movq %rax, %rdi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0x12a28
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xe05a
testq %rax, %rax
je 0x145d8
pushq $0x6
popq %rdx
movq %rax, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x140bf
movl %eax, %r15d
testl %eax, %eax
jne 0x145dc
movq (%rbx), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
testb $0x1, 0x72(%rax)
jne 0x145d3
movb $0x2, 0x71(%rax)
xorl %r15d, %r15d
jmp 0x145dc
pushq $0x7
popq %r15
movq %r14, %rdi
callq 0x12a43
movzbl %r15b, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x1
popq %rdx
callq 0x1396d
testq %rax, %rax
je 0x147fa
movq %rax, %r12
movzbl %r13b, %edx
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0x14617
movl %eax, %r14d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x968b
jmp 0x147fd
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 0xdc59
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
movl %edi, %r14d
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x96f9
testq %rax, %rax
je 0x14899
imull $0x3e8, %r14d, %esi     # imm = 0x3E8
movq %rax, %rdi
callq *0x70(%rax)
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x14910
testq %rax, %rax
je 0x148ec
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x8(%rax)
movq (%rax), %rax
movq 0x48(%rax), %rdi
cmpl $0x7, %r14d
jne 0x148f0
movq %rdi, (%rbx)
xorl %eax, %eax
jmp 0x1490b
pushq $0x1
jmp 0x1490a
movq (%rdi), %rax
testq %rax, %rax
je 0x14908
movq 0x50(%rax), %rax
movl %r14d, %esi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %rbp
jmpq *%rax
pushq $0xc
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x28(%rdi), %r12d
xorl %r13d, %r13d
testl %r12d, %r12d
cmovlel %r13d, %r12d
shlq $0x5, %r12
cmpq %r13, %r12
je 0x14964
movq 0x20(%r14), %rax
movq 0x8(%rax,%r13), %r15
testq %r15, %r15
je 0x1495e
testq %rbx, %rbx
je 0x14967
movq (%rax,%r13), %rsi
movq %rbx, %rdi
callq 0xb1bf
testl %eax, %eax
je 0x14967
addq $0x20, %r13
jmp 0x14936
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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), %r14
movq %rax, 0x8(%r14)
testb $0x2, 0x26(%r14)
jne 0x1500b
movl %ecx, %ebx
movl %edx, %r15d
testl %edx, %edx
jns 0x14fc0
movl 0x30(%r14), %r15d
subl 0x34(%r14), %r15d
leal -0x200(%rsi), %eax
cmpl $0xfe00, %eax           # imm = 0xFE00
ja 0x14fe3
leal 0x1ffff(%rsi), %eax
testl %esi, %eax
jne 0x14fe3
movl %esi, 0x30(%r14)
movq %r14, %rdi
callq 0x1d923
movq (%r14), %rdi
leaq 0x30(%r14), %rsi
movl %r15d, %edx
callq 0x180ad
movl 0x30(%r14), %ecx
movzwl %r15w, %edx
subl %edx, %ecx
movl %ecx, 0x34(%r14)
testl %ebx, %ebx
je 0x1500e
orb $0x2, 0x26(%r14)
jmp 0x1500e
pushq $0x8
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x73d49(%rip), %ecx     # 0x88d68
testl %ecx, %ecx
je 0x15076
cmpl %edi, 0x72517(%rip)     # 0x87540
jl 0x15076
movq 0x73d2e(%rip), %rax     # 0x88d60
movq (%rax), %rdx
movq %rdx, 0x73d24(%rip)     # 0x88d60
decl %ecx
movl %ecx, 0x73d24(%rip)     # 0x88d68
movl 0x73ca2(%rip), %edx     # 0x88cec
leal 0x1(%rdx), %ecx
movl %ecx, 0x73c99(%rip)     # 0x88cec
cmpl 0x73cbb(%rip), %edx     # 0x88d14
jl 0x15061
movl %ecx, 0x73cb3(%rip)     # 0x88d14
movl %edi, 0x73c99(%rip)     # 0x88d00
cmpl %edi, 0x73cbb(%rip)     # 0x88d28
jge 0x150d0
movl %edi, 0x73cb3(%rip)     # 0x88d28
retq
cmpl $0x0, 0x72383(%rip)     # 0x87400
je 0x150d1
movl %edi, 0x73c7b(%rip)     # 0x88d00
cmpl %edi, 0x73c9d(%rip)     # 0x88d28
jge 0x15093
movl %edi, 0x73c95(%rip)     # 0x88d28
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq -0x10(%rbp), %rbx
movq %rbx, %rsi
callq 0x15490
movl %eax, %ecx
movq (%rbx), %rax
testq %rax, %rax
leaq 0x8(%rsp), %rsp
popq %rbx
popq %rbp
je 0x150d7
addl 0x73c34(%rip), %ecx     # 0x88cf0
movl %ecx, 0x73c2e(%rip)     # 0x88cf0
cmpl 0x73c50(%rip), %ecx     # 0x88d18
jle 0x150d0
movl %ecx, 0x73c48(%rip)     # 0x88d18
retq
jmpq *0x72349(%rip)          # 0x87420
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1512d
movq %rdi, %rbx
cmpq %rdi, 0x72449(%rip)     # 0x87538
ja 0x15134
cmpq %rbx, 0x73c60(%rip)     # 0x88d58
jbe 0x15134
movq 0x73c5f(%rip), %rax     # 0x88d60
movq %rax, (%rbx)
movq %rbx, 0x73c55(%rip)     # 0x88d60
incl 0x73c57(%rip)           # 0x88d68
movl 0x73bd5(%rip), %eax     # 0x88cec
decl %eax
movl %eax, 0x73bcd(%rip)     # 0x88cec
cmpl 0x73bef(%rip), %eax     # 0x88d14
jle 0x1512d
movl %eax, 0x73be7(%rip)     # 0x88d14
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x0, 0x722c5(%rip)     # 0x87400
je 0x1519a
movq %rbx, %rdi
callq *0x722f2(%rip)          # 0x87438
movl 0x73ba4(%rip), %ecx     # 0x88cf0
subl %eax, %ecx
movl %ecx, 0x73b9c(%rip)     # 0x88cf0
cmpl 0x73bbe(%rip), %ecx     # 0x88d18
jle 0x15162
movl %ecx, 0x73bb6(%rip)     # 0x88d18
movl 0x73b78(%rip), %ecx     # 0x88ce0
subl %eax, %ecx
movl %ecx, 0x73b70(%rip)     # 0x88ce0
cmpl 0x73b92(%rip), %ecx     # 0x88d08
jle 0x1517e
movl %ecx, 0x73b8a(%rip)     # 0x88d08
movl 0x73b80(%rip), %eax     # 0x88d04
decl %eax
movl %eax, 0x73b78(%rip)     # 0x88d04
cmpl 0x73b9a(%rip), %eax     # 0x88d2c
jle 0x1519a
movl %eax, 0x73b92(%rip)     # 0x88d2c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *0x7227f(%rip)          # 0x87428
// File: /workspace/github_c_makefile_star2_O2/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 0x151fb
movq %rsi, %rbx
movq %rdi, %r14
movq %r14, %rdi
callq 0x8f8e
movl %eax, %eax
cmpb $0x0, 0x1(%r14,%rax)
je 0x151fb
addq %rax, %r14
incq %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8510
movl %eax, %r15d
movq %r14, %rdi
callq 0x8f8e
movl %eax, %eax
addq %rax, %r14
incq %r14
testl %r15d, %r15d
jne 0x151be
jmp 0x151fe
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
callq 0x151a9
testq %rax, %rax
je 0x1528a
movq %rax, %r14
movq %rax, %rdi
callq 0x8f8e
leaq -0x18(%rbp), %rsi
pushq $0x1
popq %rcx
movq %r14, %rdi
movl %eax, %edx
callq 0x15296
testl %eax, %eax
jne 0x1528a
movq -0x18(%rbp), %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r15d
callq *0x71f9a(%rip)          # 0x87440
movl %eax, %r14d
movl %r15d, 0x73844(%rip)    # 0x88cf4
cmpl %r15d, 0x73865(%rip)    # 0x88d1c
jge 0x154c0
movl %r15d, 0x7385c(%rip)    # 0x88d1c
cmpq $0x0, 0x73880(%rip)     # 0x88d48
je 0x154fe
movslq 0x7380f(%rip), %rax     # 0x88ce0
movq 0x73868(%rip), %rcx     # 0x88d40
movslq %r14d, %rdx
subq %rdx, %rcx
cmpq %rax, %rcx
jle 0x154ec
andl $0x0, 0x73882(%rip)     # 0x88d6c
jmp 0x154fe
movl $0x1, 0x73876(%rip)     # 0x88d6c
movl %r14d, %edi
callq 0x15566
movl %r14d, %edi
callq *0x71f19(%rip)          # 0x87420
movq %rax, %r15
testq %rax, %rax
je 0x15555
movq %r15, %rdi
callq *0x71f20(%rip)          # 0x87438
movl %eax, %r14d
movl 0x737bf(%rip), %eax     # 0x88ce0
addl %r14d, %eax
movl %eax, 0x737b6(%rip)     # 0x88ce0
cmpl 0x737d8(%rip), %eax     # 0x88d08
jle 0x15538
movl %eax, 0x737d0(%rip)     # 0x88d08
movl 0x737c6(%rip), %ecx     # 0x88d04
leal 0x1(%rcx), %eax
movl %eax, 0x737bd(%rip)     # 0x88d04
cmpl 0x737df(%rip), %ecx     # 0x88d2c
jl 0x15555
movl %eax, 0x737d7(%rip)     # 0x88d2c
movq %r15, (%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3MallocAlarm
static void sqlite3MallocAlarm(int nByte){
  void (*xCallback)(void*,sqlite3_int64,int);
  sqlite3_int64 nowUsed;
  void *pArg;
  if( mem0.alarmCallback==0 ) return;
  xCallback = mem0.alarmCallback;
  nowUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
  pArg = mem0.alarmArg;
  mem0.alarmCallback = 0;
  sqlite3_mutex_leave(mem0.mutex);
  xCallback(pArg, nowUsed, nByte);
  sqlite3_mutex_enter(mem0.mutex);
  mem0.alarmCallback = xCallback;
  mem0.alarmArg = pArg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x737d4(%rip), %r14     # 0x88d48
testq %r14, %r14
je 0x155a5
movl %edi, %edx
movslq 0x7375e(%rip), %rsi     # 0x88ce0
movq 0x737c7(%rip), %rbx     # 0x88d50
andq $0x0, 0x737b7(%rip)     # 0x88d48
movq %rbx, %rdi
callq *%r14
movq %r14, 0x737aa(%rip)     # 0x88d48
movq %rbx, 0x737ab(%rip)     # 0x88d50
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3DbMallocSize
SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){
  assert( db==0 || sqlite3_mutex_held(db->mutex) );
  if( db && isLookaside(db, p) ){
    return db->lookaside.sz;
  }else{
    assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );
    assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) );
    assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );
    return sqlite3GlobalConfig.m.xSize(p);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x155d9
cmpq %rsi, 0x170(%rdi)
ja 0x155d9
cmpq %rsi, 0x178(%rdi)
jbe 0x155d9
movzwl 0x150(%rdi), %eax
popq %rbp
retq
movq %rsi, %rdi
popq %rbp
jmpq *0x71e55(%rip)          # 0x87438
// File: /workspace/github_c_makefile_star2_O2/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 0x1568c
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
jle 0x15666
movl 0x18(%rbx), %eax
movl 0x1c(%rbx), %edx
leal (%rax,%r15), %ecx
cmpl %edx, %ecx
jge 0x1562e
movslq %eax, %rdi
addq 0x10(%rbx), %rdi
movl %r15d, %edx
movq %r14, %rsi
callq 0x82c0
addl %r15d, 0x18(%rbx)
jmp 0x1568c
movb 0x24(%rbx), %cl
testb %cl, %cl
je 0x1567b
cltq
movq 0x10(%rbx), %rdx
xorl %r12d, %r12d
cmpq 0x8(%rbx), %rdx
cmovneq %rdx, %r12
movl %r15d, %edx
addq %rax, %rdx
incq %rdx
movslq 0x20(%rbx), %rax
cmpq %rax, %rdx
jle 0x1569b
movq %rbx, %rdi
callq 0x1578c
movb $0x2, 0x25(%rbx)
jmp 0x1568c
je 0x1568c
cmpb $0x0, (%r14)
je 0x1568c
movq %r14, %rdi
callq 0x8f8e
movl %eax, %r15d
jmp 0x15608
movb $0x2, 0x25(%rbx)
movl %eax, %ecx
notl %ecx
addl %ecx, %edx
movl %edx, %r15d
testl %edx, %edx
jg 0x15616
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edx, 0x1c(%rbx)
cmpb $0x1, %cl
jne 0x156b0
movq (%rbx), %rdi
movq %r12, %rsi
callq 0x157c3
jmp 0x156ba
movq %r12, %rdi
movl %edx, %esi
callq 0x9ce9
movq %rax, %r13
testq %rax, %rax
je 0x156f1
testq %r12, %r12
sete %cl
movl 0x18(%rbx), %eax
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x156e8
movl %eax, %edx
movq 0x10(%rbx), %rsi
movq %r13, %rdi
callq 0x82c0
movl 0x18(%rbx), %eax
movq %r13, 0x10(%rbx)
jmp 0x15616
movb $0x1, 0x25(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1578c
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leaq 0x52be6(%rip), %r15     # 0x68330
pushq $0x1d
popq %r12
cmpl $0x1d, %ebx
jl 0x15766
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x155e3
addl $-0x1d, %ebx
jmp 0x1574e
testl %ebx, %ebx
jle 0x15783
leaq 0x52bbf(%rip), %rsi     # 0x68330
movq %r14, %rdi
movl %ebx, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x155e3
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq