// File: /workspace/github_c_makefile_star2_O3/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
movq %rdi, %rbx
movq $0x0, 0x8(%rsp)
movq 0x208(%rdi), %r12
testq %r12, %r12
je 0x27d8ad
cmpl $0x0, 0x18(%r12)
je 0x27d900
movl $0x15, 0x50(%rbx)
movl $0x15, %ebp
movq %rbx, %rdi
movl $0x15, %esi
callq 0x284b1f
leaq 0x1582fe(%rip), %rsi    # 0x3d5bcb
leaq 0x15cb73(%rip), %rdx    # 0x3da447
leaq 0x158156(%rip), %r8     # 0x3d5a31
movl $0x15, %edi
movl $0x22465, %ecx          # imm = 0x22465
xorl %eax, %eax
callq 0x274d08
movl %ebp, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r14
movq 0x8(%r12), %r13
leaq 0x18(%rsp), %r15
movl $0x1a0, %edx            # imm = 0x1A0
movq %r15, %rdi
xorl %esi, %esi
callq 0x173a0
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 0x27daa4
testl %eax, %eax
sete %cl
movq 0x148(%r15), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x27d978
cmpb $0x0, 0x61(%rbx)
jne 0x27d978
cmpq $0x0, 0x18(%rax)
jne 0x27d978
cmpl $0x0, 0x54(%rax)
je 0x27da05
movq 0x8(%rsp), %r14
testq %r14, %r14
leaq 0x14b122(%rip), %rdx    # 0x3c8aa9
cmoveq %r14, %rdx
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2762da
testq %r14, %r14
je 0x27d9b2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x282904
movb $0x0, 0x12c(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x27d9c9
callq 0x277f75
leaq 0x10(%rsp), %r14
movq 0x148(%r14), %rsi
movq %rbx, %rdi
callq 0x272447
movq %r14, %rdi
callq 0x27bd9d
cmpb $0x0, 0x61(%rbx)
je 0x27d9fd
movq %rbx, %rdi
callq 0x28fd56
movl $0x7, %ebp
jmp 0x27d8ec
andl 0x54(%rbx), %ebp
jmp 0x27d8ec
xorl %ebp, %ebp
cmpq $0x0, 0x8(%r13)
jne 0x27da96
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%r13)
movzwl 0x46(%rax), %ecx
movw %cx, 0x46(%r13)
movl $0x280, %ecx            # imm = 0x280
andl 0x40(%rax), %ecx
orl %ecx, 0x40(%r13)
movw $0x0, 0x46(%rax)
movq $0x0, 0x8(%rax)
xorl %ebp, %ebp
testb $-0x80, 0x40(%rax)
je 0x27da7d
movq (%r12), %rcx
movq 0x8(%rcx), %rcx
movq (%rcx), %rcx
cmpq $0x0, 0x68(%rcx)
je 0x27da7d
movq %rax, %rdx
addq $0x10, %rdx
movq (%rdx), %rcx
movzwl 0x63(%rcx), %esi
andl $0x3, %esi
leaq 0x28(%rcx), %rdx
cmpw $0x2, %si
jne 0x27da5e
xorl %ebp, %ebp
cmpw $0x1, 0x5e(%rcx)
setne %bpl
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x27da96
movq %rcx, 0x10(%r13)
movq $0x0, 0x10(%rax)
movq %r13, 0x18(%rcx)
movl $0x1, 0x18(%r12)
jmp 0x27d9b2