// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: convertToWithoutRowidTable
static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
  Index *pIdx;
  Index *pPk;
  int nPk;
  int nExtra;
  int i, j;
  sqlite3 *db = pParse->db;
  Vdbe *v = pParse->pVdbe;

  /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables)
  */
  if( !db->init.imposterTable ){
    for(i=0; i<pTab->nCol; i++){
      if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){
        pTab->aCol[i].notNull = OE_Abort;
      }
    }
    pTab->tabFlags |= TF_HasNotNull;
  }

  /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY
  ** into BTREE_BLOBKEY.
  */
  if( pParse->addrCrTab ){
    assert( v );
    sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY);
  }

  /* Locate the PRIMARY KEY index.  Or, if this table was originally
  ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index.
  */
  if( pTab->iPKey>=0 ){
    ExprList *pList;
    Token ipkToken;
    sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName);
    pList = sqlite3ExprListAppend(pParse, 0,
                  sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0));
    if( pList==0 ) return;
    if( IN_RENAME_OBJECT ){
      sqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey);
    }
    pList->a[0].sortFlags = pParse->iPkSortOrder;
    assert( pParse->pNewTable==pTab );
    pTab->iPKey = -1;
    sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0,
                       SQLITE_IDXTYPE_PRIMARYKEY);
    if( db->mallocFailed || pParse->nErr ) return;
    pPk = sqlite3PrimaryKeyIndex(pTab);
    assert( pPk->nKeyCol==1 );
  }else{
    pPk = sqlite3PrimaryKeyIndex(pTab);
    assert( pPk!=0 );

    /*
    ** Remove all redundant columns from the PRIMARY KEY.  For example, change
    ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)".  Later
    ** code assumes the PRIMARY KEY contains no repeated columns.
    */
    for(i=j=1; i<pPk->nKeyCol; i++){
      if( isDupColumn(pPk, j, pPk, i) ){
        pPk->nColumn--;
      }else{
        testcase( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) );
        pPk->azColl[j] = pPk->azColl[i];
        pPk->aSortOrder[j] = pPk->aSortOrder[i];
        pPk->aiColumn[j++] = pPk->aiColumn[i];
      }
    }
    pPk->nKeyCol = j;
  }
  assert( pPk!=0 );
  pPk->isCovering = 1;
  if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
  nPk = pPk->nColumn = pPk->nKeyCol;

  /* Bypass the creation of the PRIMARY KEY btree and the sqlite_schema
  ** table entry. This is only required if currently generating VDBE
  ** code for a CREATE TABLE (not when parsing one as part of reading
  ** a database schema).  */
  if( v && pPk->tnum>0 ){
    assert( db->init.busy==0 );
    sqlite3VdbeChangeOpcode(v, (int)pPk->tnum, OP_Goto);
  }

  /* The root page of the PRIMARY KEY is the table root page */
  pPk->tnum = pTab->tnum;

  /* Update the in-memory representation of all UNIQUE indices by converting
  ** the final rowid column into one or more columns of the PRIMARY KEY.
  */
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    int n;
    if( IsPrimaryKeyIndex(pIdx) ) continue;
    for(i=n=0; i<nPk; i++){
      if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
        testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
        n++;
      }
    }
    if( n==0 ){
      /* This index is a superset of the primary key */
      pIdx->nColumn = pIdx->nKeyCol;
      continue;
    }
    if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;
    for(i=0, j=pIdx->nKeyCol; i<nPk; i++){
      if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
        testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
        pIdx->aiColumn[j] = pPk->aiColumn[i];
        pIdx->azColl[j] = pPk->azColl[i];
        if( pPk->aSortOrder[i] ){
          /* See ticket https://www.sqlite.org/src/info/bba7b69f9849b5bf */
          pIdx->bAscKeyBug = 1;
        }
        j++;
      }
    }
    assert( pIdx->nColumn>=pIdx->nKeyCol+n );
    assert( pIdx->nColumn>=j );
  }

  /* Add all table columns to the PRIMARY KEY index
  */
  nExtra = 0;
  for(i=0; i<pTab->nCol; i++){
    if( !hasColumn(pPk->aiColumn, nPk, i)
     && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ) nExtra++;
  }
  if( resizeIndexObject(db, pPk, nPk+nExtra) ) return;
  for(i=0, j=nPk; i<pTab->nCol; i++){
    if( !hasColumn(pPk->aiColumn, j, i)
     && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0
    ){
      assert( j<pPk->nColumn );
      pPk->aiColumn[j] = i;
      pPk->azColl[j] = sqlite3StrBINARY;
      j++;
    }
  }
  assert( pPk->nColumn==j );
  assert( pTab->nNVCol<=j );
  recomputeColumnsNotIndexed(pPk);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movb 0xb6(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x433fd9
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x433fc9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movzwl 0x1c(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x433fbc
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movb $0x2, 0x18(%rax)
jmp 0x433fbe
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x433f77
movq -0x10(%rbp), %rax
movl 0x40(%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movl %ecx, 0x40(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0xc0(%rax)
je 0x433ffe
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0xc0(%rax), %esi
movl $0x2, %edx
callq 0x42deb0
movq -0x10(%rbp), %rax
movswl 0x44(%rax), %eax
cmpl $0x0, %eax
jl 0x43412c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movswq 0x44(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rsi
leaq -0x58(%rbp), %rdi
callq 0x434fd0
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movl $0x3b, %esi
leaq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0x41d660
movq -0x68(%rbp), %rdi
movq %rax, %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x41d3c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x43406f
jmp 0x434540
movq -0x8(%rbp), %rax
movzbl 0x11c(%rax), %eax
cmpl $0x2, %eax
jl 0x434098
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rdx
addq $0x44, %rdx
callq 0x435010
movq -0x8(%rbp), %rax
movb 0x11a(%rax), %cl
movq -0x48(%rbp), %rax
movb %cl, 0x18(%rax)
movq -0x10(%rbp), %rax
movw $0xffff, 0x44(%rax)     # imm = 0xFFFF
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %r8
movq -0x10(%rbp), %rax
movzbl 0x4e(%rax), %r9d
xorl %eax, %eax
movl %eax, %ecx
xorl %eax, %eax
movq %rcx, %rsi
movq %rcx, %rdx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x2, 0x20(%rsp)
callq 0x418bb0
movq -0x38(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
jne 0x434115
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x43411a
jmp 0x434540
movq -0x10(%rbp), %rdi
callq 0x3cef20
movq %rax, -0x20(%rbp)
jmp 0x43420a
movq -0x10(%rbp), %rdi
callq 0x3cef20
movq %rax, -0x20(%rbp)
movl $0x1, -0x30(%rbp)
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
cmpl %ecx, %eax
jge 0x4341fc
movq -0x20(%rbp), %rdi
movl -0x30(%rbp), %esi
movq -0x20(%rbp), %rdx
movl -0x2c(%rbp), %ecx
callq 0x435070
cmpl $0x0, %eax
je 0x434184
movq -0x20(%rbp), %rax
movw 0x60(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x60(%rax)
jmp 0x4341ec
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x30(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movw (%rax,%rcx,2), %dx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x4341ee
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x434147
movl -0x30(%rbp), %eax
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, 0x5e(%rax)
movq -0x20(%rbp), %rax
movw 0x63(%rax), %cx
andw $-0x21, %cx
orw $0x20, %cx
movw %cx, 0x63(%rax)
movq -0x38(%rbp), %rax
movb 0xb6(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x434248
movq -0x20(%rbp), %rax
movw 0x63(%rax), %cx
andw $-0x9, %cx
orw $0x8, %cx
movw %cx, 0x63(%rax)
movq -0x20(%rbp), %rax
movw 0x5e(%rax), %ax
movq -0x20(%rbp), %rcx
movw %ax, 0x60(%rcx)
movzwl %ax, %eax
movl %eax, -0x24(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x434284
movq -0x20(%rbp), %rax
cmpl $0x0, 0x58(%rax)
jbe 0x434284
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x58(%rax), %esi
movl $0xb, %edx
callq 0x435110
movq -0x10(%rbp), %rax
movl 0x38(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x58(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x434417
movq -0x18(%rbp), %rax
movw 0x63(%rax), %ax
andw $0x3, %ax
movzwl %ax, %eax
cmpl $0x2, %eax
jne 0x4342c2
jmp 0x434406
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x43430b
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %esi
movq -0x20(%rbp), %rdx
movl -0x2c(%rbp), %ecx
callq 0x435070
cmpl $0x0, %eax
jne 0x4342fe
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x434300
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4342d0
cmpl $0x0, -0x5c(%rbp)
jne 0x434326
movq -0x18(%rbp), %rax
movw 0x5e(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x60(%rax)
jmp 0x434406
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %edx
addl -0x5c(%rbp), %edx
callq 0x435150
cmpl $0x0, %eax
je 0x434348
jmp 0x434540
movl $0x0, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x434404
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %esi
movq -0x20(%rbp), %rdx
movl -0x2c(%rbp), %ecx
callq 0x435070
cmpl $0x0, %eax
jne 0x4343f4
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movw (%rax,%rcx,2), %dx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x2c(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x4343eb
movq -0x18(%rbp), %rax
movw 0x63(%rax), %cx
andw $0xfdff, %cx            # imm = 0xFDFF
orw $0x200, %cx             # imm = 0x200
movw %cx, 0x63(%rax)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x4343f6
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x43435a
jmp 0x434406
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x43429e
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x434481
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x24(%rbp), %esi
movl -0x2c(%rbp), %edx
callq 0x435280
cmpl $0x0, %eax
jne 0x434474
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movzwl 0x1c(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x434474
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x434476
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x434425
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
addl -0x28(%rbp), %edx
callq 0x435150
cmpl $0x0, %eax
je 0x43449e
jmp 0x434540
movl $0x0, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x434537
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
callq 0x435280
cmpl $0x0, %eax
jne 0x434527
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movzwl 0x1c(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x434527
movl -0x2c(%rbp), %eax
movw %ax, %dx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x30(%rbp), %rcx
leaq 0x1727bb(%rip), %rdx    # 0x5a6cd5
movq %rdx, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x434529
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4344ab
movq -0x20(%rbp), %rdi
callq 0x4352d0
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)