// File: /workspace/github_c_makefile_star2_O0/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
subq $0x80, %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 0x220(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, -0x28(%rbp)
je 0x5d332
movq -0x8(%rbp), %rax
movzbl 0x1ee(%rax), %eax
cmpl $0x0, %eax
je 0x5d337
jmp 0x5d5b0
movq -0x28(%rbp), %rax
movzbl 0x46(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x5d365
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x4a9a8(%rip), %rsi     # 0xa7d01
movb $0x0, %al
callq 0x17840
jmp 0x5d5b0
movq -0x28(%rbp), %rax
movzbl 0x46(%rax), %ecx
orl $0x4, %ecx
movb %cl, 0x46(%rax)
cmpq $0x0, -0x10(%rbp)
jne 0x5d3cc
movq -0x28(%rbp), %rax
movswl 0x3e(%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 0x5d4c1
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x5d4bf
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x70830
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x7aaa0
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1b, %eax
jne 0x5d4af
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x28(%rbp), %rcx
movswl 0x3e(%rcx), %ecx
cmpl %ecx, %eax
jge 0x5d4ad
movq -0x50(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0xb5c0
cmpl $0x0, %eax
jne 0x5d4a0
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 0x5d4ad
jmp 0x5d4a2
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x5d433
jmp 0x5d4af
jmp 0x5d4b1
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5d3dc
jmp 0x5d4c1
cmpl $0x1, -0x3c(%rbp)
jne 0x5d534
cmpq $0x0, -0x30(%rbp)
je 0x5d534
movq -0x30(%rbp), %rdi
leaq 0x48622(%rip), %rsi     # 0xa5afb
callq 0xb5c0
cmpl $0x0, %eax
jne 0x5d534
cmpl $0x1, -0x1c(%rbp)
je 0x5d534
movl -0x34(%rbp), %eax
movw %ax, %cx
movq -0x28(%rbp), %rax
movw %cx, 0x3c(%rax)
movl -0x14(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x47(%rax)
movl -0x18(%rbp), %edx
shll $0x3, %edx
movq -0x28(%rbp), %rax
movzbl 0x46(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x46(%rax)
cmpq $0x0, -0x10(%rbp)
je 0x5d532
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movb 0x18(%rax), %cl
movq -0x8(%rbp), %rax
movb %cl, 0x1ec(%rax)
jmp 0x5d5ae
cmpl $0x0, -0x18(%rbp)
je 0x5d54e
movq -0x8(%rbp), %rdi
leaq 0x4a7e5(%rip), %rsi     # 0xa7d2a
movb $0x0, %al
callq 0x17840
jmp 0x5d5ac
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 0x5d5d0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x5d5a4
movq -0x58(%rbp), %rax
movb 0x63(%rax), %cl
andb $-0x4, %cl
orb $0x2, %cl
movb %cl, 0x63(%rax)
movq $0x0, -0x10(%rbp)
jmp 0x5d5ae
jmp 0x5d5b0
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x53790
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)