// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pushDownWhereTerms
static int pushDownWhereTerms(
  Parse *pParse,        /* Parse context (for malloc() and error reporting) */
  Select *pSubq,        /* The subquery whose WHERE clause is to be augmented */
  Expr *pWhere,         /* The WHERE clause of the outer query */
  int iCursor,          /* Cursor number of the subquery */
  int isLeftJoin        /* True if pSubq is the right term of a LEFT JOIN */
){
  Expr *pNew;
  int nChng = 0;
  Select *pSel;
  if( pWhere==0 ) return 0;
  if( pSubq->selFlags & SF_Recursive ) return 0;  /* restriction (2) */

#ifndef SQLITE_OMIT_WINDOWFUNC
  for(pSel=pSubq; pSel; pSel=pSel->pPrior){
    if( pSel->pWin ) return 0;    /* restriction (6) */
  }
#endif

#ifdef SQLITE_DEBUG
  /* Only the first term of a compound can have a WITH clause.  But make
  ** sure no other terms are marked SF_Recursive in case something changes
  ** in the future.
  */
  {
    Select *pX;
    for(pX=pSubq; pX; pX=pX->pPrior){
      assert( (pX->selFlags & (SF_Recursive))==0 );
    }
  }
#endif

  if( pSubq->pLimit!=0 ){
    return 0; /* restriction (3) */
  }
  while( pWhere->op==TK_AND ){
    nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight,
                                iCursor, isLeftJoin);
    pWhere = pWhere->pLeft;
  }
  if( isLeftJoin
   && (ExprHasProperty(pWhere,EP_FromJoin)==0
         || pWhere->iRightJoinTable!=iCursor)
  ){
    return 0; /* restriction (4) */
  }
  if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
    return 0; /* restriction (5) */
  }
  if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
    nChng++;
    while( pSubq ){
      SubstContext x;
      pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
      unsetJoinExpr(pNew, -1);
      x.pParse = pParse;
      x.iTable = iCursor;
      x.iNewTable = iCursor;
      x.isLeftJoin = 0;
      x.pEList = pSubq->pEList;
      pNew = substExpr(&x, pNew);
      if( pSubq->selFlags & SF_Aggregate ){
        pSubq->pHaving = sqlite3ExprAnd(pParse, pSubq->pHaving, pNew);
      }else{
        pSubq->pWhere = sqlite3ExprAnd(pParse, pSubq->pWhere, pNew);
      }
      pSubq = pSubq->pPrior;
    }
  }
  return nChng;
}

// Assembly:
xorl %eax, %eax
testq %rdx, %rdx
je 0x2708ab
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
testb $0x20, 0x5(%rsi)
jne 0x27089d
movl %r8d, %ebp
movl %ecx, %ebx
movq %rdx, %r14
movq %rdi, %r12
movq %r15, %rcx
testq %rcx, %rcx
je 0x270896
cmpq $0x0, 0x70(%rcx)
jne 0x27089d
movq 0x50(%rcx), %rcx
jmp 0x270884
cmpq $0x0, 0x60(%r15)
je 0x2708ac
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
cmpb $0x2c, (%r14)
jne 0x2708d2
movq 0x18(%r14), %rdx
movq %r12, %rdi
movq %r15, %rsi
movl %ebx, %ecx
movl %ebp, %r8d
callq 0x270858
addl %eax, %r13d
movq 0x10(%r14), %r14
jmp 0x2708af
movl 0x4(%r14), %ecx
testl %ebp, %ebp
je 0x2708ec
xorl %eax, %eax
testb $0x1, %cl
je 0x27089d
movswl 0x34(%r14), %ecx
cmpl %ebx, %ecx
jne 0x27089d
jmp 0x2708f1
testb $0x1, %cl
je 0x2708fc
movswl 0x34(%r14), %ecx
xorl %eax, %eax
cmpl %ebx, %ecx
jne 0x27089d
movq %r14, %rdi
movl %ebx, %esi
callq 0x2765af
testl %eax, %eax
je 0x270978
testq %r15, %r15
je 0x270975
movq (%r12), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x267197
movq %rax, %rbp
movq %rax, %rdi
pushq $-0x1
popq %rsi
callq 0x270792
movq %r12, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %ebx, 0x14(%rsp)
andl $0x0, 0x18(%rsp)
movq 0x20(%r15), %rax
movq %rax, 0x20(%rsp)
leaq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x275c1b
movl 0x4(%r15), %ebp
andl $0x8, %ebp
movq 0x30(%r15,%rbp,2), %rsi
movq %r12, %rdi
movq %rax, %rdx
callq 0x26119e
movq %rax, 0x30(%r15,%rbp,2)
movq 0x50(%r15), %r15
jmp 0x27090a
incl %r13d
movl %r13d, %eax
jmp 0x27089d