// File: /workspace/github_c_makefile_star2_O1/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), %r12
movq 0x158(%rdi), %r15
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x30(%rsp)
movq %rdi, (%rsp)
movq 0x8(%r15), %rsi
movq 0x30(%r15), %rdx
movq 0x20(%r12), %rax
testq %rdx, %rdx
je 0x2f664c
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 0x2f6637
sarq $0x20, %rcx
jmp 0x2f6653
movq $-0x8000, %rcx          # imm = 0x8000
shlq $0x5, %rcx
movq (%rax,%rcx), %rdx
movq %r12, %rdi
callq 0x28ad59
movq %rax, 0xa8(%rbx)
movb 0x10(%r15), %cl
movb %cl, 0xd0(%rbx)
testq %rax, %rax
je 0x2f668d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2d1d35
movl $0x1, %ebp
testl %eax, %eax
jne 0x2f66a4
movq 0x18(%r15), %rsi
testq %rsi, %rsi
je 0x2f66a2
movq %rsp, %rdi
callq 0x2ce0ea
movl %eax, %ebp
jmp 0x2f66a4
xorl %ebp, %ebp
movq 0x38(%r15), %r15
testl %ebp, %ebp
sete %al
testq %r15, %r15
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2f685e
movq %rsp, %r14
movq %r12, 0x40(%rsp)
movq 0x10(%r15), %rsi
xorl %ebp, %ebp
testq %rsi, %rsi
je 0x2f66e5
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2d0563
cmpl $0x0, 0x30(%rbx)
je 0x2f66e5
movl 0x18(%rbx), %ebp
testl %ebp, %ebp
je 0x2f66ff
testl %ebp, %ebp
jne 0x2f685e
movq 0x50(%r15), %r15
testq %r15, %r15
jne 0x2f66c6
jmp 0x2f685e
cmpq $0x0, 0x18(%r15)
je 0x2f679f
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2ebe64
testq %rax, %rax
je 0x2f67a6
movq %rax, %r13
cmpl $0x0, (%rax)
jle 0x2f67b0
movq %r13, %rbp
addq $0x48, %rbp
movl $0x1, %r14d
leaq -0x40(%rbp), %rdx
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2d1ce5
movq %rax, -0x20(%rbp)
movl 0x34(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x34(%rbx)
movl %ecx, (%rbp)
testq %rax, %rax
je 0x2f6771
incl 0x3c(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2d1d35
testl %eax, %eax
sete %r12b
movslq (%r13), %rax
cmpq %rax, %r14
jge 0x2f6786
addq $0x70, %rbp
incq %r14
testb %r12b, %r12b
jne 0x2f6737
movq %r13, 0x8(%rsp)
movl $0x1, %ebp
testb %r12b, %r12b
movq 0x40(%rsp), %r12
movq %rsp, %r14
jne 0x2f67b5
jmp 0x2f67dd
xorl %ebp, %ebp
jmp 0x2f66e9
movl $0x7, %ebp
jmp 0x2f66e9
movq %r13, 0x8(%rsp)
movq 0x28(%r15), %rsi
testq %rsi, %rsi
je 0x2f67cf
movq %r14, %rdi
callq 0x2ce0ea
movl $0x1, %ebp
testl %eax, %eax
jne 0x2f67dd
movq 0x30(%r15), %rsi
movq %r14, %rdi
callq 0x2ce1c1
movl %eax, %ebp
movq 0x40(%r15), %r14
testq %r14, %r14
je 0x2f6842
movq %r13, 0x28(%r14)
movq %r14, 0x10(%rsp)
movl $0x200, 0x28(%rsp)      # imm = 0x200
movq (%r14), %rsi
movq %rsp, %rdi
callq 0x2ce1c1
movl %eax, %ebp
testl %eax, %eax
jne 0x2f6816
movq 0x10(%r14), %rsi
movq %rsp, %rdi
callq 0x2ce1c1
movl %eax, %ebp
testl %ebp, %ebp
jne 0x2f6828
movq 0x18(%r14), %rsi
movq %rsp, %rdi
callq 0x2ce0ea
movl %eax, %ebp
testl %ebp, %ebp
jne 0x2f683a
movq 0x8(%r14), %rsi
movq %rsp, %rdi
callq 0x2ce0ea
movl %eax, %ebp
movl $0x0, 0x28(%rsp)
movq $0x0, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x2affb4
movq %rsp, %r14
jmp 0x2f66e9
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq