// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movslq -0x14(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
xorl %edx, %edx
callq 0x42dee0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x438055
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x47, %eax
je 0x437f7a
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x438360
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x6f, %eax
jne 0x437f9f
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x4383b0
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x8000000, %ecx        # imm = 0x8000000
movl %ecx, 0x4(%rax)
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x40c670
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl $0x48, %edx
callq 0x19610
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x438016
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x438016
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3c91a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x10000, %ecx          # imm = 0x10000
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
je 0x438048
movq -0x20(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x438044
movq -0x20(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq %rcx, 0x70(%rax)
jmp 0x438046
jmp 0x438046
jmp 0x438048
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3c00a0
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x400000, %ecx         # imm = 0x400000
movl %ecx, 0x4(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)