// File: /workspace/github_c_makefile_star2_O1/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 0x2872ce
cmpl $0x0, 0x18(%r12)
je 0x287321
movl $0x15, 0x50(%rbx)
movl $0x15, %ebp
movq %rbx, %rdi
movl $0x15, %esi
callq 0x28e696
leaq 0x158031(%rip), %rsi    # 0x3df31f
leaq 0x15c8a7(%rip), %rdx    # 0x3e3b9c
leaq 0x157e89(%rip), %r8     # 0x3df185
movl $0x15, %edi
movl $0x22465, %ecx          # imm = 0x22465
xorl %eax, %eax
callq 0x27e637
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 0x10(%rsp), %r15
movl $0x1a8, %edx            # imm = 0x1A8
movq %r15, %rdi
xorl %esi, %esi
callq 0x173a0
movb $0x1, 0x11c(%r15)
movq %rbx, (%r15)
movl $0x1, 0xc4(%r15)
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x2874c0
testl %eax, %eax
sete %cl
movq 0x148(%r15), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x287393
cmpb $0x0, 0x61(%rbx)
jne 0x287393
cmpq $0x0, 0x18(%rax)
jne 0x287393
cmpl $0x0, 0x54(%rax)
je 0x287420
movq 0x8(%rsp), %r14
testq %r14, %r14
leaq 0x14ae2f(%rip), %rdx    # 0x3d21d1
cmoveq %r14, %rdx
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x27fc17
testq %r14, %r14
je 0x2873cd
movq %rbx, %rdi
movq %r14, %rsi
callq 0x28c3e7
movb $0x0, 0x12c(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2873e4
callq 0x281916
leaq 0x10(%rsp), %r14
movq 0x148(%r14), %rsi
movq %rbx, %rdi
callq 0x27bd74
movq %r14, %rdi
callq 0x285775
cmpb $0x0, 0x61(%rbx)
je 0x287418
movq %rbx, %rdi
callq 0x299b1a
movl $0x7, %ebp
jmp 0x28730d
andl 0x54(%rbx), %ebp
jmp 0x28730d
xorl %ebp, %ebp
cmpq $0x0, 0x8(%r13)
jne 0x2874b2
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 0x287499
movq (%r12), %rcx
movq 0x8(%rcx), %rcx
movq (%rcx), %rcx
cmpq $0x0, 0x68(%rcx)
je 0x287499
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x28748e
movzwl 0x63(%rcx), %edx
andl $0x3, %edx
cmpw $0x2, %dx
je 0x28748e
movq 0x28(%rcx), %rcx
jmp 0x287476
xorl %ebp, %ebp
cmpw $0x1, 0x5e(%rcx)
setne %bpl
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x2874b2
movq %rcx, 0x10(%r13)
movq $0x0, 0x10(%rax)
movq %r13, 0x18(%rcx)
movl $0x1, 0x18(%r12)
jmp 0x2873cd