// File: /workspace/github_cpp_makefile_star2_O1/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 $0x188, %rsp            # imm = 0x188
movq %rdi, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x10(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq %rsp, %r14
movl $0x1, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x32c0
movq (%r14), %rax
movb $0x30, (%rax)
leaq 0x7802(%rip), %rcx      # 0x1018d
movl $0xd, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32a0
leaq 0xe0(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x89cd
movq %rdx, 0xd0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe0(%rsp)
jmp 0x89d3
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0xd0(%rsp), %r15
movq %rdx, 0x8(%r15)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x7898(%rip), %rsi      # 0x10291
movq %r15, %rdi
callq 0x3490
leaq 0x40(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8a28
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0x8a2e
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x8a6b
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3280
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x8a81
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0xc0(%rsp), %r12
movq 0x28(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x160(%rsp)
leaq 0x50(%rsp), %r13
leaq 0x178(%rsp), %rax
movq %rax, 0x168(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x168(%rsp), %rdi
callq 0x558a
movq 0x168(%rsp), %rdi
movq %r15, %rsi
callq 0x3220
testl %eax, %eax
sete %bl
movl 0xe8(%rsp), %ebp
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0x8b1d
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3280
shrl $0xe, %ebp
andl $0x1, %ebp
andb %bpl, %bl
je 0x907d
movq %r12, 0xb0(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0xb0(%rsp), %rdi
callq 0x558a
movq 0xb0(%rsp), %rdi
callq 0x3390
movq %rax, %rbx
movq %rax, %rdi
callq 0x33a0
leaq 0x10(%rsp), %rbp
testq %rax, %rax
je 0x8bd8
addq $0x13, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0x3230
cmpb $0x2e, 0xd0(%rsp)
je 0x8bce
movq %rbp, (%rsp)
movq %r15, %rdi
callq 0x3110
leaq (%rsp,%rax), %rdx
addq $0xd0, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x561a
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0xd34a
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x8bce
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x33a0
jmp 0x8b6b
movq %rbx, %rdi
callq 0x33d0
movq 0xb0(%rsp), %rdi
cmpq %r12, %rdi
je 0x8bfd
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3280
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x70(%rsp), %rbx
movq 0x78(%rsp), %r12
cmpq %r12, %rbx
je 0x8c82
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
movq %rbx, %rdx
callq 0xce4d
movq 0x20(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x9dc8
movq %r13, %rdi
movq %r14, %rsi
callq 0xcea8
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x8c57
callq 0x7d9e
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x8c7c
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x20, %rbx
jmp 0x8c18
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x8cc1
cmpq $0x1, %rax
jne 0x8d06
movq 0x50(%rsp), %r12
movq 0x58(%rsp), %rbp
cmpq %rbp, %r12
je 0x8cf3
xorl %ebx, %ebx
movq (%r12), %rdi
callq 0x690a
cmpq %rbx, %rax
cmovaq %rax, %rbx
addq $0x10, %r12
cmpq %rbp, %r12
jne 0x8ca3
incq %rbx
jmp 0x8cf8
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
cmpq %rcx, %rax
je 0x8d42
subq %rax, %rcx
cmpq $0x10, %rcx
jne 0x8fc2
movq (%rax), %rdi
callq 0x690a
incq %rax
movq 0x28(%rsp), %rcx
movq %rax, 0x58(%rcx)
jmp 0x8d42
movl $0x1, %ebx
movq 0x28(%rsp), %rax
movq %rbx, 0x58(%rax)
leaq 0x10(%rsp), %rbp
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %r12
cmpq %r12, %rbx
je 0x8d42
movq %r12, %rax
subq %rbx, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdc31
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdce4
movq $0x0, 0xd0(%rsp)
leaq 0xd8(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r13, %rcx
callq 0xe48c
movq 0x160(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xe3ca
movaps 0xd0(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0xd0(%rsp)
movq 0x8(%rax), %rdi
movups %xmm0, (%rax)
testq %rdi, %rdi
je 0x8d9a
callq 0x7d9e
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x8dac
callq 0x7d9e
movq 0x20(%rsp), %rbx
incq %rbx
movq %rbx, 0x20(%rsp)
movl $0x1, %esi
cmpq $0xa, %rbx
jb 0x8e13
movl $0x4, %esi
movq %rbx, %rcx
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
cmpq $0x63, %rcx
jbe 0x8e0c
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x8e11
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x8e13
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x8dd6
addl $-0x3, %esi
jmp 0x8e13
addl $-0x2, %esi
jmp 0x8e13
decl %esi
movl %esi, %esi
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
leaq 0x90(%rsp), %r12
movq %r12, %rdi
xorl %edx, %edx
callq 0x32c0
movq 0x90(%rsp), %rdi
movl 0x98(%rsp), %esi
movq %rbx, %rdx
callq 0x6a22
movl $0xd, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x732b(%rip), %rcx      # 0x1018d
callq 0x32a0
movq %rbp, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq 0xe0(%rsp), %rbx
je 0x8e90
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x8e97
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
leaq 0x73d8(%rip), %rsi      # 0x10291
callq 0x3490
movq %rbx, 0xd0(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8eea
movq %rdx, 0xd0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe0(%rsp)
jmp 0x8ef0
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0xd8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x32e0
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x8f35
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3280
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x8f4b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x8f70
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x70(%rsp), %rbx
movq 0x78(%rsp), %r12
cmpq %rbx, %r12
je 0x8fad
leaq 0x10(%rbx), %rbp
movq -0x10(%rbp), %rdi
cmpq %rdi, %rbp
je 0x8f98
movq (%rbp), %rsi
incq %rsi
callq 0x3280
leaq 0x20(%rbp), %rax
addq $0x10, %rbp
cmpq %r12, %rbp
movq %rax, %rbp
jne 0x8f83
movq %rbx, 0x78(%rsp)
movq %r13, %rdi
callq 0xcf40
leaq 0xc0(%rsp), %r12
jmp 0x8ab2
movq (%rax), %rcx
movq %rcx, 0xd0(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xd8(%rsp)
testq %rax, %rax
je 0x8ff3
movq 0xcfe3(%rip), %rcx      # 0x15fc8
cmpb $0x0, (%rcx)
je 0x8fef
incl 0x8(%rax)
jmp 0x8ff3
lock
incl 0x8(%rax)
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, (%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x9023
movq 0xcfb3(%rip), %rcx      # 0x15fc8
cmpb $0x0, (%rcx)
je 0x901f
incl 0x8(%rax)
jmp 0x9023
lock
incl 0x8(%rax)
leaq 0x90(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xcee8
testb %al, %al
movq %r15, %rax
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x690a
incq %rax
movq 0x28(%rsp), %rcx
movq %rax, 0x58(%rcx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x9062
callq 0x7d9e
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x8d42
callq 0x7d9e
jmp 0x8d42
leaq 0x70(%rsp), %rdi
callq 0xcf88
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x90a3
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x90e2
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x90e2
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x9232
movq 0x10(%rsp), %rsi
jmp 0x922a
jmp 0x91b3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x9160
callq 0x7d9e
jmp 0x9160
jmp 0x91b3
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x913a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x913a
movq %rax, %rbx
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x91e0
movq 0xa0(%rsp), %rsi
jmp 0x91d8
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x91e0
callq 0x7d9e
jmp 0x91e0
jmp 0x91b3
jmp 0x91b3
jmp 0x91ec
movq %rax, %rbx
jmp 0x920c
jmp 0x91b3
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x91ef
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x91ef
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x91bb
callq 0x7d9e
jmp 0x91bb
movq %rax, %rbx
jmp 0x91e0
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x91e0
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x50(%rsp), %rdi
callq 0xcf40
jmp 0x920c
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r12, %rdi
je 0x920c
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x70(%rsp), %rdi
callq 0xcf88
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x9232
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3460