// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: resolveAlias
static void resolveAlias(
  Parse *pParse,         /* Parsing context */
  ExprList *pEList,      /* A result set */
  int iCol,              /* A column in the result set.  0..pEList->nExpr-1 */
  Expr *pExpr,           /* Transform this into an alias to the result set */
  const char *zType,     /* "GROUP" or "ORDER" or "" */
  int nSubquery          /* Number of subqueries that the label is moving */
){
  Expr *pOrig;           /* The iCol-th column of the result set */
  Expr *pDup;            /* Copy of pOrig */
  sqlite3 *db;           /* The database connection */

  assert( iCol>=0 && iCol<pEList->nExpr );
  pOrig = pEList->a[iCol].pExpr;
  assert( pOrig!=0 );
  db = pParse->db;
  pDup = sqlite3ExprDup(db, pOrig, 0);
  if( pDup!=0 ){
    if( zType[0]!='G' ) incrAggFunctionDepth(pDup, nSubquery);
    if( pExpr->op==TK_COLLATE ){
      pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
    }

    /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
    ** prevents ExprDelete() from deleting the Expr structure itself,
    ** allowing it to be repopulated by the memcpy() on the following line.
    ** The pExpr->u.zToken might point into memory that will be freed by the
    ** sqlite3DbFree(db, pDup) on the last line of this block, so be sure to
    ** make a copy of the token before doing the sqlite3DbFree().
    */
    ExprSetProperty(pExpr, EP_Static);
    sqlite3ExprDelete(db, pExpr);
    memcpy(pExpr, pDup, sizeof(*pExpr));
    if( !ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken!=0 ){
      assert( (pExpr->flags & (EP_Reduced|EP_TokenOnly))==0 );
      pExpr->u.zToken = sqlite3DbStrDup(db, pExpr->u.zToken);
      pExpr->flags |= EP_MemToken;
    }
    if( ExprHasProperty(pExpr, EP_WinFunc) ){
      if( pExpr->y.pWin!=0 ){
        pExpr->y.pWin->pOwner = pExpr;
      }else{
        assert( db->mallocFailed );
      }
    }
    sqlite3DbFree(db, pDup);
  }
  ExprSetProperty(pExpr, EP_Alias);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movslq %edx, %rax
leaq (%rax,%rax,2), %rax
movq 0x8(%rsi,%rax,8), %rsi
testq %rsi, %rsi
je 0x2c6c7c
movl %r9d, %ebp
movq %r8, %r13
movq %rdi, %r12
movq (%rdi), %r14
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2c2864
testq %rax, %rax
je 0x2c6c7c
movq %rax, %r15
testl %ebp, %ebp
jle 0x2c6c01
cmpb $0x47, (%r13)
je 0x2c6c01
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
leaq 0x131(%rip), %rax       # 0x2c6d23
movq %rax, 0x8(%rdi)
movl %ebp, 0x28(%rdi)
movq %r15, %rsi
callq 0x2c0a8c
cmpb $0x6f, (%rbx)
jne 0x2c6c18
movq 0x8(%rbx), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2c6cde
movq %rax, %r15
orb $0x8, 0x7(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a6164
movl $0x9, %ecx
movq %rbx, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl 0x4(%rbx), %eax
btl $0xa, %eax
jb 0x2c6c5e
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x2c6c5e
movq %r14, %rdi
callq 0x279928
movq %rax, 0x8(%rbx)
movl $0x10000, %eax          # imm = 0x10000
orl 0x4(%rbx), %eax
movl %eax, 0x4(%rbx)
btl $0x18, %eax
jae 0x2c6c71
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x2c6c71
movq %rbx, 0x70(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x282904
orb $0x40, 0x6(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq