// File: /workspace/github_c_makefile_star2_O0/skeeto[P]flappy/sqlite3.c
// Function: sqlite3AddPrimaryKey
SQLITE_PRIVATE void sqlite3AddPrimaryKey(
  Parse *pParse,    /* Parsing context */
  ExprList *pList,  /* List of field names to be indexed */
  int onError,      /* What to do with a uniqueness conflict */
  int autoInc,      /* True if the AUTOINCREMENT keyword is present */
  int sortOrder     /* SQLITE_SO_ASC or SQLITE_SO_DESC */
){
  Table *pTab = pParse->pNewTable;
  char *zType = 0;
  int iCol = -1, i;
  int nTerm;
  if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit;
  if( pTab->tabFlags & TF_HasPrimaryKey ){
    sqlite3ErrorMsg(pParse, 
      "table \"%s\" has more than one primary key", pTab->zName);
    goto primary_key_exit;
  }
  pTab->tabFlags |= TF_HasPrimaryKey;
  if( pList==0 ){
    iCol = pTab->nCol - 1;
    pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY;
    zType = pTab->aCol[iCol].zType;
    nTerm = 1;
  }else{
    nTerm = pList->nExpr;
    for(i=0; i<nTerm; i++){
      for(iCol=0; iCol<pTab->nCol; iCol++){
        if( sqlite3StrICmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){
          pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY;
          zType = pTab->aCol[iCol].zType;
          break;
        }
      }
    }
  }
  if( nTerm==1
   && zType && sqlite3StrICmp(zType, "INTEGER")==0
   && sortOrder==SQLITE_SO_ASC
  ){
    pTab->iPKey = iCol;
    pTab->keyConf = (u8)onError;
    assert( autoInc==0 || autoInc==1 );
    pTab->tabFlags |= autoInc*TF_Autoincrement;
    if( pList ) pParse->iPkSortOrder = pList->a[0].sortOrder;
  }else if( autoInc ){
#ifndef SQLITE_OMIT_AUTOINCREMENT
    sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an "
       "INTEGER PRIMARY KEY");
#endif
  }else{
    Vdbe *v = pParse->pVdbe;
    Index *p;
    if( v ) pParse->addrSkipPK = sqlite3VdbeAddOp0(v, OP_Noop);
    p = sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0,
                           0, sortOrder, 0);
    if( p ){
      p->autoIndex = 2;
      if( v ) sqlite3VdbeJumpHere(v, pParse->addrSkipPK);
    }
    pList = 0;
  }

primary_key_exit:
  sqlite3ExprListDelete(pParse->db, pList);
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq 0x240(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, -0x28(%rbp)
je 0x553ef
movq -0x8(%rbp), %rax
movzbl 0x212(%rax), %eax
cmpl $0x0, %eax
je 0x553f4
jmp 0x55690
movq -0x28(%rbp), %rax
movzbl 0x48(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x55422
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x45a92(%rip), %rsi     # 0x9aea8
movb $0x0, %al
callq 0x16910
jmp 0x55690
movq -0x28(%rbp), %rax
movzbl 0x48(%rax), %ecx
orl $0x4, %ecx
movb %cl, 0x48(%rax)
cmpq $0x0, -0x10(%rbp)
jne 0x55489
movq -0x28(%rbp), %rax
movswl 0x42(%rax), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movzbl 0x2b(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x2b(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x55552
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x55550
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x28(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x55540
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0xf670
cmpl $0x0, %eax
jne 0x55530
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movzbl 0x2b(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x2b(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x55540
jmp 0x55532
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x554ac
jmp 0x55542
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x55499
jmp 0x55552
cmpl $0x1, -0x3c(%rbp)
jne 0x555c8
cmpq $0x0, -0x30(%rbp)
je 0x555c8
movq -0x30(%rbp), %rdi
leaq 0x457f4(%rip), %rsi     # 0x9ad5e
callq 0xf670
cmpl $0x0, %eax
jne 0x555c8
cmpl $0x0, -0x1c(%rbp)
jne 0x555c8
movl -0x34(%rbp), %eax
movw %ax, %cx
movq -0x28(%rbp), %rax
movw %cx, 0x40(%rax)
movl -0x14(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x49(%rax)
movl -0x18(%rbp), %edx
shll $0x3, %edx
movq -0x28(%rbp), %rax
movzbl 0x48(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x48(%rax)
cmpq $0x0, -0x10(%rbp)
je 0x555c3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movb 0x18(%rax), %cl
movq -0x8(%rbp), %rax
movb %cl, 0x210(%rax)
jmp 0x5568e
cmpl $0x0, -0x18(%rbp)
je 0x555e5
movq -0x8(%rbp), %rdi
leaq 0x458f8(%rip), %rsi     # 0x9aed1
movb $0x0, %al
callq 0x16910
jmp 0x5568c
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x55612
movq -0x48(%rbp), %rdi
movl $0x97, %esi
callq 0x63920
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1f4(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %r8
movl -0x14(%rbp), %r9d
movl -0x1c(%rbp), %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq %rcx, %rsi
movq %rcx, %rdx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
callq 0x556b0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x55684
movq -0x50(%rbp), %rax
movb 0x63(%rax), %cl
andb $-0x4, %cl
orb $0x2, %cl
movb %cl, 0x63(%rax)
cmpq $0x0, -0x48(%rbp)
je 0x55682
movq -0x48(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x1f4(%rax), %esi
callq 0x63950
jmp 0x55684
movq $0x0, -0x10(%rbp)
jmp 0x5568e
jmp 0x55690
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x4ba80
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)