// File: Konano[P]UselessDatabase/Table.cpp
// Function: Table::createPrimaryKey(PrimaryKey*)
int Table::createPrimaryKey(PrimaryKey* pk) {
    if (p_key) return -1;
    if (constraintKey(pk)) return -2;
    p_key = new PrimaryKey(this);
    p_key->v_size = pk->v_size;
    p_key->name = pk->name;
    p_key->v.clear();
    for (auto i: pk->v)p_key->v.push_back(i);
    p_key->table = pk->table;
    updateColumns();
    if (p_key_index != -1) removeIndex(p_key_index);
    p_key_index = createIndex(p_key->v, "pk");
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, 0x758(%rax)
je 0x4ca94
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4ccd9
movq -0x90(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4ccf0
cmpl $0x0, %eax
je 0x4cab5
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x4ccd9
movl $0x68, %edi
callq 0x64a0
movq -0x90(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x98(%rbp)
callq 0x52d40
jmp 0x4cada
movq -0x90(%rbp), %rax
movq -0x98(%rbp), %rcx
movq %rcx, 0x758(%rax)
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %edx
movq 0x758(%rax), %rcx
movl %edx, 0x8(%rcx)
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
movq 0x758(%rax), %rdi
addq $0x10, %rdi
callq 0x6070
movq -0x90(%rbp), %rax
movq 0x758(%rax), %rdi
addq $0x30, %rdi
callq 0x3d020
movq -0x18(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x3d210
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x3d240
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3d270
testb $0x1, %al
jne 0x4cb68
jmp 0x4cbc1
leaq -0x38(%rbp), %rdi
callq 0x3d2b0
movq %rax, %rcx
movq -0x90(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x44(%rbp)
movq 0x758(%rax), %rdi
addq $0x30, %rdi
leaq -0x44(%rbp), %rsi
callq 0x3d2d0
leaq -0x38(%rbp), %rdi
callq 0x3d3b0
jmp 0x4cb55
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x68, %esi
callq 0x64b0
jmp 0x4cce5
movq -0x90(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rcx
movq 0x758(%rdi), %rax
movq %rcx, 0x48(%rax)
callq 0x48f70
movq -0x90(%rbp), %rax
cmpl $-0x1, 0x778(%rax)
je 0x4cc02
movq -0x90(%rbp), %rdi
movl 0x778(%rdi), %esi
callq 0x49120
movq -0x90(%rbp), %rax
movq 0x758(%rax), %rsi
addq $0x30, %rsi
leaq -0x60(%rbp), %rdi
callq 0x3d100
leaq -0x81(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x68a0
movq -0xa0(%rbp), %rdx
leaq 0x36fdd(%rip), %rsi     # 0x83c1b
leaq -0x80(%rbp), %rdi
callq 0xc020
jmp 0x4cc49
movq -0x90(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x491c0
movl %eax, -0xa4(%rbp)
jmp 0x4cc65
movq -0x90(%rbp), %rax
movl -0xa4(%rbp), %ecx
movl %ecx, 0x778(%rax)
leaq -0x80(%rbp), %rdi
callq 0x6340
leaq -0x81(%rbp), %rdi
callq 0x6530
leaq -0x60(%rbp), %rdi
callq 0xee40
movl $0x0, -0x4(%rbp)
jmp 0x4ccd9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x4ccc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x6340
leaq -0x81(%rbp), %rdi
callq 0x6530
leaq -0x60(%rbp), %rdi
callq 0xee40
jmp 0x4cce5
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x6890
nop