// File: /workspace/github_cpp_makefile_star2_O3/SeanChao[P]KV-Store/kvstore.cc
// Function: KVStore::loadSsTable()
void KVStore::loadSsTable() {
    // checks existing ss-table
    int lv = 0;
    int count = 0;
    std::string level = resolvePath(lv);
    while (std::filesystem::exists(level)) {
        // std::string filename = "sstable-" + std::to_string(count);
        // std::clog << "see lv " << lv << std::endl;
        std::string filename = resolvePath(lv, count);
        if ((int)fileNum.size() < lv + 1) fileNum.push_back(0);
        while (std::filesystem::exists(filename)) {
            // std::clog << "see file " << filename << std::endl;
            // parse the file
            readSsTable(filename);
            fileNum[lv]++;
            filename = resolvePath(lv, ++count);
        }
        count = 0;
        level = resolvePath(++lv);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
leaq 0x78(%rsp), %rdi
xorl %r15d, %r15d
movq %rbx, %rsi
xorl %edx, %edx
callq 0x66b8
leaq 0x60(%rbx), %rax
movq %rax, 0x40(%rsp)
leaq 0x50(%rsp), %r12
leaq 0x20(%rsp), %r13
movq %r12, %rdi
leaq 0x78(%rsp), %rsi
movl $0x2, %edx
callq 0x8f64
movq %r12, %rdi
callq 0x3120
movq %rax, %r14
movq %r12, %rdi
callq 0x8fe4
testb %r14b, %r14b
je 0x528d
movzbl %r14b, %eax
cmpl $0xff, %eax
je 0x528d
movq %r13, %rdi
movq %rbx, %rsi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x5f1a
movq 0x68(%rbx), %rsi
movq %rsi, %rax
subq 0x60(%rbx), %rax
shrq $0x2, %rax
cltq
cmpq %rax, %r15
jl 0x5153
movl $0x0, 0x50(%rsp)
cmpq 0x70(%rbx), %rsi
je 0x5146
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%rbx)
jmp 0x5153
movq 0x40(%rsp), %rdi
movq %r12, %rdx
callq 0x97a2
leaq 0x1(%r15), %rax
movq %rax, 0x48(%rsp)
movl $0x1, %r14d
movq %r12, %rdi
movq %r13, %rsi
movl $0x2, %edx
callq 0x8f64
movq %r12, %rdi
callq 0x3120
movq %rax, %rbp
movq %r12, %rdi
callq 0x8fe4
testb %bpl, %bpl
je 0x522c
movzbl %bpl, %eax
cmpl $0xff, %eax
je 0x522c
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
movq %rsp, %rbp
movq %rbp, %rdi
callq 0x95b2
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x783e
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x51e4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x60(%rbx), %rax
incl (%rax,%r15,4)
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x5f1a
movq %r13, %rdi
movq %r12, %rsi
callq 0x32e0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x5224
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
incl %r14d
jmp 0x5162
movq %r12, %rdi
movq %rbx, %rsi
movq 0x48(%rsp), %r15
movl %r15d, %edx
callq 0x66b8
leaq 0x78(%rsp), %rdi
movq %r12, %rsi
callq 0x32e0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x5268
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x50c5
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x50c5
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x52ae
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x530d
jmp 0x530d
jmp 0x52c6
movq %rax, %rbx
jmp 0x532c
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8fe4
jmp 0x532c
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5310
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x5310
jmp 0x530d
jmp 0x530d
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8fe4
jmp 0x5310
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x532c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x534d
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x33f0
nop