// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_declare_vtab
SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
  Parse *pParse;

  int rc = SQLITE_OK;
  Table *pTab;
  char *zErr = 0;

  sqlite3_mutex_enter(db->mutex);
  if( !db->pVtabCtx || !(pTab = db->pVtabCtx->pTab) ){
    sqlite3Error(db, SQLITE_MISUSE, 0);
    sqlite3_mutex_leave(db->mutex);
    return SQLITE_MISUSE_BKPT;
  }
  assert( (pTab->tabFlags & TF_Virtual)!=0 );

  pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
  if( pParse==0 ){
    rc = SQLITE_NOMEM;
  }else{
    pParse->declareVtab = 1;
    pParse->db = db;
    pParse->nQueryLoop = 1;
  
    if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr) 
     && pParse->pNewTable
     && !db->mallocFailed
     && !pParse->pNewTable->pSelect
     && (pParse->pNewTable->tabFlags & TF_Virtual)==0
    ){
      if( !pTab->aCol ){
        pTab->aCol = pParse->pNewTable->aCol;
        pTab->nCol = pParse->pNewTable->nCol;
        pParse->pNewTable->nCol = 0;
        pParse->pNewTable->aCol = 0;
      }
      db->pVtabCtx->pTab = 0;
    }else{
      sqlite3Error(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);
      sqlite3DbFree(db, zErr);
      rc = SQLITE_ERROR;
    }
    pParse->declareVtab = 0;
  
    if( pParse->pVdbe ){
      sqlite3VdbeFinalize(pParse->pVdbe);
    }
    sqlite3DeleteTable(db, pParse->pNewTable);
    sqlite3StackFree(db, pParse);
  }

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
andq $0x0, -0x28(%rbp)
movq %rdi, %rbx
movq 0x1c0(%rdi), %rax
testq %rax, %rax
je 0x1206e
movq 0x8(%rax), %r12
testq %r12, %r12
je 0x1206e
movq %rsi, %r15
movq %rbx, %rdi
movl $0x298, %esi            # imm = 0x298
callq 0xf4ae
testq %rax, %rax
je 0x1209b
movq %rax, %r14
movb $0x1, 0x201(%rax)
movq %rbx, (%rax)
movl $0x1, 0x1e8(%rax)
leaq -0x28(%rbp), %rdx
movq %rax, %rdi
movq %r15, %rsi
callq 0x1211e
testl %eax, %eax
je 0x120b6
movq -0x28(%rbp), %r12
testq %r12, %r12
leaq 0x596e0(%rip), %rdx     # 0x6b6f9
cmoveq %r12, %rdx
pushq $0x1
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
movq %r12, %rcx
xorl %eax, %eax
callq 0xbdb1
movq %rbx, %rdi
movq %r12, %rsi
callq 0x968b
movb $0x0, 0x201(%r14)
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x12052
callq 0xdc20
movq 0x238(%r14), %rsi
movq %rbx, %rdi
callq 0x93dc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x968b
jmp 0x1209f
pushq $0x15
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xbdb1
movl $0x197a9, %edi          # imm = 0x197A9
callq 0x9008
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x7
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xdc59
movq 0x238(%r14), %rax
testq %rax, %rax
je 0x1200b
cmpb $0x0, 0x50(%rbx)
jne 0x1200b
cmpq $0x0, 0x18(%rax)
jne 0x1200b
testb $0x10, 0x46(%rax)
jne 0x1200b
cmpq $0x0, 0x8(%r12)
jne 0x1210a
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%r12)
movzwl 0x42(%rax), %ecx
movw %cx, 0x42(%r12)
andw $0x0, 0x42(%rax)
andq $0x0, 0x8(%rax)
movq 0x1c0(%rbx), %rax
andq $0x0, 0x8(%rax)
xorl %r15d, %r15d
jmp 0x1203c