// File: /workspace/github_cpp_makefile_star2_O3/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 0x4853
testb %al, %al
je 0x499d
leaq 0xb8f8(%rip), %rdi      # 0x101b8
movq %r15, %rsi
callq 0x5fae
leaq 0xb8f1(%rip), %rcx      # 0x101c0
cmpq %rcx, %rax
je 0x49d8
movq %r14, %rdi
callq 0x4b7b
testb %al, %al
je 0x4a90
leaq 0xb8c9(%rip), %rdi      # 0x101b8
movq %r15, %rsi
callq 0x571a
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 0x4adc
movq %rax, %r12
movslq %r12d, %rax
cmpq %r12, %rax
jne 0x4ae8
movl (%r14), %eax
cmpl $0x22, %eax
je 0x4ae8
testl %eax, %eax
jne 0x4957
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 0x42a0
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
callq 0x61e0
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x4a81
movq 0x60(%rsp), %rsi
jmp 0x4a79
movq 0xb62c(%rip), %rbx      # 0xffd0
leaq 0x6962(%rip), %rsi      # 0xb30d
movl $0x10, %edx
movq %rbx, %rdi
callq 0x2220
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x2220
leaq 0x6aa8(%rip), %rsi      # 0xb476
movl $0x10, %edx
jmp 0x4ac6
leaq 0xb809(%rip), %rdi      # 0x101e8
movq %r15, %rsi
callq 0x5ff4
leaq 0xb802(%rip), %rcx      # 0x101f0
cmpq %rcx, %rax
je 0x4a81
leaq 0xb7ea(%rip), %rdi      # 0x101e8
movq %r15, %rsi
callq 0x5796
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 0x42a0
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0x6a32
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x4a66
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21e0
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4a81
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 0xb539(%rip), %rbx      # 0xffd0
leaq 0x68fd(%rip), %rsi      # 0xb39b
movl $0xb, %edx
movq %rbx, %rdi
callq 0x2220
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x2220
leaq 0x68e6(%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 0x67ea(%rip), %rdi      # 0xb2cd
callq 0x2120
leaq 0x67de(%rip), %rdi      # 0xb2cd
callq 0x2250
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x4b13
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x4b13
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4b54
movq 0x40(%rsp), %rsi
jmp 0x4b3a
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x4b54
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x4b54
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x4b54
movl 0xc(%rsp), %eax
movl %eax, (%r14)
movq %rbx, %rdi
callq 0x22e0