// File: /workspace/github_cpp_makefile_star2_O2/xx01cyx[P]LSM-Tree/kvstore.cc
// Function: KVStore::readAllSSTsFromDisk()
void KVStore::readAllSSTsFromDisk() {
    size_t level = 0;
    string levelDir = "./data/level-" + to_string(level) + "/";
    vector<string> filenames;
    bool emptyL0;

    while (utils::dirExists(levelDir)) {
        utils::scanDir(levelDir, filenames);
        vector<SSTPtr> levelSSTs;
        for (const auto& filename : filenames) {
            string sstName = levelDir + filename;
            SSTPtr sst = readSSTFromDisk(sstName, level);
            levelSSTs.push_back(sst);
        }

        if (level == 0) {
            if (levelSSTs.empty())
                emptyL0 = true;
            else if (levelSSTs.size() == 1)
                timeStamp = levelSSTs.front()->getTimeStamp() + 1;
            else {
                SSTTimeStampPriorComparator timeStampLessThan;
                SSTPtr firstSST = levelSSTs[0];
                SSTPtr secondSST = levelSSTs[1];
                timeStamp = timeStampLessThan(firstSST, secondSST) ?
                            secondSST->getTimeStamp() + 1 : firstSST->getTimeStamp() + 1;
            }
        } else {
            if (level == 1 && emptyL0)
                timeStamp = getMaxTimeStamp(levelSSTs) + 1;
            SSTKeyPriorComparator sstComparator;
            sort(levelSSTs.begin(), levelSSTs.end(), sstComparator);
        }
        ssTables[level] = make_shared<vector<SSTPtr>>(levelSSTs);

        ++level;
        levelDir = "./data/level-" + to_string(level) + "/";
        filenames.clear();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x8(%rsp)
andq $0x0, (%rsp)
leaq 0x50(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x5964
leaq 0x6cbf(%rip), %rsi      # 0xe1b2
leaq 0xd0(%rsp), %rdi
movq %r14, %rdx
callq 0x5940
leaq 0x6da8(%rip), %rdx      # 0xe2b2
leaq 0xb0(%rsp), %rdi
leaq 0xd0(%rsp), %r15
movq %r15, %rsi
callq 0x58ba
movq %r15, %rdi
callq 0x34a8
movq %r14, %rdi
callq 0x34a8
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq 0x8(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x48(%rsp)
leaq 0xb0(%rsp), %rbp
leaq 0x10(%rsp), %r12
leaq 0x138(%rsp), %rdi
movq %rbp, %rsi
callq 0x32f0
leaq 0x138(%rsp), %r13
movq %r13, %rdi
callq 0x72ff
movl %eax, %ebx
movq %r13, %rdi
callq 0x34a8
testb %bl, %bl
je 0x77e3
leaq 0x90(%rsp), %rdi
movq %rbp, %rsi
callq 0x32f0
movq 0x90(%rsp), %rdi
callq 0x3370
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3380
testq %rax, %rax
je 0x75fc
addq $0x13, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0x3210
cmpb $0x2e, 0xd0(%rsp)
je 0x75af
movq %r14, %rdi
movq %r15, %rsi
leaq 0x70(%rsp), %rdx
callq 0x37ce
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0xa870
movq %r14, %rdi
callq 0x34a8
jmp 0x75af
movq %rbx, %rdi
callq 0x33c0
leaq 0x90(%rsp), %rdi
callq 0x34a8
andq $0x0, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %r13
cmpq %r13, %rbx
je 0x766e
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0xa46f
movq (%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x803a
movq %r12, %rdi
movq %r14, %rsi
callq 0xa4a8
leaq 0x58(%rsp), %rdi
callq 0x6932
movq %r15, %rdi
callq 0x34a8
addq $0x20, %rbx
jmp 0x7629
movq (%rsp), %rax
testq %rax, %rax
je 0x774c
cmpq $0x1, %rax
jne 0x7695
movq %r12, %rdi
callq 0x81d8
incq %rax
movq 0x8(%rsp), %rcx
movq %rax, 0x58(%rcx)
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xb3e8
movq %r15, %rdi
movq %r12, %rsi
callq 0xa52c
movq 0x48(%rsp), %rdi
movq %rsp, %rsi
callq 0xbc36
movq %rax, %rdi
movq %r15, %rsi
callq 0xb188
leaq 0xd8(%rsp), %rdi
callq 0x6932
movq (%rsp), %rsi
incq %rsi
movq %rsi, (%rsp)
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
callq 0x5964
movq %r14, %rdi
leaq 0x6abc(%rip), %rsi      # 0xe1b2
movq %rbx, %rdx
callq 0x5940
movq %r15, %rdi
movq %r14, %rsi
leaq 0x6ba7(%rip), %rdx      # 0xe2b2
callq 0x58ba
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3290
movq %r15, %rdi
callq 0x34a8
movq %r14, %rdi
callq 0x34a8
leaq 0x70(%rsp), %rdi
callq 0x34a8
leaq 0x30(%rsp), %rdi
callq 0xa54a
movq %r12, %rdi
callq 0xa552
jmp 0x755d
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rax
cmpq %rax, %rsi
je 0x76a4
subq %rsi, %rax
cmpq $0x10, %rax
jne 0x7781
movq (%rsi), %rdi
callq 0x57f2
incq %rax
movq 0x8(%rsp), %rcx
movq %rax, 0x58(%rcx)
jmp 0x76a4
movq %r15, %rdi
callq 0xaa4e
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq %r14, %rdi
callq 0xaa4e
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa4d4
testb %al, %al
movq %r15, %rax
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x57f2
incq %rax
movq 0x8(%rsp), %rcx
movq %rax, 0x58(%rcx)
leaq 0x58(%rsp), %rdi
callq 0x6932
leaq 0xd8(%rsp), %rdi
callq 0x6932
jmp 0x76a4
leaq 0x30(%rsp), %rdi
callq 0xa574
leaq 0xb0(%rsp), %rdi
callq 0x34a8
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x34a8
jmp 0x7821
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x78d3
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x6932
jmp 0x785c
jmp 0x7881
jmp 0x7881
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x34a8
jmp 0x7850
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
jmp 0x78a0
jmp 0x7881
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x6932
jmp 0x78a5
jmp 0x7881
movq %rax, %rbx
jmp 0x78c1
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x34a8
jmp 0x78b4
movq %rax, %rbx
jmp 0x78a5
movq %rax, %rbx
jmp 0x7898
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x6932
leaq 0xd0(%rsp), %rdi
callq 0x34a8
leaq 0x10(%rsp), %rdi
callq 0xa552
jmp 0x78c1
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x34a8
leaq 0x30(%rsp), %rdi
callq 0xa574
leaq 0xb0(%rsp), %rdi
callq 0x34a8
movq %rbx, %rdi
callq 0x3440