LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/./src/include/LRUMap.h
// Function: dslab::LRUMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::Get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool LRUMap<K,D>::Get(K key, D& data){
    Node<K,D> *node = cached_map[key];
    if(node){
        detach(node);
        attach(node);
        data = node->data;
	return true;
    }
    else{
        data = D();
	return false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r14
addq $0x8, %rdi
callq 0x190c6
movq (%rax), %r15
testq %r15, %r15
je 0x18e36
movq 0x40(%r15), %rax
movq 0x48(%r15), %rcx
movq %rcx, 0x48(%rax)
movq 0x48(%r15), %rcx
movq %rax, 0x40(%rcx)
movq 0x58(%r14), %rax
movq %rax, 0x40(%r15)
movq 0x48(%rax), %rcx
movq %rcx, 0x48(%r15)
movq %r15, 0x48(%rax)
movq 0x48(%r15), %rax
movq %r15, 0x40(%rax)
leaq 0x20(%r15), %rsi
movq %rbx, %rdi
callq 0x6250
jmp 0x18e6b
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x64b0
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x18e6b
callq 0x6400
testq %r15, %r15
setne %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/./src/include/LRUMap.h
// Function: dslab::LRUMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::Delete(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool LRUMap<K,D>::Delete(K key){
    Node<K,D> *node = cached_map[key];
    if(node){
        detach(node);
	free_entries.push_back(node);
	cached_map.erase(node->key);
	return true;
    }
    else{
	return false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x8(%rdi), %rbx
movq %rbx, %rdi
callq 0x190c6
movq (%rax), %r15
movq %r15, 0x8(%rsp)
testq %r15, %r15
je 0x18ee9
movq 0x40(%r15), %rax
movq 0x48(%r15), %rcx
movq %rcx, 0x48(%rax)
movq 0x48(%r15), %rcx
movq %rax, 0x40(%rcx)
movq 0x48(%r14), %rsi
cmpq 0x50(%r14), %rsi
je 0x18ecb
movq %r15, (%rsi)
addq $0x8, 0x48(%r14)
jmp 0x18edc
addq $0x40, %r14
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x1960a
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x19500
testq %r15, %r15
setne %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::KVSlice::~KVSlice()
KVSlice::~KVSlice() {
    if (deepCopy_) {
        delete[] key_;
        delete[] data_;
    }
    if (digest_) {
        delete digest_;
    }
    if (entry_) {
        delete entry_;
    }
    if (entryGC_) {
        delete entryGC_;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x34(%rdi)
jne 0x1b7a8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1b79a
callq 0x64e0
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x1b7a8
callq 0x64e0
movq 0x20(%rbx), %r14
testq %r14, %r14
je 0x1b7c1
movq %r14, %rdi
callq 0x12bdc
movq %r14, %rdi
callq 0x6400
movq 0x28(%rbx), %r14
testq %r14, %r14
je 0x1b7da
movq %r14, %rdi
callq 0x11066
movq %r14, %rdi
callq 0x6400
movq 0x38(%rbx), %rbx
testq %rbx, %rbx
je 0x1b7fa
movq %rbx, %rdi
callq 0x11066
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6400
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::KVSlice::copy_helper(hlkvds::KVSlice const&)
void KVSlice::copy_helper(const KVSlice& toBeCopied) {
    keyLength_ = toBeCopied.GetKeyLen();
    dataLength_ = toBeCopied.GetDataLen();
    key_ = toBeCopied.GetKey();
    data_ = toBeCopied.GetData();
    *digest_ = *toBeCopied.digest_;
    *entry_ = *toBeCopied.entry_;
    segId_ = toBeCopied.segId_;
    deepCopy_ = toBeCopied.deepCopy_;
    *entryGC_ = *toBeCopied.entryGC_;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzwl 0x8(%rsi), %eax
movl %eax, 0x8(%rdi)
movzwl 0x18(%rsi), %eax
movw %ax, 0x18(%rdi)
movq (%rsi), %rax
movq %rax, (%rdi)
movq 0x10(%rsi), %rax
movq %rax, 0x10(%rdi)
movq 0x20(%rsi), %rsi
movq 0x20(%rdi), %rdi
callq 0x12bde
movq 0x28(%rbx), %rsi
movq 0x28(%r14), %rdi
callq 0x1112a
movl 0x30(%rbx), %eax
movl %eax, 0x30(%r14)
movb 0x34(%rbx), %al
movb %al, 0x34(%r14)
movq 0x38(%rbx), %rsi
movq 0x38(%r14), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1112a
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::KVSlice::KVSlice(char const*, int, char const*, int, bool)
KVSlice::KVSlice(const char* key, int key_len, const char* data, int data_len, bool deep_copy) :
    key_(NULL), keyLength_(key_len), data_(NULL), dataLength_(data_len),
            digest_(NULL), entry_(NULL), segId_(0), deepCopy_(deep_copy),
            entryGC_(NULL) {
    if (deepCopy_) {
        key_ = new char[key_len];
        data_ = new char[data_len];
        memcpy((void*)key_, key, key_len);
        memcpy((void*)data_, data, data_len);
    } else {
        key_ = key;
        data_ = data;
    }
    calcDigest();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, (%rdi)
movl %edx, 0x8(%rdi)
movq %rax, 0x10(%rdi)
movw %bp, 0x18(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movl $0x0, 0x30(%rdi)
movb %r9b, 0x34(%rdi)
movq %rax, 0x38(%rdi)
testl %r9d, %r9d
je 0x1b93f
movslq %edx, %r12
testl %edx, %edx
movq $-0x1, %r13
movq %r12, %rdi
cmovsq %r13, %rdi
movq %rcx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
callq 0x6040
movq %rax, %r14
movq %rax, (%rbx)
movslq %ebp, %r15
testl %ebp, %ebp
cmovnsq %r15, %r13
movq %r13, %rdi
callq 0x6040
movq %rax, %r13
movq %rax, 0x10(%rbx)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
callq 0x6390
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x6390
jmp 0x1b946
movq %rsi, (%rbx)
movq %rcx, 0x10(%rbx)
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1b95c
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::KVSlice::calcDigest()
void KVSlice::calcDigest() {
    if (digest_) {
        delete digest_;
        digest_=nullptr;
    }
    digest_ = new Kvdb_Digest();
    Kvdb_Key vkey(key_, keyLength_);
    KeyDigestHandle::CalcDigest(&vkey, *digest_);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %r14
testq %r14, %r14
je 0x1b987
movq %r14, %rdi
callq 0x12bdc
movq %r14, %rdi
callq 0x6400
movq $0x0, 0x20(%rbx)
movl $0x14, %edi
callq 0x6420
movq %rax, %r14
movq %rax, %rdi
callq 0x12bc0
movq %r14, 0x20(%rbx)
movq (%rbx), %rsi
movl 0x8(%rbx), %edx
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x12baa
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x12c2c
leaq 0xc(%rsp), %rdi
callq 0x12ba8
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0xc(%rsp), %rdi
callq 0x12ba8
jmp 0x1b9eb
movq %rax, %rbx
movq %r14, %rdi
callq 0x6400
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::Request::operator=(hlkvds::Request const&)
Request& Request::operator=(const Request& toBeCopied) {
    done_ = toBeCopied.done_;
    stat_ = toBeCopied.stat_;
    slice_ = toBeCopied.slice_;
    segPtr_ = toBeCopied.segPtr_;
    return *this;
}

// Assembly:
movq %rdi, %rax
movb (%rsi), %cl
movb %cl, (%rdi)
movl 0x4(%rsi), %ecx
movl %ecx, 0x4(%rdi)
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%rdi)
movq 0x68(%rsi), %rcx
movq %rcx, 0x68(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::copyHelper(hlkvds::SegBase const&)
void SegBase::copyHelper(const SegBase& toBeCopied) {
    segId_ = toBeCopied.segId_;
    vol_ = toBeCopied.vol_;
    segSize_ = toBeCopied.segSize_;
    headPos_ = toBeCopied.headPos_;
    tailPos_ = toBeCopied.tailPos_;
    keyNum_ = toBeCopied.keyNum_;
    keyAlignedNum_ = toBeCopied.keyAlignedNum_;
    memcpy(dataBuf_, toBeCopied.dataBuf_, segSize_);
    sliceList_ = toBeCopied.sliceList_;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %eax
movl %eax, (%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
movslq 0x10(%rsi), %rdx
movups 0x10(%rsi), %xmm0
movups %xmm0, 0x10(%rdi)
movl 0x20(%rsi), %eax
movl %eax, 0x20(%rdi)
movq 0x40(%rdi), %rdi
movq 0x40(%rsi), %rsi
callq 0x6390
cmpq %rbx, %r14
je 0x1bde4
addq $0x28, %r14
movq 0x28(%rbx), %rsi
addq $0x28, %rbx
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1cfba
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::Put(hlkvds::KVSlice*)
void SegBase::Put(KVSlice* slice) {
    if (slice->IsAlignedData()) {
        headPos_ += IndexManager::SizeOfDataHeader() + slice->GetKeyLen();
        tailPos_ -= ALIGNED_SIZE;
        keyAlignedNum_++;
    } else {
        headPos_ += IndexManager::SizeOfDataHeader() + slice->GetKeyLen() + slice->GetDataLen();
    }
    keyNum_++;
    sliceList_.push_back(slice);
    __DEBUG("Put request key = %s", slice->GetKeyStr().c_str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movzwl 0x18(%rsi), %ecx
movzwl 0x8(%rsi), %edx
movl 0x14(%rdi), %eax
cmpl $0x1000, %ecx           # imm = 0x1000
jne 0x1be7c
addl %edx, %eax
addl $0x20, %eax
movl %eax, 0x14(%rbx)
addl $0xfffff000, 0x18(%rbx) # imm = 0xFFFFF000
incl 0x20(%rbx)
jmp 0x1be86
addl %edx, %ecx
addl %ecx, %eax
addl $0x20, %eax
movl %eax, 0x14(%rbx)
incl 0x1c(%rbx)
leaq 0x28(%rbx), %r15
movl $0x18, %edi
callq 0x6420
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x6080
incq 0x38(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::TryPutList(std::__cxx11::list<hlkvds::KVSlice*, std::allocator<hlkvds::KVSlice*>>&)
bool SegBase::TryPutList(std::list<KVSlice*> &slice_list) {
    uint32_t freeSize = tailPos_ - headPos_;
    uint32_t needSize = 0;
    for (list<KVSlice *>::iterator iter = slice_list.begin(); iter != slice_list.end(); iter++) {
        KVSlice *slice = *iter;
        needSize += slice->GetDataLen() + slice->GetKeyLen() + IndexManager::SizeOfDataHeader();
    }
    return freeSize > needSize;

}

// Assembly:
movl 0x14(%rdi), %eax
movl 0x18(%rdi), %ecx
movq (%rsi), %rdi
xorl %edx, %edx
cmpq %rsi, %rdi
je 0x1bee0
movq 0x10(%rdi), %r8
movq (%rdi), %r9
movzwl 0x18(%r8), %edi
addl %edx, %edi
movzwl 0x8(%r8), %edx
addl %edi, %edx
addl $0x20, %edx
movq %r9, %rdi
cmpq %rsi, %r9
jne 0x1bec0
subl %eax, %ecx
cmpl %edx, %ecx
seta %al
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::WriteSegToDevice()
bool SegBase::WriteSegToDevice() {
    if (segId_ < 0)
    {
        __ERROR("Not set seg_id to segment");
        return false;
    }
    fillEntryToSlice();
    __DEBUG("Begin write seg, free size %u, seg id: %d, key num: %d", tailPos_-headPos_ , segId_, keyNum_);
    return _writeDataToDevice();
}

// Assembly:
pushq %rbx
cmpl $0x0, (%rdi)
js 0x1bf2d
movq %rdi, %rbx
callq 0x1bf36
movq %rbx, %rdi
popq %rbx
jmp 0x1c140
callq 0x8602
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::_writeDataToDevice()
bool SegBase::_writeDataToDevice() {
    posix_memalign((void **)&dataBuf_, 4096, segSize_);

    copyToDataBuf();
    uint64_t offset = 0;
    vol_->CalcSegOffsetFromId(segId_, offset);

    bool ret = vol_->Write(dataBuf_, segSize_, offset);

    free(dataBuf_);
    dataBuf_ = NULL;

    return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x40, %rdi
movslq 0x10(%rbx), %rdx
movl $0x1000, %esi           # imm = 0x1000
callq 0x6200
movq %rbx, %rdi
callq 0x1c1a2
movq 0x8(%rbx), %rdi
movl (%rbx), %eax
cmpl %eax, 0x3c(%rdi)
jbe 0x1c173
movb 0x40(%rdi), %cl
shlq %cl, %rax
jmp 0x1c175
xorl %eax, %eax
movq 0x40(%rbx), %rsi
movslq 0x10(%rbx), %rdx
movq %rax, %rcx
callq 0x20d32
movl %eax, %ebp
movq 0x40(%rbx), %rdi
callq 0x6490
movq $0x0, 0x40(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::operator=(hlkvds::SegForReq const&)
SegForReq& SegForReq::operator=(const SegForReq& toBeCopied) {
    if (this == &toBeCopied) {
        return *this;
    }

    SegBase::operator=(toBeCopied);
    idxMgr_ = toBeCopied.idxMgr_;
    timeout_ = toBeCopied.timeout_;
    startTime_ = toBeCopied.startTime_;
    persistTime_ = toBeCopied.persistTime_;
    isCompletion_ = toBeCopied.isCompletion_;
    hasReq_ = toBeCopied.hasReq_;
    reqCommited_.store(toBeCopied.reqCommited_.load());
    reqList_ = toBeCopied.reqList_;
    delReqList_ = toBeCopied.delReqList_;
    return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x1c561
movq %rsi, %r14
movq %rbx, %rdi
callq 0x1bd8c
movq 0x48(%r14), %rax
movq %rax, 0x48(%rbx)
movl 0x50(%r14), %eax
movl %eax, 0x50(%rbx)
leaq 0x58(%r14), %rsi
leaq 0x58(%rbx), %rdi
callq 0x20a04
leaq 0x68(%r14), %rsi
leaq 0x68(%rbx), %rdi
callq 0x20a04
movb 0x78(%r14), %al
movb %al, 0x78(%rbx)
movb 0x79(%r14), %al
movb %al, 0x79(%rbx)
movl 0x7c(%r14), %eax
xchgl %eax, 0x7c(%rbx)
movl $0x80, %edi
leaq (%r14,%rdi), %rdx
addq %rbx, %rdi
movq 0x80(%r14), %rsi
callq 0x1d15c
movl $0xc0, %edi
leaq (%r14,%rdi), %rdx
addq %rbx, %rdi
movq 0xc0(%r14), %rsi
callq 0x1d2fe
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::TryPut(hlkvds::Request*)
bool SegForReq::TryPut(Request* req) {
    if (isCompletion_) {
        return false;
    }
    KVSlice *slice= &req->GetSlice();
    return SegBase::TryPut(slice);
}

// Assembly:
cmpb $0x0, 0x78(%rdi)
je 0x1c65f
xorl %eax, %eax
retq
movq 0x8(%rsi), %rax
movl 0x18(%rdi), %ecx
subl 0x14(%rdi), %ecx
movzwl 0x18(%rax), %edx
movzwl 0x8(%rax), %eax
addl %edx, %eax
addl $0x20, %eax
cmpl %eax, %ecx
seta %al
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::Put(hlkvds::Request*)
void SegForReq::Put(Request* req) {
    KVSlice *slice = &req->GetSlice();
    if (GetKeyNum() == 0) {
        hasReq_ = true;
        startTime_.Update();
    }
    SegBase::Put(slice);
    reqList_.push_back(req);
    req->SetSeg(this);
    __DEBUG("Put request key = %s", req->GetSlice().GetKeyStr().c_str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %r15
cmpl $0x0, 0x1c(%rdi)
jne 0x1c69f
movb $0x1, 0x79(%r14)
leaq 0x58(%r14), %rdi
callq 0x209ec
movq %r14, %rdi
movq %r15, %rsi
callq 0x1be4a
leaq 0x80(%r14), %r15
movl $0x18, %edi
callq 0x6420
movq %rbx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x6080
incq 0x90(%r14)
movq %r14, 0x68(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::Notify(bool)
void SegForReq::Notify(bool stat) {
    std::lock_guard < std::mutex > l(mtx_);

    //Set logic timestamp to hashentry
    reqCommited_.store(GetKeyNum());

    int32_t keyNo = 0;
    persistTime_.Update();
    for (list<Request *>::iterator iter = reqList_.begin(); iter
            != reqList_.end(); iter++) {
        keyNo++;
        KVSlice *slice = &(*iter)->GetSlice();
        HashEntry &entry = slice->GetHashEntry();
        entry.SetLogicStamp(persistTime_, keyNo);

        if (!slice->GetData()) {
            delReqList_.push_back(entry);
        }
    }

    //notify and clean req.
    while (!reqList_.empty()) {
        Request *req = reqList_.front();
        reqList_.pop_front();
        req->SetWriteStat(stat);
        req->Signal();
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, 0xc(%rsp)
movq %rdi, %r14
leaq 0x98(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1c822
movq %rbx, 0x10(%rsp)
movl 0x1c(%r14), %eax
xchgl %eax, 0x7c(%r14)
leaq 0x68(%r14), %rdi
movq %rdi, 0x20(%rsp)
callq 0x209ec
leaq 0x80(%r14), %rbp
movq %r14, (%rsp)
movq 0x80(%r14), %r15
cmpq %rbp, %r15
je 0x1c800
movq (%rsp), %rax
addq $0xc0, %rax
movq %rax, 0x18(%rsp)
movl $0x1, %r13d
leaq 0x28(%rsp), %rbx
movq 0x10(%r15), %rax
movq 0x8(%rax), %r14
movq 0x28(%r14), %r12
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x209fc
movq %r12, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x111aa
movq %rbx, %rdi
callq 0x20a7a
cmpq $0x0, 0x10(%r14)
jne 0x1c7bf
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x1d498
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x6080
movq (%rsp), %rax
incq 0xd0(%rax)
movq (%r15), %r15
incl %r13d
cmpq %rbp, %r15
jne 0x1c764
jmp 0x1c800
movq 0x10(%r15), %rbx
movq (%rsp), %rax
decq 0x90(%rax)
movq %r15, %rdi
callq 0x6620
movq %r15, %rdi
callq 0x6400
movzbl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x1bc1a
movq %rbx, %rdi
callq 0x1bca6
movq (%rbp), %r15
cmpq %rbp, %r15
jne 0x1c7cc
movq 0x10(%rsp), %rdi
callq 0x6360
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
jmp 0x1c83c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x20a7a
jmp 0x1c83f
jmp 0x1c83c
movq %rax, %rbx
movq 0x10(%rsp), %rdi
callq 0x6360
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::IsExpired()
bool SegForReq::IsExpired() {
    KVTime nowTime;
    if (!hasReq_) {
        return false;
    }
    int64_t interval = nowTime - startTime_;
    return (interval > timeout_);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x209f4
cmpb $0x1, 0x79(%rbx)
jne 0x1c87f
leaq 0x58(%rbx), %rsi
movq %rsp, %rdi
callq 0x20a60
movl 0x50(%rbx), %ecx
cmpq %rcx, %rax
setg %bl
jmp 0x1c881
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x20a7a
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20a7a
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::CleanDeletedEntry()
void SegForReq::CleanDeletedEntry() {
    std::lock_guard < std::mutex > l(mtx_);
    for (list<HashEntry>::iterator iter = delReqList_.begin(); iter
            != delReqList_.end(); iter++) {
        idxMgr_->RemoveEntry(*iter);
    }
    delReqList_.clear();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x98(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1c942
leaq 0xc0(%r14), %r15
movq 0xc0(%r14), %rbp
cmpq %r15, %rbp
je 0x1c90a
movq %rsp, %r12
movq 0x48(%r14), %r13
leaq 0x10(%rbp), %rsi
movq %r12, %rdi
callq 0x11000
movq %r13, %rdi
movq %r12, %rsi
callq 0x11aba
movq %r12, %rdi
callq 0x11066
movq (%rbp), %rbp
cmpq %r15, %rbp
jne 0x1c8de
movq %r15, %rdi
callq 0x1cf88
movq %r15, 0xc8(%r14)
movq %r15, 0xc0(%r14)
movq $0x0, 0xd0(%r14)
movq %rbx, %rdi
callq 0x6360
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
movq %rax, %r14
jmp 0x1c959
movq %rax, %r14
movq %rsp, %rdi
callq 0x11066
movq %rbx, %rdi
callq 0x6360
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForSlice::operator=(hlkvds::SegForSlice const&)
SegForSlice& SegForSlice::operator=(const SegForSlice& toBeCopied) {
    if (this == &toBeCopied) {
        return *this;
    }
    SegBase::operator=(toBeCopied);
    idxMgr_ = toBeCopied.idxMgr_;
    return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x1c9d5
movq %rsi, %r14
movq %rbx, %rdi
callq 0x1bd8c
movq 0x48(%r14), %rax
movq %rax, 0x48(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForMigrate::operator=(hlkvds::SegForMigrate const&)
SegForMigrate& SegForMigrate::operator=(const SegForMigrate& toBeCopied) {
    if (this == &toBeCopied) {
        return *this;
    }
    SegBase::operator=(toBeCopied);
    idxMgr_ = toBeCopied.idxMgr_;
    return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x1ca75
movq %rsi, %r14
movq %rbx, %rdi
callq 0x1bd8c
movq 0x48(%r14), %rax
movq %rax, 0x48(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::Put(hlkvds::KVSlice*)
void SegLatencyFriendly::Put(KVSlice* slice) {
    headPos_ += IndexManager::SizeOfDataHeader() + slice->GetKeyLen() + slice->GetDataLen();
    keyNum_++;
    sliceList_.push_back(slice);
    __DEBUG("Put request key = %s", slice->GetKeyStr().c_str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movzwl 0x8(%rsi), %eax
movzwl 0x18(%rsi), %ecx
leal 0x20(%rax,%rcx), %eax
movd %eax, %xmm0
movq 0x18(%rdi), %xmm1
movaps 0x744f(%rip), %xmm2     # 0x24040
movss %xmm0, %xmm2            # xmm2 = xmm0[0],xmm2[1,2,3]
paddd %xmm1, %xmm2
movq %xmm2, 0x18(%rdi)
leaq 0x28(%rdi), %r15
movl $0x18, %edi
callq 0x6420
movq %rbx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x6080
incq 0x38(%r14)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::TryPutList(std::__cxx11::list<hlkvds::KVSlice*, std::allocator<hlkvds::KVSlice*>>&)
bool SegLatencyFriendly::TryPutList(std::list<KVSlice*> &slice_list) {
    uint32_t free_size = segSize_ - headPos_;
    uint32_t need_size = 0;
    for (list<KVSlice *>::iterator iter = slice_list.begin(); iter != slice_list.end(); iter++) {
        KVSlice *slice = *iter;
        need_size += slice->GetDataLen() + slice->GetKeyLen() + IndexManager::SizeOfDataHeader();
    }
    return free_size > need_size;
}

// Assembly:
movl 0x14(%rdi), %eax
movl 0x18(%rdi), %ecx
movq (%rsi), %rdi
xorl %edx, %edx
cmpq %rsi, %rdi
je 0x1cc56
movq 0x10(%rdi), %r8
movq (%rdi), %r9
movzwl 0x18(%r8), %edi
addl %edx, %edi
movzwl 0x8(%r8), %edx
addl %edi, %edx
addl $0x20, %edx
movq %r9, %rdi
cmpq %rsi, %r9
jne 0x1cc36
subl %ecx, %eax
cmpl %edx, %eax
seta %al
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
leaq 0x28(%rdi), %rax
movq 0x28(%rdi), %r12
movq %rax, 0x18(%rsp)
cmpq %rax, %r12
je 0x1cdaa
movq (%rbx), %rax
movzwl 0x28(%rax), %eax
movw %ax, 0xc(%rsp)
movl $0x20, %r13d
leaq 0x38(%rsp), %r14
leaq 0x20(%rsp), %r15
movq 0x10(%r12), %rbp
movl 0x10(%rbx), %eax
movl %eax, 0x30(%rbp)
movzwl 0x8(%rbp), %eax
leal (%rax,%r13), %ecx
leal 0x20(%r13,%rax), %r8d
movzwl 0x18(%rbp), %eax
leal 0x20(%rax,%rcx), %r9d
movq 0x20(%rbp), %rsi
movzwl 0x8(%rbp), %edx
movzwl 0x18(%rbp), %ecx
movq %r14, %rdi
callq 0x10d26
movq (%rbx), %rcx
movl 0x10(%rbx), %eax
cmpl %eax, 0x3c(%rcx)
jbe 0x1cd39
movb 0x40(%rcx), %cl
shlq %cl, %rax
jmp 0x1cd3b
xorl %eax, %eax
movl %r13d, %r13d
addq %r13, %rax
movzwl 0xc(%rsp), %ecx
movw %cx, 0xe(%rsp)
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0xe(%rsp), %rdx
xorl %ecx, %ecx
callq 0x10f8c
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1bab2
movzwl 0x8(%rbp), %eax
movzwl 0x18(%rbp), %ecx
addq %rcx, %r13
addq %rax, %r13
addq $0x20, %r13
movq %r15, %rdi
callq 0x11066
leaq 0xe(%rsp), %rdi
callq 0x10d6e
movq %r14, %rdi
callq 0x10d62
movq (%r12), %r12
cmpq 0x18(%rsp), %r12
jne 0x1ccf1
jmp 0x1cdb0
movl $0x20, %r13d
cmpl %r13d, 0x18(%rbx)
jne 0x1cdc5
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x18, %rbx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x874b
jmp 0x1cdb6
movq %rax, %rbx
jmp 0x1cde8
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x11066
leaq 0xe(%rsp), %rdi
callq 0x10d6e
leaq 0x38(%rsp), %rdi
callq 0x10d62
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::_writeDataToDevice()
bool SegLatencyFriendly::_writeDataToDevice() {
    checksumSize_ = headPos_ - SegBase::SizeOfSegOnDisk();
    uint32_t pages_num = headPos_ / getpagesize();
    uint32_t aligned_size = ( pages_num + 1 ) * getpagesize();

    posix_memalign((void**)&dataBuf_, 4096, aligned_size);

    copyToDataBuf();
    uint64_t offset = 0;
    vol_->CalcSegOffsetFromId(segId_, offset);

    bool ret = vol_->Write(dataBuf_, aligned_size, offset);

    free(dataBuf_);
    dataBuf_ = NULL;


    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r12
movl 0x18(%rdi), %ebx
leal -0x20(%rbx), %eax
movl %eax, 0x20(%rdi)
callq 0x66b0
movl %eax, %ecx
xorl %r15d, %r15d
movl %ebx, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %r14d
incl %r14d
imull %ecx, %r14d
leaq 0x40(%r12), %rbx
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq %r14, %rdx
callq 0x6200
movq %r12, %rdi
callq 0x1ce90
movq (%r12), %rdi
movl 0x10(%r12), %eax
cmpl %eax, 0x3c(%rdi)
jbe 0x1ce66
movb 0x40(%rdi), %cl
shlq %cl, %rax
movq %rax, %r15
movq (%rbx), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x20d32
movl %eax, %ebp
movq (%rbx), %rdi
callq 0x6490
movq $0x0, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::copyToDataBuf()
void SegLatencyFriendly::copyToDataBuf() {
    uint64_t offset = 0;
    vol_->CalcSegOffsetFromId(segId_, offset);

    uint32_t offset_begin = 0;

    offset_begin += SegBase::SizeOfSegOnDisk();

    //aggregate iovec
    for (list<KVSlice *>::iterator iter = sliceList_.begin(); iter
            != sliceList_.end(); iter++) {
        KVSlice *slice = *iter;
        DataHeader *header =
                &slice->GetHashEntry().GetEntryOnDisk().GetDataHeader();
        char *data = (char *) slice->GetData();
        uint16_t data_len = slice->GetDataLen();

        char *key = (char *) slice->GetKey();
        uint16_t key_len = slice->GetKeyLen();
        memcpy(&(dataBuf_[offset_begin]), header, IndexManager::SizeOfDataHeader());
        __DEBUG("write key = %s, seg_id: %u, header offset: %u", slice->GetKey(), segId_, offset_begin);
        offset_begin += IndexManager::SizeOfDataHeader();
        memcpy(&(dataBuf_[offset_begin]), key, key_len);
        __DEBUG("write key = %s, key offset: %u", slice->GetKey(), offset_begin);
        offset_begin += key_len;
        memcpy(&(dataBuf_[offset_begin]), data, data_len);
        __DEBUG("write key = %s, data position: %u", slice->GetKey(), offset_begin);
        offset_begin += data_len;
    }

    // Generate SegHeaderOnDisk
    uint64_t timestamp = KVTime::GetNow();
    uint64_t trx_id = 0;
    uint32_t trx_segs = 0;
    uint32_t checksum_data = 0;
    SegHeaderOnDisk seg_header(timestamp, trx_id, trx_segs, checksum_data, checksumSize_, keyNum_);
    memcpy(dataBuf_, &seg_header, SegBase::SizeOfSegOnDisk());

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x28(%rdi), %rax
movq 0x28(%rdi), %rbp
cmpq %rax, %rbp
je 0x1cf26
movl $0x20, %r13d
movq %rax, 0x10(%rsp)
movq 0x10(%rbp), %rax
movq 0x28(%rax), %rcx
movq (%rcx), %rcx
movq (%rax), %rsi
movq 0x10(%rax), %r15
movzwl 0x18(%rax), %r14d
movzwl 0x8(%rax), %r12d
movq 0x40(%rbx), %rax
movl %r13d, %edx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax,%rdx)
movups %xmm0, (%rax,%rdx)
leal 0x20(%r13), %edi
addq 0x40(%rbx), %rdi
movq %r12, %rdx
callq 0x6390
addl %r12d, %r13d
addl $0x20, %r13d
movq 0x40(%rbx), %rdi
addq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6390
movq 0x10(%rsp), %rax
addl %r14d, %r13d
movq (%rbp), %rbp
cmpq %rax, %rbp
jne 0x1ceb9
callq 0x20990
movl 0x1c(%rbx), %ecx
movl 0x20(%rbx), %r9d
movl %ecx, (%rsp)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1b744
movq 0x40(%rbx), %rax
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq %r14, %rdi
callq 0x1b720
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Get(char*, unsigned long)
bool SegmentManager::Get(char* buf, uint64_t length) {
    uint64_t stat_size = SegmentManager::SizeOfSegmentStat();
    uint64_t stat_table_size = stat_size * segNum_;
    if (length != stat_table_size) {
        return false;
    }
    char *buf_ptr = buf;
    for (uint32_t seg_idx = 0; seg_idx < segNum_; seg_idx++) {
        if (segTable_[seg_idx].state != SegUseStat::RESERVED) {
            memcpy((void *)buf_ptr, (const void *)&segTable_[seg_idx], stat_size);
        } else {
            __WARN("Segment Maybe not write to device! seg_id = %d", seg_idx);
        }
        buf_ptr += stat_size;
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl 0x20(%rdi), %eax
testq %rax, %rax
sete %cl
shlq $0x2, %rax
leaq (%rax,%rax,2), %r13
cmpq %rdx, %r13
setne %al
orb %cl, %al
jne 0x1d544
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
xorl %r12d, %r12d
movq (%r15), %rax
cmpl $0x2, (%rax,%rbp)
je 0x1d53a
leaq (%r14,%rbp), %rcx
addq %rbp, %rax
movl 0x8(%rax), %edx
movl %edx, 0x8(%rcx)
movq (%rax), %rax
movq %rax, (%rcx)
incq %r12
movl 0x20(%r15), %eax
addq $0xc, %rbp
cmpq %rax, %r12
jb 0x1d50c
jmp 0x1d544
movq %r12, %rdi
callq 0x87bf
jmp 0x1d528
cmpq %rbx, %r13
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Set(char*, unsigned long)
bool SegmentManager::Set(char* buf, uint64_t length) {
    uint64_t stat_size = SegmentManager::SizeOfSegmentStat();
    uint64_t stat_table_size = stat_size * segNum_;
    if (length != stat_table_size) {
        return false;
    }
    char* buf_ptr = buf;
    for (uint32_t seg_idx = 0; seg_idx < segNum_; seg_idx++) {
        SegmentStat seg_stat;
        memcpy((void *)&seg_stat, (const void *)buf_ptr, stat_size);
        if (seg_stat.state == SegUseStat::USED) {
            usedCounter_++;
            freedCounter_--;
        }
        segTable_.push_back(seg_stat);
        buf_ptr += stat_size;
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movl 0x20(%rdi), %eax
testq %rax, %rax
sete %cl
shlq $0x2, %rax
leaq (%rax,%rax,2), %r13
cmpq %rdx, %r13
setne %al
orb %cl, %al
jne 0x1d5e4
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
movq $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl 0x8(%r14), %eax
movl %eax, 0x10(%rsp)
movq (%r14), %rax
movq %rax, 0x8(%rsp)
cmpl $0x1, %eax
jne 0x1d5cd
movq 0x28(%r15), %xmm0
paddd 0x6b79(%rip), %xmm0     # 0x24140
movq %xmm0, 0x28(%r15)
movq %r15, %rdi
movq %r12, %rsi
callq 0x1db14
addq $0xc, %r14
incl %ebp
cmpl 0x20(%r15), %ebp
jb 0x1d593
cmpq %rbx, %r13
sete %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Alloc(unsigned int&)
bool SegmentManager::Alloc(uint32_t& seg_id) {
    std::unique_lock <std::mutex> l(mtx_);
    if (freedCounter_ <= SEG_RESERVED_FOR_GC) {
        return false;
    }

    l.unlock();
    return AllocForGC(seg_id);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x40(%rdi), %rax
movq %rsp, %r15
movq %rax, (%r15)
movb $0x0, 0x8(%r15)
movq %r15, %rdi
callq 0xe40a
movb $0x1, 0x8(%r15)
cmpl $0x3, 0x2c(%r14)
jae 0x1d630
xorl %ebx, %ebx
jmp 0x1d645
movq %rsp, %rdi
callq 0xe446
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1d66c
movl %eax, %ebx
movq %rsp, %rdi
callq 0xdf86
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0xdf86
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::AllocForGC(unsigned int&)
bool SegmentManager::AllocForGC(uint32_t& seg_id) {
    //for first use !!
    std::lock_guard <std::mutex> l(mtx_);
    if (segTable_[curSegId_].state == SegUseStat::FREE) {
        seg_id = curSegId_;
        segTable_[curSegId_].state = SegUseStat::RESERVED;

        reservedCounter_++;
        freedCounter_--;
        return true;
    }

    uint32_t seg_index = curSegId_ + 1;

    while (seg_index != curSegId_) {
        if (seg_index == segNum_) {
            seg_index = 0;
        }
        if (segTable_[seg_index].state == SegUseStat::FREE) {
            seg_id = seg_index;
            // set seg used
            curSegId_ = seg_id;
            segTable_[curSegId_].state = SegUseStat::RESERVED;

            reservedCounter_++;
            freedCounter_--;
            return true;
        }
        seg_index++;
    }
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
leaq 0x40(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1d70e
movl 0x24(%r14), %ecx
movq (%r14), %rax
leaq (%rcx,%rcx,2), %rdx
cmpl $0x0, (%rax,%rdx,4)
je 0x1d6cd
movl 0x20(%r14), %esi
xorl %edi, %edi
movl %ecx, %edx
incl %edx
cmpl %ecx, %edx
setne %bpl
je 0x1d6f9
cmpl %esi, %edx
cmovel %edi, %edx
leaq (%rdx,%rdx,2), %r8
cmpl $0x0, (%rax,%r8,4)
jne 0x1d6a6
leaq (%rax,%r8,4), %rax
movl %edx, (%r15)
movl %edx, 0x24(%r14)
jmp 0x1d6dc
movl %ecx, (%r15)
movl 0x24(%r14), %ecx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,4), %rax
movl $0x2, (%rax)
movq 0x2c(%r14), %xmm0
paddd 0x6a60(%rip), %xmm0     # 0x24150
movq %xmm0, 0x2c(%r14)
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x6360
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::FreeForFailed(unsigned int)
void SegmentManager::FreeForFailed(uint32_t seg_id) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::FREE;
    segTable_[seg_id].free_size = 0;
    segTable_[seg_id].death_size = 0;

    reservedCounter_--;
    freedCounter_++;
    __DEBUG("Free Segment seg_id = %d", seg_id);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x40(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1d768
movl %ebp, %eax
movq (%r14), %rcx
leaq (%rax,%rax,2), %rax
movq $0x0, (%rcx,%rax,4)
movl $0x0, 0x8(%rcx,%rax,4)
movq 0x2c(%r14), %xmm0
paddd 0x69ea(%rip), %xmm0     # 0x24140
movq %xmm0, 0x2c(%r14)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6360
movl %eax, %edi
callq 0x62c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::FreeForGC(unsigned int)
void SegmentManager::FreeForGC(uint32_t seg_id) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::FREE;
    segTable_[seg_id].free_size = 0;
    segTable_[seg_id].death_size = 0;

    usedCounter_--;
    freedCounter_++;
    __DEBUG("Free Segment For GC, seg_id = %d", seg_id);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x40(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1d7c2
movl %ebp, %eax
movq (%r14), %rcx
leaq (%rax,%rax,2), %rax
movq $0x0, (%rcx,%rax,4)
movl $0x0, 0x8(%rcx,%rax,4)
movq 0x28(%r14), %xmm0
paddd 0x69a0(%rip), %xmm0     # 0x24150
movq %xmm0, 0x28(%r14)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6360
movl %eax, %edi
callq 0x62c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Use(unsigned int, unsigned int)
void SegmentManager::Use(uint32_t seg_id, uint32_t free_size) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::USED;
    segTable_[seg_id].free_size = free_size;

    reservedCounter_--;
    usedCounter_++;
    __DEBUG("Used Segment seg_id = %d, free_size = %d", seg_id, free_size);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
leaq 0x40(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1d818
movl %r15d, %eax
movq (%r14), %rcx
leaq (%rax,%rax,2), %rax
movl $0x1, (%rcx,%rax,4)
movl %ebp, 0x4(%rcx,%rax,4)
decl 0x30(%r14)
incl 0x28(%r14)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6360
movl %eax, %edi
callq 0x62c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::SortSegsByUtils(std::multimap<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>>&, double)
void SegmentManager::SortSegsByUtils( std::multimap<uint32_t, uint32_t> &cand_map, double utils) {
    std::lock_guard <std::mutex> lck(mtx_);
    uint32_t used_size;
    uint32_t thld = (uint32_t)(segSize_ * utils);

    for (uint32_t index = 0; index < segNum_; index++) {
        if (segTable_[index].state == SegUseStat::USED) {
            used_size = segSize_ - (segTable_[index].free_size
                    + segTable_[index].death_size
                    + (uint32_t) SegBase::SizeOfSegOnDisk());
            if (used_size < thld) {
                cand_map.insert(std::pair<uint32_t, uint32_t>(used_size, index));
            }
        }
    } __DEBUG("There is tatal %lu segments utils under %f", cand_map.size(), utils);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %r15
addq $0x40, %rdi
movq %rdi, (%rsp)
callq 0x6590
testl %eax, %eax
jne 0x1d97b
cmpl $0x0, 0x20(%r15)
je 0x1d963
movl 0x18(%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x10(%rsp), %xmm0
cvttsd2si %xmm0, %r13
movl $0x8, %ebp
xorl %ebx, %ebx
leaq 0x8(%rsp), %r12
movq (%r15), %rax
cmpl $0x1, -0x8(%rax,%rbp)
jne 0x1d953
movl -0x4(%rax,%rbp), %ecx
addl (%rax,%rbp), %ecx
movl 0x18(%r15), %eax
subl %ecx, %eax
addl $-0x20, %eax
cmpl %r13d, %eax
jae 0x1d953
movl %eax, 0x8(%rsp)
movl %ebx, 0xc(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x1dcc2
incq %rbx
movl 0x20(%r15), %eax
addq $0xc, %rbp
cmpq %rax, %rbx
jb 0x1d921
movq (%rsp), %rdi
callq 0x6360
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
movq %rax, %r14
movq (%rsp), %rdi
callq 0x6360
movq %r14, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::SortSegsByTS(std::multimap<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>>&, unsigned int)
void SegmentManager::SortSegsByTS(std::multimap<uint32_t, uint32_t> &cand_map, uint32_t max_seg_num)
{
    std::unique_lock<std::mutex> lck(mtx_, std::defer_lock);
    uint32_t used_size;

    lck.lock();
    std::multimap<uint32_t, uint32_t> used_map;
    for (uint32_t index = 0; index < segNum_; index++) {
        if (segTable_[index].state == SegUseStat::USED) {
            used_size = segSize_ - (segTable_[index].free_size
                    + segTable_[index].death_size
                    + (uint32_t) SegBase::SizeOfSegOnDisk());
            used_map.insert(std::pair<uint32_t, uint32_t>(used_size, index));
        }
    }
    lck.unlock();

    for(std::multimap<uint32_t, uint32_t>::iterator iter = used_map.begin(); iter != used_map.end(); iter++) {
        if (max_seg_num == 0) {
            break;
        }
        cand_map.insert(*iter);
        max_seg_num --;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x40(%rdi), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
callq 0xe40a
leaq 0x20(%rsp), %rbp
movl $0x0, (%rbp)
xorl %eax, %eax
movq %rax, 0x8(%rbp)
movq %rbp, 0x10(%rbp)
movq %rbp, 0x18(%rbp)
movq %rax, 0x20(%rbp)
cmpl $0x0, 0x20(%r15)
je 0x1da34
movl $0x8, %r12d
xorl %r13d, %r13d
movq (%r15), %rax
cmpl $0x1, -0x8(%rax,%r12)
jne 0x1da24
movl 0x18(%r15), %ecx
movl -0x4(%rax,%r12), %edx
addl (%rax,%r12), %edx
negl %edx
leal (%rcx,%rdx), %eax
addl $-0x20, %eax
movl %eax, (%rsp)
movl %r13d, 0x4(%rsp)
leaq 0x18(%rsp), %rdi
movq %rsp, %rsi
callq 0x1dcc2
incq %r13
movl 0x20(%r15), %eax
addq $0xc, %r12
cmpq %rax, %r13
jb 0x1d9ef
leaq 0x8(%rsp), %rdi
callq 0xe446
movq 0x30(%rsp), %r15
cmpq %rbp, %r15
sete %al
testl %ebx, %ebx
sete %cl
orb %al, %cl
jne 0x1da7a
decl %ebx
leaq 0x20(%r15), %rsi
movq %r14, %rdi
callq 0x1dd92
movq %r15, %rdi
callq 0x62e0
movq %rax, %r15
subl $0x1, %ebx
setb %al
cmpq %rbp, %r15
je 0x1da7a
testb %al, %al
je 0x1da54
leaq 0x18(%rsp), %rdi
callq 0x10b5e
leaq 0x8(%rsp), %rdi
callq 0xdf86
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1daa6
movq %rax, %rbx
jmp 0x1dab3
jmp 0x1daa6
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x10b5e
leaq 0x8(%rsp), %rdi
callq 0xdf86
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Status.cc
// Function: hlkvds::Status::Status(hlkvds::Status::Code, char const*)
Status::Status(Code _code, const char* msg) :
    code_(_code) {
    uint32_t size = strlen(msg);
    char* const result = new char[size + 1];
    memcpy(result, msg, size);
    result[size] = '\0';
    state_ = result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movl %esi, (%rdi)
movq %rdx, %rdi
callq 0x61a0
movq %rax, %r15
leal 0x1(%rax), %edi
callq 0x6040
movq %rax, %r12
movl %r15d, %r15d
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x6390
movb $0x0, (%r12,%r15)
movq %r12, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Status.cc
// Function: hlkvds::Status::ToString[abi:cxx11]() const
std::string Status::ToString() const {
    char tmp[30];
    const char* type;
    switch (code_) {
        case kOk:
            return "OK";
        case kNotFound:
            type = "NotFound: ";
            break;
        case kCorruption:
            type = "Corruption: ";
            break;
        case kNotSupported:
            type = "Not implemented: ";
            break;
        case kInvalidArgument:
            type = "Invalid argument: ";
            break;
        case kIOError:
            type = "IO error: ";
            break;
        case kTimedOut:
            type = "Operation timed out: ";
            break;
        case kAborted:
            type = "Operation aborted: ";
            break;
        case kBusy:
            type = "Resource busy: ";
            break;
        case kTryAgain:
            type = "Operation failed. Try again.: ";
            break;
        default:
            snprintf(tmp, sizeof(tmp), "Unknown code(%d): ",
                     static_cast<int> (code()));
            type = tmp;
            break;
    }
    std::string result(type);
    if (state_ != nullptr) {
        result.append(state_);
    }

    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %ecx
cmpq $0x9, %rcx
ja 0x1def7
leaq 0x6328(%rip), %rax      # 0x241ac
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6339(%rip), %rsi      # 0x241d4
leaq 0x6334(%rip), %rdx      # 0x241d6
movq %rbx, %rdi
callq 0xa6dc
jmp 0x1df48
leaq 0x634b(%rip), %r15      # 0x24201
jmp 0x1df19
leaq 0x639a(%rip), %r15      # 0x24259
jmp 0x1df19
leaq 0x631a(%rip), %r15      # 0x241e2
jmp 0x1df19
leaq 0x631e(%rip), %r15      # 0x241ef
jmp 0x1df19
leaq 0x635b(%rip), %r15      # 0x24235
jmp 0x1df19
leaq 0x62f4(%rip), %r15      # 0x241d7
jmp 0x1df19
leaq 0x6328(%rip), %r15      # 0x24214
jmp 0x1df19
leaq 0x632a(%rip), %r15      # 0x2421f
jmp 0x1df19
leaq 0x637a(%rip), %rdx      # 0x24278
movq %rsp, %r15
movl $0x1e, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x65f0
jmp 0x1df19
leaq 0x6330(%rip), %r15      # 0x24249
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
movq %r15, %rdi
callq 0x61a0
leaq (%rax,%r15), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa6dc
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0x1df48
movq %rbx, %rdi
callq 0x6720
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x1df67
callq 0x6400
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SuperBlockManager.cc
// Function: hlkvds::SuperBlockManager::Get(char*, unsigned long)
bool SuperBlockManager::Get(char* buff, uint64_t length) {
    if (length != SuperBlockManager::SuperBlockSizeOnDevice()) {
        return false;
    }
    memcpy((void *)buff, (const void*)&sb_, SuperBlockManager::SizeOfDBSuperBlock());

    uint64_t reserved_region_length = SuperBlockManager::ReservedRegionLength();

    char *cont_ptr = buff + SuperBlockManager::SizeOfDBSuperBlock();
    memcpy((void*)cont_ptr, (const void*)resCont_, reserved_region_length);
    return true;
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
cmpq $0x1000, %rdx           # imm = 0x1000
jne 0x1dfb3
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups 0x20(%rdi), %xmm2
movups 0x2d(%rdi), %xmm3
movups %xmm3, 0x2d(%rsi)
movups %xmm2, 0x20(%rsi)
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x3d, %rsi
movq 0x40(%rdi), %rax
movl $0xfc3, %edx            # imm = 0xFC3
movq %rsi, %rdi
movq %rax, %rsi
callq 0x6390
cmpq $0x1000, %rbx           # imm = 0x1000
sete %al
popq %rbx
retq
nop