// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: substExpr
static Expr *substExpr(
  SubstContext *pSubst,  /* Description of the substitution */
  Expr *pExpr            /* Expr in which substitution occurs */
){
  if( pExpr==0 ) return 0;
  if( ExprHasProperty(pExpr, EP_FromJoin)
   && pExpr->iRightJoinTable==pSubst->iTable
  ){
    pExpr->iRightJoinTable = pSubst->iNewTable;
  }
  if( pExpr->op==TK_COLUMN
   && pExpr->iTable==pSubst->iTable
   && !ExprHasProperty(pExpr, EP_FixedCol)
  ){
    if( pExpr->iColumn<0 ){
      pExpr->op = TK_NULL;
    }else{
      Expr *pNew;
      Expr *pCopy = pSubst->pEList->a[pExpr->iColumn].pExpr;
      Expr ifNullRow;
      assert( pSubst->pEList!=0 && pExpr->iColumn<pSubst->pEList->nExpr );
      assert( pExpr->pRight==0 );
      if( sqlite3ExprIsVector(pCopy) ){
        sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
      }else{
        sqlite3 *db = pSubst->pParse->db;
        if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){
          memset(&ifNullRow, 0, sizeof(ifNullRow));
          ifNullRow.op = TK_IF_NULL_ROW;
          ifNullRow.pLeft = pCopy;
          ifNullRow.iTable = pSubst->iNewTable;
          ifNullRow.flags = EP_Skip;
          pCopy = &ifNullRow;
        }
        testcase( ExprHasProperty(pCopy, EP_Subquery) );
        pNew = sqlite3ExprDup(db, pCopy, 0);
        if( pNew && pSubst->isLeftJoin ){
          ExprSetProperty(pNew, EP_CanBeNull);
        }
        if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
          pNew->iRightJoinTable = pExpr->iRightJoinTable;
          ExprSetProperty(pNew, EP_FromJoin);
        }
        sqlite3ExprDelete(db, pExpr);
        pExpr = pNew;

        /* Ensure that the expression now has an implicit collation sequence,
        ** just as it did when it was a column of a view or sub-query. */
        if( pExpr ){
          if( pExpr->op!=TK_COLUMN && pExpr->op!=TK_COLLATE ){
            CollSeq *pColl = sqlite3ExprCollSeq(pSubst->pParse, pExpr);
            pExpr = sqlite3ExprAddCollateString(pSubst->pParse, pExpr,
                (pColl ? pColl->zName : "BINARY")
            );
          }
          ExprClearProperty(pExpr, EP_Collate);
        }
      }
    }
  }else{
    if( pExpr->op==TK_IF_NULL_ROW && pExpr->iTable==pSubst->iTable ){
      pExpr->iTable = pSubst->iNewTable;
    }
    pExpr->pLeft = substExpr(pSubst, pExpr->pLeft);
    pExpr->pRight = substExpr(pSubst, pExpr->pRight);
    if( ExprHasProperty(pExpr, EP_xIsSelect) ){
      substSelect(pSubst, pExpr->x.pSelect, 1);
    }else{
      substExprList(pSubst, pExpr->x.pList);
    }
#ifndef SQLITE_OMIT_WINDOWFUNC
    if( ExprHasProperty(pExpr, EP_WinFunc) ){
      Window *pWin = pExpr->y.pWin;
      pWin->pFilter = substExpr(pSubst, pWin->pFilter);
      substExprList(pSubst, pWin->pPartition);
      substExprList(pSubst, pWin->pOrderBy);
    }
#endif
  }
  return pExpr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rsi, %rsi
je 0x2dc8b2
movq %rsi, %rbx
movq %rdi, %r14
movl 0x4(%rsi), %eax
testb $0x1, %al
je 0x2dc64c
movswl 0x34(%rbx), %ecx
cmpl %ecx, 0x8(%r14)
jne 0x2dc64c
movzwl 0xc(%r14), %ecx
movw %cx, 0x34(%rbx)
movzbl (%rbx), %ecx
cmpl $0xb0, %ecx
je 0x2dc792
cmpl $0xa4, %ecx
jne 0x2dc7a2
testb $0x8, %al
jne 0x2dc78d
movl 0x8(%r14), %eax
cmpl %eax, 0x2c(%rbx)
jne 0x2dc78d
movswq 0x30(%rbx), %rax
testq %rax, %rax
js 0x2dc89b
movq 0x18(%r14), %rcx
leaq (%rax,%rax,2), %rax
movq 0x8(%rcx,%rax,8), %rsi
movb (%rsi), %al
movl %eax, %ecx
cmpb $-0x53, %al
jne 0x2dc6a2
movb 0x2(%rsi), %cl
movq %rsi, %rdx
cmpb $-0x52, %cl
je 0x2dc6bb
movzbl %cl, %edx
movb $0x1, %cl
cmpl $0x88, %edx
jne 0x2dc6c5
movq 0x20(%rsi), %rdx
movq 0x20(%rdx), %rcx
cmpl $0x2, (%rcx)
setl %cl
movq (%r14), %rdi
testb %cl, %cl
je 0x2dc8a0
movq (%rdi), %r12
cmpb $-0x5c, %al
je 0x2dc713
cmpl $0x0, 0x10(%r14)
je 0x2dc713
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x20(%rax)
movq $0x0, 0x40(%rax)
movb $-0x50, (%rax)
movq %rsi, 0x10(%rax)
movl 0xc(%r14), %ecx
movl %ecx, 0x2c(%rax)
movl $0x1000, 0x4(%rax)      # imm = 0x1000
movq %rax, %rsi
movq %r12, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2cbf97
testq %rax, %rax
je 0x2dc8a7
movq %rax, %r15
cmpl $0x0, 0x10(%r14)
je 0x2dc737
orb $0x10, 0x6(%r15)
testb $0x1, 0x4(%rbx)
je 0x2dc74b
movzwl 0x34(%rbx), %eax
movw %ax, 0x34(%r15)
orb $0x1, 0x4(%r15)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2afd54
movzbl (%r15), %eax
cmpl $0x6f, %eax
je 0x2dc8d8
cmpl $0xa4, %eax
je 0x2dc8d8
movq (%r14), %rdi
movq %r15, %rsi
callq 0x2b32a0
movq (%r14), %rdi
testq %rax, %rax
je 0x2dc8c6
movq (%rax), %rdx
jmp 0x2dc8cd
cmpb $-0x50, %cl
jne 0x2dc7a2
movl 0x2c(%rbx), %eax
cmpl 0x8(%r14), %eax
jne 0x2dc7a2
movl 0xc(%r14), %eax
movl %eax, 0x2c(%rbx)
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x2dc615
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x2dc615
movq %rax, 0x18(%rbx)
testb $0x8, 0x5(%rbx)
movq 0x20(%rbx), %r15
jne 0x2dc7ff
testq %r15, %r15
je 0x2dc80f
cmpl $0x0, (%r15)
jle 0x2dc80f
leaq 0x8(%r15), %r12
xorl %r13d, %r13d
movq (%r12), %rsi
movq %r14, %rdi
callq 0x2dc615
movq %rax, (%r12)
incq %r13
movslq (%r15), %rax
addq $0x18, %r12
cmpq %rax, %r13
jl 0x2dc7de
jmp 0x2dc80f
movq %r14, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x2dc443
testb $0x1, 0x7(%rbx)
je 0x2dc8b4
movq 0x40(%rbx), %r15
movq 0x48(%r15), %rsi
movq %r14, %rdi
callq 0x2dc615
movq %rax, 0x48(%r15)
movq 0x10(%r15), %r12
testq %r12, %r12
je 0x2dc864
cmpl $0x0, (%r12)
jle 0x2dc864
leaq 0x8(%r12), %r13
xorl %ebp, %ebp
movq (%r13), %rsi
movq %r14, %rdi
callq 0x2dc615
movq %rax, (%r13)
incq %rbp
movslq (%r12), %rax
addq $0x18, %r13
cmpq %rax, %rbp
jl 0x2dc844
movq 0x18(%r15), %r15
testq %r15, %r15
je 0x2dc8b4
cmpl $0x0, (%r15)
jle 0x2dc8b4
leaq 0x8(%r15), %r12
xorl %r13d, %r13d
movq (%r12), %rsi
movq %r14, %rdi
callq 0x2dc615
movq %rax, (%r12)
incq %r13
movslq (%r15), %rax
addq $0x18, %r12
cmpq %rax, %r13
jl 0x2dc87a
jmp 0x2dc8b4
movb $0x77, (%rbx)
jmp 0x2dc8b4
callq 0x2cbde0
jmp 0x2dc8b4
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2afd54
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfea13(%rip), %rdx     # 0x3db2e0
movq %r15, %rsi
callq 0x2d0359
movq %rax, %r15
andb $-0x2, 0x5(%r15)
movq %r15, %rbx
jmp 0x2dc8b4