// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: generateColumnNames
static void generateColumnNames(
  Parse *pParse,      /* Parser context */
  Select *pSelect     /* Generate column names for this SELECT statement */
){
  Vdbe *v = pParse->pVdbe;
  int i;
  Table *pTab;
  SrcList *pTabList;
  ExprList *pEList;
  sqlite3 *db = pParse->db;
  int fullName;    /* TABLE.COLUMN if no AS clause and is a direct table ref */
  int srcName;     /* COLUMN or TABLE.COLUMN if no AS clause and is direct */

#ifndef SQLITE_OMIT_EXPLAIN
  /* If this is an EXPLAIN, skip this step */
  if( pParse->explain ){
    return;
  }
#endif

  if( pParse->colNamesSet ) return;
  /* Column names are determined by the left-most term of a compound select */
  while( pSelect->pPrior ) pSelect = pSelect->pPrior;
  SELECTTRACE(1,pParse,pSelect,("generating column names\n"));
  pTabList = pSelect->pSrc;
  pEList = pSelect->pEList;
  assert( v!=0 );
  assert( pTabList!=0 );
  pParse->colNamesSet = 1;
  fullName = (db->flags & SQLITE_FullColNames)!=0;
  srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
  sqlite3VdbeSetNumCols(v, pEList->nExpr);
  for(i=0; i<pEList->nExpr; i++){
    Expr *p = pEList->a[i].pExpr;

    assert( p!=0 );
    assert( p->op!=TK_AGG_COLUMN );  /* Agg processing has not run yet */
    assert( p->op!=TK_COLUMN || p->y.pTab!=0 ); /* Covering idx not yet coded */
    if( pEList->a[i].zEName && pEList->a[i].eEName==ENAME_NAME ){
      /* An AS clause always takes first priority */
      char *zName = pEList->a[i].zEName;
      sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);
    }else if( srcName && p->op==TK_COLUMN ){
      char *zCol;
      int iCol = p->iColumn;
      pTab = p->y.pTab;
      assert( pTab!=0 );
      if( iCol<0 ) iCol = pTab->iPKey;
      assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
      if( iCol<0 ){
        zCol = "rowid";
      }else{
        zCol = pTab->aCol[iCol].zName;
      }
      if( fullName ){
        char *zName = 0;
        zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
      }else{
        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT);
      }
    }else{
      const char *z = pEList->a[i].zEName;
      z = z==0 ? sqlite3MPrintf(db, "column%d", i+1) : sqlite3DbStrDup(db, z);
      sqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC);
    }
  }
  generateColumnTypes(pParse, pTabList, pEList);
}

// Assembly:
cmpb $0x0, 0x11b(%rdi)
je 0x2cb24d
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x1c(%rdi)
je 0x2cb273
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
movq %rax, (%rsp)
movq 0x10(%rbx), %r15
movq %rsi, %rax
movq 0x50(%rsi), %rsi
testq %rsi, %rsi
jne 0x2cb27e
movq 0x20(%rax), %rbp
movq 0x28(%rax), %r14
movb $0x1, 0x1c(%rbx)
movq (%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%rbp), %esi
movq %r15, %rdi
callq 0x2a871c
cmpl $0x0, (%rbp)
jle 0x2cb264
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
leaq 0x8(%rbp), %r13
xorl %r14d, %r14d
xorl %ebx, %ebx
movq (%r13), %rax
movq 0x8(%r13), %rsi
testq %rsi, %rsi
je 0x2cb2db
testb $0x3, 0x11(%r13)
je 0x2cb345
testb $0x44, 0x8(%rsp)
je 0x2cb335
cmpb $-0x5c, (%rax)
jne 0x2cb335
movzwl 0x30(%rax), %edx
movq 0x40(%rax), %rax
testw %dx, %dx
jns 0x2cb304
movzwl 0x44(%rax), %edx
leaq 0x10b267(%rip), %rcx    # 0x3d6566
testw %dx, %dx
js 0x2cb312
movq 0x8(%rax), %rcx
movzwl %dx, %edx
shll $0x5, %edx
movq (%rcx,%rdx), %rcx
testb $0x4, 0x8(%rsp)
jne 0x2cb382
movq (%r15), %rax
cmpb $0x0, 0x61(%rax)
jne 0x2cb3c3
movq 0x98(%r15), %rdi
addq %r14, %rdi
movq %rcx, %rsi
jmp 0x2cb358
testq %rsi, %rsi
je 0x2cb36b
movq (%rsp), %rdi
callq 0x279928
jmp 0x2cb397
movq (%r15), %rax
cmpb $0x0, 0x61(%rax)
jne 0x2cb3c3
movq 0x98(%r15), %rdi
addq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq $-0x1, %r8
jmp 0x2cb3be
leal 0x1(%rbx), %edx
movq (%rsp), %rdi
leaq 0x10cacd(%rip), %rsi    # 0x3d7e46
xorl %eax, %eax
callq 0x27b56a
jmp 0x2cb397
movq (%rax), %rdx
movq (%rsp), %rdi
leaq 0x89755(%rip), %rsi     # 0x354ae5
xorl %eax, %eax
callq 0x27b56a
movq (%r15), %rcx
cmpb $0x0, 0x61(%rcx)
jne 0x2cb3c3
movq 0x98(%r15), %rdi
addq %r14, %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
leaq -0x528a2(%rip), %r8     # 0x278b1c
callq 0x278594
incq %rbx
movslq (%rbp), %r12
addq $0x18, %r13
addq $0x38, %r14
cmpq %r12, %rbx
jl 0x2cb2c7
movq 0x18(%rsp), %rax
movq 0x10(%rax), %r14
movq 0x10(%rsp), %rcx
movq %rcx, 0x28(%rsp)
movq %rax, 0x20(%rsp)
movq $0x0, 0x38(%rsp)
testl %r12d, %r12d
jle 0x2cb264
leaq 0x8(%rbp), %r15
xorl %r13d, %r13d
xorl %ebx, %ebx
movq (%r15), %rsi
leaq 0x20(%rsp), %rdi
callq 0x2c915a
movq (%r14), %rcx
cmpb $0x0, 0x61(%rcx)
jne 0x2cb457
movzwl 0xc0(%r14), %ecx
imulq $0x38, %rcx, %rdi
addq 0x98(%r14), %rdi
addq %r13, %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq $-0x1, %r8
callq 0x278594
movl (%rbp), %r12d
incq %rbx
movslq %r12d, %rax
addq $0x38, %r13
addq $0x18, %r15
cmpq %rax, %rbx
jl 0x2cb40e
jmp 0x2cb264