// File: /workspace/github_c_makefile_star2_O1/jkbenaim[P]psfrag/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) );
  DbClearProperty(db, iDb, DB_Empty);
  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;
    db->init.newTnum = sqlite3Atoi(argv[3]);
    db->init.orphanTrigger = 0;
    db->init.azInit = argv;
    TESTONLY(rcp = ) sqlite3_prepare(db, argv[4], -1, &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
     || sqlite3GetInt32(argv[3],&pIndex->tnum)==0
     || pIndex->tnum<2
     || sqlite3IndexHasDuplicateRootPage(pIndex)
    ){
      corruptSchema(pData, argv[1], pIndex?"invalid rootpage":"orphan index");
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq (%rdi), %r12
movslq 0x10(%rdi), %r13
movq 0x20(%r12), %rbp
movq %r13, %rbx
shlq $0x5, %rbx
movq 0x18(%rbp,%rbx), %rax
andw $-0x5, 0x72(%rax)
incl 0x1c(%rdi)
movq %rdx, %r15
cmpb $0x0, 0x61(%r12)
je 0x37103
movq 0x8(%r15), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x3eb26
movl $0x1, %ebx
jmp 0x372c7
testq %r15, %r15
je 0x371cc
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x371d3
movq %rax, 0x8(%rsp)
movq 0x20(%r15), %rdi
leaq 0x56dc5(%rip), %rsi     # 0x8deee
movq %rdi, 0x10(%rsp)
movl $0x7, %edx
callq 0xcfa1
testl %eax, %eax
je 0x371e8
movq 0x8(%r15), %rsi
testq %rsi, %rsi
movq 0x10(%rsp), %rax
je 0x371d7
testq %rax, %rax
je 0x3715c
cmpb $0x0, (%rax)
jne 0x371d7
movq (%rbp,%rbx), %rdx
movq %r12, %rdi
callq 0x3ec27
testq %rax, %rax
je 0x3728a
movq %rax, %r12
movq 0x18(%r15), %rdi
leaq 0x58(%rax), %r13
movq %r13, %rsi
callq 0x3ecd9
leaq 0x56d6a(%rip), %rdx     # 0x8def6
testl %eax, %eax
movl $0x0, %ebx
je 0x37293
movl (%r13), %eax
cmpl $0x2, %eax
jl 0x37293
movq 0x18(%r12), %rcx
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
je 0x372c7
cmpq %r12, %rcx
je 0x371c6
cmpl %eax, 0x58(%rcx)
je 0x37293
movq 0x28(%rcx), %rcx
jmp 0x371af
xorl %ebx, %ebx
jmp 0x372c7
movq 0x8(%r15), %rsi
xorl %ebx, %ebx
movq %r14, %rdi
xorl %edx, %edx
callq 0x3eb26
jmp 0x372c7
movb 0xb4(%r12), %bpl
movb %r13b, 0xb4(%r12)
leaq 0x24(%rsp), %rbx
movl $0x0, (%rbx)
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x3ecd9
movl (%rbx), %eax
movl %eax, 0xb0(%r12)
andb $-0x2, 0xb6(%r12)
movq %r15, 0xb8(%r12)
movq 0x20(%r15), %rsi
movq $0x0, (%rsp)
xorl %ebx, %ebx
leaq 0x18(%rsp), %r9
movq %r12, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x15713
movl 0x50(%r12), %eax
movb %bpl, 0xb4(%r12)
testl %eax, %eax
je 0x372bd
testb $0x1, 0xb6(%r12)
jne 0x372bd
cmpl 0x14(%r14), %eax
jle 0x37276
movl %eax, 0x14(%r14)
cmpl $0x9, %eax
je 0x372bd
cmpl $0x7, %eax
jne 0x3729f
movq %r12, %rdi
callq 0x10dd9
jmp 0x372bd
leaq 0x56c76(%rip), %rdx     # 0x8df07
xorl %ebx, %ebx
movq 0x8(%r15), %rsi
movq %r14, %rdi
jmp 0x371de
cmpb $0x6, %al
je 0x372bd
movq 0x8(%r15), %r15
movq %r12, %rdi
callq 0x14f1c
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x3eb26
movq 0x18(%rsp), %rdi
callq 0x100e6
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq