// File: /workspace/github_c_makefile_star2_O2/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 0x24448f
movq 0x8(%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x24abdb
pushq $0x1
popq %r14
jmp 0x244666
xorl %r14d, %r14d
testq %r15, %r15
je 0x244666
movq 0x18(%r15), %r13
testq %r13, %r13
je 0x244550
movq 0x20(%r15), %rdi
leaq 0x13265a(%rip), %rsi    # 0x376b0d
pushq $0x7
popq %rdx
movq %rdi, 0x8(%rsp)
callq 0x2217ad
testl %eax, %eax
je 0x244566
movq 0x8(%r15), %rsi
testq %rsi, %rsi
movq 0x8(%rsp), %rax
je 0x244554
testq %rax, %rax
je 0x2444e0
cmpb $0x0, (%rax)
jne 0x244554
movq 0x20(%r12), %rax
shlq $0x5, %rbp
movq (%rax,%rbp), %rdx
movq %r12, %rdi
callq 0x24b089
testq %rax, %rax
je 0x24462b
movq %rax, %r12
movq 0x18(%r15), %rdi
leaq 0x58(%rax), %r13
movq %r13, %rsi
callq 0x24ac8c
testl %eax, %eax
je 0x244533
movl (%r13), %eax
cmpl $0x2, %eax
jb 0x244533
cmpl 0x20(%rbx), %eax
ja 0x244533
movq %r12, %rdi
callq 0x24b105
testl %eax, %eax
je 0x244666
cmpb $0x0, 0x1f60df(%rip)    # 0x43a619
je 0x244666
movq 0x8(%r15), %rsi
leaq 0x1325ca(%rip), %rdx    # 0x376b15
jmp 0x244636
movq 0x8(%r15), %rsi
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x24abdb
jmp 0x244666
leaq 0xb0(%r12), %r14
movb 0xb4(%r12), %al
movb %al, 0x8(%rsp)
movb %bpl, 0xb4(%r12)
movq %r13, %rdi
movq %r14, %rsi
callq 0x24ac8c
testl %eax, %eax
je 0x24459d
movl 0x20(%rbx), %eax
cmpl %eax, (%r14)
jbe 0x2445b9
testl %eax, %eax
je 0x2445b9
cmpb $0x0, 0x1f6075(%rip)    # 0x43a619
je 0x2445b9
movq 0x8(%r15), %rsi
leaq 0x132564(%rip), %rdx    # 0x376b15
movq %rbx, %rdi
callq 0x24abdb
andb $-0x2, 0xb6(%r12)
movq %r15, 0xb8(%r12)
leaq 0x10(%rsp), %r9
andq $0x0, (%r9)
movq 0x20(%r15), %rsi
andq $0x0, (%rsp)
xorl %r14d, %r14d
pushq $-0x1
popq %rdx
movq %r12, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x24ace4
movl 0x50(%r12), %eax
movb 0x8(%rsp), %cl
movb %cl, 0xb4(%r12)
testl %eax, %eax
je 0x24465c
testb $0x1, 0xb6(%r12)
jne 0x24465c
cmpl 0x14(%rbx), %eax
jle 0x244617
movl %eax, 0x14(%rbx)
cmpl $0x9, %eax
je 0x24465c
cmpl $0x7, %eax
jne 0x24463e
movq %r12, %rdi
callq 0x224bb1
jmp 0x24465c
movq 0x8(%r15), %rsi
leaq 0x1324f0(%rip), %rdx    # 0x376b26
movq %rbx, %rdi
jmp 0x24455c
cmpb $0x6, %al
je 0x24465c
movq 0x8(%r15), %r15
movq %r12, %rdi
callq 0x2280b1
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x24abdb
movq 0x10(%rsp), %rdi
callq 0x224044
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq