// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/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 = sqlite3MPrintf(db, "%s", pTab->zName);
  if( !zModuleName ){
    return SQLITE_NOMEM;
  }

  pVTable = sqlite3DbMallocZero(db, sizeof(VTable));
  if( !pVTable ){
    sqlite3DbFree(db, zModuleName);
    return SQLITE_NOMEM;
  }
  pVTable->db = db;
  pVTable->pMod = pMod;

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

  /* 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 ) db->mallocFailed = 1;
  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;
    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;
      u8 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 = pTab->aCol[iCol].zType;
        int nType;
        int i = 0;
        if( !zType ){
          pTab->tabFlags |= oooHidden;
          continue;
        }
        nType = sqlite3Strlen30(zType);
        if( sqlite3StrNICmp("hidden", zType, 6)||(zType[6] && zType[6]!=' ') ){
          for(i=0; i<nType; i++){
            if( (0==sqlite3StrNICmp(" hidden", &zType[i], 7))
             && (zType[i+7]=='\0' || zType[i+7]==' ')
            ){
              i++;
              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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %r13
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x50(%rsi), %rsi
movl 0x4c(%r15), %edi
andq $0x0, -0x60(%rbp)
leaq 0x1c0(%rbx), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x37c55
leaq 0x10(%rcx), %rax
cmpq %r15, 0x8(%rcx)
jne 0x37c22
movq (%r15), %rdx
leaq 0x359a8(%rip), %rsi     # 0x6d5e6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13638
movq %rax, (%r13)
pushq $0x6
popq %r14
jmp 0x37f1d
movl %edi, -0x38(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdx, -0x40(%rbp)
movq (%r15), %rdx
leaq 0x34719(%rip), %rsi     # 0x6c383
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13638
pushq $0x7
popq %r12
testq %rax, %rax
je 0x37d7f
movq %rax, -0x50(%rbp)
pushq $0x30
popq %rsi
movq %rbx, %rdi
callq 0x12153
testq %rax, %rax
je 0x37d73
movq %r13, -0x68(%rbp)
movq %rbx, (%rax)
movq %r14, -0x58(%rbp)
movq -0x40(%rbp), %r14
movq %r14, 0x8(%rax)
movq %rax, %r13
movq 0x68(%r15), %rsi
movq %rbx, %rdi
callq 0x136fb
movq 0x20(%rbx), %rcx
cltq
shlq $0x5, %rax
movq (%rcx,%rax), %rax
movq 0x50(%r15), %rcx
movq %rax, 0x8(%rcx)
leaq -0x88(%rbp), %r12
movq %r15, 0x8(%r12)
movq %r13, (%r12)
movq 0x1c0(%rbx), %rax
movq %rax, 0x10(%r12)
andl $0x0, 0x18(%r12)
movq %r12, 0x1c0(%rbx)
movq 0x10(%r14), %rsi
movq %r13, -0x48(%rbp)
addq $0x10, %r13
leaq -0x60(%rbp), %r9
movq %rbx, %rdi
movl -0x38(%rbp), %edx
movq -0x30(%rbp), %rcx
movq %r13, %r8
callq *-0x58(%rbp)
movl %eax, %r14d
movq 0x10(%r12), %rax
movq %rbx, -0x30(%rbp)
movq %rax, 0x1c0(%rbx)
testl %r14d, %r14d
je 0x37d87
cmpl $0x7, %r14d
movq -0x30(%rbp), %rbx
movq -0x68(%rbp), %r15
jne 0x37d44
movb $0x1, 0x51(%rbx)
movq -0x60(%rbp), %rdx
testq %rdx, %rdx
je 0x37eed
leaq 0x3462b(%rip), %rsi     # 0x6c383
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13638
movq %rax, (%r15)
movq -0x60(%rbp), %rdi
callq 0xa828
jmp 0x37f05
movq %rbx, %rdi
movq -0x50(%rbp), %rsi
callq 0xb856
movq %r12, %r14
jmp 0x37f1d
movq (%r13), %rax
testq %rax, %rax
je 0x37f34
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %r14
movq 0x10(%r14), %rcx
movq %rax, (%rcx)
movl $0x1, 0x18(%r14)
cmpl $0x0, -0x70(%rbp)
movq -0x30(%rbp), %rbx
je 0x37f3d
movq 0x58(%r15), %rax
movq %rax, 0x28(%r14)
movq %r14, 0x58(%r15)
pushq $0x7
popq %r14
xorl %ecx, %ecx
movq $0x0, -0x38(%rbp)
movswq 0x3e(%r15), %rax
cmpq %rax, %rcx
jge 0x37f2f
movq 0x8(%r15), %rax
imulq $0x30, %rcx, %rdx
movq 0x18(%rax,%rdx), %r12
testq %r12, %r12
je 0x37e5c
movq %rdx, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
movq %r12, %rdi
callq 0xb080
movl %eax, %ebx
leaq 0x35843(%rip), %rdi     # 0x6d65d
movq %r12, %rsi
pushq $0x6
popq %rdx
callq 0xa730
movl %ebx, -0x58(%rbp)
movl %ebx, %ebx
testl %eax, %eax
je 0x37e66
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0x37eab
leaq (%r12,%r13), %rsi
leaq 0x3581b(%rip), %rdi     # 0x6d65c
movl %r14d, %edx
callq 0xa730
testl %eax, %eax
jne 0x37e57
movzbl 0x7(%r12,%r13), %eax
testb $-0x21, %al
je 0x37e75
incq %r13
jmp 0x37e31
movq -0x38(%rbp), %rax
orb %al, 0x46(%r15)
jmp 0x37ee5
movzbl 0x6(%r12), %eax
xorl %r13d, %r13d
testb $-0x21, %al
je 0x37e78
jmp 0x37e2e
incl %r13d
cmpl -0x58(%rbp), %r13d
jge 0x37eab
movslq %r13d, %rax
cmpb $0x1, 0x6(%r12,%rax)
pushq $0x7
popq %rcx
sbbq $0x0, %rcx
leaq (%r12,%rcx), %rdx
movq %rax, %rsi
leaq (%rcx,%rsi), %rdi
cmpq %rbx, %rdi
ja 0x37eb5
movb (%rdx,%rsi), %dil
movb %dil, (%r12,%rsi)
incq %rsi
jmp 0x37e95
movq -0x38(%rbp), %rax
orb %al, 0x46(%r15)
jmp 0x37edd
testl %r13d, %r13d
jle 0x37eca
cmpb $0x0, (%r12,%rax)
jne 0x37eca
movl %r13d, %eax
movb $0x0, -0x1(%r12,%rax)
movq 0x8(%r15), %rax
movq -0x48(%rbp), %rcx
orb $0x2, 0x2b(%rax,%rcx)
movb $-0x80, %al
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rbx
movq -0x40(%rbp), %rcx
incq %rcx
jmp 0x37de1
leaq 0x3571c(%rip), %rsi     # 0x6d610
movq %rbx, %rdi
movq -0x50(%rbp), %rdx
xorl %eax, %eax
callq 0x13638
movq %rax, (%r15)
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0xb856
movq %rbx, %rdi
movq -0x50(%rbp), %rsi
callq 0xb856
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
jmp 0x37f11
xorl %r14d, %r14d
movq -0x30(%rbp), %rbx
jmp 0x37f11
movq (%r15), %rdx
leaq 0x356e7(%rip), %rsi     # 0x6d62e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13638
movq -0x68(%rbp), %rcx
movq %rax, (%rcx)
movq %r14, %rdi
callq 0x24d3d
pushq $0x1
popq %r14
jmp 0x37f11