// File: 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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6940
testb $0x1, %al
jne 0x69d7
movq 0x1961d(%rip), %rdi     # 0x1ffc8
leaq 0xf94f(%rip), %rsi      # 0x16301
callq 0x3280
movq %rax, %rdi
movq -0x8(%rbp), %rsi
callq 0x3250
movq %rax, %rdi
leaq 0xfa9d(%rip), %rsi      # 0x1646a
callq 0x3280
jmp 0x6b6a
movq -0x8(%rbp), %rdi
callq 0x6b80
testb $0x1, %al
jne 0x69e9
jmp 0x6ab2
movq -0x10(%rbp), %rdi
callq 0x6bd0
testb $0x1, %al
jne 0x6a29
movq 0x195cb(%rip), %rdi     # 0x1ffc8
leaq 0xf98b(%rip), %rsi      # 0x1638f
callq 0x3280
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x3250
movq %rax, %rdi
leaq 0xf97c(%rip), %rsi      # 0x1639b
callq 0x3280
jmp 0x6b6a
movq -0x8(%rbp), %rsi
leaq 0x1983c(%rip), %rdi     # 0x20270
callq 0x7770
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x5570
movl %eax, -0x94(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x3120
movq -0xa0(%rbp), %rdi
movl -0x94(%rbp), %esi
movq -0x90(%rbp), %rdx
callq 0xa3d0
jmp 0x6a8a
leaq -0x38(%rbp), %rdi
callq 0x3190
jmp 0x6b6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3190
jmp 0x6b73
movq -0x8(%rbp), %rdi
callq 0x6c50
testb $0x1, %al
jne 0x6ac4
jmp 0x6b68
movq -0x8(%rbp), %rsi
leaq 0x197d1(%rip), %rdi     # 0x202a0
callq 0x7850
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movl $0x1, %edx
movl $0xa, %ecx
callq 0x32b0
movq -0x18(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x3120
jmp 0x6b07
movq -0xa8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0xad50
jmp 0x6b20
leaq -0x88(%rbp), %rdi
callq 0x3190
leaq -0x68(%rbp), %rdi
callq 0x3190
jmp 0x6b68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6b5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
leaq -0x68(%rbp), %rdi
callq 0x3190
jmp 0x6b73
jmp 0x6b6a
addq $0xb0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3410
nopl (%rax)