// File: /workspace/github_c_makefile_star2_O1/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 0x2d4b4e
retq
cmpb $0x0, 0x1c(%rdi)
jne 0x2d4b4d
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq (%rdi), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rdi), %r15
movq %rsi, %rax
movq 0x50(%rsi), %rsi
testq %rsi, %rsi
jne 0x2d4b6e
movq 0x20(%rax), %rbp
movq 0x28(%rax), %rax
movq %rax, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
movb $0x1, 0x1c(%rdi)
movq 0x8(%rsp), %rax
movq 0x30(%rax), %r12
movl (%rbp), %esi
movq %r15, %rdi
callq 0x2b2353
cmpl $0x0, (%rbp)
jle 0x2d4ccc
leaq 0x8(%rbp), %r13
xorl %r14d, %r14d
xorl %ebx, %ebx
movq (%r13), %rax
movq 0x8(%r13), %rsi
testq %rsi, %rsi
je 0x2d4bcb
testb $0x3, 0x11(%r13)
je 0x2d4c34
testb $0x44, %r12b
je 0x2d4c23
cmpb $-0x5c, (%rax)
jne 0x2d4c23
movzwl 0x30(%rax), %edx
movq 0x40(%rax), %rax
testw %dx, %dx
jns 0x2d4be7
movzwl 0x44(%rax), %edx
leaq 0x10b0c5(%rip), %rcx    # 0x3dfcb3
testw %dx, %dx
js 0x2d4c01
movq 0x8(%rax), %rcx
movzwl %dx, %edx
shll $0x5, %edx
movq (%rcx,%rdx), %rcx
testb $0x4, %r12b
jne 0x2d4c72
movq (%r15), %rax
cmpb $0x0, 0x61(%rax)
jne 0x2d4cb4
movq 0x98(%r15), %rdi
addq %r14, %rdi
movq %rcx, %rsi
jmp 0x2d4c47
testq %rsi, %rsi
je 0x2d4c5a
movq 0x8(%rsp), %rdi
callq 0x283365
jmp 0x2d4c88
movq (%r15), %rax
cmpb $0x0, 0x61(%rax)
jne 0x2d4cb4
movq 0x98(%r15), %rdi
addq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq $-0x1, %r8
jmp 0x2d4caf
leal 0x1(%rbx), %edx
movq 0x8(%rsp), %rdi
leaq 0x10c932(%rip), %rsi    # 0x3e159b
xorl %eax, %eax
callq 0x284f95
jmp 0x2d4c88
movq (%rax), %rdx
movq 0x8(%rsp), %rdi
leaq 0x88e9c(%rip), %rsi     # 0x35db1d
xorl %eax, %eax
callq 0x284f95
movq (%r15), %rcx
cmpb $0x0, 0x61(%rcx)
jne 0x2d4cb4
movq 0x98(%r15), %rdi
addq %r14, %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
leaq -0x527f4(%rip), %r8     # 0x2824bb
callq 0x281f27
incq %rbx
movslq (%rbp), %rax
addq $0x18, %r13
addq $0x38, %r14
cmpq %rax, %rbx
jl 0x2d4bb7
movq 0x18(%rsp), %rax
movq 0x10(%rax), %r14
movq 0x10(%rsp), %rcx
movq %rcx, 0x28(%rsp)
movq %rax, 0x20(%rsp)
movq $0x0, 0x38(%rsp)
cmpl $0x0, (%rbp)
jle 0x2d4d59
leaq 0x8(%rbp), %r15
xorl %r12d, %r12d
leaq 0x20(%rsp), %rbx
xorl %r13d, %r13d
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x2d29ae
movq (%r14), %rcx
cmpb $0x0, 0x61(%rcx)
jne 0x2d4d45
movzwl 0xc0(%r14), %ecx
imulq $0x38, %rcx, %rdi
addq 0x98(%r14), %rdi
addq %r12, %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq $-0x1, %r8
callq 0x281f27
incq %r13
movslq (%rbp), %rax
addq $0x38, %r12
addq $0x18, %r15
cmpq %rax, %r13
jl 0x2d4d02
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq