// File: /workspace/github_c_makefile_star2_O2/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 0x12b95
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, 0x749c4(%rip)     # 0x87560
je 0x12bb7
movl $0x1c4d6, %edi          # imm = 0x1C4D6
callq 0x9008
pushq $0x15
popq %rbx
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 0x12bf2
xorl %ebx, %ebx
leaq 0x544e3(%rip), %rax     # 0x670cc
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
pushq $0x1
jmp 0x12baa
movl -0x20(%rbp), %edx
cmpq $0x29, %rdx
jae 0x12e54
movq -0x10(%rbp), %rax
movq %rdx, %rcx
addq $0x8, %rcx
movl %ecx, -0x20(%rbp)
movq (%rax,%rdx), %rax
cmpl $0x20, %edx
ja 0x12e63
addq -0x10(%rbp), %rcx
addl $0x10, %edx
movl %edx, -0x20(%rbp)
jmp 0x12e6f
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x12ea6
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x12eb2
movl -0x20(%rbp), %eax
cmpq $0x29, %rax
jae 0x12ec1
movq -0x10(%rbp), %rcx
leal 0x8(%rax), %edx
movl %edx, -0x20(%rbp)
movq (%rcx,%rax), %rcx
movq %rcx, 0x748ca(%rip)     # 0x87538
cmpl $0x21, %eax
jae 0x12ed7
movq -0x10(%rbp), %rdx
movq %rax, %rcx
addq $0x10, %rcx
movl %ecx, -0x20(%rbp)
movl 0x8(%rdx,%rax), %edx
movl %edx, 0x748b1(%rip)     # 0x87540
cmpl $0x18, %eax
ja 0x12eeb
addq -0x10(%rbp), %rcx
addl $0x18, %eax
movl %eax, -0x20(%rbp)
jmp 0x12ef7
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x12f04
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x12f10
movl -0x20(%rbp), %eax
cmpq $0x29, %rax
jae 0x12f1d
movq -0x10(%rbp), %rcx
leal 0x8(%rax), %edx
movl %edx, -0x20(%rbp)
movq (%rcx,%rax), %rcx
movq %rcx, 0x74860(%rip)     # 0x87548
cmpl $0x21, %eax
jae 0x12f33
movq -0x10(%rbp), %rdx
movq %rax, %rcx
addq $0x10, %rcx
movl %ecx, -0x20(%rbp)
movl 0x8(%rdx,%rax), %edx
movl %edx, 0x74847(%rip)     # 0x87550
cmpl $0x18, %eax
ja 0x12f47
addq -0x10(%rbp), %rcx
addl $0x18, %eax
movl %eax, -0x20(%rbp)
jmp 0x12f53
cmpq $0x0, 0x7478f(%rip)     # 0x874b8
jne 0x12d30
callq 0x130a7
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x12f60
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x12f6c
cmpq $0x0, 0x746c9(%rip)     # 0x87420
jne 0x12d5e
callq 0x1308f
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x12f81
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x12f8d
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x12fc0
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x12fcc
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x12fff
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x1300b
movl -0x20(%rbp), %ecx
cmpq $0x29, %rcx
jae 0x13018
movq -0x10(%rbp), %rdx
movq %rcx, %rax
addq $0x8, %rax
movl %eax, -0x20(%rbp)
movl (%rdx,%rcx), %edx
movl %edx, 0x74639(%rip)     # 0x87418
cmpl $0x20, %ecx
ja 0x1302c
addq -0x10(%rbp), %rax
addl $0x10, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x13038
movl -0x20(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x13045
movq %rcx, %rax
addq -0x10(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x13051
movl -0x20(%rbp), %ecx
cmpq $0x29, %rcx
jae 0x1305e
movq -0x10(%rbp), %rdx
movq %rcx, %rax
addq $0x8, %rax
movl %eax, -0x20(%rbp)
movq (%rdx,%rcx), %rdx
movq %rdx, 0x7474c(%rip)     # 0x87588
cmpl $0x20, %ecx
ja 0x13074
addq -0x10(%rbp), %rax
addl $0x10, %ecx
movl %ecx, -0x20(%rbp)
jmp 0x13080
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, 0x746ab(%rip)     # 0x87530
xorl %ebx, %ebx
testq %rax, %rax
movl $0x0, %ecx
cmovgq %rax, %rcx
cmpq %rdx, %rax
cmovgq %rdx, %rcx
movq %rcx, 0x74687(%rip)     # 0x87528
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rsi
leaq 0x745ec(%rip), %rdi     # 0x874a8
jmp 0x12f76
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x74661(%rip)     # 0x87538
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x74655(%rip)     # 0x87540
movq -0x18(%rbp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, -0x18(%rbp)
movl (%rcx), %eax
movl %eax, 0x74645(%rip)     # 0x87544
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x744f8(%rip)     # 0x87410
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x74615(%rip)     # 0x87548
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x74609(%rip)     # 0x87550
movq -0x18(%rbp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, -0x18(%rbp)
movl (%rcx), %eax
movl %eax, 0x745f9(%rip)     # 0x87554
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rdi
leaq 0x74532(%rip), %rsi     # 0x874a8
pushq $0xd
popq %rcx
rep  movsq (%rsi), %es:(%rdi)
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movups 0x744b9(%rip), %xmm0    # 0x87450
movups %xmm0, 0x30(%rax)
movups 0x7449e(%rip), %xmm0    # 0x87440
movups %xmm0, 0x20(%rax)
movups 0x74483(%rip), %xmm0    # 0x87430
movups %xmm0, 0x10(%rax)
movups 0x74468(%rip), %xmm0    # 0x87420
movups %xmm0, (%rax)
jmp 0x12bab
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, 0x7446b(%rip)    # 0x87450
movups %xmm2, 0x74454(%rip)    # 0x87440
movups %xmm1, 0x7443d(%rip)    # 0x87430
movups %xmm0, 0x74426(%rip)    # 0x87420
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x743ed(%rip)     # 0x87400
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x743ec(%rip)     # 0x87418
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x743dc(%rip)     # 0x8741c
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl (%rax), %eax
movl %eax, 0x743b3(%rip)     # 0x8740c
jmp 0x12bab
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x74514(%rip)     # 0x87588
movq -0x18(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
movq %rax, 0x74506(%rip)     # 0x87590
jmp 0x12bab