// File: /workspace/github_c_makefile_star2_O3/ukontainer[P]sqlite-bench/sqlite3.c
// Function: selectWindowRewriteExprCb
static int selectWindowRewriteExprCb(Walker *pWalker, Expr *pExpr){
  struct WindowRewrite *p = pWalker->u.pRewrite;
  Parse *pParse = pWalker->pParse;

  /* 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( pExpr->pWin==0 ){
        break;
      }else{
        Window *pWin;
        for(pWin=p->pWin; pWin; pWin=pWin->pNextWin){
          if( pExpr->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;
      }

      break;
    }

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

  return WRC_Continue;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq (%rdi), %r12
movq 0x28(%rdi), %r15
cmpq $0x0, 0x18(%r15)
movzbl (%rsi), %eax
je 0x4611b6
cmpl $0x9e, %eax
jne 0x4611a6
movq 0x8(%r15), %rdx
movslq (%rdx), %rcx
xorl %r14d, %r14d
movl $0x0, %esi
testq %rcx, %rcx
jle 0x4611ae
movl 0x2c(%rbx), %edi
addq $0x48, %rdx
xorl %esi, %esi
cmpl (%rdx), %edi
je 0x4611ae
incq %rsi
addq $0x70, %rdx
cmpq %rsi, %rcx
jne 0x461196
xorl %r14d, %r14d
jmp 0x46125d
cmpl %ecx, %esi
je 0x46125d
leal -0x9e(%rax), %ecx
cmpl $0x2, %ecx
jae 0x46122d
movq (%r12), %rdi
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x452376
movq 0x10(%r15), %rsi
movq (%r12), %rdi
movq %rax, %rdx
callq 0x444182
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x46125d
orb $-0x80, 0x5(%rbx)
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x4381eb
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movb $-0x62, (%rbx)
movq 0x10(%r15), %rax
movl (%rax), %eax
decl %eax
movw %ax, 0x30(%rbx)
movq (%r15), %rax
movl 0x48(%rax), %eax
movl %eax, 0x2c(%rbx)
jmp 0x46125d
xorl %r14d, %r14d
cmpl $0x9d, %eax
jne 0x46125d
movq 0x48(%rbx), %rax
testq %rax, %rax
je 0x46125d
movq (%r15), %rcx
testq %rcx, %rcx
je 0x4611c1
cmpq %rcx, %rax
je 0x461257
movq 0x30(%rcx), %rcx
jmp 0x461243
movl $0x1, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq