LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Set(char*, unsigned long)
bool SegmentManager::Set(char* buf, uint64_t length) {
    uint64_t stat_size = SegmentManager::SizeOfSegmentStat();
    uint64_t stat_table_size = stat_size * segNum_;
    if (length != stat_table_size) {
        return false;
    }
    char* buf_ptr = buf;
    for (uint32_t seg_idx = 0; seg_idx < segNum_; seg_idx++) {
        SegmentStat seg_stat;
        memcpy((void *)&seg_stat, (const void *)buf_ptr, stat_size);
        if (seg_stat.state == SegUseStat::USED) {
            usedCounter_++;
            freedCounter_--;
        }
        segTable_.push_back(seg_stat);
        buf_ptr += stat_size;
    }

    return true;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x47a90
movq 0x8(%rsp), %rcx
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movl 0x20(%rcx), %ecx
imulq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x38(%rsp), %rax
je 0x46fd3
movb $0x0, 0x67(%rsp)
jmp 0x4708c
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movq 0x8(%rsp), %rcx
movl 0x2c(%rsp), %eax
cmpl 0x20(%rcx), %eax
jae 0x47087
leaq 0x20(%rsp), %rdi
callq 0x47ac0
movq 0x30(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x20(%rsp), %rdi
callq 0x8410
cmpl $0x1, 0x20(%rsp)
jne 0x47033
movq 0x8(%rsp), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
movl 0x2c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x2c(%rax)
movq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x47ae0
jmp 0x47044
movq 0x40(%rsp), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x47b50
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x46fe5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x18(%rsp)
movl %eax, 0x14(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x47b50
jmp 0x47097
movb $0x1, 0x67(%rsp)
movb 0x67(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
movq 0x18(%rsp), %rdi
callq 0x8820
nopw %cs:(%rax,%rax)
// File: yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Alloc(unsigned int&)
bool SegmentManager::Alloc(uint32_t& seg_id) {
    std::unique_lock <std::mutex> l(mtx_);
    if (freedCounter_ <= SEG_RESERVED_FOR_GC) {
        return false;
    }

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

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x48(%rsp), %rsi
movq %rsi, 0x10(%rsp)
addq $0x40, %rsi
leaq 0x30(%rsp), %rdi
callq 0x15a10
movq 0x10(%rsp), %rax
cmpl $0x2, 0x2c(%rax)
ja 0x470f0
movb $0x0, 0x57(%rsp)
movl $0x1, 0x2c(%rsp)
jmp 0x4713f
leaq 0x30(%rsp), %rdi
callq 0x16e30
jmp 0x470fc
movq 0x10(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x47160
movb %al, 0xf(%rsp)
jmp 0x47111
movb 0xf(%rsp), %al
andb $0x1, %al
movb %al, 0x57(%rsp)
movl $0x1, 0x2c(%rsp)
jmp 0x4713f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x20(%rsp)
movl %eax, 0x1c(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x15c30
jmp 0x47154
leaq 0x30(%rsp), %rdi
callq 0x15c30
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
movq 0x20(%rsp), %rdi
callq 0x8820
nop
// File: yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::AllocForGC(unsigned int&)
bool SegmentManager::AllocForGC(uint32_t& seg_id) {
    //for first use !!
    std::lock_guard <std::mutex> l(mtx_);
    if (segTable_[curSegId_].state == SegUseStat::FREE) {
        seg_id = curSegId_;
        segTable_[curSegId_].state = SegUseStat::RESERVED;

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

    uint32_t seg_index = curSegId_ + 1;

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

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

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rsi
movq %rsi, 0x8(%rsp)
addq $0x40, %rsi
leaq 0x18(%rsp), %rdi
callq 0xb5f0
movq 0x8(%rsp), %rdi
movl 0x24(%rdi), %eax
movl %eax, %esi
callq 0x47aa0
cmpl $0x0, (%rax)
jne 0x471e5
movq 0x8(%rsp), %rdi
movl 0x24(%rdi), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movl 0x24(%rdi), %eax
movl %eax, %esi
callq 0x47aa0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movl $0x2, (%rcx)
movl 0x30(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x30(%rax)
movl 0x2c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x2c(%rax)
movb $0x1, 0x37(%rsp)
movl $0x1, 0x14(%rsp)
jmp 0x472a1
movq 0x8(%rsp), %rax
movl 0x24(%rax), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rcx
movl 0x10(%rsp), %eax
cmpl 0x24(%rcx), %eax
je 0x47294
movq 0x8(%rsp), %rcx
movl 0x10(%rsp), %eax
cmpl 0x20(%rcx), %eax
jne 0x4721c
movl $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rdi
movl 0x10(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
cmpl $0x0, (%rax)
jne 0x47284
movq 0x8(%rsp), %rdi
movl 0x10(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x20(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x24(%rdi)
movl 0x24(%rdi), %eax
movl %eax, %esi
callq 0x47aa0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movl $0x2, (%rcx)
movl 0x30(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x30(%rax)
movl 0x2c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x2c(%rax)
movb $0x1, 0x37(%rsp)
movl $0x1, 0x14(%rsp)
jmp 0x472a1
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x471f4
movb $0x0, 0x37(%rsp)
movl $0x1, 0x14(%rsp)
leaq 0x18(%rsp), %rdi
callq 0xb830
movb 0x37(%rsp), %al
andb $0x1, %al
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::FreeForFailed(unsigned int)
void SegmentManager::FreeForFailed(uint32_t seg_id) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::FREE;
    segTable_[seg_id].free_size = 0;
    segTable_[seg_id].death_size = 0;

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

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movq 0x20(%rsp), %rsi
movq %rsi, 0x8(%rsp)
addq $0x40, %rsi
leaq 0x10(%rsp), %rdi
callq 0xb5f0
movq 0x8(%rsp), %rdi
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq 0x8(%rsp), %rdi
movl $0x0, (%rax)
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq 0x8(%rsp), %rdi
movl $0x0, 0x4(%rax)
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movl $0x0, 0x8(%rcx)
movl 0x30(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x30(%rax)
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
leaq 0x10(%rsp), %rdi
callq 0xb830
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::FreeForGC(unsigned int)
void SegmentManager::FreeForGC(uint32_t seg_id) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::FREE;
    segTable_[seg_id].free_size = 0;
    segTable_[seg_id].death_size = 0;

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

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movq 0x20(%rsp), %rsi
movq %rsi, 0x8(%rsp)
addq $0x40, %rsi
leaq 0x10(%rsp), %rdi
callq 0xb5f0
movq 0x8(%rsp), %rdi
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq 0x8(%rsp), %rdi
movl $0x0, (%rax)
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq 0x8(%rsp), %rdi
movl $0x0, 0x4(%rax)
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movl $0x0, 0x8(%rcx)
movl 0x28(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x28(%rax)
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
leaq 0x10(%rsp), %rdi
callq 0xb830
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Use(unsigned int, unsigned int)
void SegmentManager::Use(uint32_t seg_id, uint32_t free_size) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::USED;
    segTable_[seg_id].free_size = free_size;

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

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movq 0x20(%rsp), %rsi
movq %rsi, 0x8(%rsp)
addq $0x40, %rsi
leaq 0x10(%rsp), %rdi
callq 0xb5f0
movq 0x8(%rsp), %rdi
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq 0x8(%rsp), %rdi
movl $0x1, (%rax)
movl 0x18(%rsp), %eax
movl %eax, 0x4(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movl 0x4(%rsp), %edx
movq %rax, %rcx
movq 0x8(%rsp), %rax
movl %edx, 0x4(%rcx)
movl 0x30(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x30(%rax)
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
leaq 0x10(%rsp), %rdi
callq 0xb830
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::SortSegsByUtils(std::multimap<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>>&, double)
void SegmentManager::SortSegsByUtils( std::multimap<uint32_t, uint32_t> &cand_map, double utils) {
    std::lock_guard <std::mutex> lck(mtx_);
    uint32_t used_size;
    uint32_t thld = (uint32_t)(segSize_ * utils);

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

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movsd %xmm0, 0x70(%rsp)
movq 0x80(%rsp), %rsi
movq %rsi, 0x30(%rsp)
addq $0x40, %rsi
leaq 0x68(%rsp), %rdi
callq 0xb5f0
movq 0x30(%rsp), %rax
movl 0x18(%rax), %eax
cvtsi2sd %rax, %xmm0
movsd 0x70(%rsp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, 0x60(%rsp)
movl $0x0, 0x5c(%rsp)
movq 0x30(%rsp), %rcx
movl 0x5c(%rsp), %eax
cmpl 0x20(%rcx), %eax
jae 0x476d1
movq 0x30(%rsp), %rdi
movl 0x5c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
cmpl $0x1, (%rax)
jne 0x476bf
movq 0x30(%rsp), %rdi
movl 0x18(%rdi), %eax
movl %eax, 0x1c(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq 0x30(%rsp), %rdi
movl 0x4(%rax), %eax
movl %eax, 0x20(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, %esi
callq 0x47aa0
movq %rax, %rcx
movl 0x20(%rsp), %eax
movl 0x8(%rcx), %ecx
addl %ecx, %eax
movl %eax, 0x24(%rsp)
callq 0x166a0
movq %rax, 0x28(%rsp)
jmp 0x47642
movl 0x1c(%rsp), %eax
movl 0x24(%rsp), %ecx
movq 0x28(%rsp), %rdx
addl %edx, %ecx
subl %ecx, %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
cmpl 0x60(%rsp), %eax
jae 0x476bd
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x44(%rsp), %rdi
leaq 0x64(%rsp), %rsi
leaq 0x5c(%rsp), %rdx
callq 0x47b90
jmp 0x47681
movq 0x10(%rsp), %rdi
leaq 0x44(%rsp), %rsi
callq 0x47b60
movq %rax, 0x8(%rsp)
jmp 0x47697
movq 0x8(%rsp), %rax
movq %rax, 0x38(%rsp)
jmp 0x476bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
leaq 0x68(%rsp), %rdi
callq 0xb830
jmp 0x476e3
jmp 0x476bf
jmp 0x476c1
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x475cd
leaq 0x68(%rsp), %rdi
callq 0xb830
addq $0x88, %rsp
retq
movq 0x50(%rsp), %rdi
callq 0x8820
nopl (%rax)
// File: yangwanyuan[P]HLKVDS/src/Status.cc
// Function: hlkvds::Status::Status(hlkvds::Status::Code, char const*)
Status::Status(Code _code, const char* msg) :
    code_(_code) {
    uint32_t size = strlen(msg);
    char* const result = new char[size + 1];
    memcpy(result, msg, size);
    result[size] = '\0';
    state_ = result;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x2c(%rsp), %ecx
movl %ecx, (%rax)
movq 0x20(%rsp), %rdi
callq 0x81b0
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
callq 0x8040
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %eax
movl %eax, %edx
callq 0x8410
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movl 0x1c(%rsp), %edx
movb $0x0, (%rcx,%rdx)
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rax)
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: yangwanyuan[P]HLKVDS/src/SuperBlockManager.cc
// Function: hlkvds::SuperBlockManager::Get(char*, unsigned long)
bool SuperBlockManager::Get(char* buff, uint64_t length) {
    if (length != SuperBlockManager::SuperBlockSizeOnDevice()) {
        return false;
    }
    memcpy((void *)buff, (const void*)&sb_, SuperBlockManager::SizeOfDBSuperBlock());

    uint64_t reserved_region_length = SuperBlockManager::ReservedRegionLength();

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

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
callq 0x117e0
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
je 0x49490
movb $0x0, 0x57(%rsp)
jmp 0x494f7
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x117f0
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rax, %rdx
callq 0x8410
callq 0x116c0
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x117f0
movq 0x10(%rsp), %rcx
movq %rax, %rdx
movq 0x18(%rsp), %rax
addq %rdx, %rcx
movq %rcx, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movq 0x40(%rax), %rsi
movq 0x30(%rsp), %rdx
callq 0x8410
movb $0x1, 0x57(%rsp)
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
callq 0x117e0
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
je 0x49550
movb $0x0, 0x57(%rsp)
jmp 0x495b7
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x117f0
movq 0x8(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq %rax, %rdx
callq 0x8410
callq 0x116c0
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x117f0
movq 0x10(%rsp), %rcx
movq %rax, %rdx
movq 0x18(%rsp), %rax
addq %rdx, %rcx
movq %rcx, 0x28(%rsp)
movq 0x40(%rax), %rdi
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x8410
movb $0x1, 0x57(%rsp)
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rsi
movq %rsi, 0x8(%rsp)
addq $0x50, %rsi
leaq 0x10(%rsp), %rdi
callq 0xb5f0
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movq 0x18(%rsp), %rcx
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%rax)
movq 0x18(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rcx
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movq 0x18(%rsp), %rcx
movq 0x1c(%rcx), %rcx
movq %rcx, 0x1c(%rax)
movq 0x18(%rsp), %rcx
movq 0x24(%rcx), %rcx
movq %rcx, 0x24(%rax)
movq 0x18(%rsp), %rcx
movl 0x2c(%rcx), %ecx
movl %ecx, 0x2c(%rax)
movq 0x18(%rsp), %rcx
movl 0x30(%rcx), %ecx
movl %ecx, 0x30(%rax)
movq 0x18(%rsp), %rcx
movq 0x34(%rcx), %rcx
movq %rcx, 0x34(%rax)
movq 0x18(%rsp), %rcx
movb 0x3c(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x3c(%rax)
leaq 0x10(%rsp), %rdi
callq 0xb830
addq $0x28, %rsp
retq
nop
// File: 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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x48(%rsp), %rsi
movq %rsi, 0x8(%rsp)
addq $0x50, %rsi
leaq 0x30(%rsp), %rdi
callq 0xb5f0
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x116c0
movq %rax, 0x18(%rsp)
jmp 0x49801
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rcx, %rax
je 0x49839
movb $0x0, 0x57(%rsp)
movl $0x1, 0x20(%rsp)
jmp 0x4985e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
leaq 0x30(%rsp), %rdi
callq 0xb830
jmp 0x49873
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x8410
movb $0x1, 0x57(%rsp)
movl $0x1, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
callq 0xb830
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
movq 0x28(%rsp), %rdi
callq 0x8820
nopl (%rax)
// File: 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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x48(%rsp), %rsi
movq %rsi, 0x8(%rsp)
addq $0x50, %rsi
leaq 0x30(%rsp), %rdi
callq 0xb5f0
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x116c0
movq %rax, 0x18(%rsp)
jmp 0x498c1
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rcx, %rax
je 0x498f9
movb $0x0, 0x57(%rsp)
movl $0x1, 0x20(%rsp)
jmp 0x4991e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
leaq 0x30(%rsp), %rdi
callq 0xb830
jmp 0x49933
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rdi
movq 0x40(%rax), %rsi
movq 0x38(%rsp), %rdx
callq 0x8410
movb $0x1, 0x57(%rsp)
movl $0x1, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
callq 0xb830
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
movq 0x28(%rsp), %rdi
callq 0x8820
nopl (%rax)
// File: 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:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x1e0(%rax), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x49ce9
movq 0x20(%rsp), %rdi
callq 0x36290
movq 0x20(%rsp), %rdi
callq 0x84b0
movq 0x18(%rsp), %rsi
addq $0x128, %rsi            # imm = 0x128
leaq 0x50(%rsp), %rdi
callq 0x15a10
movl $0x0, 0x4c(%rsp)
movq 0x18(%rsp), %rcx
movl 0x4c(%rsp), %eax
cmpl 0x124(%rcx), %eax
jge 0x49dcc
movq 0x18(%rsp), %rdi
addq $0x150, %rdi            # imm = 0x150
leaq 0x4c(%rsp), %rsi
callq 0x16c10
movq %rax, 0x10(%rsp)
jmp 0x49d39
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x49d6a
movq 0x8(%rsp), %rdi
callq 0x427e0
movq 0x8(%rsp), %rdi
callq 0x84b0
movq 0x18(%rsp), %rdi
addq $0x180, %rdi            # imm = 0x180
movslq 0x4c(%rsp), %rsi
callq 0x16d00
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x49da0
movq (%rsp), %rdi
callq 0x84b0
jmp 0x49da2
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x49d07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x15c30
jmp 0x49dfd
movq 0x18(%rsp), %rdi
addq $0x150, %rdi            # imm = 0x150
callq 0x16d20
movq 0x18(%rsp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x16d30
leaq 0x50(%rsp), %rdi
callq 0x15c30
addq $0x68, %rsp
retq
movq 0x38(%rsp), %rdi
callq 0x8820
nopw (%rax,%rax)
// File: 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:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq 0xa0(%rsp), %rsi
movq %rsi, 0x40(%rsp)
addq $0x128, %rsi            # imm = 0x128
leaq 0x90(%rsp), %rdi
callq 0x15a10
movl $0x0, 0x8c(%rsp)
movq 0x40(%rsp), %rcx
movl 0x8c(%rsp), %eax
cmpl 0x124(%rcx), %eax
jge 0x49fa5
movl $0xd8, %edi
callq 0x84f0
movq %rax, 0x38(%rsp)
jmp 0x49e74
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rcx
movq 0x1d8(%rcx), %rsi
movq (%rcx), %rax
movq 0x10(%rcx), %rdx
movl 0x10(%rax), %ecx
callq 0x42b00
jmp 0x49e96
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %rcx
movq %rcx, 0x80(%rsp)
addq $0x150, %rax            # imm = 0x150
movq %rax, 0x20(%rsp)
leaq 0x8c(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x15b90
movq %rdx, 0x28(%rsp)
movl %eax, 0x34(%rsp)
jmp 0x49ed3
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
movl 0x34(%rsp), %ecx
movl %ecx, 0x60(%rsp)
movq %rax, 0x68(%rsp)
leaq 0x60(%rsp), %rsi
callq 0x15b40
movb %dl, 0x17(%rsp)
movq %rax, 0x18(%rsp)
jmp 0x49eff
movb 0x17(%rsp), %al
movq 0x18(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movb %al, 0x58(%rsp)
movl $0x28, %edi
callq 0x84f0
movq %rax, 0x8(%rsp)
jmp 0x49f22
movq 0x8(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq $0x0, 0x20(%rdi)
callq 0x15800
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rdi
movq %rax, 0x48(%rsp)
addq $0x180, %rdi            # imm = 0x180
leaq 0x48(%rsp), %rsi
callq 0x15bc0
jmp 0x49f60
jmp 0x49f62
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x49e4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x4a00f
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0x84b0
jmp 0x4a00f
movl $0x58, %edi
callq 0x84f0
movq %rax, (%rsp)
jmp 0x49fb5
movq 0x40(%rsp), %rdx
movq (%rsp), %rdi
movq (%rdx), %r8
movq 0x10(%rdx), %rsi
movq 0x1e8(%rdx), %rcx
callq 0x362c0
jmp 0x49fd3
movq 0x40(%rsp), %rax
movq (%rsp), %rcx
movq %rcx, 0x1e0(%rax)
leaq 0x90(%rsp), %rdi
callq 0x15c30
addq $0xa8, %rsp
retq
movq (%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0x84b0
leaq 0x90(%rsp), %rdi
callq 0x15c30
movq 0x78(%rsp), %rdi
callq 0x8820
nopw %cs:(%rax,%rax)
// File: yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::StartThds()
void FastTier::StartThds() {
    for (int i = 0; i < shardsNum_; i++) {
        ReqsMergeWQ *req_wq = new ReqsMergeWQ(this, 1);
        req_wq->Start();
        reqWQVec_.push_back(req_wq);
    }

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

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

    //vol_->StartThds();

    migrationT_stop_.store(false);
    migrationT_ = std::thread(&FastTier::MigrationThdEntry, this);
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x28(%rsp)
movl $0x0, 0x8c(%rsp)
movq 0x28(%rsp), %rcx
movl 0x8c(%rsp), %eax
cmpl 0x124(%rcx), %eax
jge 0x4a0fb
movl $0xd8, %edi
callq 0x84f0
movq 0x28(%rsp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x20(%rsp)
movl $0x1, %edx
callq 0x4e990
jmp 0x4a095
movq 0x20(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x15cc0
movq 0x28(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
leaq 0x80(%rsp), %rsi
callq 0x4e9e0
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x4a057
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0x84b0
jmp 0x4a243
movl $0xd8, %edi
callq 0x84f0
movq 0x28(%rsp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x18(%rsp)
movq (%rsi), %rax
movl 0x14(%rax), %edx
callq 0x4ea50
jmp 0x4a122
movq 0x28(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, 0x208(%rax)
movq 0x208(%rax), %rdi
callq 0x15e50
movq 0x28(%rsp), %rdi
addq $0x218, %rdi            # imm = 0x218
xorl %esi, %esi
movl %esi, 0x10(%rsp)
movl $0x5, %edx
movl %edx, 0x14(%rsp)
callq 0x15f20
movq 0x28(%rsp), %rax
leaq 0xe5(%rip), %rcx        # 0x4a250
movq %rcx, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
movq %rax, 0x50(%rsp)
leaq 0x68(%rsp), %rdi
movq %rdi, 0x8(%rsp)
leaq 0x58(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x4eaa0
movq 0x8(%rsp), %rsi
movq 0x28(%rsp), %rdi
addq $0x210, %rdi            # imm = 0x210
callq 0x160b0
movq 0x8(%rsp), %rdi
callq 0x158b0
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
movq 0x28(%rsp), %rdi
addq $0x228, %rdi            # imm = 0x228
callq 0x15f20
movq 0x28(%rsp), %rax
leaq 0x3c4(%rip), %rcx       # 0x4a5a0
movq %rcx, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movq %rax, 0x30(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x4eaa0
movq 0x28(%rsp), %rdi
addq $0x220, %rdi            # imm = 0x220
leaq 0x48(%rsp), %rsi
callq 0x160b0
leaq 0x48(%rsp), %rdi
callq 0x158b0
addq $0x98, %rsp
retq
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0x84b0
movq 0x78(%rsp), %rdi
callq 0x8820
nopl (%rax)
// File: yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::MigrationThdEntry()
void FastTier::MigrationThdEntry() {
    __DEBUG("Migration thread start!!");
    while (!migrationT_stop_) {
        uint32_t free_seg_num = vol_->GetTotalFreeSegs();
        uint32_t total_seg_num = vol_->GetNumberOfSeg();
        uint32_t used_seg_num = total_seg_num - free_seg_num;

        double util_rate = (double)used_seg_num / (double)total_seg_num;

        //if ( util_rate > 0.3) {
        //    uint32_t mt_vol_id = mt_->PickVolForMigrate();
        //    uint32_t free_num = mig_->BackMigrate(mt_vol_id);
        //    __DEBUG("Once migration done, free %d segments", free_num);

        //    int sleep_time;
        //    if (util_rate > 0.8) {
        //        sleep_time = 10;
        //    }
        //    else if (util_rate > 0.5) {
        //        sleep_time = 1000;
        //    }
        //    else{
        //        sleep_time = 100000;
        //    }
        //    usleep(sleep_time);
        //}
        if (util_rate > 0.1) {
            uint32_t mt_vol_id = mt_->PickVolForMigrate();
            uint32_t free_num = mig_->BackMigrate(mt_vol_id);
            __DEBUG("Once migration done, free %d segments", free_num);
        }
        usleep(1000);
    }__DEBUG("Migration thread stop!!");
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
addq $0x228, %rdi            # imm = 0x228
callq 0x16f80
xorb $-0x1, %al
testb $0x1, %al
jne 0x4a5cf
jmp 0x4a678
movq 0x8(%rsp), %rax
movq 0x1d8(%rax), %rdi
callq 0x510f0
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x2c(%rsp)
movq 0x1d8(%rax), %rdi
callq 0x16d50
movl %eax, 0x28(%rsp)
movl 0x28(%rsp), %eax
movl 0x2c(%rsp), %ecx
subl %ecx, %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
cvtsi2sd %rax, %xmm0
movl 0x28(%rsp), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
movsd 0x912d(%rip), %xmm1     # 0x53760
ucomisd %xmm1, %xmm0
jbe 0x4a669
movq 0x8(%rsp), %rax
movq 0x1e8(%rax), %rdi
callq 0x4c4f0
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x14(%rsp)
movq 0x1e0(%rax), %rdi
movl 0x14(%rsp), %esi
callq 0x36af0
movl %eax, 0x10(%rsp)
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x86e0
jmp 0x4a5b3
addq $0x38, %rsp
retq
nopl (%rax)
// File: 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:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, 0x18(%rsp)
addq $0x228, %rdi            # imm = 0x228
movl $0x1, %esi
movl $0x5, %edx
callq 0x15f20
movq 0x18(%rsp), %rdi
addq $0x220, %rdi            # imm = 0x220
callq 0x87f0
movq 0x18(%rsp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl $0x1, %esi
movl $0x5, %edx
callq 0x15f20
movq 0x18(%rsp), %rdi
addq $0x210, %rdi            # imm = 0x210
callq 0x87f0
movl $0x0, 0x2c(%rsp)
movq 0x18(%rsp), %rcx
movl 0x2c(%rsp), %eax
cmpl 0x124(%rcx), %eax
jge 0x4a751
movq 0x18(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
movslq 0x2c(%rsp), %rsi
callq 0x4eb70
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0x16200
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x4a742
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x4a744
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x4a6ee
movq 0x18(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x4eb90
movq 0x18(%rsp), %rax
cmpq $0x0, 0x208(%rax)
je 0x4a7a6
movq 0x18(%rsp), %rax
movq 0x208(%rax), %rdi
callq 0x162d0
movq 0x18(%rsp), %rax
movq 0x208(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x4a7a4
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x4a7a6
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: 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:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq 0x58(%rsp), %rsi
movq %rsi, 0x18(%rsp)
addq $0x198, %rsi            # imm = 0x198
leaq 0x48(%rsp), %rdi
callq 0xb5f0
movq 0x18(%rsp), %rax
movq 0x1e8(%rax), %rdi
callq 0x4ec00
movl %eax, 0x24(%rsp)
jmp 0x4b150
movl 0x24(%rsp), %eax
movl %eax, 0x44(%rsp)
movq 0x18(%rsp), %rax
movq 0x1d8(%rax), %rdi
movq 0x50(%rsp), %rsi
callq 0x50e40
movb %al, 0x17(%rsp)
jmp 0x4b174
movb 0x17(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4b183
jmp 0x4b204
cmpl $0x0, 0x44(%rsp)
jne 0x4b1b3
movb $0x0, 0x67(%rsp)
movl $0x1, 0x30(%rsp)
jmp 0x4b211
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xb830
jmp 0x4b226
movq 0x18(%rsp), %rax
movq 0x1e8(%rax), %rdi
callq 0x4c4f0
movl %eax, 0x10(%rsp)
jmp 0x4b1ca
movq 0x18(%rsp), %rax
movl 0x10(%rsp), %ecx
movl %ecx, 0x2c(%rsp)
movl 0x44(%rsp), %ecx
decl %ecx
movl %ecx, 0x44(%rsp)
movq 0x1e0(%rax), %rdi
movl 0x2c(%rsp), %esi
callq 0x36350
movl %eax, 0xc(%rsp)
jmp 0x4b1f7
movl 0xc(%rsp), %eax
movl %eax, 0x28(%rsp)
jmp 0x4b158
movb $0x1, 0x67(%rsp)
movl $0x1, 0x30(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xb830
movb 0x67(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
movq 0x38(%rsp), %rdi
callq 0x8820
// File: 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:
subq $0x78, %rsp
movq %rdi, 0x20(%rsp)
movq %rdi, %rax
movq %rax, 0x28(%rsp)
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq %rcx, 0x58(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x60(%rsp), %rdi
callq 0x116b0
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x1d8(%rax), %rdi
movq 0x50(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x51320
testb $0x1, %al
jne 0x4b2af
movq 0x20(%rsp), %rdi
leaq 0x74f6(%rip), %rsi      # 0x5279b
callq 0x163e0
jmp 0x4b3f3
movq 0x50(%rsp), %rdi
callq 0x16580
movw %ax, 0x46(%rsp)
movzwl 0x46(%rsp), %eax
cmpl $0x0, %eax
jne 0x4b2de
movq 0x20(%rsp), %rdi
leaq 0x74e5(%rip), %rsi      # 0x527b9
callq 0x165a0
jmp 0x4b3f3
movzwl 0x46(%rsp), %eax
movl %eax, %edi
callq 0x8040
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x38(%rsp)
movq 0x1d8(%rax), %rdi
movq 0x38(%rsp), %rsi
movzwl 0x46(%rsp), %eax
movl %eax, %edx
movq 0x48(%rsp), %rcx
callq 0x50ed0
testb $0x1, %al
jne 0x4b3b9
jmp 0x4b31e
movq 0x25cb3(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x8480
movq 0x18(%rsp), %rdi
movq %rax, %rdx
leaq 0x7170(%rip), %rsi      # 0x524b1
leaq 0x7483(%rip), %rcx      # 0x527cb
leaq 0x9193(%rip), %r8       # 0x544e2
movl $0xaf, %r9d
movb $0x0, %al
callq 0x86f0
movq 0x25c75(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x7467(%rip), %rsi      # 0x527d4
movb $0x0, %al
callq 0x86f0
movq 0x25c5d(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x7a40(%rip), %rsi      # 0x52dc5
movb $0x0, %al
callq 0x86f0
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x4b3a6
movq 0x10(%rsp), %rdi
callq 0x8610
movq 0x20(%rsp), %rdi
leaq 0x7442(%rip), %rsi      # 0x527f4
callq 0x16510
jmp 0x4b3f3
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rsi
movzwl 0x46(%rsp), %eax
movl %eax, %edx
callq 0x8660
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x4b3e9
movq 0x8(%rsp), %rdi
callq 0x8610
movq 0x20(%rsp), %rdi
callq 0x16560
movq 0x28(%rsp), %rax
addq $0x78, %rsp
retq
nopl (%rax)
// File: 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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x10c, 0x8(%rsp)       # imm = 0x10C
je 0x4b43e
movb $0x0, 0x27(%rsp)
jmp 0x4b470
movq (%rsp), %rax
movq 0x1d8(%rax), %rdi
callq 0x51070
movq (%rsp), %rsi
movl %eax, 0x120(%rsi)
movq 0x10(%rsp), %rdi
addq $0x18, %rsi
movq 0x8(%rsp), %rdx
callq 0x8410
movb $0x1, 0x27(%rsp)
movb 0x27(%rsp), %al
andb $0x1, %al
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: 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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x10c, 0x8(%rsp)       # imm = 0x10C
je 0x4b4ae
movb $0x0, 0x27(%rsp)
jmp 0x4b4ca
movq (%rsp), %rdi
addq $0x18, %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x8410
movb $0x1, 0x27(%rsp)
movb 0x27(%rsp), %al
andb $0x1, %al
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
movl 0x1d0(%rax), %ecx
movl %ecx, 0x18(%rax)
movq 0x1d8(%rax), %rsi
leaq 0x30(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x51090
movq (%rsp), %rdi
movq 0x18(%rsp), %rax
addq $0x1c, %rax
movq %rax, 0x8(%rsp)
callq 0x8180
movq (%rsp), %rdi
movq %rax, 0x10(%rsp)
callq 0x8350
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
callq 0x8410
movq 0x18(%rsp), %rax
movl 0x1d4(%rax), %ecx
movl %ecx, 0x11c(%rax)
movq 0x1d8(%rax), %rdi
callq 0x51070
movl %eax, 0x20(%rsp)
jmp 0x4b85b
movq 0x18(%rsp), %rax
movl 0x20(%rsp), %ecx
movl %ecx, 0x120(%rax)
leaq 0x30(%rsp), %rdi
callq 0x8928
addq $0x58, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x8928
movq 0x28(%rsp), %rdi
callq 0x8820
nopl (%rax,%rax)
// File: 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:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq 0x98(%rsp), %rax
addq $0x1c, %rax
movq %rax, 0x20(%rsp)
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x8830
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x8680
jmp 0x4bafd
leaq 0x6f(%rsp), %rdi
callq 0x8540
movq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x166e0
movq (%rax), %rsi
movq (%rsi), %rax
movq 0x28(%rax), %rax
leaq 0x38(%rsp), %rdi
callq *%rax
jmp 0x4bb2b
leaq 0x70(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x16d60
testb $0x1, %al
jne 0x4bb43
jmp 0x4bc26
jmp 0x4bb45
movq 0x2548c(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x8480
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x6949(%rip), %rsi      # 0x524b1
leaq 0x6d49(%rip), %rcx      # 0x528b8
leaq 0x896c(%rip), %r8       # 0x544e2
movl $0x1b2, %r9d            # imm = 0x1B2
movb $0x0, %al
callq 0x86f0
movq 0x2544e(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x8180
movq %rax, 0x18(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x8180
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq %rax, %rcx
leaq 0x6d08(%rip), %rsi      # 0x528c7
movb $0x0, %al
callq 0x86f0
movq 0x2540b(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x71ee(%rip), %rsi      # 0x52dc5
movb $0x0, %al
callq 0x86f0
jmp 0x4bbe0
movb $0x0, 0xa7(%rsp)
movl $0x1, 0x34(%rsp)
jmp 0x4bc36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x6f(%rsp), %rdi
callq 0x8540
jmp 0x4bc5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x8928
jmp 0x4bc5b
movb $0x1, 0xa7(%rsp)
movl $0x1, 0x34(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x8928
leaq 0x70(%rsp), %rdi
callq 0x8928
movb 0xa7(%rsp), %al
andb $0x1, %al
addq $0xa8, %rsp
retq
movq 0x60(%rsp), %rdi
callq 0x8820
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rsi
movq %rsi, 0x10(%rsp)
addq $0x80, %rsi
leaq 0x18(%rsp), %rdi
callq 0xb5f0
movq 0x10(%rsp), %rcx
movl 0x78(%rcx), %eax
movl 0x40(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4c534
movq 0x10(%rsp), %rax
movl $0x0, 0x78(%rax)
jmp 0x4c542
movq 0x10(%rsp), %rax
movl 0x78(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x78(%rax)
movq 0x10(%rsp), %rax
movl 0x78(%rax), %eax
movl %eax, 0xc(%rsp)
leaq 0x18(%rsp), %rdi
callq 0xb830
movl 0xc(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movl $0x0, 0x24(%rsp)
movb $0x0, 0x23(%rsp)
leaq 0x24(%rsp), %rsi
callq 0x4b110
andb $0x1, %al
movb %al, 0x23(%rsp)
testb $0x1, 0x23(%rsp)
jne 0x4c965
jmp 0x4c8e2
movq 0x246ef(%rip), %rax     # 0x70fd8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x8480
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x5bac(%rip), %rsi      # 0x524b1
leaq 0x5fdc(%rip), %rcx      # 0x528e8
leaq 0x7bcf(%rip), %r8       # 0x544e2
movl $0x1f3, %r9d            # imm = 0x1F3
movb $0x0, %al
callq 0x86f0
movq 0x246b1(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x5d96(%rip), %rsi      # 0x526c7
movb $0x0, %al
callq 0x86f0
movq 0x24699(%rip), %rax     # 0x70fd8
movq (%rax), %rdi
leaq 0x647c(%rip), %rsi      # 0x52dc5
movb $0x0, %al
callq 0x86f0
movq 0x28(%rsp), %rdi
movb 0x23(%rsp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x42d10
jmp 0x4c9db
movq 0x28(%rsp), %rdi
callq 0x16540
movl %eax, 0x1c(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x164f0
movq 0x28(%rsp), %rdi
callq 0x41bb0
andb $0x1, %al
movb %al, 0x23(%rsp)
testb $0x1, 0x23(%rsp)
je 0x4c9b3
movq 0x10(%rsp), %rax
movq 0x1d8(%rax), %rdi
movl 0x24(%rsp), %esi
movl 0x1c(%rsp), %edx
callq 0x51220
jmp 0x4c9c8
movq 0x10(%rsp), %rax
movq 0x1d8(%rax), %rdi
movl 0x24(%rsp), %esi
callq 0x511c0
movq 0x28(%rsp), %rdi
movb 0x23(%rsp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x42d10
addq $0x38, %rsp
retq
// File: yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::MediumTier::deleteAllVolume()
void MediumTier::deleteAllVolume() {
    map<int, Volume *>::iterator iter;
    for (iter = volMap_.begin(); iter != volMap_.end(); ) {
        Volume *vol = iter->second;
        delete vol;
        volMap_.erase(iter++);
    }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x16ad0
movq 0x18(%rsp), %rdi
addq $0x48, %rdi
callq 0x16af0
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x18(%rsp), %rdi
addq $0x48, %rdi
callq 0x16b40
movq %rax, 0x38(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x16b20
testb $0x1, %al
jne 0x4cb52
jmp 0x4cbc1
leaq 0x48(%rsp), %rdi
callq 0x16b70
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x4cb89
movq 0x10(%rsp), %rdi
callq 0x50cb0
movq 0x10(%rsp), %rdi
callq 0x84b0
movq 0x18(%rsp), %rax
addq $0x48, %rax
movq %rax, 0x8(%rsp)
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x16bd0
movq 0x8(%rsp), %rdi
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rsi
callq 0x16b90
movq %rax, 0x20(%rsp)
jmp 0x4cb2a
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)