// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: renameResolveTrigger
static int renameResolveTrigger(Parse *pParse){
  sqlite3 *db = pParse->db;
  Trigger *pNew = pParse->pNewTrigger;
  TriggerStep *pStep;
  NameContext sNC;
  int rc = SQLITE_OK;

  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
  assert( pNew->pTabSchema );
  pParse->pTriggerTab = sqlite3FindTable(db, pNew->table,
      db->aDb[sqlite3SchemaToIndex(db, pNew->pTabSchema)].zDbSName
  );
  pParse->eTriggerOp = pNew->op;
  /* ALWAYS() because if the table of the trigger does not exist, the
  ** error would have been hit before this point */
  if( ALWAYS(pParse->pTriggerTab) ){
    rc = sqlite3ViewGetColumnNames(pParse, pParse->pTriggerTab);
  }

  /* Resolve symbols in WHEN clause */
  if( rc==SQLITE_OK && pNew->pWhen ){
    rc = sqlite3ResolveExprNames(&sNC, pNew->pWhen);
  }

  for(pStep=pNew->step_list; rc==SQLITE_OK && pStep; pStep=pStep->pNext){
    if( pStep->pSelect ){
      sqlite3SelectPrep(pParse, pStep->pSelect, &sNC);
      if( pParse->nErr ) rc = pParse->rc;
    }
    if( rc==SQLITE_OK && pStep->zTarget ){
      SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
      if( pSrc ){
        int i;
        for(i=0; i<pSrc->nSrc && rc==SQLITE_OK; i++){
          struct SrcList_item *p = &pSrc->a[i];
          p->pTab = sqlite3LocateTableItem(pParse, 0, p);
          p->iCursor = pParse->nTab++;
          if( p->pTab==0 ){
            rc = SQLITE_ERROR;
          }else{
            p->pTab->nTabRef++;
            rc = sqlite3ViewGetColumnNames(pParse, p->pTab);
          }
        }
        sNC.pSrcList = pSrc;
        if( rc==SQLITE_OK && pStep->pWhere ){
          rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere);
        }
        if( rc==SQLITE_OK ){
          rc = sqlite3ResolveExprListNames(&sNC, pStep->pExprList);
        }
        assert( !pStep->pUpsert || (!pStep->pWhere && !pStep->pExprList) );
        if( pStep->pUpsert ){
          Upsert *pUpsert = pStep->pUpsert;
          assert( rc==SQLITE_OK );
          pUpsert->pUpsertSrc = pSrc;
          sNC.uNC.pUpsert = pUpsert;
          sNC.ncFlags = NC_UUpsert;
          rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
          if( rc==SQLITE_OK ){
            ExprList *pUpsertSet = pUpsert->pUpsertSet;
            rc = sqlite3ResolveExprListNames(&sNC, pUpsertSet);
          }
          if( rc==SQLITE_OK ){
            rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertWhere);
          }
          if( rc==SQLITE_OK ){
            rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
          }
          sNC.ncFlags = 0;
        }
        sNC.pSrcList = 0;
        sqlite3SrcListDelete(db, pSrc);
      }else{
        rc = SQLITE_NOMEM;
      }
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x158(%rdi), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rsp)
movups %xmm0, 0x28(%rsp)
movups %xmm0, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x8(%r15), %rsi
movq 0x30(%r15), %rdx
movq %rax, 0x8(%rsp)
movq 0x20(%rax), %rax
testq %rdx, %rdx
je 0x2ed338
leaq 0x18(%rax), %rdi
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
movabsq $0x100000000, %r8       # imm = 0x100000000
addq %r8, %rcx
leaq 0x20(%rdi), %r9
cmpq %rdx, (%rdi)
movq %r9, %rdi
jne 0x2ed323
sarq $0x20, %rcx
jmp 0x2ed33f
movq $-0x8000, %rcx          # imm = 0x8000
shlq $0x5, %rcx
movq (%rax,%rcx), %rdx
movq 0x8(%rsp), %rdi
callq 0x2811f8
movq %rax, 0xa8(%rbx)
movb 0x10(%r15), %cl
movb %cl, 0xd0(%rbx)
testq %rax, %rax
je 0x2ed37f
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2c8512
movl $0x1, %ebp
testl %eax, %eax
jne 0x2ed54a
movq 0x18(%r15), %rsi
testq %rsi, %rsi
je 0x2ed396
leaq 0x10(%rsp), %rdi
callq 0x2c496c
movl %eax, %ebp
jmp 0x2ed398
xorl %ebp, %ebp
movq 0x38(%r15), %r15
testl %ebp, %ebp
sete %al
testq %r15, %r15
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2ed54a
leaq 0x10(%rsp), %r14
movq 0x10(%r15), %rsi
testq %rsi, %rsi
je 0x2ed3dc
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2c6ee7
cmpl $0x0, 0x30(%rbx)
je 0x2ed3dc
movl 0x18(%rbx), %ebp
testl %ebp, %ebp
jne 0x2ed54a
cmpq $0x0, 0x18(%r15)
je 0x2ed461
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2e2baf
testq %rax, %rax
je 0x2ed545
movq %rax, %r13
cmpl $0x0, (%rax)
jle 0x2ed468
movq %r13, %rbp
addq $0x48, %rbp
movl $0x1, %r12d
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2c84c3
movq %rax, -0x20(%rbp)
movl 0x34(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x34(%rbx)
movl %ecx, (%rbp)
testq %rax, %rax
je 0x2ed49b
incl 0x3c(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2c8512
movslq (%r13), %rcx
cmpq %rcx, %r12
jge 0x2ed451
addq $0x70, %rbp
incq %r12
testl %eax, %eax
je 0x2ed40c
movq %r13, 0x18(%rsp)
movl $0x1, %ebp
testl %eax, %eax
jne 0x2ed4a5
jmp 0x2ed46d
xorl %ebp, %ebp
jmp 0x2ed50b
movq %r13, 0x18(%rsp)
movq 0x28(%r15), %rsi
testq %rsi, %rsi
je 0x2ed489
leaq 0x10(%rsp), %rdi
callq 0x2c496c
movl $0x1, %ebp
testl %eax, %eax
jne 0x2ed4a5
movq 0x30(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x2c4a43
movl %eax, %ebp
jmp 0x2ed4a5
movq %r13, 0x18(%rsp)
movl $0x1, %ebp
movq 0x40(%r15), %r12
testq %r12, %r12
je 0x2ed4f0
movq %r13, 0x28(%r12)
movq %r12, 0x20(%rsp)
movl $0x200, 0x38(%rsp)      # imm = 0x200
movq (%r12), %rsi
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x2c4a43
testl %eax, %eax
jne 0x2ed4e6
movq 0x10(%r12), %rsi
movq %r14, %rdi
callq 0x2c4a43
testl %eax, %eax
je 0x2ed51e
movl %eax, %ebp
movl $0x0, 0x38(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x2a63cf
leaq 0x10(%rsp), %r14
testl %ebp, %ebp
jne 0x2ed54a
movq 0x50(%r15), %r15
testq %r15, %r15
jne 0x2ed3b7
jmp 0x2ed54a
movq 0x18(%r12), %rsi
movq %r14, %rdi
callq 0x2c496c
movl $0x1, %ebp
testl %eax, %eax
jne 0x2ed4e8
movq 0x8(%r12), %rsi
leaq 0x10(%rsp), %rdi
callq 0x2c496c
jmp 0x2ed4e6
movl $0x7, %ebp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq