// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x208(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x3ce7b2
movq -0x20(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x3ce7d2
movq -0x10(%rbp), %rdi
movl $0x15, %esi
callq 0x3c5210
movl $0x22465, %edi          # imm = 0x22465
callq 0x3bf6a0
movl %eax, -0x4(%rbp)
jmp 0x3cea0f
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
leaq -0x1e0(%rbp), %rdi
xorl %esi, %esi
movl $0x1a8, %edx            # imm = 0x1A8
callq 0x19360
movb $0x1, -0xc4(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movl $0x1, -0x11c(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x1e0(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x3cea20
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3ce982
cmpq $0x0, -0x98(%rbp)
je 0x3ce982
movq -0x10(%rbp), %rax
cmpb $0x0, 0x61(%rax)
jne 0x3ce982
movq -0x98(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x3ce982
movq -0x98(%rbp), %rax
cmpl $0x0, 0x54(%rax)
jne 0x3ce982
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x3ce975
movq -0x98(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x1e8(%rbp), %rax
movw 0x46(%rax), %cx
movq -0x30(%rbp), %rax
movw %cx, 0x46(%rax)
movq -0x1e8(%rbp), %rax
movl 0x40(%rax), %ecx
andl $0x280, %ecx            # imm = 0x280
movq -0x30(%rbp), %rax
orl 0x40(%rax), %ecx
movl %ecx, 0x40(%rax)
movq -0x1e8(%rbp), %rax
movw $0x0, 0x46(%rax)
movq -0x1e8(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x1e8(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x3ce92a
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
cmpq $0x0, 0x68(%rax)
je 0x3ce92a
movq -0x1e8(%rbp), %rdi
callq 0x3cef20
movzwl 0x5e(%rax), %eax
cmpl $0x1, %eax
je 0x3ce92a
movl $0x1, -0x24(%rbp)
movq -0x1e8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x1f0(%rbp)
cmpq $0x0, -0x1f0(%rbp)
je 0x3ce973
movq -0x1f0(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x1e8(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq -0x1f0(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x3ce975
movq -0x20(%rbp), %rax
movl $0x1, 0x18(%rax)
jmp 0x3ce9c1
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0x1cd68c(%rip), %rax    # 0x59c021
cmpq $0x0, %rcx
cmovneq %rax, %rdx
movq -0x38(%rbp), %rcx
movl $0x1, %esi
movb $0x0, %al
callq 0x3c50b0
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3c00a0
movl $0x1, -0x24(%rbp)
movb $0x0, -0xc4(%rbp)
cmpq $0x0, -0x1d0(%rbp)
je 0x3ce9de
movq -0x1d0(%rbp), %rdi
callq 0x3c7330
movq -0x10(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x3bff20
leaq -0x1e0(%rbp), %rdi
callq 0x3cc3b0
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x3c7380
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopl (%rax,%rax)