// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movl 0x54(%rax), %eax
movl %eax, -0x6c(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x208(%rax), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
je 0x40ec7f
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0x40ec69
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq 0x19d56e(%rip), %rsi    # 0x5ac1ba
movb $0x0, %al
callq 0x3cb7d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x6, -0x4(%rbp)
jmp 0x40f139
jmp 0x40ec6b
movq -0x90(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x90(%rbp)
jmp 0x40ec1f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x3c91a0
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x40eca6
movl $0x7, -0x4(%rbp)
jmp 0x40f139
movl $0x30, %edi
callq 0x3c51d0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x40ecdd
movq -0x10(%rbp), %rdi
callq 0x3c8ba0
movq -0x10(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x3c00a0
movl $0x7, -0x4(%rbp)
jmp 0x40f139
movq -0x10(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x58(%rbp), %rax
movb $0x1, 0x1d(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rsi
callq 0x3cb770
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x84(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x208(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
leaq -0x50(%rbp), %rcx
movq %rcx, 0x208(%rax)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x18(%rcx), %rsi
movl -0x6c(%rbp), %edx
movq -0x68(%rbp), %rcx
movq -0x58(%rbp), %r8
addq $0x10, %r8
leaq -0x78(%rbp), %r9
callq *%rax
movl %eax, -0x5c(%rbp)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x208(%rax)
cmpl $0x7, -0x5c(%rbp)
jne 0x40edb3
movq -0x10(%rbp), %rdi
callq 0x3c8ba0
xorl %eax, %eax
cmpl -0x5c(%rbp), %eax
je 0x40ee1e
cmpq $0x0, -0x78(%rbp)
jne 0x40ede3
movq -0x10(%rbp), %rdi
movq -0x80(%rbp), %rdx
leaq 0x19d414(%rip), %rsi    # 0x5ac1e4
movb $0x0, %al
callq 0x3cb7d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
jmp 0x40ee0c
movq -0x10(%rbp), %rdi
movq -0x78(%rbp), %rdx
leaq 0x18d22f(%rip), %rsi    # 0x59c021
movb $0x0, %al
callq 0x3cb7d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x78(%rbp), %rdi
callq 0x3c0800
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x3c00a0
jmp 0x40f126
movq -0x58(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x40f124
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x19360
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x58(%rbp), %rax
movl $0x1, 0x18(%rax)
cmpl $0x0, -0x38(%rbp)
jne 0x40eeb7
leaq 0x19d38a(%rip), %rax    # 0x5ac202
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movb $0x0, %al
callq 0x3cb7d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rdi
callq 0x3eb660
movl $0x1, -0x5c(%rbp)
jmp 0x40f122
movw $0x0, -0x9e(%rbp)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x58(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x40f120
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x9c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x18e70f(%rip), %rsi    # 0x59d628
callq 0x3d3c70
movq %rax, -0xa8(%rbp)
movl $0x0, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x3c3400
movl %eax, -0xac(%rbp)
movl $0x0, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
cmpl -0xac(%rbp), %eax
jge 0x40effc
movq -0xa8(%rbp), %rsi
movslq -0xb0(%rbp), %rax
addq %rax, %rsi
leaq 0x19d2bb(%rip), %rdi    # 0x5ac230
movl $0x6, %edx
callq 0x3c3ef0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x40efe6
cmpl $0x0, -0xb0(%rbp)
je 0x40efac
movq -0xa8(%rbp), %rax
movl -0xb0(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0x40efe6
movq -0xa8(%rbp), %rax
movl -0xb0(%rbp), %ecx
addl $0x6, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x40efe4
movq -0xa8(%rbp), %rax
movl -0xb0(%rbp), %ecx
addl $0x6, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0x40efe6
jmp 0x40effc
jmp 0x40efe8
movl -0xb0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0(%rbp)
jmp 0x40ef4b
movl -0xb0(%rbp), %eax
cmpl -0xac(%rbp), %eax
jge 0x40f0f9
movq -0xa8(%rbp), %rax
movl -0xb0(%rbp), %ecx
addl $0x6, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
addl $0x6, %eax
movl %eax, -0xb8(%rbp)
movl -0xb0(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
addl -0xb8(%rbp), %eax
cmpl -0xac(%rbp), %eax
jg 0x40f096
movq -0xa8(%rbp), %rax
movl -0xb4(%rbp), %ecx
addl -0xb8(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0xa8(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x40f047
movq -0xa8(%rbp), %rax
movslq -0xb0(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x40f0cd
cmpl $0x0, -0xb0(%rbp)
jle 0x40f0cd
movq -0xa8(%rbp), %rax
movl -0xb0(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x9c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movzwl 0x1c(%rax), %ecx
orl $0x2, %ecx
movw %cx, 0x1c(%rax)
movw $0x400, -0x9e(%rbp)     # imm = 0x400
jmp 0x40f10a
movzwl -0x9e(%rbp), %ecx
movq -0x18(%rbp), %rax
orl 0x40(%rax), %ecx
movl %ecx, 0x40(%rax)
jmp 0x40f10c
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x40eee6
jmp 0x40f122
jmp 0x40f124
jmp 0x40f126
movq -0x10(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x3c00a0
movl -0x5c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)