// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3GenerateRowDelete
SQLITE_PRIVATE void sqlite3GenerateRowDelete(
  Parse *pParse,     /* Parsing context */
  Table *pTab,       /* Table containing the row to be deleted */
  Trigger *pTrigger, /* List of triggers to (potentially) fire */
  int iDataCur,      /* Cursor from which column data is extracted */
  int iIdxCur,       /* First index cursor */
  int iPk,           /* First memory cell containing the PRIMARY KEY */
  i16 nPk,           /* Number of PRIMARY KEY memory cells */
  u8 count,          /* If non-zero, increment the row change counter */
  u8 onconf,         /* Default ON CONFLICT policy for triggers */
  u8 eMode,          /* ONEPASS_OFF, _SINGLE, or _MULTI.  See above */
  int iIdxNoSeek     /* Cursor number of cursor that does not need seeking */
){
  Vdbe *v = pParse->pVdbe;        /* Vdbe */
  int iOld = 0;                   /* First register in OLD.* array */
  int iLabel;                     /* Label resolved to end of generated code */
  u8 opSeek;                      /* Seek opcode */

  /* Vdbe is guaranteed to have been allocated by this stage. */
  assert( v );
  VdbeModuleComment((v, "BEGIN: GenRowDel(%d,%d,%d,%d)",
                         iDataCur, iIdxCur, iPk, (int)nPk));

  /* Seek cursor iCur to the row to delete. If this row no longer exists 
  ** (this can happen if a trigger program has already deleted it), do
  ** not attempt to delete it or fire any DELETE triggers.  */
  iLabel = sqlite3VdbeMakeLabel(v);
  opSeek = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
  if( eMode==ONEPASS_OFF ){
    sqlite3VdbeAddOp4Int(v, opSeek, iDataCur, iLabel, iPk, nPk);
    VdbeCoverageIf(v, opSeek==OP_NotExists);
    VdbeCoverageIf(v, opSeek==OP_NotFound);
  }
 
  /* If there are any triggers to fire, allocate a range of registers to
  ** use for the old.* references in the triggers.  */
  if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){
    u32 mask;                     /* Mask of OLD.* columns in use */
    int iCol;                     /* Iterator used while populating OLD.* */
    int addrStart;                /* Start of BEFORE trigger programs */

    /* TODO: Could use temporary registers here. Also could attempt to
    ** avoid copying the contents of the rowid register.  */
    mask = sqlite3TriggerColmask(
        pParse, pTrigger, 0, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onconf
    );
    mask |= sqlite3FkOldmask(pParse, pTab);
    iOld = pParse->nMem+1;
    pParse->nMem += (1 + pTab->nCol);

    /* Populate the OLD.* pseudo-table register array. These values will be 
    ** used by any BEFORE and AFTER triggers that exist.  */
    sqlite3VdbeAddOp2(v, OP_Copy, iPk, iOld);
    for(iCol=0; iCol<pTab->nCol; iCol++){
      testcase( mask!=0xffffffff && iCol==31 );
      testcase( mask!=0xffffffff && iCol==32 );
      if( mask==0xffffffff || (iCol<=31 && (mask & MASKBIT32(iCol))!=0) ){
        sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+iCol+1);
      }
    }

    /* Invoke BEFORE DELETE trigger programs. */
    addrStart = sqlite3VdbeCurrentAddr(v);
    sqlite3CodeRowTrigger(pParse, pTrigger, 
        TK_DELETE, 0, TRIGGER_BEFORE, pTab, iOld, onconf, iLabel
    );

    /* If any BEFORE triggers were coded, then seek the cursor to the 
    ** row to be deleted again. It may be that the BEFORE triggers moved
    ** the cursor or of already deleted the row that the cursor was
    ** pointing to.
    */
    if( addrStart<sqlite3VdbeCurrentAddr(v) ){
      sqlite3VdbeAddOp4Int(v, opSeek, iDataCur, iLabel, iPk, nPk);
      VdbeCoverageIf(v, opSeek==OP_NotExists);
      VdbeCoverageIf(v, opSeek==OP_NotFound);
    }

    /* Do FK processing. This call checks that any FK constraints that
    ** refer to this table (i.e. constraints attached to other tables) 
    ** are not violated by deleting this row.  */
    sqlite3FkCheck(pParse, pTab, iOld, 0, 0, 0);
  }

  /* Delete the index and table entries. Skip this step if pTab is really
  ** a view (in which case the only effect of the DELETE statement is to
  ** fire the INSTEAD OF triggers).  */ 
  if( pTab->pSelect==0 ){
    sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,iIdxNoSeek);
    sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, (count?OPFLAG_NCHANGE:0));
    if( count ){
      sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);
    }
    if( iIdxNoSeek>=0 ){
      sqlite3VdbeAddOp1(v, OP_Delete, iIdxNoSeek);
    }
    sqlite3VdbeChangeP5(v, eMode==ONEPASS_MULTI);
  }

  /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to
  ** handle rows (possibly in other tables) that refer via a foreign key
  ** to the row just deleted. */ 
  sqlite3FkActions(pParse, pTab, 0, iOld, 0, 0);

  /* Invoke AFTER DELETE trigger programs. */
  sqlite3CodeRowTrigger(pParse, pTrigger, 
      TK_DELETE, 0, TRIGGER_AFTER, pTab, iOld, onconf, iLabel
  );

  /* Jump here if the row had already been deleted before any BEFORE
  ** trigger programs were invoked. Or if a trigger program throws a 
  ** RAISE(IGNORE) exception.  */
  sqlite3VdbeResolveLabel(v, iLabel);
  VdbeModuleComment((v, "END: GenRowDel()"));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, -0x34(%rbp)
movl %r8d, -0x58(%rbp)
movl %ecx, -0x30(%rbp)
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
movq 0x10(%rdi), %rbx
movq 0x30(%rbx), %rdi
callq 0x51729
movl %eax, %r13d
testb $0x20, 0x46(%r15)
sete %al
shlb $0x2, %al
addb $0x46, %al
movb %al, -0x29(%rbp)
cmpb $0x0, 0x28(%rbp)
jne 0x69d49
movzbl -0x29(%rbp), %esi
movq %rbx, %rdi
movl -0x30(%rbp), %edx
movl %r13d, %ecx
movl -0x34(%rbp), %r8d
callq 0x3ea9f
movswq 0x10(%rbp), %rdx
movq %rbx, %rdi
movl %eax, %esi
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x14b4f
movq (%r14), %rax
movl 0x2c(%rax), %edi
movq $0x0, -0x48(%rbp)
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x69799
movzbl 0x20(%rbp), %ecx
movq %rcx, -0x50(%rbp)
testq %r12, %r12
movq %r13, -0x68(%rbp)
jne 0x69d7c
testl %eax, %eax
je 0x69eb6
subq $0x8, %rsp
movq %r12, %rsi
xorl %r12d, %r12d
movq %r14, %rdi
movq %rsi, -0x40(%rbp)
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x3, %r8d
movq %r15, %r9
pushq -0x50(%rbp)
callq 0x6a2d5
addq $0x10, %rsp
movl %eax, -0x54(%rbp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x6a378
movl %eax, %r13d
movq %r14, %rdx
movl 0x54(%r14), %r14d
leal 0x1(%r14), %ecx
movswl 0x3e(%r15), %eax
leal 0x1(%r14,%rax), %eax
movq %rdx, -0x60(%rbp)
movl %eax, 0x54(%rdx)
movq %rbx, %rdi
movl $0x1f, %esi
movl -0x34(%rbp), %edx
movq %rcx, -0x48(%rbp)
xorl %r8d, %r8d
callq 0x3ea9f
movzwl 0x3e(%r15), %eax
testw %ax, %ax
jle 0x69e33
orl -0x54(%rbp), %r13d
addl $0x2, %r14d
cmpl $-0x1, %r13d
je 0x69e0e
cmpl $0x1f, %r12d
ja 0x69e28
btl %r12d, %r13d
jae 0x69e28
leal (%r14,%r12), %r8d
movq %rbx, %rdi
movq %r15, %rsi
movl -0x30(%rbp), %edx
movl %r12d, %ecx
callq 0x52c52
movzwl 0x3e(%r15), %eax
incl %r12d
movswl %ax, %ecx
cmpl %ecx, %r12d
jl 0x69dfc
movl 0x3c(%rbx), %r14d
subq $0x8, %rsp
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %r12
movq %r12, %rsi
movl $0x6d, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movq %r15, %r9
movq -0x68(%rbp), %r13
pushq %r13
pushq -0x50(%rbp)
pushq -0x48(%rbp)
callq 0x6a47f
addq $0x20, %rsp
cmpl 0x3c(%rbx), %r14d
jge 0x69e9b
movzbl -0x29(%rbp), %esi
movq %rbx, %rdi
movl -0x30(%rbp), %edx
movl %r13d, %ecx
movl -0x34(%rbp), %r8d
callq 0x3ea9f
movswq 0x10(%rbp), %rdx
movq %rbx, %rdi
movl %eax, %esi
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x14b4f
movq -0x60(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq -0x48(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x6a4fb
cmpq $0x0, 0x18(%r15)
jne 0x69f6a
movq %r12, -0x40(%rbp)
movl 0x30(%rbp), %r9d
movq %r14, %rdi
movb 0x18(%rbp), %r14b
movq %rdi, %r12
movq %r15, %rsi
movl -0x30(%rbp), %r13d
movl %r13d, %edx
movl -0x58(%rbp), %ecx
xorl %r8d, %r8d
callq 0x6aafc
xorl %ecx, %ecx
testb %r14b, %r14b
setne %cl
movq %rbx, %rdi
movl $0x63, %esi
movl %r13d, %edx
xorl %r8d, %r8d
callq 0x3ea9f
testb %r14b, %r14b
je 0x69f1a
movq (%r15), %rdx
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x14b4f
movl 0x30(%rbp), %edx
testl %edx, %edx
js 0x69f33
movq %rbx, %rdi
movl $0x63, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
cmpb $0x2, 0x28(%rbp)
sete %al
movq (%rbx), %rcx
cmpb $0x0, 0x51(%rcx)
movq %r12, %r14
je 0x69f4f
leaq 0x295ab(%rip), %rcx     # 0x934f8
jmp 0x69f63
movslq 0x3c(%rbx), %rcx
movq 0x8(%rbx), %rdx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rcx,8), %rcx
addq $-0x18, %rcx
movq -0x40(%rbp), %r12
movb %al, 0x3(%rcx)
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq -0x48(%rbp), %r13
movl %r13d, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x6ac04
subq $0x8, %rsp
movq %r14, %rdi
movq %r12, %rsi
movl $0x6d, %edx
xorl %ecx, %ecx
movl $0x2, %r8d
movq %r15, %r9
movq -0x68(%rbp), %r14
pushq %r14
pushq -0x50(%rbp)
pushq %r13
callq 0x6a47f
addq $0x20, %rsp
movq 0x30(%rbx), %rax
movq 0x80(%rax), %rdx
testq %rdx, %rdx
je 0x69fd0
notl %r14d
movl 0x3c(%rbx), %ecx
movslq %r14d, %rsi
movl %ecx, (%rdx,%rsi,4)
jmp 0x69fd3
movl 0x3c(%rbx), %ecx
decl %ecx
movl %ecx, 0x68(%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq