// File: /workspace/github_c_makefile_star2_O1/shifengbin[P]bishe/Output/../Persistence/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++){
      Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr);
      assert( pCExpr!=0 );
      sqlite3StringToId(pCExpr);
      if( pCExpr->op==TK_ID ){
        const char *zCName = pCExpr->u.zToken;
        for(iCol=0; iCol<pTab->nCol; iCol++){
          if( sqlite3StrICmp(zCName, 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_DESC
  ){
    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{
    Index *p;
    p = sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0,
                           0, sortOrder, 0);
    if( p ){
      p->idxType = SQLITE_IDXTYPE_PRIMARYKEY;
    }
    pList = 0;
  }

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x220(%rdi), %r9
testq %r9, %r9
je 0x4424f
cmpb $0x0, 0x1ee(%rbx)
jne 0x4424f
movb 0x46(%r9), %al
testb $0x4, %al
jne 0x44102
orb $0x4, %al
movb %al, 0x46(%r9)
testq %r14, %r14
movq %r14, -0x40(%rbp)
movl %edx, -0x30(%rbp)
movl %r8d, -0x34(%rbp)
movl %ecx, -0x38(%rbp)
movb %al, -0x29(%rbp)
je 0x4411b
movslq (%r14), %rsi
testq %rsi, %rsi
jle 0x44144
movq %rbx, -0x60(%rbp)
movq 0x8(%r14), %rdi
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %ebx, %ebx
xorl %r8d, %r8d
movq %r9, -0x58(%rbp)
movq %rsi, -0x50(%rbp)
movq %rdi, -0x48(%rbp)
movq %rbx, %rax
shlq $0x5, %rax
movq (%rdi,%rax), %rax
testq %rax, %rax
je 0x4406d
movl 0x4(%rax), %ecx
btl $0xc, %ecx
jae 0x4406d
btl $0x12, %ecx
jb 0x44060
addq $0x10, %rax
jmp 0x44068
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
jmp 0x44046
movzbl (%rax), %edx
movq %rax, %rcx
cmpl $0x61, %edx
je 0x44086
cmpl $0x5f, %edx
jne 0x44089
movq 0x10(%rax), %rcx
cmpb $0x61, (%rcx)
jne 0x44089
movb $0x1b, (%rcx)
cmpb $0x1b, (%rax)
jne 0x440ea
movswq 0x3e(%r9), %r12
testq %r12, %r12
jle 0x440d1
movq %r8, -0x68(%rbp)
movq 0x8(%rax), %r15
movq 0x8(%r9), %r14
addq $0x2b, %r14
xorl %r13d, %r13d
movq -0x2b(%r14), %rsi
movq %r15, %rdi
callq 0xa3f0
testl %eax, %eax
je 0x440d6
incq %r13
addq $0x30, %r14
cmpq %r13, %r12
jne 0x440ab
movq -0x58(%rbp), %r9
movq -0x68(%rbp), %r8
jmp 0x440e2
xorl %r13d, %r13d
jmp 0x440ea
orb $0x1, (%r14)
movq -0x13(%r14), %r8
movq -0x58(%rbp), %r9
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdi
incq %rbx
cmpq %rsi, %rbx
jne 0x4403b
cmpl $0x1, %esi
sete %al
movq -0x60(%rbp), %rbx
jmp 0x4414f
movq (%r9), %rdx
leaq 0x3b2a7(%rip), %rsi     # 0x7f3b3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x14804
jmp 0x4424f
movswq 0x3e(%r9), %r13
decq %r13
movq 0x8(%r9), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
shlq $0x4, %rcx
orb $0x1, 0x2b(%rax,%rcx)
movq 0x18(%rax,%rcx), %r8
movb $0x1, %al
jmp 0x4414f
xorl %eax, %eax
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %r8d, %r8d
testb %al, %al
je 0x441ec
testq %r8, %r8
je 0x441ec
movb (%r8), %al
testb %al, %al
je 0x44197
incq %r8
leaq 0x3904a(%rip), %rcx     # 0x7d1bb
leaq 0x36198(%rip), %rdx     # 0x7a310
movzbl %al, %esi
movb (%rsi,%rdx), %sil
movzbl (%rcx), %edi
cmpb (%rdi,%rdx), %sil
jne 0x4419e
incq %rcx
movb (%r8), %al
incq %r8
testb %al, %al
jne 0x44178
jmp 0x4419e
leaq 0x3901d(%rip), %rcx     # 0x7d1bb
cmpl $0x1, -0x34(%rbp)
je 0x441ec
movzbl %al, %eax
leaq 0x36162(%rip), %rdx     # 0x7a310
movzbl (%rcx), %ecx
movb (%rcx,%rdx), %cl
cmpb %cl, (%rax,%rdx)
jne 0x441ec
movl -0x38(%rbp), %eax
shlb $0x3, %al
movb -0x29(%rbp), %cl
orb %al, %cl
movw %r13w, 0x3c(%r9)
movl -0x30(%rbp), %eax
movb %al, 0x47(%r9)
movb %cl, 0x46(%r9)
movq -0x40(%rbp), %r14
testq %r14, %r14
je 0x4424c
movq 0x8(%r14), %rax
movb 0x18(%rax), %al
movb %al, 0x1ec(%rbx)
jmp 0x4424f
cmpl $0x0, -0x38(%rbp)
je 0x44209
leaq 0x3b1e3(%rip), %rsi     # 0x7f3dc
movq %rbx, %rdi
xorl %eax, %eax
callq 0x14804
movq -0x40(%rbp), %r14
jmp 0x4424f
movl -0x34(%rbp), %eax
movl %eax, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movl $0x0, 0x18(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq -0x40(%rbp), %r8
movl -0x30(%rbp), %r9d
callq 0x44268
movl $0x0, %r14d
testq %rax, %rax
je 0x4424f
movb 0x63(%rax), %cl
andb $-0x4, %cl
orb $0x2, %cl
movb %cl, 0x63(%rax)
xorl %r14d, %r14d
movq (%rbx), %rdi
movq %r14, %rsi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3d971