// File: /workspace/github_c_makefile_star2_O1/shifengbin[P]bishe/Output/../Persistence/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 */
  sqlite3_xauth xAuth;       /* Saved xAuth pointer */
  u8 bEnabledLA;             /* Saved db->lookaside.bEnabled state */

  assert( pTable );

#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( sqlite3VtabCallConnect(pParse, pTable) ){
    return SQLITE_ERROR;
  }
  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 );
  bEnabledLA = db->lookaside.bEnabled;
  if( pTable->pCheck ){
    db->lookaside.bEnabled = 0;
    sqlite3ColumnsFromExprList(pParse, pTable->pCheck, 
                               &pTable->nCol, &pTable->aCol);
  }else{
    pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
    if( pSel ){
      n = pParse->nTab;
      sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
      pTable->nCol = -1;
      db->lookaside.bEnabled = 0;
#ifndef SQLITE_OMIT_AUTHORIZATION
      xAuth = db->xAuth;
      db->xAuth = 0;
      pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
      db->xAuth = xAuth;
#else
      pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
#endif
      pParse->nTab = n;
      if( pSelTab ){
        assert( pTable->aCol==0 );
        pTable->nCol = pSelTab->nCol;
        pTable->aCol = pSelTab->aCol;
        pSelTab->nCol = 0;
        pSelTab->aCol = 0;
        sqlite3DeleteTable(db, pSelTab);
        assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
      }else{
        pTable->nCol = 0;
        nErr++;
      }
      sqlite3SelectDelete(db, pSel);
    } else {
      nErr++;
    }
  }
  db->lookaside.bEnabled = bEnabledLA;
  pTable->pSchema->schemaFlags |= DB_UnresetViews;
#endif /* SQLITE_OMIT_VIEW */
  return nErr;  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %r14
testb $0x10, 0x46(%rsi)
jne 0x5a2a0
xorl %r13d, %r13d
testb $0x10, 0x46(%rbx)
jne 0x5a44a
leaq 0x3e(%rbx), %r12
cmpw $0x0, 0x3e(%rbx)
jg 0x5a44a
js 0x5a348
movb 0x152(%r14), %al
movb %al, -0x29(%rbp)
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x5a367
movb $0x0, 0x152(%r14)
leaq 0x8(%rbx), %rcx
movq %r15, %rdi
movq %r12, %rdx
callq 0x59f0f
xorl %r13d, %r13d
movb -0x29(%rbp), %r15b
jmp 0x5a43a
movq 0x58(%rbx), %rax
testq %rax, %rax
je 0x5a2b4
cmpq %r14, (%rax)
je 0x5a244
movq 0x28(%rax), %rax
jmp 0x5a2a4
movq 0x50(%rbx), %rax
movq (%rax), %r12
leaq 0x1a8(%r14), %rdi
leaq -0x4c(%rbp), %rdx
movq %r12, %rsi
callq 0x3d198
testq %rax, %rax
je 0x5a2d9
movq 0x10(%rax), %rdx
jmp 0x5a2db
xorl %edx, %edx
testq %rdx, %rdx
je 0x5a339
leaq -0x38(%rbp), %r8
movq $0x0, (%r8)
movq (%rdx), %rax
movq 0x10(%rax), %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3efd7
movl %eax, %r12d
testl %eax, %eax
je 0x5a319
movq -0x38(%rbp), %rdx
leaq 0x23074(%rip), %rsi     # 0x7d383
movq %r15, %rdi
xorl %eax, %eax
callq 0x14804
movq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0xb6df
movl $0x1, %r13d
testl %r12d, %r12d
jne 0x5a44a
jmp 0x5a244
leaq 0x24293(%rip), %rsi     # 0x7e5d3
movq %r15, %rdi
movq %r12, %rdx
jmp 0x5a355
movq (%rbx), %rdx
leaq 0x24da5(%rip), %rsi     # 0x7f0f7
movq %r15, %rdi
xorl %eax, %eax
callq 0x14804
movl $0x1, %r13d
jmp 0x5a44a
movq 0x18(%rbx), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x54d2a
testq %rax, %rax
je 0x5a40d
movl 0x50(%r15), %ecx
movl %ecx, -0x30(%rbp)
movq %rax, %r13
movq 0x28(%rax), %rsi
movq %r15, %rdi
callq 0x59eaf
movw $0xffff, (%r12)         # imm = 0xFFFF
movb $0x0, 0x152(%r14)
movq 0x180(%r14), %rax
movq %rax, -0x40(%rbp)
movq $0x0, 0x180(%r14)
movq %r15, %rdi
movq %r13, -0x48(%rbp)
movq %r13, %rsi
callq 0x56476
movq -0x40(%rbp), %rcx
movq %rcx, 0x180(%r14)
movl -0x30(%rbp), %ecx
movl %ecx, 0x50(%r15)
testq %rax, %rax
je 0x5a418
movzwl 0x3e(%rax), %ecx
movw %cx, 0x3e(%rbx)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rbx)
movw $0x0, 0x3e(%rax)
movq $0x0, 0x8(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0xb4be
xorl %r13d, %r13d
jmp 0x5a425
movl $0x1, %r13d
jmp 0x5a297
movw $0x0, (%r12)
movl $0x1, %r13d
movb -0x29(%rbp), %r15b
movq %r14, %rdi
movq -0x48(%rbp), %rsi
movl $0x1, %edx
callq 0x3d9e2
movb %r15b, 0x152(%r14)
movq 0x68(%rbx), %rax
orw $0x2, 0x72(%rax)
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq