LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6580
testl %eax, %eax
jne 0x1eebc
movq 0x1e8(%r15), %rax
movl 0x40(%rax), %r12d
movq 0x1d8(%r15), %rdi
movq %r14, %rsi
callq 0x20c92
movl %eax, %ebp
subl $0x1, %r12d
setb %al
orb %bpl, %al
testb $0x1, %al
jne 0x1eea9
movq 0x1e8(%r15), %rdi
callq 0x1f606
movq 0x1e0(%r15), %rdi
movl %eax, %esi
callq 0x16c14
jmp 0x1ee6e
movq %rbx, %rdi
callq 0x6350
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62b0
jmp 0x1eec7
jmp 0x1eec7
movq %rax, %r14
movq %rbx, %rdi
callq 0x6350
movq %r14, %rdi
callq 0x6670
// File: /workspace/github_cpp_makefile_star2_O3/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 0x20dc4
testb %al, %al
je 0x1ef73
movq (%r15), %rax
movzwl 0x16(%rax), %r15d
testq %r15, %r15
je 0x1ef84
movq %r15, %rdi
callq 0x6040
movq %rax, %r13
movq 0x1d8(%r12), %rdi
movq 0x8(%rsp), %rcx
movq %rax, %rsi
movq %r15, %rdx
callq 0x20cb0
testb %al, %al
je 0x1efa9
movq 0x8(%r14), %rdx
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rcx
movq %r15, %r8
callq 0x65d0
movq %r13, %rdi
callq 0x64d0
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
jmp 0x1ef98
leaq 0x3650(%rip), %rdx      # 0x225ca
movq %rbx, %rdi
movl $0x7, %esi
jmp 0x1ef93
leaq 0x365d(%rip), %rdx      # 0x225e8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1de28
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8e75
jmp 0x1ef98
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1eff6
movq %rsi, %r14
movq %rdi, %r15
movq 0x1d8(%rdi), %rdi
callq 0x20d14
movl %eax, 0x120(%r15)
addq $0x18, %r15
movl $0x10c, %edx            # imm = 0x10C
movq %r14, %rdi
movq %r15, %rsi
callq 0x6380
cmpq $0x10c, %rbx            # imm = 0x10C
sete %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1f021
addq $0x18, %rdi
movl $0x10c, %edx            # imm = 0x10C
callq 0x6380
cmpq $0x10c, %rbx            # imm = 0x10C
sete %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1f128
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 0xc20a
movl %eax, 0x1d4(%rbx)
movl 0x1d0(%rbx), %ecx
addl $-0x4a, %ecx
movl %ecx, 0x1c0(%rbx)
addl %eax, %ebp
movl %ebp, %edi
callq 0xc1e2
movq %rax, 0x1c8(%rbx)
addq %rax, %r14
movl $0x58, %edi
callq 0x6410
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 0x20af4
addq $0x20, %rsp
movq %r12, 0x1d8(%rbx)
movq %rbx, %rdi
callq 0x1f142
testl $0xfff, %r13d           # imm = 0xFFF
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8f03
jmp 0x1f10f
movq %rax, %rbx
movq %r12, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
// File: /workspace/github_cpp_makefile_star2_O3/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 0x20d1c
leaq 0x1c(%rbx), %rdi
movq (%r14), %rsi
movq 0x8(%r14), %rdx
callq 0x6380
movl 0x1d4(%rbx), %eax
movl %eax, 0x11c(%rbx)
movq 0x1d8(%rbx), %rdi
callq 0x20d14
movl %eax, 0x120(%rbx)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1f1aa
callq 0x63f0
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1f1c8
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1f2a6
movl %eax, %ebp
testb %al, %al
je 0x1f28c
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 0x6410
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 0x20af4
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 0x8f65
jmp 0x1f27b
movq %rax, %rbx
movq %r14, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
// File: /workspace/github_cpp_makefile_star2_O3/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 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq %r15, %rdi
callq 0x61a0
leaq (%r14,%rax), %rdx
addq $0x1c, %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0xa862
movq (%rbx), %rax
movq (%rax), %rsi
movq (%rsi), %rax
leaq 0x20(%rsp), %rdi
callq *0x28(%rax)
movq 0x8(%rsp), %rdx
cmpq 0x28(%rsp), %rdx
jne 0x1f347
movb $0x1, %bl
movq 0x20(%rsp), %r14
testq %rdx, %rdx
je 0x1f319
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x6420
testl %eax, %eax
jne 0x1f347
leaq 0x30(%rsp), %rax
cmpq %rax, %r14
je 0x1f32b
movq %r14, %rdi
callq 0x63f0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1f339
callq 0x63f0
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rbx
movq %rbx, %rdx
callq 0x8fc7
movq (%rbx), %r14
xorl %ebx, %ebx
jmp 0x1f319
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1f374
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
// File: /workspace/github_cpp_makefile_star2_O3/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 0x20dee
testb %al, %al
je 0x1f494
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 0x20cb0
testb %al, %al
je 0x1f4bc
movq %r14, %rdx
addq %r12, %rdx
movb $0x0, (%r14,%r12)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa862
movq %r14, %rdi
callq 0x64d0
jmp 0x1f4ad
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x374a(%rip), %rdx      # 0x22bec
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xa862
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9045
jmp 0x1f4ad
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x20dc4
testb %al, %al
je 0x1f553
movq (%r15), %rax
movzwl 0x16(%rax), %r12d
testq %r12, %r12
je 0x1f553
leaq 0x1(%r12), %rdi
callq 0x6040
movq %rax, %r15
movq 0x1d8(%r14), %rdi
movq (%rsp), %rcx
movq %rax, %rsi
movq %r12, %rdx
callq 0x20cb0
testb %al, %al
je 0x1f57b
movq %r15, %rdx
addq %r12, %rdx
movb $0x0, (%r15,%r12)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa862
movq %r15, %rdi
callq 0x64d0
jmp 0x1f56c
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x368b(%rip), %rdx      # 0x22bec
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xa862
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %rbx, %rsi
callq 0x90da
jmp 0x1f56c
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6580
testl %eax, %eax
jne 0x1f647
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 0x6350
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edi
callq 0x62b0
// File: /workspace/github_cpp_makefile_star2_O3/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 0xe58e
movb $0x1, 0x20(%rsp)
leaq 0x8(%rsp), %rdi
callq 0xe58e
leaq 0x150(%r14), %r15
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0xe528
movq (%rax), %r12
leaq 0x8(%rsp), %rdi
callq 0xe5ca
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1c678
testb %al, %al
je 0x1f6e3
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1c69e
jmp 0x1f79e
movq %r12, %rdi
callq 0x1c6fe
movq 0x208(%r14), %rdi
movq %r12, %rsi
callq 0xe5f2
movl $0xd8, %edi
callq 0x6410
movq %rax, %r12
movq 0x1d8(%r14), %rsi
movq (%r14), %rax
movq 0x10(%r14), %rdx
movl 0x10(%rax), %ecx
movq %r12, %rdi
callq 0x1c58e
leaq 0x8(%rsp), %rdi
callq 0xe58e
movq 0x160(%r14), %rax
addq $0x158, %r14            # imm = 0x158
testq %rax, %rax
je 0x1f767
movl 0x4(%rsp), %ecx
movq %r14, %rdx
xorl %esi, %esi
cmpl %ecx, 0x20(%rax)
setl %sil
cmovgeq %rax, %rdx
movq 0x10(%rax,%rsi,8), %rax
testq %rax, %rax
jne 0x1f744
cmpq %r14, %rdx
je 0x1f767
cmpl 0x20(%rdx), %ecx
cmovgeq %rdx, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x10024
movl 0x4(%rsp), %eax
leaq 0x28(%rsp), %rsi
movl %eax, (%rsi)
movq %r12, 0x8(%rsi)
movq %r15, %rdi
callq 0xed58
leaq 0x8(%rsp), %rdi
callq 0xe5ca
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1c69e
leaq 0x18(%rsp), %rdi
callq 0xe10e
leaq 0x8(%rsp), %rdi
callq 0xe10e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1f7d6
movq %rax, %rbx
movq %r12, %rdi
callq 0x63f0
jmp 0x1f7d9
jmp 0x1f7d6
movq %rax, %rbx
jmp 0x1f7e3
jmp 0x1f7d6
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xe10e
leaq 0x8(%rsp), %rdi
callq 0xe10e
movq %rbx, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1ee42
testb %al, %al
je 0x1f879
movl 0x14(%rbx), %r12d
movl 0x18(%rbx), %r15d
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movq %rbx, %rdi
callq 0x1bf42
movl %eax, %ebp
testb %al, %al
je 0x1f850
subl %r12d, %r15d
movq 0x1d8(%r14), %rdi
movl 0xc(%rsp), %esi
movl %r15d, %edx
callq 0x20d80
jmp 0x1f860
movq 0x1d8(%r14), %rdi
movl 0xc(%rsp), %esi
callq 0x20d6c
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0x1c70a
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x916f
xorl %ebp, %ebp
jmp 0x1f860
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1fb67
movq %rsi, %r14
movq %rdi, %r15
callq 0x1fb7c
movq 0x18(%r15), %rax
movq %rax, (%r14)
cmpl $0x0, 0x40(%r15)
je 0x1fb67
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 0x6380
incq %rbp
movl 0x40(%r15), %eax
addq $0x108, %r13            # imm = 0x108
cmpq %rax, %rbp
jb 0x1fb3f
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_O3/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)
shrq $0x20, %rax
movq %rax, %rcx
shlq $0x8, %rcx
leaq (%rcx,%rax,8), %r14
addq $0x8, %r14
cmpq %rdx, %r14
movq %rdx, 0x8(%rsp)
jne 0x1fc9b
testq %rax, %rax
je 0x1fc81
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 0x6380
movq 0x28(%r15), %rsi
cmpq 0x30(%r15), %rsi
je 0x1fc67
movl $0x108, %edx            # imm = 0x108
movq %rsi, %rdi
movq %r12, %rsi
callq 0x6600
addq $0x108, 0x28(%r15)      # imm = 0x108
jmp 0x1fc72
movq %r13, %rdi
movq %rbp, %rdx
callq 0x2078e
addq $0x108, %r12            # imm = 0x108
incl %ebx
cmpl 0x1c(%r15), %ebx
jb 0x1fc33
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 0x9260
jmp 0x1fc81
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
cmpl $0x0, 0x40(%rdi)
je 0x1fd26
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x48(%rdi), %r15
xorl %r12d, %r12d
movq %rsp, %r13
movl %r12d, 0x4(%rsp)
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0xe2e4
movq (%rax), %rdi
callq 0x20d2e
movq %rax, %rbp
movl %r12d, (%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0xe2e4
movq (%rax), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x20c9c
testb %al, %al
je 0x1fd17
addq %rbp, %rbx
incl %r12d
cmpl 0x40(%r14), %r12d
jb 0x1fccd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
cmpl $0x0, 0x40(%rdi)
je 0x1fda4
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x48(%rdi), %r15
xorl %r12d, %r12d
movq %rsp, %r13
movl %r12d, 0x4(%rsp)
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0xe2e4
movq (%rax), %rdi
callq 0x20d2e
movq %rax, %rbp
movl %r12d, (%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0xe2e4
movq (%rax), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x20ca6
testb %al, %al
je 0x1fd95
addq %rbp, %rbx
incl %r12d
cmpl 0x40(%r14), %r12d
jb 0x1fd4b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1fe9f
movq %rdi, %rbx
movl %ebp, 0xc(%rsp)
movq 0x8(%rsi), %rax
subq (%rsi), %rax
shrq $0x3, %rax
decl %eax
movl %eax, 0x40(%rdi)
je 0x1fe7b
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 0xc27e
movl %eax, %ebp
movl $0x58, %edi
callq 0x6410
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 0x20af4
addq $0x20, %rsp
leaq 0x1(%r13), %r14
movl %r13d, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xf9ec
addl %ebp, 0x3c(%rbx)
movl 0x40(%rbx), %eax
movq %r14, %r13
cmpq %rax, %r14
movq %r15, %rsi
jb 0x1fdf4
movq %rbx, %rdi
callq 0x1feba
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 0x92db
jmp 0x1fe87
movq %rax, %rbx
movq %r12, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::initSBReservedContentForCreate()
void MediumTier::initSBReservedContentForCreate() {
    sbResMediumTierHeader_.segment_size = segSize_;
    sbResMediumTierHeader_.volume_num = volNum_;
    for (uint32_t i = 0; i < volNum_; i++) {
        MultiTierDS_SB_Reserved_MediumTier_Content sb_res_item;
        string dev_path = volMap_[i]->GetDevicePath();
        memcpy((void*)&sb_res_item.dev_path, (const void*)dev_path.c_str(), dev_path.size());
        sb_res_item.segment_num = volMap_[i]->GetNumberOfSeg();
        sb_res_item.cur_seg_id = volMap_[i]->GetCurSegId();
        sbResMediumTierVolVec_.push_back(sb_res_item);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movl 0x38(%rdi), %eax
movl 0x40(%rdi), %ecx
movl %eax, 0x18(%rdi)
movl %ecx, 0x1c(%rdi)
testl %ecx, %ecx
je 0x1ffcb
movq %rdi, %rbx
leaq 0x48(%rdi), %r14
leaq 0x20(%rdi), %rax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
leaq 0x30(%rsp), %r12
leaq 0x4(%rsp), %r13
leaq 0x10(%rsp), %rbp
movl $0x108, %edx            # imm = 0x108
movq %r12, %rdi
xorl %esi, %esi
callq 0x6250
movl %r15d, 0x4(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0xe2e4
movq (%rax), %rsi
movq %rbp, %rdi
callq 0x20d1c
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x6380
movl %r15d, 0x4(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0xe2e4
movq (%rax), %rax
movl 0x3c(%rax), %eax
movl %eax, 0x130(%rsp)
movl %r15d, 0x4(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0xe2e4
movq (%rax), %rdi
callq 0x20d14
movl %eax, 0x134(%rsp)
movq 0x28(%rbx), %rsi
cmpq 0x30(%rbx), %rsi
je 0x1ff9d
movl $0x108, %edx            # imm = 0x108
movq %rsi, %rdi
movq %r12, %rsi
callq 0x6380
addq $0x108, 0x28(%rbx)      # imm = 0x108
jmp 0x1ffaa
movq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0x2078e
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1ffbe
callq 0x63f0
incl %r15d
cmpl 0x40(%rbx), %r15d
jb 0x1ff01
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1ffe1
jmp 0x1ffe1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1fff8
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::OpenVolume(std::vector<hlkvds::BlockDevice*, std::allocator<hlkvds::BlockDevice*>>&)
bool MediumTier::OpenVolume(std::vector<BlockDevice*> &bd_vec) {
    int fast_tier_device_num = hlkvds::FastTierVolNum;

    segSize_ = sbResMediumTierHeader_.segment_size;
    volNum_ = sbResMediumTierHeader_.volume_num;

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

    for (uint32_t i = 0; i < volNum_; i++) {
        BlockDevice *bdev = bd_vec[i + fast_tier_device_num];
        uint32_t seg_num = sbResMediumTierVolVec_[i].segment_num;
        uint32_t cur_seg_id = sbResMediumTierVolVec_[i].cur_seg_id;
        Volume *vol = new Volume(bdev, idxMgr_, options_, i, 0, segSize_, seg_num, cur_seg_id);
        volMap_.insert( pair<int, Volume*>(i, vol) );
        segTotalNum_ += seg_num;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
movl 0x18(%rdi), %eax
movl 0x1c(%rdi), %ecx
movl %eax, 0x38(%rdi)
movl %ecx, 0x40(%rdi)
movq %rsi, 0x18(%rsp)
callq 0x2010a
movb %al, 0xf(%rsp)
testb %al, %al
je 0x200f0
cmpl $0x0, 0x40(%r14)
je 0x200dd
leaq 0x48(%r14), %rax
movq %rax, 0x10(%rsp)
movl $0x104, %ebx            # imm = 0x104
xorl %r13d, %r13d
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax,%r13,8), %r12
movq 0x20(%r14), %rax
movl -0x4(%rax,%rbx), %r15d
movl (%rax,%rbx), %eax
movq %rax, 0x20(%rsp)
movl $0x58, %edi
callq 0x6410
movq %rax, %rbp
movq (%r14), %rcx
movq 0x10(%r14), %rdx
movl 0x38(%r14), %eax
subq $0x8, %rsp
movq %rbp, %rdi
movq %r12, %rsi
movl %r13d, %r8d
xorl %r9d, %r9d
pushq 0x28(%rsp)
pushq %r15
pushq %rax
callq 0x20af4
addq $0x20, %rsp
leaq 0x1(%r13), %r12
movl %r13d, 0x28(%rsp)
movq %rbp, 0x30(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xf9ec
addl %r15d, 0x3c(%r14)
movl 0x40(%r14), %eax
addq $0x108, %rbx            # imm = 0x108
movq %r12, %r13
cmpq %rax, %r12
jb 0x2004f
movb 0xf(%rsp), %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x933d
jmp 0x200dd
movq %rax, %rbx
movq %rbp, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::verifyTopology(std::vector<hlkvds::BlockDevice*, std::allocator<hlkvds::BlockDevice*>>&)
bool MediumTier::verifyTopology(std::vector<BlockDevice*> &bd_vec) {
    int fast_tier_device_num = hlkvds::FastTierVolNum;

    // Verify MediumTier Volume Number
    if (volNum_ != bd_vec.size() - fast_tier_device_num) {
        __ERROR("record MediumTierVolNum_ = %d, total block device number: %d", volNum_, (int)bd_vec.size() );
        return false;
    }

    // Verify MediumTier every Volume
    for (uint32_t i = 0; i < volNum_; i++) {
        string record_path = string(sbResMediumTierVolVec_[i].dev_path);
        string device_path = bd_vec[i + fast_tier_device_num]->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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
leaq 0x40(%rdi), %rax
movq %rax, (%rsp)
movq 0x8(%rsi), %rcx
subq (%rsi), %rcx
movl 0x40(%rdi), %edx
sarq $0x3, %rcx
decq %rcx
cmpq %rdx, %rcx
jne 0x2020e
movb $0x1, %al
testl %edx, %edx
je 0x201ff
movq %rdi, %r15
leaq 0x18(%rsp), %r12
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x20(%r15), %rax
leaq (%rax,%r13), %rbp
movq %r12, 0x8(%rsp)
testq %rax, %rax
je 0x20177
movq %rbp, %rdi
callq 0x61a0
movq %rax, %rdx
addq %rbp, %rdx
jmp 0x2017c
movl $0x1, %edx
leaq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0xa862
movq (%rbx), %rax
movq 0x8(%rax,%r14,8), %rsi
movq (%rsi), %rax
leaq 0x28(%rsp), %rdi
callq *0x28(%rax)
movq 0x10(%rsp), %rdx
cmpq 0x30(%rsp), %rdx
jne 0x20220
movq 0x28(%rsp), %rbp
testq %rdx, %rdx
je 0x201c3
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x6420
testl %eax, %eax
jne 0x20220
leaq 0x38(%rsp), %rax
cmpq %rax, %rbp
je 0x201d5
movq %rbp, %rdi
callq 0x63f0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x201e4
callq 0x63f0
incq %r14
movq (%rsp), %rax
movl (%rax), %eax
addq $0x108, %r13            # imm = 0x108
cmpq %rax, %r14
jb 0x20155
movb $0x1, %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rbx), %rsi
movq (%rsp), %rdi
movq %rbx, %rdx
callq 0x939f
jmp 0x20237
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %r12, %rcx
callq 0x941d
xorl %eax, %eax
jmp 0x201ff
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2024d
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::GetTotalFreeSegs()
uint32_t MediumTier::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
cmpl $0x0, 0x40(%rdi)
je 0x2029e
movq %rdi, %rbx
leaq 0x48(%rdi), %r14
xorl %r12d, %r12d
leaq 0xc(%rsp), %r15
xorl %ebp, %ebp
movl %r12d, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xe2e4
movq (%rax), %rdi
callq 0x20d3a
addl %eax, %ebp
incl %r12d
cmpl 0x40(%rbx), %r12d
jb 0x20279
jmp 0x202a0
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::GetTotalUsedSegs()
uint32_t MediumTier::GetTotalUsedSegs() {
    uint32_t used_num = 0;
    for (uint32_t i = 0; i < volNum_; i++) {
        used_num += volMap_[i]->GetTotalUsedSegs();
    }
    return used_num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
cmpl $0x0, 0x40(%rdi)
je 0x202f8
movq %rdi, %rbx
leaq 0x48(%rdi), %r14
xorl %r12d, %r12d
leaq 0xc(%rsp), %r15
xorl %ebp, %ebp
movl %r12d, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xe2e4
movq (%rax), %rdi
callq 0x20d44
addl %eax, %ebp
incl %r12d
cmpl 0x40(%rbx), %r12d
jb 0x202d3
jmp 0x202fa
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::GetSSTLength()
uint64_t MediumTier::GetSSTLength() {
    uint64_t length = 0;
    for (uint32_t i = 0; i < volNum_; i++) {
        length += volMap_[i]->GetSSTLength();
    }
    return length;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
xorl %r13d, %r13d
cmpl $0x0, 0x40(%rdi)
je 0x20355
movq %rdi, %rbx
leaq 0x48(%rdi), %r14
leaq 0xc(%rsp), %r12
xorl %r15d, %r15d
movl %r13d, 0xc(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0xe2e4
movq (%rax), %rdi
callq 0x20d2e
addq %rax, %r15
incl %r13d
cmpl 0x40(%rbx), %r13d
jb 0x2032f
jmp 0x20358
xorl %r15d, %r15d
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Utils.cc
// Function: hlkvds::Thread::Start()
int Thread::Start() {
    int result = pthread_create(&tid_, NULL, runThread, (void *) this);
    if (result == 0) {
        running_ = 1;
    }
    return result;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x8, %rdi
leaq -0x2f(%rip), %rdx       # 0x20a34
xorl %esi, %esi
movq %rbx, %rcx
callq 0x66d0
testl %eax, %eax
jne 0x20a78
movl $0x1, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Utils.cc
// Function: hlkvds::Thread::Join()
int Thread::Join() {
    int result = -1;
    if (running_ == 1) {
        result = pthread_join(tid_, NULL);
        if (result == 0) {
            detached_ = 0;
        }
    }
    return result;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x1, 0x10(%rdi)
jne 0x20aa2
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
xorl %esi, %esi
callq 0x63d0
testl %eax, %eax
jne 0x20aa1
movl $0x0, 0x14(%rbx)
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Utils.cc
// Function: hlkvds::Thread::Detach()
int Thread::Detach() {
    int result = -1;
    if (running_ == 1 && detached_ == 0) {
        result = pthread_detach(tid_);
        if (result == 0) {
            detached_ = 1;
        }
    }
    return result;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x1, 0x10(%rdi)
jne 0x20ad0
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x14(%rdi)
jne 0x20acf
movq 0x8(%rbx), %rdi
callq 0x62f0
testl %eax, %eax
jne 0x20acf
movl $0x1, 0x14(%rbx)
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Volume.cc
// Function: hlkvds::Volume::Read(char*, unsigned long, long)
bool Volume::Read(char* data, size_t count, off_t offset) {
    uint64_t phy_offset = offset + startOff_;
    if (bdev_->pRead(data, count, phy_offset) != (ssize_t)count) {
        __ERROR("Read data error!!!");
        return false;
    }
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
addq 0x30(%rdi), %rcx
movq (%rdi), %rdi
movq (%rdi), %rax
callq *0x50(%rax)
movq %rax, %r14
cmpq %rbx, %rax
jne 0x20cda
cmpq %rbx, %r14
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x9654
jmp 0x20ccc
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Volume.cc
// Function: hlkvds::Volume::Write(char*, unsigned long, long)
bool Volume::Write(char* data, size_t count, off_t offset) {
    uint64_t phy_offset = offset + startOff_;
    if (bdev_->pWrite(data, count, phy_offset) != (ssize_t)count) {
        __ERROR("Write data error!!!");
        return false;
    }
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
addq 0x30(%rdi), %rcx
movq (%rdi), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
movq %rax, %r14
cmpq %rbx, %rax
jne 0x20d0c
cmpq %rbx, %r14
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x96b4
jmp 0x20cfe
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/./src/include/Volume.h
// Function: hlkvds::Volume::CalcSegOffsetFromOffset(unsigned long, unsigned long&)
inline bool CalcSegIdFromOffset(uint64_t offset, uint32_t& seg_id) {
        seg_id = offset >> segSizeBit_;
        if (seg_id >= segNum_) {
            return false;
        }
        return true;
    }

// Assembly:
movl 0x3c(%rdi), %eax
movl 0x40(%rdi), %ecx
shrq %cl, %rsi
cmpl %esi, %eax
jbe 0x20dbd
movl %esi, %edi
shlq %cl, %rdi
movq %rdi, (%rdx)
cmpl %esi, %eax
seta %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Volume.cc
// Function: hlkvds::Volume::ModifyDeathEntry(hlkvds::HashEntry&)
void Volume::ModifyDeathEntry(HashEntry &entry) {
    uint32_t seg_id;
    uint64_t offset = entry.GetHeaderOffset();
    if (!CalcSegIdFromOffset(offset, seg_id)) {
        __ERROR("Calculate Seg Id Wrong!!! offset = %ld", offset);
    }

    uint16_t data_size = entry.GetDataSize();
    uint32_t death_size = (uint32_t) data_size
            + (uint32_t) IndexManager::SizeOfDataHeader();

    segMgr_->AddDeathSize(seg_id, death_size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq (%rsi), %rax
movq 0x22(%rax), %rdi
movb 0x40(%rbx), %cl
movq %rdi, %r14
shrq %cl, %r14
cmpl %r14d, 0x3c(%rbx)
jbe 0x20e3e
movzwl 0x16(%rax), %edx
addl $0x20, %edx
movq 0x8(%rbx), %rdi
movl %r14d, %esi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x1d82a
leaq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x9714
movq (%r15), %rax
jmp 0x20e22
// File: /workspace/github_cpp_makefile_star2_O3/eecs280staff[P]unit_test_framework/test/sequence_equal.cpp
// Function: array_vector_equal()
TEST(array_vector_equal) {
  int a[] = { 1, 2 };
  std::vector<double> b = { 1.0, 2.0 };
  ASSERT_SEQUENCE_EQUAL(a, b);
  ASSERT_SEQUENCE_EQUAL(b, a);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movabsq $0x200000001, %rax      # imm = 0x200000001
leaq 0x28(%rsp), %rbx
movq %rax, (%rbx)
movaps 0x3900(%rip), %xmm0     # 0x6010
leaq 0x30(%rsp), %rsi
movaps %xmm0, (%rsi)
leaq 0x10(%rsp), %r14
leaq 0xf(%rsp), %rcx
movl $0x2, %edx
movq %r14, %rdi
callq 0x374c
leaq 0x3966(%rip), %rcx      # 0x609c
movq %rbx, %rdi
movq %r14, %rsi
movl $0xd, %edx
callq 0x3792
leaq 0x39a2(%rip), %rcx      # 0x60ef
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0xe, %edx
callq 0x3ae2
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2778
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x279a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/eecs280staff[P]unit_test_framework/test/sequence_equal.cpp
// Function: array_vector_unequal()
TEST(array_vector_unequal) {
  int a[] = { 1, 2 };
  std::vector<double> b = { 1.0, 2.0, -2.1 };
  ASSERT_SEQUENCE_EQUAL(a, b);
  ASSERT_SEQUENCE_EQUAL(b, a);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movabsq $0x200000001, %rax      # imm = 0x200000001
leaq 0x28(%rsp), %rbx
movq %rax, (%rbx)
movups 0x3c10(%rip), %xmm0     # 0x6410
leaq 0x30(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $-0x3fff333333333333, %rax # imm = 0xC000CCCCCCCCCCCD
movq %rax, 0x10(%rsi)
leaq 0x10(%rsp), %r14
leaq 0xf(%rsp), %rcx
movl $0x3, %edx
movq %r14, %rdi
callq 0x374c
leaq 0x3868(%rip), %rcx      # 0x609c
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1a, %edx
callq 0x3792
leaq 0x38a4(%rip), %rcx      # 0x60ef
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0x1b, %edx
callq 0x3ae2
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2876
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2898
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/eecs280staff[P]unit_test_framework/./unit_test_framework.hpp
// Function: decltype(print(fp, (*std::begin(fp0), *std::end(fp0))))& unit_test_framework::Diagnostic::print_sequence_helper<std::vector<double, std::allocator<double>>>(std::ostream&, std::vector<double, std::allocator<double>> const&)
static auto print_sequence_helper(std::ostream &os, const Sequence& seq)
      -> decltype(print(os, (*std::begin(seq), *std::end(seq))))& {
      if (std::begin(seq) == std::end(seq)) {
        return os << "{}";
      }

      auto it = std::begin(seq);
      os << "{ ";
      print(os, *it);
      for (++it; it != std::end(seq); ++it) {
        os << ", ";
        print(os, *it);
      }
      return os << " }";
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rsi), %r13
cmpq 0x8(%rsi), %r13
je 0x3f4a
movq %rsi, %r14
leaq 0x21fc(%rip), %rsi      # 0x60e9
movl $0x2, %edx
movq %rbx, %rdi
callq 0x2220
movsd (%r13), %xmm0
movq %rbx, %rdi
callq 0x22c0
addq $0x8, %r13
leaq 0x21d9(%rip), %r15      # 0x60ec
cmpq 0x8(%r14), %r13
je 0x3f51
leaq 0x228d(%rip), %r12      # 0x61ad
movl $0x2, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2220
movsd (%r13), %xmm0
movq %rbx, %rdi
callq 0x22c0
addq $0x8, %r13
cmpq 0x8(%r14), %r13
jne 0x3f20
jmp 0x3f51
leaq 0x2195(%rip), %r15      # 0x60e6
movl $0x2, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2220
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq