// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: codeTriggerProgram
static int codeTriggerProgram(
  Parse *pParse,            /* The parser context */
  TriggerStep *pStepList,   /* List of statements inside the trigger body */
  int orconf                /* Conflict algorithm. (OE_Abort, etc) */
){
  TriggerStep *pStep;
  Vdbe *v = pParse->pVdbe;
  sqlite3 *db = pParse->db;

  assert( pParse->pTriggerTab && pParse->pToplevel );
  assert( pStepList );
  assert( v!=0 );
  for(pStep=pStepList; pStep; pStep=pStep->pNext){
    /* Figure out the ON CONFLICT policy that will be used for this step
    ** of the trigger program. If the statement that caused this trigger
    ** to fire had an explicit ON CONFLICT, then use it. Otherwise, use
    ** the ON CONFLICT policy that was specified as part of the trigger
    ** step statement. Example:
    **
    **   CREATE TRIGGER AFTER INSERT ON t1 BEGIN;
    **     INSERT OR REPLACE INTO t2 VALUES(new.a, new.b);
    **   END;
    **
    **   INSERT INTO t1 ... ;            -- insert into t2 uses REPLACE policy
    **   INSERT OR IGNORE INTO t1 ... ;  -- insert into t2 uses IGNORE policy
    */
    pParse->eOrconf = (orconf==OE_Default)?pStep->orconf:(u8)orconf;
    assert( pParse->okConstFactor==0 );

#ifndef SQLITE_OMIT_TRACE
    if( pStep->zSpan ){
      sqlite3VdbeAddOp4(v, OP_Trace, 0x7fffffff, 1, 0,
                        sqlite3MPrintf(db, "-- %s", pStep->zSpan),
                        P4_DYNAMIC);
    }
#endif

    switch( pStep->op ){
      case TK_UPDATE: {
        sqlite3Update(pParse,
          sqlite3TriggerStepSrc(pParse, pStep),
          sqlite3ExprListDup(db, pStep->pExprList, 0),
          sqlite3ExprDup(db, pStep->pWhere, 0),
          pParse->eOrconf, 0, 0, 0
        );
        break;
      }
      case TK_INSERT: {
        sqlite3Insert(pParse,
          sqlite3TriggerStepSrc(pParse, pStep),
          sqlite3SelectDup(db, pStep->pSelect, 0),
          sqlite3IdListDup(db, pStep->pIdList),
          pParse->eOrconf,
          sqlite3UpsertDup(db, pStep->pUpsert)
        );
        break;
      }
      case TK_DELETE: {
        sqlite3DeleteFrom(pParse,
          sqlite3TriggerStepSrc(pParse, pStep),
          sqlite3ExprDup(db, pStep->pWhere, 0), 0, 0
        );
        break;
      }
      default: assert( pStep->op==TK_SELECT ); {
        SelectDest sDest;
        Select *pSelect = sqlite3SelectDup(db, pStep->pSelect, 0);
        sqlite3SelectDestInit(&sDest, SRT_Discard, 0);
        sqlite3Select(pParse, pSelect, &sDest);
        sqlite3SelectDelete(db, pSelect);
        break;
      }
    }
    if( pStep->op!=TK_SELECT ){
      sqlite3VdbeAddOp0(v, OP_ResetCount);
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x45c4d1
cmpl $0xb, -0x14(%rbp)
jne 0x45c243
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, -0x64(%rbp)
jmp 0x45c24c
movl -0x14(%rbp), %eax
movzbl %al, %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0xd1(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x45c2ad
movq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rdx
leaq 0x14f7fa(%rip), %rsi    # 0x5aba7b
movb $0x0, %al
callq 0x3cb7d0
movq -0x70(%rbp), %rdi
movq %rax, %r9
movl $0xaa, %esi
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl $0x1, %ecx
xorl %r8d, %r8d
movl $0xfffffff9, (%rsp)     # imm = 0xFFFFFFF9
callq 0x429aa0
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x74(%rbp)
subl $0x7d, %eax
je 0x45c368
jmp 0x45c2c2
movl -0x74(%rbp), %eax
subl $0x7e, %eax
je 0x45c40b
jmp 0x45c2d0
movl -0x74(%rbp), %eax
subl $0x7f, %eax
jne 0x45c45d
jmp 0x45c2de
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x45c5b0
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rsi
xorl %edx, %edx
callq 0x432810
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rsi
xorl %edx, %edx
callq 0x42dee0
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq %rax, %rcx
movq -0x8(%rbp), %rax
movzbl 0xd1(%rax), %r8d
xorl %eax, %eax
movl %eax, %r9d
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x41eba0
jmp 0x45c4a2
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x45c5b0
movq %rax, -0xb0(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
callq 0x4325b0
movq %rax, -0xa8(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x433130
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movzbl 0xd1(%rax), %eax
movl %eax, -0x94(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x45c690
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq -0xa0(%rbp), %rcx
movl -0x94(%rbp), %r8d
movq %rax, %r9
callq 0x420d10
jmp 0x45c4a2
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x45c5b0
movq %rax, -0xc0(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rsi
xorl %edx, %edx
callq 0x42dee0
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq %rax, %rdx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x41de20
jmp 0x45c4a2
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
callq 0x4325b0
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x430c20
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x41aee0
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x40c7e0
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x88, %eax
je 0x45c4be
movq -0x28(%rbp), %rdi
movl $0x7b, %esi
callq 0x429a40
jmp 0x45c4c0
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x45c225
xorl %eax, %eax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)