// File: /workspace/github_c_makefile_star2_O3/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 0x1444f
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, 0x8010a(%rip)     # 0x94560
je 0x14488
leaq 0x68f85(%rip), %rsi     # 0x7d3e4
leaq 0x650d3(%rip), %rcx     # 0x79539
movl $0x15, %ebx
movl $0x15, %edi
movl $0x1c4d6, %edx          # imm = 0x1C4D6
xorl %eax, %eax
callq 0xb9c7
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 0x144c3
xorl %ebx, %ebx
leaq 0x60c56(%rip), %rax     # 0x75110
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x1, %ebx
jmp 0x1447c
movl -0x20(%rbp), %edx
cmpq $0x29, %rdx
jae 0x14744
movq -0x10(%rbp), %rax
movq %rdx, %rcx
addq $0x8, %rcx
movl %ecx, -0x20(%rbp)
movq (%rax,%rdx), %rax
cmpl $0x20, %edx
ja 0x14753
addq -0x10(%rbp), %rcx
addl $0x10, %edx
movl %edx, -0x20(%rbp)
jmp 0x1475f
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14796
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x147a2
movl -0x20(%rbp), %eax
cmpq $0x29, %rax
jae 0x147b1
movq -0x10(%rbp), %rcx
leal 0x8(%rax), %edx
movl %edx, -0x20(%rbp)
movq (%rcx,%rax), %rcx
movq %rcx, 0x7fff6(%rip)     # 0x94538
cmpl $0x21, %eax
jae 0x147c7
movq -0x10(%rbp), %rdx
movq %rax, %rcx
addq $0x10, %rcx
movl %ecx, -0x20(%rbp)
movl 0x8(%rdx,%rax), %edx
movl %edx, 0x7ffdd(%rip)     # 0x94540
cmpl $0x18, %eax
ja 0x147db
addq -0x10(%rbp), %rcx
addl $0x18, %eax
movl %eax, -0x20(%rbp)
jmp 0x147e7
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x147f4
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14800
movl -0x20(%rbp), %eax
cmpq $0x29, %rax
jae 0x1480d
movq -0x10(%rbp), %rcx
leal 0x8(%rax), %edx
movl %edx, -0x20(%rbp)
movq (%rcx,%rax), %rcx
movq %rcx, 0x7ff8c(%rip)     # 0x94548
cmpl $0x21, %eax
jae 0x14823
movq -0x10(%rbp), %rdx
movq %rax, %rcx
addq $0x10, %rcx
movl %ecx, -0x20(%rbp)
movl 0x8(%rdx,%rax), %edx
movl %edx, 0x7ff73(%rip)     # 0x94550
cmpl $0x18, %eax
ja 0x14837
addq -0x10(%rbp), %rcx
addl $0x18, %eax
movl %eax, -0x20(%rbp)
jmp 0x14843
cmpq $0x0, 0x7febb(%rip)     # 0x944b8
jne 0x14612
leaq 0x7f18a(%rip), %rsi     # 0x93790
movl $0x12, %edi
xorl %eax, %eax
callq 0x143f6
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14850
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x1485c
cmpq $0x0, 0x7fde7(%rip)     # 0x94420
jne 0x1464e
leaq 0x7f10e(%rip), %rsi     # 0x93750
movl $0x4, %edi
xorl %eax, %eax
callq 0x143f6
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14873
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x1487f
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x148b2
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x148be
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x148f1
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x148fd
movl -0x20(%rbp), %ecx
cmpq $0x29, %rcx
jae 0x1490a
movq -0x10(%rbp), %rdx
movq %rcx, %rax
addq $0x8, %rax
movl %eax, -0x20(%rbp)
movl (%rdx,%rcx), %edx
movl %edx, 0x7fd49(%rip)     # 0x94418
cmpl $0x20, %ecx
ja 0x1491e
addq -0x10(%rbp), %rax
addl $0x10, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x1492a
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x14937
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14943
movl -0x20(%rbp), %ecx
cmpq $0x29, %rcx
jae 0x14950
movq -0x10(%rbp), %rdx
movq %rcx, %rax
addq $0x8, %rax
movl %eax, -0x20(%rbp)
movq (%rdx,%rcx), %rdx
movq %rdx, 0x7fe5c(%rip)     # 0x94588
cmpl $0x20, %ecx
ja 0x14966
addq -0x10(%rbp), %rax
addl $0x10, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x14972
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
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, 0x7fdbb(%rip)     # 0x94530
xorl %ebx, %ebx
testq %rax, %rax
movl $0x0, %ecx
cmovgq %rax, %rcx
cmpq %rdx, %rax
cmovgq %rdx, %rcx
movq %rcx, 0x7fd97(%rip)     # 0x94528
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rsi
leaq 0x7fcfc(%rip), %rdi     # 0x944a8
jmp 0x14866
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x7fd71(%rip)     # 0x94538
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fd65(%rip)     # 0x94540
movq -0x18(%rbp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, -0x18(%rbp)
movl (%rcx), %eax
movl %eax, 0x7fd55(%rip)     # 0x94544
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fc08(%rip)     # 0x94410
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x7fd25(%rip)     # 0x94548
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fd19(%rip)     # 0x94550
movq -0x18(%rbp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, -0x18(%rbp)
movl (%rcx), %eax
movl %eax, 0x7fd09(%rip)     # 0x94554
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rdi
leaq 0x7fc42(%rip), %rsi     # 0x944a8
movl $0xd, %ecx
rep  movsq (%rsi), %es:(%rdi)
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movups 0x7fbc7(%rip), %xmm0    # 0x94450
movups %xmm0, 0x30(%rax)
movups 0x7fbac(%rip), %xmm0    # 0x94440
movups %xmm0, 0x20(%rax)
movups 0x7fb91(%rip), %xmm0    # 0x94430
movups %xmm0, 0x10(%rax)
movups 0x7fb76(%rip), %xmm0    # 0x94420
movups %xmm0, (%rax)
jmp 0x1447c
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, 0x7fb79(%rip)    # 0x94450
movups %xmm2, 0x7fb62(%rip)    # 0x94440
movups %xmm1, 0x7fb4b(%rip)    # 0x94430
movups %xmm0, 0x7fb34(%rip)    # 0x94420
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fafb(%rip)     # 0x94400
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fafa(%rip)     # 0x94418
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7faea(%rip)     # 0x9441c
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x7fac1(%rip)     # 0x9440c
jmp 0x1447c
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x7fc22(%rip)     # 0x94588
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x7fc14(%rip)     # 0x94590
jmp 0x1447c