// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/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;

  /* 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;
      }
    }
  }

  /* 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;
    pList->a[0].sortOrder = pParse->iPkSortOrder;
    assert( pParse->pNewTable==pTab );
    sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0,
                       SQLITE_IDXTYPE_PRIMARYKEY);
    if( db->mallocFailed || pParse->nErr ) return;
    pPk = sqlite3PrimaryKeyIndex(pTab);
    pTab->iPKey = -1;
  }else{
    pPk = sqlite3PrimaryKeyIndex(pTab);

    /*
    ** 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( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){
        pPk->nColumn--;
      }else{
        pPk->aiColumn[j++] = pPk->aiColumn[i];
      }
    }
    pPk->nKeyCol = j;
  }
  assert( pPk!=0 );
  pPk->isCovering = 1;
  if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
  nPk = pPk->nKeyCol;

  /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
  ** 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, 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( !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] = sqlite3StrBINARY;
        j++;
      }
    }
    assert( pPk->nColumn==j );
    assert( pTab->nCol==j );
  }else{
    pPk->nColumn = pTab->nCol;
  }
  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 0x4745fb
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x4745f9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movzbl 0x1b(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4745ec
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movb $0x2, 0x18(%rax)
jmp 0x4745ee
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x4745a7
jmp 0x4745fb
movq -0x8(%rbp), %rax
cmpl $0x0, 0xb0(%rax)
je 0x474620
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0xb0(%rax), %esi
movl $0x2, %edx
callq 0x46fab0
movq -0x10(%rbp), %rax
movswl 0x44(%rax), %eax
cmpl $0x0, %eax
jl 0x474725
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 0x475440
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movl $0x3b, %esi
leaq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0x460aa0
movq -0x68(%rbp), %rdi
movq %rax, %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x460810
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x474691
jmp 0x474a83
movq -0x8(%rbp), %rax
movb 0x10a(%rax), %cl
movq -0x48(%rbp), %rax
movb %cl, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %r8
movq -0x10(%rbp), %rax
movzbl 0x4c(%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 0x45c510
movq -0x38(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
jne 0x474704
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x474709
jmp 0x474a83
movq -0x10(%rbp), %rdi
callq 0x414850
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movw $0xffff, 0x44(%rax)     # imm = 0xFFFF
jmp 0x4747cb
movq -0x10(%rbp), %rdi
callq 0x414850
movq %rax, -0x20(%rbp)
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
movzwl 0x5e(%rcx), %ecx
cmpl %ecx, %eax
jge 0x4747bd
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x2c(%rbp), %esi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movswl (%rax,%rcx,2), %edx
callq 0x475480
cmpl $0x0, %eax
je 0x474786
movq -0x20(%rbp), %rax
movw 0x60(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x60(%rax)
jmp 0x4747b0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movw (%rax,%rcx,2), %dx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x2c(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x4747b2
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x474740
movl -0x2c(%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 0x474809
movq -0x20(%rbp), %rax
movw 0x63(%rax), %cx
andw $-0x9, %cx
orw $0x8, %cx
movw %cx, 0x63(%rax)
movq -0x20(%rbp), %rax
movzwl 0x5e(%rax), %eax
movl %eax, -0x24(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x47483a
movq -0x20(%rbp), %rax
cmpl $0x0, 0x58(%rax)
jle 0x47483a
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x58(%rax), %esi
movl $0xb, %edx
callq 0x4754d0
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 0x4749bf
movq -0x18(%rbp), %rax
movw 0x63(%rax), %ax
andw $0x3, %ax
movzwl %ax, %eax
cmpl $0x2, %eax
jne 0x474878
jmp 0x4749ae
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x4748ce
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 0x475480
cmpl $0x0, %eax
jne 0x4748c1
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x4748c3
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x474886
cmpl $0x0, -0x5c(%rbp)
jne 0x4748e9
movq -0x18(%rbp), %rax
movw 0x5e(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x60(%rax)
jmp 0x4749ae
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
movzwl 0x5e(%rax), %edx
addl -0x5c(%rbp), %edx
callq 0x475510
cmpl $0x0, %eax
je 0x47490b
jmp 0x474a83
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 0x4749ac
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 0x475480
cmpl $0x0, %eax
jne 0x47499c
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 0x47499e
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x47491d
jmp 0x4749ae
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x474854
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x474a6a
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rax
movswl 0x46(%rax), %edx
callq 0x475510
cmpl $0x0, %eax
je 0x4749f1
jmp 0x474a83
movl $0x0, -0x28(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x474a68
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x475480
cmpl $0x0, %eax
jne 0x474a5b
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 0x105907(%rip), %rdx    # 0x57a355
movq %rdx, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x474a5d
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x4749fe
jmp 0x474a7a
movq -0x10(%rbp), %rax
movw 0x46(%rax), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x60(%rax)
movq -0x20(%rbp), %rdi
callq 0x475640
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)