// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x440bd5
movl $0x0, -0x4(%rbp)
jmp 0x440dcd
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x440bf2
movl $0x0, -0x4(%rbp)
jmp 0x440dcd
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x440c28
movq -0x40(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x440c18
movl $0x0, -0x4(%rbp)
jmp 0x440dcd
jmp 0x440c1a
movq -0x40(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x440bfa
movq -0x18(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x440c3f
movl $0x0, -0x4(%rbp)
jmp 0x440dcd
jmp 0x440c41
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2c, %eax
jne 0x440c7d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
callq 0x440ba0
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x440c41
cmpl $0x0, -0x28(%rbp)
je 0x440cb6
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x440caa
movq -0x20(%rbp), %rax
movswl 0x34(%rax), %eax
cmpl -0x24(%rbp), %eax
je 0x440cb6
movl $0x0, -0x4(%rbp)
jmp 0x440dcd
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x440cde
movq -0x20(%rbp), %rax
movswl 0x34(%rax), %eax
cmpl -0x24(%rbp), %eax
je 0x440cde
movl $0x0, -0x4(%rbp)
jmp 0x440dcd
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x4487f0
cmpl $0x0, %eax
je 0x440dc7
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x440dc5
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x42dee0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x43f3f0
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x4465f0
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x440d94
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rsi
movq -0x30(%rbp), %rdx
callq 0x4229d0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x440db4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x30(%rbp), %rdx
callq 0x4229d0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x440cfc
jmp 0x440dc7
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)