// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3VtabFinishParse
SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
  Table *pTab = pParse->pNewTable;  /* The table being constructed */
  sqlite3 *db = pParse->db;         /* The database connection */

  if( pTab==0 ) return;
  addArgumentToVtab(pParse);
  pParse->sArg.z = 0;
  if( pTab->nModuleArg<1 ) return;

  /* If the CREATE VIRTUAL TABLE statement is being entered for the
  ** first time (in other words if the virtual table is actually being
  ** created now instead of just being read out of sqlite_schema) then
  ** do additional initialization work and store the statement text
  ** in the sqlite_schema table.
  */
  if( !db->init.busy ){
    char *zStmt;
    char *zWhere;
    int iDb;
    int iReg;
    Vdbe *v;

    sqlite3MayAbort(pParse);

    /* Compute the complete text of the CREATE VIRTUAL TABLE statement */
    if( pEnd ){
      pParse->sNameToken.n = (int)(pEnd->z - pParse->sNameToken.z) + pEnd->n;
    }
    zStmt = sqlite3MPrintf(db, "CREATE VIRTUAL TABLE %T", &pParse->sNameToken);

    /* A slot for the record has already been allocated in the
    ** schema table.  We just need to update that slot with all
    ** the information we've collected.
    **
    ** The VM register number pParse->regRowid holds the rowid of an
    ** entry in the sqlite_schema table tht was created for this vtab
    ** by sqlite3StartTable().
    */
    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
    sqlite3NestedParse(pParse,
      "UPDATE %Q." DFLT_SCHEMA_TABLE " "
         "SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q "
       "WHERE rowid=#%d",
      db->aDb[iDb].zDbSName,
      pTab->zName,
      pTab->zName,
      zStmt,
      pParse->regRowid
    );
    v = sqlite3GetVdbe(pParse);
    sqlite3ChangeCookie(pParse, iDb);

    sqlite3VdbeAddOp0(v, OP_Expire);
    zWhere = sqlite3MPrintf(db, "name=%Q AND sql=%Q", pTab->zName, zStmt);
    sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);
    sqlite3DbFree(db, zStmt);

    iReg = ++pParse->nMem;
    sqlite3VdbeLoadString(v, iReg, pTab->zName);
    sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
  }

  /* If we are rereading the sqlite_schema table create the in-memory
  ** record of the table. The xConnect() method is not called until
  ** the first time the virtual table is used in an SQL statement. This
  ** allows a schema that contains virtual tables to be loaded before
  ** the required virtual table implementations are registered.  */
  else {
    Table *pOld;
    Schema *pSchema = pTab->pSchema;
    const char *zName = pTab->zName;
    assert( sqlite3SchemaMutexHeld(db, 0, pSchema) );
    pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
    if( pOld ){
      sqlite3OomFault(db);
      assert( pTab==pOld );  /* Malloc must have failed inside HashInsert() */
      return;
    }
    pParse->pNewTable = 0;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x148(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x428fc6
jmp 0x42919e
movq -0x8(%rbp), %rdi
callq 0x465a70
movq -0x8(%rbp), %rax
movq $0x0, 0x168(%rax)
movq -0x18(%rbp), %rax
cmpl $0x1, 0x54(%rax)
jge 0x428fed
jmp 0x42919e
movq -0x20(%rbp), %rax
cmpb $0x0, 0xb5(%rax)
jne 0x42914d
movq -0x8(%rbp), %rdi
callq 0x42e470
cmpq $0x0, -0x10(%rbp)
je 0x429036
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movq 0xf8(%rcx), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x100(%rax)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0xf8, %rdx
leaq 0x186299(%rip), %rsi    # 0x5af2e5
movb $0x0, %al
callq 0x3cb7d0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rsi
callq 0x3cb770
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %r8
movq -0x28(%rbp), %r9
movq -0x8(%rbp), %rax
movl 0x78(%rax), %eax
leaq 0x186258(%rip), %rsi    # 0x5af2fd
movl %eax, (%rsp)
movb $0x0, %al
callq 0x434d60
movq -0x8(%rbp), %rdi
callq 0x4299d0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x434f00
movq -0x40(%rbp), %rdi
movl $0x9e, %esi
callq 0x429a40
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movq -0x28(%rbp), %rcx
leaq 0x186274(%rip), %rsi    # 0x5af360
movb $0x0, %al
callq 0x3cb7d0
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rdi
movl -0x34(%rbp), %esi
movq -0x30(%rbp), %rdx
callq 0x434f60
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x3c00a0
movq -0x8(%rbp), %rcx
movl 0x38(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x38(%rcx)
movl %eax, -0x38(%rbp)
movq -0x40(%rbp), %rdi
movl -0x38(%rbp), %esi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
callq 0x429f40
movq -0x40(%rbp), %rdi
movl -0x34(%rbp), %edx
movl -0x38(%rbp), %ecx
movl $0xa3, %esi
callq 0x410100
jmp 0x42919e
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
movq -0x58(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x40ada0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x42918f
movq -0x20(%rbp), %rdi
callq 0x3c8ba0
jmp 0x42919e
movq -0x8(%rbp), %rax
movq $0x0, 0x148(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)