// File: /workspace/github_c_makefile_star2_O1/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 0x1366e
movq 0x8(%rax), %r12
testq %r12, %r12
je 0x1366e
movq %rsi, %r15
movq %rbx, %rdi
movl $0x298, %esi            # imm = 0x298
callq 0x115e9
testq %rax, %rax
je 0x136b0
movq %rax, %r14
movl $0x298, %edx            # imm = 0x298
movq %rax, %rdi
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 0x1373c
testl %eax, %eax
je 0x136cd
movq -0x28(%rbp), %r12
testq %r12, %r12
leaq 0x660c4(%rip), %rdx     # 0x796d9
cmoveq %r12, %rdx
movl $0x1, %r15d
movq %rbx, %rdi
movl $0x1, %esi
movq %r12, %rcx
xorl %eax, %eax
callq 0xc8f4
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9c3a
movb $0x0, 0x201(%r14)
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x13652
callq 0xe9e9
movq 0x238(%r14), %rsi
movq %rbx, %rdi
callq 0x9939
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9c3a
jmp 0x136b6
movq %rbx, %rdi
movl $0x15, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xc8f4
leaq 0x69d5e(%rip), %rsi     # 0x7d3e4
leaq 0x65eac(%rip), %rcx     # 0x79539
movl $0x15, %edi
movl $0x197a9, %edx          # imm = 0x197A9
xorl %eax, %eax
callq 0xb8cc
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 0xea22
movq 0x238(%r14), %rax
testq %rax, %rax
je 0x13607
cmpb $0x0, 0x50(%rbx)
jne 0x13607
cmpq $0x0, 0x18(%rax)
jne 0x13607
testb $0x10, 0x46(%rax)
jne 0x13607
cmpq $0x0, 0x8(%r12)
jne 0x13725
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 0x1363c