// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3ViewGetColumnNames
SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
  Table *pSelTab;   /* A fake table from which we get the result set */
  Select *pSel;     /* Copy of the SELECT that implements the view */
  int nErr = 0;     /* Number of errors encountered */
  int n;            /* Temporarily holds the number of cursors assigned */
  sqlite3 *db = pParse->db;  /* Database connection for malloc errors */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  int rc;
#endif
#ifndef SQLITE_OMIT_AUTHORIZATION
  sqlite3_xauth xAuth;       /* Saved xAuth pointer */
#endif

  assert( pTable );

#ifndef SQLITE_OMIT_VIRTUALTABLE
  db->nSchemaLock++;
  rc = sqlite3VtabCallConnect(pParse, pTable);
  db->nSchemaLock--;
  if( rc ){
    return 1;
  }
  if( IsVirtual(pTable) ) return 0;
#endif

#ifndef SQLITE_OMIT_VIEW
  /* A positive nCol means the columns names for this view are
  ** already known.
  */
  if( pTable->nCol>0 ) return 0;

  /* A negative nCol is a special marker meaning that we are currently
  ** trying to compute the column names.  If we enter this routine with
  ** a negative nCol, it means two or more views form a loop, like this:
  **
  **     CREATE VIEW one AS SELECT * FROM two;
  **     CREATE VIEW two AS SELECT * FROM one;
  **
  ** Actually, the error above is now caught prior to reaching this point.
  ** But the following test is still important as it does come up
  ** in the following:
  **
  **     CREATE TABLE main.ex1(a);
  **     CREATE TEMP VIEW ex1 AS SELECT a FROM ex1;
  **     SELECT * FROM temp.ex1;
  */
  if( pTable->nCol<0 ){
    sqlite3ErrorMsg(pParse, "view %s is circularly defined", pTable->zName);
    return 1;
  }
  assert( pTable->nCol>=0 );

  /* If we get this far, it means we need to compute the table names.
  ** Note that the call to sqlite3ResultSetOfSelect() will expand any
  ** "*" elements in the results set of the view and will assign cursors
  ** to the elements of the FROM clause.  But we do not want these changes
  ** to be permanent.  So the computation is done on a copy of the SELECT
  ** statement that defines the view.
  */
  assert( pTable->pSelect );
  pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
  if( pSel ){
    u8 eParseMode = pParse->eParseMode;
    pParse->eParseMode = PARSE_MODE_NORMAL;
    n = pParse->nTab;
    sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
    pTable->nCol = -1;
    DisableLookaside;
#ifndef SQLITE_OMIT_AUTHORIZATION
    xAuth = db->xAuth;
    db->xAuth = 0;
    pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE);
    db->xAuth = xAuth;
#else
    pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE);
#endif
    pParse->nTab = n;
    if( pSelTab==0 ){
      pTable->nCol = 0;
      nErr++;
    }else if( pTable->pCheck ){
      /* CREATE VIEW name(arglist) AS ...
      ** The names of the columns in the table are taken from
      ** arglist which is stored in pTable->pCheck.  The pCheck field
      ** normally holds CHECK constraints on an ordinary table, but for
      ** a VIEW it holds the list of column names.
      */
      sqlite3ColumnsFromExprList(pParse, pTable->pCheck,
                                 &pTable->nCol, &pTable->aCol);
      if( db->mallocFailed==0
       && pParse->nErr==0
       && pTable->nCol==pSel->pEList->nExpr
      ){
        sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel,
                                               SQLITE_AFF_NONE);
      }
    }else{
      /* CREATE VIEW name AS...  without an argument list.  Construct
      ** the column names from the SELECT statement that defines the view.
      */
      assert( pTable->aCol==0 );
      pTable->nCol = pSelTab->nCol;
      pTable->aCol = pSelTab->aCol;
      pSelTab->nCol = 0;
      pSelTab->aCol = 0;
      assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
    }
    pTable->nNVCol = pTable->nCol;
    sqlite3DeleteTable(db, pSelTab);
    sqlite3SelectDelete(db, pSel);
    EnableLookaside;
    pParse->eParseMode = eParseMode;
  } else {
    nErr++;
  }
  pTable->pSchema->schemaFlags |= DB_UnresetViews;
  if( db->mallocFailed ){
    sqlite3DeleteColumnNames(db, pTable);
    pTable->aCol = 0;
    pTable->nCol = 0;
  }
#endif /* SQLITE_OMIT_VIEW */
  return nErr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43b460
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movl 0x48(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x48(%rax)
cmpl $0x0, -0x3c(%rbp)
je 0x43a63e
movl $0x1, -0x4(%rbp)
jmp 0x43a8ff
movq -0x18(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x43a654
movl $0x0, -0x4(%rbp)
jmp 0x43a8ff
movq -0x18(%rbp), %rax
movswl 0x46(%rax), %eax
cmpl $0x0, %eax
jle 0x43a66d
movl $0x0, -0x4(%rbp)
jmp 0x43a8ff
movq -0x18(%rbp), %rax
movswl 0x46(%rax), %eax
cmpl $0x0, %eax
jge 0x43a69f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq 0x172c88(%rip), %rsi    # 0x5ad314
movb $0x0, %al
callq 0x3cb660
movl $0x1, -0x4(%rbp)
jmp 0x43a8ff
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
xorl %edx, %edx
callq 0x4325b0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x43a8b0
movq -0x10(%rbp), %rax
movb 0x11c(%rax), %al
movb %al, -0x49(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0x11c(%rax)
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x439ed0
movq -0x18(%rbp), %rax
movw $0xffff, 0x46(%rax)     # imm = 0xFFFF
movq -0x38(%rbp), %rax
movl 0x170(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x170(%rax)
movq -0x38(%rbp), %rax
movw $0x0, 0x174(%rax)
movq -0x38(%rbp), %rax
movq 0x1c8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq $0x0, 0x1c8(%rax)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x40, %edx
callq 0x4347c0
movq %rax, -0x20(%rbp)
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x1c8(%rax)
movl -0x30(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
cmpq $0x0, -0x20(%rbp)
jne 0x43a78a
movq -0x18(%rbp), %rax
movw $0x0, 0x46(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x43a831
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x43a7f9
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x18(%rbp), %rdx
addq $0x46, %rdx
movq -0x18(%rbp), %rcx
addq $0x8, %rcx
callq 0x43af90
movq -0x38(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
jne 0x43a7f7
movq -0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x43a7f7
movq -0x18(%rbp), %rax
movswl 0x46(%rax), %eax
movq -0x28(%rbp), %rcx
movq 0x20(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x43a7f7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl $0x40, %ecx
callq 0x43b570
jmp 0x43a82f
movq -0x20(%rbp), %rax
movw 0x46(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x46(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movw $0x0, 0x46(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0x43a831
movq -0x18(%rbp), %rax
movw 0x46(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x48(%rax)
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3bff20
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x40c7e0
movq -0x38(%rbp), %rax
movl 0x170(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x170(%rax)
movq -0x38(%rbp), %rax
cmpl $0x0, 0x170(%rax)
je 0x43a882
xorl %eax, %eax
movl %eax, -0x50(%rbp)
jmp 0x43a890
movq -0x38(%rbp), %rax
movzwl 0x176(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movw %ax, %cx
movq -0x38(%rbp), %rax
movw %cx, 0x174(%rax)
movb -0x49(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x11c(%rax)
jmp 0x43a8b9
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movzwl 0x72(%rax), %ecx
orl $0x2, %ecx
movw %cx, 0x72(%rax)
movq -0x38(%rbp), %rax
cmpb $0x0, 0x61(%rax)
je 0x43a8f9
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x411c00
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movw $0x0, 0x46(%rax)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)