// File: /workspace/github_c_makefile_star2_O1/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
movl %r9d, %ebp
movq %r8, %r13
movq %rcx, %rbx
movq %rdi, %r12
movslq %edx, %rax
leaq (%rax,%rax,2), %rax
movq 0x8(%rsi,%rax,8), %rsi
movq (%rdi), %r14
testq %rsi, %rsi
je 0x2d023b
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2cbf97
movq %rax, %r15
jmp 0x2d023e
xorl %r15d, %r15d
testq %r15, %r15
je 0x2d02ef
testl %ebp, %ebp
jle 0x2d0279
cmpb $0x47, (%r13)
je 0x2d0279
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
leaq 0x134(%rip), %rax       # 0x2d039e
movq %rax, 0x8(%rdi)
movl %ebp, 0x28(%rdi)
movq %r15, %rsi
callq 0x2ca211
cmpb $0x6f, (%rbx)
jne 0x2d0290
movq 0x8(%rbx), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2d0359
movq %rax, %r15
orb $0x8, 0x7(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2afd54
movl $0x9, %ecx
movq %rbx, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
testb $0x4, 0x5(%rbx)
jne 0x2d02cc
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x2d02cc
movq %r14, %rdi
callq 0x283365
movq %rax, 0x8(%rbx)
orb $0x1, 0x6(%rbx)
testb $0x1, 0x7(%rbx)
je 0x2d02df
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x2d02df
movq %rbx, 0x70(%rax)
testq %r15, %r15
je 0x2d02ef
movq %r14, %rdi
movq %r15, %rsi
callq 0x28c3e7
orb $0x40, 0x6(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq