// File: /workspace/github_c_makefile_star2_O0/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 %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, 0x20(%rax)
je 0x8de16
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa2, %eax
je 0x8ddb0
movl $0x0, -0x4(%rbp)
jmp 0x8df62
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 0x8ddfe
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 0x8ddf1
jmp 0x8ddfe
jmp 0x8ddf3
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x8ddc4
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x8de12
movl $0x0, -0x4(%rbp)
jmp 0x8df62
jmp 0x8de14
jmp 0x8de16
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x44(%rbp)
addl $0xffffff5e, %eax       # imm = 0xFFFFFF5E
subl $0x2, %eax
jb 0x8de92
jmp 0x8de2c
movl -0x44(%rbp), %eax
subl $0xa7, %eax
jne 0x8df59
jmp 0x8de3c
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
jne 0x8de52
jmp 0x8df5b
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x8de8e
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
cmpq -0x38(%rbp), %rax
jne 0x8de7e
movl $0x1, -0x4(%rbp)
jmp 0x8df62
jmp 0x8de80
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x8de5d
jmp 0x8de90
jmp 0x8de92
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x77a40
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x40(%rbp), %rdx
callq 0x681a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x8df57
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x8000000, %ecx        # imm = 0x8000000
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x57260
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0xf7ffffff, %ecx       # imm = 0xF7FFFFFF
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x48, %edx
callq 0x8130
movq -0x18(%rbp), %rax
movb $-0x5e, (%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 0x58(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x8df5b
jmp 0x8df5b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)