// File: /workspace/github_c_makefile_star2_O3/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 0x2c8fd9
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rbx
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 0x2c9145
movq 0x20(%rdx), %r15
addq $0x8, %r15
movq 0x8(%rbx), %r13
addq $0x1c, %r13
xorl %ebp, %ebp
movq %rbx, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
movq %rbx, %r14
movq (%r15), %r12
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x2c915a
movq %rax, %rbx
movq %r12, %rdi
callq 0x2c08a4
movb %al, -0x3(%r13)
testq %rbx, %rbx
je 0x2c9097
movq %r12, 0x28(%rsp)
movq %rbx, 0x20(%rsp)
movq %rbx, %rdi
callq 0x172f0
movq %rax, %rbx
movq -0x1c(%r13), %r14
testq %r14, %r14
je 0x2c90a1
movq %r14, %rdi
callq 0x172f0
movq %rax, %r12
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
jmp 0x2c90a4
movq %r14, %rbx
movq 0x10(%rsp), %r14
jmp 0x2c90f8
xorl %r12d, %r12d
andl $0x3fffffff, %ebx       # imm = 0x3FFFFFFF
leal (%rbx,%r12), %edx
addl $0x2, %edx
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2919d2
movq %rax, -0x1c(%r13)
testq %rax, %rax
je 0x2c90e5
movl %r12d, %ecx
leaq (%rax,%rcx), %rdi
incq %rdi
incl %ebx
movq 0x20(%rsp), %rsi
movq %rbx, %rdx
callq 0x17660
orb $0x4, (%r13)
movb -0x3(%r13), %al
movq 0x18(%rsp), %rbx
movq 0x10(%rsp), %r14
movq 0x28(%rsp), %r12
cmpb $0x40, %al
jg 0x2c9104
movl 0x4(%rsp), %eax
movb %al, -0x3(%r13)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2a9678
testq %rax, %rax
je 0x2c912c
cmpq $0x0, -0xc(%r13)
jne 0x2c912c
movq (%rax), %rsi
movq 0x8(%rsp), %rdi
callq 0x279928
movq %rax, -0xc(%r13)
incq %rbp
movswq 0x46(%rbx), %rax
addq $0x18, %r15
addq $0x20, %r13
cmpq %rax, %rbp
jl 0x2c903e
movw $0x1, 0x4c(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq