// File: /workspace/github_c_makefile_star2_O1/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), %rbp
orl $0x40, 0x2c(%r12)
incl 0x1c(%rdi)
movq %rdx, %r15
cmpb $0x0, 0x61(%r12)
je 0x2a74c2
movq 0x8(%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2af10a
movl $0x1, %r14d
jmp 0x2a76be
xorl %r14d, %r14d
testq %r15, %r15
je 0x2a76be
movq 0x18(%r15), %r13
testq %r13, %r13
je 0x2a75a8
movq 0x20(%r15), %rdi
leaq 0x138954(%rip), %rsi    # 0x3dfe3a
movq %rdi, 0x8(%rsp)
movl $0x7, %edx
callq 0x27e951
testl %eax, %eax
je 0x2a75be
movq 0x8(%r15), %rsi
testq %rsi, %rsi
movq 0x8(%rsp), %rax
je 0x2a75ac
testq %rax, %rax
je 0x2a751d
cmpb $0x0, (%rax)
jne 0x2a75ac
movq 0x20(%r12), %rax
shlq $0x5, %rbp
movq (%rax,%rbp), %rdx
movq %r12, %rdi
callq 0x2af701
testq %rax, %rax
je 0x2a7683
movq %rax, %r12
movq 0x18(%r15), %rdi
leaq 0x58(%rax), %r13
movq %r13, %rsi
callq 0x2af20b
testl %eax, %eax
je 0x2a76d6
movl (%r13), %eax
cmpl $0x2, %eax
jb 0x2a76d6
cmpl 0x20(%rbx), %eax
ja 0x2a76d6
movq 0x18(%r12), %rcx
movq 0x10(%rcx), %rcx
xorl %r14d, %r14d
testq %rcx, %rcx
je 0x2a76d0
cmpl %eax, 0x58(%rcx)
sete %sil
cmpq %r12, %rcx
setne %dl
andb %sil, %dl
cmpb $0x1, %dl
je 0x2a76d2
movq 0x28(%rcx), %rcx
testq %rcx, %rcx
jne 0x2a7581
jmp 0x2a76d2
movq 0x8(%r15), %rsi
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2af10a
jmp 0x2a76be
leaq 0xb0(%r12), %r14
movb 0xb4(%r12), %al
movb %al, 0x8(%rsp)
movb %bpl, 0xb4(%r12)
movq %r13, %rdi
movq %r14, %rsi
callq 0x2af20b
testl %eax, %eax
je 0x2a75f5
movl 0x20(%rbx), %eax
cmpl %eax, (%r14)
jbe 0x2a7611
testl %eax, %eax
je 0x2a7611
cmpb $0x0, 0x21f06d(%rip)    # 0x4c6669
je 0x2a7611
movq 0x8(%r15), %rsi
leaq 0x138839(%rip), %rdx    # 0x3dfe42
movq %rbx, %rdi
callq 0x2af10a
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 0x2af27d
movl 0x50(%r12), %eax
movb 0x8(%rsp), %cl
movb %cl, 0xb4(%r12)
testl %eax, %eax
je 0x2a76b4
testb $0x1, 0xb6(%r12)
jne 0x2a76b4
cmpl 0x14(%rbx), %eax
jle 0x2a766f
movl %eax, 0x14(%rbx)
cmpl $0x9, %eax
je 0x2a76b4
cmpl $0x7, %eax
jne 0x2a7696
movq %r12, %rdi
callq 0x2824bb
jmp 0x2a76b4
movq 0x8(%r15), %rsi
leaq 0x1387c5(%rip), %rdx    # 0x3dfe53
movq %rbx, %rdi
jmp 0x2a75b4
cmpb $0x6, %al
je 0x2a76b4
movq 0x8(%r15), %r15
movq %r12, %rdi
callq 0x286451
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2af10a
movq 0x10(%rsp), %rdi
callq 0x2817e7
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edx, %edx
testb %dl, %dl
je 0x2a76be
cmpb $0x0, 0x21ef8c(%rip)    # 0x4c6669
je 0x2a76be
movq 0x8(%r15), %rsi
leaq 0x138758(%rip), %rdx    # 0x3dfe42
movq %rbx, %rdi
callq 0x2af10a
xorl %r14d, %r14d
jmp 0x2a76be