// File: /workspace/github_cpp_makefile_star2_O1/ChaohuiYu[P]BPlusTree/commands.cpp
// Function: insertRecord(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void insertRecord(const string& relationName, const string& key, const string& record) {
    // need to check if key should be integer
    // need to check if key exists

    if (!isRelationExist(relationName)) {
        cout << "Error: Relation " << relationName << " doesn't exist.\n";
        return;
    }

    if (isRelationInRelationInt(relationName)) {
        if (!is_number(key)) {
            cout << "Error: Key " << key << " is not a number.\n";
            return;
        }
        relationNameToRelationInt[relationName]->insertRecord(stoi(key), record);
    }
    else if (isRelationInRelationStr(relationName)) {
        relationNameToRelationStr[relationName]->insertRecord(key.substr(1, 10), record);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x4893
testb %al, %al
je 0x49dd
leaq 0xb8b8(%rip), %rdi      # 0x101b8
movq %r15, %rsi
callq 0x5ff2
leaq 0xb8b1(%rip), %rcx      # 0x101c0
cmpq %rcx, %rax
je 0x4a18
movq %r14, %rdi
callq 0x4bbb
testb %al, %al
je 0x4ad0
leaq 0xb889(%rip), %rdi      # 0x101b8
movq %r15, %rsi
callq 0x575e
movq (%rax), %r15
movq (%r14), %r13
callq 0x2060
movq %rax, %r14
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movl $0x0, (%r14)
leaq 0x70(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
movl $0xa, %edx
callq 0x2240
cmpq %r13, (%rbp)
je 0x4b1c
movq %rax, %r12
movslq %r12d, %rax
cmpq %r12, %rax
jne 0x4b28
movl (%r14), %eax
cmpl $0x22, %eax
je 0x4b28
testl %eax, %eax
jne 0x4997
movl 0xc(%rsp), %eax
movl %eax, (%r14)
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x42ae
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
callq 0x6224
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x4ac1
movq 0x60(%rsp), %rsi
jmp 0x4ab9
movq 0xb5ec(%rip), %rbx      # 0xffd0
leaq 0x6922(%rip), %rsi      # 0xb30d
movl $0x10, %edx
movq %rbx, %rdi
callq 0x2220
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x2220
leaq 0x6a68(%rip), %rsi      # 0xb476
movl $0x10, %edx
jmp 0x4b06
leaq 0xb7c9(%rip), %rdi      # 0x101e8
movq %r15, %rsi
callq 0x6038
leaq 0xb7c2(%rip), %rcx      # 0x101f0
cmpq %rcx, %rax
je 0x4ac1
leaq 0xb7aa(%rip), %rdi      # 0x101e8
movq %r15, %rsi
callq 0x57da
movq (%rax), %r15
leaq 0x30(%rsp), %rdi
movl $0x1, %edx
movl $0xa, %ecx
movq %r14, %rsi
callq 0x2200
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x42ae
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0x6a74
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x4aa6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21e0
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4ac1
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21e0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xb4f9(%rip), %rbx      # 0xffd0
leaq 0x68bd(%rip), %rsi      # 0xb39b
movl $0xb, %edx
movq %rbx, %rdi
callq 0x2220
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x2220
leaq 0x68a6(%rip), %rsi      # 0xb3a7
movl $0x12, %edx
movq %rax, %rdi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
leaq 0x67aa(%rip), %rdi      # 0xb2cd
callq 0x2120
leaq 0x679e(%rip), %rdi      # 0xb2cd
callq 0x2250
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x4b53
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x4b53
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4b94
movq 0x40(%rsp), %rsi
jmp 0x4b7a
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x4b94
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x4b94
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x4b94
movl 0xc(%rsp), %eax
movl %eax, (%r14)
movq %rbx, %rdi
callq 0x22e0