// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_config
SQLITE_API int sqlite3_config(int op, ...){
  va_list ap;
  int rc = SQLITE_OK;

  /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
  ** the SQLite library is in use. */
  if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;

  va_start(ap, op);
  switch( op ){

    /* Mutex configuration options are only available in a threadsafe
    ** compile. 
    */
#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0
    case SQLITE_CONFIG_SINGLETHREAD: {
      /* Disable all mutexing */
      sqlite3GlobalConfig.bCoreMutex = 0;
      sqlite3GlobalConfig.bFullMutex = 0;
      break;
    }
    case SQLITE_CONFIG_MULTITHREAD: {
      /* Disable mutexing of database connections */
      /* Enable mutexing of core data structures */
      sqlite3GlobalConfig.bCoreMutex = 1;
      sqlite3GlobalConfig.bFullMutex = 0;
      break;
    }
    case SQLITE_CONFIG_SERIALIZED: {
      /* Enable all mutexing */
      sqlite3GlobalConfig.bCoreMutex = 1;
      sqlite3GlobalConfig.bFullMutex = 1;
      break;
    }
    case SQLITE_CONFIG_MUTEX: {
      /* Specify an alternative mutex implementation */
      sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);
      break;
    }
    case SQLITE_CONFIG_GETMUTEX: {
      /* Retrieve the current mutex implementation */
      *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;
      break;
    }
#endif


    case SQLITE_CONFIG_MALLOC: {
      /* Specify an alternative malloc implementation */
      sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*);
      break;
    }
    case SQLITE_CONFIG_GETMALLOC: {
      /* Retrieve the current malloc() implementation */
      if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
      *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
      break;
    }
    case SQLITE_CONFIG_MEMSTATUS: {
      /* Enable or disable the malloc status collection */
      sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
      break;
    }
    case SQLITE_CONFIG_SCRATCH: {
      /* Designate a buffer for scratch memory space */
      sqlite3GlobalConfig.pScratch = va_arg(ap, void*);
      sqlite3GlobalConfig.szScratch = va_arg(ap, int);
      sqlite3GlobalConfig.nScratch = va_arg(ap, int);
      break;
    }
    case SQLITE_CONFIG_PAGECACHE: {
      /* Designate a buffer for page cache memory space */
      sqlite3GlobalConfig.pPage = va_arg(ap, void*);
      sqlite3GlobalConfig.szPage = va_arg(ap, int);
      sqlite3GlobalConfig.nPage = va_arg(ap, int);
      break;
    }

    case SQLITE_CONFIG_PCACHE: {
      /* no-op */
      break;
    }
    case SQLITE_CONFIG_GETPCACHE: {
      /* now an error */
      rc = SQLITE_ERROR;
      break;
    }

    case SQLITE_CONFIG_PCACHE2: {
      /* Specify an alternative page cache implementation */
      sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*);
      break;
    }
    case SQLITE_CONFIG_GETPCACHE2: {
      if( sqlite3GlobalConfig.pcache2.xInit==0 ){
        sqlite3PCacheSetDefault();
      }
      *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;
      break;
    }

#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
    case SQLITE_CONFIG_HEAP: {
      /* Designate a buffer for heap memory space */
      sqlite3GlobalConfig.pHeap = va_arg(ap, void*);
      sqlite3GlobalConfig.nHeap = va_arg(ap, int);
      sqlite3GlobalConfig.mnReq = va_arg(ap, int);

      if( sqlite3GlobalConfig.mnReq<1 ){
        sqlite3GlobalConfig.mnReq = 1;
      }else if( sqlite3GlobalConfig.mnReq>(1<<12) ){
        /* cap min request size at 2^12 */
        sqlite3GlobalConfig.mnReq = (1<<12);
      }

      if( sqlite3GlobalConfig.pHeap==0 ){
        /* If the heap pointer is NULL, then restore the malloc implementation
        ** back to NULL pointers too.  This will cause the malloc to go
        ** back to its default implementation when sqlite3_initialize() is
        ** run.
        */
        memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m));
      }else{
        /* The heap pointer is not NULL, then install one of the
        ** mem5.c/mem3.c methods.  The enclosing #if guarantees at
        ** least one of these methods is currently enabled.
        */
#ifdef SQLITE_ENABLE_MEMSYS3
        sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3();
#endif
#ifdef SQLITE_ENABLE_MEMSYS5
        sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5();
#endif
      }
      break;
    }
#endif

    case SQLITE_CONFIG_LOOKASIDE: {
      sqlite3GlobalConfig.szLookaside = va_arg(ap, int);
      sqlite3GlobalConfig.nLookaside = va_arg(ap, int);
      break;
    }
    
    /* Record a pointer to the logger function and its first argument.
    ** The default is NULL.  Logging is disabled if the function pointer is
    ** NULL.
    */
    case SQLITE_CONFIG_LOG: {
      /* MSVC is picky about pulling func ptrs from va lists.
      ** http://support.microsoft.com/kb/47961
      ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
      */
      typedef void(*LOGFUNC_t)(void*,int,const char*);
      sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
      sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);
      break;
    }

    case SQLITE_CONFIG_URI: {
      sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
      break;
    }

    case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
      sqlite3GlobalConfig.bUseCis = va_arg(ap, int);
      break;
    }

#ifdef SQLITE_ENABLE_SQLLOG
    case SQLITE_CONFIG_SQLLOG: {
      typedef void(*SQLLOGFUNC_t)(void*, sqlite3*, const char*, int);
      sqlite3GlobalConfig.xSqllog = va_arg(ap, SQLLOGFUNC_t);
      sqlite3GlobalConfig.pSqllogArg = va_arg(ap, void *);
      break;
    }
#endif

    case SQLITE_CONFIG_MMAP_SIZE: {
      sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64);
      sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);
      if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ){
        mxMmap = SQLITE_MAX_MMAP_SIZE;
      }
      sqlite3GlobalConfig.mxMmap = mxMmap;
      if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE;
      if( szMmap>mxMmap) szMmap = mxMmap;
      sqlite3GlobalConfig.szMmap = szMmap;
      break;
    }

    default: {
      rc = SQLITE_ERROR;
      break;
    }
  }
  va_end(ap);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xc8, %rsp
movq %rsi, -0xc8(%rbp)
movq %rdx, -0xc0(%rbp)
movq %rcx, -0xb8(%rbp)
movq %r8, -0xb0(%rbp)
movq %r9, -0xa8(%rbp)
testb %al, %al
je 0x144ad
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
cmpl $0x0, 0x800ac(%rip)     # 0x94560
je 0x144e6
leaq 0x68f27(%rip), %rsi     # 0x7d3e4
leaq 0x65075(%rip), %rcx     # 0x79539
movl $0x15, %ebx
movl $0x15, %edi
movl $0x1c4d6, %edx          # imm = 0x1C4D6
xorl %eax, %eax
callq 0xb8cc
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %rbp
retq
leaq -0xd0(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, -0x20(%rbp)
addl $-0x4, %edi
cmpl $0x12, %edi
ja 0x14521
xorl %ebx, %ebx
leaq 0x60bb4(%rip), %rax     # 0x750cc
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x1, %ebx
jmp 0x144da
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x146d6
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x146e2
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14740
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x1474c
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x1475b
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14767
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x147ce
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x147da
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x147e7
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x147f3
cmpq $0x0, 0x7feed(%rip)     # 0x944b8
jne 0x145e0
leaq 0x7f1bc(%rip), %rsi     # 0x93790
movl $0x12, %edi
xorl %eax, %eax
callq 0x14454
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x1485a
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14866
cmpq $0x0, 0x7fe19(%rip)     # 0x94420
jne 0x1461c
leaq 0x7f140(%rip), %rsi     # 0x93750
movl $0x4, %edi
xorl %eax, %eax
callq 0x14454
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x1487d
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14889
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x148bc
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x148c8
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x148fb
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14907
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14914
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14920
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14959
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14965
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14972
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x1497e
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movl -0x20(%rbp), %edx
cmpq $0x28, %rdx
ja 0x146fd
movq %rdx, %rcx
addq -0x10(%rbp), %rcx
addl $0x8, %edx
movl %edx, -0x20(%rbp)
jmp 0x14709
movq -0x18(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x18(%rbp)
movq (%rcx), %rcx
movl $0x7fff0000, %edx       # imm = 0x7FFF0000
cmpq %rdx, %rcx
cmovbq %rcx, %rdx
movq %rdx, 0x7fe11(%rip)     # 0x94530
xorl %ebx, %ebx
testq %rax, %rax
movl $0x0, %ecx
cmovgq %rax, %rcx
cmpq %rdx, %rax
cmovgq %rdx, %rcx
movq %rcx, 0x7fded(%rip)     # 0x94528
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rsi
leaq 0x7fd52(%rip), %rdi     # 0x944a8
jmp 0x14870
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x7fdc7(%rip)     # 0x94538
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14789
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14795
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fda3(%rip)     # 0x94540
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x147b5
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x147c1
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fd7b(%rip)     # 0x94544
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fc2e(%rip)     # 0x94410
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x7fd4b(%rip)     # 0x94548
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14815
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14821
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fd27(%rip)     # 0x94550
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14841
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x1484d
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fcff(%rip)     # 0x94554
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rdi
leaq 0x7fc38(%rip), %rsi     # 0x944a8
movl $0xd, %ecx
rep  movsq (%rsi), %es:(%rdi)
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movups 0x7fbbd(%rip), %xmm0    # 0x94450
movups %xmm0, 0x30(%rax)
movups 0x7fba2(%rip), %xmm0    # 0x94440
movups %xmm0, 0x20(%rax)
movups 0x7fb87(%rip), %xmm0    # 0x94430
movups %xmm0, 0x10(%rax)
movups 0x7fb6c(%rip), %xmm0    # 0x94420
movups %xmm0, (%rax)
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movups %xmm3, 0x7fb6f(%rip)    # 0x94450
movups %xmm2, 0x7fb58(%rip)    # 0x94440
movups %xmm1, 0x7fb41(%rip)    # 0x94430
movups %xmm0, 0x7fb2a(%rip)    # 0x94420
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7faf1(%rip)     # 0x94400
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7faf0(%rip)     # 0x94418
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14940
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x1494c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fac8(%rip)     # 0x9441c
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fa9f(%rip)     # 0x9440c
jmp 0x144da
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x7fc00(%rip)     # 0x94588
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x149a0
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x149ac
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x7fbda(%rip)     # 0x94590
jmp 0x144da