// File: yangwanyuan[P]HLKVDS/src/KvdbIter.cc
// Function: hlkvds::KvdbIter::Seek(char const*)
void KvdbIter::Seek(const char* key) {
    //need hashEntry;
    int key_len = strlen(key);
    KVSlice slice(key, key_len, NULL, 0);
    DataHeader data_header;
    data_header.SetDigest(slice.GetDigest());
    DataHeaderAddress addrs;
    HashEntry entry(data_header, addrs, NULL);
    
    LinkedList<HashEntry> *entry_list;
    hashEntry_ = NULL;
    for (int i = 0; i < htSize_; i++) {
        entry_list = idxMgr_->GetEntryListByNo(i);
        hashEntry_ = entry_list->getRef(entry);
        if (NULL != hashEntry_) {
            hashTableCur_ = i;
            entryListCur_ = entry_list->searchNo(entry);
            break;
        }
    }

    if (NULL != hashEntry_) {
        valid_ = true;
    } else {
        valid_ = false;
    }
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x81b0
movl %eax, 0xf4(%rsp)
movq 0xf8(%rsp), %rsi
movl 0xf4(%rsp), %edx
xorl %r9d, %r9d
movl %r9d, %ecx
leaq 0xb0(%rsp), %rdi
movl %r9d, %r8d
callq 0x40eb0
leaq 0x90(%rsp), %rdi
callq 0x24d50
jmp 0x2ae0c
leaq 0xb0(%rsp), %rdi
callq 0x16d90
movq %rax, 0x28(%rsp)
jmp 0x2ae20
movq 0x28(%rsp), %rsi
leaq 0x90(%rsp), %rdi
callq 0x24e10
jmp 0x2ae34
leaq 0x7a(%rsp), %rdi
callq 0x27510
jmp 0x2ae40
xorl %eax, %eax
movl %eax, %ecx
leaq 0x60(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x7a(%rsp), %rdx
callq 0x25210
jmp 0x2ae5d
movq 0x30(%rsp), %rax
movq $0x0, 0x20(%rax)
movl $0x0, 0x54(%rsp)
movq 0x30(%rsp), %rcx
movl 0x54(%rsp), %eax
cmpl 0x38(%rcx), %eax
jge 0x2afc9
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x54(%rsp), %esi
callq 0x2b490
movq %rax, 0x20(%rsp)
jmp 0x2ae9d
movq 0x20(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x38(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x252e0
jmp 0x2aec2
movq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x27be0
movq %rax, 0x10(%rsp)
jmp 0x2aed8
movq 0x30(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, 0x20(%rax)
leaq 0x38(%rsp), %rdi
callq 0x253b0
movq 0x30(%rsp), %rcx
xorl %eax, %eax
cmpq 0x20(%rcx), %rax
je 0x2afb7
movq 0x30(%rsp), %rax
movl 0x54(%rsp), %ecx
movl %ecx, 0x3c(%rax)
movq 0x58(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x2b520
movl %eax, 0xc(%rsp)
jmp 0x2af22
movq 0x30(%rsp), %rax
movl 0xc(%rsp), %ecx
movl %ecx, 0x40(%rax)
jmp 0x2afc9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x2b041
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x2b034
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x2b02a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x2b020
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x253b0
jmp 0x2b020
jmp 0x2afb9
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x2ae72
movq 0x30(%rsp), %rcx
xorl %eax, %eax
cmpq 0x20(%rcx), %rax
je 0x2afe1
movq 0x30(%rsp), %rax
movb $0x1, 0x18(%rax)
jmp 0x2afea
movq 0x30(%rsp), %rax
movb $0x0, 0x18(%rax)
leaq 0x60(%rsp), %rdi
callq 0x253b0
leaq 0x7a(%rsp), %rdi
callq 0x24e40
leaq 0x90(%rsp), %rdi
callq 0x24e00
leaq 0xb0(%rsp), %rdi
callq 0x40c40
addq $0x108, %rsp            # imm = 0x108
retq
leaq 0x60(%rsp), %rdi
callq 0x253b0
leaq 0x7a(%rsp), %rdi
callq 0x24e40
leaq 0x90(%rsp), %rdi
callq 0x24e00
leaq 0xb0(%rsp), %rdi
callq 0x40c40
movq 0x88(%rsp), %rdi
callq 0x8820
nopl (%rax,%rax)