// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3DeleteTable
SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
  Index *pIndex, *pNext;
  TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */

  assert( !pTable || pTable->nRef>0 );

  /* Do not delete the table until the reference count reaches zero. */
  if( !pTable ) return;
  if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;

  /* Record the number of outstanding lookaside allocations in schema Tables
  ** prior to doing any free() operations.  Since schema Tables do not use
  ** lookaside, this number should not change. */
  TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?
                         db->lookaside.nOut : 0 );

  /* Delete all indices associated with this table. */
  for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
    pNext = pIndex->pNext;
    assert( pIndex->pSchema==pTable->pSchema );
    if( !db || db->pnBytesFreed==0 ){
      char *zName = pIndex->zName; 
      TESTONLY ( Index *pOld = ) sqlite3HashInsert(
         &pIndex->pSchema->idxHash, zName, sqlite3Strlen30(zName), 0
      );
      assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
      assert( pOld==pIndex || pOld==0 );
    }
    freeIndex(db, pIndex);
  }

  /* Delete any foreign keys attached to this table. */
  sqlite3FkDelete(db, pTable);

  /* Delete the Table structure itself.
  */
  sqliteDeleteColumnNames(db, pTable);
  sqlite3DbFree(db, pTable->zName);
  sqlite3DbFree(db, pTable->zColAff);
  sqlite3SelectDelete(db, pTable->pSelect);
#ifndef SQLITE_OMIT_CHECK
  sqlite3ExprListDelete(db, pTable->pCheck);
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  sqlite3VtabClear(db, pTable);
#endif
  sqlite3DbFree(db, pTable);

  /* Verify that no lookaside memory was used by schema tables */
  assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rsi, %rsi
je 0x99a0
movq %rsi, %rbx
movq %rdi, %r14
testq %rdi, %rdi
je 0x999a
cmpq $0x0, 0x328(%r14)
jne 0x99a9
decw 0x44(%rbx)
je 0x99a9
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbx), %r15
testq %r15, %r15
je 0x9a0c
movq 0x28(%r15), %r12
testq %r14, %r14
je 0x99c5
cmpq $0x0, 0x328(%r14)
jne 0x99f9
movq (%r15), %rsi
testq %rsi, %rsi
je 0x99e8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rsi, %rax
incl %edx
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x99d5
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
jmp 0x99ea
xorl %edx, %edx
movq 0x30(%r15), %rdi
addq $0x20, %rdi
xorl %ecx, %ecx
callq 0x34400
movq %r14, %rdi
movq %r15, %rsi
callq 0x3476c
movq %r12, %r15
testq %r12, %r12
jne 0x99b2
movq 0x20(%rbx), %r15
testq %r15, %r15
je 0x9ae5
testq %r14, %r14
je 0x9a2c
cmpq $0x0, 0x328(%r14)
jne 0x9ab2
movq 0x18(%r15), %rcx
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x9a3f
movq %rcx, 0x18(%rax)
jmp 0x9aa1
movq 0x68(%rbx), %rdi
addq $0x50, %rdi
testq %rcx, %rcx
je 0x9a70
movq 0x10(%rcx), %rsi
testq %rsi, %rsi
je 0x9a94
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rsi, %rax
incl %edx
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x9a5d
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
jmp 0x9a9c
movq 0x10(%r15), %rsi
testq %rsi, %rsi
je 0x9a98
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rsi, %rax
incl %edx
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x9a81
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
jmp 0x9a9a
xorl %edx, %edx
jmp 0x9a9c
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x34400
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x9ab2
movq 0x20(%r15), %rcx
movq %rcx, 0x20(%rax)
movq 0x30(%r15), %rsi
movq %r14, %rdi
callq 0x36f69
movq 0x38(%r15), %rsi
movq %r14, %rdi
callq 0x36f69
movq 0x8(%r15), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x9ca4
movq %r12, %r15
testq %r12, %r12
jne 0x9a19
movq %r14, %rdi
movq %rbx, %rsi
callq 0x36ed9
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x9ca4
movq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0x9ca4
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x34827
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0x3484e
testq %r14, %r14
je 0x9b2e
cmpq $0x0, 0x328(%r14)
jne 0x9b73
movq 0x58(%rbx), %rax
movq $0x0, 0x58(%rbx)
testq %rax, %rax
je 0x9b73
leaq 0x58(%rbx), %rcx
movq (%rax), %rdx
testq %rdx, %rdx
je 0x9b5b
movq 0x1d0(%rdx), %rsi
addq $0x1d0, %rdx            # imm = 0x1D0
jmp 0x9b60
movq %rcx, %rdx
xorl %esi, %esi
movq 0x28(%rax), %rdi
movq %rax, (%rdx)
movq %rsi, 0x28(%rax)
movq %rdi, %rax
testq %rdi, %rdi
jne 0x9b43
movq 0x50(%rbx), %rsi
testq %rsi, %rsi
je 0x9bb6
movl 0x4c(%rbx), %eax
testl %eax, %eax
jle 0x9bae
xorl %r15d, %r15d
cmpq $0x1, %r15
je 0x9b9f
movq 0x50(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0x9ca4
movl 0x4c(%rbx), %eax
incq %r15
movslq %eax, %rcx
cmpq %rcx, %r15
jl 0x9b86
movq 0x50(%rbx), %rsi
movq %r14, %rdi
callq 0x9ca4
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9ca4