// File: SeanChao[P]KV-Store/kvstore.cc
// Function: KVStore::reset()
void KVStore::reset() {
    // reset memTable
    resetMemTable();
    // Removes all existing ss-table
    int lv = 0;
    std::string level = resolvePath(lv);
    while (std::filesystem::exists(level)) {
        // std::clog << "remove " << level << std::endl;
        uintmax_t count = std::filesystem::remove_all(level);
        std::clog << "removed " << count << " file or directories" << std::endl;
        level = resolvePath(++lv);
        // std::clog << level << std::endl;
    }
    level = resolvePath(-1);
    if (std::filesystem::exists(level)) std::filesystem::remove_all(level);
    indexTableList.clear();
    fileNum.clear();
    fileNum.push_back(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x7c10
movq -0x138(%rbp), %rsi
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %edx
leaq -0x30(%rbp), %rdi
callq 0x8b40
leaq -0x58(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x2, %edx
callq 0xc5a0
jmp 0x888d
leaq -0x58(%rbp), %rdi
callq 0xc570
movb %al, -0x139(%rbp)
jmp 0x889e
leaq -0x58(%rbp), %rdi
callq 0xc680
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0x88b6
jmp 0x89e5
leaq -0x98(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x2, %edx
callq 0xc5a0
jmp 0x88cd
leaq -0x98(%rbp), %rdi
callq 0x4590
movq %rax, -0x148(%rbp)
jmp 0x88e2
leaq -0x98(%rbp), %rdi
callq 0xc680
movq -0x148(%rbp), %rax
movq %rax, -0x70(%rbp)
movq 0x166a0(%rip), %rdi     # 0x1efa0
leaq 0xda3c(%rip), %rsi      # 0x16343
callq 0x42f0
movq %rax, -0x150(%rbp)
jmp 0x8915
movq -0x150(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x4090
movq %rax, -0x158(%rbp)
jmp 0x892e
movq -0x158(%rbp), %rdi
leaq 0xda10(%rip), %rsi      # 0x1634c
callq 0x42f0
movq %rax, -0x160(%rbp)
jmp 0x894a
movq -0x160(%rbp), %rdi
movq 0x16658(%rip), %rsi     # 0x1efb0
callq 0x4320
jmp 0x895f
movq -0x138(%rbp), %rsi
movl -0xc(%rbp), %edx
incl %edx
movl %edx, -0xc(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x8b40
jmp 0x897c
leaq -0x30(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x43c0
leaq -0xb8(%rbp), %rdi
callq 0x45d8
jmp 0x8879
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x8b2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xc680
jmp 0x8b2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xc680
jmp 0x8b2e
movq -0x138(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x8b40
jmp 0x89ff
leaq -0x30(%rbp), %rdi
movq %rdi, -0x168(%rbp)
leaq -0xd8(%rbp), %rsi
movq %rsi, -0x170(%rbp)
callq 0x43c0
movq -0x170(%rbp), %rdi
callq 0x45d8
movq -0x168(%rbp), %rsi
leaq -0x100(%rbp), %rdi
movl $0x2, %edx
callq 0xc5a0
jmp 0x8a43
leaq -0x100(%rbp), %rdi
callq 0xc570
movb %al, -0x171(%rbp)
jmp 0x8a57
leaq -0x100(%rbp), %rdi
callq 0xc680
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0x8a6f
jmp 0x8ad6
leaq -0x128(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x2, %edx
callq 0xc5a0
jmp 0x8a86
leaq -0x128(%rbp), %rdi
callq 0x4590
jmp 0x8a94
leaq -0x128(%rbp), %rdi
callq 0xc680
jmp 0x8ad6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xc680
jmp 0x8b2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x128(%rbp), %rdi
callq 0xc680
jmp 0x8b2e
movq -0x138(%rbp), %rdi
addq $0x40, %rdi
callq 0xc6b0
movq -0x138(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0x180(%rbp)
callq 0xc6d0
movq -0x180(%rbp), %rdi
movl $0x0, -0x12c(%rbp)
leaq -0x12c(%rbp), %rsi
callq 0xb720
jmp 0x8b1c
leaq -0x30(%rbp), %rdi
callq 0x45d8
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x45d8
movq -0x60(%rbp), %rdi
callq 0x4530