// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: resolveExprStep
static int resolveExprStep(Walker *pWalker, Expr *pExpr){
  NameContext *pNC;
  Parse *pParse;

  pNC = pWalker->u.pNC;
  assert( pNC!=0 );
  pParse = pNC->pParse;
  assert( pParse==pWalker->pParse );

  if( ExprHasProperty(pExpr, EP_Resolved) ) return WRC_Prune;
  ExprSetProperty(pExpr, EP_Resolved);
#ifndef NDEBUG
  if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
    SrcList *pSrcList = pNC->pSrcList;
    int i;
    for(i=0; i<pNC->pSrcList->nSrc; i++){
      assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab);
    }
  }
#endif
  switch( pExpr->op ){

#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
    /* The special operator TK_ROW means use the rowid for the first
    ** column in the FROM clause.  This is used by the LIMIT and ORDER BY
    ** clause processing on UPDATE and DELETE statements.
    */
    case TK_ROW: {
      SrcList *pSrcList = pNC->pSrcList;
      struct SrcList_item *pItem;
      assert( pSrcList && pSrcList->nSrc==1 );
      pItem = pSrcList->a; 
      pExpr->op = TK_COLUMN;
      pExpr->pTab = pItem->pTab;
      pExpr->iTable = pItem->iCursor;
      pExpr->iColumn = -1;
      pExpr->affinity = SQLITE_AFF_INTEGER;
      break;
    }
#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT)
          && !defined(SQLITE_OMIT_SUBQUERY) */

    /* A lone identifier is the name of a column.
    */
    case TK_ID: {
      return lookupName(pParse, 0, 0, pExpr->u.zToken, pNC, pExpr);
    }
  
    /* A table name and column name:     ID.ID
    ** Or a database, table and column:  ID.ID.ID
    */
    case TK_DOT: {
      const char *zColumn;
      const char *zTable;
      const char *zDb;
      Expr *pRight;

      /* if( pSrcList==0 ) break; */
      notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr);
      /*notValid(pParse, pNC, "the \".\" operator", NC_PartIdx|NC_IsCheck, 1);*/
      pRight = pExpr->pRight;
      if( pRight->op==TK_ID ){
        zDb = 0;
        zTable = pExpr->pLeft->u.zToken;
        zColumn = pRight->u.zToken;
      }else{
        assert( pRight->op==TK_DOT );
        zDb = pExpr->pLeft->u.zToken;
        zTable = pRight->pLeft->u.zToken;
        zColumn = pRight->pRight->u.zToken;
      }
      return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);
    }

    /* Resolve function names
    */
    case TK_FUNCTION: {
      ExprList *pList = pExpr->x.pList;    /* The argument list */
      int n = pList ? pList->nExpr : 0;    /* Number of arguments */
      int no_such_func = 0;       /* True if no such function exists */
      int wrong_num_args = 0;     /* True if wrong number of arguments */
      int is_agg = 0;             /* True if is an aggregate function */
      int auth;                   /* Authorization to use the function */
      int nId;                    /* Number of characters in function name */
      const char *zId;            /* The function name. */
      FuncDef *pDef;              /* Information about the function */
      u8 enc = ENC(pParse->db);   /* The database encoding */

      assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
      notValid(pParse, pNC, "functions", NC_PartIdx);
      zId = pExpr->u.zToken;
      nId = sqlite3Strlen30(zId);
      pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0);
      if( pDef==0 ){
        pDef = sqlite3FindFunction(pParse->db, zId, nId, -2, enc, 0);
        if( pDef==0 ){
          no_such_func = 1;
        }else{
          wrong_num_args = 1;
        }
      }else{
        is_agg = pDef->xFunc==0;
        if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
          ExprSetProperty(pExpr, EP_Unlikely|EP_Skip);
          if( n==2 ){
            pExpr->iTable = exprProbability(pList->a[1].pExpr);
            if( pExpr->iTable<0 ){
              sqlite3ErrorMsg(pParse,
                "second argument to likelihood() must be a "
                "constant between 0.0 and 1.0");
              pNC->nErr++;
            }
          }else{
            /* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is
            ** equivalent to likelihood(X, 0.0625).
            ** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is
            ** short-hand for likelihood(X,0.0625).
            ** EVIDENCE-OF: R-36850-34127 The likely(X) function is short-hand
            ** for likelihood(X,0.9375).
            ** EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent
            ** to likelihood(X,0.9375). */
            /* TUNING: unlikely() probability is 0.0625.  likely() is 0.9375 */
            pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
          }             
        }
#ifndef SQLITE_OMIT_AUTHORIZATION
        auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
        if( auth!=SQLITE_OK ){
          if( auth==SQLITE_DENY ){
            sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
                                    pDef->zName);
            pNC->nErr++;
          }
          pExpr->op = TK_NULL;
          return WRC_Prune;
        }
#endif
        if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){
          /* For the purposes of the EP_ConstFunc flag, date and time
          ** functions and other functions that change slowly are considered
          ** constant because they are constant for the duration of one query */
          ExprSetProperty(pExpr,EP_ConstFunc);
        }
        if( (pDef->funcFlags & SQLITE_FUNC_CONSTANT)==0 ){
          /* Date/time functions that use 'now', and other functions like
          ** sqlite_version() that might change over time cannot be used
          ** in an index. */
          notValid(pParse, pNC, "non-deterministic functions", NC_IdxExpr);
        }
      }
      if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){
        sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId);
        pNC->nErr++;
        is_agg = 0;
      }else if( no_such_func && pParse->db->init.busy==0 ){
        sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId);
        pNC->nErr++;
      }else if( wrong_num_args ){
        sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()",
             nId, zId);
        pNC->nErr++;
      }
      if( is_agg ) pNC->ncFlags &= ~NC_AllowAgg;
      sqlite3WalkExprList(pWalker, pList);
      if( is_agg ){
        NameContext *pNC2 = pNC;
        pExpr->op = TK_AGG_FUNCTION;
        pExpr->op2 = 0;
        while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){
          pExpr->op2++;
          pNC2 = pNC2->pNext;
        }
        assert( pDef!=0 );
        if( pNC2 ){
          assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg );
          testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 );
          pNC2->ncFlags |= NC_HasAgg | (pDef->funcFlags & SQLITE_FUNC_MINMAX);

        }
        pNC->ncFlags |= NC_AllowAgg;
      }
      /* FIX ME:  Compute pExpr->affinity based on the expected return
      ** type of the function 
      */
      return WRC_Prune;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_SELECT:
    case TK_EXISTS:  testcase( pExpr->op==TK_EXISTS );
#endif
    case TK_IN: {
      testcase( pExpr->op==TK_IN );
      if( ExprHasProperty(pExpr, EP_xIsSelect) ){
        int nRef = pNC->nRef;
        notValid(pParse, pNC, "subqueries", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
        sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
        assert( pNC->nRef>=nRef );
        if( nRef!=pNC->nRef ){
          ExprSetProperty(pExpr, EP_VarSelect);
        }
      }
      break;
    }
    case TK_VARIABLE: {
      notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
      break;
    }
  }
  return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl 0x4(%rsi), %eax
pushq $0x1
popq %r15
testb $0x4, %al
jne 0x4f506
movq %rsi, %r14
movq %rdi, %r13
movq 0x28(%rdi), %rbx
movq (%rbx), %r12
movl %eax, %ecx
orl $0x4, %ecx
movl %ecx, 0x4(%rsi)
movzbl (%rsi), %ecx
cmpl $0x14, %ecx
je 0x4f203
cmpl $0x97, %ecx
je 0x4f29d
cmpl $0x4b, %ecx
je 0x4f203
cmpl $0x77, %ecx
je 0x4f203
cmpl $0x7a, %ecx
je 0x4f278
cmpl $0x87, %ecx
je 0x4f23b
cmpl $0x1b, %ecx
jne 0x4f250
movq 0x8(%r14), %rcx
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
jmp 0x4f2cf
btl $0xb, %eax
jae 0x4f250
movl 0x28(%rbx), %r15d
leaq 0x1ec20(%rip), %rdx     # 0x6de34
pushq $0x34
popq %rcx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x505f5
movq 0x20(%r14), %rsi
movq %r13, %rdi
callq 0x4d28c
cmpl 0x28(%rbx), %r15d
je 0x4f250
orb $0x20, 0x4(%r14)
jmp 0x4f250
leaq 0x1ebfd(%rip), %rdx     # 0x6de3f
pushq $0x34
popq %rcx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x505f5
cmpl $0x0, 0x4c(%r12)
je 0x4f261
pushq $0x2
popq %r15
jmp 0x4f506
movq (%r12), %rax
xorl %r15d, %r15d
cmpb $0x0, 0x51(%rax)
setne %r15b
addl %r15d, %r15d
jmp 0x4f506
leaq 0x1eab6(%rip), %rdx     # 0x6dd35
pushq $0x20
popq %rcx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x505f5
movq 0x18(%r14), %rax
cmpb $0x1b, (%rax)
jne 0x4f2b1
xorl %esi, %esi
movq %r14, %rdx
jmp 0x4f2c0
movq 0x20(%r14), %rax
testq %rax, %rax
movq %rax, -0x58(%rbp)
je 0x4f2e8
movl (%rax), %eax
movl %eax, -0x48(%rbp)
jmp 0x4f2ef
movq 0x10(%r14), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdx
movq 0x18(%rax), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rdx), %rax
movq 0x8(%rax), %rdx
movq %r12, %rdi
movq %rbx, %r8
movq %r14, %r9
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4fcf2
movl $0x0, -0x48(%rbp)
movq (%r12), %rax
movb 0x4e(%rax), %al
movb %al, -0x2c(%rbp)
leaq 0x1eac2(%rip), %rdx     # 0x6ddc2
pushq $0x10
popq %rcx
movq %r12, %rdi
movq %rbx, -0x40(%rbp)
movq %rbx, %rsi
callq 0x505f5
movq 0x8(%r14), %rbx
movq %rbx, %rdi
callq 0xb080
movq (%r12), %rdi
movzbl -0x2c(%rbp), %r8d
movq %rbx, %rsi
movl %eax, -0x2c(%rbp)
movl %eax, %edx
movl -0x48(%rbp), %ecx
movl %r8d, -0x50(%rbp)
xorl %r9d, %r9d
callq 0x1751e
testq %rax, %rax
je 0x4f3f6
movq %rax, %rdx
movq %rbx, -0x50(%rbp)
movq 0x18(%rax), %rbx
testb $0x4, 0x3(%rax)
movq %rax, -0x38(%rbp)
je 0x4f457
orl $0x41000, 0x4(%r14)     # imm = 0x41000
cmpl $0x2, -0x48(%rbp)
jne 0x4f43f
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movabsq $-0x4010000000000000, %rcx # imm = 0xBFF0000000000000
movq %rcx, -0x98(%rbp)
cmpb $-0x7b, (%rax)
jne 0x4f3d3
movq 0x8(%rax), %rdi
movq %rdi, -0x48(%rbp)
callq 0xb080
leaq -0x98(%rbp), %rsi
pushq $0x1
popq %rcx
movq -0x48(%rbp), %rdi
movl %eax, %edx
callq 0x26fbc
movq -0x38(%rbp), %rdx
leaq -0x98(%rbp), %rax
movsd (%rax), %xmm0
ucomisd 0x1cb2b(%rip), %xmm0    # 0x6bef8
jbe 0x4f5af
orl $-0x1, 0x2c(%r14)
leaq 0x1e967(%rip), %rsi     # 0x6dd46
movq %r12, %rdi
xorl %eax, %eax
callq 0x1357a
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rax
incl 0x2c(%rax)
jmp 0x4f457
movq (%r12), %rdi
pushq $-0x2
popq %rcx
movq %rbx, %rsi
movl -0x2c(%rbp), %r14d
movl %r14d, %edx
movl -0x50(%rbp), %r8d
xorl %r9d, %r9d
callq 0x1751e
testq %rax, %rax
movq %rbx, %rcx
movl %r14d, %edx
je 0x4f4ed
leaq 0x1e9de(%rip), %rsi     # 0x6de07
movq %r12, %rdi
xorl %eax, %eax
callq 0x1357a
movq -0x40(%rbp), %rax
incl 0x2c(%rax)
jmp 0x4f4fa
movq 0x30(%rdx), %rax
cmpb $0x75, (%rax)
movl $0x800000, %eax         # imm = 0x800000
movl $0x7800000, %ecx        # imm = 0x7800000
cmovel %eax, %ecx
movl %ecx, 0x2c(%r14)
movq 0x30(%rdx), %rcx
pushq $0x1f
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x4e772
testl %eax, %eax
je 0x4f49a
cmpl $0x1, %eax
jne 0x4f494
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rdx
leaq 0x1e90a(%rip), %rsi     # 0x6dd8d
movq %r12, %rdi
xorl %eax, %eax
callq 0x1357a
movq -0x40(%rbp), %rax
incl 0x2c(%rax)
movb $0x65, (%r14)
jmp 0x4f506
movq -0x38(%rbp), %rax
movzwl 0x2(%rax), %eax
testw $0x2800, %ax            # imm = 0x2800
je 0x4f4ad
orb $0x8, 0x6(%r14)
btl $0xb, %eax
jb 0x4f4c9
leaq 0x1e8f6(%rip), %rdx     # 0x6ddb0
pushq $0x20
popq %rcx
movq %r12, %rdi
movq -0x40(%rbp), %rsi
callq 0x505f5
testq %rbx, %rbx
jne 0x4f4fa
movq -0x40(%rbp), %rbx
movzwl 0x30(%rbx), %eax
testb $0x1, %al
jne 0x4f524
leaq 0x1e8eb(%rip), %rsi     # 0x6ddcc
movq -0x50(%rbp), %rcx
movl -0x2c(%rbp), %edx
jmp 0x4f429
movq (%r12), %rax
cmpb $0x0, 0xa1(%rax)
je 0x4f518
movq %r13, %rdi
movq -0x58(%rbp), %rsi
callq 0x4d3d5
movl %r15d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e8d1(%rip), %rsi     # 0x6ddf0
jmp 0x4f429
andl $0xfffe, %eax           # imm = 0xFFFE
movw %ax, 0x30(%rbx)
movq %r13, %rdi
movq -0x58(%rbp), %rsi
callq 0x4d3d5
movb $-0x67, (%r14)
movb $0x0, 0x36(%r14)
leaq -0x90(%rbp), %r12
movq %rbx, %r13
testq %r13, %r13
je 0x4f5e6
movq 0x8(%r13), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%r12)
movupd %xmm0, (%r12)
leaq 0x138e(%rip), %rcx      # 0x508ff
movq %rcx, -0x98(%rbp)
leaq -0x68(%rbp), %rcx
movq %rcx, -0x70(%rbp)
movq %rax, -0x68(%rbp)
andq $0x0, -0x60(%rbp)
movq 0x20(%r14), %rsi
leaq -0x98(%rbp), %rdi
callq 0x4d3d5
cmpl $0x0, -0x60(%rbp)
jg 0x4f5cc
cmpl $0x0, -0x5c(%rbp)
je 0x4f5cc
incb 0x36(%r14)
movq 0x20(%r13), %r13
jmp 0x4f54c
mulsd 0x1c949(%rip), %xmm0    # 0x6bf00
cvttsd2si %xmm0, %eax
movl %eax, 0x2c(%r14)
testl %eax, %eax
jns 0x4f457
jmp 0x4f3d8
movq -0x38(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
orw 0x30(%r13), %ax
orl $0x2, %eax
movw %ax, 0x30(%r13)
orb $0x1, 0x30(%rbx)
jmp 0x4f506