// File: /workspace/github_c_makefile_star2_O1/jkbenaim[P]psfrag/sqlite3.c
// Function: selectWindowRewriteExprCb
static int selectWindowRewriteExprCb(Walker *pWalker, Expr *pExpr){
  struct WindowRewrite *p = pWalker->u.pRewrite;
  Parse *pParse = pWalker->pParse;
  assert( p!=0 );
  assert( p->pWin!=0 );

  /* If this function is being called from within a scalar sub-select
  ** that used by the SELECT statement being processed, only process
  ** TK_COLUMN expressions that refer to it (the outer SELECT). Do
  ** not process aggregates or window functions at all, as they belong
  ** to the scalar sub-select.  */
  if( p->pSubSelect ){
    if( pExpr->op!=TK_COLUMN ){
      return WRC_Continue;
    }else{
      int nSrc = p->pSrc->nSrc;
      int i;
      for(i=0; i<nSrc; i++){
        if( pExpr->iTable==p->pSrc->a[i].iCursor ) break;
      }
      if( i==nSrc ) return WRC_Continue;
    }
  }

  switch( pExpr->op ){

    case TK_FUNCTION:
      if( !ExprHasProperty(pExpr, EP_WinFunc) ){
        break;
      }else{
        Window *pWin;
        for(pWin=p->pWin; pWin; pWin=pWin->pNextWin){
          if( pExpr->y.pWin==pWin ){
            assert( pWin->pOwner==pExpr );
            return WRC_Prune;
          }
        }
      }
      /* Fall through.  */

    case TK_AGG_FUNCTION:
    case TK_COLUMN: {
      Expr *pDup = sqlite3ExprDup(pParse->db, pExpr, 0);
      p->pSub = sqlite3ExprListAppend(pParse, p->pSub, pDup);
      if( p->pSub ){
        assert( ExprHasProperty(pExpr, EP_Static)==0 );
        ExprSetProperty(pExpr, EP_Static);
        sqlite3ExprDelete(pParse->db, pExpr);
        ExprClearProperty(pExpr, EP_Static);
        memset(pExpr, 0, sizeof(Expr));

        pExpr->op = TK_COLUMN;
        pExpr->iColumn = p->pSub->nExpr-1;
        pExpr->iTable = p->pWin->iEphCsr;
        pExpr->y.pTab = p->pTab;
      }

      break;
    }

    default: /* no-op */
      break;
  }

  return WRC_Continue;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq (%rdi), %r15
movq 0x28(%rdi), %r12
cmpq $0x0, 0x20(%r12)
je 0x6928a
xorl %r14d, %r14d
cmpb $-0x5e, (%rbx)
jne 0x69362
movq 0x8(%r12), %rcx
movl (%rcx), %eax
xorl %r14d, %r14d
movl $0x0, %edx
testl %eax, %eax
jle 0x69282
movl 0x2c(%rbx), %esi
addq $0x48, %rcx
xorl %edx, %edx
cmpl (%rcx), %esi
je 0x69282
incq %rdx
addq $0x70, %rcx
cmpq %rdx, %rax
jne 0x69270
movl %eax, %edx
cmpl %eax, %edx
je 0x69362
movzbl (%rbx), %eax
leal -0xa2(%rax), %ecx
cmpl $0x2, %ecx
jae 0x6931e
movq (%r15), %rdi
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5a513
movq 0x10(%r12), %rsi
movq %r15, %rdi
movq %rax, %rdx
callq 0x4ad8b
movq %rax, 0x10(%r12)
testq %rax, %rax
je 0x69362
orb $0x8, 0x7(%rbx)
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x3f525
andb $-0x9, 0x7(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x30(%rbx)
movq $0x0, 0x40(%rbx)
movb $-0x5e, (%rbx)
movq 0x10(%r12), %rax
movl (%rax), %eax
decl %eax
movw %ax, 0x30(%rbx)
movq (%r12), %rax
movl 0x58(%rax), %eax
movl %eax, 0x2c(%rbx)
movq 0x18(%r12), %rax
movq %rax, 0x40(%rbx)
jmp 0x69362
xorl %r14d, %r14d
cmpl $0xa7, %eax
jne 0x69362
testb $0x1, 0x7(%rbx)
je 0x69362
movq (%r12), %rcx
xorl %r14d, %r14d
testq %rcx, %rcx
sete %al
je 0x6935a
movq 0x40(%rbx), %rdx
cmpq %rcx, %rdx
je 0x69354
movq 0x40(%rcx), %rcx
testq %rcx, %rcx
sete %al
jne 0x69341
jmp 0x6935a
movl $0x1, %r14d
testb %al, %al
jne 0x6929c
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq