// File: /workspace/github_cpp_makefile_star2_O2/xx01cyx[P]LSM-Tree/SSTable.cc
// Function: SSTable::getValuesFromDisk(std::unordered_map<unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&) const
void SSTable::getValuesFromDisk(KVPair& sstData) const {

    string filename = getFilename();
    ifstream table(filename, ios::in | ios::binary);
    if (!table) {
        cerr << "Cannot open file `" << filename << "`." << endl;
        exit(-1);
    }

    table.seekg(0, ios::end);
    uint32_t fileLength = table.tellg();

    uint32_t dataStart = HEADER_SIZE + BLOOM_FILTER_SIZE + DATA_INDEX_SIZE * header.keyNumber;
    table.seekg(dataStart, ios::beg);

    uint32_t start = dataStart;
    uint32_t end;

    auto it = dataIndexes.cbegin();
    LsmKey key = (*it).key;
    it++;
    while (it != dataIndexes.cend()) {
        end = (*it).offset;
        LsmValue value = readValueFromFile(table, start, end, true);
        sstData[key] = value;
        start = end;
        key = (*it).key;    // Get key for the next loop.
        it++;
    }

    // Set the last k-v pair.
    end = fileLength;
    LsmValue value = readValueFromFile(table, start, end, true);
    sstData[key] = value;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x533e
leaq 0x60(%rsp), %rdi
pushq $0xc
popq %rdx
movq %rbx, %rsi
callq 0x33d0
movq 0x60(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x80(%rsp,%rax)
jne 0x5772
leaq 0x60(%rsp), %rdi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x32e0
leaq 0x60(%rsp), %rdi
callq 0x3430
movq %rax, 0x18(%rsp)
imull $0xc, 0x10(%r14), %ebx
addl $0x2820, %ebx           # imm = 0x2820
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x32e0
movq 0x30(%r14), %rbp
movq (%rbp), %rax
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
addq $0x10, %rbp
leaq 0x20(%rsp), %r13
pushq $0x1
popq %r15
cmpq 0x38(%r14), %rbp
je 0x570c
movl 0x8(%rbp), %r12d
movq %r13, %rdi
leaq 0x60(%rsp), %rsi
movl %ebx, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq 0x55a2
movq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5ade
movq %rax, %rdi
movq %r13, %rsi
callq 0x3140
movq (%rbp), %rax
movq %rax, 0x8(%rsp)
movq %r13, %rdi
callq 0x34a8
addq $0x10, %rbp
movl %r12d, %ebx
jmp 0x56b9
leaq 0x20(%rsp), %rdi
leaq 0x60(%rsp), %rsi
pushq $0x1
popq %r8
movl %ebx, %edx
movq 0x18(%rsp), %rcx
callq 0x55a2
leaq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x5ade
leaq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x3140
leaq 0x20(%rsp), %rdi
callq 0x34a8
leaq 0x60(%rsp), %rdi
callq 0x3070
leaq 0x40(%rsp), %rdi
callq 0x34a8
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xf877(%rip), %rdi      # 0x14ff0
leaq 0x8a1c(%rip), %rsi      # 0xe19c
callq 0x3230
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x31e0
leaq 0x8a16(%rip), %rsi      # 0xe1af
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
callq 0x3120
pushq $-0x1
popq %rdi
callq 0x3280
jmp 0x57c0
jmp 0x57c0
jmp 0x57c0
movq %rax, %rbx
jmp 0x57dc
jmp 0x57c0
jmp 0x57c5
movq %rax, %rbx
jmp 0x57d2
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x34a8
leaq 0x60(%rsp), %rdi
callq 0x3070
leaq 0x40(%rsp), %rdi
callq 0x34a8
movq %rbx, %rdi
callq 0x3440