// File: /workspace/github_cpp_makefile_star2_O3/SeanChao[P]KV-Store/kvstore.cc
// Function: KVStore::del(unsigned long)
bool KVStore::del(uint64_t key) {
    std::clog << "- " << key << std::endl;
    std::string val = get(key);
    bool exists = false;
    std::shared_ptr<std::string> strVal(new std::string);

    uint64_t offset = 0;
    // exists in some ssTable
    if (findIndexedKey(key, &offset) != -1) {
        if (val != "") {
            put(key, "");
            exists = true;
        }else {
            exists = false;
        }
        // std::clog << "\tindexed" << std::endl;
    } else if (memTable->remove(key, strVal)) {
        this->memTableSize -= getDataSize((*strVal).length());
        exists = true;
        std::clog << "\tin mem" << std::endl;
    }
    if (!exists) std::clog << "x" << std::endl;
    return exists;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8e15(%rip), %r15      # 0xefa8
leaq 0x5166(%rip), %rsi      # 0xb300
movl $0x2, %edx
movq %r15, %rdi
callq 0x32b0
movq %r15, %rdi
movq %r14, %rsi
callq 0x31a0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3250
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq (%rbx), %rax
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x8(%rax)
movl $0x20, %edi
callq 0x3270
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x8(%rsp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0xa09e
leaq 0x60(%rsp), %rdx
movq $0x0, (%rdx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5d2e
cmpl $-0x1, %eax
je 0x629e
leaq 0x50b1(%rip), %rsi      # 0xb2f2
leaq 0x40(%rsp), %rdi
callq 0x3100
testl %eax, %eax
je 0x6350
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x508f(%rip), %rdx      # 0xb2f2
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x4ea6
movq (%rbx), %rax
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *(%rax)
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x6297
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3280
movb $0x1, %bl
jmp 0x6398
movq 0x38(%rbx), %rdi
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x62cf
movq 0x8d07(%rip), %rcx      # 0xefc8
cmpb $0x0, (%rcx)
je 0x62cb
incl 0x8(%rax)
jmp 0x62cf
lock
incl 0x8(%rax)
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
callq 0x8d64
movl %eax, %ebp
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x62ed
callq 0x9436
testb %bpl, %bpl
je 0x6350
movq (%rsp), %rax
movq 0x30(%rbx), %rcx
subq 0x8(%rax), %rcx
addq $-0x28, %rcx
movq %rcx, 0x30(%rbx)
movq 0x8c9b(%rip), %rbx      # 0xefa8
leaq 0x4fef(%rip), %rsi      # 0xb303
movl $0x7, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3250
movsbl %al, %esi
movq 0x8c69(%rip), %rdi      # 0xefa8
callq 0x3040
movb $0x1, %bl
movq %rax, %rdi
callq 0x31b0
jmp 0x6398
movq 0x8c51(%rip), %rbx      # 0xefa8
leaq 0x4fad(%rip), %rsi      # 0xb30b
movl $0x1, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3250
movsbl %al, %esi
movq 0x8c1f(%rip), %rdi      # 0xefa8
callq 0x3040
movq %rax, %rdi
callq 0x31b0
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x63a7
callq 0x9436
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x63c2
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3280
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x6409
callq 0x9436
jmp 0x6409
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x6409
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x6409
jmp 0x6406
movq %rax, %rbx
jmp 0x6418
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x6418
callq 0x9436
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6433
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x33f0
nop