// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3_declare_vtab
SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
  VtabCtx *pCtx;
  int rc = SQLITE_OK;
  Table *pTab;
  char *zErr = 0;
  Parse sParse;

#ifdef SQLITE_ENABLE_API_ARMOR
  if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){
    return SQLITE_MISUSE_BKPT;
  }
#endif
  sqlite3_mutex_enter(db->mutex);
  pCtx = db->pVtabCtx;
  if( !pCtx || pCtx->bDeclared ){
    sqlite3Error(db, SQLITE_MISUSE);
    sqlite3_mutex_leave(db->mutex);
    return SQLITE_MISUSE_BKPT;
  }
  pTab = pCtx->pTab;
  assert( IsVirtual(pTab) );

  memset(&sParse, 0, sizeof(sParse));
  sParse.eParseMode = PARSE_MODE_DECLARE_VTAB;
  sParse.db = db;
  sParse.nQueryLoop = 1;
  if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr)
   && sParse.pNewTable
   && !db->mallocFailed
   && !sParse.pNewTable->pSelect
   && !IsVirtual(sParse.pNewTable)
  ){
    if( !pTab->aCol ){
      Table *pNew = sParse.pNewTable;
      Index *pIdx;
      pTab->aCol = pNew->aCol;
      pTab->nCol = pNew->nCol;
      pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);
      pNew->nCol = 0;
      pNew->aCol = 0;
      assert( pTab->pIndex==0 );
      assert( HasRowid(pNew) || sqlite3PrimaryKeyIndex(pNew)!=0 );
      if( !HasRowid(pNew)
       && pCtx->pVTable->pMod->pModule->xUpdate!=0
       && sqlite3PrimaryKeyIndex(pNew)->nKeyCol!=1
      ){
        /* WITHOUT ROWID virtual tables must either be read-only (xUpdate==0)
        ** or else must have a single-column PRIMARY KEY */
        rc = SQLITE_ERROR;
      }
      pIdx = pNew->pIndex;
      if( pIdx ){
        assert( pIdx->pNext==0 );
        pTab->pIndex = pIdx;
        pNew->pIndex = 0;
        pIdx->pTable = pTab;
      }
    }
    pCtx->bDeclared = 1;
  }else{
    sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);
    sqlite3DbFree(db, zErr);
    rc = SQLITE_ERROR;
  }
  sParse.eParseMode = PARSE_MODE_NORMAL;

  if( sParse.pVdbe ){
    sqlite3VdbeFinalize(sParse.pVdbe);
  }
  sqlite3DeleteTable(db, sParse.pNewTable);
  sqlite3ParserReset(&sParse);

  assert( (rc&0xff)==rc );
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
andq $0x0, 0x8(%rsp)
movq %rdi, %rbx
movq 0x208(%rdi), %r12
testq %r12, %r12
je 0x228cb6
cmpl $0x0, 0x18(%r12)
je 0x228cdc
pushq $0x15
popq %rsi
movq %rbx, %rdi
callq 0x222800
movl $0x22465, %edi          # imm = 0x22465
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21ec3c
movq %rsi, %r14
movq 0x8(%r12), %r13
leaq 0x18(%rsp), %r15
movl $0x1a0, %edx            # imm = 0x1A0
movq %r15, %rdi
xorl %esi, %esi
callq 0x17380
movb $0x1, 0x114(%r15)
movq %rbx, -0x8(%r15)
movl $0x1, 0xbc(%r15)
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x228e55
testl %eax, %eax
sete %al
movq 0x148(%r15), %r14
testq %r14, %r14
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x228d51
cmpb $0x0, 0x61(%rbx)
jne 0x228d51
cmpq $0x0, 0x18(%r14)
jne 0x228d51
cmpl $0x0, 0x54(%r14)
je 0x228dd0
movq 0x8(%rsp), %r14
testq %r14, %r14
leaq 0x140149(%rip), %rdx    # 0x368ea9
cmoveq %r14, %rdx
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2226f3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21f26b
movb $0x0, 0x12c(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x228d98
callq 0x224149
leaq 0x10(%rsp), %r14
movq 0x148(%r14), %rsi
movq %rbx, %rdi
callq 0x21f182
movq %r14, %rdi
callq 0x22767e
movq %rbx, %rdi
movl %ebp, %esi
callq 0x22417d
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
cmpq $0x0, 0x8(%r13)
jne 0x228e47
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movzwl 0x46(%r14), %eax
movw %ax, 0x46(%r13)
movl $0x280, %eax            # imm = 0x280
andl 0x40(%r14), %eax
orl %eax, 0x40(%r13)
andw $0x0, 0x46(%r14)
andq $0x0, 0x8(%r14)
xorl %ebp, %ebp
testb $-0x80, 0x40(%r14)
je 0x228e31
movq (%r12), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
cmpq $0x0, 0x68(%rax)
je 0x228e31
movq %r14, %rdi
callq 0x2293af
xorl %ebp, %ebp
cmpw $0x1, 0x5e(%rax)
setne %bpl
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x228e47
movq %rax, 0x10(%r13)
andq $0x0, 0x10(%r14)
movq %r13, 0x18(%rax)
movl $0x1, 0x18(%r12)
jmp 0x228d81