// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rsi, %rsi
je 0x275df1
movq %rsi, %rbx
movq %rdi, %r14
movl 0x4(%rsi), %eax
testb $0x1, %al
je 0x275c4f
movswl 0x34(%rbx), %ecx
cmpl %ecx, 0x8(%r14)
jne 0x275c4f
movzwl 0xc(%r14), %ecx
movw %cx, 0x34(%rbx)
movzbl (%rbx), %ecx
cmpl $0xb0, %ecx
je 0x275caa
cmpl $0xa4, %ecx
jne 0x275cba
testb $0x8, %al
jne 0x275cba
movl 0x8(%r14), %eax
cmpl %eax, 0x2c(%rbx)
jne 0x275cba
movswq 0x30(%rbx), %rax
testq %rax, %rax
js 0x275d34
movq 0x18(%r14), %rcx
imulq $0x18, %rax, %rax
movq 0x8(%rcx,%rax), %r15
movq %r15, %rdi
callq 0x2661b9
movq (%r14), %rdi
testl %eax, %eax
je 0x275d3c
movq %r15, %rsi
callq 0x2696ff
jmp 0x275df3
movl 0x2c(%rbx), %eax
cmpl 0x8(%r14), %eax
jne 0x275cba
movl 0xc(%r14), %eax
movl %eax, 0x2c(%rbx)
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x275c1b
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x275c1b
movq %rax, 0x18(%rbx)
testb $0x8, 0x5(%rbx)
movq 0x20(%rbx), %rsi
jne 0x275cee
movq %r14, %rdi
callq 0x275bd6
jmp 0x275cf9
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x275b16
testb $0x1, 0x7(%rbx)
je 0x275df3
movq 0x40(%rbx), %r15
movq 0x48(%r15), %rsi
movq %r14, %rdi
callq 0x275c1b
movq %rax, 0x48(%r15)
movq 0x10(%r15), %rsi
movq %r14, %rdi
callq 0x275bd6
movq 0x18(%r15), %rsi
movq %r14, %rdi
callq 0x275bd6
jmp 0x275df3
movb $0x77, (%rbx)
jmp 0x275df3
movq (%rdi), %r12
cmpl $0x0, 0x10(%r14)
je 0x275d7e
cmpb $-0x5c, (%r15)
je 0x275d7e
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movaps %xmm0, 0x10(%rax)
andq $0x0, 0x40(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x20(%rax)
movb $-0x50, (%rax)
movq %r15, 0x10(%rax)
movl 0xc(%r14), %ecx
movl %ecx, 0x2c(%rax)
movl $0x1000, 0x4(%rax)      # imm = 0x1000
movq %rax, %r15
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x267197
testq %rax, %rax
je 0x275de6
movq %rax, %r15
cmpl $0x0, 0x10(%r14)
je 0x275d9f
orb $0x10, 0x6(%r15)
testb $0x1, 0x4(%rbx)
je 0x275db3
movzwl 0x34(%rbx), %eax
movw %ax, 0x34(%r15)
orb $0x1, 0x4(%r15)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x24b649
movzbl (%r15), %eax
cmpl $0x6f, %eax
je 0x275e14
cmpl $0xa4, %eax
je 0x275e14
movq (%r14), %rdi
movq %r15, %rsi
callq 0x24e541
movq (%r14), %rdi
testq %rax, %rax
je 0x275e02
movq (%rax), %rdx
jmp 0x275e09
movq %r12, %rdi
movq %rbx, %rsi
callq 0x24b649
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xfc167(%rip), %rdx     # 0x371f70
movq %r15, %rsi
callq 0x26d1c6
movq %rax, %r15
andb $-0x2, 0x5(%r15)
movq %r15, %rbx
jmp 0x275df3