// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3FinishTrigger
SQLITE_PRIVATE void sqlite3FinishTrigger(
  Parse *pParse,          /* Parser context */
  TriggerStep *pStepList, /* The triggered program */
  Token *pAll             /* Token that describes the complete CREATE TRIGGER */
){
  Trigger *pTrig = pParse->pNewTrigger;   /* Trigger being finished */
  char *zName;                            /* Name of trigger */
  sqlite3 *db = pParse->db;               /* The database */
  DbFixer sFix;                           /* Fixer object */
  int iDb;                                /* Database containing the trigger */
  Token nameToken;                        /* Trigger name for error reporting */

  pParse->pNewTrigger = 0;
  if( NEVER(pParse->nErr) || !pTrig ) goto triggerfinish_cleanup;
  zName = pTrig->zName;
  iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
  pTrig->step_list = pStepList;
  while( pStepList ){
    pStepList->pTrig = pTrig;
    pStepList = pStepList->pNext;
  }
  sqlite3TokenInit(&nameToken, pTrig->zName);
  sqlite3FixInit(&sFix, pParse, iDb, "trigger", &nameToken);
  if( sqlite3FixTriggerStep(&sFix, pTrig->step_list)
   || sqlite3FixExpr(&sFix, pTrig->pWhen)
  ){
    goto triggerfinish_cleanup;
  }

#ifndef SQLITE_OMIT_ALTERTABLE
  if( IN_RENAME_OBJECT ){
    assert( !db->init.busy );
    pParse->pNewTrigger = pTrig;
    pTrig = 0;
  }else
#endif

  /* if we are not initializing,
  ** build the sqlite_schema entry
  */
  if( !db->init.busy ){
    Vdbe *v;
    char *z;

    /* Make an entry in the sqlite_schema table */
    v = sqlite3GetVdbe(pParse);
    if( v==0 ) goto triggerfinish_cleanup;
    sqlite3BeginWriteOperation(pParse, 0, iDb);
    z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n);
    testcase( z==0 );
    sqlite3NestedParse(pParse,
       "INSERT INTO %Q." DFLT_SCHEMA_TABLE
       " VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')",
       db->aDb[iDb].zDbSName, zName,
       pTrig->table, z);
    sqlite3DbFree(db, z);
    sqlite3ChangeCookie(pParse, iDb);
    sqlite3VdbeAddParseSchemaOp(v, iDb,
        sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName));
  }

  if( db->init.busy ){
    Trigger *pLink = pTrig;
    Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
    assert( pLink!=0 );
    pTrig = sqlite3HashInsert(pHash, zName, pTrig);
    if( pTrig ){
      sqlite3OomFault(db);
    }else if( pLink->pSchema==pLink->pTabSchema ){
      Table *pTab;
      pTab = sqlite3HashFind(&pLink->pTabSchema->tblHash, pLink->table);
      assert( pTab!=0 );
      pLink->pNext = pTab->pTrigger;
      pTab->pTrigger = pLink;
    }
  }

triggerfinish_cleanup:
  sqlite3DeleteTrigger(db, pTrig);
  assert( IN_RENAME_OBJECT || !pParse->pNewTrigger );
  sqlite3DeleteTriggerStep(db, pStepList);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x158(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0x158(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x4270a1
cmpq $0x0, -0x20(%rbp)
jne 0x4270a6
jmp 0x427341
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x3cb770
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x38(%rax)
cmpq $0x0, -0x10(%rbp)
je 0x4270f5
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x4270d4
movq -0x20(%rbp), %rax
movq (%rax), %rsi
leaq -0x78(%rbp), %rdi
callq 0x434fd0
movq -0x8(%rbp), %rsi
movl -0x64(%rbp), %edx
leaq -0x60(%rbp), %rdi
leaq 0x183d13(%rip), %rcx    # 0x5aae2a
leaq -0x78(%rbp), %r8
callq 0x43ce90
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rsi
leaq -0x60(%rbp), %rdi
callq 0x462f60
cmpl $0x0, %eax
jne 0x42714c
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x60(%rbp), %rdi
callq 0x43d790
cmpl $0x0, %eax
je 0x427151
jmp 0x427341
movq -0x8(%rbp), %rax
movzbl 0x11c(%rax), %eax
cmpl $0x2, %eax
jl 0x42717d
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x158(%rax)
movq $0x0, -0x20(%rbp)
jmp 0x42726d
movq -0x30(%rbp), %rax
cmpb $0x0, 0xb5(%rax)
jne 0x42726b
movq -0x8(%rbp), %rdi
callq 0x4299d0
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x4271a7
jmp 0x427341
movq -0x8(%rbp), %rdi
movl -0x64(%rbp), %edx
xorl %esi, %esi
callq 0x433bf0
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %edx
callq 0x40bb40
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x64(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x88(%rbp), %r9
leaq 0x18752c(%rip), %rsi    # 0x5ae735
movb $0x0, %al
callq 0x434d60
movq -0x30(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x3c00a0
movq -0x8(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x434f00
movq -0x80(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x187531(%rip), %rsi    # 0x5ae780
movb $0x0, %al
callq 0x3cb7d0
movq -0xb0(%rbp), %rdi
movl -0xa4(%rbp), %esi
movq %rax, %rdx
callq 0x434f60
jmp 0x42726d
movq -0x30(%rbp), %rax
cmpb $0x0, 0xb5(%rax)
je 0x42733f
movq -0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x64(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
addq $0x38, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x40ada0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x4272d5
movq -0x30(%rbp), %rdi
callq 0x3c8ba0
jmp 0x42733d
movq -0x90(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x90(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jne 0x42733b
movq -0x90(%rbp), %rax
movq 0x30(%rax), %rdi
addq $0x8, %rdi
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x40ad70
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq 0x68(%rax), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x90(%rbp), %rcx
movq -0xa0(%rbp), %rax
movq %rcx, 0x68(%rax)
jmp 0x42733d
jmp 0x42733f
jmp 0x427341
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3bfea0
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x4122f0
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)