// File: /workspace/github_c_makefile_star2_O2/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), %r13
testq %r13, %r13
je 0x3e65a
cmpb $0x0, 0x1ee(%rbx)
jne 0x3e65a
movl %ecx, -0x3c(%rbp)
movl %r8d, -0x38(%rbp)
movl %edx, -0x34(%rbp)
movb 0x46(%r13), %al
testb $0x4, %al
jne 0x3e550
movq %rbx, -0x48(%rbp)
orb $0x4, %al
movb %al, 0x46(%r13)
testq %r14, %r14
je 0x3e573
movl (%r14), %eax
testl %eax, %eax
movl $0x0, %ebx
movl %eax, -0x54(%rbp)
cmovgl %eax, %ebx
pushq $-0x1
popq %rax
movq %rax, -0x30(%rbp)
xorl %r15d, %r15d
movq $0x0, -0x50(%rbp)
movq %r14, -0x68(%rbp)
movq %rbx, -0x60(%rbp)
cmpq %rbx, %r15
je 0x3e56a
movq 0x8(%r14), %rax
movq %r15, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rdi
callq 0x4cea1
movq %rax, %r12
movq %rax, %rdi
callq 0x52a95
cmpb $0x1b, (%r12)
jne 0x3e548
movq %r15, -0x70(%rbp)
movzwl 0x3e(%r13), %eax
testw %ax, %ax
movl $0x0, %ecx
cmovlel %ecx, %eax
movq 0x8(%r12), %r12
movzwl %ax, %eax
movq %rax, -0x30(%rbp)
pushq $0x2b
popq %r14
xorl %r15d, %r15d
cmpq %r15, -0x30(%rbp)
je 0x3e520
movq %r13, %rbx
movq 0x8(%r13), %r13
movq -0x2b(%r13,%r14), %rsi
movq %r12, %rdi
callq 0xa4f0
testl %eax, %eax
je 0x3e526
incq %r15
addq $0x30, %r14
movq %rbx, %r13
jmp 0x3e4f6
movq -0x68(%rbp), %r14
jmp 0x3e540
orb $0x1, (%r13,%r14)
movq -0x13(%r13,%r14), %rax
movq %rax, -0x50(%rbp)
movq %r15, -0x30(%rbp)
movq -0x68(%rbp), %r14
movq %rbx, %r13
movq -0x60(%rbp), %rbx
movq -0x70(%rbp), %r15
incq %r15
jmp 0x3e4a0
movq (%r13), %rdx
leaq 0x2fe58(%rip), %rsi     # 0x6e3b3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1357a
jmp 0x3e65a
cmpl $0x1, -0x54(%rbp)
sete %al
jmp 0x3e597
movswq 0x3e(%r13), %rdx
decq %rdx
movq 0x8(%r13), %rax
movq %rdx, -0x30(%rbp)
imulq $0x30, %rdx, %rcx
orb $0x1, 0x2b(%rax,%rcx)
movq 0x18(%rax,%rcx), %rax
movq %rax, -0x50(%rbp)
movb $0x1, %al
testb %al, %al
je 0x3e5ee
cmpq $0x0, -0x50(%rbp)
je 0x3e5ee
leaq 0x2dc12(%rip), %rsi     # 0x6c1bb
movq -0x50(%rbp), %rdi
callq 0xa4f0
cmpl $0x1, -0x38(%rbp)
je 0x3e5ee
testl %eax, %eax
jne 0x3e5ee
movl -0x3c(%rbp), %eax
shlb $0x3, %al
orb %al, 0x46(%r13)
movq -0x30(%rbp), %rax
movw %ax, 0x3c(%r13)
movl -0x34(%rbp), %eax
movb %al, 0x47(%r13)
testq %r14, %r14
je 0x3e653
movq 0x8(%r14), %rax
movb 0x18(%rax), %al
movq -0x48(%rbp), %rbx
movb %al, 0x1ec(%rbx)
jmp 0x3e65a
cmpl $0x0, -0x3c(%rbp)
je 0x3e60b
leaq 0x2fde1(%rip), %rsi     # 0x6e3dc
movq -0x48(%rbp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1357a
jmp 0x3e65a
movl -0x38(%rbp), %eax
movl %eax, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
andl $0x0, 0x18(%rsp)
movq -0x48(%rbp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
movl -0x34(%rbp), %r9d
callq 0x3e673
movl $0x0, %r14d
testq %rax, %rax
je 0x3e65a
movb 0x63(%rax), %cl
andb $-0x4, %cl
orb $0x2, %cl
movb %cl, 0x63(%rax)
xorl %r14d, %r14d
jmp 0x3e65a
xorl %r14d, %r14d
movq -0x48(%rbp), %rbx
movq (%rbx), %rdi
movq %r14, %rsi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x36862