// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_test_control
SQLITE_API int sqlite3_test_control(int op, ...){
  int rc = 0;
#ifndef SQLITE_OMIT_BUILTIN_TEST
  va_list ap;
  va_start(ap, op);
  switch( op ){

    /*
    ** Save the current state of the PRNG.
    */
    case SQLITE_TESTCTRL_PRNG_SAVE: {
      sqlite3PrngSaveState();
      break;
    }

    /*
    ** Restore the state of the PRNG to the last state saved using
    ** PRNG_SAVE.  If PRNG_SAVE has never before been called, then
    ** this verb acts like PRNG_RESET.
    */
    case SQLITE_TESTCTRL_PRNG_RESTORE: {
      sqlite3PrngRestoreState();
      break;
    }

    /*
    ** Reset the PRNG back to its uninitialized state.  The next call
    ** to sqlite3_randomness() will reseed the PRNG using a single call
    ** to the xRandomness method of the default VFS.
    */
    case SQLITE_TESTCTRL_PRNG_RESET: {
      sqlite3PrngResetState();
      break;
    }

    /*
    **  sqlite3_test_control(BITVEC_TEST, size, program)
    **
    ** Run a test against a Bitvec object of size.  The program argument
    ** is an array of integers that defines the test.  Return -1 on a
    ** memory allocation error, 0 on success, or non-zero for an error.
    ** See the sqlite3BitvecBuiltinTest() for additional information.
    */
    case SQLITE_TESTCTRL_BITVEC_TEST: {
      int sz = va_arg(ap, int);
      int *aProg = va_arg(ap, int*);
      rc = sqlite3BitvecBuiltinTest(sz, aProg);
      break;
    }

    /*
    **  sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd)
    **
    ** Register hooks to call to indicate which malloc() failures 
    ** are benign.
    */
    case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: {
      typedef void (*void_function)(void);
      void_function xBenignBegin;
      void_function xBenignEnd;
      xBenignBegin = va_arg(ap, void_function);
      xBenignEnd = va_arg(ap, void_function);
      sqlite3BenignMallocHooks(xBenignBegin, xBenignEnd);
      break;
    }

    /*
    **  sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X)
    **
    ** Set the PENDING byte to the value in the argument, if X>0.
    ** Make no changes if X==0.  Return the value of the pending byte
    ** as it existing before this routine was called.
    **
    ** IMPORTANT:  Changing the PENDING byte from 0x40000000 results in
    ** an incompatible database file format.  Changing the PENDING byte
    ** while any database connection is open results in undefined and
    ** dileterious behavior.
    */
    case SQLITE_TESTCTRL_PENDING_BYTE: {
      rc = PENDING_BYTE;
#ifndef SQLITE_OMIT_WSD
      {
        unsigned int newVal = va_arg(ap, unsigned int);
        if( newVal ) sqlite3PendingByte = newVal;
      }
#endif
      break;
    }

    /*
    **  sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X)
    **
    ** This action provides a run-time test to see whether or not
    ** assert() was enabled at compile-time.  If X is true and assert()
    ** is enabled, then the return value is true.  If X is true and
    ** assert() is disabled, then the return value is zero.  If X is
    ** false and assert() is enabled, then the assertion fires and the
    ** process aborts.  If X is false and assert() is disabled, then the
    ** return value is zero.
    */
    case SQLITE_TESTCTRL_ASSERT: {
      volatile int x = 0;
      assert( (x = va_arg(ap,int))!=0 );
      rc = x;
      break;
    }


    /*
    **  sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X)
    **
    ** This action provides a run-time test to see how the ALWAYS and
    ** NEVER macros were defined at compile-time.
    **
    ** The return value is ALWAYS(X).  
    **
    ** The recommended test is X==2.  If the return value is 2, that means
    ** ALWAYS() and NEVER() are both no-op pass-through macros, which is the
    ** default setting.  If the return value is 1, then ALWAYS() is either
    ** hard-coded to true or else it asserts if its argument is false.
    ** The first behavior (hard-coded to true) is the case if
    ** SQLITE_TESTCTRL_ASSERT shows that assert() is disabled and the second
    ** behavior (assert if the argument to ALWAYS() is false) is the case if
    ** SQLITE_TESTCTRL_ASSERT shows that assert() is enabled.
    **
    ** The run-time test procedure might look something like this:
    **
    **    if( sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){
    **      // ALWAYS() and NEVER() are no-op pass-through macros
    **    }else if( sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){
    **      // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false.
    **    }else{
    **      // ALWAYS(x) is a constant 1.  NEVER(x) is a constant 0.
    **    }
    */
    case SQLITE_TESTCTRL_ALWAYS: {
      int x = va_arg(ap,int);
      rc = ALWAYS(x);
      break;
    }

    /*   sqlite3_test_control(SQLITE_TESTCTRL_RESERVE, sqlite3 *db, int N)
    **
    ** Set the nReserve size to N for the main database on the database
    ** connection db.
    */
    case SQLITE_TESTCTRL_RESERVE: {
      sqlite3 *db = va_arg(ap, sqlite3*);
      int x = va_arg(ap,int);
      sqlite3_mutex_enter(db->mutex);
      sqlite3BtreeSetPageSize(db->aDb[0].pBt, 0, x, 0);
      sqlite3_mutex_leave(db->mutex);
      break;
    }

    /*  sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N)
    **
    ** Enable or disable various optimizations for testing purposes.  The 
    ** argument N is a bitmask of optimizations to be disabled.  For normal
    ** operation N should be 0.  The idea is that a test program (like the
    ** SQL Logic Test or SLT test module) can run the same SQL multiple times
    ** with various optimizations disabled to verify that the same answer
    ** is obtained in every case.
    */
    case SQLITE_TESTCTRL_OPTIMIZATIONS: {
      sqlite3 *db = va_arg(ap, sqlite3*);
      db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);
      break;
    }

#ifdef SQLITE_N_KEYWORD
    /* sqlite3_test_control(SQLITE_TESTCTRL_ISKEYWORD, const char *zWord)
    **
    ** If zWord is a keyword recognized by the parser, then return the
    ** number of keywords.  Or if zWord is not a keyword, return 0.
    ** 
    ** This test feature is only available in the amalgamation since
    ** the SQLITE_N_KEYWORD macro is not defined in this file if SQLite
    ** is built using separate source files.
    */
    case SQLITE_TESTCTRL_ISKEYWORD: {
      const char *zWord = va_arg(ap, const char*);
      int n = sqlite3Strlen30(zWord);
      rc = (sqlite3KeywordCode((u8*)zWord, n)!=TK_ID) ? SQLITE_N_KEYWORD : 0;
      break;
    }
#endif 

    /* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree);
    **
    ** Pass pFree into sqlite3ScratchFree(). 
    ** If sz>0 then allocate a scratch buffer into pNew.  
    */
    case SQLITE_TESTCTRL_SCRATCHMALLOC: {
      void *pFree, **ppNew;
      int sz;
      sz = va_arg(ap, int);
      ppNew = va_arg(ap, void**);
      pFree = va_arg(ap, void*);
      if( sz ) *ppNew = sqlite3ScratchMalloc(sz);
      sqlite3ScratchFree(pFree);
      break;
    }

    /*   sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
    **
    ** If parameter onoff is non-zero, configure the wrappers so that all
    ** subsequent calls to localtime() and variants fail. If onoff is zero,
    ** undo this setting.
    */
    case SQLITE_TESTCTRL_LOCALTIME_FAULT: {
      sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int);
      break;
    }

#if defined(SQLITE_ENABLE_TREE_EXPLAIN)
    /*   sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT,
    **                        sqlite3_stmt*,const char**);
    **
    ** If compiled with SQLITE_ENABLE_TREE_EXPLAIN, each sqlite3_stmt holds
    ** a string that describes the optimized parse tree.  This test-control
    ** returns a pointer to that string.
    */
    case SQLITE_TESTCTRL_EXPLAIN_STMT: {
      sqlite3_stmt *pStmt = va_arg(ap, sqlite3_stmt*);
      const char **pzRet = va_arg(ap, const char**);
      *pzRet = sqlite3VdbeExplanation((Vdbe*)pStmt);
      break;
    }
#endif

  }
  va_end(ap);
#endif /* SQLITE_OMIT_BUILTIN_TEST */
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
leaq -0x110(%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 0x1663c
movaps %xmm0, -0xe0(%rbp)
movaps %xmm1, -0xd0(%rbp)
movaps %xmm2, -0xc0(%rbp)
movaps %xmm3, -0xb0(%rbp)
movaps %xmm4, -0xa0(%rbp)
movaps %xmm5, -0x90(%rbp)
movaps %xmm6, -0x80(%rbp)
movaps %xmm7, -0x70(%rbp)
movq %r10, -0x30(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, -0x40(%rbp)
xorl %r12d, %r12d
addl $-0x5, %edi
cmpl $0xd, %edi
ja 0x16c24
leaq 0x5eaac(%rip), %rax     # 0x75118
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x7f96c(%rip), %rdi     # 0x95fe8
leaq 0x7f6ed(%rip), %rsi     # 0x95d70
jmp 0x1675c
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x167d8
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x167e4
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x16823
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x1682f
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x1686c
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x16878
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x16885
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x16891
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x168ad
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x168b9
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x16922
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x1692e
movb $0x0, 0x7f627(%rip)     # 0x95d70
jmp 0x16c24
leaq 0x7f61b(%rip), %rdi     # 0x95d70
leaq 0x7f88c(%rip), %rsi     # 0x95fe8
movl $0x103, %edx            # imm = 0x103
callq 0x82f0
jmp 0x16c24
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %r12d
jmp 0x16c24
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x169bf
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x169cb
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x169d3
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x169df
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x16a12
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x16a1e
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %rdi
xorl %ebx, %ebx
movl $0x0, %esi
testq %rdi, %rdi
je 0x1680c
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rdi, %rax
incl %esi
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x167fb
andl $0x3fffffff, %esi       # imm = 0x3FFFFFFF
callq 0x35e68
cmpl $0x1a, %eax
movl $0x79, %r12d
cmovel %ebx, %r12d
jmp 0x16c24
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %rax
movl -0x40(%rbp), %edx
cmpq $0x28, %rdx
ja 0x1684a
movq %rdx, %rcx
addq -0x30(%rbp), %rcx
addl $0x8, %edx
movl %edx, -0x40(%rbp)
jmp 0x16856
movq -0x38(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x38(%rbp)
movq (%rcx), %rcx
movq %rax, 0x7f700(%rip)     # 0x95f60
movq %rcx, 0x7f701(%rip)     # 0x95f68
jmp 0x16c24
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movl (%rax), %eax
movl %eax, 0x7dd18(%rip)     # 0x94598
jmp 0x16c24
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movl 0x7dfa8(%rip), %r12d    # 0x94840
movl (%rax), %eax
testl %eax, %eax
je 0x16c24
movl %eax, 0x7df98(%rip)     # 0x94840
jmp 0x16c24
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movl (%rax), %edi
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x168d3
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x168df
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %rbx
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x168fa
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x16906
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %r14
testl %edi, %edi
je 0x16915
callq 0x16cce
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x16d96
jmp 0x16c24
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movl (%rax), %ebx
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x16948
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x16954
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %r13
movl $0x200, %edi            # imm = 0x200
callq 0xa2a2
movq %rax, %r14
testq %rax, %rax
je 0x1697b
movl $0x200, %edx            # imm = 0x200
movq %r14, %rdi
xorl %esi, %esi
callq 0x8200
movl %ebx, (%r14)
leal 0x7(%rbx), %eax
movq %rbx, -0x60(%rbp)
addl $0xe, %ebx
testl %eax, %eax
cmovnsl %eax, %ebx
sarl $0x3, %ebx
incl %ebx
movl %ebx, %edi
callq 0xa2a2
movq %rax, %r15
testq %rax, %rax
je 0x169ab
movslq %ebx, %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x8200
callq 0x9d1f
testl %eax, %eax
je 0x16a60
xorl %edi, %edi
jmp 0x16a6d
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movl (%rax), %r12d
jmp 0x16c24
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %rax
movl -0x40(%rbp), %edx
cmpq $0x28, %rdx
ja 0x169fa
movq %rdx, %rcx
addq -0x30(%rbp), %rcx
addl $0x8, %edx
movl %edx, -0x40(%rbp)
jmp 0x16a06
movq -0x38(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x38(%rbp)
movzwl (%rcx), %ecx
movw %cx, 0x4c(%rax)
jmp 0x16c24
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %rax
movl -0x40(%rbp), %edx
cmpq $0x28, %rdx
ja 0x16a39
movq %rdx, %rcx
addq -0x30(%rbp), %rcx
addl $0x8, %edx
movl %edx, -0x40(%rbp)
jmp 0x16a45
movq -0x38(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x38(%rbp)
movl (%rcx), %edx
movq 0x20(%rax), %rax
movq 0x8(%rax), %rdi
xorl %r12d, %r12d
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x16c39
jmp 0x16c24
movl $0x200, %edi            # imm = 0x200
callq 0xa2a2
movq %rax, %rdi
testq %r15, %r15
sete %al
testq %r14, %r14
sete %cl
testq %rdi, %rdi
sete %dl
orb %cl, %dl
orb %al, %dl
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jne 0x16c0f
movq %rdi, -0x58(%rbp)
movq %r14, -0x50(%rbp)
xorl %ebx, %ebx
movl %ebx, %r12d
movl (%r13,%r12,4), %r14d
leal -0x1(%r14), %eax
cmpl $0x2, %eax
jb 0x16ace
cmpl $0x5, %r14d
je 0x16ace
testl %r14d, %r14d
je 0x16b82
movl $0x4, %edi
leaq -0x44(%rbp), %rsi
callq 0xb9d9
movl $0x2, %ebx
jmp 0x16ae8
movl 0x8(%r13,%r12,4), %eax
leal -0x1(%rax), %ecx
movl %ecx, -0x44(%rbp)
addl 0xc(%r13,%r12,4), %eax
movl %eax, 0x8(%r13,%r12,4)
movl $0x4, %ebx
movl 0x4(%r13,%r12,4), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x4(%r13,%r12,4)
cmpl $0x2, %eax
movl $0x0, %eax
cmovgel %eax, %ebx
addl %r12d, %ebx
movl -0x44(%rbp), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
xorl %edx, %edx
idivl -0x60(%rbp)
movl %edx, -0x44(%rbp)
incl %edx
movl %edx, %ecx
andb $0x7, %cl
movl $0x1, %eax
shll %cl, %eax
movl %edx, %ecx
shrl $0x3, %ecx
movb (%r15,%rcx), %sil
testb $0x1, %r14b
jne 0x16b4f
notb %al
andb %al, %sil
movb %sil, (%r15,%rcx)
movq -0x50(%rbp), %rdi
movl %edx, %esi
movq -0x58(%rbp), %rdx
callq 0x22ea6
jmp 0x16a99
orb %al, %sil
movb %sil, (%r15,%rcx)
cmpl $0x5, %r14d
je 0x16a99
movq -0x50(%rbp), %rdi
movl %edx, %esi
callq 0x1b642
testl %eax, %eax
je 0x16a99
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq -0x50(%rbp), %r14
jmp 0x16c0b
movq -0x60(%rbp), %rbx
leal 0x1(%rbx), %esi
movq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x1b2c2
movl %eax, %r12d
movq %r14, %rdi
xorl %esi, %esi
callq 0x1b2c2
subl %ebx, %r12d
addl %eax, %r12d
addl (%r14), %r12d
testl %ebx, %ebx
jle 0x16bf8
negl %ebx
movl $0x1, %r13d
movq %rbx, %r14
movl %r13d, %eax
shrl $0x3, %eax
movzbl (%r15,%rax), %eax
movl %r13d, %ecx
andl $0x7, %ecx
xorl %ebx, %ebx
btl %ecx, %eax
setb %bl
movq -0x50(%rbp), %rdi
movl %r13d, %esi
callq 0x1b2c2
cmpl %eax, %ebx
jne 0x16c00
movl %r13d, %eax
incl %r13d
movq %r14, %rbx
addl %r14d, %eax
incl %eax
cmpl $0x1, %eax
jne 0x16bb7
jmp 0x16c03
movl $0x1, %r13d
jmp 0x16c07
movl %r13d, %r12d
movq -0x50(%rbp), %r14
movl %r13d, -0x44(%rbp)
movq -0x58(%rbp), %rdi
callq 0xa2e8
movq %r15, %rdi
callq 0xa2e8
movq %r14, %rdi
callq 0x1df1e
movl %r12d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq