// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3CreateView
SQLITE_PRIVATE void sqlite3CreateView(
  Parse *pParse,     /* The parsing context */
  Token *pBegin,     /* The CREATE token that begins the statement */
  Token *pName1,     /* The token that holds the name of the view */
  Token *pName2,     /* The token that holds the name of the view */
  ExprList *pCNames, /* Optional list of view column names */
  Select *pSelect,   /* A SELECT statement that will become the new view */
  int isTemp,        /* TRUE for a TEMPORARY view */
  int noErr          /* Suppress error messages if VIEW already exists */
){
  Table *p;
  int n;
  const char *z;
  Token sEnd;
  DbFixer sFix;
  Token *pName = 0;
  int iDb;
  sqlite3 *db = pParse->db;

  if( pParse->nVar>0 ){
    sqlite3ErrorMsg(pParse, "parameters are not allowed in views");
    goto create_view_fail;
  }
  sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr);
  p = pParse->pNewTable;
  if( p==0 || pParse->nErr ) goto create_view_fail;
  sqlite3TwoPartName(pParse, pName1, pName2, &pName);
  iDb = sqlite3SchemaToIndex(db, p->pSchema);
  sqlite3FixInit(&sFix, pParse, iDb, "view", pName);
  if( sqlite3FixSelect(&sFix, pSelect) ) goto create_view_fail;

  /* Make a copy of the entire SELECT statement that defines the view.
  ** This will force all the Expr.token.z values to be dynamically
  ** allocated rather than point to the input string - which means that
  ** they will persist after the current sqlite3_exec() call returns.
  */
  pSelect->selFlags |= SF_View;
  if( IN_RENAME_OBJECT ){
    p->pSelect = pSelect;
    pSelect = 0;
  }else{
    p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);
  }
  p->pCheck = sqlite3ExprListDup(db, pCNames, EXPRDUP_REDUCE);
  if( db->mallocFailed ) goto create_view_fail;

  /* Locate the end of the CREATE VIEW statement.  Make sEnd point to
  ** the end.
  */
  sEnd = pParse->sLastToken;
  assert( sEnd.z[0]!=0 || sEnd.n==0 );
  if( sEnd.z[0]!=';' ){
    sEnd.z += sEnd.n;
  }
  sEnd.n = 0;
  n = (int)(sEnd.z - pBegin->z);
  assert( n>0 );
  z = pBegin->z;
  while( sqlite3Isspace(z[n-1]) ){ n--; }
  sEnd.z = &z[n-1];
  sEnd.n = 1;

  /* Use sqlite3EndTable() to add the view to the schema table */
  sqlite3EndTable(pParse, 0, &sEnd, 0, 0);

create_view_fail:
  sqlite3SelectDelete(db, pSelect);
  if( IN_RENAME_OBJECT ){
    sqlite3RenameExprlistUnmap(pParse, pCNames);
  }
  sqlite3ExprListDelete(db, pCNames);
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movswl 0x118(%rax), %eax
cmpl $0x0, %eax
jle 0x41ac99
movq -0x8(%rbp), %rdi
leaq 0x192ee5(%rip), %rsi    # 0x5adb72
movb $0x0, %al
callq 0x3cb660
jmp 0x41ae95
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl 0x10(%rbp), %ecx
movl 0x18(%rbp), %eax
movl $0x1, %r8d
xorl %r9d, %r9d
movl %eax, (%rsp)
callq 0x417240
movq -0x8(%rbp), %rax
movq 0x148(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x41acdc
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x41ace1
jmp 0x41ae95
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x90(%rbp), %rcx
callq 0x4339d0
movq -0xa0(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x70(%rax), %rsi
callq 0x3cb770
movl %eax, -0x94(%rbp)
movq -0x8(%rbp), %rsi
movl -0x94(%rbp), %edx
movq -0x90(%rbp), %r8
leaq -0x88(%rbp), %rdi
leaq 0x1935f6(%rip), %rcx    # 0x5ae328
callq 0x43ce90
movq -0x30(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x43d600
cmpl $0x0, %eax
je 0x41ad51
jmp 0x41ae95
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x200000, %ecx         # imm = 0x200000
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movzbl 0x11c(%rax), %eax
cmpl $0x2, %eax
jl 0x41ad87
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq $0x0, -0x30(%rbp)
jmp 0x41ada7
movq -0xa0(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x1, %edx
callq 0x4325b0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0xa0(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x1, %edx
callq 0x432810
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0xa0(%rbp), %rax
cmpb $0x0, 0x61(%rax)
je 0x41add9
jmp 0x41ae95
movq -0x8(%rbp), %rax
movq 0x108(%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x110(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3b, %eax
je 0x41ae0f
movl -0x50(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x50(%rbp)
movq -0x58(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x18bd84(%rip), %rax    # 0x5a6bd0
movzbl (%rax,%rcx), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x41ae63
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x41ae32
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movl $0x1, -0x50(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %r8d
leaq -0x58(%rbp), %rdx
xorl %ecx, %ecx
movq %r8, %rsi
callq 0x417840
movq -0xa0(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x40c7e0
movq -0x8(%rbp), %rax
movzbl 0x11c(%rax), %eax
cmpl $0x2, %eax
jl 0x41aec2
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x43cb60
movq -0xa0(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x40c6a0
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)