// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3SelectAddColumnTypeAndCollation
SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(
  Parse *pParse,        /* Parsing contexts */
  Table *pTab,          /* Add column type information to this table */
  Select *pSelect,      /* SELECT used to determine types and collations */
  char aff              /* Default affinity for columns */
){
  sqlite3 *db = pParse->db;
  NameContext sNC;
  Column *pCol;
  CollSeq *pColl;
  int i;
  Expr *p;
  struct ExprList_item *a;

  assert( pSelect!=0 );
  assert( (pSelect->selFlags & SF_Resolved)!=0 );
  assert( pTab->nCol==pSelect->pEList->nExpr || db->mallocFailed );
  if( db->mallocFailed ) return;
  memset(&sNC, 0, sizeof(sNC));
  sNC.pSrcList = pSelect->pSrc;
  a = pSelect->pEList->a;
  for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
    const char *zType;
    int n, m;
    p = a[i].pExpr;
    zType = columnType(&sNC, p, 0, 0, 0);
    /* pCol->szEst = ... // Column size est for SELECT tables never used */
    pCol->affinity = sqlite3ExprAffinity(p);
    if( zType ){
      m = sqlite3Strlen30(zType);
      n = sqlite3Strlen30(pCol->zName);
      pCol->zName = sqlite3DbReallocOrFree(db, pCol->zName, n+m+2);
      if( pCol->zName ){
        memcpy(&pCol->zName[n+1], zType, m+1);
        pCol->colFlags |= COLFLAG_HASTYPE;
      }
    }
    if( pCol->affinity<=SQLITE_AFF_NONE ) pCol->affinity = aff;
    pColl = sqlite3ExprCollSeq(pParse, p);
    if( pColl && pCol->zColl==0 ){
      pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
    }
  }
  pTab->szTabRow = 1; /* Any non-zero value works */
}

// Assembly:
movq (%rdi), %rax
cmpb $0x0, 0x61(%rax)
je 0x2d2840
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rax, 0x8(%rsp)
movl %ecx, 0x4(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x28(%rdx), %rax
movq %rax, 0x38(%rsp)
cmpw $0x0, 0x46(%rsi)
jle 0x2d2998
movq 0x20(%rdx), %r15
addq $0x8, %r15
movq 0x8(%r14), %r13
addq $0x1c, %r13
xorl %ebp, %ebp
movq %r14, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
movq (%r15), %rbx
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x2d29ae
movq %rax, %r12
movq %rbx, 0x28(%rsp)
movq %rbx, %rdi
callq 0x2ca042
movb %al, -0x3(%r13)
testq %r12, %r12
je 0x2d2944
movq %r12, 0x20(%rsp)
movq %r12, %rdi
callq 0x172f0
movq %rax, %rbx
movq -0x1c(%r13), %r14
testq %r14, %r14
je 0x2d28fb
movq %r14, %rdi
callq 0x172f0
movq %rax, %r12
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
jmp 0x2d28fe
xorl %r12d, %r12d
andl $0x3fffffff, %ebx       # imm = 0x3FFFFFFF
leal (%rbx,%r12), %edx
addl $0x2, %edx
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x29b6a6
movq %rax, -0x1c(%r13)
testq %rax, %rax
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %rsi
je 0x2d2944
movl %r12d, %ecx
leaq (%rax,%rcx), %rdi
incq %rdi
incl %ebx
movq %rbx, %rdx
callq 0x17660
orb $0x4, (%r13)
cmpb $0x40, -0x3(%r13)
jg 0x2d2953
movl 0x4(%rsp), %eax
movb %al, -0x3(%r13)
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x2b32a0
testq %rax, %rax
je 0x2d297f
cmpq $0x0, -0xc(%r13)
jne 0x2d297f
movq (%rax), %rsi
movq 0x8(%rsp), %rdi
callq 0x283365
movq %rax, -0xc(%r13)
incq %rbp
movswq 0x46(%r14), %rax
addq $0x18, %r15
addq $0x20, %r13
cmpq %rax, %rbp
jl 0x2d28a5
movw $0x1, 0x4c(%r14)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq