LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::Create_KVDS(char const*, hlkvds::Options)
KVDS* KVDS::Create_KVDS(const char* filename, Options opts) {
    if (filename == NULL) {
        return NULL;
    }

    KVDS* kvds = new KVDS(filename, opts);

    if (!kvds->openAllDevices(kvds->paths_)) {
        delete kvds;
        return NULL;
    }

    int datastor_type = opts.datastor_type;
    kvds->dataStor_ = DataStor::Create(kvds->options_, kvds->bdVec_, kvds->sbMgr_, kvds->idxMgr_, datastor_type);

    if (kvds->dataStor_ == NULL) {
        delete kvds;
        return NULL;
    }

    kvds->idxMgr_->InitDataStor(kvds->dataStor_);
    kvds->metaStor_->InitDataStor(kvds->dataStor_);

    if (!kvds->metaStor_->CreateMetaData()) {
        delete kvds;
        return NULL;
    }

    __INFO("\nCreate KVDS Success!!!");
    kvds->printDbStates();

    kvds->dataStor_->InitSegmentBuffer();
    kvds->startThds();

    kvds->isOpen_ = true;

    return kvds;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
testq %rdi, %rdi
je 0x136cd
movq %rdi, %r15
leaq 0xa0(%rsp), %r14
movl $0xc0, %edi
callq 0x6420
movq %rax, %rbx
movl $0xa, %ecx
movq %rsp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
movq %r15, %rsi
callq 0x13cae
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %r15
movq %r15, %rdi
callq 0xa64c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13716
movl %eax, %ebp
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x13674
callq 0x6400
testb %bpl, %bpl
je 0x136c4
movl 0x3c(%r14), %r8d
leaq 0x50(%rbx), %rdi
leaq 0xa0(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x30(%rbx), %rcx
callq 0xfed8
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x136c4
movq 0x30(%rbx), %rdi
movq %rax, %rsi
callq 0x111f8
movq 0x40(%rbx), %rdi
movq 0x48(%rbx), %rsi
callq 0x161ac
movq 0x40(%rbx), %rdi
callq 0x16298
testb %al, %al
jne 0x136df
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30(%rbx), %rdx
movq %rbx, %rsi
addq $0x48, %rsi
movq %rbx, %rdi
callq 0x76b8
jmp 0x136cf
movq %rax, %r14
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
jne 0x13709
jmp 0x1370e
movq %rax, %r14
movq %rbx, %rdi
callq 0x6400
movq %r14, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::openAllDevices(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool KVDS::openAllDevices(string paths) {

    vector<string> fields;
    boost::split(fields, paths, boost::is_any_of(FileDelim));
    vector<string>::iterator iter;
    for(iter = fields.begin(); iter != fields.end(); iter++){
        BlockDevice *bdev = new KernelDevice();

        if (bdev->Open(*iter) < 0) {
            return false;
        }__DEBUG("Open Device %s Success!", (*iter).c_str());

        bdVec_.push_back(bdev);
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x20cff(%rip), %rax     # 0x34440
movq 0x20d00(%rip), %rcx     # 0x34448
addq %rax, %rcx
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq %rcx, 0x8(%rsi)
leaq 0x20(%rsp), %rdi
callq 0x1450a
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
movq %r14, %rsi
movl $0x1, %ecx
callq 0x14331
cmpq $0x11, 0x30(%rsp)
jb 0x1378d
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1378d
callq 0x64e0
movq (%rsp), %r14
cmpq 0x8(%rsp), %r14
sete %bpl
je 0x13854
leaq 0x58(%rsp), %r12
leaq 0xa0(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x48(%rsp), %r15
movl $0x48, %edi
callq 0x6420
movq %rax, %r13
movq %rax, %rdi
callq 0x126dc
movq %r13, 0x38(%rsp)
movq %r12, 0x48(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0xa64c
movq (%r13), %rax
movq %r13, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq *0x18(%rax)
movl %eax, %r13d
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x1380b
callq 0x6400
testl %r13d, %r13d
js 0x13854
movq 0xa8(%rbx), %rsi
cmpq 0xb0(%rbx), %rsi
je 0x13832
movq 0x38(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0xa8(%rbx)
jmp 0x13841
movq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x16044
addq $0x20, %r14
cmpq 0x8(%rsp), %r14
sete %bpl
jne 0x137b6
movq %rsp, %rdi
callq 0x144c6
andb $0x1, %bpl
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
cmpq $0x11, 0x30(%rsp)
jb 0x138ae
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x138ae
callq 0x64e0
jmp 0x138ae
jmp 0x138ab
movq %rax, %rbx
movq %r13, %rdi
jmp 0x138a4
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x138ae
callq 0x6400
jmp 0x138ae
movq %rax, %rbx
movq %rsp, %rdi
callq 0x144c6
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::printDbStates()
void KVDS::printDbStates() {
    sbMgr_->printSBInfo();
    dataStor_->printDeviceTopologyInfo();

    idxMgr_->printDynamicInfo();
    dataStor_->printDynamicInfo();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
callq 0x883a
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movq 0x30(%rbx), %rdi
callq 0x72d2
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
popq %rbx
jmpq *0x38(%rax)
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::Open_KVDS(char const*, hlkvds::Options)
KVDS* KVDS::Open_KVDS(const char* filename, Options opts) {
    KVDS *kvds = new KVDS(filename, opts);

    Status s = kvds->openDB();
    if (!s.ok()) {
        delete kvds;
        return NULL;
    }

    kvds->isOpen_ = true;
    return kvds;

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
movl $0xc0, %edi
callq 0x6420
movq %rax, %rbx
leaq 0x80(%rsp), %rsi
movl $0xa, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
movq %r14, %rsi
callq 0x13cae
leaq 0x58(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x139c2
cmpl $0x0, (%r14)
je 0x1399c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
xorl %ebx, %ebx
jmp 0x139a3
movb $0x1, 0xb8(%rbx)
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x6400
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::openDB()
Status KVDS::openDB() {
    if (!openAllDevices(paths_)) {
        return Status::IOError("Could not open all device");
    }

    int datastor_type = -1;
    if ( !metaStor_->TryLoadSB(datastor_type)) {
        return  Status::IOError("Could not load SB");
    }
    dataStor_ = DataStor::Create(options_, bdVec_, sbMgr_, idxMgr_, datastor_type);

    if (dataStor_ == NULL) {
        return Status::NotSupported("Could not support this data store");
    }

    idxMgr_->InitDataStor(dataStor_);
    metaStor_->InitDataStor(dataStor_);

    if (!metaStor_->LoadMetaData()) {
        return Status::IOError("Could not read meta data");
    }

    __INFO("\nOpen KVDS Success!!!");
    printDbStates();

    dataStor_->InitSegmentBuffer();
    startThds();
    return Status::OK();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%rsi), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0xa64c
movq %r14, %rdi
movq %r15, %rsi
callq 0x13716
movl %eax, %ebp
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x13a12
callq 0x6400
testb %bpl, %bpl
je 0x13a84
leaq 0xc(%rsp), %rsi
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
movq 0x40(%r14), %rdi
callq 0x161c2
testb %al, %al
je 0x13a8d
leaq 0x50(%r14), %rdi
leaq 0xa0(%r14), %rsi
movq 0x28(%r14), %rdx
movq 0x30(%r14), %rcx
movl 0xc(%rsp), %r8d
callq 0xfed8
movq %rax, 0x48(%r14)
testq %rax, %rax
je 0x13ab1
movq 0x30(%r14), %rdi
movq %rax, %rsi
callq 0x111f8
movq 0x40(%r14), %rdi
movq 0x48(%r14), %rsi
callq 0x161ac
movq 0x40(%r14), %rdi
callq 0x16654
testb %al, %al
jne 0x13ac2
leaq 0xf409(%rip), %rdx      # 0x22e8b
jmp 0x13a94
leaq 0xf3b2(%rip), %rdx      # 0x22e3d
jmp 0x13a94
leaq 0xf3c3(%rip), %rdx      # 0x22e57
movq %rbx, %rdi
movl $0x5, %esi
callq 0x1de18
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf3b1(%rip), %rdx      # 0x22e69
movq %rbx, %rdi
movl $0x3, %esi
jmp 0x13a9c
leaq 0x30(%r14), %rdx
leaq 0x48(%r14), %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq 0x7755
jmp 0x13aa1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x13ae9
callq 0x6400
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::closeDB()
Status KVDS::closeDB() {
    if (!metaStor_->PersistMetaData()) {
        __ERROR("Could not to write metadata to device\n");
        return Status::IOError("Could not to write metadata to device");
    }
    stopThds();
    return Status::OK();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x40(%rsi), %rdi
callq 0x16862
testb %al, %al
je 0x13b35
movq 0x48(%r14), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movq 0x30(%r14), %rdi
callq 0x12126
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rdi
callq 0x77fd
jmp 0x13b2a
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::~KVDS()
KVDS::~KVDS() {
    if (isOpen_) {
        closeDB();
    }
    delete idxMgr_;
    delete sbMgr_;
    if(!options_.disable_cache){
        delete rdCache_;
    }
    delete metaStor_;
    if (dataStor_) {
        delete dataStor_;
    }
    closeAllDevices();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x1fa27(%rip), %rax     # 0x33590
addq $0x10, %rax
movq %rax, (%rdi)
cmpb $0x1, 0xb8(%rdi)
jne 0x13b86
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x13af2
movq 0x30(%rbx), %r14
testq %r14, %r14
je 0x13b9f
movq %r14, %rdi
callq 0x11fa8
movq %r14, %rdi
callq 0x6400
movq 0x28(%rbx), %r14
testq %r14, %r14
je 0x13bb8
movq %r14, %rdi
callq 0x1e0be
movq %r14, %rdi
callq 0x6400
cmpb $0x0, 0x50(%rbx)
jne 0x13bd7
movq 0x38(%rbx), %r14
testq %r14, %r14
je 0x13bd7
movq %r14, %rdi
callq 0x173f2
movq %r14, %rdi
callq 0x6400
movq 0x40(%rbx), %r14
testq %r14, %r14
je 0x13bf0
movq %r14, %rdi
callq 0x161aa
movq %r14, %rdi
callq 0x6400
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x13bff
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x13c3a
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0x13c18
callq 0x6400
movq 0x8(%rbx), %rdi
addq $0x18, %rbx
cmpq %rbx, %rdi
je 0x13c2a
callq 0x6400
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0xdf17
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::KVDS(char const*, hlkvds::Options)
KVDS::KVDS(const char* filename, Options opts) :
    paths_(string(filename)), sbMgr_(NULL), idxMgr_(NULL), rdCache_(NULL), metaStor_(NULL), dataStor_(NULL), options_(opts), isOpen_(false) {

    sbMgr_ = new SuperBlockManager(options_);
    idxMgr_ = new IndexManager(sbMgr_, options_);

    if(!options_.disable_cache){
        rdCache_ = new ReadCache(CachePolicy(options_.cache_policy), (size_t) options_.cache_size, options_.slru_partition);
    }

    metaStor_ = new MetaStor(filename, bdVec_, sbMgr_, idxMgr_, options_);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x1f8ca(%rip), %rax     # 0x33590
addq $0x10, %rax
movq %rax, (%rdi)
addq $0x8, %rdi
leaq 0x7(%rsp), %rdx
callq 0x6170
leaq 0x50(%rbx), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movups %xmm0, 0x28(%rbx)
movq $0x0, 0x48(%rbx)
leaq 0x40(%rsp), %rsi
movl $0xa, %ecx
movq %r12, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xa0(%rbx), %r14
movups %xmm0, 0xa9(%rbx)
movups %xmm0, 0xa0(%rbx)
movl $0x78, %edi
callq 0x6420
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x1e074
leaq 0x28(%rbx), %rax
movq %r13, (%rax)
movl $0xa0, %edi
callq 0x6420
movq %rax, %rbp
movq %rax, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x11f2c
movq %rbp, 0x30(%rbx)
cmpb $0x0, 0x50(%rbx)
jne 0x13d7e
movl $0x1a8, %edi            # imm = 0x1A8
callq 0x6420
movq %rax, %r13
movslq 0x54(%rbx), %rdx
movl 0x58(%rbx), %esi
movl 0x5c(%rbx), %ecx
movq %rax, %rdi
callq 0x17334
movq %r13, 0x38(%rbx)
movl $0x50, %edi
callq 0x6420
movq %rax, %r13
movq 0x28(%rbx), %rcx
movq 0x30(%rbx), %r8
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %r9
callq 0x1617c
movq %r13, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13dc3
jmp 0x13dc3
movq %rax, %r15
movq %rbp, %rdi
jmp 0x13dc9
movq %rax, %r15
movq %r13, %rdi
callq 0x6400
jmp 0x13dd3
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x13de0
callq 0x6400
movq 0x8(%rbx), %rdi
addq $0x18, %rbx
cmpq %rbx, %rdi
je 0x13df2
callq 0x6400
movq %r15, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::Insert(char const*, unsigned int, char const*, unsigned short, bool)
Status KVDS::Insert(const char* key, uint32_t key_len, const char* data,
                      uint16_t length, bool immediately) {
    if (key == NULL || key[0] == '\0') {
        return Status::InvalidArgument("Key is null or empty.");
    }

    KVSlice slice(key, key_len, data, length);

    Status s = dataStor_->WriteData(slice, immediately);

    if (s.ok()) {
        if(!options_.disable_cache && !slice.GetDataLen()){
            rdCache_->Put(slice.GetKeyStr(),slice.GetDataStr());
        }
    }

    return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
testq %rdx, %rdx
je 0x13e63
cmpb $0x0, (%rdx)
je 0x13e63
movq %rsi, %r14
movb 0xb0(%rsp), %bpl
movzwl %r9w, %eax
leaq 0x48(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
movl %ecx, %edx
movq %r8, %rcx
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x1b89e
movq 0x48(%r14), %rsi
movq (%rsi), %rax
movzbl %bpl, %ecx
movq %rbx, %rdi
movq %r15, %rdx
callq *0x40(%rax)
cmpl $0x0, (%rbx)
je 0x13e88
leaq 0x48(%rsp), %rdi
callq 0x1b780
jmp 0x13e77
leaq 0xf0ac(%rip), %rdx      # 0x22f16
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1de18
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x50(%r14)
jne 0x13e57
cmpw $0x0, 0x60(%rsp)
jne 0x13e57
movq 0x38(%r14), %r14
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1ba6c
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1ba8e
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x17424
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13ede
callq 0x6400
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13e57
callq 0x6400
jmp 0x13e57
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13f15
callq 0x6400
jmp 0x13f15
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13f2f
callq 0x6400
jmp 0x13f2f
jmp 0x13f2c
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x1b780
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Kvdb_Impl.cc
// Function: hlkvds::KVDS::InsertBatch(hlkvds::WriteBatch*)
Status KVDS::InsertBatch(WriteBatch *batch) {
    if (batch->batch_.empty()) {
        return Status::OK();
    }

    Status s = dataStor_->WriteBatchData(batch);

    if (s.ok()) {
        if(!options_.disable_cache) {
            for (std::list<KVSlice *>::iterator iter = batch->batch_.begin();
                    iter != batch->batch_.end(); iter++) {
                if(!(*iter)->GetDataLen()) {//no "" should be put in to the cache
                    rdCache_->Put((*iter)->GetKeyStr(), (*iter)->GetDataStr());
                }
            }
        }
    }

    return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpq %rdx, (%rdx)
je 0x14299
movq %rdx, %r14
movq %rsi, (%rsp)
movq 0x48(%rsi), %rsi
movq (%rsi), %rax
movq %rbx, %rdi
callq *0x48(%rax)
cmpl $0x0, (%rbx)
jne 0x142a7
movq (%rsp), %rax
cmpb $0x0, 0x50(%rax)
jne 0x142a7
movq (%r14), %r12
cmpq %r14, %r12
je 0x142a7
leaq 0x28(%rsp), %r13
leaq 0x8(%rsp), %r15
movq 0x10(%r12), %rsi
cmpw $0x0, 0x18(%rsi)
jne 0x1428e
movq (%rsp), %rax
movq 0x38(%rax), %rbp
movq %r13, %rdi
callq 0x1ba6c
movq 0x10(%r12), %rsi
movq %r15, %rdi
callq 0x1ba8e
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x17424
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1427a
callq 0x6400
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1428e
callq 0x6400
movq (%r12), %r12
cmpq %r14, %r12
jne 0x1422f
jmp 0x142a7
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x142d5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x142d5
callq 0x6400
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x142e9
callq 0x6400
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::TryLoadSB(int&)
bool MetaStor::TryLoadSB(int &datastor_type) {
    verifyMetaDevice();

    //Load SuperBlock
    sbOff_ = 0;
    if (!loadSuperBlock()) {
        __ERROR("Load SuperBlock failed.");
        return false;
    }

    datastor_type = sbMgr_->GetDataStoreType();
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, 0x10(%rdi)
movq $0x0, 0x38(%rdi)
callq 0x16204
movl %eax, %ebp
testb %al, %al
je 0x161fd
movq 0x18(%r14), %rax
movl 0x2c(%rax), %eax
movl %eax, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x7893
jmp 0x161f6
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::loadSuperBlock()
bool MetaStor::loadSuperBlock() {
    uint64_t length = SuperBlockManager::SuperBlockSizeOnDevice();
    char *buff = new char[length];
    memset(buff, 0, length);

    if ((uint64_t) metaDev_->pRead(buff, length, sbOff_) != length){
        __ERROR("Could not read superblock from device at %ld\n", sbOff_);
        delete[] buff;
        return false;
    }

    if (!sbMgr_->Set(buff, length))
    {
        __ERROR("Can't Set SuperBlock, Load Failed!");
        delete[] buff;
        return false;
    }
    delete[] buff;
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0x1000, %edi           # imm = 0x1000
callq 0x6040
movq %rax, %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rax, %rdi
xorl %esi, %esi
callq 0x6260
movq 0x10(%r14), %rdi
movq 0x38(%r14), %rcx
movq (%rdi), %rax
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
callq *0x50(%rax)
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x1626c
movq 0x18(%r14), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
callq 0x1dfc0
movb $0x1, %bpl
testb %al, %al
je 0x1627a
movq %rbx, %rdi
callq 0x64e0
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
addq $0x38, %r14
movq %r14, %rdi
callq 0x78f3
jmp 0x1627f
callq 0x794b
movq 0x1dd52(%rip), %rax     # 0x33fd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x64d0
xorl %ebp, %ebp
jmp 0x1625d
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::createSuperBlock()
bool MetaStor::createSuperBlock() {
    uint64_t length = SuperBlockManager::SuperBlockSizeOnDevice();
    char *buff = new char[length];
    memset(buff, 0, length);

    if (!sbMgr_->Set(buff, length))
    {
        __ERROR("Can't Set SuperBlock, Load Failed!");
        delete[] buff;
        return false;
    }
    delete[] buff;
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0x1000, %edi           # imm = 0x1000
callq 0x6040
movq %rax, %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rax, %rdi
xorl %esi, %esi
callq 0x6260
movq 0x18(%r14), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
callq 0x1dfc0
movl %eax, %ebp
testb %al, %al
je 0x16485
movq %rbx, %rdi
callq 0x64e0
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x7ac2
jmp 0x16476
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::createIndex(unsigned int, unsigned long)
bool MetaStor::createIndex(uint32_t ht_size, uint64_t index_size) {
    idxMgr_->InitMeta(ht_size, index_size, 0, 0);

    uint64_t length = index_size;
    char *buff = new char[length];
    memset(buff, 0, length);

    if(!idxMgr_->Set(buff, length)){
        __ERROR("Can't Set Index Region, Load Failed!");
        delete[] buff;
        return false;
    }

    delete[] buff;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %r15
movq 0x20(%rdi), %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x111fe
movq %r14, %rdi
callq 0x6040
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x6260
movq 0x20(%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1142e
movl %eax, %ebp
testb %al, %al
je 0x164e9
movq %rbx, %rdi
callq 0x64e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x7b24
jmp 0x164d4
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::createDataStor()
bool MetaStor::createDataStor() {
    if (!dataStor_->CreateAllComponents(sstOff_)) {
        __ERROR("Can't Create DataStore");
        return false;
    }

    uint64_t length = dataStor_->GetSSTsLengthOnDisk();

    char *buff = new char[length];
    memset(buff, 0 , length);

    if (!dataStor_->SetAllSSTs(buff, length)) {
        __ERROR("Can't Set SST Region, Load Failed!");
        delete[] buff;
        return false;
    }

    delete[] buff;
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
movq 0x48(%rbx), %rsi
movq (%rdi), %rax
callq *0x80(%rax)
testb %al, %al
je 0x1655b
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
movq %rax, %r15
movq %rax, %rdi
callq 0x6040
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x6260
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %r15, %rdx
callq *0x78(%rax)
movl %eax, %ebx
movq %r14, %rdi
testb %al, %al
je 0x16564
callq 0x64e0
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
callq 0x7b86
xorl %ebx, %ebx
jmp 0x16553
callq 0x7be8
jmp 0x16553
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::zeroDeviceMetaRegion(unsigned long)
bool MetaStor::zeroDeviceMetaRegion(uint64_t meta_size) {
    if (meta_size % 4096 != 0) {
        return false;
    }

    char *align_buf;
    int block_size = metaDev_->GetBlockSize();
    block_size = (block_size > 4096? block_size : 4096);

    int ret = posix_memalign((void **)&align_buf, 4096, (size_t)block_size);
    if (ret < 0) {
        __ERROR("Can't allocate memory for SSTs, Persist Failed!");
        return false;
    }
    memset(align_buf, 0, block_size);

    uint64_t need_wte_bytes = meta_size;
    uint64_t wte_offset = 0;
    while (need_wte_bytes > 0) {
        uint64_t bytes_to_write = min(need_wte_bytes, (uint64_t)block_size);
        if ( !metaDev_->pWrite(align_buf, bytes_to_write, wte_offset) ) {
            __ERROR("error in fill_file_with_zeros write: %s\n", strerror(errno));
            free(align_buf);
            return false;
        }
        need_wte_bytes -= bytes_to_write;
        wte_offset += bytes_to_write;
    }
    free(align_buf);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rax
shlq $0x34, %rax
je 0x1658a
xorl %ebp, %ebp
jmp 0x16639
movq %rsi, %rbx
movq %rdi, %r12
movq 0x10(%rdi), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
cmpl $0x1001, %eax           # imm = 0x1001
movl $0x1000, %r15d          # imm = 0x1000
cmovgel %eax, %r15d
leaq 0x8(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdx
callq 0x6200
testl %eax, %eax
js 0x1664a
leaq 0x8(%rsp), %rax
movq (%rax), %rdi
xorl %r13d, %r13d
xorl %esi, %esi
movq %r15, %rdx
callq 0x6260
movq %r15, 0x10(%rsp)
testq %rbx, %rbx
sete %bpl
je 0x1662f
cmpq %r15, %rbx
cmovbq %rbx, %r15
movq %r12, %r14
movq 0x10(%r12), %rdi
movq 0x8(%rsp), %rsi
movq (%rdi), %rax
movq %r15, %rdx
movq %r13, %rcx
callq *0x48(%rax)
movq %rax, %r12
testq %rax, %rax
je 0x16623
subq %r15, %rbx
addq %r15, %r13
testq %r12, %r12
movq %r14, %r12
movq 0x10(%rsp), %r15
jne 0x165dd
jmp 0x16639
leaq 0x8(%rsp), %rdi
callq 0x7c54
jmp 0x16614
movq 0x8(%rsp), %rdi
callq 0x6490
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7ccf
jmp 0x16583
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::LoadMetaData()
bool MetaStor::LoadMetaData() {

    //Load Index
    uint32_t index_ht_size = sbMgr_->GetHTSize();
    uint64_t sb_region_length = SuperBlockManager::SuperBlockSizeOnDevice();
    uint64_t index_region_length = sbMgr_->GetIndexRegionLength();

    idxOff_ = sbOff_ + sb_region_length;
    if(!loadIndex(index_ht_size, index_region_length)) {
        __ERROR("Load Index failed.");
        return false;
    }

    //Load DataStor
    sstOff_ = idxOff_ + index_region_length;
    if (!loadDataStor()) {
        __ERROR("Load SSTs failed.");
        return false;
    }

    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movl 0x4(%rax), %esi
movq 0x10(%rax), %r14
movl $0x1000, %eax           # imm = 0x1000
addq 0x38(%rdi), %rax
movq %rax, 0x40(%rdi)
movq %r14, %rdx
callq 0x166c4
testb %al, %al
je 0x1669f
addq 0x40(%rbx), %r14
movq %r14, 0x48(%rbx)
movq %rbx, %rdi
callq 0x1676e
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
je 0x166a6
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x7d32
jmp 0x166ab
callq 0x7d89
movq 0x1d926(%rip), %rax     # 0x33fd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x64d0
xorl %eax, %eax
jmp 0x16697
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::loadIndex(unsigned int, unsigned long)
bool MetaStor::loadIndex(uint32_t ht_size, uint64_t index_size) {
    idxMgr_->InitMeta(ht_size, index_size, sbMgr_->GetDataTheorySize(), sbMgr_->GetEntryCount());

    uint64_t length = index_size;
    char *buff = new char[length];
    memset(buff, 0, length);

    if ((uint64_t) metaDev_->pRead(buff, length, idxOff_) != length) {
        __ERROR("Could not read Index region from device at %ld\n", idxOff_);
        delete[] buff;
        return false;
    }

    if(!idxMgr_->Set(buff, length)){
        __ERROR("Can't Set Index Region, Load Failed!");
        delete[] buff;
        return false;
    }

    delete[] buff;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %r15
movq 0x18(%rdi), %rax
movq 0x20(%rdi), %rdi
movq 0x34(%rax), %rcx
movl 0x30(%rax), %r8d
callq 0x111fe
movq %r14, %rdi
callq 0x6040
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x6260
movq 0x10(%r15), %rdi
movq 0x40(%r15), %rcx
movq (%rdi), %rax
movq %rbx, %rsi
movq %r14, %rdx
callq *0x50(%rax)
cmpq %r14, %rax
jne 0x16742
movq 0x20(%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1142e
movb $0x1, %bpl
testb %al, %al
je 0x16750
movq %rbx, %rdi
callq 0x64e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
addq $0x40, %r15
movq %r15, %rdi
callq 0x7de0
jmp 0x16755
callq 0x7e38
movq 0x1d87c(%rip), %rax     # 0x33fd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x64d0
xorl %ebp, %ebp
jmp 0x1672d
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::loadDataStor()
bool MetaStor::loadDataStor() {
    uint64_t reserved_region_length = SuperBlockManager::ReservedRegionLength();

    char *reserved_content = new char[reserved_region_length];
    if ( !sbMgr_->GetReservedContent(reserved_content, reserved_region_length) ) {
        delete[] reserved_content;
        return false;
    }
    if ( !dataStor_->SetSBReservedContent(reserved_content, reserved_region_length) ) {
        delete[] reserved_content;
        return false;
    }
    delete[] reserved_content;

    if (!dataStor_->OpenAllComponents()) {
        __ERROR("Could not Open All Volumes, Maybe device topology is inconsistent");
        return false;
    }

    uint64_t length = dataStor_->GetSSTsLengthOnDisk();
    char *buff = new char[length];
    memset(buff, 0 , length);
    if ((uint64_t) metaDev_->pRead(buff, length, sstOff_) != length) {
        __ERROR("Could not read SST region from device at %ld\n", idxOff_);
        delete[] buff;
        return false;
    }

    if (!dataStor_->SetAllSSTs(buff, length)) {
        __ERROR("Can't Set SST Region, Load Failed!");
        delete[] buff;
        return false;
    }

    delete[] buff;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0xfc3, %edi            # imm = 0xFC3
callq 0x6040
movq %rax, %r14
movq 0x18(%rbx), %rdi
movl $0xfc3, %edx            # imm = 0xFC3
movq %rax, %rsi
callq 0x1e15e
testb %al, %al
je 0x16831
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movl $0xfc3, %edx            # imm = 0xFC3
movq %r14, %rsi
callq *0x68(%rax)
movl %eax, %ebp
movq %r14, %rdi
callq 0x64e0
testb %bpl, %bpl
je 0x16839
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x16846
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
movq %rax, %r15
movq %rax, %rdi
callq 0x6040
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x6260
movq 0x10(%rbx), %rdi
movq 0x48(%rbx), %rcx
movq (%rdi), %rax
movq %r14, %rsi
movq %r15, %rdx
callq *0x50(%rax)
cmpq %r15, %rax
jne 0x1684d
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %r15, %rdx
callq *0x78(%rax)
movq %r14, %rdi
testb %al, %al
je 0x1685a
callq 0x64e0
movb $0x1, %al
jmp 0x1683b
movq %r14, %rdi
callq 0x64e0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x7e8f
jmp 0x16839
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ef1
jmp 0x16839
callq 0x7f6c
jmp 0x16839
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::PersistMetaData()
bool MetaStor::PersistMetaData() {
    if (!PersistIndexToDevice()) {
        __WARN("Persist Index failed.");
        return false;
    }

    if (!PersistSSTsToDevice()) {
        __WARN("Persist SSTs failed.");
        return false;
    }

    if (!persistSuperBlockToDevice()) {
        __WARN("Persist SB failed.");
        return false;
    }

    return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x168b8
testb %al, %al
je 0x1688d
movq %rbx, %rdi
callq 0x16958
testb %al, %al
je 0x16894
movq %rbx, %rdi
callq 0x16a3c
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
je 0x1689b
popq %rbx
retq
callq 0x7fd8
jmp 0x168a0
callq 0x802f
jmp 0x168a0
callq 0x8086
movq 0x1d731(%rip), %rax     # 0x33fd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x64d0
xorl %eax, %eax
jmp 0x1688b
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::PersistIndexToDevice()
bool MetaStor::PersistIndexToDevice() {
    int ret = false;
    char *align_buf;
    uint64_t length = sbMgr_->GetIndexRegionLength();
    ret = posix_memalign((void **)&align_buf, 4096, length);
    if (ret < 0) {
        __ERROR("Can't allocate memory for Index, Persist Failed!");
        return false;
    }
    memset(align_buf, 0, length);

    if (!idxMgr_->Get(align_buf, length)) {
        __ERROR("Can't Get Index, Persist Failed!");
        free(align_buf);
        return false;
    }

    if ((uint64_t) metaDev_->pWrite(align_buf, length, idxOff_) != length) {
        __ERROR("Could not write Index at position %ld\n", idxOff_);
        free(align_buf);
        return false;
    }

    free(align_buf);

    idxMgr_->UpdateMetaToSB();
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq 0x10(%rax), %r14
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdx
callq 0x6200
testl %eax, %eax
js 0x16933
movq (%rsp), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x6260
movq 0x20(%rbx), %rdi
movq (%rsp), %rsi
movq %r14, %rdx
callq 0x112fc
testb %al, %al
je 0x1693a
movq (%rsp), %rsi
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rcx
movq (%rdi), %rax
movq %r14, %rdx
callq *0x48(%rax)
cmpq %r14, %rax
jne 0x16944
movq (%rsp), %rdi
callq 0x6490
movq 0x20(%rbx), %rdi
callq 0x112de
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x81c5
jmp 0x16953
movq %rsp, %rdi
callq 0x80dd
jmp 0x16953
addq $0x40, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x814a
xorl %eax, %eax
jmp 0x1692b
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::PersistSSTsToDevice()
bool MetaStor::PersistSSTsToDevice() {
    int ret = false;
    char *align_buf;
    uint64_t length = sbMgr_->GetSSTRegionLength();
    ret = posix_memalign((void **)&align_buf, 4096, length);
    if (ret < 0) {
        __ERROR("Can't allocate memory for SSTs, Persist Failed!");
        return false;
    }
    memset(align_buf, 0, length);

    if (!dataStor_->GetAllSSTs(align_buf, length)) {
        __ERROR("Can't Get SSTs, Persist Failed!");
        free(align_buf);
        return false;
    }

    if ((uint64_t) metaDev_->pWrite(align_buf, length, sstOff_) != length) {
        __ERROR("Could not write SSTs at position %ld\n", sstOff_);
        free(align_buf);
        return false;
    }

    free(align_buf);

    uint64_t reserved_region_length = SuperBlockManager::ReservedRegionLength();

    char *reserved_content = new char[reserved_region_length];
    if ( !dataStor_->GetSBReservedContent(reserved_content, reserved_region_length) ) {
        delete[] reserved_content;
        return false;
    }

    if ( !sbMgr_->SetReservedContent(reserved_content, reserved_region_length) ) {
        delete[] reserved_content;
        return false;
    }

    delete[] reserved_content;
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq 0x24(%rax), %r14
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdx
callq 0x6200
testl %eax, %eax
js 0x16a19
movq (%rsp), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x6260
movq 0x28(%rbx), %rdi
movq (%rsp), %rsi
movq (%rdi), %rax
movq %r14, %rdx
callq *0x70(%rax)
testb %al, %al
je 0x16a20
movq (%rsp), %rsi
movq 0x10(%rbx), %rdi
movq 0x48(%rbx), %rcx
movq (%rdi), %rax
movq %r14, %rdx
callq *0x48(%rax)
cmpq %r14, %rax
jne 0x16a2a
movq (%rsp), %rdi
callq 0x6490
movl $0xfc3, %edi            # imm = 0xFC3
callq 0x6040
movq %rax, %r14
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movl $0xfc3, %edx            # imm = 0xFC3
movq %r14, %rsi
callq *0x60(%rax)
testb %al, %al
je 0x16a05
movq 0x18(%rbx), %rdi
movl $0xfc3, %edx            # imm = 0xFC3
movq %r14, %rsi
callq 0x1e0fe
movl %eax, %ebx
movq %r14, %rdi
callq 0x64e0
jmp 0x16a0f
movq %r14, %rdi
callq 0x64e0
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x8310
jmp 0x16a0d
movq %rsp, %rdi
callq 0x8228
jmp 0x16a0d
addq $0x48, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x8295
jmp 0x16a0d
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/MetaStor.cc
// Function: hlkvds::MetaStor::persistSuperBlockToDevice()
bool MetaStor::persistSuperBlockToDevice() {
    int ret = false;
    char *align_buf;
    uint64_t length = SuperBlockManager::SuperBlockSizeOnDevice();
    ret = posix_memalign((void **)&align_buf, 4096, length);
    if (ret < 0) {
        __ERROR("Can't allocate memory for SuperBlock, Persist Failed!");
        return false;
    }
    memset(align_buf, 0, length);

    if (!sbMgr_->Get(align_buf, length)) {
        __ERROR("Can't Get SuperBlock, Persist Failed!");
        free(align_buf);
        return false;
    }

    if ((uint64_t) metaDev_->pWrite(align_buf, length, sbOff_) != length) {
        __ERROR("Could not write superblock at position %ld\n", sbOff_);
        free(align_buf);
        return false;
    }

    free(align_buf);
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movl $0x1000, %edx           # imm = 0x1000
callq 0x6200
testl %eax, %eax
js 0x16ab3
movq (%rsp), %r14
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
xorl %esi, %esi
callq 0x6260
movq 0x18(%rbx), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rsi
callq 0x1df70
testb %al, %al
je 0x16aba
movq (%rsp), %rsi
movq 0x10(%rbx), %rdi
movq 0x38(%rbx), %rcx
movq (%rdi), %rax
movl $0x1000, %edx           # imm = 0x1000
callq *0x48(%rax)
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x16ac4
movq (%rsp), %rdi
callq 0x6490
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x845b
jmp 0x16ad3
movq %rsp, %rdi
callq 0x8373
jmp 0x16ad3
addq $0x38, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x83e0
xorl %eax, %eax
jmp 0x16aab
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Migrate.cc
// Function: hlkvds::Migrate::ForeMigrate(unsigned int)
uint32_t Migrate::ForeMigrate(uint32_t mt_vol_id) {
    std::lock_guard <std::mutex> lck(mtx_);

    //Get the sorted Segments
    Volume *ft_vol = ft_->GetVolume();

    //check free segment;
    uint32_t free_seg_num = ft_vol->GetTotalFreeSegs();
    if (free_seg_num > SEG_RESERVED_FOR_GC) {
        __DEBUG("some thread already called Do Migrate, ignore this call!");
        return 0;
    }

    uint32_t max_seg_num = ft_vol->GetNumberOfSeg();
    free_seg_num = doMigrate(mt_vol_id, max_seg_num);
    return free_seg_num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x6590
testl %eax, %eax
jne 0x16b89
movq (%r14), %rax
movq 0x1d8(%rax), %r12
movq %r12, %rdi
callq 0x20d8a
xorl %r15d, %r15d
cmpl $0x2, %eax
ja 0x16b75
movl 0x3c(%r12), %edx
movq %r14, %rdi
movl %ebp, %esi
callq 0x16ba6
movl %eax, %r15d
movq %rbx, %rdi
callq 0x6360
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62c0
jmp 0x16b92
movq %rax, %r14
movq %rbx, %rdi
callq 0x6360
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/Migrate.cc
// Function: hlkvds::Migrate::loadKvList(unsigned int, std::__cxx11::list<hlkvds::KVSlice*, std::allocator<hlkvds::KVSlice*>>&)
bool Migrate::loadKvList(uint32_t seg_id, std::list<KVSlice*> &slice_list) {

    uint64_t seg_phy_off;

    Volume *ft_vol = ft_->GetVolume();
    ft_vol->CalcSegOffsetFromId(seg_id, seg_phy_off);

    memset(ftDataBuf_, 0 , ftSegSize_);
    if (!ft_vol->Read(ftDataBuf_, ftSegSize_, seg_phy_off)) {
        return false;
    }

    SegHeaderOnDisk seg_header;
    memcpy(&seg_header, ftDataBuf_, SegBase::SizeOfSegOnDisk());

    uint32_t num_keys = seg_header.number_keys;

    loadSegKV(slice_list, num_keys, seg_phy_off);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movq (%rdi), %rax
movq 0x1d8(%rax), %r12
cmpl %esi, 0x3c(%r12)
jbe 0x16fba
movl %esi, %r15d
movb 0x40(%r12), %cl
shlq %cl, %r15
movq 0x48(%r14), %rdi
movl 0x50(%r14), %edx
xorl %esi, %esi
callq 0x6260
movq 0x48(%r14), %rsi
movl 0x50(%r14), %edx
movq %r12, %rdi
movq %r15, %rcx
callq 0x20d00
movl %eax, %ebp
testb %al, %al
je 0x1701e
movq %rsp, %r12
movq %r12, %rdi
callq 0x1b714
movq 0x48(%r14), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0x10(%r12)
movaps %xmm0, (%r12)
movl 0x1c(%r12), %edx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x170a2
movq %rsp, %rdi
callq 0x1b720
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1b720
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/ReadCache.cc
// Function: dslab::ReadCache::Get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool ReadCache::Get(string key, string &value){
	ReadLock r_lock(myLock);
	map<string, string>::iterator it_dedup = dedup_map.find(key);
	if( it_dedup!=dedup_map.end() ){
		return cache_map->Get(it_dedup->second, value);
	}
	else{ 
		value = "";
		return false;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x70(%rdi), %rax
movq %rsp, %rdi
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
callq 0x1b4e2
leaq 0x8(%r14), %rdi
movq %r15, %rsi
callq 0x1afc0
leaq 0x10(%r14), %rcx
cmpq %rcx, %rax
je 0x17b70
movq (%r14), %r14
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xa64c
movq (%r14), %rax
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq *0x18(%rax)
movl %eax, %r14d
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x17b8b
callq 0x6400
jmp 0x17b8b
movq 0x8(%rbx), %rdx
xorl %r14d, %r14d
leaq 0xb06e(%rip), %rcx      # 0x22bec
movq %rbx, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x65e0
cmpb $0x1, 0x8(%rsp)
jne 0x17b9b
movq (%rsp), %rdi
callq 0x1b616
movl %r14d, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0xdf17
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x17bc7
callq 0x6400
jmp 0x17bc7
movq %rax, %rbx
movq %rsp, %rdi
callq 0x18038
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/src/ReadCache.cc
// Function: dslab::ReadCache::Delete(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void ReadCache::Delete(string key){
	WriteLock w_lock(myLock);
	map<string, string>::iterator it_dedup = dedup_map.find(key);
	if(it_dedup!=dedup_map.end()){
		multimap<string, string>::iterator it_refer = refer_map.find( it_dedup->second);	
		for(int i = 0; i < refer_map.count( it_dedup->second); i++){
			if(it_refer->second == key) {
				refer_map.erase(it_refer);
				break;
			}
		}
		if(refer_map.count(it_dedup->second)==0) cache_map->Delete(it_dedup->second);
		dedup_map.erase(it_dedup);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r12
movq %rdi, %r15
leaq 0x70(%rdi), %rax
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
callq 0x19e18
leaq 0x8(%r15), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1afc0
leaq 0x10(%r15), %rcx
cmpq %rcx, %rax
je 0x17ce8
movq %rbx, 0x10(%rsp)
leaq 0x38(%r15), %r13
movq %rax, 0x8(%rsp)
leaq 0x40(%rax), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1afc0
movq %rax, %rbx
xorl %r14d, %r14d
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1b04a
cmpq %r14, %rax
jbe 0x17c81
movq 0x48(%rbx), %rdx
cmpq 0x8(%r12), %rdx
jne 0x17c71
testq %rdx, %rdx
je 0x17c76
movq (%r12), %rsi
movq 0x40(%rbx), %rdi
callq 0x6430
testl %eax, %eax
je 0x17c76
incq %r14
jmp 0x17c40
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1b1ae
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1b04a
testq %rax, %rax
movq 0x8(%rsp), %r12
jne 0x17cdb
movq (%r15), %rbx
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x40(%r12), %rsi
movq 0x48(%r12), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0xa64c
movq (%rbx), %rax
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq *0x20(%rax)
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
movq 0x8(%rsp), %r12
je 0x17cdb
callq 0x6400
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x1b1ae
cmpb $0x1, 0x20(%rsp)
jne 0x17cf9
movq 0x18(%rsp), %rdi
callq 0x1ad4e
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x17d2b
callq 0x6400
jmp 0x17d2b
movq %rax, %rdi
callq 0xdf17
jmp 0x17d28
jmp 0x17d28
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1801e
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/./src/include/CacheMap.h
// Function: dslab::CacheMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::create(dslab::CachePolicy, unsigned long, unsigned long)
CacheMap<K, D> *CacheMap<K, D>::create(CachePolicy policy, size_t cache_size, size_t probation){
	if(policy == LRU){
		return new LRUMap<K, D> (cache_size);
	}else{
		size_t protect = cache_size-probation;
		return new SLRUMap<K, D> (protect, probation);
	} 
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
testl %edi, %edi
je 0x17f2d
movq %rdx, %r15
subq %rdx, %r14
movl $0xe8, %edi
callq 0x6420
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x18ac8
jmp 0x17f45
movl $0x70, %edi
callq 0x6420
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x18918
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
jmp 0x17f50
movq %rax, %r14
movq %rbx, %rdi
callq 0x6400
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/./src/include/LRUMap.h
// Function: dslab::LRUMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::LRUMap(unsigned long)
LRUMap(size_t size){
        if(size <= 0)
            size = 1024;

        entries = new Node<K,D>[size];
        for(size_t i = 0; i < size; ++i)
            free_entries.push_back(entries + i);

        head = new Node<K,D>;
        tail = new Node<K,D>;
        head->prev = NULL;
        head->next = tail;
        tail->prev = head;
        tail->next = NULL;

    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
testq %rsi, %rsi
movl $0x400, %r15d           # imm = 0x400
cmovneq %rsi, %r15
movl $0x50, %ecx
movq %r15, %rax
mulq %rcx
seto %cl
orq $0x8, %rax
leaq 0x1b03a(%rip), %rdx     # 0x33988
movq $-0x1, %rdi
testb %cl, %cl
cmoveq %rax, %rdi
addq $0x10, %rdx
movq %rdx, (%rbx)
leaq 0x38(%rbx), %rax
movq %rax, 0x8(%rbx)
movq $0x1, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movl $0x3f800000, 0x28(%rbx) # imm = 0x3F800000
leaq 0x40(%rbx), %r14
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x40(%rbx)
movq $0x0, 0x50(%rbx)
callq 0x6040
movq %r15, (%rax)
leaq 0x8(%rax), %rcx
addq $0x38, %rax
movq %r15, %rdx
shlq $0x4, %rdx
leaq (%rdx,%rdx,4), %rdx
xorl %esi, %esi
leaq -0x20(%rax), %rdi
movq %rdi, -0x30(%rax)
movq %rsi, -0x28(%rax)
movb %sil, -0x20(%rax)
movq %rax, -0x10(%rax)
movq %rsi, -0x8(%rax)
movb %sil, (%rax)
addq $0x50, %rax
addq $-0x50, %rdx
jne 0x189b1
movq %rcx, 0x68(%rbx)
cmpq $0x1, %r15
adcq $0x0, %r15
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
movq 0x68(%rbx), %rax
addq %r13, %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0x18a0a
movq %rax, (%rsi)
addq $0x8, 0x48(%rbx)
jmp 0x18a15
movq %r14, %rdi
movq %r12, %rdx
callq 0x18efa
addq $0x50, %r13
decq %r15
jne 0x189ea
movl $0x50, %edi
callq 0x6420
movq %rax, %r15
addq $0x10, %rax
movq %rax, (%r15)
xorl %eax, %eax
movq %rax, 0x8(%r15)
movb %al, 0x10(%r15)
movq %r15, %rcx
addq $0x30, %rcx
movq %rcx, 0x20(%r15)
movq %rax, 0x28(%r15)
movb %al, 0x30(%r15)
movq %r15, 0x58(%rbx)
movl $0x50, %edi
callq 0x6420
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movb %cl, 0x10(%rax)
movq %rax, %rdx
addq $0x30, %rdx
movq %rdx, 0x20(%rax)
movq %rcx, 0x28(%rax)
movb %cl, 0x30(%rax)
movq %rax, 0x60(%rbx)
movq %rcx, 0x40(%r15)
movq %rax, 0x48(%r15)
movq %r15, 0x40(%rax)
movq %rcx, 0x48(%rax)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x18aa3
movq %rax, %r15
addq $0x8, %rbx
movq (%r14), %rdi
testq %rdi, %rdi
je 0x18ab7
callq 0x6400
movq %rbx, %rdi
callq 0x19030
movq %r15, %rdi
callq 0x6680
nop