LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: absFunc
static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  assert( argc==1 );
  UNUSED_PARAMETER(argc);
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      i64 iVal = sqlite3_value_int64(argv[0]);
      if( iVal<0 ){
        if( (iVal<<1)==0 ){
          /* IMP: R-35460-15084 If X is the integer -9223372036854775807 then
          ** abs(X) throws an integer overflow error since there is no
          ** equivalent positive 64-bit two complement value. */
          sqlite3_result_error(context, "integer overflow", -1);
          return;
        }
        iVal = -iVal;
      } 
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      /* IMP: R-37434-19929 Abs(X) returns NULL if X is NULL. */
      sqlite3_result_null(context);
      break;
    }
    default: {
      /* Because sqlite3_value_double() returns 0.0 if the argument is not
      ** something that can be converted into a number, we have:
      ** IMP: R-57326-31541 Abs(X) return 0.0 if X is a string or blob that
      ** cannot be converted to a numeric value. 
      */
      double rVal = sqlite3_value_double(argv[0]);
      if( rVal<0 ) rVal = -rVal;
      sqlite3_result_double(context, rVal);
      break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdx), %rdi
movzbl 0x26(%rdi), %eax
cmpl $0x5, %eax
je 0x58851
cmpl $0x1, %eax
jne 0x58863
callq 0xdfe0
testq %rax, %rax
jns 0x5883c
leaq (,%rax,2), %rcx
testq %rcx, %rcx
je 0x5888e
negq %rax
addq $0x8, %rbx
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe3ff
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe43c
callq 0xdf89
movapd 0x12b50(%rip), %xmm1    # 0x6b3c0
xorpd %xmm0, %xmm1
maxsd %xmm0, %xmm1
addq $0x8, %rbx
movq %rbx, %rdi
movapd %xmm1, %xmm0
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe166
leaq 0x16646(%rip), %rsi     # 0x6eedb
pushq $-0x1
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe1ae
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: roundFunc
static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  int n = 0;
  double r;
  char *zBuf;
  assert( argc==1 || argc==2 );
  if( argc==2 ){
    if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
    n = sqlite3_value_int(argv[1]);
    if( n>30 ) n = 30;
    if( n<0 ) n = 0;
  }
  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  r = sqlite3_value_double(argv[0]);
  /* If Y==0 and X will fit in a 64-bit int,
  ** handle the rounding directly,
  ** otherwise use printf.
  */
  if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
    r = (double)((sqlite_int64)(r+0.5));
  }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){
    r = -(double)((sqlite_int64)((-r)+0.5));
  }else{
    zBuf = sqlite3_mprintf("%.*f",n,r);
    if( zBuf==0 ){
      sqlite3_result_error_nomem(context);
      return;
    }
    sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);
    sqlite3_free(zBuf);
  }
  sqlite3_result_double(context, r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %rbx
xorl %r14d, %r14d
cmpl $0x2, %esi
jne 0x588df
movq 0x8(%r15), %rdi
cmpb $0x5, 0x26(%rdi)
je 0x588e8
callq 0xdfe0
cmpl $0x1e, %eax
pushq $0x1e
popq %rcx
cmovll %eax, %ecx
xorl %r14d, %r14d
testl %ecx, %ecx
cmovgl %ecx, %r14d
movq (%r15), %rdi
cmpb $0x5, 0x26(%rdi)
jne 0x588f3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0xdf89
movsd %xmm0, -0x20(%rbp)
testl %r14d, %r14d
jne 0x5892e
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x5892e
movsd 0x129a4(%rip), %xmm1    # 0x6b2b8
ucomisd %xmm0, %xmm1
jbe 0x5892e
addsd 0x1295e(%rip), %xmm0    # 0x6b280
cvttsd2si %xmm0, %rax
cvtsi2sd %rax, %xmm0
jmp 0x589a9
testl %r14d, %r14d
jne 0x58967
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x58967
ucomisd 0x1299b(%rip), %xmm0    # 0x6b2e0
jbe 0x58967
movsd 0x12931(%rip), %xmm1    # 0x6b280
subsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
cvtsi2sd %rax, %xmm0
xorpd 0x12a5b(%rip), %xmm0    # 0x6b3c0
jmp 0x589a9
leaq 0x1657e(%rip), %rdi     # 0x6eeec
movl %r14d, %esi
movb $0x1, %al
callq 0xae3e
testq %rax, %rax
je 0x589bf
movq %rax, %r14
movq %rax, %rdi
callq 0x8f8e
leaq -0x20(%rbp), %r15
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x20fe3
movq %r14, %rdi
callq 0x9c7b
movsd (%r15), %xmm0
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe166
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe631
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: upperFunc
static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  char *z1;
  const char *z2;
  int i, n;
  UNUSED_PARAMETER(argc);
  z2 = (char*)sqlite3_value_text(argv[0]);
  n = sqlite3_value_bytes(argv[0]);
  /* Verify that the call to _bytes() does not invalidate the _text() pointer */
  assert( z2==(char*)sqlite3_value_text(argv[0]) );
  if( z2 ){
    z1 = contextMalloc(context, ((i64)n)+1);
    if( z1 ){
      for(i=0; i<n; i++){
        z1[i] = (char)sqlite3Toupper(z2[i]);
      }
      sqlite3_result_text(context, z1, n, sqlite3_free);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %rbx
movq (%rdx), %rdi
callq 0xdf1e
movq %rax, %r14
movq (%r15), %rdi
callq 0xdf2d
testq %r14, %r14
je 0x58a42
movl %eax, %r15d
movslq %eax, %rsi
incq %rsi
movq %rbx, %rdi
callq 0x5959e
testq %rax, %rax
je 0x58a42
xorl %ecx, %ecx
testl %r15d, %r15d
movl %r15d, %edx
cmovlel %ecx, %edx
leaq 0xf54f(%rip), %rsi      # 0x67f70
cmpq %rcx, %rdx
je 0x58a4d
movzbl (%r14,%rcx), %edi
movb (%rdi,%rsi), %r8b
notb %r8b
orb $-0x21, %r8b
andb %dil, %r8b
movb %r8b, (%rax,%rcx)
incq %rcx
jmp 0x58a21
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0x4edd9(%rip), %rcx    # 0x9c7b
movq %rbx, %rdi
movq %rax, %rsi
movl %r15d, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe48d
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: lowerFunc
static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  char *z1;
  const char *z2;
  int i, n;
  UNUSED_PARAMETER(argc);
  z2 = (char*)sqlite3_value_text(argv[0]);
  n = sqlite3_value_bytes(argv[0]);
  /* Verify that the call to _bytes() does not invalidate the _text() pointer */
  assert( z2==(char*)sqlite3_value_text(argv[0]) );
  if( z2 ){
    z1 = contextMalloc(context, ((i64)n)+1);
    if( z1 ){
      for(i=0; i<n; i++){
        z1[i] = sqlite3Tolower(z2[i]);
      }
      sqlite3_result_text(context, z1, n, sqlite3_free);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %rbx
movq (%rdx), %rdi
callq 0xdf1e
movq %rax, %r14
movq (%r15), %rdi
callq 0xdf2d
testq %r14, %r14
je 0x58ad3
movl %eax, %r15d
movslq %eax, %rsi
incq %rsi
movq %rbx, %rdi
callq 0x5959e
testq %rax, %rax
je 0x58ad3
xorl %ecx, %ecx
testl %r15d, %r15d
movl %r15d, %edx
cmovlel %ecx, %edx
leaq 0xf5b4(%rip), %rsi      # 0x68070
cmpq %rcx, %rdx
je 0x58ade
movzbl (%r14,%rcx), %edi
movb (%rdi,%rsi), %dil
movb %dil, (%rax,%rcx)
incq %rcx
jmp 0x58abc
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0x4ee6a(%rip), %rcx    # 0x9c7b
movq %rbx, %rdi
movq %rax, %rsi
movl %r15d, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe48d
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: hexFunc
static void hexFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int i, n;
  const unsigned char *pBlob;
  char *zHex, *z;
  assert( argc==1 );
  UNUSED_PARAMETER(argc);
  pBlob = sqlite3_value_blob(argv[0]);
  n = sqlite3_value_bytes(argv[0]);
  assert( pBlob==sqlite3_value_blob(argv[0]) );  /* No encoding change */
  z = zHex = contextMalloc(context, ((i64)n)*2 + 1);
  if( zHex ){
    for(i=0; i<n; i++, pBlob++){
      unsigned char c = *pBlob;
      *(z++) = hexdigits[(c>>4)&0xf];
      *(z++) = hexdigits[c&0xf];
    }
    *z = 0;
    sqlite3_result_text(context, zHex, n*2, sqlite3_free);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movq (%rdx), %rdi
callq 0xde7e
movq %rax, %r15
movq (%r14), %rdi
callq 0xdf2d
movl %eax, %r14d
cltq
leaq 0x1(,%rax,2), %rsi
movq %rbx, %rdi
callq 0x5959e
testq %rax, %rax
je 0x58bb6
xorl %ecx, %ecx
testl %r14d, %r14d
movl $0x0, %edx
cmovgl %r14d, %edx
leaq 0x128c9(%rip), %rsi     # 0x6b430
cmpl %ecx, %edx
je 0x58b90
movzbl (%r15,%rcx), %edi
movl %edi, %r8d
shrl $0x4, %r8d
movb (%r8,%rsi), %r8b
movb %r8b, (%rax,%rcx,2)
andl $0xf, %edi
movb (%rdi,%rsi), %dil
movb %dil, 0x1(%rax,%rcx,2)
incq %rcx
jmp 0x58b67
movb $0x0, (%rax,%rcx,2)
addl %r14d, %r14d
leaq -0x4ef23(%rip), %rcx    # 0x9c7b
movq %rbx, %rdi
movq %rax, %rsi
movl %r14d, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe48d
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: randomBlob
static void randomBlob(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int n;
  unsigned char *p;
  assert( argc==1 );
  UNUSED_PARAMETER(argc);
  n = sqlite3_value_int(argv[0]);
  if( n<1 ){
    n = 1;
  }
  p = contextMalloc(context, n);
  if( p ){
    sqlite3_randomness(n, p);
    sqlite3_result_blob(context, (char*)p, n, sqlite3_free);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdx), %rdi
callq 0xdfe0
cmpl $0x2, %eax
pushq $0x1
popq %r14
cmovgel %eax, %r14d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5959e
testq %rax, %rax
je 0x58c64
movq %rax, %r15
movl %r14d, %edi
movq %rax, %rsi
callq 0xb09f
leaq -0x4efd1(%rip), %rcx    # 0x9c7b
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe123
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: nullifFunc
static void nullifFunc(
  sqlite3_context *context,
  int NotUsed,
  sqlite3_value **argv
){
  CollSeq *pColl = sqlite3GetFuncCollSeq(context);
  UNUSED_PARAMETER(NotUsed);
  if( sqlite3MemCompare(argv[0], argv[1], pColl)!=0 ){
    sqlite3_result_value(context, argv[0]);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movq 0x48(%rdi), %rdx
movq (%r14), %rdi
movq 0x8(%r14), %rsi
callq 0x29b5f
testl %eax, %eax
je 0x58ca3
movq (%r14), %rsi
addq $0x8, %rbx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xe4e0
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: compileoptiongetFunc
static void compileoptiongetFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int n;
  assert( argc==1 );
  UNUSED_PARAMETER(argc);
  /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function
  ** is a wrapper around the sqlite3_compileoption_get() C/C++ function.
  */
  n = sqlite3_value_int(argv[0]);
  sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdx), %rdi
callq 0xdfe0
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x58d47
xorl %esi, %esi
jmp 0x58d55
andl $0x1, %eax
leaq 0x2cf5f(%rip), %rcx     # 0x85cb0
movq (%rcx,%rax,8), %rsi
pushq $-0x1
popq %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe48d
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: zeroblobFunc
static void zeroblobFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  i64 n;
  sqlite3 *db = sqlite3_context_db_handle(context);
  assert( argc==1 );
  UNUSED_PARAMETER(argc);
  n = sqlite3_value_int64(argv[0]);
  testcase( n==db->aLimit[SQLITE_LIMIT_LENGTH] );
  testcase( n==db->aLimit[SQLITE_LIMIT_LENGTH]+1 );
  if( n>db->aLimit[SQLITE_LIMIT_LENGTH] ){
    sqlite3_result_error_toobig(context);
  }else{
    sqlite3_result_zeroblob(context, (int)n); /* IMP: R-00293-64994 */
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq (%rdx), %rdi
callq 0xdfe0
movslq 0x68(%r14), %rcx
cmpq %rcx, %rax
jle 0x5922b
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xe604
addq $0x8, %rbx
movq %rbx, %rdi
movl %eax, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0xe558
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sumStep
static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  SumCtx *p;
  int type;
  assert( argc==1 );
  UNUSED_PARAMETER(argc);
  p = sqlite3_aggregate_context(context, sizeof(*p));
  type = sqlite3_value_numeric_type(argv[0]);
  if( p && type!=SQLITE_NULL ){
    p->cnt++;
    if( type==SQLITE_INTEGER ){
      i64 v = sqlite3_value_int64(argv[0]);
      p->rSum += v;
      if( (p->approx|p->overflow)==0 && sqlite3AddInt64(&p->iSum, v) ){
        p->overflow = 1;
      }
    }else{
      p->rSum += sqlite3_value_double(argv[0]);
      p->approx = 1;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
pushq $0x20
popq %rsi
callq 0xf1e2
movq %rax, %rbx
movq (%r14), %rdi
callq 0xfd73
testq %rbx, %rbx
setne %cl
cmpl $0x5, %eax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x592bd
incq 0x10(%rbx)
movq (%r14), %rdi
cmpl $0x1, %eax
jne 0x592ac
callq 0xdfe0
cvtsi2sd %rax, %xmm0
addsd (%rbx), %xmm0
movsd %xmm0, (%rbx)
movb 0x18(%rbx), %cl
orb 0x19(%rbx), %cl
jne 0x592bd
movq %rbx, %rdi
addq $0x8, %rdi
movq %rax, %rsi
callq 0x2998e
testl %eax, %eax
je 0x592bd
movb $0x1, 0x18(%rbx)
jmp 0x592bd
callq 0xdf89
addsd (%rbx), %xmm0
movsd %xmm0, (%rbx)
movb $0x1, 0x19(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sumFinalize
static void sumFinalize(sqlite3_context *context){
  SumCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->cnt>0 ){
    if( p->overflow ){
      sqlite3_result_error(context,"integer overflow",-1);
    }else if( p->approx ){
      sqlite3_result_double(context, p->rSum);
    }else{
      sqlite3_result_int64(context, p->iSum);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0xf1e2
testq %rax, %rax
je 0x592fc
cmpq $0x0, 0x10(%rax)
jle 0x592fc
cmpb $0x0, 0x18(%rax)
je 0x59303
leaq 0x15bf0(%rip), %rsi     # 0x6eedb
pushq $-0x1
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe1ae
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpb $0x0, 0x19(%rax)
je 0x5931f
movsd (%rax), %xmm0
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe166
movq 0x8(%rax), %rsi
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe3ff
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: totalFinalize
static void totalFinalize(sqlite3_context *context){
  SumCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
  sqlite3_result_double(context, p ? p->rSum : (double)0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0xf1e2
testq %rax, %rax
je 0x59350
movsd (%rax), %xmm0
jmp 0x59353
xorps %xmm0, %xmm0
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe166
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: avgFinalize
static void avgFinalize(sqlite3_context *context){
  SumCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->cnt>0 ){
    sqlite3_result_double(context, p->rSum/(double)p->cnt);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0xf1e2
testq %rax, %rax
je 0x593a2
movq 0x10(%rax), %rcx
testq %rcx, %rcx
jle 0x593a2
movsd (%rax), %xmm0
cvtsi2sd %rcx, %xmm1
divsd %xmm1, %xmm0
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe166
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: countStep
static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  CountCtx *p;
  p = sqlite3_aggregate_context(context, sizeof(*p));
  if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){
    p->n++;
  }

#ifndef SQLITE_OMIT_DEPRECATED
  /* The sqlite3_aggregate_count() function is deprecated.  But just to make
  ** sure it still operates correctly, verify that its count agrees with our 
  ** internal count when using count(*) and when the total count can be
  ** expressed as a 32-bit integer. */
  assert( argc==1 || p==0 || p->n>0x7fffffff
          || p->n==sqlite3_aggregate_count(context) );
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %r14d
pushq $0x8
popq %rsi
callq 0xf1e2
testl %r14d, %r14d
je 0x593df
movq (%rbx), %rcx
cmpb $0x5, 0x26(%rcx)
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
je 0x593da
incq (%rax)
popq %rbx
popq %r14
popq %rbp
retq
testq %rax, %rax
jne 0x593d7
jmp 0x593da
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: groupConcatStep
static void groupConcatStep(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const char *zVal;
  StrAccum *pAccum;
  const char *zSep;
  int nVal, nSep;
  assert( argc==1 || argc==2 );
  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum));

  if( pAccum ){
    sqlite3 *db = sqlite3_context_db_handle(context);
    int firstTerm = pAccum->useMalloc==0;
    pAccum->useMalloc = 2;
    pAccum->mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH];
    if( !firstTerm ){
      if( argc==2 ){
        zSep = (char*)sqlite3_value_text(argv[1]);
        nSep = sqlite3_value_bytes(argv[1]);
      }else{
        zSep = ",";
        nSep = 1;
      }
      sqlite3StrAccumAppend(pAccum, zSep, nSep);
    }
    zVal = (char*)sqlite3_value_text(argv[0]);
    nVal = sqlite3_value_bytes(argv[0]);
    sqlite3StrAccumAppend(pAccum, zVal, nVal);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq (%rdx), %rax
cmpb $0x5, 0x26(%rax)
je 0x59478
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r12
pushq $0x28
popq %rsi
callq 0xf1e2
testq %rax, %rax
je 0x59478
movq %rax, %r14
cmpb $0x0, 0x24(%rax)
movq 0x8(%r12), %rax
movb $0x2, 0x24(%r14)
movl 0x68(%rax), %eax
movl %eax, 0x20(%r14)
je 0x59496
cmpl $0x2, %r15d
jne 0x59481
movq 0x8(%rbx), %rdi
callq 0xdf1e
movq %rax, %r15
movq 0x8(%rbx), %rdi
callq 0xdf2d
movl %eax, %edx
jmp 0x5948b
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13ee5(%rip), %r15     # 0x6d36d
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x155e3
movq (%rbx), %rdi
callq 0xdf1e
movq %rax, %r15
movq (%rbx), %rdi
callq 0xdf2d
movq %r14, %rdi
movq %r15, %rsi
movl %eax, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x155e3
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: groupConcatFinalize
static void groupConcatFinalize(sqlite3_context *context){
  StrAccum *pAccum;
  pAccum = sqlite3_aggregate_context(context, 0);
  if( pAccum ){
    if( pAccum->accError==STRACCUM_TOOBIG ){
      sqlite3_result_error_toobig(context);
    }else if( pAccum->accError==STRACCUM_NOMEM ){
      sqlite3_result_error_nomem(context);
    }else{    
      sqlite3_result_text(context, sqlite3StrAccumFinish(pAccum), -1, 
                          sqlite3_free);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0xf1e2
testq %rax, %rax
je 0x594ef
movzbl 0x25(%rax), %ecx
cmpl $0x1, %ecx
je 0x594f6
cmpl $0x2, %ecx
jne 0x59504
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe604
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe631
movq %rax, %rdi
callq 0xadc3
leaq -0x4f898(%rip), %rcx    # 0x9c7b
pushq $-0x1
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe48d
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3FuncDefInsert
SQLITE_PRIVATE void sqlite3FuncDefInsert(
  FuncDefHash *pHash,  /* The hash table into which to insert */
  FuncDef *pDef        /* The function definition to insert */
){
  FuncDef *pOther;
  int nName = sqlite3Strlen30(pDef->zName);
  u8 c1 = (u8)pDef->zName[0];
  int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a);
  pOther = functionSearch(pHash, h, pDef->zName, nName);
  if( pOther ){
    assert( pOther!=pDef && pOther->pNext!=pDef );
    pDef->pNext = pOther->pNext;
    pOther->pNext = pDef;
  }else{
    pDef->pNext = 0;
    pDef->pHash = pHash->a[h];
    pHash->a[h] = pDef;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x30(%rsi), %r12
movq %r12, %rdi
callq 0x8f8e
movl %eax, %ecx
movzbl (%r12), %eax
leaq 0xeb1e(%rip), %rdx      # 0x68070
movzbl (%rax,%rdx), %eax
addl %ecx, %eax
pushq $0x17
popq %rsi
xorl %edx, %edx
divl %esi
movl %edx, %r15d
movq %r14, %rdi
movl %edx, %esi
movq %r12, %rdx
callq 0x595db
testq %rax, %rax
je 0x5957c
addq $0x10, %rax
pushq $0x10
jmp 0x5958a
andq $0x0, 0x10(%rbx)
movl %r15d, %eax
leaq (%r14,%rax,8), %rax
pushq $0x38
popq %rcx
movq (%rax), %rdx
movq %rdx, (%rbx,%rcx)
movq %rbx, (%rax)
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: contextMalloc
static void *contextMalloc(sqlite3_context *context, i64 nByte){
  char *z;
  sqlite3 *db = sqlite3_context_db_handle(context);
  assert( nByte>0 );
  testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH] );
  testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH]+1 );
  if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
    sqlite3_result_error_toobig(context);
    z = 0;
  }else{
    z = sqlite3Malloc((int)nByte);
    if( !z ){
      sqlite3_result_error_nomem(context);
    }
  }
  return z;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movslq 0x68(%rax), %rax
cmpq %rsi, %rax
jge 0x595be
movq %rbx, %rdi
callq 0xe604
jmp 0x595d2
movl %esi, %edi
callq 0x9c40
testq %rax, %rax
jne 0x595d4
movq %rbx, %rdi
callq 0xe631
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: functionSearch
static FuncDef *functionSearch(
  FuncDefHash *pHash,  /* Hash table to search */
  int h,               /* Hash of the name */
  const char *zFunc,   /* Name of function */
  int nFunc            /* Number of bytes in zFunc */
){
  FuncDef *p;
  for(p=pHash->a[h]; p; p=p->pHash){
    if( sqlite3StrNICmp(p->zName, zFunc, nFunc)==0 && p->zName[nFunc]==0 ){
      return p;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movslq %esi, %rax
leaq (%rdi,%rax,8), %r15
movslq %ecx, %r13
movq (%r15), %r15
testq %r15, %r15
je 0x59622
movq 0x30(%r15), %r12
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x8f45
testl %eax, %eax
jne 0x5961c
cmpb $0x0, (%r12,%r13)
je 0x59622
addq $0x38, %r15
jmp 0x595f8
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: juliandayFunc
static void juliandayFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  if( isDate(context, argc, argv, &x)==0 ){
    computeJD(&x);
    sqlite3_result_double(context, x.iJD/86400000.0);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
leaq -0x40(%rbp), %rcx
callq 0x59bf8
testl %eax, %eax
jne 0x59674
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x5a515
cvtsi2sdq (%r14), %xmm0
divsd 0x11c48(%rip), %xmm0    # 0x6b2b0
addq $0x8, %rbx
movq %rbx, %rdi
callq 0xe166
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: dateFunc
static void dateFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  if( isDate(context, argc, argv, &x)==0 ){
    char zBuf[100];
    computeYMD(&x);
    sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D);
    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
leaq -0x40(%rbp), %rcx
callq 0x59bf8
testl %eax, %eax
jne 0x596df
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x5ab3c
movl 0x8(%r14), %ecx
movl 0xc(%r14), %r8d
movl 0x10(%r14), %r9d
leaq 0x158d3(%rip), %rdx     # 0x6ef8d
pushq $0x64
popq %rdi
leaq -0xb0(%rbp), %r14
movq %r14, %rsi
xorl %eax, %eax
callq 0xaf26
pushq $-0x1
popq %rdx
pushq $-0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe48d
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: timeFunc
static void timeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  if( isDate(context, argc, argv, &x)==0 ){
    char zBuf[100];
    computeHMS(&x);
    sqlite3_snprintf(sizeof(zBuf), zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s);
    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
leaq -0x40(%rbp), %rcx
callq 0x59bf8
testl %eax, %eax
jne 0x5974f
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x5ac2b
movl 0x14(%r14), %ecx
movl 0x18(%r14), %r8d
cvttsd2si 0x20(%r14), %r9d
leaq 0x15881(%rip), %rdx     # 0x6efab
pushq $0x64
popq %rdi
leaq -0xb0(%rbp), %r14
movq %r14, %rsi
xorl %eax, %eax
callq 0xaf26
pushq $-0x1
popq %rdx
pushq $-0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe48d
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: datetimeFunc
static void datetimeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  if( isDate(context, argc, argv, &x)==0 ){
    char zBuf[100];
    computeYMD_HMS(&x);
    sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d %02d:%02d:%02d",
                     x.Y, x.M, x.D, x.h, x.m, (int)(x.s));
    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
leaq -0x48(%rbp), %rcx
callq 0x59bf8
testl %eax, %eax
jne 0x597db
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x5ab20
movl 0x8(%r14), %ecx
movl 0xc(%r14), %r8d
movl 0x10(%r14), %r9d
movl 0x14(%r14), %r10d
movl 0x18(%r14), %r11d
cvttsd2si 0x20(%r14), %r15d
subq $0x8, %rsp
leaq 0x157f0(%rip), %rdx     # 0x6ef9c
pushq $0x64
popq %rdi
leaq -0xb0(%rbp), %r14
movq %r14, %rsi
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r10
callq 0xaf26
addq $0x20, %rsp
pushq $-0x1
popq %rdx
pushq $-0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe48d
addq $0x98, %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: computeJD
static void computeJD(DateTime *p){
  int Y, M, D, A, B, X1, X2;

  if( p->validJD ) return;
  if( p->validYMD ){
    Y = p->Y;
    M = p->M;
    D = p->D;
  }else{
    Y = 2000;  /* If no YMD specified, assume 2000-Jan-01 */
    M = 1;
    D = 1;
  }
  if( M<=2 ){
    Y--;
    M += 12;
  }
  A = Y/100;
  B = 2 - A + (A/4);
  X1 = 36525*(Y+4716)/100;
  X2 = 306001*(M+1)/10000;
  p->iJD = (sqlite3_int64)((X1 + X2 + D + B - 1524.5 ) * 86400000);
  p->validJD = 1;
  if( p->validHMS ){
    p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000);
    if( p->validTZ ){
      p->iJD -= p->tz*60000;
      p->validYMD = 0;
      p->validHMS = 0;
      p->validTZ = 0;
    }
  }
}

// Assembly:
cmpb $0x0, 0x2a(%rdi)
je 0x5a51c
retq
cmpb $0x0, 0x28(%rdi)
je 0x5a532
movl 0x8(%rdi), %ecx
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %r9d
addl $0x2, %r9d
jmp 0x5a542
movl $0x7d0, %ecx            # imm = 0x7D0
movl $0x1, %eax
movl $0x3, %r9d
pushq %rbp
movq %rsp, %rbp
leal 0xc(%rax), %r10d
xorl %edx, %edx
cmpl $0x3, %eax
setl %dl
cmovgel %eax, %r10d
subl %edx, %ecx
movl $0xffffff9c, %esi       # imm = 0xFFFFFF9C
movl %ecx, %eax
cltd
idivl %esi
movl %eax, %esi
movl $0x190, %r8d            # imm = 0x190
movl %ecx, %eax
cltd
idivl %r8d
movl %eax, %r8d
imull $0x8ead, %ecx, %eax     # imm = 0x8EAD
addl $0xa445afc, %eax        # imm = 0xA445AFC
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %ecx
imull $0x4ab51, %r10d, %eax   # imm = 0x4AB51
addl $0x4ab51, %eax          # imm = 0x4AB51
movl $0x2710, %r10d          # imm = 0x2710
cltd
idivl %r10d
addl %r9d, %esi
addl %r8d, %esi
addl %eax, %esi
addl %ecx, %esi
cvtsi2sd %esi, %xmm0
addsd 0x10d7c(%rip), %xmm0    # 0x6b330
mulsd 0x10cf4(%rip), %xmm0    # 0x6b2b0
cvttsd2si %xmm0, %rax
movq %rax, (%rdi)
movb $0x1, 0x2a(%rdi)
cmpb $0x0, 0x29(%rdi)
je 0x5a622
movslq 0x14(%rdi), %rcx
imulq $0x36ee80, %rcx, %rcx   # imm = 0x36EE80
movslq 0x18(%rdi), %rdx
imulq $0xea60, %rdx, %rdx     # imm = 0xEA60
movsd 0x20(%rdi), %xmm0
mulsd 0x10d17(%rip), %xmm0    # 0x6b308
addq %rcx, %rdx
cvttsd2si %xmm0, %rcx
addq %rdx, %rcx
addq %rax, %rcx
movq %rcx, (%rdi)
cmpb $0x0, 0x2b(%rdi)
je 0x5a622
movslq 0x1c(%rdi), %rax
imulq $0xea60, %rax, %rax     # imm = 0xEA60
subq %rax, %rcx
movq %rcx, (%rdi)
andw $0x0, 0x28(%rdi)
movb $0x0, 0x2b(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: setDateTimeToCurrent
static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){
  sqlite3 *db = sqlite3_context_db_handle(context);
  if( sqlite3OsCurrentTimeInt64(db->pVfs, &p->iJD)==SQLITE_OK ){
    p->validJD = 1;
    return 0;
  }else{
    return 1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x8(%rdi), %rax
movq (%rax), %rdi
callq 0x21b2a
testl %eax, %eax
je 0x5a642
pushq $0x1
popq %rax
jmp 0x5a648
movb $0x1, 0x2a(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: getDigits
static int getDigits(const char *zDate, ...){
  va_list ap;
  int val;
  int N;
  int min;
  int max;
  int nextC;
  int *pVal;
  int cnt = 0;
  va_start(ap, zDate);
  do{
    N = va_arg(ap, int);
    min = va_arg(ap, int);
    max = va_arg(ap, int);
    nextC = va_arg(ap, int);
    pVal = va_arg(ap, int*);
    val = 0;
    while( N-- ){
      if( !sqlite3Isdigit(*zDate) ){
        goto end_getDigits;
      }
      val = val*10 + *zDate - '0';
      zDate++;
    }
    if( val<min || val>max || (nextC!=0 && nextC!=*zDate) ){
      goto end_getDigits;
    }
    *pVal = val;
    zDate++;
    cnt++;
  }while( nextC );
end_getDigits:
  va_end(ap);
  return cnt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
leaq -0xe0(%rbp), %r10
movq %rsi, 0x8(%r10)
movq %rdx, 0x10(%r10)
movq %rcx, 0x18(%r10)
movq %r8, 0x20(%r10)
movq %r9, 0x28(%r10)
testb %al, %al
je 0x5a89b
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
movq %r10, -0x20(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, -0x30(%rbp)
xorl %eax, %eax
movl -0x30(%rbp), %r9d
cmpq $0x29, %r9
jae 0x5a92c
movq -0x20(%rbp), %rdx
leaq 0x8(%r9), %rcx
movl %ecx, -0x30(%rbp)
movl (%rdx,%r9), %edx
cmpl $0x21, %r9d
jae 0x5a93a
movq -0x20(%rbp), %rsi
leal 0x10(%r9), %r8d
movl %r8d, -0x30(%rbp)
movl (%rsi,%rcx), %ecx
cmpl $0x19, %r9d
jae 0x5a948
movq -0x20(%rbp), %rsi
leaq 0x18(%r9), %r8
movl %r8d, -0x30(%rbp)
movl 0x10(%rsi,%r9), %esi
cmpl $0x11, %r9d
jae 0x5a956
movq -0x20(%rbp), %r11
movl %r9d, %r10d
orl $0x20, %r10d
movl %r10d, -0x30(%rbp)
movl (%r11,%r8), %r8d
cmpl $0x28, %r10d
ja 0x5a965
movl %r10d, %r10d
addq -0x20(%rbp), %r10
addl $0x28, %r9d
movl %r9d, -0x30(%rbp)
jmp 0x5a971
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x28(%rbp)
movl (%rcx), %edx
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rsi
movq %rsi, -0x28(%rbp)
movl (%rcx), %ecx
movq -0x28(%rbp), %rsi
leaq 0x8(%rsi), %r8
movq %r8, -0x28(%rbp)
movl (%rsi), %esi
movq -0x28(%rbp), %r8
leaq 0x8(%r8), %r9
movq %r9, -0x28(%rbp)
movl (%r8), %r8d
movq -0x28(%rbp), %r10
leaq 0x8(%r10), %r9
movq %r9, -0x28(%rbp)
movq (%r10), %r9
movl %edx, %r11d
leaq (%rdi,%r11), %rdx
xorl %ebx, %ebx
xorl %r10d, %r10d
cmpl %ebx, %r11d
je 0x5a9a8
movzbl (%rdi,%rbx), %r14d
leaq -0x3a(%r14), %r15
cmpq $-0xa, %r15
jb 0x5a9d4
movsbl %r14b, %r14d
imull $0xa, %r10d, %r10d
addl %r14d, %r10d
addl $-0x30, %r10d
incq %rbx
jmp 0x5a980
cmpl %ecx, %r10d
jl 0x5a9d4
cmpl %esi, %r10d
jg 0x5a9d4
testl %r8d, %r8d
je 0x5a9cf
movsbl (%rdx), %ecx
cmpl %ecx, %r8d
jne 0x5a9d4
movl %r10d, (%r9)
incq %rdx
incl %eax
movq %rdx, %rdi
jmp 0x5a8b7
movl %r10d, (%r9)
incl %eax
addq $0x48, %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: localtimeOffset
static sqlite3_int64 localtimeOffset(
  DateTime *p,                    /* Date at which to calculate offset */
  sqlite3_context *pCtx,          /* Write error here if one occurs */
  int *pRc                        /* OUT: Error code. SQLITE_OK or ERROR */
){
  DateTime x, y;
  time_t t;
  struct tm sLocal;

  /* Initialize the contents of sLocal to avoid a compiler warning. */
  memset(&sLocal, 0, sizeof(sLocal));

  x = *p;
  computeYMD_HMS(&x);
  if( x.Y<1971 || x.Y>=2038 ){
    x.Y = 2000;
    x.M = 1;
    x.D = 1;
    x.h = 0;
    x.m = 0;
    x.s = 0.0;
  } else {
    int s = (int)(x.s + 0.5);
    x.s = s;
  }
  x.tz = 0;
  x.validJD = 0;
  computeJD(&x);
  t = (time_t)(x.iJD/1000 - 21086676*(i64)10000);
  if( osLocaltime(&t, &sLocal) ){
    sqlite3_result_error(pCtx, "local time unavailable", -1);
    *pRc = SQLITE_ERROR;
    return 0;
  }
  y.Y = sLocal.tm_year + 1900;
  y.M = sLocal.tm_mon + 1;
  y.D = sLocal.tm_mday;
  y.h = sLocal.tm_hour;
  y.m = sLocal.tm_min;
  y.s = sLocal.tm_sec;
  y.validYMD = 1;
  y.validHMS = 1;
  y.validJD = 0;
  y.validTZ = 0;
  computeJD(&y);
  *pRc = SQLITE_OK;
  return y.iJD - x.iJD;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups 0x20(%rdi), %xmm2
leaq -0x50(%rbp), %r15
movaps %xmm0, (%r15)
movaps %xmm1, 0x10(%r15)
movaps %xmm2, 0x20(%r15)
movq %r15, %rdi
callq 0x5ab20
movl $0xfffff80a, %eax       # imm = 0xFFFFF80A
addl 0x8(%r15), %eax
cmpl $-0x44, %eax
ja 0x5aa3d
movapd 0x109c3(%rip), %xmm0    # 0x6b3f0
movupd %xmm0, -0x48(%rbp)
andl $0x0, -0x38(%rbp)
andq $0x0, -0x30(%rbp)
jmp 0x5aa57
movsd -0x30(%rbp), %xmm0
addsd 0x10836(%rip), %xmm0    # 0x6b280
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movlpd %xmm0, -0x30(%rbp)
andl $0x0, 0x1c(%r15)
movb $0x0, 0x2a(%r15)
movq %r15, %rdi
callq 0x5a515
movq (%r15), %r15
movl $0x3e8, %ecx            # imm = 0x3E8
movq %r15, %rax
cqto
idivq %rcx
movabsq $-0x3118a36940, %rcx    # imm = 0xFFFFFFCEE75C96C0
addq %rax, %rcx
leaq -0x58(%rbp), %rdi
movq %rcx, (%rdi)
callq 0x8280
cmpl $0x0, 0x2caff(%rip)     # 0x87598
setne %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x5aac2
leaq 0x144c6(%rip), %rsi     # 0x6ef76
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0xe1ae
pushq $0x1
popq %rcx
xorl %eax, %eax
jmp 0x5ab13
movq 0x4(%rax), %rcx
rolq $0x20, %rcx
movl 0xc(%rax), %edx
movl 0x10(%rax), %esi
movl $0x76c, %edi            # imm = 0x76C
addl 0x14(%rax), %edi
cvtsi2sdl (%rax), %xmm0
leaq -0x88(%rbp), %r14
movl %edi, 0x8(%r14)
incl %esi
movl %esi, 0xc(%r14)
movl %edx, 0x10(%r14)
movq %rcx, 0x14(%r14)
movsd %xmm0, 0x20(%r14)
movl $0x101, 0x28(%r14)      # imm = 0x101
movq %r14, %rdi
callq 0x5a515
movq (%r14), %rax
subq %r15, %rax
xorl %ecx, %ecx
movl %ecx, (%rbx)
addq $0x78, %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: computeYMD
static void computeYMD(DateTime *p){
  int Z, A, B, C, D, E, X1;
  if( p->validYMD ) return;
  if( !p->validJD ){
    p->Y = 2000;
    p->M = 1;
    p->D = 1;
  }else{
    Z = (int)((p->iJD + 43200000)/86400000);
    A = (int)((Z - 1867216.25)/36524.25);
    A = Z + 1 + A - (A/4);
    B = A + 1524;
    C = (int)((B - 122.1)/365.25);
    D = (36525*C)/100;
    E = (int)((B-D)/30.6001);
    X1 = (int)(30.6001*E);
    p->D = B - D - X1;
    p->M = E<14 ? E-1 : E-13;
    p->Y = p->M>2 ? C - 4716 : C - 4715;
  }
  p->validYMD = 1;
}

// Assembly:
cmpb $0x0, 0x28(%rdi)
je 0x5ab43
retq
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x2a(%rdi)
je 0x5ac10
movl $0x2932e00, %eax        # imm = 0x2932E00
addq (%rdi), %rax
movl $0x5265c00, %ecx        # imm = 0x5265C00
cqto
idivq %rcx
movq %rax, %rcx
cvtsi2sd %ecx, %xmm0
addsd 0x107d6(%rip), %xmm0    # 0x6b348
divsd 0x107d6(%rip), %xmm0    # 0x6b350
cvttsd2si %xmm0, %esi
movl $0xfffffffc, %r8d       # imm = 0xFFFFFFFC
movl %esi, %eax
cltd
idivl %r8d
addl %esi, %ecx
leal (%rax,%rcx), %edx
addl $0x5f5, %edx            # imm = 0x5F5
movl %ecx, %esi
cvtsi2sd %edx, %xmm0
addsd 0x107b5(%rip), %xmm0    # 0x6b358
divsd 0x107b5(%rip), %xmm0    # 0x6b360
addl %eax, %esi
cvttsd2si %xmm0, %ecx
imull $0x8ead, %ecx, %eax     # imm = 0x8EAD
movl $0xffffff9c, %r8d       # imm = 0xFFFFFF9C
cltd
idivl %r8d
addl %esi, %eax
addl $0x5f5, %eax            # imm = 0x5F5
cvtsi2sd %eax, %xmm0
movsd 0x10794(%rip), %xmm1    # 0x6b368
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %esi
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %edx
subl %edx, %eax
xorl %edx, %edx
cmpl $0xe, %esi
setl %dl
negl %edx
orl $-0xd, %edx
addl %esi, %edx
xorl %esi, %esi
cmpl $0x3, %edx
setge %sil
xorl $0xffffed95, %esi       # imm = 0xFFFFED95
addl %ecx, %esi
jmp 0x5ac1c
movl $0x1, %edx
movl $0x7d0, %esi            # imm = 0x7D0
movl %edx, %eax
movl %esi, 0x8(%rdi)
movl %edx, 0xc(%rdi)
movl %eax, 0x10(%rdi)
movb $0x1, 0x28(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: computeHMS
static void computeHMS(DateTime *p){
  int s;
  if( p->validHMS ) return;
  computeJD(p);
  s = (int)((p->iJD + 43200000) % 86400000);
  p->s = s/1000.0;
  s = (int)p->s;
  p->s -= s;
  p->h = s/3600;
  s -= p->h*3600;
  p->m = s/60;
  p->s += s - p->m*60;
  p->validHMS = 1;
}

// Assembly:
cmpb $0x0, 0x29(%rdi)
je 0x5ac32
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5a515
movl $0x2932e00, %eax        # imm = 0x2932E00
addq (%rbx), %rax
movl $0x5265c00, %ecx        # imm = 0x5265C00
cqto
idivq %rcx
cvtsi2sd %edx, %xmm0
divsd 0x106aa(%rip), %xmm0    # 0x6b308
cvttsd2si %xmm0, %ecx
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
subsd %xmm1, %xmm0
movl $0xe10, %esi            # imm = 0xE10
movl %ecx, %eax
cltd
idivl %esi
movl %eax, 0x14(%rbx)
imull $0xfffff1f0, %eax, %esi # imm = 0xFFFFF1F0
addl %ecx, %esi
pushq $0x3c
popq %rcx
movl %esi, %eax
cltd
idivl %ecx
imull $-0x3c, %eax, %ecx
addl %esi, %ecx
cvtsi2sd %ecx, %xmm1
movl %eax, 0x18(%rbx)
addsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rbx)
movb $0x1, 0x29(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: renameTableFunc
static void renameTableFunc(
  sqlite3_context *context,
  int NotUsed,
  sqlite3_value **argv
){
  unsigned char const *zSql = sqlite3_value_text(argv[0]);
  unsigned char const *zTableName = sqlite3_value_text(argv[1]);

  int token;
  Token tname;
  unsigned char const *zCsr = zSql;
  int len = 0;
  char *zRet;

  sqlite3 *db = sqlite3_context_db_handle(context);

  UNUSED_PARAMETER(NotUsed);

  /* The principle used to locate the table name in the CREATE TABLE 
  ** statement is that the table name is the first non-space token that
  ** is immediately followed by a TK_LP or TK_USING token.
  */
  if( zSql ){
    do {
      if( !*zCsr ){
        /* Ran out of input before finding an opening bracket. Return NULL. */
        return;
      }

      /* Store the token that zCsr points to in tname. */
      tname.z = (char*)zCsr;
      tname.n = len;

      /* Advance zCsr to the next token. Store that token type in 'token',
      ** and its length in 'len' (to be used next iteration of this loop).
      */
      do {
        zCsr += len;
        len = sqlite3GetToken(zCsr, &token);
      } while( token==TK_SPACE );
      assert( len>0 );
    } while( token!=TK_LP && token!=TK_USING );

    zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", ((u8*)tname.z) - zSql, zSql, 
       zTableName, tname.z+tname.n);
    sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rdi, %r12
movq (%rdx), %rdi
callq 0xdf1e
movq %rax, %rbx
movq 0x8(%r15), %rdi
callq 0xdf1e
movq %rax, -0x48(%rbp)
testq %rbx, %rbx
je 0x5ad7c
movq 0x8(%r12), %rax
movq %rax, -0x38(%rbp)
xorl %r15d, %r15d
leaq -0x2c(%rbp), %r13
movq %rbx, %r14
movq %r12, -0x40(%rbp)
cmpb $0x0, (%r14)
je 0x5ad7c
movl %r15d, %eax
movq %r14, %r12
cltq
addq %rax, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x30a47
movl -0x2c(%rbp), %ecx
cmpl $0x95, %ecx
je 0x5ad06
cmpl $0x79, %ecx
je 0x5ad33
cmpl $0x16, %ecx
je 0x5ad33
movl %eax, %r15d
movq %r12, %r14
jmp 0x5acfa
movq %r14, %rdx
subq %rbx, %rdx
movl %r15d, %r9d
addq %r14, %r9
leaq 0x142c4(%rip), %rsi     # 0x6f00a
movq -0x38(%rbp), %rdi
movq %rbx, %rcx
movq -0x48(%rbp), %r8
xorl %eax, %eax
callq 0x10594
leaq -0x519e8(%rip), %rcx    # 0x9377
pushq $-0x1
popq %rdx
movq -0x40(%rbp), %rdi
movq %rax, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe48d
addq $0x28, %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: sqlite3MemMalloc
static void *sqlite3MemMalloc(int nByte){
#ifdef SQLITE_MALLOCSIZE
  void *p = SQLITE_MALLOC( nByte );
  if( p==0 ){
    testcase( sqlite3GlobalConfig.xLog!=0 );
    sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
  }
  return p;
#else
  sqlite3_int64 *p;
  assert( nByte>0 );
  nByte = ROUND8(nByte);
  p = SQLITE_MALLOC( nByte+8 );
  if( p ){
    p[0] = nByte;
    p++;
  }else{
    testcase( sqlite3GlobalConfig.xLog!=0 );
    sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
  }
  return (void *)p;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
addl $0x7, %ebx
andl $-0x8, %ebx
leal 0x8(%rbx), %eax
movslq %eax, %rdi
callq 0x84f0
testq %rax, %rax
je 0x5b040
movq %rax, %r14
movslq %ebx, %rax
movq %rax, (%r14)
addq $0x8, %r14
jmp 0x5b056
leaq 0x13fd9(%rip), %rsi     # 0x6f020
xorl %r14d, %r14d
pushq $0x7
popq %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0xaf99
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: sqlite3MemRealloc
static void *sqlite3MemRealloc(void *pPrior, int nByte){
#ifdef SQLITE_MALLOCSIZE
  void *p = SQLITE_REALLOC(pPrior, nByte);
  if( p==0 ){
    testcase( sqlite3GlobalConfig.xLog!=0 );
    sqlite3_log(SQLITE_NOMEM,
      "failed memory resize %u to %u bytes",
      SQLITE_MALLOCSIZE(pPrior), nByte);
  }
  return p;
#else
  sqlite3_int64 *p = (sqlite3_int64*)pPrior;
  assert( pPrior!=0 && nByte>0 );
  assert( nByte==ROUND8(nByte) ); /* EV: R-46199-30249 */
  p--;
  p = SQLITE_REALLOC(p, nByte+8 );
  if( p ){
    p[0] = nByte;
    p++;
  }else{
    testcase( sqlite3GlobalConfig.xLog!=0 );
    sqlite3_log(SQLITE_NOMEM,
      "failed memory resize %u to %u bytes",
      sqlite3MemSize(pPrior), nByte);
  }
  return (void*)p;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r12
leaq -0x8(%rdi), %r15
leal 0x8(%rbx), %eax
movslq %eax, %rsi
movq %r15, %rdi
callq 0x8660
testq %rax, %rax
je 0x5b0a2
movq %rax, %r14
movslq %ebx, %rax
movq %rax, (%r14)
addq $0x8, %r14
jmp 0x5b0c4
testq %r12, %r12
je 0x5b0ac
movl (%r15), %edx
jmp 0x5b0ae
xorl %edx, %edx
leaq 0x13f91(%rip), %rsi     # 0x6f046
xorl %r14d, %r14d
pushq $0x7
popq %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0xaf99
movq %r14, %rax
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: pcache1Init
static int pcache1Init(void *NotUsed){
  UNUSED_PARAMETER(NotUsed);
  assert( pcache1.isInit==0 );
  memset(&pcache1, 0, sizeof(pcache1));
  if( sqlite3GlobalConfig.bCoreMutex ){
    pcache1.grp.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_LRU);
    pcache1.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_PMEM);
  }
  pcache1.grp.mxPinned = 10;
  pcache1.isInit = 1;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x2deb6(%rip)    # 0x88fc0
movups %xmm0, 0x2de9f(%rip)    # 0x88fb0
movups %xmm0, 0x2de88(%rip)    # 0x88fa0
movups %xmm0, 0x2de71(%rip)    # 0x88f90
movups %xmm0, 0x2de5a(%rip)    # 0x88f80
movups %xmm0, 0x2de43(%rip)    # 0x88f70
cmpl $0x0, 0x2c2d0(%rip)     # 0x87404
je 0x5b14e
movabsq $0x8, %rax
movq %rax, 0x2de29(%rip)     # 0x88f70
movq %rax, 0x2de6a(%rip)     # 0x88fb8
movl $0xa, 0x2de28(%rip)     # 0x88f80
movl $0x1, 0x2de36(%rip)     # 0x88f98
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pcache1Cachesize
static void pcache1Cachesize(sqlite3_pcache *p, int nMax){
  PCache1 *pCache = (PCache1 *)p;
  if( pCache->bPurgeable ){
    PGroup *pGroup = pCache->pGroup;
    pcache1EnterMutex(pGroup);
    pGroup->nMaxPage += (nMax - pCache->nMax);
    pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
    pCache->nMax = nMax;
    pCache->n90pct = pCache->nMax*9/10;
    pcache1EnforceMaxPage(pGroup);
    pcache1LeaveMutex(pGroup);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x0, 0x10(%rdi)
je 0x5b241
movq (%rdi), %rcx
movl %esi, %eax
subl 0x18(%rdi), %eax
addl 0x8(%rcx), %eax
movl %eax, 0x8(%rcx)
subl 0xc(%rcx), %eax
addl $0xa, %eax
movl %eax, 0x10(%rcx)
movl %esi, 0x18(%rdi)
leal (%rsi,%rsi,8), %eax
movl $0xa, %esi
xorl %edx, %edx
divl %esi
movl %eax, 0x1c(%rdi)
movq %rcx, %rdi
popq %rbp
jmp 0x5b63d
popq %rbp
retq