// File: /workspace/github_cpp_makefile_star2_O3/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), %r12
movq %r12, %rdi
movq %r15, %rsi
movl $0xc, %edx
callq 0x33e0
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x90(%rsp,%rax)
jne 0x9d95
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 0x9d16
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 0x9d00
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x18(%rsp)
jmp 0x9d0b
movq %r13, %rdi
movq %r12, %rdx
callq 0x8070
movl %r14d, %eax
incl %r14d
cmpq %rax, %rbp
ja 0x9cd4
leaq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x570e
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 0xe3c8
leaq 0x38(%rsp), %rdi
callq 0x573c
leaq 0x70(%rsp), %rdi
callq 0x3070
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9d80
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 0xc254(%rip), %rdi      # 0x15ff0
leaq 0x63f4(%rip), %rsi      # 0x10197
movl $0x12, %edx
callq 0x32b0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0xc235(%rip), %rdi      # 0x15ff0
callq 0x32b0
movq %rax, %rbx
leaq 0x63e0(%rip), %rsi      # 0x101aa
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 0x573c
jmp 0x9dff
jmp 0x9dfc
jmp 0x9dfc
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3070
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9e20
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3460