// File: /workspace/github_cpp_makefile_star2_O1/zimpha[P]MiniSQL/API.cc
// Function: API::createTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<AttrType, std::allocator<AttrType>>&, int)
Response API::createTable(const std::string &tableName, std::vector<AttrType> &data, int pk) {
    if (cm.hasTable(tableName + ".table")) {
        return Response("This table already exists");
    }
    
    Table nt = cm.createTable(tableName + ".table", data);
    nt.attributes[pk].unique = true;
    nt.write();

    std::string dbName = tableName + ".db";
    // Record Manager creat database
    // 传入数据库文件名(dbName)
    rm.RecordManagerTableCreate(dbName);

    return createIndex(tableName + ".PrimaryKeyDefault", tableName, nt.attributes[pk].name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r8d, -0x34(%rbp)
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, -0x30(%rbp)
leaq -0xb0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rbx
movq %rbx, %rdi
callq 0x8766
leaq 0xf9a0(%rip), %rsi      # 0x14051
movq %rbx, %rdi
callq 0x34f0
leaq -0xc0(%rbp), %rsi
movq %r15, %rdi
callq 0xdd18
movl %eax, %ebx
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x46db
callq 0x3270
testb %bl, %bl
je 0x473c
leaq -0xf0(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xfa53(%rip), %rsi      # 0x14144
leaq 0xfa65(%rip), %rdx      # 0x1415d
leaq -0x100(%rbp), %rbx
movq %rbx, %rdi
callq 0x8800
movq -0x30(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x134ae
movq -0x100(%rbp), %rdi
cmpq %r14, %rdi
je 0x4727
callq 0x3270
movq %r15, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x48(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
callq 0x8766
leaq 0xf8ef(%rip), %rsi      # 0x14051
movq %rbx, %rdi
callq 0x34f0
leaq -0xc0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
movq %r15, %rsi
movq %r13, %rcx
callq 0xddfa
movq -0x58(%rbp), %rdi
movq %r12, %rbx
cmpq %r12, %rdi
je 0x4791
callq 0x3270
movslq -0x34(%rbp), %rax
leaq -0xc0(%rbp), %rdi
movq 0x28(%rdi), %rcx
leaq (%rax,%rax,2), %r12
shlq $0x5, %r12
movb $0x1, 0x28(%rcx,%r12)
callq 0x12cc6
leaq -0x58(%rbp), %rdi
movq %rbx, (%rdi)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
callq 0x8766
leaq 0xf8ee(%rip), %rsi      # 0x140be
leaq -0x58(%rbp), %rdi
callq 0x34f0
leaq -0xd0(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x8766
leaq 0x30(%r15), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x11b80
movq -0xe0(%rbp), %rdi
cmpq %r13, %rdi
je 0x481c
callq 0x3270
leaq -0x68(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x8766
leaq 0xf920(%rip), %rsi      # 0x1415e
leaq -0x78(%rbp), %rdi
callq 0x34f0
addq -0x98(%rbp), %r12
leaq -0x78(%rbp), %rdx
movq -0x30(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rcx
movq %r12, %r8
callq 0x3d32
movq -0x78(%rbp), %rdi
cmpq %r13, %rdi
movq %rbx, %r14
je 0x4875
callq 0x3270
leaq -0x98(%rbp), %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
movq -0x30(%rbp), %r15
je 0x488e
callq 0x3270
movq %rbx, %rdi
callq 0x8304
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4722
jmp 0x4727
jmp 0x48b1
movq %rax, %r15
movq -0x78(%rbp), %rdi
jmp 0x48c6
jmp 0x48d4
movq %rax, %r15
movq -0xe0(%rbp), %rdi
cmpq %r13, %rdi
je 0x48d7
callq 0x3270
jmp 0x48d7
jmp 0x48d4
movq %rax, %r15
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0x48ec
callq 0x3270
jmp 0x48ec
jmp 0x48e9
movq %rax, %r15
leaq -0xc0(%rbp), %rdi
callq 0x78f8
jmp 0x492c
jmp 0x48fc
movq %rax, %r15
movq -0x58(%rbp), %rdi
jmp 0x4922
movq %rax, %r15
movq -0x100(%rbp), %rdi
cmpq %r14, %rdi
jne 0x4927
jmp 0x492c
jmp 0x4918
movq %rax, %r15
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x492c
callq 0x3270
movq %r15, %rdi
callq 0x3480