// File: /workspace/github_c_makefile_star2_O1/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 0x9964
movq %rsi, %rbx
movq %rdi, %r14
testq %rdi, %rdi
je 0x995e
cmpq $0x0, 0x328(%r14)
jne 0x996d
decw 0x44(%rbx)
je 0x996d
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbx), %r15
testq %r15, %r15
je 0x99d0
movq 0x28(%r15), %r12
testq %r14, %r14
je 0x9989
cmpq $0x0, 0x328(%r14)
jne 0x99bd
movq (%r15), %rsi
testq %rsi, %rsi
je 0x99ac
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rsi, %rax
incl %edx
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x9999
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
jmp 0x99ae
xorl %edx, %edx
movq 0x30(%r15), %rdi
addq $0x20, %rdi
xorl %ecx, %ecx
callq 0x33cea
movq %r14, %rdi
movq %r15, %rsi
callq 0x34037
movq %r12, %r15
testq %r12, %r12
jne 0x9976
movq 0x20(%rbx), %r15
testq %r15, %r15
je 0x9a80
testq %r14, %r14
je 0x99ec
cmpq $0x0, 0x328(%r14)
jne 0x9a4d
movq 0x18(%r15), %rcx
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x99ff
movq %rcx, 0x18(%rax)
jmp 0x9a3c
testq %rcx, %rcx
movq %rcx, %rax
cmoveq %r15, %rax
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x9a2d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rsi, %rax
incl %edx
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x9a1a
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
jmp 0x9a2f
xorl %edx, %edx
movq 0x68(%rbx), %rdi
addq $0x50, %rdi
callq 0x33cea
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x9a4d
movq 0x20(%r15), %rcx
movq %rcx, 0x20(%rax)
movq 0x30(%r15), %rsi
movq %r14, %rdi
callq 0x36862
movq 0x38(%r15), %rsi
movq %r14, %rdi
callq 0x36862
movq 0x8(%r15), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x9c3a
movq %r12, %r15
testq %r12, %r12
jne 0x99dd
movq %r14, %rdi
movq %rbx, %rsi
callq 0x367d5
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
movq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x340e4
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0x3410b
testq %r14, %r14
je 0x9ac9
cmpq $0x0, 0x328(%r14)
jne 0x9b0e
movq 0x58(%rbx), %rax
movq $0x0, 0x58(%rbx)
testq %rax, %rax
je 0x9b0e
movq (%rax), %rdx
movq 0x28(%rax), %rcx
testq %rdx, %rdx
je 0x9afa
movq 0x1d0(%rdx), %rsi
movq %rsi, 0x28(%rax)
movq %rax, 0x1d0(%rdx)
jmp 0x9b06
movq %rax, 0x58(%rbx)
movq $0x0, 0x28(%rax)
movq %rcx, %rax
testq %rcx, %rcx
jne 0x9ada
cmpq $0x0, 0x50(%rbx)
je 0x9b4c
cmpl $0x0, 0x4c(%rbx)
jle 0x9b40
xorl %r15d, %r15d
cmpq $0x1, %r15
je 0x9b34
movq 0x50(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0x9c3a
incq %r15
movslq 0x4c(%rbx), %rax
cmpq %rax, %r15
jl 0x9b1e
movq 0x50(%rbx), %rsi
movq %r14, %rdi
callq 0x9c3a
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9c3a