// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x483676
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x9e, %eax
je 0x483610
movl $0x0, -0x4(%rbp)
jmp 0x4837a7
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x48365e
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %eax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x8, %rcx
movslq -0x30(%rbp), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x40(%rcx), %eax
jne 0x483651
jmp 0x48365e
jmp 0x483653
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x483624
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x483672
movl $0x0, -0x4(%rbp)
jmp 0x4837a7
jmp 0x483674
jmp 0x483676
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x44(%rbp)
subl $0x9d, %eax
je 0x48369b
jmp 0x483689
movl -0x44(%rbp), %eax
addl $0xffffff62, %eax       # imm = 0xFFFFFF62
subl $0x2, %eax
jb 0x4836eb
jmp 0x48379e
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x4836ab
jmp 0x4837a0
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x4836e7
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
cmpq -0x38(%rbp), %rax
jne 0x4836d7
movl $0x1, -0x4(%rbp)
jmp 0x4837a7
jmp 0x4836d9
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x4836b6
jmp 0x4836e9
jmp 0x4836eb
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x4717d0
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x40(%rbp), %rdx
callq 0x460810
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x48379c
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x8000, %ecx           # imm = 0x8000
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x44fdb0
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0xffff7fff, %ecx       # imm = 0xFFFF7FFF
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x4010b0
movq -0x18(%rbp), %rax
movb $-0x62, (%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
subl $0x1, %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x30(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl 0x48(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x2c(%rax)
jmp 0x4837a0
jmp 0x4837a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq