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

  iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);
  assert( iDb>=0 && iDb<db->nDb );
  pTable = tableOfTrigger(pTrigger);
  assert( pTable );
  assert( pTable->pSchema==pTrigger->pSchema || iDb==1 );
#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    int code = SQLITE_DROP_TRIGGER;
    const char *zDb = db->aDb[iDb].zName;
    const char *zTab = SCHEMA_TABLE(iDb);
    if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER;
    if( sqlite3AuthCheck(pParse, code, pTrigger->zName, pTable->zName, zDb) ||
      sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
      return;
    }
  }
#endif

  /* Generate code to destroy the database record of the trigger.
  */
  assert( pTable!=0 );
  if( (v = sqlite3GetVdbe(pParse))!=0 ){
    int base;
    static const VdbeOpList dropTrigger[] = {
      { OP_Rewind,     0, ADDR(9),  0},
      { OP_String8,    0, 1,        0}, /* 1 */
      { OP_Column,     0, 1,        2},
      { OP_Ne,         2, ADDR(8),  1},
      { OP_String8,    0, 1,        0}, /* 4: "trigger" */
      { OP_Column,     0, 0,        2},
      { OP_Ne,         2, ADDR(8),  1},
      { OP_Delete,     0, 0,        0},
      { OP_Next,       0, ADDR(1),  0}, /* 8 */
    };

    sqlite3BeginWriteOperation(pParse, 0, iDb);
    sqlite3OpenMasterTable(pParse, iDb);
    base = sqlite3VdbeAddOpList(v,  ArraySize(dropTrigger), dropTrigger);
    sqlite3VdbeChangeP4(v, base+1, pTrigger->zName, P4_TRANSIENT);
    sqlite3VdbeChangeP4(v, base+4, "trigger", P4_STATIC);
    sqlite3ChangeCookie(pParse, iDb);
    sqlite3VdbeAddOp2(v, OP_Close, 0, 0);
    sqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->zName, 0);
    if( pParse->nMem<3 ){
      pParse->nMem = 3;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r12
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0x4fe07
movl 0x28(%r12), %ecx
testl %ecx, %ecx
jle 0x4fe0f
movq 0x20(%r12), %rdx
addq $0x18, %rdx
xorl %r15d, %r15d
cmpq %rax, (%rdx)
je 0x4fe12
incq %r15
addq $0x20, %rdx
cmpq %r15, %rcx
jne 0x4fdf1
movl %ecx, %r15d
jmp 0x4fe12
movl $0xfff0bdc0, %r15d      # imm = 0xFFF0BDC0
jmp 0x4fe12
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x34a43
movq 0x20(%r12), %rcx
movslq %r15d, %rdx
movq %rdx, %rsi
shlq $0x5, %rsi
movq (%rcx,%rsi), %r12
xorl %ecx, %ecx
cmpl $0x1, %edx
setne %cl
leal 0xe(,%rcx,2), %esi
movq (%r14), %rdx
movq (%rax), %rcx
movq %rbx, %rdi
movq %r12, %r8
callq 0x460eb
testl %eax, %eax
jne 0x4fe7d
cmpl $0x1, %r15d
leaq 0x2a0bd(%rip), %rax     # 0x79f19
leaq 0x2a0c9(%rip), %rdx     # 0x79f2c
cmoveq %rax, %rdx
movq %rbx, %rdi
movl $0x9, %esi
xorl %ecx, %ecx
movq %r12, %r8
callq 0x460eb
testl %eax, %eax
je 0x4fe8c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x45ece
testq %rax, %rax
je 0x4fe7d
movq %rax, %r12
movq 0x1d8(%rbx), %r13
testq %r13, %r13
cmoveq %rbx, %r13
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4632f
movl $0x1, %eax
movl %r15d, %ecx
shll %cl, %eax
orl %eax, 0x164(%r13)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x46424
leaq 0x289e8(%rip), %rdx     # 0x788c0
movq %r12, %rdi
movl $0x9, %esi
callq 0x119d6
movl %eax, %r13d
leal 0x1(%r13), %esi
movq (%r14), %rdx
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x11a9f
addl $0x4, %r13d
leaq 0x2d0c9(%rip), %rdx     # 0x7cfcd
movq %r12, %rdi
movl %r13d, %esi
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x11a9f
movq %rbx, %rdi
movl %r15d, %esi
callq 0x46a12
movq %r12, %rdi
movl $0x36, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45f15
movq (%r14), %r14
movq %r12, %rdi
movl $0x74, %esi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45f15
movq %r12, %rdi
movl %eax, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x11a9f
cmpl $0x2, 0x58(%rbx)
jg 0x4fe7d
movl $0x3, 0x58(%rbx)
jmp 0x4fe7d