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

  /* Convert the OP_CreateTable opcode that would normally create the
  ** root-page for the table into a OP_CreateIndex opcode.  The index
  ** created will become the PRIMARY KEY index.
  */
  if( pParse->addrCrTab ){
    assert( v );
    sqlite3VdbeGetOp(v, pParse->addrCrTab)->opcode = OP_CreateIndex;
  }

  /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
  ** table entry.
  */
  if( pParse->addrSkipPK ){
    assert( v );
    sqlite3VdbeGetOp(v, pParse->addrSkipPK)->opcode = OP_Goto;
  }

  /* 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;
    pList = sqlite3ExprListAppend(pParse, 0, 0);
    if( pList==0 ) return;
    pList->a[0].zName = sqlite3DbStrDup(pParse->db,
                                        pTab->aCol[pTab->iPKey].zName);
    pList->a[0].sortOrder = pParse->iPkSortOrder;
    assert( pParse->pNewTable==pTab );
    pPk = sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0);
    if( pPk==0 ) return;
    pPk->autoIndex = 2;
    pTab->iPKey = -1;
  }else{
    pPk = sqlite3PrimaryKeyIndex(pTab);
  }
  pPk->isCovering = 1;
  assert( pPk!=0 );
  nPk = pPk->nKeyCol;

  /* Make sure every column of the PRIMARY KEY is NOT NULL */
  for(i=0; i<nPk; i++){
    pTab->aCol[pPk->aiColumn[i]].notNull = 1;
  }
  pPk->uniqNotNull = 1;

  /* 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( pIdx->autoIndex==2 ) continue;
    for(i=n=0; i<nPk; i++){
      if( !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( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){
        pIdx->aiColumn[j] = pPk->aiColumn[i];
        pIdx->azColl[j] = pPk->azColl[i];
        j++;
      }
    }
    assert( pIdx->nColumn>=pIdx->nKeyCol+n );
    assert( pIdx->nColumn>=j );
  }

  /* Add all table columns to the PRIMARY KEY index
  */
  if( nPk<pTab->nCol ){
    if( resizeIndexObject(db, pPk, pTab->nCol) ) return;
    for(i=0, j=nPk; i<pTab->nCol; i++){
      if( !hasColumn(pPk->aiColumn, j, i) ){
        assert( j<pPk->nColumn );
        pPk->aiColumn[j] = i;
        pPk->azColl[j] = "BINARY";
        j++;
      }
    }
    assert( pPk->nColumn==j );
    assert( pTab->nCol==j );
  }else{
    pPk->nColumn = pTab->nCol;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %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 -0x8(%rbp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x6ae5a
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x1f0(%rax), %esi
callq 0x6bac0
movb $0x70, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1f4(%rax)
je 0x6ae7d
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x1f4(%rax), %esi
callq 0x6bac0
movb $0x10, (%rax)
movq -0x10(%rbp), %rax
movswl 0x40(%rax), %eax
cmpl $0x0, %eax
jl 0x6af68
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x591a0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x6aeae
jmp 0x6b21b
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movswq 0x40(%rcx), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x147b0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movb 0x210(%rax), %cl
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movb %cl, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %r8
movq -0x10(%rbp), %rax
movzbl 0x49(%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)
callq 0x556b0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x6af4c
jmp 0x6b21b
movq -0x20(%rbp), %rax
movb 0x63(%rax), %cl
andb $-0x4, %cl
orb $0x2, %cl
movb %cl, 0x63(%rax)
movq -0x10(%rbp), %rax
movw $0xffff, 0x40(%rax)     # imm = 0xFFFF
jmp 0x6af75
movq -0x10(%rbp), %rdi
callq 0x4b190
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb 0x63(%rax), %cl
andb $-0x21, %cl
orb $0x20, %cl
movb %cl, 0x63(%rax)
movq -0x20(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x6afce
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x28(%rbp), %rdx
movswq (%rcx,%rdx,2), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movb $0x1, 0x28(%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x6af97
movq -0x20(%rbp), %rax
movb 0x63(%rax), %cl
andb $-0x9, %cl
orb $0x8, %cl
movb %cl, 0x63(%rax)
movq -0x10(%rbp), %rax
movl 0x3c(%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 0x6b160
movq -0x18(%rbp), %rax
movb 0x63(%rax), %al
andb $0x3, %al
movzbl %al, %eax
cmpl $0x2, %eax
jne 0x6b019
jmp 0x6b14f
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x6b06f
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %esi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movswl (%rax,%rcx,2), %edx
callq 0x6bb20
cmpl $0x0, %eax
jne 0x6b062
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x6b064
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x6b027
cmpl $0x0, -0x4c(%rbp)
jne 0x6b08a
movq -0x18(%rbp), %rax
movw 0x5e(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x60(%rax)
jmp 0x6b14f
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %edx
addl -0x4c(%rbp), %edx
callq 0x6bb70
cmpl $0x0, %eax
je 0x6b0ac
jmp 0x6b21b
movl $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x6b14d
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %esi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movswl (%rax,%rcx,2), %edx
callq 0x6bb20
cmpl $0x0, %eax
jne 0x6b13d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movw (%rax,%rcx,2), %dx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x6b13f
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x6b0be
jmp 0x6b14f
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x6aff8
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x6b20b
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rax
movswl 0x42(%rax), %edx
callq 0x6bb70
cmpl $0x0, %eax
je 0x6b192
jmp 0x6b21b
movl $0x0, -0x28(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x6b209
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x6bb20
cmpl $0x0, %eax
jne 0x6b1fc
movl -0x28(%rbp), %eax
movw %ax, %dx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x2c(%rbp), %rcx
leaq 0x2e3f6(%rip), %rdx     # 0x995e5
movq %rdx, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x6b1fe
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x6b19f
jmp 0x6b21b
movq -0x10(%rbp), %rax
movw 0x42(%rax), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x60(%rax)
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)