// File: /workspace/github_c_makefile_star2_O1/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 0x40790
movl %edx, %r13d
movq %rdi, %r15
callq 0x36175
testl %eax, %eax
je 0x407a9
movq %r14, %rdi
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x341f5
movq 0x10(%rbx), %r12
movq 0x18(%rbx), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x3375e
testq %rax, %rax
je 0x407dc
testb $0x3, 0x57(%rax)
je 0x407ee
leaq 0x3b764(%rip), %rsi     # 0x7bf32
movq %r15, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x11724
jmp 0x40790
testl %r13d, %r13d
je 0x40820
movq %r15, %rdi
movq %r12, %rsi
callq 0x4f7ee
jmp 0x40836
movq 0x30(%rax), %rsi
testq %rsi, %rsi
je 0x40840
movl 0x28(%r14), %ecx
testl %ecx, %ecx
jle 0x40848
movq 0x20(%r14), %rdx
addq $0x18, %rdx
xorl %r13d, %r13d
cmpq %rsi, (%rdx)
je 0x4084b
incq %r13
addq $0x20, %rdx
cmpq %r13, %rcx
jne 0x4080a
movl %ecx, %r13d
jmp 0x4084b
leaq 0x3b6f9(%rip), %rsi     # 0x7bf20
movq %r15, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x11724
movb $0x1, 0x1d(%r15)
jmp 0x40790
movl $0xfff0bdc0, %r13d      # imm = 0xFFF0BDC0
jmp 0x4084b
xorl %r13d, %r13d
movq 0x18(%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x20(%r14), %rdx
movslq %r13d, %rcx
movq %rcx, %r12
shlq $0x5, %r12
movq (%rdx,%r12), %r8
cmpl $0x1, %ecx
leaq 0x396aa(%rip), %rcx     # 0x79f19
leaq 0x396b6(%rip), %rdx     # 0x79f2c
cmoveq %rcx, %rdx
movq %r15, %rdi
movq %rax, -0x38(%rbp)
movl $0x9, %esi
movq %rdx, -0x40(%rbp)
xorl %ecx, %ecx
movq %r8, -0x30(%rbp)
callq 0x45d75
testl %eax, %eax
jne 0x40790
xorl %eax, %eax
testl %r13d, %r13d
setne %al
leal 0xa(,%rax,2), %esi
movq -0x38(%rbp), %rax
movq (%rax), %rdx
movq -0x48(%rbp), %rax
movq (%rax), %rcx
movq %r15, %rdi
movq -0x30(%rbp), %r8
callq 0x45d75
testl %eax, %eax
jne 0x40790
movq %r15, %rdi
callq 0x45b57
testq %rax, %rax
je 0x40790
movq %rax, -0x30(%rbp)
movq %r15, %rdi
movl $0x1, %esi
movl %r13d, %edx
callq 0x460a9
movq 0x20(%r14), %rax
movq (%rax,%r12), %rdx
movq -0x38(%rbp), %r12
movq (%r12), %r8
leaq 0x3b671(%rip), %rsi     # 0x7bf7b
movq %r15, %rdi
movq -0x40(%rbp), %rcx
xorl %eax, %eax
callq 0x465b3
movq (%r12), %rcx
leaq 0x3b689(%rip), %rdx     # 0x7bfac
movq %r15, %rdi
movl %r13d, %esi
callq 0x4f89f
movq %r15, %rdi
movl %r13d, %esi
callq 0x466e1
movl 0x50(%r12), %esi
movq %r15, %rdi
movl %r13d, %edx
callq 0x4ff8b
movq (%r12), %r15
movq -0x30(%rbp), %r12
movq %r12, %rdi
movl $0x73, %esi
movl %r13d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movq %r12, %rdi
movl %eax, %esi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x11975
jmp 0x40790