// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3DropIndex
SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){
  Index *pIndex;
  Vdbe *v;
  sqlite3 *db = pParse->db;
  int iDb;

  assert( pParse->nErr==0 );   /* Never called with prior errors */
  if( db->mallocFailed ){
    goto exit_drop_index;
  }
  assert( pName->nSrc==1 );
  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
    goto exit_drop_index;
  }
  pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);
  if( pIndex==0 ){
    if( !ifExists ){
      sqlite3ErrorMsg(pParse, "no such index: %S", pName, 0);
    }else{
      sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase);
    }
    pParse->checkSchema = 1;
    goto exit_drop_index;
  }
  if( pIndex->autoIndex ){
    sqlite3ErrorMsg(pParse, "index associated with UNIQUE "
      "or PRIMARY KEY constraint cannot be dropped", 0);
    goto exit_drop_index;
  }
  iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    int code = SQLITE_DROP_INDEX;
    Table *pTab = pIndex->pTable;
    const char *zDb = db->aDb[iDb].zName;
    const char *zTab = SCHEMA_TABLE(iDb);
    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
      goto exit_drop_index;
    }
    if( !OMIT_TEMPDB && iDb ) code = SQLITE_DROP_TEMP_INDEX;
    if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
      goto exit_drop_index;
    }
  }
#endif

  /* Generate code to remove the index and from the master table */
  v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3BeginWriteOperation(pParse, 1, iDb);
    sqlite3NestedParse(pParse,
       "DELETE FROM %Q.%s WHERE name=%Q AND type='index'",
       db->aDb[iDb].zName, SCHEMA_TABLE(iDb), pIndex->zName
    );
    sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName);
    sqlite3ChangeCookie(pParse, iDb);
    destroyRootPage(pParse, pIndex->tnum, iDb);
    sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0);
  }

exit_drop_index:
  sqlite3SrcListDelete(db, pName);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq (%rdi), %r14
cmpb $0x0, 0x50(%r14)
jne 0x40b76
movl %edx, %r13d
movq %rdi, %r15
callq 0x36884
testl %eax, %eax
je 0x40b8f
movq %r14, %rdi
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3493b
movq 0x10(%rbx), %r12
movq 0x18(%rbx), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x33e69
testq %rax, %rax
je 0x40bc2
testb $0x3, 0x57(%rax)
je 0x40bd4
leaq 0x3b37e(%rip), %rsi     # 0x7bf32
movq %r15, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x11842
jmp 0x40b76
testl %r13d, %r13d
je 0x40c34
movq %r15, %rdi
movq %r12, %rsi
callq 0x4f7b5
jmp 0x40c4a
movq 0x30(%rax), %rcx
testq %rcx, %rcx
je 0x40c54
movl 0x28(%r14), %edx
testl %edx, %edx
jle 0x40c5c
leaq 0x20(%r14), %rsi
movq %rsi, -0x40(%rbp)
movq 0x20(%r14), %rdi
leaq 0x18(%rdi), %rsi
xorl %r13d, %r13d
cmpq %rcx, (%rsi)
je 0x40c0c
incq %r13
addq $0x20, %rsi
cmpq %r13, %rdx
jne 0x40bf8
movl %edx, %r13d
movslq %r13d, %rdx
movq %rdx, %rcx
shlq $0x5, %rcx
addq %rcx, %rdi
movq %rdx, -0x38(%rbp)
cmpl $0x1, %edx
leaq 0x392f2(%rip), %rcx     # 0x79f19
leaq 0x392fe(%rip), %rdx     # 0x79f2c
cmoveq %rcx, %rdx
jmp 0x40c7d
leaq 0x3b2e5(%rip), %rsi     # 0x7bf20
movq %r15, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x11842
movb $0x1, 0x1d(%r15)
jmp 0x40b76
movl $0xfff0bdc0, %r13d      # imm = 0xFFF0BDC0
jmp 0x40c5f
xorl %r13d, %r13d
leaq 0x20(%r14), %rcx
movq %rcx, -0x40(%rbp)
movslq %r13d, %rdi
movq %rdi, -0x38(%rbp)
shlq $0x5, %rdi
addq 0x20(%r14), %rdi
leaq 0x392af(%rip), %rdx     # 0x79f2c
movq 0x18(%rax), %rcx
movq %rcx, -0x30(%rbp)
movq (%rdi), %r8
movq %rax, -0x48(%rbp)
movq %r15, %rdi
movl $0x9, %esi
movq %rdx, -0x50(%rbp)
xorl %ecx, %ecx
movq %r8, %r12
callq 0x460eb
testl %eax, %eax
jne 0x40b76
xorl %eax, %eax
testl %r13d, %r13d
setne %al
leal 0xa(,%rax,2), %esi
movq -0x48(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %r15, %rdi
movq %r12, %r8
callq 0x460eb
testl %eax, %eax
jne 0x40b76
movq %r15, %rdi
callq 0x45ece
testq %rax, %rax
je 0x40b76
movq %rax, -0x30(%rbp)
movq %r15, %rdi
movl $0x1, %esi
movl %r13d, %edx
callq 0x463e1
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rdx
movq -0x48(%rbp), %r12
movq (%r12), %r8
leaq 0x3b25a(%rip), %rsi     # 0x7bf7b
movq %r15, %rdi
movq -0x50(%rbp), %rcx
xorl %eax, %eax
callq 0x468e4
movq (%r12), %rcx
leaq 0x3b272(%rip), %rdx     # 0x7bfac
movq %r15, %rdi
movl %r13d, %esi
callq 0x4f86f
movq %r15, %rdi
movl %r13d, %esi
callq 0x46a12
movl 0x50(%r12), %esi
movq %r15, %rdi
movl %r13d, %edx
callq 0x4ff70
movq (%r12), %r15
movq -0x30(%rbp), %r12
movq %r12, %rdi
movl $0x73, %esi
movl %r13d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45f15
movq %r12, %rdi
movl %eax, %esi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x11a9f
jmp 0x40b76