// File: /workspace/github_cpp_makefile_star2_O1/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 0x8e89(%rip), %r15      # 0xefa8
leaq 0x51da(%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 0xa046
leaq 0x60(%rsp), %rdx
movq $0x0, (%rdx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5cb0
cmpl $-0x1, %eax
je 0x622a
leaq 0x5125(%rip), %rsi      # 0xb2f2
leaq 0x40(%rsp), %rdi
callq 0x3100
testl %eax, %eax
je 0x62dc
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5103(%rip), %rdx      # 0xb2f2
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x4e24
movq (%rbx), %rax
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *(%rax)
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x6223
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3280
movb $0x1, %bl
jmp 0x62de
movq 0x38(%rbx), %rdi
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x625b
movq 0x8d7b(%rip), %rcx      # 0xefc8
cmpb $0x0, (%rcx)
je 0x6257
incl 0x8(%rax)
jmp 0x625b
lock
incl 0x8(%rax)
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
callq 0x8d3a
movl %eax, %ebp
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x6279
callq 0x9408
testb %bpl, %bpl
je 0x62dc
movq (%rsp), %rax
movq 0x30(%rbx), %rcx
subq 0x8(%rax), %rcx
addq $-0x28, %rcx
movq %rcx, 0x30(%rbx)
movq 0x8d0f(%rip), %rbx      # 0xefa8
leaq 0x5063(%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 0x8cdd(%rip), %rdi      # 0xefa8
callq 0x3040
movb $0x1, %bl
movq %rax, %rdi
callq 0x31b0
jmp 0x62de
xorl %ebx, %ebx
testb %bl, %bl
jne 0x6328
movq 0x8cbf(%rip), %r14      # 0xefa8
leaq 0x501b(%rip), %rsi      # 0xb30b
movl $0x1, %edx
movq %r14, %rdi
callq 0x32b0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3250
movsbl %al, %esi
movq 0x8c8d(%rip), %rdi      # 0xefa8
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x6337
callq 0x9408
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6352
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 0x6399
callq 0x9408
jmp 0x6399
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x6399
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x6399
jmp 0x6396
movq %rax, %rbx
jmp 0x63a8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x63a8
callq 0x9408
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x63c3
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x33f0
nop