// File: /workspace/github_c_makefile_star2_O0/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
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 -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x797b0
cmpl $0x0, %eax
je 0x78f90
movl $0x1, -0x4(%rbp)
jmp 0x79179
movq -0x18(%rbp), %rax
movzbl 0x46(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x78fac
movl $0x0, -0x4(%rbp)
jmp 0x79179
movq -0x18(%rbp), %rax
movswl 0x3e(%rax), %eax
cmpl $0x0, %eax
jle 0x78fc5
movl $0x0, -0x4(%rbp)
jmp 0x79179
movq -0x18(%rbp), %rax
movswl 0x3e(%rax), %eax
cmpl $0x0, %eax
jge 0x78ff7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq 0x2ea61(%rip), %rsi     # 0xa7a45
movb $0x0, %al
callq 0x17840
movl $0x1, -0x4(%rbp)
jmp 0x79179
movq -0x38(%rbp), %rax
movb 0x152(%rax), %al
movb %al, -0x41(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x79040
movq -0x38(%rbp), %rax
movb $0x0, 0x152(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x18(%rbp), %rdx
addq $0x3e, %rdx
movq -0x18(%rbp), %rcx
addq $0x8, %rcx
callq 0x78a50
jmp 0x79153
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
xorl %edx, %edx
callq 0x71840
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x79148
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x78570
movq -0x18(%rbp), %rax
movw $0xffff, 0x3e(%rax)     # imm = 0xFFFF
movq -0x38(%rbp), %rax
movb $0x0, 0x152(%rax)
movq -0x38(%rbp), %rax
movq 0x180(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq $0x0, 0x180(%rax)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x74090
movq %rax, -0x20(%rbp)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x180(%rax)
movl -0x30(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x50(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x79126
movq -0x20(%rbp), %rax
movw 0x3e(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x3e(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movw $0x0, 0x3e(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xd000
jmp 0x79139
movq -0x18(%rbp), %rax
movw $0x0, 0x3e(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x53840
jmp 0x79151
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x79153
movb -0x41(%rbp), %cl
movq -0x38(%rbp), %rax
movb %cl, 0x152(%rax)
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
movzwl 0x72(%rax), %ecx
orl $0x2, %ecx
movw %cx, 0x72(%rax)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)