// File: /workspace/github_c_makefile_star2_O0/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
subq $0x70, %rsp
movl 0x30(%rbp), %eax
movb 0x28(%rbp), %al
movb 0x20(%rbp), %al
movb 0x18(%rbp), %al
movw 0x10(%rbp), %ax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6e5a0
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x46(%rax), %edx
andl $0x20, %edx
movl $0x46, %eax
movl $0x4a, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movb %al, -0x39(%rbp)
movzbl 0x28(%rbp), %eax
cmpl $0x0, %eax
jne 0x901b1
movq -0x30(%rbp), %rdi
movzbl -0x39(%rbp), %esi
movl -0x1c(%rbp), %edx
movl -0x38(%rbp), %ecx
movl -0x24(%rbp), %r8d
movswl 0x10(%rbp), %r9d
callq 0x17b10
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x8fa50
cmpl $0x0, %eax
jne 0x901d4
cmpq $0x0, -0x18(%rbp)
je 0x9033a
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %r9
movzbl 0x20(%rbp), %eax
xorl %ecx, %ecx
movl %ecx, %edx
xorl %ecx, %ecx
movl $0x3, %r8d
movl %eax, (%rsp)
callq 0x90810
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x908f0
orl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl 0x54(%rax), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movswl 0x3e(%rax), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
addl 0x54(%rax), %ecx
movl %ecx, 0x54(%rax)
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x34(%rbp), %ecx
movl $0x1f, %esi
callq 0x6c310
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x3e(%rcx), %ecx
cmpl %ecx, %eax
jge 0x902a8
cmpl $-0x1, -0x40(%rbp)
je 0x9027c
cmpl $0x1f, -0x44(%rbp)
jg 0x9029b
movl -0x40(%rbp), %eax
movl -0x44(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x9029b
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x44(%rbp), %ecx
movl -0x34(%rbp), %r8d
addl -0x44(%rbp), %r8d
addl $0x1, %r8d
callq 0x6ff20
jmp 0x9029d
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x9024b
movq -0x30(%rbp), %rdi
callq 0x6c2b0
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %r9
movl -0x34(%rbp), %r11d
movzbl 0x20(%rbp), %r10d
movl -0x38(%rbp), %eax
movl $0x6d, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x90a70
movl -0x48(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6c2b0
movl %eax, %ecx
movl -0x4c(%rbp), %eax
cmpl %ecx, %eax
jge 0x9031f
movq -0x30(%rbp), %rdi
movzbl -0x39(%rbp), %esi
movl -0x1c(%rbp), %edx
movl -0x38(%rbp), %ecx
movl -0x24(%rbp), %r8d
movswl 0x10(%rbp), %r9d
callq 0x17b10
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x34(%rbp), %edx
xorl %r9d, %r9d
xorl %eax, %eax
movl %eax, %r8d
movl %r9d, %ecx
callq 0x90b10
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x903d6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movl 0x30(%rbp), %r9d
xorl %eax, %eax
movl %eax, %r8d
callq 0x91180
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %edx
movzbl 0x18(%rbp), %esi
xorl %ecx, %ecx
movl $0x1, %eax
cmpl $0x0, %esi
cmovnel %eax, %ecx
movl $0x63, %esi
callq 0x6c310
cmpb $0x0, 0x18(%rbp)
je 0x903a4
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
callq 0x17dd0
cmpl $0x0, 0x30(%rbp)
jl 0x903bb
movq -0x30(%rbp), %rdi
movl 0x30(%rbp), %edx
movl $0x63, %esi
callq 0x6e570
movq -0x30(%rbp), %rdi
movzbl 0x28(%rbp), %eax
cmpl $0x2, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movzbl %al, %esi
callq 0x17b70
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x34(%rbp), %ecx
xorl %eax, %eax
movl %eax, %r8d
xorl %r9d, %r9d
movq %r8, %rdx
callq 0x91300
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %r9
movl -0x34(%rbp), %r11d
movzbl 0x20(%rbp), %r10d
movl -0x38(%rbp), %eax
movl $0x6d, %edx
xorl %ecx, %ecx
movl $0x2, %r8d
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x90a70
movq -0x30(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x6e780
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)