// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::fillEntryToSlice()
void SegLatencyFriendly::fillEntryToSlice() {
    uint32_t head_pos = SegBase::SizeOfSegOnDisk();
    int vol_id = vol_->GetId();

    for (list<KVSlice *>::iterator iter = sliceList_.begin(); iter
            != sliceList_.end(); iter++) {
        KVSlice *slice = *iter;
        slice->SetSegId(segId_);

        uint32_t data_offset = head_pos + IndexManager::SizeOfDataHeader() + slice->GetKeyLen();
        uint32_t next_offset = head_pos + IndexManager::SizeOfDataHeader() + slice->GetKeyLen() + slice->GetDataLen();
        DataHeader data_header(slice->GetDigest(), slice->GetKeyLen(), slice->GetDataLen(),
                               data_offset, next_offset);
        uint64_t seg_offset = 0;
        vol_->CalcSegOffsetFromId(segId_, seg_offset);
        uint64_t header_offset = seg_offset + head_pos;

        DataHeaderAddress addrs(vol_id, header_offset);
        HashEntry hash_entry(data_header, addrs, NULL);
        slice->SetHashEntry(&hash_entry);

        head_pos += IndexManager::SizeOfDataHeader() + slice->GetKeyLen() + slice->GetDataLen();
        __DEBUG("SegmentSlice: key=%s, data_offset=%u, header_offset=%lu, seg_id=%u, head_pos=%u", slice->GetKey(), data_offset, header_offset, segId_, head_pos);
    }

    if (head_pos != headPos_ ) {
        __ERROR("Segment fillEntryToSlice  Failed!!! head_pos= %u, headPos_=%u", head_pos, headPos_);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movzwl 0x28(%rax), %eax
movw %ax, 0xc(%rsp)
leaq 0x28(%rdi), %r13
pushq $0x20
popq %r14
leaq 0x38(%rsp), %r15
leaq 0x20(%rsp), %r12
movq %r13, 0x18(%rsp)
movq (%r13), %r13
cmpq 0x18(%rsp), %r13
je 0x1979f
movq 0x10(%r13), %rbp
movl 0x10(%rbx), %eax
movl %eax, 0x30(%rbp)
movzwl 0x8(%rbp), %edx
leal (%r14,%rdx), %eax
leal 0x20(%r14,%rdx), %r8d
movzwl 0x18(%rbp), %ecx
leal 0x20(%rcx,%rax), %r9d
movq 0x20(%rbp), %rsi
movq %r15, %rdi
callq 0xe350
movq (%rbx), %rcx
movl 0x10(%rbx), %eax
cmpl %eax, 0x3c(%rcx)
jbe 0x1973a
movb 0x40(%rcx), %cl
shlq %cl, %rax
jmp 0x1973c
xorl %eax, %eax
movl %r14d, %r14d
addq %r14, %rax
movzwl 0xc(%rsp), %ecx
movw %cx, 0xe(%rsp)
movq %rax, 0x10(%rsp)
movq %r12, %rdi
movq %r15, %rsi
leaq 0xe(%rsp), %rdx
xorl %ecx, %ecx
callq 0xe56a
movq %rbp, %rdi
movq %r12, %rsi
callq 0x1867e
movzwl 0x8(%rbp), %eax
movzwl 0x18(%rbp), %ecx
addq %rcx, %r14
addq %rax, %r14
addq $0x20, %r14
movq %r12, %rdi
callq 0xe636
leaq 0xe(%rsp), %rdi
callq 0xe398
movq %r15, %rdi
callq 0xe38c
jmp 0x196ec
cmpl %r14d, 0x18(%rbx)
jne 0x197b4
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1881d(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0x5ada(%rip), %rsi      # 0x1f2a5
leaq 0x78a8(%rip), %rcx      # 0x2107a
leaq 0x7878(%rip), %r8       # 0x21051
movq %r15, %rdi
movq %rax, %rdx
movl $0x29b, %r9d            # imm = 0x29B
xorl %eax, %eax
callq 0x6580
movq (%r12), %rdi
movl 0x18(%rbx), %ecx
leaq 0x78ec(%rip), %rsi      # 0x210e6
movl %r14d, %edx
xorl %eax, %eax
callq 0x6580
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
jmp 0x197a5
movq %rax, %rbx
jmp 0x19824
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xe636
leaq 0xe(%rsp), %rdi
callq 0xe398
leaq 0x38(%rsp), %rdi
callq 0xe38c
movq %rbx, %rdi
callq 0x6680