// File: /workspace/github_c_makefile_star2_O3/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 $0x78, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x220(%rdi), %r10
testq %r10, %r10
je 0x43222
cmpb $0x0, 0x1ee(%rbx)
jne 0x43222
movb 0x46(%r10), %r12b
testb $0x4, %r12b
jne 0x430e9
movl %edx, %r9d
orb $0x4, %r12b
movb %r12b, 0x46(%r10)
testq %r14, %r14
je 0x43102
movslq (%r14), %rsi
testq %rsi, %rsi
jle 0x431cc
movb %r12b, -0x29(%rbp)
movl %ecx, -0x3c(%rbp)
movl %r8d, -0x40(%rbp)
movl %r9d, -0x44(%rbp)
movq %rbx, -0x78(%rbp)
movq %r14, -0x70(%rbp)
movq 0x8(%r14), %r8
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %r13d, %r13d
movq $0x0, -0x50(%rbp)
movq %r10, -0x68(%rbp)
movq %rsi, -0x60(%rbp)
movq %r8, -0x58(%rbp)
movq %r13, %rax
shlq $0x5, %rax
movq (%r8,%rax), %rax
testq %rax, %rax
je 0x43032
movl 0x4(%rax), %ecx
btl $0xc, %ecx
jae 0x43034
btl $0x12, %ecx
jb 0x43025
addq $0x10, %rax
jmp 0x4302d
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
jmp 0x4300b
xorl %eax, %eax
movzbl (%rax), %ecx
movq %rax, %rdx
cmpl $0x61, %ecx
je 0x4304d
cmpl $0x5f, %ecx
jne 0x43052
movq 0x10(%rax), %rdx
cmpb $0x61, (%rdx)
jne 0x430ba
movb $0x1b, (%rdx)
movb (%rax), %cl
cmpb $0x1b, %cl
jne 0x430ba
movswl 0x3e(%r10), %ecx
testl %ecx, %ecx
jle 0x4309c
movq 0x8(%rax), %r15
movq 0x8(%r10), %rbx
movq %rcx, -0x38(%rbp)
movl %ecx, %r12d
addq $0x2b, %rbx
xorl %r14d, %r14d
movq -0x2b(%rbx), %rsi
movq %r15, %rdi
callq 0xa400
testl %eax, %eax
je 0x430a0
incq %r14
addq $0x30, %rbx
cmpq %r14, %r12
jne 0x43076
movq -0x68(%rbp), %r10
movq -0x38(%rbp), %rdi
jmp 0x430b2
xorl %edi, %edi
jmp 0x430ba
orb $0x1, (%rbx)
movq -0x13(%rbx), %rax
movq %rax, -0x50(%rbp)
movl %r14d, %edi
movq -0x68(%rbp), %r10
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %r8
incq %r13
cmpq %rsi, %r13
jne 0x43000
cmpl $0x1, %esi
sete %al
movq -0x78(%rbp), %rbx
movq -0x70(%rbp), %r14
movl -0x44(%rbp), %r9d
movl -0x40(%rbp), %r8d
movl -0x3c(%rbp), %ecx
movb -0x29(%rbp), %r12b
movq -0x50(%rbp), %rdx
jmp 0x43122
movq (%r10), %rdx
leaq 0x3a2d0(%rip), %rsi     # 0x7d3c3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x14890
jmp 0x43222
movswq 0x3e(%r10), %rdi
decq %rdi
movq 0x8(%r10), %rax
leaq (%rdi,%rdi,2), %rdx
shlq $0x4, %rdx
orb $0x1, 0x2b(%rax,%rdx)
movq 0x18(%rax,%rdx), %rdx
movb $0x1, %al
testb %al, %al
je 0x431cc
testq %rdx, %rdx
je 0x431cc
movb (%rdx), %sil
testb %sil, %sil
je 0x43179
movq %rdx, %r13
movq %rdi, -0x38(%rbp)
incq %r13
leaq 0x3807f(%rip), %rax     # 0x7b1cb
leaq 0x3520d(%rip), %rdx     # 0x78360
xorl %r15d, %r15d
movzbl %sil, %esi
movb (%rsi,%rdx), %dil
movzbl (%rax), %r11d
cmpb (%r11,%rdx), %dil
jne 0x43185
incq %rax
movb (%r13), %sil
incq %r13
testb %sil, %sil
jne 0x43156
jmp 0x43188
leaq 0x3804b(%rip), %rax     # 0x7b1cb
xorl %r15d, %r15d
jmp 0x4318c
movq %rsi, %r15
movq -0x38(%rbp), %rdi
cmpl $0x1, %r8d
je 0x431cc
leaq 0x351c7(%rip), %rdx     # 0x78360
movzbl (%rax), %eax
movb (%rax,%rdx), %al
cmpb %al, (%r15,%rdx)
jne 0x431cc
shlb $0x3, %cl
orb %cl, %r12b
movw %di, 0x3c(%r10)
movb %r9b, 0x47(%r10)
movb %r12b, 0x46(%r10)
testq %r14, %r14
je 0x4321f
movq 0x8(%r14), %rax
movb 0x18(%rax), %al
movb %al, 0x1ec(%rbx)
jmp 0x43222
testl %ecx, %ecx
je 0x431e3
leaq 0x3a215(%rip), %rsi     # 0x7d3ec
movq %rbx, %rdi
xorl %eax, %eax
callq 0x14890
jmp 0x43222
movl %r8d, 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 %r14, %r8
callq 0x4323b
movl $0x0, %r14d
testq %rax, %rax
je 0x43222
movb 0x63(%rax), %cl
andb $-0x4, %cl
orb $0x2, %cl
movb %cl, 0x63(%rax)
xorl %r14d, %r14d
movq (%rbx), %rdi
movq %r14, %rsi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3c97e