// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3CodeDropTable
SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){
  Vdbe *v;
  sqlite3 *db = pParse->db;
  Trigger *pTrigger;
  Db *pDb = &db->aDb[iDb];

  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  sqlite3BeginWriteOperation(pParse, 1, iDb);

#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( IsVirtual(pTab) ){
    sqlite3VdbeAddOp0(v, OP_VBegin);
  }
#endif

  /* Drop all triggers associated with the table being dropped. Code
  ** is generated to remove entries from sqlite_master and/or
  ** sqlite_temp_master if required.
  */
  pTrigger = sqlite3TriggerList(pParse, pTab);
  while( pTrigger ){
    assert( pTrigger->pSchema==pTab->pSchema || 
        pTrigger->pSchema==db->aDb[1].pSchema );
    sqlite3DropTriggerPtr(pParse, pTrigger);
    pTrigger = pTrigger->pNext;
  }

#ifndef SQLITE_OMIT_AUTOINCREMENT
  /* Remove any entries of the sqlite_sequence table associated with
  ** the table being dropped. This is done before the table is dropped
  ** at the btree level, in case the sqlite_sequence table needs to
  ** move as a result of the drop (can happen in auto-vacuum mode).
  */
  if( pTab->tabFlags & TF_Autoincrement ){
    sqlite3NestedParse(pParse,
      "DELETE FROM %Q.sqlite_sequence WHERE name=%Q",
      pDb->zName, pTab->zName
    );
  }
#endif

  /* Drop all SQLITE_MASTER table and index entries that refer to the
  ** table. The program name loops through the master table and deletes
  ** every row that refers to a table of the same name as the one being
  ** dropped. Triggers are handled separately because a trigger can be
  ** created in the temp database that refers to a table in another
  ** database.
  */
  sqlite3NestedParse(pParse, 
      "DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'",
      pDb->zName, SCHEMA_TABLE(iDb), pTab->zName);
  if( !isView && !IsVirtual(pTab) ){
    destroyTable(pParse, pTab);
  }

  /* Remove the table entry from SQLite's internal schema and modify
  ** the schema cookie.
  */
  if( IsVirtual(pTab) ){
    sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0);
  }
  sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);
  sqlite3ChangeCookie(pParse, iDb);
  sqliteViewResetAll(db, iDb);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, -0x3c(%rbp)
movq %rsi, %r12
movq %rdi, %r15
movq (%rdi), %rax
movl %edx, -0x30(%rbp)
movslq %edx, %r13
movq %r13, %rcx
shlq $0x5, %rcx
movq %rax, -0x50(%rbp)
movq 0x20(%rax), %r14
movq %rcx, -0x48(%rbp)
addq %rcx, %r14
callq 0x45ece
movq %rax, -0x38(%rbp)
movq 0x1d8(%r15), %rbx
testq %rbx, %rbx
cmoveq %r15, %rbx
movq %r15, %rdi
movl %r13d, %esi
callq 0x4632f
movl $0x1, %eax
movl %r13d, %ecx
shll %cl, %eax
orl %eax, 0x164(%rbx)
orb $0x1, 0x23(%rbx)
testb $0x10, 0x46(%r12)
je 0x4fabf
movq -0x38(%rbp), %rdi
movl $0x86, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45f15
movq (%r15), %rax
movq 0x20(%rax), %rax
movq 0x38(%rax), %rdi
movzbl 0x1f6(%r15), %esi
movq %r12, %rdx
callq 0x4fd1a
testq %rax, %rax
je 0x4faf6
movq %rax, %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x4fdbc
movq 0x40(%r13), %r13
testq %r13, %r13
jne 0x4fae2
testb $0x8, 0x46(%r12)
movq -0x50(%rbp), %rbx
je 0x4fb1a
movq (%r14), %rdx
movq (%r12), %rcx
leaq 0x2bd0e(%rip), %rsi     # 0x7b81e
movq %r15, %rdi
xorl %eax, %eax
callq 0x468e4
movq (%r14), %rdx
movl -0x30(%rbp), %r14d
cmpl $0x1, %r14d
leaq 0x2a3ed(%rip), %rax     # 0x79f19
leaq 0x2a3f9(%rip), %rcx     # 0x79f2c
cmoveq %rax, %rcx
movq (%r12), %r8
leaq 0x2bd09(%rip), %rsi     # 0x7b84b
xorl %r13d, %r13d
movq %r15, %rdi
xorl %eax, %eax
callq 0x468e4
cmpl $0x0, -0x3c(%rbp)
sete %cl
movb 0x46(%r12), %al
testb $0x10, %al
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4fc05
movl 0x3c(%r12), %r14d
cmpl %r13d, %r14d
movl $0x0, %eax
cmovll %r14d, %eax
testl %r13d, %r13d
cmovel %r14d, %eax
movq 0x10(%r12), %rcx
testq %rcx, %rcx
je 0x4fba9
movl 0x50(%rcx), %edx
cmpl %eax, %edx
movl %eax, %esi
cmovgl %edx, %esi
cmpl %r13d, %edx
cmovll %esi, %eax
testl %r13d, %r13d
cmovel %esi, %eax
movq 0x28(%rcx), %rcx
jmp 0x4fb88
testl %eax, %eax
je 0x4fbfc
movl %eax, %r13d
movq 0x68(%r12), %rax
testq %rax, %rax
je 0x4fbe3
movq (%r15), %rdx
movl 0x28(%rdx), %ecx
testl %ecx, %ecx
jle 0x4fbea
movq 0x20(%rdx), %rsi
addq $0x18, %rsi
xorl %edx, %edx
cmpq %rax, (%rsi)
je 0x4fbec
incq %rdx
addq $0x20, %rsi
cmpq %rdx, %rcx
jne 0x4fbce
movl %ecx, %edx
jmp 0x4fbec
movl $0xfff0bdc0, %edx       # imm = 0xFFF0BDC0
jmp 0x4fbec
xorl %edx, %edx
movq %r15, %rdi
movl %r13d, %esi
callq 0x4ff70
jmp 0x4fb70
movb 0x46(%r12), %al
movl -0x30(%rbp), %r14d
testb $0x10, %al
je 0x4fc3a
movq (%r12), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %r13
movq %r13, %rdi
movl $0x88, %esi
movl %r14d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45f15
movq %r13, %rdi
movl %eax, %esi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0x11a9f
movq (%r12), %r12
movq -0x38(%rbp), %r13
movq %r13, %rdi
movl $0x72, %esi
movl %r14d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45f15
movq %r13, %rdi
movl %eax, %esi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x11a9f
movq %r15, %rdi
movl %r14d, %esi
callq 0x46a12
movq 0x20(%rbx), %rax
movq -0x48(%rbp), %r12
movq 0x18(%rax,%r12), %rax
movzwl 0x72(%rax), %ecx
testb $0x2, %cl
je 0x4fcd4
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x4fcca
movq 0x10(%r15), %r14
cmpq $0x0, 0x18(%r14)
je 0x4fcb5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x36ed9
movq $0x0, 0x8(%r14)
movw $0x0, 0x42(%r14)
movq (%r15), %r15
testq %r15, %r15
jne 0x4fc90
movq 0x20(%rbx), %rax
movq 0x18(%rax,%r12), %rax
movzwl 0x72(%rax), %ecx
andl $0xfffd, %ecx           # imm = 0xFFFD
movw %cx, 0x72(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq