// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x11b(%rax)
je 0x43eacc
jmp 0x43ed83
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1c(%rax)
je 0x43eadb
jmp 0x43ed83
jmp 0x43eadd
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x43eaf6
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x43eadd
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movb $0x1, 0x1c(%rax)
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rcx
andq $0x40, %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0x79(%rbp)
jne 0x43eb52
cmpl $0x0, -0x44(%rbp)
setne %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movl (%rax), %esi
callq 0x4106b0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x43ed72
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x43ec0f
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb 0x11(%rax), %al
andb $0x3, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x43ec0f
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x58(%rbp), %rcx
xorl %edx, %edx
movq $-0x1, %r8
callq 0x410780
jmp 0x43ed62
cmpl $0x0, -0x48(%rbp)
je 0x43ece5
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa4, %eax
jne 0x43ece5
movq -0x50(%rbp), %rax
movswl 0x30(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x50(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0x43ec53
movq -0x28(%rbp), %rax
movswl 0x44(%rax), %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0x43ec66
leaq 0x16cd93(%rip), %rax    # 0x5ab9f3
movq %rax, -0x60(%rbp)
jmp 0x43ec80
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x64(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x43ecca
movq $0x0, -0x70(%rbp)
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
movq -0x60(%rbp), %rcx
leaq 0xe6f21(%rip), %rsi     # 0x525bc5
movb $0x0, %al
callq 0x3cb7d0
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x70(%rbp), %rcx
xorl %edx, %edx
leaq -0x76123(%rip), %r8     # 0x3c8ba0
callq 0x410780
jmp 0x43ece3
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x60(%rbp), %rcx
xorl %edx, %edx
movq $-0x1, %r8
callq 0x410780
jmp 0x43ed60
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0x43ed28
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %edx
addl $0x1, %edx
leaq 0x16e5c8(%rip), %rsi    # 0x5ad2e0
movb $0x0, %al
callq 0x3cb7d0
movq %rax, -0x88(%rbp)
jmp 0x43ed3c
movq -0x40(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x3c91a0
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x78(%rbp), %rcx
xorl %edx, %edx
leaq -0x761bb(%rip), %r8     # 0x3c8ba0
callq 0x410780
jmp 0x43ed62
jmp 0x43ed64
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x43eb73
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x4459a0
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)