// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3InitCallback
SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
  InitData *pData = (InitData*)pInit;
  sqlite3 *db = pData->db;
  int iDb = pData->iDb;

  assert( argc==5 );
  UNUSED_PARAMETER2(NotUsed, argc);
  assert( sqlite3_mutex_held(db->mutex) );
  db->mDbFlags |= DBFLAG_EncodingFixed;
  pData->nInitRow++;
  if( db->mallocFailed ){
    corruptSchema(pData, argv[1], 0);
    return 1;
  }

  assert( iDb>=0 && iDb<db->nDb );
  if( argv==0 ) return 0;   /* Might happen if EMPTY_RESULT_CALLBACKS are on */
  if( argv[3]==0 ){
    corruptSchema(pData, argv[1], 0);
  }else if( sqlite3_strnicmp(argv[4],"create ",7)==0 ){
    /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
    ** But because db->init.busy is set to 1, no VDBE code is generated
    ** or executed.  All the parser does is build the internal data
    ** structures that describe the table, index, or view.
    */
    int rc;
    u8 saved_iDb = db->init.iDb;
    sqlite3_stmt *pStmt;
    TESTONLY(int rcp);            /* Return code from sqlite3_prepare() */

    assert( db->init.busy );
    db->init.iDb = iDb;
    if( sqlite3GetUInt32(argv[3], &db->init.newTnum)==0
     || (db->init.newTnum>pData->mxPage && pData->mxPage>0)
    ){
      if( sqlite3Config.bExtraSchemaChecks ){
        corruptSchema(pData, argv[1], "invalid rootpage");
      }
    }
    db->init.orphanTrigger = 0;
    db->init.azInit = argv;
    pStmt = 0;
    TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0);
    rc = db->errCode;
    assert( (rc&0xFF)==(rcp&0xFF) );
    db->init.iDb = saved_iDb;
    /* assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); */
    if( SQLITE_OK!=rc ){
      if( db->init.orphanTrigger ){
        assert( iDb==1 );
      }else{
        if( rc > pData->rc ) pData->rc = rc;
        if( rc==SQLITE_NOMEM ){
          sqlite3OomFault(db);
        }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
          corruptSchema(pData, argv[1], sqlite3_errmsg(db));
        }
      }
    }
    sqlite3_finalize(pStmt);
  }else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){
    corruptSchema(pData, argv[1], 0);
  }else{
    /* If the SQL column is blank it means this is an index that
    ** was created to be the PRIMARY KEY or to fulfill a UNIQUE
    ** constraint for a CREATE TABLE.  The index should have already
    ** been created when we processed the CREATE TABLE.  All we have
    ** to do here is record the root page number for that index.
    */
    Index *pIndex;
    pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName);
    if( pIndex==0 ){
      corruptSchema(pData, argv[1], "orphan index");
    }else
    if( sqlite3GetUInt32(argv[3],&pIndex->tnum)==0
     || pIndex->tnum<2
     || pIndex->tnum>pData->mxPage
     || sqlite3IndexHasDuplicateRootPage(pIndex)
    ){
      if( sqlite3Config.bExtraSchemaChecks ){
        corruptSchema(pData, argv[1], "invalid rootpage");
      }
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq (%rdi), %r12
movslq 0x10(%rdi), %rax
orl $0x40, 0x2c(%r12)
incl 0x1c(%rdi)
movq %rdx, %r15
cmpb $0x0, 0x61(%r12)
je 0x29dc6e
movq 0x8(%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2a559f
movl $0x1, %r14d
jmp 0x29de7b
xorl %r14d, %r14d
testq %r15, %r15
je 0x29de7b
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x29dccf
movq 0x20(%r15), %rcx
testq %rcx, %rcx
je 0x29dcd8
xorl %esi, %esi
leaq 0x13364b(%rip), %rdx    # 0x3d12e0
leaq 0x138a51(%rip), %r8     # 0x3d66ed
movzbl (%rcx,%rsi), %r9d
testq %r9, %r9
je 0x29dd4c
movzbl (%r9,%rdx), %r9d
movzbl (%rsi,%r8), %r10d
movb (%r10,%rdx), %r10b
cmpb %r10b, %r9b
jne 0x29dd58
incq %rsi
cmpq $0x7, %rsi
jne 0x29dc9c
jmp 0x29dd65
movq 0x8(%r15), %rsi
jmp 0x29de34
movq 0x8(%r15), %rsi
testq %rsi, %rsi
je 0x29de32
leaq 0x8(%r15), %r13
movq 0x20(%r12), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rdx
movq %r12, %rdi
callq 0x2a5b2b
testq %rax, %rax
je 0x29de43
movq %rax, %r12
movq 0x18(%r15), %rdi
leaq 0x58(%rax), %r15
movq %r15, %rsi
callq 0x2a56a0
testl %eax, %eax
je 0x29dd2f
movl (%r15), %eax
cmpl $0x2, %eax
jb 0x29dd2f
cmpl 0x20(%rbx), %eax
jbe 0x29de8d
cmpb $0x0, 0x21d933(%rip)    # 0x4bb669
je 0x29de7b
movq (%r13), %rsi
leaq 0x1389ae(%rip), %rdx    # 0x3d66f5
jmp 0x29de4e
movzbl (%rsi,%r8), %esi
movb (%rsi,%rdx), %r10b
xorl %r9d, %r9d
movzbl %r10b, %edx
cmpl %edx, %r9d
jne 0x29de1f
leaq 0xb0(%r12), %r14
movb 0xb4(%r12), %bpl
movb %al, 0xb4(%r12)
movq %r14, %rsi
callq 0x2a56a0
testl %eax, %eax
je 0x29dd95
movl 0x20(%rbx), %eax
cmpl %eax, (%r14)
jbe 0x29ddb1
testl %eax, %eax
je 0x29ddb1
cmpb $0x0, 0x21d8cd(%rip)    # 0x4bb669
je 0x29ddb1
movq 0x8(%r15), %rsi
leaq 0x13894c(%rip), %rdx    # 0x3d66f5
movq %rbx, %rdi
callq 0x2a559f
andb $-0x2, 0xb6(%r12)
movq %r15, 0xb8(%r12)
xorl %r14d, %r14d
leaq 0x10(%rsp), %r9
movq %r14, (%r9)
movq 0x20(%r15), %rsi
movq %r14, (%rsp)
movq %r12, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2a5710
movl 0x50(%r12), %eax
movb %bpl, 0xb4(%r12)
testl %eax, %eax
je 0x29de71
testb $0x1, 0xb6(%r12)
jne 0x29de71
cmpl 0x14(%rbx), %eax
jle 0x29de0b
movl %eax, 0x14(%rbx)
cmpl $0x9, %eax
je 0x29de71
cmpl $0x7, %eax
jne 0x29de53
movq %r12, %rdi
callq 0x278b1c
jmp 0x29de71
movq 0x8(%r15), %rsi
testq %rsi, %rsi
je 0x29de32
cmpb $0x0, (%rcx)
jne 0x29de34
jmp 0x29dce5
xorl %esi, %esi
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2a559f
jmp 0x29de7b
movq (%r13), %rsi
leaq 0x1388b8(%rip), %rdx    # 0x3d6706
movq %rbx, %rdi
jmp 0x29de3c
cmpb $0x6, %al
je 0x29de71
movq 0x8(%r15), %r15
movq %r12, %rdi
callq 0x27c968
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2a559f
movq 0x10(%rsp), %rdi
callq 0x277e46
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%r12), %rcx
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
je 0x29de7b
cmpq %r12, %rcx
je 0x29dea9
cmpl %eax, 0x58(%rcx)
je 0x29dd2f
movq 0x28(%rcx), %rcx
jmp 0x29de96