// File: yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::GetKeyByHashEntry[abi:cxx11](hlkvds::HashEntry*)
string DS_MultiVolume_Impl::GetKeyByHashEntry(HashEntry *entry) {
    uint64_t key_offset = 0;

    int vol_id = getVolIdFromEntry(entry);
    Volume *vol = volMap_[vol_id];

    if (!vol->CalcKeyOffsetPhyFromEntry(entry, key_offset)) {
        return "";
    }
    __DEBUG("key offset: %lu",key_offset);
    uint16_t key_len = entry->GetKeySize();
    char *mkey = new char[key_len+1];
    if (!vol->Read(mkey, key_len, key_offset)) {
        __ERROR("Could not read data at position");
        delete[] mkey;
        return "";
    }
    mkey[key_len] = '\0';
    string res(mkey, key_len);
    //__INFO("Iterator key is %s, key_offset = %lu, key_len = %u", mkey, key_offset, key_len);
    delete[] mkey;

    return res;
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0x48(%rsp)
movq %rdi, %rax
movq %rax, 0x50(%rsp)
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq 0xa8(%rsp), %rdi
movq %rdi, 0x58(%rsp)
movq $0x0, 0x98(%rsp)
movq 0xa0(%rsp), %rsi
callq 0x13530
movq 0x58(%rsp), %rdi
movl %eax, 0x94(%rsp)
addq $0x28, %rdi
leaq 0x94(%rsp), %rsi
callq 0x15a50
movq (%rax), %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rdi
movq 0xa0(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x513b0
testb $0x1, %al
jne 0x14bb7
leaq 0x87(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x8830
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rdx
leaq 0x3e248(%rip), %rsi     # 0x52dc6
callq 0x8680
jmp 0x14b85
leaq 0x87(%rsp), %rdi
callq 0x8540
jmp 0x14d9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x87(%rsp), %rdi
callq 0x8540
jmp 0x14da9
movq 0xa0(%rsp), %rdi
callq 0x16800
movw %ax, 0x72(%rsp)
movzwl 0x72(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rdi
movq $-0x1, %rax
cmpq $0x0, %rdi
cmovlq %rax, %rdi
callq 0x8040
movq %rax, 0x68(%rsp)
movq 0x88(%rsp), %rdi
movq 0x68(%rsp), %rsi
movzwl 0x72(%rsp), %eax
movl %eax, %edx
movq 0x98(%rsp), %rcx
callq 0x50ed0
testb $0x1, %al
jne 0x14cf3
jmp 0x14c18
movq 0x5c3b9(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x38(%rsp)
callq 0x8480
movq 0x38(%rsp), %rdi
movq %rax, %rdx
leaq 0x3d876(%rip), %rsi     # 0x524b1
leaq 0x3dc2e(%rip), %rcx     # 0x52870
leaq 0x3d908(%rip), %r8      # 0x52551
movl $0x18f, %r9d            # imm = 0x18F
movb $0x0, %al
callq 0x86f0
movq 0x5c37b(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x3db6d(%rip), %rsi     # 0x527d4
movb $0x0, %al
callq 0x86f0
movq 0x5c363(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x3e146(%rip), %rsi     # 0x52dc5
movb $0x0, %al
callq 0x86f0
movq 0x68(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x14ca0
movq 0x30(%rsp), %rdi
callq 0x8610
leaq 0x67(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x8830
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rdx
leaq 0x3e106(%rip), %rsi     # 0x52dc6
callq 0x8680
jmp 0x14cc7
leaq 0x67(%rsp), %rdi
callq 0x8540
jmp 0x14d9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x67(%rsp), %rdi
callq 0x8540
jmp 0x14da9
movq 0x68(%rsp), %rax
movzwl 0x72(%rsp), %ecx
movb $0x0, (%rax,%rcx)
movb $0x0, 0x66(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movzwl 0x72(%rsp), %eax
movq %rax, 0x18(%rsp)
leaq 0x65(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x8830
movq 0x48(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x8570
jmp 0x14d44
leaq 0x65(%rsp), %rdi
callq 0x8540
movq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x14d68
movq 0x8(%rsp), %rdi
callq 0x8610
movb $0x1, 0x66(%rsp)
testb $0x1, 0x66(%rsp)
jne 0x14d9a
jmp 0x14d90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x65(%rsp), %rdi
callq 0x8540
jmp 0x14da9
movq 0x48(%rsp), %rdi
callq 0x8928
jmp 0x14d9c
movq 0x50(%rsp), %rax
addq $0xb8, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0x8820
nopw %cs:(%rax,%rax)