LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiTier_Impl.cc
// Function: hlkvds::DS_MultiTier_Impl::GetAllSSTs(char*, unsigned long)
bool DS_MultiTier_Impl::GetAllSSTs(char* buf, uint64_t length) {
    uint64_t sst_total_length = GetSSTsLengthOnDisk();
    if (length != sst_total_length) {
        return false;
    }
    char *buf_ptr = buf;

    //Copy TS
    int64_t time_len = KVTime::SizeOf();
    lastTime_->Update();
    time_t t = lastTime_->GetTime();
    memcpy((void *)buf_ptr, (const void *)&t, time_len);
    buf_ptr += time_len;
    __DEBUG("memcpy timestamp: %s at %p, at %ld", KVTime::ToChar(*lastTime_), (void *)buf_ptr, (int64_t)(buf_ptr-buf));

    //Copy First Tier SST
    uint64_t fast_tier_sst_length = ft_->GetSSTLength();
    if ( !ft_->GetSST(buf_ptr, fast_tier_sst_length) ) {
        return false;
    }
    buf_ptr += fast_tier_sst_length;

    //Copy Second Tier SST
    uint64_t med_tier_sst_length = mt_->GetSSTLength();
    if ( !mt_->GetSST(buf_ptr, med_tier_sst_length) ) {
        return false;
    }

    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x98(%rax)
cmpq %r15, %rax
jne 0x8b26
movq 0x40(%r14), %rdi
callq 0x1db02
movq 0x40(%r14), %rdi
callq 0x1daf6
movq %rax, (%rbx)
addq $0x8, %rbx
movq 0x30(%r14), %rdi
callq 0x1c0a2
movq %rax, %r15
movq 0x30(%r14), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1bcb6
testb %al, %al
je 0x8b26
addq %r15, %rbx
movq 0x38(%r14), %rdi
callq 0x1d2da
movq 0x38(%r14), %rdi
movq %rbx, %rsi
movq %rax, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x1cbdc
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiTier_Impl.cc
// Function: hlkvds::DS_MultiTier_Impl::SetAllSSTs(char*, unsigned long)
bool DS_MultiTier_Impl::SetAllSSTs(char* buf, uint64_t length) {
    uint64_t sst_total_length = GetSSTsLengthOnDisk();
    if (length != sst_total_length) {
        return false;
    }
    char *buf_ptr = buf;

    //Set TS
    int64_t time_len = KVTime::SizeOf();
    time_t t;
    memcpy((void *)&t, (const void *)buf_ptr, time_len);
    lastTime_->SetTime(t);
    buf_ptr += time_len;
    __DEBUG("memcpy timestamp: %s at %p, at %ld", KVTime::ToChar(*lastTime_), (void *)buf_ptr, (int64_t)(buf_ptr-buf));

    //Set First Tier SST
    uint64_t fast_tier_sst_length = ft_->GetSSTLength();
    if (!ft_->SetSST(buf_ptr, fast_tier_sst_length) ) {
        return false;
    }
    buf_ptr += fast_tier_sst_length;

    //Set Second Tier SST
    uint64_t med_tier_sst_length = mt_->GetSSTLength();
    if ( !mt_->SetSST(buf_ptr, med_tier_sst_length) ) {
        return false;
    }

    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x98(%rax)
cmpq %r15, %rax
jne 0x8b99
movq (%rbx), %rsi
movq 0x40(%r14), %rdi
callq 0x1daec
addq $0x8, %rbx
movq 0x30(%r14), %rdi
callq 0x1c0a2
movq %rax, %r15
movq 0x30(%r14), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1bcc2
testb %al, %al
je 0x8b99
addq %r15, %rbx
movq 0x38(%r14), %rdi
callq 0x1d2da
movq 0x38(%r14), %rdi
movq %rbx, %rsi
movq %rax, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x1cc58
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiTier_Impl.cc
// Function: hlkvds::DS_MultiTier_Impl::CreateAllComponents(unsigned long)
bool DS_MultiTier_Impl::CreateAllComponents(uint64_t sst_offset) {
    bool ret;
    ret = mt_->CreateVolume(bdVec_);
    if (!ret) {
        return false;
    }

    uint32_t mt_seg_num = mt_->GetTotalSegNum();
    ret = ft_->CreateVolume(bdVec_, sst_offset, mt_seg_num);
    if (!ret) {
        return false;
    }

    // init SB Reserved Header For Create
    sbResHeader_.sb_reserved_fast_tier_size = ft_->GetSbReservedSize();
    sbResHeader_.sb_reserved_medium_tier_size = mt_->GetSbReservedSize();

    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rdi), %rsi
movq 0x38(%rdi), %rdi
callq 0x1ccd4
testb %al, %al
je 0x8bf4
movq 0x38(%rbx), %rax
movl 0x3c(%rax), %ecx
movq 0x10(%rbx), %rsi
movq 0x30(%rbx), %rdi
movq %r14, %rdx
callq 0x1bcce
testb %al, %al
je 0x8bf4
movl $0x10c, 0x28(%rbx)      # imm = 0x10C
movq 0x38(%rbx), %rax
imull $0x108, 0x40(%rax), %eax # imm = 0x108
addl $0x8, %eax
movl %eax, 0x2c(%rbx)
movb $0x1, %al
jmp 0x8bf6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiTier_Impl.cc
// Function: hlkvds::DS_MultiTier_Impl::OpenAllComponents()
bool DS_MultiTier_Impl::OpenAllComponents() {
    bool ret;

    ret = ft_->OpenVolume(bdVec_);

    if (!ret) {
        __ERROR("Fast Tier Open Volume Failed!");
        return false;
    }

    ret = mt_->OpenVolume(bdVec_);
    if (!ret) {
        __ERROR("Medium Tier Open Volume Failed!");
        return false;
    }

    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rsi
movq 0x30(%rdi), %rdi
callq 0x1be92
testb %al, %al
je 0x8c33
movq 0x10(%rbx), %rsi
movq 0x38(%rbx), %rdi
callq 0x1cf40
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
je 0x8c78
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x2939e(%rip), %r14     # 0x31fd8
movq (%r14), %rbx
callq 0x63c0
leaq 0x1665c(%rip), %rsi     # 0x1f2a5
leaq 0x16675(%rip), %rcx     # 0x1f2c5
leaq 0x16591(%rip), %r8      # 0x1f1e8
movq %rbx, %rdi
movq %rax, %rdx
movl $0xe1, %r9d
xorl %eax, %eax
callq 0x6580
movq (%r14), %rcx
leaq 0x16663(%rip), %rdi     # 0x1f2d7
pushq $0x1d
jmp 0x8cbb
movq 0x29359(%rip), %r14     # 0x31fd8
movq (%r14), %rbx
callq 0x63c0
leaq 0x16617(%rip), %rsi     # 0x1f2a5
leaq 0x16630(%rip), %rcx     # 0x1f2c5
leaq 0x1654c(%rip), %r8      # 0x1f1e8
movq %rbx, %rdi
movq %rax, %rdx
movl $0xe7, %r9d
xorl %eax, %eax
callq 0x6580
movq (%r14), %rcx
leaq 0x1663c(%rip), %rdi     # 0x1f2f5
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq 0x2930d(%rip), %rax     # 0x31fd8
movq (%rax), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
xorl %eax, %eax
jmp 0x8c2b
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiTier_Impl.cc
// Function: hlkvds::DS_MultiTier_Impl::GetKeyByHashEntry[abi:cxx11](hlkvds::HashEntry*)
std::string DS_MultiTier_Impl::GetKeyByHashEntry(HashEntry *entry) {
    TierType tier_type = locateTierFromEntry(entry);
    if (tier_type == TierType::FastTierType) {
        return ft_->GetKeyByHashEntry(entry);
    }
    return mt_->GetKeyByHashEntry(entry);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdx), %rax
cmpw $0x64, 0x20(%rax)
jne 0x8d34
movq 0x30(%rsi), %rsi
movq %rbx, %rdi
callq 0x1c116
jmp 0x8d40
movq 0x38(%rsi), %rsi
movq %rbx, %rdi
callq 0x1d35a
movq %rbx, %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiTier_Impl.cc
// Function: hlkvds::DS_MultiTier_Impl::GetValueByHashEntry[abi:cxx11](hlkvds::HashEntry*)
std::string DS_MultiTier_Impl::GetValueByHashEntry(HashEntry *entry) {
    //TODO: find location
    TierType tier_type = locateTierFromEntry(entry);
    if (tier_type == TierType::FastTierType) {
        return ft_->GetValueByHashEntry(entry);
    }
    return mt_->GetValueByHashEntry(entry);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdx), %rax
cmpw $0x64, 0x20(%rax)
jne 0x8d62
movq 0x30(%rsi), %rsi
movq %rbx, %rdi
callq 0x1c234
jmp 0x8d6e
movq 0x38(%rsi), %rsi
movq %rbx, %rdi
callq 0x1d48e
movq %rbx, %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiTier_Impl.cc
// Function: hlkvds::DS_MultiTier_Impl::CalcSSTsLengthOnDiskBySegNum(unsigned int)
uint64_t DS_MultiTier_Impl::CalcSSTsLengthOnDiskBySegNum(uint32_t seg_num) {
    uint64_t sst_pure_length = sizeof(SegmentStat) * seg_num;
    uint64_t sst_length = sst_pure_length + sizeof(time_t);
    uint64_t sst_pages = sst_length / getpagesize();
    sst_length = (sst_pages + 1) * getpagesize();
    return sst_length;
}

// Assembly:
pushq %rbx
movl %edi, %eax
imulq $0xc, %rax, %rbx
addq $0x8, %rbx
callq 0x66b0
movslq %eax, %rcx
movq %rbx, %rax
xorl %edx, %edx
divq %rcx
incq %rax
imulq %rcx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiTier_Impl.cc
// Function: hlkvds::DS_MultiTier_Impl::CalcSegNumForFastTierVolume(unsigned long, unsigned long, unsigned int, unsigned int)
uint32_t DS_MultiTier_Impl::CalcSegNumForFastTierVolume(uint64_t capacity, uint64_t sst_offset, uint32_t fast_tier_seg_size, uint32_t med_tier_seg_num) {
    uint64_t valid_capacity = capacity - sst_offset;
    uint32_t seg_num_candidate = valid_capacity / fast_tier_seg_size;

    uint32_t seg_num_total = seg_num_candidate + med_tier_seg_num;
    uint64_t sst_length = DS_MultiTier_Impl::CalcSSTsLengthOnDiskBySegNum( seg_num_total );

    uint32_t seg_size_bit = log2(fast_tier_seg_size);

    while( sst_length + ((uint64_t) seg_num_candidate << seg_size_bit) > valid_capacity) {
         seg_num_candidate--;
         seg_num_total = seg_num_candidate + med_tier_seg_num;
         sst_length = DS_MultiTier_Impl::CalcSSTsLengthOnDiskBySegNum( seg_num_total );
    }
    return seg_num_candidate;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movq %rdi, %r14
subq %rsi, %r14
movl %edx, %ecx
movq %r14, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r15
leal (%rax,%rbx), %edi
callq 0x8d74
movq %rax, %r13
movl %ebp, %edi
callq 0x8e3f
cvttsd2si %xmm0, %rax
movl %eax, %r12d
movl %r15d, %eax
movl %r12d, %ecx
shlq %cl, %rax
addq %r13, %rax
cmpq %r14, %rax
jbe 0x8dfd
movl %r15d, %ebp
decl %ebp
leal (%r15,%rbx), %edi
decl %edi
callq 0x8d74
movq %rax, %r13
movl %ebp, %r15d
jmp 0x8dd4
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::deleteAllSegments()
void DS_MultiVolume_Impl::deleteAllSegments() {
    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_);
    for (int i = 0; i< shardsNum_; i++) {
        SegForReq* seg = segMap_[i];
        delete seg;
        std::mutex *seg_mtx = segMtxVec_[i];
        delete seg_mtx;
    }
    segMap_.clear();
    segMtxVec_.clear();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x60(%rdi), %rsi
leaq 0x8(%rsp), %rdi
callq 0xaf4e
leaq 0x88(%rbx), %r14
xorl %eax, %eax
leaq 0x4(%rsp), %r15
movl %eax, 0x4(%rsp)
cmpl 0x58(%rbx), %eax
jge 0x90cd
movq %r14, %rdi
movq %r15, %rsi
callq 0xb444
movq (%rax), %r12
testq %r12, %r12
je 0x90a8
movq %r12, %rdi
callq 0x18f4a
movq %r12, %rdi
callq 0x63f0
movslq 0x4(%rsp), %rax
movq 0xb8(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x63f0
movl 0x4(%rsp), %eax
incl %eax
jmp 0x9084
movq %r14, %rdi
callq 0xd1e4
movq 0xb8(%rbx), %rax
cmpq %rax, 0xc0(%rbx)
je 0x90ec
movq %rax, 0xc0(%rbx)
leaq 0x8(%rsp), %rdi
callq 0xafd0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xafd0
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::deleteAllVolumes()
void DS_MultiVolume_Impl::deleteAllVolumes() {
    map<int, Volume *>::iterator iter;
    for (iter = volMap_.begin(); iter != volMap_.end(); ) {
        Volume *vol = iter->second;
        delete vol;
        volMap_.erase(iter++);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
movq 0x40(%rdi), %r15
addq $0x30, %rbx
cmpq %rbx, %r15
je 0x9168
movq 0x28(%r15), %r12
testq %r12, %r12
je 0x9145
movq %r12, %rdi
callq 0x1dd10
movq %r12, %rdi
callq 0x63f0
movq %r15, %rdi
callq 0x62c0
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0xd01a
movq %r12, %r15
jmp 0x912f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::InitSegmentBuffer()
void DS_MultiVolume_Impl::InitSegmentBuffer() {
    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_);
    for (int i = 0; i < shardsNum_; i++) {
        int vol_id = pickVol();
        SegForReq * seg = new SegForReq(volMap_[vol_id], idxMgr_, options_.expired_time);
        segMap_.insert(make_pair(i, seg));

        std::mutex *seg_mtx = new mutex();
        segMtxVec_.push_back(seg_mtx);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x60(%rdi), %rsi
leaq 0x28(%rsp), %rdi
callq 0xaf4e
leaq 0x28(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0x88(%rbx), %r15
leaq 0xb8(%rbx), %r12
xorl %r14d, %r14d
leaq 0x18(%rsp), %rbp
cmpl 0x58(%rbx), %r14d
jge 0x9250
movq %rbx, %rdi
callq 0x9292
movl %eax, 0xc(%rsp)
movl $0xd8, %edi
callq 0x6410
movq %rax, %r13
movq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0xaf64
movq (%rax), %rsi
movq 0x8(%rbx), %rax
movq 0x20(%rbx), %rdx
movl 0x10(%rax), %ecx
movq %r13, %rdi
callq 0x190a0
movl %r14d, 0x18(%rsp)
movq %r13, 0x20(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0xbf28
pushq $0x28
popq %rdi
callq 0x6410
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
andq $0x0, 0x20(%rax)
movq %rax, 0x18(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0xafb2
incl %r14d
jmp 0x91c4
leaq 0x28(%rsp), %rdi
callq 0xafd0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x927c
jmp 0x927c
jmp 0x927c
movq %rax, %rbx
movq %r13, %rdi
callq 0x63f0
jmp 0x927f
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xafd0
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::pickVol()
int DS_MultiVolume_Impl::pickVol() {
    std::lock_guard <std::mutex> l(volIdMtx_);
    if ( pickVolId_ == (int)(volNum_ - 1) ){
        pickVolId_ = 0;
    }
    else {
        pickVolId_++;
    }
    return pickVolId_;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xf8(%rdi), %r14
movq %r14, %rdi
callq 0xbc3a
movl 0xe0(%rbx), %eax
movl 0xf0(%rbx), %ecx
decl %eax
leal 0x1(%rcx), %edx
xorl %ebp, %ebp
cmpl %eax, %ecx
cmovnel %edx, %ebp
movl %ebp, 0xf0(%rbx)
movq %r14, %rdi
callq 0x6340
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::StartThds()
void DS_MultiVolume_Impl::StartThds() {
    for (int i = 0; i < shardsNum_; i++) {
        ReqsMergeWQ *req_wq = new ReqsMergeWQ(this, 1);
        req_wq->Start();
        reqWQVec_.push_back(req_wq);
    }

    segWteWQ_ = new SegmentWriteWQ(this, options_.seg_write_thread);
    segWteWQ_->Start();

    segTimeoutT_stop_.store(false);
    segTimeoutT_ = std::thread(&DS_MultiVolume_Impl::SegTimeoutThdEntry, this);

    for (uint32_t i = 0; i < volNum_; i++) {
        volMap_[i]->StartThds();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x140(%rdi), %r14
xorl %r13d, %r13d
pushq $0x1
popq %rbp
leaq 0x8(%rsp), %r15
cmpl 0x58(%rbx), %r13d
jge 0x9336
movl $0xd8, %edi
callq 0x6410
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0xafe6
movq %r12, 0x8(%rsp)
movq %r12, %rdi
callq 0xb014
movq %r14, %rdi
movq %r15, %rsi
callq 0xb0a6
incl %r13d
jmp 0x92f9
movl $0xd8, %edi
callq 0x6410
movq %rax, %r14
movq 0x8(%rbx), %rax
movl 0x14(%rax), %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb0c4
movq %r14, 0x158(%rbx)
movq %r14, %rdi
callq 0xb0f2
xorl %eax, %eax
xchgb %al, 0x168(%rbx)
leaq 0x8f(%rip), %rax        # 0x9402
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
andq $0x0, 0x8(%r14)
xorl %ebp, %ebp
leaq 0x18(%rsp), %rdx
movq %rbx, (%rdx)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xb184
leaq 0x160(%rbx), %rdi
movq %r15, %rsi
callq 0xb206
movq %r15, %rdi
callq 0xaf36
leaq 0x28(%rbx), %r15
cmpl 0xe0(%rbx), %ebp
jae 0x93d8
movl %ebp, 0x8(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0xb220
movq (%rax), %rdi
callq 0x1dd5c
incl %ebp
jmp 0x93b5
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
jmp 0x93f5
movq %rax, %rbx
movq %r12, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::SegTimeoutThdEntry()
void DS_MultiVolume_Impl::SegTimeoutThdEntry() {
    __DEBUG("Segment Timeout thread start!!");
    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_, std::defer_lock);

    while (!segTimeoutT_stop_) {
        for ( int i = 0; i < shardsNum_; i++) {
            std::mutex *mtx = segMtxVec_[i];
            std::unique_lock<std::mutex> l(*mtx);

            lck_seg_map.lock();
            SegForReq *seg = segMap_[i];
            lck_seg_map.unlock();

            if (seg->IsExpired()) {
                seg->Completion();

                segWteWQ_->Add_task(seg);
                int vol_id = pickVol();
                seg = new SegForReq(volMap_[vol_id], idxMgr_, options_.expired_time);

                lck_seg_map.lock();
                std::map<int, SegForReq*>::iterator iter = segMap_.find(i);
                segMap_.erase(iter);
                segMap_.insert( make_pair(i, seg) );
                lck_seg_map.unlock();
            }

        }

        usleep(options_.expired_time);
    } __DEBUG("Segment Timeout thread stop!!");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x60(%rdi), %rax
leaq 0x28(%rsp), %r14
movq %rax, (%r14)
movb $0x0, 0x8(%r14)
leaq 0x88(%rdi), %r15
leaq 0x28(%rdi), %rax
movq %rax, 0x10(%rsp)
leaq 0x38(%rsp), %r13
leaq 0x8(%rsp), %rbp
movb 0x168(%rbx), %al
testb $0x1, %al
jne 0x9557
xorl %eax, %eax
movl %eax, 0x8(%rsp)
cmpl 0x58(%rbx), %eax
jge 0x9546
cltq
movq 0xb8(%rbx), %rcx
movq (%rcx,%rax,8), %rsi
movq %r13, %rdi
callq 0xaf4e
movq %r14, %rdi
callq 0xb49c
movq %r15, %rdi
movq %rbp, %rsi
callq 0xb444
movq (%rax), %r12
movq %r14, %rdi
callq 0xb4c6
movq %r12, %rdi
callq 0x192d6
testb %al, %al
je 0x9533
movq %r12, %rdi
callq 0x191b2
movq 0x158(%rbx), %rdi
movq %r12, %rsi
callq 0xb4ec
movq %rbx, %rdi
callq 0x9292
movl %eax, 0xc(%rsp)
movl $0xd8, %edi
callq 0x6410
movq %rax, %r12
movq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0xaf64
movq (%rax), %rsi
movq 0x8(%rbx), %rax
movq 0x20(%rbx), %rdx
movl 0x10(%rax), %ecx
movq %r12, %rdi
callq 0x190a0
movq %r14, %rdi
callq 0xb49c
movq %r15, %rdi
movq %rbp, %rsi
callq 0xd420
movq %r15, %rdi
movq %rax, %rsi
callq 0xd454
movl 0x8(%rsp), %eax
movl %eax, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
callq 0xbf28
movq %r14, %rdi
callq 0xb4c6
movq %r13, %rdi
callq 0xafd0
movl 0x8(%rsp), %eax
incl %eax
jmp 0x944e
movq 0x8(%rbx), %rax
movl 0x10(%rax), %edi
callq 0x6570
jmp 0x943e
leaq 0x28(%rsp), %rdi
callq 0xafd0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9576
jmp 0x958c
jmp 0x958c
movq %rax, %rbx
jmp 0x9599
movq %rax, %rbx
movq %r12, %rdi
callq 0x63f0
jmp 0x958f
jmp 0x958c
jmp 0x958c
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xafd0
leaq 0x28(%rsp), %rdi
callq 0xafd0
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::StopThds()
void DS_MultiVolume_Impl::StopThds() {
    for (uint32_t i = 0; i < volNum_; i++) {
        volMap_[i]->StopThds();
    }

    segTimeoutT_stop_.store(true);
    segTimeoutT_.join();

    for (int i = 0; i < shardsNum_; i++) {
        ReqsMergeWQ *req_wq = reqWQVec_[i];
        req_wq->Stop();
        delete req_wq;
    }
    reqWQVec_.clear();

    if (segWteWQ_) {
        segWteWQ_->Stop();
        delete segWteWQ_;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
xorl %ebp, %ebp
leaq 0x4(%rsp), %r15
cmpl 0xe0(%rbx), %ebp
jae 0x95e4
movl %ebp, 0x4(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xb220
movq (%rax), %rdi
callq 0x1ddd6
incl %ebp
jmp 0x95c1
movb $0x1, %al
xchgb %al, 0x168(%rbx)
leaq 0x160(%rbx), %rdi
callq 0x6660
xorl %r15d, %r15d
movslq 0x58(%rbx), %rcx
movq 0x140(%rbx), %rax
cmpq %rcx, %r15
jge 0x9625
movq (%rax,%r15,8), %r14
movq %r14, %rdi
callq 0xb26e
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
incq %r15
jmp 0x95fb
cmpq %rax, 0x148(%rbx)
je 0x9635
movq %rax, 0x148(%rbx)
movq 0x158(%rbx), %rdi
testq %rdi, %rdi
je 0x9658
callq 0xb2b2
movq 0x158(%rbx), %rdi
testq %rdi, %rdi
je 0x9658
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::printDeviceTopologyInfo()
void DS_MultiVolume_Impl::printDeviceTopologyInfo() {
    __INFO("\nDB Device Topology information:\n"
            "\t Segment size                : %d\n"
            "\t Volumes number              : %d",
            sbResHeader_.segment_size, sbResHeader_.volume_num);
    for (uint32_t i = 0 ; i < sbResHeader_.volume_num; i++) {
        __INFO("\nVolume[%d] : dev_path = %s, segment_num = %d, cur_seg_id = %d",
                i, sbResVolVec_[i].dev_path,
                sbResVolVec_[i].segment_num,
                sbResVolVec_[i].cur_seg_id);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x2895f(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
movq %rax, %r14
leaq 0x15b24(%rip), %rsi     # 0x1f1b0
leaq 0x15b3d(%rip), %rcx     # 0x1f1d0
leaq 0x15cc6(%rip), %r8      # 0x1f360
pushq $0x54
popq %r9
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x6580
movq (%r12), %rdi
movl 0x120(%rbx), %edx
movl 0x124(%rbx), %ecx
leaq 0x15cb9(%rip), %rsi     # 0x1f37b
xorl %eax, %eax
callq 0x6580
movq (%r12), %rsi
pushq $0xa
popq %rbp
movl %ebp, %edi
callq 0x64b0
xorl %r15d, %r15d
xorl %r13d, %r13d
movl 0x124(%rbx), %eax
cmpq %rax, %r13
jae 0x9756
movq (%r12), %rdi
leaq 0x15abd(%rip), %rsi     # 0x1f1b0
movq %r14, %rdx
leaq 0x15ad3(%rip), %rcx     # 0x1f1d0
leaq 0x15c5c(%rip), %r8      # 0x1f360
pushq $0x59
popq %r9
xorl %eax, %eax
callq 0x6580
movq (%r12), %rdi
movq 0x128(%rbx), %rax
leaq (%rax,%r15), %rcx
movl 0x100(%rax,%r15), %r8d
movl 0x104(%rax,%r15), %r9d
leaq 0x15cad(%rip), %rsi     # 0x1f3e2
movl %r13d, %edx
xorl %eax, %eax
callq 0x6580
movq (%r12), %rsi
movl %ebp, %edi
callq 0x64b0
incq %r13
addq $0x108, %r15            # imm = 0x108
jmp 0x96dd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::WriteData(hlkvds::KVSlice&, bool)
Status DS_MultiVolume_Impl::WriteData(KVSlice& slice, bool immediately) {
    if (slice.GetDataLen() > maxValueLen_) {
        return Status::NotSupported("Data length cann't be longer than max segment size");
    }

    if (options_.aggregate_request == 1 && !immediately) {
        return writeDataAggregate(slice);
    }
    else {
        return writeDataImmediately(slice);
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movzwl 0x18(%rdx), %eax
cmpl %eax, 0xdc(%rsi)
jae 0x985f
leaq 0x15c3f(%rip), %rsi     # 0x1f494
movq %rbx, %rdi
callq 0xb2f6
jmp 0x987b
movq 0x8(%rsi), %rax
movb 0x38(%rax), %al
xorb $0x1, %al
movq %rbx, %rdi
orb %cl, %al
je 0x9876
callq 0x9914
jmp 0x987b
callq 0x9880
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::writeDataAggregate(hlkvds::KVSlice&)
Status DS_MultiVolume_Impl::writeDataAggregate(KVSlice& slice) {

    Request *req = new Request(slice);

    int shards_id = calcShardId(slice);
    req->SetShardsWQId(shards_id);
    ReqsMergeWQ *req_wq = reqWQVec_[shards_id];
    req_wq->Add_task(req);

    req->Wait();
    Status s = updateMeta(req);
    delete req;
    return s;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x78
popq %rdi
callq 0x6410
movq %rax, %r14
movq %rax, %rdi
movq %r12, %rsi
callq 0x18798
movq %r15, %rdi
movq %r12, %rsi
callq 0xabfa
movl %eax, 0x70(%r14)
cltq
movq 0x140(%r15), %rcx
movq (%rcx,%rax,8), %rdi
movq %r14, %rsi
callq 0xb37e
movq %r14, %rdi
callq 0x187f2
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xac10
movq %r14, %rdi
callq 0x1872c
movq %r14, %rdi
callq 0x63f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::ReadData(hlkvds::KVSlice&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
Status DS_MultiVolume_Impl::ReadData(KVSlice &slice, string &data) {
    HashEntry *entry;
    entry = &slice.GetHashEntry();

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

    uint64_t data_offset = 0;
    if (!vol->CalcDataOffsetPhyFromEntry(entry, data_offset)) {
        return Status::Aborted("Calculate data offset failed.");
    }

    uint16_t data_len = entry->GetDataSize();

    if (data_len == 0) {
        //The key is not exist
        return Status::NotFound("Key is not found.");
    }

    char *mdata = new char[data_len];
    if (!vol->Read(mdata, data_len, data_offset)) {
        __ERROR("Could not read data at position");
        delete[] mdata;
        return Status::IOError("Could not read data at position.");
    }
    data.assign(mdata, data_len);
    delete[] mdata;

    __DEBUG("get key: %s, data offset %ld, head_offset is %ld", slice.GetKeyStr().c_str(), data_offset, entry->GetHeaderOffset());

    return Status::OK();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r15
movq %rdi, %rbx
movq 0x28(%rdx), %r14
movq (%r14), %rax
movzwl 0x20(%rax), %ecx
leaq 0xc(%rsp), %rax
movl %ecx, (%rax)
leaq 0x28(%rsi), %rdi
movq %rax, %rsi
callq 0xaf64
movq (%rax), %r12
movq %rsp, %rdx
andq $0x0, (%rdx)
movq %r12, %rdi
movq %r14, %rsi
callq 0x1dfc6
testb %al, %al
je 0x9dfa
movq (%r14), %rax
movzwl 0x16(%rax), %r13d
testq %r13, %r13
je 0x9e0b
movq %r13, %rdi
callq 0x6040
movq %rax, %r14
movq (%rsp), %rcx
movq %r12, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x1de02
testb %al, %al
je 0x9e2b
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x6510
movq %r14, %rdi
callq 0x64c0
andl $0x0, (%rbx)
andq $0x0, 0x8(%rbx)
jmp 0x9e1a
leaq 0x157a9(%rip), %rsi     # 0x1f5aa
movq %rbx, %rdi
callq 0xb30a
jmp 0x9e1a
leaq 0x157b6(%rip), %rsi     # 0x1f5c8
movq %rbx, %rdi
callq 0xb332
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x281a6(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0x15463(%rip), %rsi     # 0x1f2a5
leaq 0x15791(%rip), %rcx     # 0x1f5da
leaq 0x15510(%rip), %r8      # 0x1f360
movq %r15, %rdi
movq %rax, %rdx
movl $0xb3, %r9d
xorl %eax, %eax
callq 0x6580
movq (%r12), %rcx
leaq 0x15775(%rip), %rdi     # 0x1f5e3
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq %r14, %rdi
callq 0x64c0
leaq 0x1576f(%rip), %rsi     # 0x1f603
movq %rbx, %rdi
callq 0xb31e
jmp 0x9e1a
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::GetSBReservedContent(char*, unsigned long)
bool DS_MultiVolume_Impl::GetSBReservedContent(char* buf, uint64_t length) {
    if (length != SuperBlockManager::ReservedRegionLength()) {
        return false;
    }
    memset((void*)buf, 0, length);

    //Get sbResHeader_
    uint64_t header_size = sizeof(MultiVolumeDS_SB_Reserved_Header);
    memcpy((void*)buf, (const void*)&sbResHeader_, header_size);
    __DEBUG("SB_RESERVED_HEADER: volume_num= %d, segment_size = %d", sbResHeader_.volume_num, sbResHeader_.segment_size);

    //Get sbResVolVec_
    uint64_t sb_res_vol_size = sizeof(MultiVolumeDS_SB_Reserved_Volume);
    uint32_t vol_num = sbResHeader_.volume_num;
    char * sb_res_vol_ptr = buf + header_size;

    updateAllVolSBRes();

    for (uint32_t i = 0; i < vol_num; i++) {
        memcpy((void*)(sb_res_vol_ptr), (const void*)&sbResVolVec_[i], sb_res_vol_size);
        sb_res_vol_ptr += sb_res_vol_size;
        __DEBUG("Volume [%d], device_path= %s, segment_num = %d, current_seg_id = %d", i, sbResVolVec_[i].dev_path, sbResVolVec_[i].segment_num, sbResVolVec_[i].cur_seg_id);
    }

    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
cmpq $0xfc3, %rdx            # imm = 0xFC3
jne 0x9fbb
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
movl $0xfc3, %edx            # imm = 0xFC3
movq %rsi, %rdi
xorl %esi, %esi
callq 0x6250
movq 0x120(%r15), %rax
movq %rax, (%r14)
movl 0x124(%r15), %r13d
addq $0x8, %r14
movq %r15, %rdi
callq 0x9fd0
imulq $0x108, %r13, %r13      # imm = 0x108
cmpq %r12, %r13
je 0x9fbb
leaq (%r14,%r12), %rdi
movq 0x128(%r15), %rsi
addq %r12, %rsi
movl $0x108, %edx            # imm = 0x108
callq 0x6370
addq $0x108, %r12            # imm = 0x108
jmp 0x9f95
cmpq $0xfc3, %rbx            # imm = 0xFC3
sete %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::SetSBReservedContent(char*, unsigned long)
bool DS_MultiVolume_Impl::SetSBReservedContent(char* buf, uint64_t length) {
    if (length != SuperBlockManager::ReservedRegionLength()) {
        return false;
    }

    //Set sbResHeader_
    uint64_t header_size = sizeof(MultiVolumeDS_SB_Reserved_Header);
    memcpy((void*)&sbResHeader_, (const void*)buf, header_size);
    __DEBUG("SB_RESERVED_HEADER: volume_num= %d, segment_size = %d", sbResHeader_.volume_num, sbResHeader_.segment_size);

    //Set sbResVolVec_
    uint64_t sb_res_vol_size = sizeof(MultiVolumeDS_SB_Reserved_Volume);
    uint32_t vol_num = sbResHeader_.volume_num;
    char * sb_res_vol_ptr = buf + header_size;

    for (uint32_t i = 0; i < vol_num; i++) {
        MultiVolumeDS_SB_Reserved_Volume sb_res_vol;
        memcpy((void*)&sb_res_vol, (const void*)sb_res_vol_ptr, sb_res_vol_size);
        sbResVolVec_.push_back(sb_res_vol);
        sb_res_vol_ptr += sb_res_vol_size;
        __DEBUG("Volume [%d], device_path= %s, segment_num = %d, current_seg_id = %d", i, sbResVolVec_[i].dev_path, sbResVolVec_[i].segment_num, sbResVolVec_[i].cur_seg_id);
    }

    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movq %rdx, %rbx
cmpq $0xfc3, %rdx            # imm = 0xFC3
jne 0xa0a4
movq %rsi, %r14
movq %rdi, %r15
movq (%rsi), %r13
movq %r13, 0x120(%rdi)
shrq $0x20, %r13
addq $0x8, %r14
addq $0x128, %r15            # imm = 0x128
leaq 0x8(%rsp), %r12
subl $0x1, %r13d
jb 0xa0a4
movl $0x108, %edx            # imm = 0x108
movq %r12, %rdi
movq %r14, %rsi
callq 0x6370
movq %r15, %rdi
movq %r12, %rsi
callq 0xb346
addq $0x108, %r14            # imm = 0x108
jmp 0xa07a
cmpq $0xfc3, %rbx            # imm = 0xFC3
sete %al
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::GetAllSSTs(char*, unsigned long)
bool DS_MultiVolume_Impl::GetAllSSTs(char* buf, uint64_t length) {
    uint64_t sst_total_length = GetSSTsLengthOnDisk();
    if (length != sst_total_length) {
        return false;
    }
    char *buf_ptr = buf;

    //Copy TS
    int64_t time_len = KVTime::SizeOf();
    lastTime_->Update();
    time_t t = lastTime_->GetTime();
    memcpy((void *)buf_ptr, (const void *)&t, time_len);
    buf_ptr += time_len;
    __DEBUG("memcpy timestamp: %s at %p, at %ld", KVTime::ToChar(*lastTime_), (void *)buf_ptr, (int64_t)(buf_ptr-buf));

    //Copy SST
    for (uint32_t i = 0; i < volNum_; i++) {
        uint64_t vol_sst_length = volMap_[i]->GetSSTLength();
        if ( !volMap_[i]->GetSST(buf_ptr, vol_sst_length) ) {
            return false;
        }
        buf_ptr += vol_sst_length;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x98(%rax)
xorl %r13d, %r13d
movl $0x0, %ebp
cmpq %r15, %rax
jne 0xa160
movq 0xd0(%r14), %rdi
callq 0x1db02
movq 0xd0(%r14), %rdi
callq 0x1daf6
movq %rax, (%rbx)
addq $0x8, %rbx
leaq 0x28(%r14), %r15
cmpl 0xe0(%r14), %r13d
setae %bpl
jae 0xa160
movl %r13d, 0x4(%rsp)
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0xb220
movq (%rax), %rdi
callq 0x1df34
movq %rax, %r12
movl %r13d, (%rsp)
movq %r15, %rdi
movq %rsp, %rsi
callq 0xb220
movq (%rax), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x1ddee
testb %al, %al
je 0xa160
addq %r12, %rbx
incl %r13d
jmp 0xa10d
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::SetAllSSTs(char*, unsigned long)
bool DS_MultiVolume_Impl::SetAllSSTs(char* buf, uint64_t length) {
    uint64_t sst_total_length = GetSSTsLengthOnDisk();
    if (length != sst_total_length) {
        return false;
    }
    char *buf_ptr = buf;

    //Set TS
    int64_t time_len = KVTime::SizeOf();
    time_t t;
    memcpy((void *)&t, (const void *)buf_ptr, time_len);
    lastTime_->SetTime(t);
    buf_ptr += time_len;
    __DEBUG("memcpy timestamp: %s at %p, at %ld", KVTime::ToChar(*lastTime_), (void *)buf_ptr, (int64_t)(buf_ptr-buf));

    //Set SST
    for (uint32_t i = 0; i < volNum_; i++) {
        uint64_t vol_sst_length = volMap_[i]->GetSSTLength();
        if ( !volMap_[i]->SetSST(buf_ptr, vol_sst_length) ) {
            return false;
        }
        buf_ptr += vol_sst_length;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x98(%rax)
xorl %r13d, %r13d
movl $0x0, %ebp
cmpq %r15, %rax
jne 0xa206
movq (%rbx), %rsi
movq 0xd0(%r14), %rdi
callq 0x1daec
addq $0x8, %rbx
leaq 0x28(%r14), %r15
cmpl 0xe0(%r14), %r13d
setae %bpl
jae 0xa206
movl %r13d, 0x4(%rsp)
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0xb220
movq (%rax), %rdi
callq 0x1df34
movq %rax, %r12
movl %r13d, (%rsp)
movq %r15, %rdi
movq %rsp, %rsi
callq 0xb220
movq (%rax), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x1ddf8
testb %al, %al
je 0xa206
addq %r12, %rbx
incl %r13d
jmp 0xa1b3
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::calcSegNumForMetaVolume(unsigned long, unsigned long, unsigned int, unsigned int)
uint32_t DS_MultiVolume_Impl::calcSegNumForMetaVolume(uint64_t capacity, uint64_t sst_offset, uint32_t total_buddy_seg_num, uint32_t seg_size) {
    uint64_t valid_capacity = capacity - sst_offset;
    uint32_t seg_num_candidate = valid_capacity / seg_size;

    uint32_t seg_num_total = seg_num_candidate + total_buddy_seg_num;
    uint64_t sst_length = calcSSTsLengthOnDiskBySegNum( seg_num_total );

    uint32_t seg_size_bit = log2(seg_size);

    while( sst_length + ((uint64_t) seg_num_candidate << seg_size_bit) > valid_capacity) {
         seg_num_candidate--;
         seg_num_total = seg_num_candidate + total_buddy_seg_num;
         sst_length = calcSSTsLengthOnDiskBySegNum( seg_num_total );
    }
    return seg_num_candidate;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %ebx
movq %rsi, %r14
subq %rdx, %r14
movl %r8d, %ecx
movq %r14, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r15
leal (%rax,%rbx), %esi
callq 0xa4c0
movq %rax, %r13
movl %ebp, %edi
callq 0x8e3f
cvttsd2si %xmm0, %rax
movl %eax, %r12d
movl %r15d, %eax
movl %r12d, %ecx
shlq %cl, %rax
addq %r13, %rax
cmpq %r14, %rax
jbe 0xa4ad
movl %r15d, %ebp
decl %ebp
leal (%r15,%rbx), %esi
decl %esi
callq 0xa4c0
movq %rax, %r13
movl %ebp, %r15d
jmp 0xa484
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::initSBReservedContentForCreate()
void DS_MultiVolume_Impl::initSBReservedContentForCreate() {
    sbResHeader_.segment_size = segSize_;
    sbResHeader_.volume_num = volNum_;

    for(uint32_t i = 0; i < volNum_; i++)
    {
        MultiVolumeDS_SB_Reserved_Volume sb_res_vol;

        string dev_path = volMap_[i]->GetDevicePath();
        memcpy((void*)&sb_res_vol.dev_path, (const void*)dev_path.c_str(), dev_path.size());

        sb_res_vol.segment_num = volMap_[i]->GetNumberOfSeg();
        sb_res_vol.cur_seg_id = volMap_[i]->GetCurSegId();

        sbResVolVec_.push_back(sb_res_vol);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, %rbx
movl 0xd8(%rdi), %ecx
movl 0xe0(%rdi), %eax
movl %ecx, 0x120(%rdi)
movl %eax, 0x124(%rdi)
leaq 0x28(%rdi), %r14
leaq 0x128(%rdi), %rcx
movq %rcx, 0x8(%rsp)
xorl %r15d, %r15d
leaq 0x30(%rsp), %r12
leaq 0x4(%rsp), %r13
leaq 0x10(%rsp), %rbp
cmpl %eax, %r15d
jae 0xa5d6
movl $0x108, %edx            # imm = 0x108
movq %r12, %rdi
xorl %esi, %esi
callq 0x6250
movl %r15d, 0x4(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0xb220
movq (%rax), %rsi
movq %rbp, %rdi
callq 0x1df22
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x6370
movl %r15d, 0x4(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0xb220
movq (%rax), %rax
movl 0x3c(%rax), %eax
movl %eax, 0x130(%rsp)
movl %r15d, 0x4(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0xb220
movq (%rax), %rdi
callq 0x1df1a
movl %eax, 0x134(%rsp)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0xb346
movq %rbp, %rdi
callq 0x6788
incl %r15d
movl 0xe0(%rbx), %eax
jmp 0xa532
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa5ec
jmp 0xa5ec
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6788
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::verifyTopology()
bool DS_MultiVolume_Impl::verifyTopology() {
    if (volNum_ != bdVec_.size()) {
        return false;
    }
    for (uint32_t i = 0; i < volNum_; i++) {
        string record_path = string(sbResVolVec_[i].dev_path);
        string device_path = bdVec_[i]->GetDevicePath();
        if (record_path != device_path) {
            __ERROR("record_path: %s, device_path:%s ", record_path.c_str(), device_path.c_str());
            return false;
        }
    }
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl 0xe0(%rdi), %eax
movq 0x10(%rdi), %rcx
movq 0x8(%rcx), %rdx
subq (%rcx), %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jne 0xa8ab
movq %rdi, %rbx
xorl %r12d, %r12d
movq %rsp, %r14
leaq 0x20(%rsp), %r15
xorl %r13d, %r13d
movl %eax, %eax
cmpq %rax, %r13
jae 0xa8af
movq 0x128(%rbx), %rsi
addq %r12, %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x6150
movq 0x10(%rbx), %rax
movq (%rax), %rax
movq (%rax,%r13,8), %rsi
movq (%rsi), %rax
movq %r15, %rdi
callq *0x28(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0xb492
testb %al, %al
jne 0xa8c1
movq %r15, %rdi
callq 0x6788
movq %r14, %rdi
callq 0x6788
incq %r13
movl 0xe0(%rbx), %eax
addq $0x108, %r12            # imm = 0x108
jmp 0xa84a
xorl %ebx, %ebx
jmp 0xa8b1
movb $0x1, %bl
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x27710(%rip), %r12     # 0x31fd8
movq (%r12), %r14
callq 0x63c0
leaq 0x149cd(%rip), %rsi     # 0x1f2a5
leaq 0x14de8(%rip), %rcx     # 0x1f6c7
leaq 0x14a7a(%rip), %r8      # 0x1f360
xorl %ebx, %ebx
movq %r14, %rdi
movq %rax, %rdx
movl $0x263, %r9d            # imm = 0x263
xorl %eax, %eax
callq 0x6580
movq (%r12), %rdi
movq %rsp, %r14
movq (%r14), %rdx
leaq 0x20(%rsp), %r15
movq (%r15), %rcx
leaq 0x14dc2(%rip), %rsi     # 0x1f6d6
xorl %eax, %eax
callq 0x6580
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq %r15, %rdi
callq 0x6788
movq %r14, %rdi
callq 0x6788
jmp 0xa8b1
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6788
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r12
andq $0x0, (%r12)
movq (%rdx), %rax
movzwl 0x20(%rax), %ecx
leaq 0x14(%rsp), %rax
movl %ecx, (%rax)
leaq 0x28(%rsi), %rdi
movq %rax, %rsi
callq 0xaf64
movq (%rax), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x1dff0
testb %al, %al
je 0xaa1d
movq (%r14), %rax
movzwl 0x14(%rax), %r12d
leaq 0x1(%r12), %rdi
callq 0x6040
movq %rax, %r14
movq 0x8(%rsp), %rcx
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x1de02
testb %al, %al
je 0xaa40
movq %r14, %rdx
addq %r12, %rdx
movb $0x0, (%r14,%r12)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xcd5c
movq %r14, %rdi
callq 0x64c0
jmp 0xaa31
leaq 0x151d8(%rip), %rsi     # 0x1fbfc
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0x6150
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x27591(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0x1484e(%rip), %rsi     # 0x1f2a5
leaq 0x14c21(%rip), %rcx     # 0x1f67f
leaq 0x148fb(%rip), %r8      # 0x1f360
movq %r15, %rdi
movq %rax, %rdx
movl $0x18f, %r9d            # imm = 0x18F
xorl %eax, %eax
callq 0x6580
movq (%r12), %rcx
leaq 0x14b60(%rip), %rdi     # 0x1f5e3
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq %r14, %rdi
callq 0x64c0
leaq 0x15153(%rip), %rsi     # 0x1fbfc
leaq 0x6(%rsp), %rdx
jmp 0xaa29
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::GetValueByHashEntry[abi:cxx11](hlkvds::HashEntry*)
string DS_MultiVolume_Impl::GetValueByHashEntry(HashEntry *entry) {
    uint64_t data_offset = 0;

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

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

    return res;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r12
andq $0x0, (%r12)
movq (%rdx), %rax
movzwl 0x20(%rax), %ecx
leaq 0x14(%rsp), %rax
movl %ecx, (%rax)
leaq 0x28(%rsi), %rdi
movq %rax, %rsi
callq 0xaf64
movq (%rax), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x1dfc6
testb %al, %al
je 0xab56
movq (%r14), %rax
movzwl 0x16(%rax), %r12d
testq %r12, %r12
je 0xab64
leaq 0x1(%r12), %rdi
callq 0x6040
movq %rax, %r14
movq 0x8(%rsp), %rcx
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x1de02
testb %al, %al
je 0xab87
movq %r14, %rdx
addq %r12, %rdx
movb $0x0, (%r14,%r12)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xcd5c
movq %r14, %rdi
callq 0x64c0
jmp 0xab78
leaq 0x1509f(%rip), %rsi     # 0x1fbfc
leaq 0x7(%rsp), %rdx
jmp 0xab70
leaq 0x15091(%rip), %rsi     # 0x1fbfc
leaq 0x6(%rsp), %rdx
movq %rbx, %rdi
callq 0x6150
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x2744a(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0x14707(%rip), %rsi     # 0x1f2a5
leaq 0x14aec(%rip), %rcx     # 0x1f691
leaq 0x147b4(%rip), %r8      # 0x1f360
movq %r15, %rdi
movq %rax, %rdx
movl $0x1ab, %r9d            # imm = 0x1AB
xorl %eax, %eax
callq 0x6580
movq (%r12), %rcx
leaq 0x14a19(%rip), %rdi     # 0x1f5e3
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq %r14, %rdi
callq 0x64c0
leaq 0x1500c(%rip), %rsi     # 0x1fbfc
leaq 0x5(%rsp), %rdx
jmp 0xab70
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::updateMeta(hlkvds::Request*)
Status DS_MultiVolume_Impl::updateMeta(Request *req) {
    bool res = req->GetWriteStat();
    // update index
    if (!res) {
        return Status::Aborted("Write failed");
    }
    KVSlice *slice = &req->GetSlice();
    res = idxMgr_->UpdateIndex(slice);
    // minus the segment delete counter
    SegForReq *seg = req->GetSeg();
    if (!seg->CommitedAndGetNum()) {
        idxMgr_->AddToReaper(seg);
    }
    return Status::OK();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x2, 0x4(%rdx)
jne 0xac50
movq %rdx, %r15
movq %rsi, %r14
movq 0x8(%rdx), %rsi
movq 0x20(%r14), %rdi
xorl %edx, %edx
callq 0xebc6
movq 0x68(%r15), %rsi
lock
decl 0x7c(%rsi)
jne 0xac46
movq 0x20(%r14), %rdi
callq 0xf564
andl $0x0, (%rbx)
andq $0x0, 0x8(%rbx)
jmp 0xac5f
leaq 0x14a63(%rip), %rsi     # 0x1f6ba
movq %rbx, %rdi
callq 0xb30a
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::getTotalFreeSegs()
uint32_t DS_MultiVolume_Impl::getTotalFreeSegs() {
    uint32_t free_num = 0;
    for (uint32_t i = 0; i < volNum_; i++) {
        free_num += volMap_[i]->GetTotalFreeSegs();
    }
    return free_num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
xorl %ebp, %ebp
leaq 0xc(%rsp), %r15
xorl %r12d, %r12d
cmpl 0xe0(%rbx), %r12d
jae 0xacad
movl %r12d, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xb220
movq (%rax), %rdi
callq 0x1df3c
addl %eax, %ebp
incl %r12d
jmp 0xac85
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq