// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rdi, %rbx
movq (%rdi), %r15
movslq 0x10(%rdi), %rsi
movq 0x20(%r15), %rax
movq %rsi, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rdi
andw $-0x5, 0x72(%rdi)
incl 0x1c(%rbx)
movq %rdx, %r12
cmpb $0x0, 0x61(%r15)
je 0x366d3
movq 0x8(%r12), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3ddbe
movl $0x1, %r14d
jmp 0x368cd
xorl %r14d, %r14d
testq %r12, %r12
je 0x368cd
movq 0x18(%r12), %rdi
testq %rdi, %rdi
je 0x36738
movq 0x20(%r12), %rdx
testq %rdx, %rdx
je 0x36742
xorl %r9d, %r9d
leaq 0x51753(%rip), %r8      # 0x87e50
leaq 0x5687e(%rip), %r10     # 0x8cf82
movzbl (%rdx,%r9), %r11d
testq %r11, %r11
je 0x367bf
movzbl (%r11,%r8), %r11d
movzbl (%r9,%r10), %r13d
movb (%r13,%r8), %bpl
cmpb %bpl, %r11b
jne 0x367cb
incq %r9
cmpq $0x7, %r9
jne 0x36704
jmp 0x367d8
movq 0x8(%r12), %rsi
jmp 0x36885
movq 0x8(%r12), %rsi
testq %rsi, %rsi
je 0x36883
leaq 0x8(%r12), %r13
movq (%rax,%rcx), %rdx
movq %r15, %rdi
callq 0x3debf
testq %rax, %rax
je 0x3688f
movq %rax, %r15
movq 0x18(%r12), %rdi
leaq 0x58(%rax), %r12
movq %r12, %rsi
callq 0x3df5a
leaq 0x56805(%rip), %rdx     # 0x8cf8a
testl %eax, %eax
je 0x36896
movl (%r12), %eax
cmpl $0x2, %eax
jl 0x36896
movq 0x18(%r15), %rcx
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
je 0x368cd
cmpq %r15, %rcx
je 0x367b9
cmpl %eax, 0x58(%rcx)
je 0x36896
movq 0x28(%rcx), %rcx
jmp 0x367a2
movzbl (%r9,%r10), %r9d
movb (%r9,%r8), %bpl
xorl %r11d, %r11d
movzbl %bpl, %r8d
cmpl %r8d, %r11d
jne 0x3686f
movb 0xb4(%r15), %bpl
movb %sil, 0xb4(%r15)
leaq 0x14(%rsp), %r14
movl $0x0, (%r14)
movq %r14, %rsi
callq 0x3df5a
movl (%r14), %eax
movl %eax, 0xb0(%r15)
andb $-0x2, 0xb6(%r15)
movq %r12, 0xb8(%r15)
movq 0x20(%r12), %rsi
movq $0x0, (%rsp)
xorl %r14d, %r14d
leaq 0x8(%rsp), %r9
movq %r15, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1567a
movl 0x50(%r15), %eax
movb %bpl, 0xb4(%r15)
testl %eax, %eax
je 0x368c3
testb $0x1, 0xb6(%r15)
jne 0x368c3
cmpl 0x14(%rbx), %eax
jle 0x3685b
movl %eax, 0x14(%rbx)
cmpl $0x9, %eax
je 0x368c3
cmpl $0x7, %eax
jne 0x368a4
movq %r15, %rdi
callq 0x10d8c
jmp 0x368c3
movq 0x8(%r12), %rsi
testq %rsi, %rsi
je 0x36883
cmpb $0x0, (%rdx)
jne 0x36885
jmp 0x36750
xorl %esi, %esi
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %edx, %edx
jmp 0x3689d
leaq 0x56705(%rip), %rdx     # 0x8cf9b
movq (%r13), %rsi
movq %rbx, %rdi
callq 0x3ddbe
jmp 0x368cd
cmpb $0x6, %al
je 0x368c3
movq 0x8(%r12), %r12
movq %r15, %rdi
callq 0x14dd6
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x3ddbe
movq 0x8(%rsp), %rdi
callq 0x100a7
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq