// File: /workspace/github_cpp_makefile_star2_O1/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 $0x258, %rsp            # imm = 0x258
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x5cf4
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0xc, %edx
callq 0x33e0
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x70(%rsp,%rax)
jne 0x6842
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x3320
leaq 0x50(%rsp), %rdi
callq 0x3450
movq %rax, %r15
movl 0x10(%r14), %eax
leal (%rax,%rax,2), %eax
leal 0x2820(,%rax,4), %r12d
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3320
movq %r15, 0x28(%rsp)
movq 0x30(%r14), %rbp
movq (%rbp), %rax
movq %rax, (%rsp)
addq $0x10, %rbp
cmpq 0x38(%r14), %rbp
je 0x67bb
leaq 0x8(%rsp), %r13
movq %rsp, %r15
movl %r12d, %edx
movl 0x8(%rbp), %r12d
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
movl %r12d, %ecx
movl $0x1, %r8d
callq 0x6624
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6aba
movq %rax, %rdi
movq %r13, %rsi
callq 0x3160
movq (%rbp), %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x67b1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x10, %rbp
cmpq 0x38(%r14), %rbp
jne 0x675a
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl %r12d, %edx
movq 0x28(%rsp), %rcx
movl $0x1, %r8d
callq 0x6624
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6aba
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x3160
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x680b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x50(%rsp), %rdi
callq 0x3070
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6830
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xf7a7(%rip), %rdi      # 0x15ff0
leaq 0x9927(%rip), %rsi      # 0x10177
movl $0x12, %edx
callq 0x32b0
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0xf785(%rip), %rdi      # 0x15ff0
callq 0x32b0
movq %rax, %rbx
leaq 0x9910(%rip), %rsi      # 0x1018a
movl $0x2, %edx
movq %rax, %rdi
callq 0x32b0
movq %rbx, %rdi
callq 0x3140
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x32d0
jmp 0x68b4
jmp 0x68b4
jmp 0x68b4
movq %rax, %rbx
jmp 0x68e2
jmp 0x68b4
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x68c6
movq %rax, %rbx
jmp 0x68d8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x68d8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x50(%rsp), %rdi
callq 0x3070
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68fd
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3460
nop