LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SuperBlockManager.cc
// Function: hlkvds::SuperBlockManager::Set(char*, unsigned long)
bool SuperBlockManager::Set(char* buff, uint64_t length) {
    if (length != SuperBlockManager::SuperBlockSizeOnDevice()) {
        return false;
    }
    memcpy((void*)&sb_, (const void*)buff, SuperBlockManager::SizeOfDBSuperBlock());

    uint64_t reserved_region_length = SuperBlockManager::ReservedRegionLength();
    char * cont_ptr = buff + SuperBlockManager::SizeOfDBSuperBlock();
    memcpy((void*)resCont_, (const void*)cont_ptr, reserved_region_length);

    return true;
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
cmpq $0x1000, %rdx           # imm = 0x1000
jne 0x1dffd
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups 0x20(%rsi), %xmm2
movups 0x2d(%rsi), %xmm3
movups %xmm3, 0x2d(%rdi)
movups %xmm2, 0x20(%rdi)
movups %xmm1, 0x10(%rdi)
movups %xmm0, (%rdi)
addq $0x3d, %rsi
movq 0x40(%rdi), %rdi
movl $0xfc3, %edx            # imm = 0xFC3
callq 0x6390
cmpq $0x1000, %rbx           # imm = 0x1000
sete %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SuperBlockManager.cc
// Function: hlkvds::SuperBlockManager::SetSuperBlock(hlkvds::DBSuperBlock&)
void SuperBlockManager::SetSuperBlock(DBSuperBlock& sb) {
    std::lock_guard<std::mutex> l(mtx_);
    sb_.magic_number            = sb.magic_number;
    sb_.index_ht_size           = sb.index_ht_size;
    sb_.index_region_offset     = sb.index_region_offset;
    sb_.index_region_length     = sb.index_region_length;
    sb_.sst_total_num           = sb.sst_total_num;
    sb_.sst_region_offset       = sb.sst_region_offset;
    sb_.sst_region_length       = sb.sst_region_length;
    sb_.data_store_type         = sb.data_store_type;
    sb_.entry_count             = sb.entry_count;
    sb_.entry_theory_data_size  = sb.entry_theory_data_size;
    sb_.grace_close_flag        = sb.grace_close_flag;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x50(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1e06c
movq (%r15), %rax
movq %rax, (%r14)
movups 0x8(%r15), %xmm0
movups %xmm0, 0x8(%r14)
movl 0x18(%r15), %eax
movl %eax, 0x18(%r14)
movups 0x1c(%r15), %xmm0
movups %xmm0, 0x1c(%r14)
movq 0x2c(%r15), %rax
movq %rax, 0x2c(%r14)
movq 0x34(%r15), %rax
movq %rax, 0x34(%r14)
movb 0x3c(%r15), %al
movb %al, 0x3c(%r14)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6360
movl %eax, %edi
callq 0x62c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SuperBlockManager.cc
// Function: hlkvds::SuperBlockManager::SetReservedContent(char*, unsigned long)
bool SuperBlockManager::SetReservedContent(char* content, uint64_t length) {
    std::lock_guard<std::mutex> l(mtx_);
    if (length != SuperBlockManager::ReservedRegionLength()) {
        return false;
    }
    memcpy((void*)resCont_, (const void*)content, length);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x50(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1e156
cmpq $0xfc3, %r14            # imm = 0xFC3
jne 0x1e138
movq 0x40(%r12), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6390
cmpq $0xfc3, %r14            # imm = 0xFC3
sete %bpl
movq %rbx, %rdi
callq 0x6360
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/SuperBlockManager.cc
// Function: hlkvds::SuperBlockManager::GetReservedContent(char*, unsigned long)
bool SuperBlockManager::GetReservedContent(char* content, uint64_t length) {
    std::lock_guard<std::mutex> l(mtx_);
    if (length != SuperBlockManager::ReservedRegionLength()) {
        return false;
    }
    memcpy((void*)content,(const void*)resCont_, length);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x50(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1e1b6
cmpq $0xfc3, %r14            # imm = 0xFC3
jne 0x1e198
movq 0x40(%r12), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x6390
cmpq $0xfc3, %r14            # imm = 0xFC3
sete %bpl
movq %rbx, %rdi
callq 0x6360
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::deleteAllSegments()
void FastTier::deleteAllSegments() {
    delete mig_;

    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
movq 0x1e0(%rdi), %r14
testq %r14, %r14
je 0x1e37c
movq %r14, %rdi
callq 0x16adc
movq %r14, %rdi
callq 0x6400
leaq 0x128(%rbx), %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movb $0x0, 0x8(%r14)
movq %r14, %rdi
callq 0xe40a
movb $0x1, 0x8(%r14)
movl $0x0, 0x4(%rsp)
cmpl $0x0, 0x124(%rbx)
jle 0x1e409
leaq 0x150(%rbx), %r14
leaq 0x4(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xe3a6
movq (%rax), %r12
testq %r12, %r12
je 0x1e3dd
movq %r12, %rdi
callq 0x1c3c6
movq %r12, %rdi
callq 0x6400
movslq 0x4(%rsp), %rax
movq 0x180(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x1e3f7
callq 0x6400
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl 0x124(%rbx), %eax
jl 0x1e3ba
leaq 0x150(%rbx), %rdi
callq 0xfc78
movq 0x180(%rbx), %rax
cmpq %rax, 0x188(%rbx)
je 0x1e42c
movq %rax, 0x188(%rbx)
leaq 0x8(%rsp), %rdi
callq 0xdf86
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xdf86
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::CreateAllSegments()
void FastTier::CreateAllSegments() {
    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_);
    for (int i = 0; i < shardsNum_; i++) {
        SegForReq * seg = new SegForReq(vol_, idxMgr_, options_.expired_time);
        segMap_.insert(make_pair(i, seg));

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

    //Create Migrate;
    mig_ = new Migrate(idxMgr_, this, mt_, options_);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x128(%rdi), %rax
leaq 0x18(%rsp), %r14
movq %rax, (%r14)
movb $0x0, 0x8(%r14)
movq %r14, %rdi
callq 0xe40a
movb $0x1, 0x8(%r14)
cmpl $0x0, 0x124(%rbx)
jle 0x1e53d
leaq 0x150(%rbx), %r14
leaq 0x180(%rbx), %r15
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
movl $0xd8, %edi
callq 0x6420
movq %rax, %r13
movq 0x1d8(%rbx), %rsi
movq (%rbx), %rax
movq 0x10(%rbx), %rdx
movl 0x10(%rax), %ecx
movq %r13, %rdi
callq 0x1c56c
movl %ebp, 0x8(%rsp)
movq %r13, 0x10(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0xebc0
movl $0x28, %edi
callq 0x6420
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq $0x0, 0x20(%rax)
movq %rax, 0x8(%rsp)
movq 0x188(%rbx), %rsi
cmpq 0x190(%rbx), %rsi
je 0x1e524
movq %rax, (%rsi)
addq $0x8, 0x188(%rbx)
jmp 0x1e52f
movq %r15, %rdi
movq %r12, %rdx
callq 0xecfe
incl %ebp
cmpl 0x124(%rbx), %ebp
jl 0x1e4ac
movl $0x58, %edi
callq 0x6420
movq %rax, %r14
movq (%rbx), %r8
movq 0x10(%rbx), %rsi
movq 0x1e8(%rbx), %rcx
movq %rax, %rdi
movq %rbx, %rdx
callq 0x16af4
movq %r14, 0x1e0(%rbx)
leaq 0x18(%rsp), %rdi
callq 0xdf86
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
jmp 0x1e595
jmp 0x1e59e
jmp 0x1e59e
movq %rax, %rbx
movq %r13, %rdi
callq 0x6400
jmp 0x1e5a1
jmp 0x1e59e
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xdf86
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::SegTimeoutThdEntry()
void FastTier::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);
                seg = new SegForReq(vol_, 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 $0x38, %rsp
movq %rdi, %rbx
leaq 0x128(%rdi), %rax
leaq 0x28(%rsp), %r14
movq %rax, (%r14)
movb $0x0, 0x8(%r14)
leaq 0x150(%rdi), %r15
leaq 0x158(%rdi), %r13
leaq 0x8(%rsp), %r12
movb 0x218(%rbx), %al
testb $0x1, %al
jne 0x1e9bf
movl $0x0, 0x4(%rsp)
cmpl $0x0, 0x124(%rbx)
jle 0x1e9af
xorl %eax, %eax
cltq
movq 0x180(%rbx), %rcx
movq (%rcx,%rax,8), %rax
movq %rax, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %r12, %rdi
callq 0xe40a
movb $0x1, 0x10(%rsp)
movq %r14, %rdi
callq 0xe40a
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0xe3a6
movq (%rax), %rbp
movq %r14, %rdi
callq 0xe446
movq %rbp, %rdi
callq 0x1c852
testb %al, %al
je 0x1e991
movq %rbp, %rdi
callq 0x1c6dc
movq 0x208(%rbx), %rdi
movq %rbp, %rsi
callq 0xe46e
movl $0xd8, %edi
callq 0x6420
movq %rax, %rbp
movq 0x1d8(%rbx), %rsi
movq (%rbx), %rax
movq 0x10(%rbx), %rdx
movl 0x10(%rax), %ecx
movq %rbp, %rdi
callq 0x1c56c
movq %r14, %rdi
callq 0xe40a
movq 0x160(%rbx), %rcx
movq %r13, %rax
testq %rcx, %rcx
je 0x1e951
movl 0x4(%rsp), %edx
movq %r13, %rax
xorl %esi, %esi
cmpl %edx, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x1e93a
movq %r13, %rsi
cmpq %r13, %rax
je 0x1e967
movl 0x4(%rsp), %ecx
cmpl 0x20(%rax), %ecx
cmovlq %r13, %rax
movq %rax, %rsi
movq %r15, %rdi
callq 0xfe9e
movl 0x4(%rsp), %eax
movl %eax, 0x18(%rsp)
movq %rbp, 0x20(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
callq 0xebc0
movq %r14, %rdi
callq 0xe446
movq %r12, %rdi
callq 0xdf86
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl 0x124(%rbx), %eax
jl 0x1e88b
movq (%rbx), %rax
movl 0x10(%rax), %edi
callq 0x6560
jmp 0x1e866
leaq 0x28(%rsp), %rdi
callq 0xdf86
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e9e9
movq %rax, %rbx
movq %rbp, %rdi
callq 0x6400
jmp 0x1e9f5
jmp 0x1e9f2
movq %rax, %rbx
jmp 0x1e9ff
jmp 0x1e9f2
jmp 0x1e9f2
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xdf86
leaq 0x28(%rsp), %rdi
callq 0xdf86
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::StopThds()
void FastTier::StopThds() {
    //vol_->StopThds();

    migrationT_stop_.store(true);
    migrationT_.join();

    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
movb $0x1, %bpl
movb $0x1, %al
xchgb %al, 0x228(%rdi)
addq $0x220, %rdi            # imm = 0x220
callq 0x6660
xchgb %bpl, 0x218(%rbx)
leaq 0x210(%rbx), %rdi
callq 0x6660
cmpl $0x0, 0x124(%rbx)
jle 0x1eaf1
xorl %r15d, %r15d
movq 0x1f0(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %r14, %rdi
callq 0xe1d2
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
incq %r15
movslq 0x124(%rbx), %rax
cmpq %rax, %r15
jl 0x1eac6
movq 0x1f0(%rbx), %rax
cmpq %rax, 0x1f8(%rbx)
je 0x1eb08
movq %rax, 0x1f8(%rbx)
movq 0x208(%rbx), %rdi
testq %rdi, %rdi
je 0x1eb35
callq 0xe216
movq 0x208(%rbx), %rdi
testq %rdi, %rdi
je 0x1eb35
movq (%rdi), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::writeDataImmediately(hlkvds::KVSlice&)
Status FastTier::writeDataImmediately(KVSlice& slice){
    uint32_t seg_id = 0;
    bool ret = false;

    ret = allocSegment(seg_id);
    if (!ret) {
        __ERROR("Cann't get a new Empty Segment.\n");
        return Status::Aborted("Can't allocate a Empty Segment.");
    }

    SegLatencyFriendly *seg = new SegLatencyFriendly(vol_, idxMgr_);
    seg->Put(&slice);
    seg->SegSegId(seg_id);
    ret = seg->WriteSegToDevice();
    if(!ret) {
        __ERROR("Write batch segment to device failed");
        vol_->FreeForFailed(seg_id);
        delete seg;
        return Status::IOError("could not write batch segment to device ");
    }
    uint32_t free_size = seg->GetFreeSize();
    vol_->Use(seg_id, free_size);
    seg->UpdateToIndex();
    delete seg;
    return Status::OK();

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
movq %r15, %rdi
callq 0x1ee3a
testb %al, %al
je 0x1ece4
movl $0x48, %edi
callq 0x6420
movq %rax, %r14
movq 0x10(%r15), %rdx
movq 0x1d8(%r15), %rsi
movq %rax, %rdi
callq 0x1cb78
addq $0x1d8, %r15            # imm = 0x1D8
movq %r14, %rdi
movq %r12, %rsi
callq 0x1cbca
movl 0x4(%rsp), %eax
movl %eax, 0x10(%r14)
movq %r14, %rdi
callq 0x1cc8c
testb %al, %al
je 0x1ecee
movl 0x14(%r14), %edx
subl 0x20(%r14), %edx
addl $-0x20, %edx
movq (%r15), %rdi
movl 0x4(%rsp), %esi
callq 0x20dd0
movq %r14, %rdi
callq 0x1cf78
movq %r14, %rdi
callq 0x1caf4
movq %r14, %rdi
callq 0x6400
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x8a31
jmp 0x1ecd5
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x8aa8
jmp 0x1ecd5
movq %rax, %rbx
movq %r14, %rdi
callq 0x6400
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::WriteBatchData(hlkvds::WriteBatch*)
Status FastTier::WriteBatchData(WriteBatch *batch) {
    uint32_t seg_id = 0;
    bool ret = false;

    ret = allocSegment(seg_id);
    if (!ret) {
        __ERROR("Cann't get a new Empty Segment.\n");
        return Status::Aborted("Can't allocate a Empty Segment.");
    }

    SegForSlice *seg = new SegForSlice(vol_, idxMgr_);
    for (std::list<KVSlice *>::iterator iter = batch->batch_.begin();
            iter != batch->batch_.end(); iter++) {
        if (seg->TryPut(*iter)) {
            seg->Put(*iter);
        }
        else {
            __ERROR("The Batch is too large, can't put in one segment");
            delete seg;
            return Status::Aborted("Batch is too large.");
        }
    }

    seg->SetSegId(seg_id);
    ret = seg->WriteSegToDevice();
    if(!ret) {
        __ERROR("Write batch segment to device failed");
        vol_->FreeForFailed(seg_id);
        delete seg;
        return Status::IOError("could not write batch segment to device ");
    }

    uint32_t free_size = seg->GetFreeSize();
    vol_->Use(seg_id, free_size);
    seg->UpdateToIndex();
    delete seg;
    return Status::OK();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
movq %r15, %rdi
callq 0x1ee3a
testb %al, %al
je 0x1edfb
movl $0x50, %edi
callq 0x6420
movq %rax, %r14
movq 0x10(%r15), %rdx
movq 0x1d8(%r15), %rsi
movq %rax, %rdi
callq 0x1c9e0
movq (%r12), %r13
cmpq %r12, %r13
je 0x1ed96
movq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0x1be30
testb %al, %al
je 0x1ee1a
movq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0x1be4a
movq (%r13), %r13
jmp 0x1ed6b
addq $0x1d8, %r15            # imm = 0x1D8
movl 0xc(%rsp), %eax
movl %eax, (%r14)
movq %r14, %rdi
callq 0x1bf16
testb %al, %al
je 0x1ee05
movl 0x18(%r14), %edx
subl 0x14(%r14), %edx
movq (%r15), %rdi
movl 0xc(%rsp), %esi
callq 0x20dd0
movq %r14, %rdi
callq 0x1ca1a
movq %r14, %rdi
callq 0x1bd18
movq %r14, %rdi
callq 0x6400
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x8b56
jmp 0x1edea
leaq 0xc(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x8c61
jmp 0x1edea
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8bcb
jmp 0x1edea
movq %rax, %rbx
movq %r14, %rdi
callq 0x6400
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::allocSegment(unsigned int&)
bool FastTier::allocSegment(uint32_t &seg_id) {
    std::lock_guard <std::mutex> l(allocMtx_);

    uint32_t mt_vol_num = mt_->GetVolumeNum();
    while (!vol_->Alloc(seg_id)) {
        __DEBUG("cant't alloc segment, need migrate, free = %d, used = %d", vol_->GetTotalFreeSegs(), vol_->GetTotalUsedSegs());
        if (mt_vol_num == 0) {
            return false;
        }
        uint32_t mt_vol_id = mt_->PickVolForMigrate();
        mt_vol_num--;
        uint32_t free_num = mig_->ForeMigrate(mt_vol_id);
        __DEBUG("After migration total free %d segments on Medium Tier Volume [%d].", free_num, mt_vol_id);
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x198(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1eeb4
movq 0x1e8(%r15), %rax
movl 0x40(%rax), %r12d
movq 0x1d8(%r15), %rdi
movq %r14, %rsi
callq 0x20ce2
movl %eax, %ebp
subl $0x1, %r12d
setb %al
orb %bpl, %al
testb $0x1, %al
jne 0x1eea1
movq 0x1e8(%r15), %rdi
callq 0x1f602
movq 0x1e0(%r15), %rdi
movl %eax, %esi
callq 0x16b2c
jmp 0x1ee66
movq %rbx, %rdi
callq 0x6360
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
jmp 0x1eebf
jmp 0x1eebf
movq %rax, %r14
movq %rbx, %rdi
callq 0x6360
movq %r14, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::ReadData(hlkvds::KVSlice&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
Status FastTier::ReadData(KVSlice &slice, std::string &data) {
    HashEntry *entry;
    entry = &slice.GetHashEntry();

    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, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq 0x28(%rdx), %r15
leaq 0x8(%rsp), %rdx
movq $0x0, (%rdx)
movq 0x1d8(%rsi), %rdi
movq %r15, %rsi
callq 0x20e14
testb %al, %al
je 0x1ef6b
movq (%r15), %rax
movzwl 0x16(%rax), %r15d
testq %r15, %r15
je 0x1ef7c
movq %r15, %rdi
callq 0x6040
movq %rax, %r13
movq 0x1d8(%r12), %rdi
movq 0x8(%rsp), %rcx
movq %rax, %rsi
movq %r15, %rdx
callq 0x20d00
testb %al, %al
je 0x1efa1
movq 0x8(%r14), %rdx
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rcx
movq %r15, %r8
callq 0x65e0
movq %r13, %rdi
callq 0x64e0
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
jmp 0x1ef90
leaq 0x3658(%rip), %rdx      # 0x225ca
movq %rbx, %rdi
movl $0x7, %esi
jmp 0x1ef8b
leaq 0x3665(%rip), %rdx      # 0x225e8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1de18
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8d0f
jmp 0x1ef90
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::GetSBReservedContent(char*, unsigned long)
bool FastTier::GetSBReservedContent(char* buf, uint64_t length) {
    if (length != sizeof(MultiTierDS_SB_Reserved_FastTier)) {
        return false;
    }

    sbResFastTier_.cur_seg_id = vol_->GetCurSegId();

    memcpy((void*)buf, (const void*)&sbResFastTier_, length);
    __DEBUG("MultiTierDS_SB_Reserved_FastTier: segment_size = %d, dev_path = %s, segment_num = %d, cur_seg_id = %d",
            sbResFastTier_.segment_size, sbResFastTier_.dev_path,
            sbResFastTier_.segment_num, sbResFastTier_.cur_seg_id);

    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
cmpq $0x10c, %rdx            # imm = 0x10C
jne 0x1efee
movq %rsi, %r14
movq %rdi, %r15
movq 0x1d8(%rdi), %rdi
callq 0x20d64
movl %eax, 0x120(%r15)
addq $0x18, %r15
movl $0x10c, %edx            # imm = 0x10C
movq %r14, %rdi
movq %r15, %rsi
callq 0x6390
cmpq $0x10c, %rbx            # imm = 0x10C
sete %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::SetSBReservedContent(char*, unsigned long)
bool FastTier::SetSBReservedContent(char* buf, uint64_t length) {
    if (length != sizeof(MultiTierDS_SB_Reserved_FastTier)) {
        return false;
    }

    memcpy((void*)&sbResFastTier_, (const void*)buf, length);
    __DEBUG("MultiTierDS_SB_Reserved_FastTier: segment_size = %d, dev_path = %s, segment_num = %d, cur_seg_id = %d",
            sbResFastTier_.segment_size, sbResFastTier_.dev_path,
            sbResFastTier_.segment_num, sbResFastTier_.cur_seg_id);
    return true;
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
cmpq $0x10c, %rdx            # imm = 0x10C
jne 0x1f019
addq $0x18, %rdi
movl $0x10c, %edx            # imm = 0x10C
callq 0x6390
cmpq $0x10c, %rbx            # imm = 0x10C
sete %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::CreateVolume(std::vector<hlkvds::BlockDevice*, std::allocator<hlkvds::BlockDevice*>>&, unsigned long, unsigned int)
bool FastTier::CreateVolume(std::vector<BlockDevice*> &bd_vec, uint64_t sst_offset, uint32_t medium_tier_total_seg_num) {
    segSize_ = options_.segment_size;

    uint32_t align_bit = log2(ALIGNED_SIZE);
    if (segSize_ != (segSize_ >> align_bit) << align_bit) {
        __ERROR("FastTier Segment Size is not page aligned!");
        return false;
    }

    BlockDevice *bdev = bd_vec[0];
    uint64_t device_capacity = bdev->GetDeviceCapacity();
    uint32_t seg_num = DS_MultiTier_Impl::CalcSegNumForFastTierVolume(device_capacity, sst_offset, segSize_, medium_tier_total_seg_num);
    segNum_ = seg_num;
    maxValueLen_ = segSize_ - SegBase::SizeOfSegOnDisk() - IndexManager::SizeOfHashEntryOnDisk();

    uint32_t seg_total_num = segNum_ + medium_tier_total_seg_num;
    sstLengthOnDisk_ = DS_MultiTier_Impl::CalcSSTsLengthOnDiskBySegNum(seg_total_num);

    uint64_t start_off = sst_offset + sstLengthOnDisk_;
    vol_ = new Volume(bdev, idxMgr_, options_, hlkvds::FastTierVolId, start_off, segSize_, segNum_, 0);

    initSBReservedContentForCreate();

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %rax
movl 0x44(%rax), %r13d
movl %r13d, 0x1d0(%rdi)
testl $0xfff, %r13d           # imm = 0xFFF
jne 0x1f120
movl %ecx, %ebp
movq %rdx, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq (%rax), %r15
movq (%r15), %rax
movq %r15, %rdi
callq *0x30(%rax)
movl 0x1d0(%rbx), %edx
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %ecx
callq 0xc07e
movl %eax, 0x1d4(%rbx)
movl 0x1d0(%rbx), %ecx
addl $-0x4a, %ecx
movl %ecx, 0x1c0(%rbx)
addl %eax, %ebp
movl %ebp, %edi
callq 0xc056
movq %rax, 0x1c8(%rbx)
addq %rax, %r14
movl $0x58, %edi
callq 0x6420
movq %rax, %r12
movq (%rbx), %rcx
movq 0x10(%rbx), %rdx
movl 0x1d0(%rbx), %eax
movl 0x1d4(%rbx), %r10d
subq $0x8, %rsp
movq %r12, %rdi
movq %r15, %rsi
movl $0x64, %r8d
movq %r14, %r9
pushq $0x0
pushq %r10
pushq %rax
callq 0x20b3c
addq $0x20, %rsp
movq %r12, 0x1d8(%rbx)
movq %rbx, %rdi
callq 0x1f13a
testl $0xfff, %r13d           # imm = 0xFFF
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8d9d
jmp 0x1f107
movq %rax, %rbx
movq %r12, %rdi
callq 0x6400
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::initSBReservedContentForCreate()
void FastTier::initSBReservedContentForCreate() {
    sbResFastTier_.segment_size = segSize_;
    string dev_path  = vol_->GetDevicePath();
    memcpy((void*)&sbResFastTier_.dev_path, (const void*)dev_path.c_str(), dev_path.size());
    sbResFastTier_.segment_num = segNum_;
    sbResFastTier_.cur_seg_id = vol_->GetCurSegId();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl 0x1d0(%rdi), %eax
movl %eax, 0x18(%rdi)
movq 0x1d8(%rdi), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x20d6c
leaq 0x1c(%rbx), %rdi
movq (%r14), %rsi
movq 0x8(%r14), %rdx
callq 0x6390
movl 0x1d4(%rbx), %eax
movl %eax, 0x11c(%rbx)
movq 0x1d8(%rbx), %rdi
callq 0x20d64
movl %eax, 0x120(%rbx)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1f1a2
callq 0x6400
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1f1c0
callq 0x6400
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::OpenVolume(std::vector<hlkvds::BlockDevice*, std::allocator<hlkvds::BlockDevice*>>&)
bool FastTier::OpenVolume(std::vector<BlockDevice*> &bd_vec) {
    segSize_ = sbResFastTier_.segment_size;
    segNum_ = sbResFastTier_.segment_num;
    maxValueLen_ = segSize_ - SegBase::SizeOfSegOnDisk() - IndexManager::SizeOfHashEntryOnDisk();
    sstLengthOnDisk_ = sbMgr_->GetSSTRegionLength();

    if (!verifyTopology(bd_vec)) {
        __ERROR("TheDevice Topology is inconsistent");
        return false;
    }

    BlockDevice *bdev = bd_vec[0];
    uint32_t cur_id = sbResFastTier_.cur_seg_id;
    uint64_t start_off = sbMgr_->GetSSTRegionOffset() + sbMgr_->GetSSTRegionLength();
    vol_ = new Volume(bdev, idxMgr_, options_, hlkvds::FastTierVolId, start_off, segSize_, segNum_, cur_id);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x18(%rdi), %eax
movl %eax, 0x1d0(%rdi)
movl 0x11c(%rdi), %ecx
movl %ecx, 0x1d4(%rdi)
addl $-0x4a, %eax
movl %eax, 0x1c0(%rdi)
movq 0x8(%rdi), %rax
movq 0x24(%rax), %rax
movq %rax, 0x1c8(%rdi)
callq 0x1f29e
movl %eax, %ebp
testb %al, %al
je 0x1f284
movq (%r14), %rax
movq (%rax), %r15
movl 0x120(%rbx), %r13d
movq 0x8(%rbx), %rax
movq 0x24(%rax), %r12
addq 0x1c(%rax), %r12
movl $0x58, %edi
callq 0x6420
movq %rax, %r14
movq (%rbx), %rcx
movq 0x10(%rbx), %rdx
movl 0x1d0(%rbx), %eax
movl 0x1d4(%rbx), %r10d
subq $0x8, %rsp
movq %r14, %rdi
movq %r15, %rsi
movl $0x64, %r8d
movq %r12, %r9
pushq %r13
pushq %r10
pushq %rax
callq 0x20b3c
addq $0x20, %rsp
movq %r14, 0x1d8(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8dff
jmp 0x1f273
movq %rax, %rbx
movq %r14, %rdi
callq 0x6400
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::verifyTopology(std::vector<hlkvds::BlockDevice*, std::allocator<hlkvds::BlockDevice*>>&)
bool FastTier::verifyTopology(std::vector<BlockDevice*> &bd_vec) {
    string record_path = string(sbResFastTier_.dev_path);
    string device_path = bd_vec[0]->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 %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1c(%rdi), %r15
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq %r15, %rdi
callq 0x61a0
leaq (%r14,%rax), %rdx
addq $0x1c, %rdx
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0xa6dc
movq (%rbx), %rax
movq (%rax), %rsi
movq (%rsi), %rax
leaq 0x28(%rsp), %rdi
callq *0x28(%rax)
movq 0x10(%rsp), %rdx
movb $0x1, %bl
cmpq 0x30(%rsp), %rdx
jne 0x1f316
testq %rdx, %rdx
je 0x1f314
movq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x6430
testl %eax, %eax
setne %bl
jmp 0x1f316
xorl %ebx, %ebx
testb %bl, %bl
jne 0x1f34d
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1f32d
callq 0x6400
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1f33c
callq 0x6400
xorb $0x1, %bl
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x8e61
jmp 0x1f31a
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1f370
callq 0x6400
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::GetKeyByHashEntry[abi:cxx11](hlkvds::HashEntry*)
std::string FastTier::GetKeyByHashEntry(HashEntry *entry) {
    uint64_t key_offset = 0;

    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
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %rdx
movq $0x0, (%rdx)
movq 0x1d8(%rsi), %rdi
movq %r14, %rsi
callq 0x20e3e
testb %al, %al
je 0x1f490
movq (%r14), %rax
movzwl 0x14(%rax), %r12d
leaq 0x1(%r12), %rdi
callq 0x6040
movq %rax, %r14
movq 0x1d8(%r15), %rdi
movq (%rsp), %rcx
movq %rax, %rsi
movq %r12, %rdx
callq 0x20d00
testb %al, %al
je 0x1f4b8
movq %r14, %rdx
addq %r12, %rdx
movb $0x0, (%r14,%r12)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa6dc
movq %r14, %rdi
callq 0x64e0
jmp 0x1f4a9
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x374e(%rip), %rdx      # 0x22bec
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xa6dc
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8ed7
jmp 0x1f4a9
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::GetValueByHashEntry[abi:cxx11](hlkvds::HashEntry*)
std::string FastTier::GetValueByHashEntry(HashEntry *entry) {
    uint64_t data_offset = 0;

    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
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdx
movq $0x0, (%rdx)
movq 0x1d8(%rsi), %rdi
movq %r15, %rsi
callq 0x20e14
testb %al, %al
je 0x1f54f
movq (%r15), %rax
movzwl 0x16(%rax), %r12d
testq %r12, %r12
je 0x1f54f
leaq 0x1(%r12), %rdi
callq 0x6040
movq %rax, %r15
movq 0x1d8(%r14), %rdi
movq (%rsp), %rcx
movq %rax, %rsi
movq %r12, %rdx
callq 0x20d00
testb %al, %al
je 0x1f577
movq %r15, %rdx
addq %r12, %rdx
movb $0x0, (%r15,%r12)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa6dc
movq %r15, %rdi
callq 0x64e0
jmp 0x1f568
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x368f(%rip), %rdx      # 0x22bec
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xa6dc
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8f6c
jmp 0x1f568
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::PickVolForMigrate()
uint32_t MediumTier::PickVolForMigrate() {
    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, %r14
leaq 0x80(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x1f643
movl 0x40(%r14), %eax
movl 0x78(%r14), %ecx
decl %eax
leal 0x1(%rcx), %edx
xorl %ebp, %ebp
cmpl %eax, %ecx
cmovnel %edx, %ebp
movl %ebp, 0x78(%r14)
movq %rbx, %rdi
callq 0x6360
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::ReqMerge(hlkvds::Request*)
void FastTier::ReqMerge(Request* req) {
    int shard_id = req->GetShardsWQId();

    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_, std::defer_lock);

    std::mutex *seg_mtx = segMtxVec_[shard_id];
    std::unique_lock<std::mutex> lck_seg(*seg_mtx);

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

    if (seg->TryPut(req)) {
        seg->Put(req);
    } else {
        seg->Completion();
        segWteWQ_->Add_task(seg);

        seg = new SegForReq(vol_, idxMgr_, options_.expired_time);

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

        seg->Put(req);
    }

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x70(%rsi), %rax
movl %eax, 0x4(%rsp)
leaq 0x128(%rdi), %rcx
movq %rcx, 0x8(%rsp)
xorl %ecx, %ecx
movb %cl, 0x10(%rsp)
movq 0x180(%rdi), %rdx
movq (%rdx,%rax,8), %rax
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
movb %cl, 0x8(%rdi)
callq 0xe40a
movb $0x1, 0x20(%rsp)
leaq 0x8(%rsp), %rdi
callq 0xe40a
leaq 0x150(%r14), %r15
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0xe3a6
movq (%rax), %r12
leaq 0x8(%rsp), %rdi
callq 0xe446
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1c656
testb %al, %al
je 0x1f6df
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1c67c
jmp 0x1f7a1
movq %r12, %rdi
callq 0x1c6dc
movq 0x208(%r14), %rdi
movq %r12, %rsi
callq 0xe46e
movl $0xd8, %edi
callq 0x6420
movq %rax, %r12
movq 0x1d8(%r14), %rsi
movq (%r14), %rax
movq 0x10(%r14), %rdx
movl 0x10(%rax), %ecx
movq %r12, %rdi
callq 0x1c56c
leaq 0x8(%rsp), %rdi
callq 0xe40a
movq 0x160(%r14), %rcx
addq $0x158, %r14            # imm = 0x158
movq %r14, %rax
testq %rcx, %rcx
je 0x1f75a
movl 0x4(%rsp), %edx
movq %r14, %rax
xorl %esi, %esi
cmpl %edx, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x1f743
cmpq %r14, %rax
je 0x1f76a
movl 0x4(%rsp), %ecx
cmpl 0x20(%rax), %ecx
cmovgeq %rax, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xfe9e
movl 0x4(%rsp), %eax
leaq 0x28(%rsp), %rsi
movl %eax, (%rsi)
movq %r12, 0x8(%rsi)
movq %r15, %rdi
callq 0xebc0
leaq 0x8(%rsp), %rdi
callq 0xe446
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1c67c
leaq 0x18(%rsp), %rdi
callq 0xdf86
leaq 0x8(%rsp), %rdi
callq 0xdf86
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1f7d9
movq %rax, %rbx
movq %r12, %rdi
callq 0x6400
jmp 0x1f7dc
jmp 0x1f7d9
movq %rax, %rbx
jmp 0x1f7e6
jmp 0x1f7d9
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xdf86
leaq 0x8(%rsp), %rdi
callq 0xdf86
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::SegWrite(hlkvds::SegForReq*)
void FastTier::SegWrite(SegForReq *seg) {
    uint32_t seg_id = 0;
    bool ret = false;

    ret = allocSegment(seg_id);
    if (!ret) {
        __ERROR("Cann't get a new Empty Segment.\n");
        seg->Notify(ret);
        return ;
    }

    uint32_t free_size = seg->GetFreeSize();
    seg->SetSegId(seg_id);
    ret = seg->WriteSegToDevice();
    if (ret) {
        vol_->Use(seg_id, free_size);
    } else {
        vol_->FreeForFailed(seg_id);
    }
    seg->Notify(ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x1ee3a
testb %al, %al
je 0x1f87b
movl 0x14(%rbx), %r12d
movl 0x18(%rbx), %r15d
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movq %rbx, %rdi
callq 0x1bf16
movl %eax, %ebp
testb %al, %al
je 0x1f852
subl %r12d, %r15d
movq 0x1d8(%r14), %rdi
movl 0xc(%rsp), %esi
movl %r15d, %edx
callq 0x20dd0
jmp 0x1f862
movq 0x1d8(%r14), %rdi
movl 0xc(%rsp), %esi
callq 0x20dbc
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0x1c6e8
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x9001
xorl %ebp, %ebp
jmp 0x1f862
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::ManualGC()
void MediumTier::ManualGC() {
    map<int, Volume *>::iterator iter;
    for (iter = volMap_.begin(); iter != volMap_.end(); ) {
        Volume *vol = iter->second;
        vol->FullGC();
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x60(%rdi), %r14
addq $0x50, %rbx
cmpq %rbx, %r14
je 0x1faff
movq 0x28(%r14), %rdi
callq 0x20de4
jmp 0x1faef
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::GetSBReservedContent(char*, unsigned long)
bool MediumTier::GetSBReservedContent(char* buf, uint64_t length) {
    uint32_t except_length = sizeof(MultiTierDS_SB_Reserved_MediumTier_Header) +
                            volNum_ * sizeof(MultiTierDS_SB_Reserved_MediumTier_Content);
    if (length != except_length) {
        return false;
    }

    updateAllVolSBRes();

    char* buf_ptr = buf;
    uint64_t medium_tier_header_size = sizeof(MultiTierDS_SB_Reserved_MediumTier_Header);
    memcpy((void*)buf, (const void *)&sbResMediumTierHeader_, medium_tier_header_size);
    __DEBUG("MultiTierDS_SB_Reserved_MediumTier_Header: segment_size = %d, volume_num = %d",
            sbResMediumTierHeader_.segment_size, sbResMediumTierHeader_.volume_num);
    buf_ptr += medium_tier_header_size;

    //Get sbResVolVec_
    uint64_t sb_res_item_size = sizeof(MultiTierDS_SB_Reserved_MediumTier_Content);
    for (uint32_t i = 0; i < volNum_; i++) {
        memcpy((void*)buf_ptr, (const void*)&sbResMediumTierVolVec_[i], sb_res_item_size);
        buf_ptr += sb_res_item_size;
        __DEBUG("MultiTierDS_SB_Reserved_MediumTier_Content[%d]: device_path = %s, segment_num = %d, current_seg_id = %d",
            i, sbResMediumTierVolVec_[i].dev_path, sbResMediumTierVolVec_[i].segment_num,
            sbResMediumTierVolVec_[i].cur_seg_id);

    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl 0x40(%rdi), %eax
movl %eax, %ecx
shll $0x8, %ecx
leal (%rcx,%rax,8), %r12d
addl $0x8, %r12d
cmpq %rdx, %r12
jne 0x1fb75
movq %rsi, %r14
movq %rdi, %r15
callq 0x1fb8a
movq 0x18(%r15), %rax
movq %rax, (%r14)
cmpl $0x0, 0x40(%r15)
je 0x1fb75
addq $0x8, %r14
xorl %r13d, %r13d
xorl %ebp, %ebp
leaq (%r14,%r13), %rdi
movq 0x20(%r15), %rsi
addq %r13, %rsi
movl $0x108, %edx            # imm = 0x108
callq 0x6390
incq %rbp
movl 0x40(%r15), %eax
addq $0x108, %r13            # imm = 0x108
cmpq %rax, %rbp
jb 0x1fb4d
cmpq %rbx, %r12
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::SetSBReservedContent(char*, unsigned long)
bool MediumTier::SetSBReservedContent(char* buf, uint64_t length) {
    char* buf_ptr = buf;
    uint64_t medium_tier_header_size = sizeof(MultiTierDS_SB_Reserved_MediumTier_Header);
    memcpy((void*)&sbResMediumTierHeader_, (const void *)buf_ptr, medium_tier_header_size);
    __DEBUG("MultiTierDS_SB_Reserved_MediumTier_Header: segment_size = %d, volume_num = %d",
            sbResMediumTierHeader_.segment_size, sbResMediumTierHeader_.volume_num);
    buf_ptr += medium_tier_header_size;

    uint64_t except_length = sizeof(MultiTierDS_SB_Reserved_MediumTier_Header) +
                            sbResMediumTierHeader_.volume_num * sizeof(MultiTierDS_SB_Reserved_MediumTier_Content);
    if (length != except_length) {
        __INFO("!!!!!length = %ld, except_length = %ld, volNum_ = %d", length, except_length, volNum_);
        return false;
    }

    //Get sbResVolVec_
    uint64_t sb_res_item_size = sizeof(MultiTierDS_SB_Reserved_MediumTier_Content);
    for (uint32_t i = 0; i < sbResMediumTierHeader_.volume_num; i++) {
        MultiTierDS_SB_Reserved_MediumTier_Content sb_res_item;
        memcpy((void*)&sb_res_item, (const void*)buf_ptr, sb_res_item_size);
        sbResMediumTierVolVec_.push_back(sb_res_item);
        buf_ptr += sb_res_item_size;
        __DEBUG("MultiTierDS_SB_Reserved_MediumTier_Content[%d]: device_path = %s, segment_num = %d, current_seg_id = %d",
            i, sbResMediumTierVolVec_[i].dev_path, sbResMediumTierVolVec_[i].segment_num,
            sbResMediumTierVolVec_[i].cur_seg_id);
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %r15
movq (%rsi), %rax
movq %rax, 0x18(%rdi)
movl 0x1c(%rdi), %eax
movq %rax, %rcx
shlq $0x8, %rcx
leaq (%rcx,%rax,8), %r14
addq $0x8, %r14
cmpq %rdx, %r14
movq %rdx, 0x8(%rsp)
jne 0x1fcae
cmpl $0x0, 0x1c(%r15)
je 0x1fc94
movq %rsi, %r12
addq $0x8, %r12
leaq 0x20(%r15), %r13
xorl %ebx, %ebx
leaq 0x10(%rsp), %rbp
movl $0x108, %edx            # imm = 0x108
movq %rbp, %rdi
movq %r12, %rsi
callq 0x6390
movq 0x28(%r15), %rsi
cmpq 0x30(%r15), %rsi
je 0x1fc7a
movl $0x108, %edx            # imm = 0x108
movq %rsi, %rdi
movq %r12, %rsi
callq 0x6610
addq $0x108, 0x28(%r15)      # imm = 0x108
jmp 0x1fc85
movq %r13, %rdi
movq %rbp, %rdx
callq 0x207d4
addq $0x108, %r12            # imm = 0x108
incl %ebx
cmpl 0x1c(%r15), %ebx
jb 0x1fc46
cmpq 0x8(%rsp), %r14
sete %al
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x90f2
jmp 0x1fc94
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::GetSST(char*, unsigned long)
bool MediumTier::GetSST(char* buf, uint64_t length) {
    char* buf_ptr = buf;
    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
cmpl $0x0, 0x40(%rdi)
sete %bpl
je 0x1fd2e
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x48(%rdi), %r15
xorl %r13d, %r13d
movl %r13d, 0x4(%rsp)
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0xe16e
movq (%rax), %rdi
callq 0x20d7e
movq %rax, %r12
movl %r13d, (%rsp)
movq %r15, %rdi
movq %rsp, %rsi
callq 0xe16e
movq (%rax), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x20cec
testb %al, %al
je 0x1fd2e
addq %r12, %rbx
incl %r13d
cmpl 0x40(%r14), %r13d
setae %bpl
jb 0x1fce0
andb $0x1, %bpl
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_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::SetSST(char*, unsigned long)
bool MediumTier::SetSST(char* buf, uint64_t length) {
    char* buf_ptr = buf;
    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
cmpl $0x0, 0x40(%rdi)
sete %bpl
je 0x1fdb4
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x48(%rdi), %r15
xorl %r13d, %r13d
movl %r13d, 0x4(%rsp)
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0xe16e
movq (%rax), %rdi
callq 0x20d7e
movq %rax, %r12
movl %r13d, (%rsp)
movq %r15, %rdi
movq %rsp, %rsi
callq 0xe16e
movq (%rax), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x20cf6
testb %al, %al
je 0x1fdb4
addq %r12, %rbx
incl %r13d
cmpl 0x40(%r14), %r13d
setae %bpl
jb 0x1fd66
andb $0x1, %bpl
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_O1/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::CreateVolume(std::vector<hlkvds::BlockDevice*, std::allocator<hlkvds::BlockDevice*>>&)
bool MediumTier::CreateVolume(std::vector<BlockDevice*> &bd_vec) {

    segSize_ = options_.secondary_seg_size;
    uint32_t align_bit = log2(ALIGNED_SIZE);
    if (segSize_ != (segSize_ >> align_bit) << align_bit) {
        __ERROR("Medium Tier Segment Size is not page aligned!");
        return false;
    }

    int fast_tier_device_num = hlkvds::FastTierVolNum;
    volNum_ = bd_vec.size() - fast_tier_device_num;

    for (uint32_t i = 0; i < volNum_; i++ ) {
        BlockDevice *bdev = bd_vec[i + fast_tier_device_num];
        uint64_t device_capacity = bdev->GetDeviceCapacity();
        uint32_t seg_num = DS_MultiTier_Impl::CalcSegNumForMediumTierVolume(device_capacity, segSize_);
        Volume *vol = new Volume(bdev, idxMgr_, options_, i, 0, segSize_, seg_num, 0);
        volMap_.insert( pair<int, Volume*>(i, vol) );
        segTotalNum_ += seg_num;
    }

    initSBReservedContentForCreate();
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq (%rdi), %rax
movl 0x48(%rax), %ebp
movl %ebp, 0x38(%rdi)
testl $0xfff, %ebp            # imm = 0xFFF
jne 0x1fec1
movq %rdi, %rbx
movl %ebp, 0xc(%rsp)
movq 0x8(%rsi), %rax
subq (%rsi), %rax
shrq $0x3, %rax
decl %eax
movl %eax, 0x40(%rdi)
je 0x1fe9d
leaq 0x48(%rbx), %rax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
movq %rsi, %r15
movq (%rsi), %rax
movq 0x8(%rax,%r13,8), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
movl 0x38(%rbx), %esi
movq %rax, %rdi
callq 0xc0f2
movl %eax, %ebp
movl $0x58, %edi
callq 0x6420
movq %rax, %r12
movq (%rbx), %rcx
movq 0x10(%rbx), %rdx
movl 0x38(%rbx), %eax
subq $0x8, %rsp
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %rbp
pushq %rax
callq 0x20b3c
addq $0x20, %rsp
leaq 0x1(%r13), %r14
movl %r13d, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xf866
addl %ebp, 0x3c(%rbx)
movl 0x40(%rbx), %eax
movq %r14, %r13
cmpq %rax, %r14
movq %r15, %rsi
jb 0x1fe16
movq %rbx, %rdi
callq 0x1fedc
movl 0xc(%rsp), %ebp
testl $0xfff, %ebp            # imm = 0xFFF
sete %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x916d
jmp 0x1fea9
movq %rax, %rbx
movq %r12, %rdi
callq 0x6400
movq %rbx, %rdi
callq 0x6680
nop