// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: vtabCallConstructor
static int vtabCallConstructor(
  sqlite3 *db,
  Table *pTab,
  Module *pMod,
  int (*xConstruct)(sqlite3*,void*,int,const char*const*,sqlite3_vtab**,char**),
  char **pzErr
){
  VtabCtx sCtx;
  VTable *pVTable;
  int rc;
  const char *const*azArg = (const char *const*)pTab->azModuleArg;
  int nArg = pTab->nModuleArg;
  char *zErr = 0;
  char *zModuleName;
  int iDb;
  VtabCtx *pCtx;

  /* Check that the virtual-table is not already being initialized */
  for(pCtx=db->pVtabCtx; pCtx; pCtx=pCtx->pPrior){
    if( pCtx->pTab==pTab ){
      *pzErr = sqlite3MPrintf(db,
          "vtable constructor called recursively: %s", pTab->zName
      );
      return SQLITE_LOCKED;
    }
  }

  zModuleName = sqlite3DbStrDup(db, pTab->zName);
  if( !zModuleName ){
    return SQLITE_NOMEM_BKPT;
  }

  pVTable = sqlite3MallocZero(sizeof(VTable));
  if( !pVTable ){
    sqlite3OomFault(db);
    sqlite3DbFree(db, zModuleName);
    return SQLITE_NOMEM_BKPT;
  }
  pVTable->db = db;
  pVTable->pMod = pMod;
  pVTable->eVtabRisk = SQLITE_VTABRISK_Normal;

  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  pTab->azModuleArg[1] = db->aDb[iDb].zDbSName;

  /* Invoke the virtual table constructor */
  assert( &db->pVtabCtx );
  assert( xConstruct );
  sCtx.pTab = pTab;
  sCtx.pVTable = pVTable;
  sCtx.pPrior = db->pVtabCtx;
  sCtx.bDeclared = 0;
  db->pVtabCtx = &sCtx;
  rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
  db->pVtabCtx = sCtx.pPrior;
  if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
  assert( sCtx.pTab==pTab );

  if( SQLITE_OK!=rc ){
    if( zErr==0 ){
      *pzErr = sqlite3MPrintf(db, "vtable constructor failed: %s", zModuleName);
    }else {
      *pzErr = sqlite3MPrintf(db, "%s", zErr);
      sqlite3_free(zErr);
    }
    sqlite3DbFree(db, pVTable);
  }else if( ALWAYS(pVTable->pVtab) ){
    /* Justification of ALWAYS():  A correct vtab constructor must allocate
    ** the sqlite3_vtab object if successful.  */
    memset(pVTable->pVtab, 0, sizeof(pVTable->pVtab[0]));
    pVTable->pVtab->pModule = pMod->pModule;
    pMod->nRefModule++;
    pVTable->nRef = 1;
    if( sCtx.bDeclared==0 ){
      const char *zFormat = "vtable constructor did not declare schema: %s";
      *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);
      sqlite3VtabUnlock(pVTable);
      rc = SQLITE_ERROR;
    }else{
      int iCol;
      u16 oooHidden = 0;
      /* If everything went according to plan, link the new VTable structure
      ** into the linked list headed by pTab->pVTable. Then loop through the
      ** columns of the table to see if any of them contain the token "hidden".
      ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from
      ** the type string.  */
      pVTable->pNext = pTab->pVTable;
      pTab->pVTable = pVTable;

      for(iCol=0; iCol<pTab->nCol; iCol++){
        char *zType = sqlite3ColumnType(&pTab->aCol[iCol], "");
        int nType;
        int i = 0;
        nType = sqlite3Strlen30(zType);
        for(i=0; i<nType; i++){
          if( 0==sqlite3StrNICmp("hidden", &zType[i], 6)
           && (i==0 || zType[i-1]==' ')
           && (zType[i+6]=='\0' || zType[i+6]==' ')
          ){
            break;
          }
        }
        if( i<nType ){
          int j;
          int nDel = 6 + (zType[i+6] ? 1 : 0);
          for(j=i; (j+nDel)<=nType; j++){
            zType[j] = zType[j+nDel];
          }
          if( zType[i]=='\0' && i>0 ){
            assert(zType[i-1]==' ');
            zType[i-1] = '\0';
          }
          pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
          oooHidden = TF_OOOHidden;
        }else{
          pTab->tabFlags |= oooHidden;
        }
      }
    }
  }

  sqlite3DbFree(db, zModuleName);
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, %rbx
movq %rcx, %r15
movq %rsi, %r12
movq %rdi, %rbp
movq 0x58(%rsi), %rsi
movl 0x54(%r12), %r13d
andq $0x0, 0x20(%rsp)
leaq 0x208(%rdi), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x24cb19
leaq 0x10(%rcx), %rax
cmpq %r12, 0x8(%rcx)
jne 0x24cae6
movq (%r12), %rdx
leaq 0x12a646(%rip), %rsi    # 0x377149
movq %rbp, %rdi
xorl %eax, %eax
callq 0x226ec3
movq %rax, (%rbx)
pushq $0x6
popq %r15
jmp 0x24cdd2
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
movq (%r12), %rsi
movq %rbp, %rdi
callq 0x22572a
pushq $0x7
popq %r14
testq %rax, %rax
je 0x24cc4c
movq %rax, %rbx
pushq $0x30
popq %rdi
callq 0x2227e2
testq %rax, %rax
je 0x24cc39
movq %rbx, 0x30(%rsp)
movq %rbp, (%rax)
movq %r15, (%rsp)
movq 0x10(%rsp), %r15
movq %r15, 0x8(%rax)
movb $0x1, 0x1d(%rax)
movq %rax, %r14
movq 0x70(%r12), %rsi
movq %rbp, %rdi
callq 0x226e9e
movq 0x20(%rbp), %rcx
cltq
shlq $0x5, %rax
movq (%rcx,%rax), %rax
movq 0x58(%r12), %rcx
movq %rax, 0x8(%rcx)
leaq 0x38(%rsp), %rbx
movq %r12, 0x8(%rbx)
movq %r14, (%rbx)
movq 0x208(%rbp), %rax
movq %rax, 0x10(%rbx)
andl $0x0, 0x18(%rbx)
movq %rbx, 0x208(%rbp)
movq 0x18(%r15), %rsi
movq %r14, 0x28(%rsp)
addq $0x10, %r14
leaq 0x20(%rsp), %r9
movq %rbp, %rdi
movl %r13d, %edx
movq 0x18(%rsp), %rcx
movq %r14, %r8
callq *(%rsp)
movl %eax, %r15d
movq 0x10(%rbx), %rax
movq %rbp, (%rsp)
movq %rax, 0x208(%rbp)
testl %r15d, %r15d
je 0x24cc54
cmpl $0x7, %r15d
movq (%rsp), %rbx
jne 0x24cc03
movq %rbx, %rdi
callq 0x224bb1
movq 0x20(%rsp), %rdx
testq %rdx, %rdx
je 0x24cd9a
leaq 0x11c291(%rip), %rsi    # 0x368ea9
movq %rbx, %rdi
xorl %eax, %eax
callq 0x226ec3
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq 0x20(%rsp), %rdi
callq 0x21f7f9
jmp 0x24cdb8
movq %rbp, %rdi
callq 0x224bb1
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x22d0fc
movq %r14, %r15
jmp 0x24cdd2
movq (%r14), %rax
testq %rax, %rax
je 0x24cded
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq 0x10(%rsp), %rdx
movq (%rdx), %rax
movq 0x28(%rsp), %r14
movq 0x10(%r14), %rcx
movq %rax, (%rcx)
incl 0x10(%rdx)
movl $0x1, 0x18(%r14)
cmpl $0x0, 0x50(%rsp)
je 0x24cdf6
movq 0x60(%r12), %rax
movq %rax, 0x28(%r14)
movq %r14, 0x60(%r12)
leaq 0x12a515(%rip), %rbp    # 0x3771bf
pushq $0x6
popq %r13
xorl %ecx, %ecx
movq $0x0, 0x8(%rsp)
movswq 0x46(%r12), %rax
cmpq %rax, %rcx
jge 0x24cde4
movq %rcx, 0x10(%rsp)
shlq $0x5, %rcx
movq 0x8(%r12), %rdi
movq %rcx, 0x18(%rsp)
addq %rcx, %rdi
leaq 0x11d88b(%rip), %rsi    # 0x36a570
callq 0x22c117
movq %rax, %r14
movq %rax, %rdi
callq 0x2211ac
movl %eax, %r15d
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x24cd2e
leaq (%r14,%rbx), %rsi
movq %rbp, %rdi
movl %r13d, %edx
callq 0x2217ad
testl %eax, %eax
jne 0x24cd29
testq %rbx, %rbx
je 0x24cd1f
cmpb $0x20, -0x1(%r14,%rbx)
jne 0x24cd29
movzbl 0x6(%r14,%rbx), %eax
testb $-0x21, %al
je 0x24cd3a
incq %rbx
jmp 0x24ccfa
movzwl 0x8(%rsp), %eax
orl %eax, 0x40(%r12)
jmp 0x24cd8d
cmpb $0x1, %al
pushq $0x7
popq %rax
sbbq $0x0, %rax
movq %r14, %rcx
addq %rax, %rcx
movq %rbx, %rdx
leaq (%rax,%rdx), %rsi
cmpq %r15, %rsi
ja 0x24cd62
movb (%rcx,%rdx), %sil
movb %sil, (%r14,%rdx)
incq %rdx
jmp 0x24cd4c
testq %rbx, %rbx
je 0x24cd74
cmpb $0x0, (%r14,%rbx)
jne 0x24cd74
movb $0x0, -0x1(%r14,%rbx)
movq 0x8(%r12), %rax
movq 0x18(%rsp), %rcx
orw $0x2, 0x1c(%rax,%rcx)
movw $0x400, %ax             # imm = 0x400
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rcx
incq %rcx
jmp 0x24ccb9
leaq 0x12a3d2(%rip), %rsi    # 0x377173
movq %rbx, %rdi
movq 0x30(%rsp), %rdx
xorl %eax, %eax
callq 0x226ec3
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0x22d0fc
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x22d0fc
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rbx
xorl %r15d, %r15d
jmp 0x24cdc5
xorl %r15d, %r15d
movq (%rsp), %rbx
jmp 0x24cdc5
movq (%r12), %rdx
leaq 0x12a390(%rip), %rsi    # 0x377191
movq (%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x226ec3
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq %r14, %rdi
callq 0x238838
pushq $0x1
popq %r15
jmp 0x24cdc5