// File: /workspace/github_c_makefile_star2_O2/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
imulq $0x18, %rax, %rax
movq 0x8(%rsi,%rax), %rsi
movq (%rdi), %r14
movq %r14, %rdi
xorl %edx, %edx
callq 0x267197
testq %rax, %rax
je 0x26d168
movq %rax, %r15
testl %ebp, %ebp
jle 0x26d0ef
cmpb $0x47, (%r13)
je 0x26d0ef
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
leaq 0x121(%rip), %rax       # 0x26d201
movq %rax, 0x8(%rdi)
movl %ebp, 0x28(%rdi)
movq %r15, %rsi
callq 0x267f87
cmpb $0x6f, (%rbx)
jne 0x26d106
movq 0x8(%rbx), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x26d1c6
movq %rax, %r15
orb $0x8, 0x7(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24b649
pushq $0x9
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl 0x4(%rbx), %eax
btl $0xa, %eax
jb 0x26d14a
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x26d14a
movq %r14, %rdi
callq 0x22572a
movq %rax, 0x8(%rbx)
movl $0x10000, %eax          # imm = 0x10000
orl 0x4(%rbx), %eax
movl %eax, 0x4(%rbx)
btl $0x18, %eax
jae 0x26d15d
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x26d15d
movq %rbx, 0x70(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x21f26b
orb $0x40, 0x6(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq