// File: /workspace/github_cpp_makefile_star2_O1/xx01cyx[P]LSM-Tree/kvstore.cc
// Function: KVStore::readSSTFromDisk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long)
SSTPtr KVStore::readSSTFromDisk(const string& filename, size_t level) {
    SSTHeader sstHeader;
    bool* byteArray = new bool[BLOOM_FILTER_SIZE];
    vector<DataIndex> dataIndexes;

    ifstream sstFile(filename, ios::binary | ios::in);
    if (!sstFile) {
        cerr << "Cannot open file `" << filename << "`." << endl;
        exit(-1);
    }

    sstFile.read((char*)&sstHeader, HEADER_SIZE);
    sstFile.read((char*)byteArray, BLOOM_FILTER_SIZE);

    uint64_t keyNumber = sstHeader.keyNumber;
    for (uint32_t i = 0; i < keyNumber; ++i) {
        DataIndex dataIndex;
        sstFile.read((char*)&dataIndex, DATA_INDEX_SIZE);
        dataIndexes.push_back(dataIndex);
    }

    BloomFilter bloomFilter(byteArray);
    SSTPtr sst = make_shared<SSTable>(level, sstHeader, bloomFilter, dataIndexes);
    return sst;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rsi, %r15
movq %rdi, %rbx
movq %rdx, 0x48(%rsp)
movl $0x2800, %edi           # imm = 0x2800
callq 0x3030
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
movl $0xc, %edx
callq 0x33e0
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x90(%rsp,%rax)
jne 0x9f35
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0x20, %edx
callq 0x32f0
leaq 0x70(%rsp), %rdi
movl $0x2800, %edx           # imm = 0x2800
movq 0x30(%rsp), %rsi
callq 0x32f0
movq 0x58(%rsp), %rbp
testq %rbp, %rbp
je 0x9eb6
movl $0x1, %r14d
leaq 0x70(%rsp), %r15
leaq 0x38(%rsp), %r12
leaq 0x10(%rsp), %r13
movl $0xc, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x32f0
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x9ea0
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x18(%rsp)
jmp 0x9eab
movq %r13, %rdi
movq %r12, %rdx
callq 0x8198
movl %r14d, %eax
incl %r14d
cmpq %rax, %rbp
ja 0x9e74
leaq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x56da
movq $0x0, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
leaq 0xf(%rsp), %rdx
leaq 0x48(%rsp), %rcx
leaq 0x50(%rsp), %r8
leaq 0x38(%rsp), %r9
movq %rbx, %rsi
callq 0xe4fe
leaq 0x38(%rsp), %rdi
callq 0x5708
leaq 0x70(%rsp), %rdi
callq 0x3070
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9f20
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
movq %rbx, %rax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc0b4(%rip), %rdi      # 0x15ff0
leaq 0x6234(%rip), %rsi      # 0x10177
movl $0x12, %edx
callq 0x32b0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0xc095(%rip), %rdi      # 0x15ff0
callq 0x32b0
movq %rax, %rbx
leaq 0x6220(%rip), %rsi      # 0x1018a
movl $0x2, %edx
movq %rax, %rdi
callq 0x32b0
movq %rbx, %rdi
callq 0x3140
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x32d0
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x5708
jmp 0x9fa4
jmp 0x9fa1
movq %rax, %rbx
jmp 0x9fae
jmp 0x9fa1
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3070
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9fc5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3460
nop