LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Get(char*, unsigned long)
bool SegmentManager::Get(char* buf, uint64_t length) {
    uint64_t stat_size = SegmentManager::SizeOfSegmentStat();
    uint64_t stat_table_size = stat_size * segNum_;
    if (length != stat_table_size) {
        return false;
    }
    char *buf_ptr = buf;
    for (uint32_t seg_idx = 0; seg_idx < segNum_; seg_idx++) {
        if (segTable_[seg_idx].state != SegUseStat::RESERVED) {
            memcpy((void *)buf_ptr, (const void *)&segTable_[seg_idx], stat_size);
        } else {
            __WARN("Segment Maybe not write to device! seg_id = %d", seg_idx);
        }
        buf_ptr += stat_size;
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
movl 0x20(%rdi), %eax
imulq $0xc, %rax, %rdi
cmpq %rdx, %rdi
jne 0x1a166
movq %rsi, %r14
xorl %ebx, %ebx
xorl %r12d, %r12d
movq %rdx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movl %eax, %eax
cmpq %rax, %r12
jae 0x1a166
movq (%r15), %rax
cmpl $0x2, (%rax,%rbx)
je 0x1a103
leaq (%r14,%rbx), %rcx
addq %rbx, %rax
movl 0x8(%rax), %esi
movl %esi, 0x8(%rcx)
movq (%rax), %rax
movq %rax, (%rcx)
incq %r12
movl 0x20(%r15), %eax
addq $0xc, %rbx
jmp 0x1a0cf
movq 0x17ece(%rip), %rbp     # 0x31fd8
movq (%rbp), %r13
callq 0x63c0
movq %r13, %rdi
leaq 0x5a17(%rip), %rsi      # 0x1fb34
movq %rax, %rdx
leaq 0x7029(%rip), %rcx      # 0x21150
leaq 0x7026(%rip), %r8       # 0x21154
pushq $0x12
popq %r9
xorl %eax, %eax
callq 0x6580
movq (%rbp), %rdi
leaq 0x7026(%rip), %rsi      # 0x2116a
movl %r12d, %edx
xorl %eax, %eax
callq 0x6580
movq (%rbp), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
jmp 0x1a0f6
cmpq %rdx, %rdi
sete %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Set(char*, unsigned long)
bool SegmentManager::Set(char* buf, uint64_t length) {
    uint64_t stat_size = SegmentManager::SizeOfSegmentStat();
    uint64_t stat_table_size = stat_size * segNum_;
    if (length != stat_table_size) {
        return false;
    }
    char* buf_ptr = buf;
    for (uint32_t seg_idx = 0; seg_idx < segNum_; seg_idx++) {
        SegmentStat seg_stat;
        memcpy((void *)&seg_stat, (const void *)buf_ptr, stat_size);
        if (seg_stat.state == SegUseStat::USED) {
            usedCounter_++;
            freedCounter_--;
        }
        segTable_.push_back(seg_stat);
        buf_ptr += stat_size;
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movl 0x20(%rdi), %eax
imulq $0xc, %rax, %r13
cmpq %rdx, %r13
jne 0x1a1ea
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
cmpl %eax, %ebp
jae 0x1a1ea
movl 0x8(%r14), %eax
movl %eax, 0x10(%rsp)
movq (%r14), %rax
movq %rax, 0x8(%rsp)
cmpl $0x1, %eax
jne 0x1a1d3
movq 0x28(%r15), %xmm0
paddd 0x6f63(%rip), %xmm0     # 0x21130
movq %xmm0, 0x28(%r15)
movq %r15, %rdi
movq %r12, %rsi
callq 0x1a67c
addq $0xc, %r14
incl %ebp
movl 0x20(%r15), %eax
jmp 0x1a1a6
cmpq %rbx, %r13
sete %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Alloc(unsigned int&)
bool SegmentManager::Alloc(uint32_t& seg_id) {
    std::unique_lock <std::mutex> l(mtx_);
    if (freedCounter_ <= SEG_RESERVED_FOR_GC) {
        return false;
    }

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

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x40(%rdi), %rsi
leaq 0x8(%rsp), %rdi
callq 0xaf4e
cmpl $0x3, 0x2c(%r14)
jae 0x1a226
xorl %ebx, %ebx
jmp 0x1a23d
leaq 0x8(%rsp), %rdi
callq 0xb4c6
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1a266
movl %eax, %ebx
leaq 0x8(%rsp), %rdi
callq 0xafd0
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xafd0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::AllocForGC(unsigned int&)
bool SegmentManager::AllocForGC(uint32_t& seg_id) {
    //for first use !!
    std::lock_guard <std::mutex> l(mtx_);
    if (segTable_[curSegId_].state == SegUseStat::FREE) {
        seg_id = curSegId_;
        segTable_[curSegId_].state = SegUseStat::RESERVED;

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

    uint32_t seg_index = curSegId_ + 1;

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
leaq 0x40(%rdi), %rbx
movq %rbx, %rdi
callq 0xbc3a
movl 0x24(%r14), %ecx
movq (%r14), %rax
imulq $0xc, %rcx, %rdx
cmpl $0x0, (%rax,%rdx)
je 0x1a2ba
movl 0x20(%r14), %esi
xorl %edi, %edi
movl %ecx, %edx
incl %edx
cmpl %ecx, %edx
je 0x1a2e7
cmpl %esi, %edx
cmovel %edi, %edx
imulq $0xc, %rdx, %r8
cmpl $0x0, (%rax,%r8)
jne 0x1a298
addq %r8, %rax
movl %edx, (%r15)
movl %edx, 0x24(%r14)
jmp 0x1a2c8
movl %ecx, (%r15)
movl 0x24(%r14), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl $0x2, (%rax)
movq 0x2c(%r14), %xmm0
paddd 0x6e64(%rip), %xmm0     # 0x21140
movq %xmm0, 0x2c(%r14)
movb $0x1, %bpl
jmp 0x1a2e9
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x6340
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::FreeForFailed(unsigned int)
void SegmentManager::FreeForFailed(uint32_t seg_id) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::FREE;
    segTable_[seg_id].free_size = 0;
    segTable_[seg_id].death_size = 0;

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leaq 0x40(%rdi), %r15
movq %r15, %rdi
callq 0xbc3a
movl %ebx, %eax
movq (%r14), %rcx
imulq $0xc, %rax, %rax
andq $0x0, (%rcx,%rax)
andl $0x0, 0x8(%rcx,%rax)
movq 0x2c(%r14), %xmm0
paddd 0x6dfb(%rip), %xmm0     # 0x21130
movq %xmm0, 0x2c(%r14)
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6340
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::FreeForGC(unsigned int)
void SegmentManager::FreeForGC(uint32_t seg_id) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::FREE;
    segTable_[seg_id].free_size = 0;
    segTable_[seg_id].death_size = 0;

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leaq 0x40(%rdi), %r15
movq %r15, %rdi
callq 0xbc3a
movl %ebx, %eax
movq (%r14), %rcx
imulq $0xc, %rax, %rax
andq $0x0, (%rcx,%rax)
andl $0x0, 0x8(%rcx,%rax)
movq 0x28(%r14), %xmm0
paddd 0x6dc1(%rip), %xmm0     # 0x21140
movq %xmm0, 0x28(%r14)
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6340
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::Use(unsigned int, unsigned int)
void SegmentManager::Use(uint32_t seg_id, uint32_t free_size) {
    std::lock_guard <std::mutex> l(mtx_);
    segTable_[seg_id].state = SegUseStat::USED;
    segTable_[seg_id].free_size = free_size;

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %r15
addq $0x40, %rdi
movq %rdi, (%rsp)
callq 0xbc3a
movl 0x18(%r15), %eax
cvtsi2sd %rax, %xmm0
mulsd 0x10(%rsp), %xmm0
cvttsd2si %xmm0, %r13
pushq $0x8
popq %rbp
xorl %ebx, %ebx
leaq 0x8(%rsp), %r12
movl 0x20(%r15), %eax
cmpq %rax, %rbx
jae 0x1a4ed
movq (%r15), %rax
cmpl $0x1, -0x8(%rax,%rbp)
jne 0x1a4e4
movl -0x4(%rax,%rbp), %ecx
addl (%rax,%rbp), %ecx
movl 0x18(%r15), %eax
subl %ecx, %eax
addl $-0x20, %eax
cmpl %r13d, %eax
jae 0x1a4e4
movl %eax, 0x8(%rsp)
movl %ebx, 0xc(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x1a836
incq %rbx
addq $0xc, %rbp
jmp 0x1a4a9
movq (%rsp), %rdi
callq 0x6340
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rsp), %rdi
callq 0x6340
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SegmentManager.cc
// Function: hlkvds::SegmentManager::SortSegsByTS(std::multimap<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>>&, unsigned int)
void SegmentManager::SortSegsByTS(std::multimap<uint32_t, uint32_t> &cand_map, uint32_t max_seg_num)
{
    std::unique_lock<std::mutex> lck(mtx_, std::defer_lock);
    uint32_t used_size;

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x40(%rdi), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
callq 0xb49c
leaq 0x20(%rsp), %rbp
andl $0x0, (%rbp)
andq $0x0, 0x8(%rbp)
movq %rbp, 0x10(%rbp)
movq %rbp, 0x18(%rbp)
andq $0x0, 0x20(%rbp)
pushq $0x8
popq %r12
xorl %r13d, %r13d
movl 0x20(%r15), %eax
cmpq %rax, %r13
jae 0x1a5ae
movq (%r15), %rax
cmpl $0x1, -0x8(%rax,%r12)
jne 0x1a5a5
movl 0x18(%r15), %ecx
movl -0x4(%rax,%r12), %edx
addl (%rax,%r12), %edx
negl %edx
leal (%rcx,%rdx), %eax
addl $-0x20, %eax
movl %eax, (%rsp)
movl %r13d, 0x4(%rsp)
leaq 0x18(%rsp), %rdi
movq %rsp, %rsi
callq 0x1a836
incq %r13
addq $0xc, %r12
jmp 0x1a567
leaq 0x8(%rsp), %rdi
callq 0xb4c6
movq 0x30(%rsp), %r15
subl $0x1, %ebx
setb %al
cmpq %rbp, %r15
je 0x1a5e5
testb %al, %al
jne 0x1a5e5
leaq 0x20(%r15), %rsi
movq %r14, %rdi
callq 0x1a962
movq %r15, %rdi
callq 0x62c0
movq %rax, %r15
jmp 0x1a5bd
leaq 0x18(%rsp), %rdi
callq 0xe080
leaq 0x8(%rsp), %rdi
callq 0xafd0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1a611
movq %rax, %rbx
jmp 0x1a61e
jmp 0x1a611
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xe080
leaq 0x8(%rsp), %rdi
callq 0xafd0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Status.cc
// Function: hlkvds::Status::Status(hlkvds::Status::Code, char const*)
Status::Status(Code _code, const char* msg) :
    code_(_code) {
    uint32_t size = strlen(msg);
    char* const result = new char[size + 1];
    memcpy(result, msg, size);
    result[size] = '\0';
    state_ = result;
}

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %ecx
cmpq $0x9, %rcx
ja 0x1aab4
leaq 0x6752(%rip), %rax      # 0x2119c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x676a(%rip), %rsi      # 0x211c4
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
callq 0x6150
jmp 0x1aaf7
leaq 0x677e(%rip), %r15      # 0x211f1
jmp 0x1aad6
leaq 0x67cd(%rip), %r15      # 0x21249
jmp 0x1aad6
leaq 0x674d(%rip), %r15      # 0x211d2
jmp 0x1aad6
leaq 0x6751(%rip), %r15      # 0x211df
jmp 0x1aad6
leaq 0x678e(%rip), %r15      # 0x21225
jmp 0x1aad6
leaq 0x6727(%rip), %r15      # 0x211c7
jmp 0x1aad6
leaq 0x675b(%rip), %r15      # 0x21204
jmp 0x1aad6
leaq 0x675d(%rip), %r15      # 0x2120f
jmp 0x1aad6
leaq 0x67ad(%rip), %rdx      # 0x21268
leaq 0x10(%rsp), %r15
pushq $0x1e
popq %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x65f0
jmp 0x1aad6
leaq 0x6763(%rip), %r15      # 0x21239
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6150
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0x1aaf7
movq %rbx, %rdi
callq 0x6720
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x6788
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SuperBlockManager.cc
// Function: hlkvds::SuperBlockManager::Get(char*, unsigned long)
bool SuperBlockManager::Get(char* buff, uint64_t length) {
    if (length != SuperBlockManager::SuperBlockSizeOnDevice()) {
        return false;
    }
    memcpy((void *)buff, (const void*)&sb_, SuperBlockManager::SizeOfDBSuperBlock());

    uint64_t reserved_region_length = SuperBlockManager::ReservedRegionLength();

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

// Assembly:
pushq %rbx
movq %rdx, %rbx
cmpq $0x1000, %rdx           # imm = 0x1000
jne 0x1abdf
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups 0x20(%rdi), %xmm2
movups 0x2d(%rdi), %xmm3
movups %xmm3, 0x2d(%rsi)
movups %xmm2, 0x20(%rsi)
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x3d, %rsi
movq 0x40(%rdi), %rax
movl $0xfc3, %edx            # imm = 0xFC3
movq %rsi, %rdi
movq %rax, %rsi
callq 0x6370
cmpq $0x1000, %rbx           # imm = 0x1000
sete %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/SuperBlockManager.cc
// Function: hlkvds::SuperBlockManager::Set(char*, unsigned long)
bool SuperBlockManager::Set(char* buff, uint64_t length) {
    if (length != SuperBlockManager::SuperBlockSizeOnDevice()) {
        return false;
    }
    memcpy((void*)&sb_, (const void*)buff, SuperBlockManager::SizeOfDBSuperBlock());

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

    return true;
}

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x50(%rdi), %rbx
movq %rbx, %rdi
callq 0xbc3a
cmpq $0xfc3, %r14            # imm = 0xFC3
jne 0x1ad9e
movq 0x40(%r12), %rsi
movl $0xfc3, %edx            # imm = 0xFC3
movq %r15, %rdi
callq 0x6370
cmpq $0xfc3, %r14            # imm = 0xFC3
sete %bpl
movq %rbx, %rdi
callq 0x6340
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::deleteAllSegments()
void FastTier::deleteAllSegments() {
    delete mig_;

    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_);
    for (int i = 0; i< shardsNum_; i++) {
        SegForReq* seg = segMap_[i];
        delete seg;
        std::mutex *seg_mtx = segMtxVec_[i];
        delete seg_mtx;
    }
    segMap_.clear();
    segMtxVec_.clear();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x1e0(%rdi), %r14
testq %r14, %r14
je 0x1af4e
movq %r14, %rdi
callq 0x143f8
movq %r14, %rdi
callq 0x63f0
leaq 0x128(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0xaf4e
leaq 0x150(%rbx), %r14
xorl %eax, %eax
leaq 0x4(%rsp), %r15
movl %eax, 0x4(%rsp)
cmpl 0x124(%rbx), %eax
jge 0x1afc1
movq %r14, %rdi
movq %r15, %rsi
callq 0xb444
movq (%rax), %r12
testq %r12, %r12
je 0x1af9c
movq %r12, %rdi
callq 0x18f4a
movq %r12, %rdi
callq 0x63f0
movslq 0x4(%rsp), %rax
movq 0x180(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x63f0
movl 0x4(%rsp), %eax
incl %eax
jmp 0x1af75
movq %r14, %rdi
callq 0xd1e4
movq 0x180(%rbx), %rax
cmpq %rax, 0x188(%rbx)
je 0x1afe0
movq %rax, 0x188(%rbx)
leaq 0x8(%rsp), %rdi
callq 0xafd0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xafd0
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::CreateAllSegments()
void FastTier::CreateAllSegments() {
    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_);
    for (int i = 0; i < shardsNum_; i++) {
        SegForReq * seg = new SegForReq(vol_, idxMgr_, options_.expired_time);
        segMap_.insert(make_pair(i, seg));

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x128(%rdi), %rsi
leaq 0x18(%rsp), %rdi
callq 0xaf4e
leaq 0x150(%rbx), %r14
leaq 0x180(%rbx), %r15
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
cmpl 0x124(%rbx), %r13d
jge 0x1b0b4
movl $0xd8, %edi
callq 0x6410
movq %rax, %rbp
movq 0x1d8(%rbx), %rsi
movq (%rbx), %rax
movq 0x10(%rbx), %rdx
movl 0x10(%rax), %ecx
movq %rbp, %rdi
callq 0x190a0
movl %r13d, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0xbf28
pushq $0x28
popq %rdi
callq 0x6410
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
andq $0x0, 0x20(%rax)
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xafb2
incl %r13d
jmp 0x1b044
pushq $0x58
popq %rdi
callq 0x6410
movq %rax, %r14
movq (%rbx), %r8
movq 0x10(%rbx), %rsi
movq 0x1e8(%rbx), %rcx
movq %rax, %rdi
movq %rbx, %rdx
callq 0x1440c
movq %r14, 0x1e0(%rbx)
leaq 0x18(%rsp), %rdi
callq 0xafd0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
jmp 0x1b108
jmp 0x1b113
movq %rax, %rbx
movq %rbp, %rdi
callq 0x63f0
jmp 0x1b116
jmp 0x1b113
jmp 0x1b113
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xafd0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x1f0(%rdi), %r14
xorl %r13d, %r13d
pushq $0x1
popq %rbp
leaq 0x10(%rsp), %r15
cmpl 0x124(%rbx), %r13d
jge 0x1b18b
movl $0xd8, %edi
callq 0x6410
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x1d5ee
movq %r12, 0x10(%rsp)
movq %r12, %rdi
callq 0xb014
movq %r14, %rdi
movq %r15, %rsi
callq 0x1d61c
incl %r13d
jmp 0x1b14b
movl $0xd8, %edi
callq 0x6410
movq %rax, %r14
movq (%rbx), %rax
movl 0x14(%rax), %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1d63a
movq %r14, 0x208(%rbx)
movq %r14, %rdi
callq 0xb0f2
xorl %eax, %eax
xchgb %al, 0x218(%rbx)
leaq 0xb5(%rip), %rax        # 0x1b27c
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
andq $0x0, 0x8(%r14)
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
movq %rbx, (%r15)
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1d668
leaq 0x210(%rbx), %rdi
movq %r12, %rsi
callq 0xb206
movq %r12, %rdi
callq 0xaf36
xchgb %bpl, 0x228(%rbx)
leaq 0x1ee(%rip), %rax       # 0x1b404
movq %rax, (%r14)
andq $0x0, 0x8(%r14)
movq %rbx, (%r15)
leaq 0x20(%rsp), %r14
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x1d668
addq $0x220, %rbx            # imm = 0x220
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb206
movq %r14, %rdi
callq 0xaf36
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
jmp 0x1b26f
movq %rax, %rbx
movq %r12, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::SegTimeoutThdEntry()
void FastTier::SegTimeoutThdEntry() {
    __DEBUG("Segment Timeout thread start!!");
    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_, std::defer_lock);

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

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

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

                segWteWQ_->Add_task(seg);
                seg = new SegForReq(vol_, idxMgr_, options_.expired_time);

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x128(%rdi), %rax
leaq 0x18(%rsp), %r14
movq %rax, (%r14)
movb $0x0, 0x8(%r14)
leaq 0x150(%rdi), %r15
leaq 0x28(%rsp), %r12
leaq 0x4(%rsp), %r13
movb 0x218(%rbx), %al
testb $0x1, %al
jne 0x1b3b1
xorl %eax, %eax
movl %eax, 0x4(%rsp)
cmpl 0x124(%rbx), %eax
jge 0x1b3a1
cltq
movq 0x180(%rbx), %rcx
movq (%rcx,%rax,8), %rsi
movq %r12, %rdi
callq 0xaf4e
movq %r14, %rdi
callq 0xb49c
movq %r15, %rdi
movq %r13, %rsi
callq 0xb444
movq (%rax), %rbp
movq %r14, %rdi
callq 0xb4c6
movq %rbp, %rdi
callq 0x192d6
testb %al, %al
je 0x1b38e
movq %rbp, %rdi
callq 0x191b2
movq 0x208(%rbx), %rdi
movq %rbp, %rsi
callq 0xb4ec
movl $0xd8, %edi
callq 0x6410
movq %rax, %rbp
movq 0x1d8(%rbx), %rsi
movq (%rbx), %rax
movq 0x10(%rbx), %rdx
movl 0x10(%rax), %ecx
movq %rbp, %rdi
callq 0x190a0
movq %r14, %rdi
callq 0xb49c
movq %r15, %rdi
movq %r13, %rsi
callq 0xd420
movq %r15, %rdi
movq %rax, %rsi
callq 0xd454
movl 0x4(%rsp), %eax
movl %eax, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0xbf28
movq %r14, %rdi
callq 0xb4c6
movq %r12, %rdi
callq 0xafd0
movl 0x4(%rsp), %eax
incl %eax
jmp 0x1b2c2
movq (%rbx), %rax
movl 0x10(%rax), %edi
callq 0x6570
jmp 0x1b2b2
leaq 0x18(%rsp), %rdi
callq 0xafd0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1b3dd
movq %rax, %rbx
movq %rbp, %rdi
callq 0x63f0
jmp 0x1b3e7
jmp 0x1b3e4
jmp 0x1b3e4
movq %rax, %rbx
jmp 0x1b3f1
jmp 0x1b3e4
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xafd0
leaq 0x18(%rsp), %rdi
callq 0xafd0
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::StopThds()
void FastTier::StopThds() {
    //vol_->StopThds();

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

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x1, %bpl
movb $0x1, %al
xchgb %al, 0x228(%rdi)
addq $0x220, %rdi            # imm = 0x220
callq 0x6660
xchgb %bpl, 0x218(%rbx)
leaq 0x210(%rbx), %rdi
callq 0x6660
xorl %r15d, %r15d
movslq 0x124(%rbx), %rcx
movq 0x1f0(%rbx), %rax
cmpq %rcx, %r15
jge 0x1b4ce
movq (%rax,%r15,8), %r14
movq %r14, %rdi
callq 0xb26e
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
incq %r15
jmp 0x1b4a1
cmpq %rax, 0x1f8(%rbx)
je 0x1b4de
movq %rax, 0x1f8(%rbx)
movq 0x208(%rbx), %rdi
testq %rdi, %rdi
je 0x1b50b
callq 0xb2b2
movq 0x208(%rbx), %rdi
testq %rdi, %rdi
je 0x1b50b
movq (%rdi), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::writeDataImmediately(hlkvds::KVSlice&)
Status FastTier::writeDataImmediately(KVSlice& slice){
    uint32_t seg_id = 0;
    bool ret = false;

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

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

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
andl $0x0, (%rsi)
movq %r15, %rdi
callq 0x1ba7e
testb %al, %al
je 0x1b71d
pushq $0x48
popq %rdi
callq 0x6410
movq %rax, %r14
movq 0x10(%r15), %rdx
movq 0x1d8(%r15), %rsi
movq %rax, %rdi
callq 0x1954e
movq %r14, %rdi
movq %r12, %rsi
callq 0x1959a
movl 0xc(%rsp), %eax
movl %eax, 0x10(%r14)
movq %r14, %rdi
callq 0x19636
testb %al, %al
je 0x1b785
movl 0x14(%r14), %edx
subl 0x20(%r14), %edx
addl $-0x20, %edx
movq 0x1d8(%r15), %rdi
movl 0xc(%rsp), %esi
callq 0x1df82
movq %r14, %rdi
callq 0x199a2
movq %r14, %rdi
callq 0x1950a
movq %r14, %rdi
callq 0x63f0
andl $0x0, (%rbx)
andq $0x0, 0x8(%rbx)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x168b4(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0x3b72(%rip), %rsi      # 0x1f2a5
leaq 0x3f6b(%rip), %rcx      # 0x1f6a5
leaq 0x5c87(%rip), %r8       # 0x213c8
movq %r14, %rdi
movq %rax, %rdx
movl $0x172, %r9d            # imm = 0x172
xorl %eax, %eax
callq 0x6580
movq (%r15), %rcx
leaq 0x3d78(%rip), %rdi      # 0x1f4d6
pushq $0x20
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
leaq 0x3d7c(%rip), %rsi      # 0x1f4f7
movq %rbx, %rdi
callq 0xb30a
jmp 0x1b70c
movq 0x1684c(%rip), %r13     # 0x31fd8
movq (%r13), %r12
callq 0x63c0
leaq 0x3b09(%rip), %rsi      # 0x1f2a5
leaq 0x3f02(%rip), %rcx      # 0x1f6a5
leaq 0x5c1e(%rip), %r8       # 0x213c8
movq %r12, %rdi
movq %rax, %rdx
movl $0x17b, %r9d            # imm = 0x17B
xorl %eax, %eax
callq 0x6580
movq (%r13), %rcx
leaq 0x3d94(%rip), %rdi      # 0x1f55c
pushq $0x24
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq 0x1d8(%r15), %rdi
movl 0xc(%rsp), %esi
callq 0x1df6e
movq %r14, %rdi
callq 0x1950a
movq %r14, %rdi
callq 0x63f0
leaq 0x3d7b(%rip), %rsi      # 0x1f581
movq %rbx, %rdi
callq 0xb31e
jmp 0x1b70c
movq %rax, %rbx
movq %r14, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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 0xbc3a
movq 0x1e8(%r15), %rax
movl 0x40(%rax), %r12d
movq 0x1d8(%r15), %rdi
movq %r14, %rsi
callq 0x1dde4
movl %eax, %ebp
subl $0x1, %r12d
setb %al
orb %bpl, %al
testb $0x1, %al
jne 0x1bae1
movq 0x1e8(%r15), %rdi
callq 0x1c3d6
movq 0x1e0(%r15), %rdi
movl %eax, %esi
callq 0x14444
jmp 0x1baa6
movq %rbx, %rdi
callq 0x6340
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1baf8
jmp 0x1baf8
movq %rax, %r14
movq %rbx, %rdi
callq 0x6340
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x28(%rdx), %r14
leaq 0x8(%rsp), %rdx
andq $0x0, (%rdx)
movq 0x1d8(%rsi), %rdi
movq %r14, %rsi
callq 0x1dfc6
testb %al, %al
je 0x1bb96
movq (%r14), %rax
movzwl 0x16(%rax), %r13d
testq %r13, %r13
je 0x1bba7
movq %r13, %rdi
callq 0x6040
movq %rax, %r14
movq 0x1d8(%r12), %rdi
movq 0x8(%rsp), %rcx
movq %rax, %rsi
movq %r13, %rdx
callq 0x1de02
testb %al, %al
je 0x1bbc7
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x6510
movq %r14, %rdi
callq 0x64c0
andl $0x0, (%rbx)
andq $0x0, 0x8(%rbx)
jmp 0x1bbb6
leaq 0x3a0d(%rip), %rsi      # 0x1f5aa
movq %rbx, %rdi
callq 0xb30a
jmp 0x1bbb6
leaq 0x3a1a(%rip), %rsi      # 0x1f5c8
movq %rbx, %rdi
callq 0xb332
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x1640a(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0x36c7(%rip), %rsi      # 0x1f2a5
leaq 0x39f5(%rip), %rcx      # 0x1f5da
leaq 0x57dc(%rip), %r8       # 0x213c8
movq %r15, %rdi
movq %rax, %rdx
movl $0xaf, %r9d
xorl %eax, %eax
callq 0x6580
movq (%r12), %rcx
leaq 0x39d9(%rip), %rdi      # 0x1f5e3
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq %r14, %rdi
callq 0x64c0
leaq 0x39d3(%rip), %rsi      # 0x1f603
movq %rbx, %rdi
callq 0xb31e
jmp 0x1bbb6
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1bc7e
movq %rsi, %r14
movq %rdi, %r15
movq 0x1d8(%rdi), %rdi
callq 0x1df1a
movl %eax, 0x120(%r15)
addq $0x18, %r15
movl $0x10c, %edx            # imm = 0x10C
movq %r14, %rdi
movq %r15, %rsi
callq 0x6370
cmpq $0x10c, %rbx            # imm = 0x10C
sete %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1bca9
addq $0x18, %rdi
movl $0x10c, %edx            # imm = 0x10C
callq 0x6370
cmpq $0x10c, %rbx            # imm = 0x10C
sete %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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)
testw $0xfff, %r13w           # imm = 0xFFF
jne 0x1bdaa
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 0x8d98
movl %eax, 0x1d4(%rbx)
movl 0x1d0(%rbx), %ecx
addl $-0x4a, %ecx
movl %ecx, 0x1c0(%rbx)
addl %eax, %ebp
movl %ebp, %edi
callq 0x8d74
movq %rax, 0x1c8(%rbx)
addq %rax, %r14
pushq $0x58
popq %rdi
callq 0x6410
movq %rax, %r12
movq (%rbx), %rcx
movq 0x10(%rbx), %rdx
movl 0x1d0(%rbx), %eax
movl 0x1d4(%rbx), %r10d
subq $0x8, %rsp
pushq $0x64
popq %r8
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %r9
pushq $0x0
pushq %r10
pushq %rax
callq 0x1dc4c
addq $0x20, %rsp
movq %r12, 0x1d8(%rbx)
movq %rbx, %rdi
callq 0x1be16
testw $0xfff, %r13w           # imm = 0xFFF
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x16227(%rip), %r14     # 0x31fd8
movq (%r14), %rbx
callq 0x63c0
leaq 0x34e5(%rip), %rsi      # 0x1f2a5
leaq 0x56b2(%rip), %rcx      # 0x21479
leaq 0x55fa(%rip), %r8       # 0x213c8
movq %rbx, %rdi
movq %rax, %rdx
movl $0xe7, %r9d
xorl %eax, %eax
callq 0x6580
movq (%r14), %rcx
leaq 0x569b(%rip), %rdi      # 0x21486
pushq $0x2a
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
jmp 0x1bd92
movq %rax, %rbx
movq %r12, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1df22
leaq 0x1c(%rbx), %rdi
movq (%r14), %rsi
movq 0x8(%r14), %rdx
callq 0x6370
movl 0x1d4(%rbx), %eax
movl %eax, 0x11c(%rbx)
movq 0x1d8(%rbx), %rdi
callq 0x1df1a
movl %eax, 0x120(%rbx)
leaq 0x8(%rsp), %rdi
callq 0x6788
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6788
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movq %rdi, %r14
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 0x1bfb6
movl %eax, %ebx
testb %al, %al
je 0x1bf4a
movq (%r15), %rax
movq (%rax), %r12
movl 0x120(%r14), %ebp
movq 0x8(%r14), %rax
movq 0x24(%rax), %r13
addq 0x1c(%rax), %r13
pushq $0x58
popq %rdi
callq 0x6410
movq %rax, %r15
movq (%r14), %rcx
movq 0x10(%r14), %rdx
movl 0x1d0(%r14), %eax
movl 0x1d4(%r14), %r10d
subq $0x8, %rsp
pushq $0x64
popq %r8
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %r9
pushq %rbp
pushq %r10
pushq %rax
callq 0x1dc4c
addq $0x20, %rsp
movq %r15, 0x1d8(%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x16087(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0x3345(%rip), %rsi      # 0x1f2a5
leaq 0x554a(%rip), %rcx      # 0x214b1
leaq 0x545a(%rip), %r8       # 0x213c8
movq %r14, %rdi
movq %rax, %rdx
movl $0x103, %r9d            # imm = 0x103
xorl %eax, %eax
callq 0x6580
movq (%r15), %rcx
leaq 0x5531(%rip), %rdi      # 0x214bc
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
jmp 0x1bf39
movq %rax, %rbx
movq %r15, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x40, %rsp
movq %rsi, %rbx
leaq 0x1c(%rdi), %rsi
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x6150
movq (%rbx), %rax
movq (%rax), %rsi
movq (%rsi), %rax
movq %rsp, %rdi
callq *0x28(%rax)
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xb492
movl %eax, %ebx
testb %al, %al
jne 0x1c016
xorb $0x1, %bl
movq %rsp, %rdi
callq 0x6788
leaq 0x20(%rsp), %rdi
callq 0x6788
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x15fbb(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0x3279(%rip), %rsi      # 0x1f2a5
leaq 0x3694(%rip), %rcx      # 0x1f6c7
leaq 0x538e(%rip), %r8       # 0x213c8
movq %r14, %rdi
movq %rax, %rdx
movl $0x1b2, %r9d            # imm = 0x1B2
xorl %eax, %eax
callq 0x6580
movq (%r15), %rdi
movq 0x20(%rsp), %rdx
movq (%rsp), %rcx
leaq 0x3676(%rip), %rsi      # 0x1f6d6
xorl %eax, %eax
callq 0x6580
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
jmp 0x1bff5
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6788
movq %rbx, %rdi
callq 0x6680
nop