// File: /workspace/github_c_makefile_star2_O3/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
movq %rdi, %rbx
movq $0x0, -0x28(%rbp)
movq 0x1c0(%rdi), %rax
testq %rax, %rax
je 0x13770
movq 0x8(%rax), %r12
testq %r12, %r12
je 0x13770
movq %rsi, %r15
movq %rbx, %rdi
movl $0x298, %esi            # imm = 0x298
callq 0x11721
testq %rax, %rax
je 0x137b2
movq %rax, %r14
movq %rax, %rdi
addq $0x8, %rdi
movl $0x290, %edx            # imm = 0x290
xorl %esi, %esi
callq 0x8200
movb $0x1, 0x201(%r14)
movq %rbx, (%r14)
movl $0x1, 0x1e8(%r14)
leaq -0x28(%rbp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1383e
testl %eax, %eax
je 0x137cf
movq -0x28(%rbp), %r12
testq %r12, %r12
leaq 0x65fc2(%rip), %rdx     # 0x796d9
cmoveq %r12, %rdx
movl $0x1, %r15d
movq %rbx, %rdi
movl $0x1, %esi
movq %r12, %rcx
xorl %eax, %eax
callq 0xca2d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9ca4
movb $0x0, 0x201(%r14)
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x13754
callq 0xeac6
movq 0x238(%r14), %rsi
movq %rbx, %rdi
callq 0x9975
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9ca4
jmp 0x137b8
movq %rbx, %rdi
movl $0x15, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xca2d
leaq 0x69c5c(%rip), %rsi     # 0x7d3e4
leaq 0x65daa(%rip), %rcx     # 0x79539
movl $0x15, %edi
movl $0x197a9, %edx          # imm = 0x197A9
xorl %eax, %eax
callq 0xb9c7
movl $0x15, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x7, %r15d
movq %rbx, %rdi
movl %r15d, %esi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xeaff
movq 0x238(%r14), %rax
testq %rax, %rax
je 0x13709
cmpb $0x0, 0x50(%rbx)
jne 0x13709
cmpq $0x0, 0x18(%rax)
jne 0x13709
testb $0x10, 0x46(%rax)
jne 0x13709
cmpq $0x0, 0x8(%r12)
jne 0x13827
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%r12)
movzwl 0x42(%rax), %ecx
movw %cx, 0x42(%r12)
movw $0x0, 0x42(%rax)
movq $0x0, 0x8(%rax)
movq 0x1c0(%rbx), %rax
movq $0x0, 0x8(%rax)
xorl %r15d, %r15d
jmp 0x1373e