// File: /workspace/github_cpp_makefile_star2_O3/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 0x88b4
leaq 0xf95a(%rip), %rsi      # 0x14051
movq %rbx, %rdi
callq 0x34f0
leaq -0xc0(%rbp), %rsi
movq %r15, %rdi
callq 0xde1c
movl %eax, %ebx
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4721
callq 0x3270
testb %bl, %bl
je 0x4782
leaq -0xf0(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xfa0d(%rip), %rsi      # 0x14144
leaq 0xfa1f(%rip), %rdx      # 0x1415d
leaq -0x100(%rbp), %rbx
movq %rbx, %rdi
callq 0x8952
movq -0x30(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x135e0
movq -0x100(%rbp), %rdi
cmpq %r14, %rdi
je 0x476d
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 0x88b4
leaq 0xf8a9(%rip), %rsi      # 0x14051
movq %rbx, %rdi
callq 0x34f0
leaq -0xc0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
movq %r15, %rsi
movq %r13, %rcx
callq 0xdf08
movq -0x58(%rbp), %rdi
movq %r12, %rbx
cmpq %r12, %rdi
je 0x47d7
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 0x12df6
leaq -0x58(%rbp), %rdi
movq %rbx, (%rdi)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
callq 0x88b4
leaq 0xf8a8(%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 0x88b4
leaq 0x30(%r15), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x11cd8
movq -0xe0(%rbp), %rdi
cmpq %r13, %rdi
je 0x4862
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 0x88b4
leaq 0xf8da(%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 0x48bb
callq 0x3270
leaq -0x98(%rbp), %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
movq -0x30(%rbp), %r15
je 0x48d4
callq 0x3270
movq %rbx, %rdi
callq 0x844c
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4768
jmp 0x476d
jmp 0x48f7
movq %rax, %r15
movq -0x78(%rbp), %rdi
jmp 0x490c
jmp 0x491a
movq %rax, %r15
movq -0xe0(%rbp), %rdi
cmpq %r13, %rdi
je 0x491d
callq 0x3270
jmp 0x491d
jmp 0x491a
movq %rax, %r15
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0x4932
callq 0x3270
jmp 0x4932
jmp 0x492f
movq %rax, %r15
leaq -0xc0(%rbp), %rdi
callq 0x7a3c
jmp 0x4972
jmp 0x4942
movq %rax, %r15
movq -0x58(%rbp), %rdi
jmp 0x4968
movq %rax, %r15
movq -0x100(%rbp), %rdi
cmpq %r14, %rdi
jne 0x496d
jmp 0x4972
jmp 0x495e
movq %rax, %r15
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4972
callq 0x3270
movq %r15, %rdi
callq 0x3480