LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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 0x13f77
cmpb $0x0, (%rdx)
je 0x13f77
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 0x1b8ca
movq 0x48(%r14), %rsi
movq (%rsi), %rax
movzbl %bpl, %ecx
movq %rbx, %rdi
movq %r15, %rdx
callq *0x40(%rax)
cmpl $0x0, (%rbx)
je 0x13f9c
leaq 0x48(%rsp), %rdi
callq 0x1b7ac
jmp 0x13f8b
leaq 0xef98(%rip), %rdx      # 0x22f16
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1de28
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x50(%r14)
jne 0x13f6b
cmpw $0x0, 0x60(%rsp)
jne 0x13f6b
movq 0x38(%r14), %r14
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1ba98
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1baba
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x17514
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13ff2
callq 0x63f0
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13f6b
callq 0x63f0
jmp 0x13f6b
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14029
callq 0x63f0
jmp 0x14029
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14043
callq 0x63f0
jmp 0x14043
jmp 0x14040
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x1b7ac
movq %rbx, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x143ad
movq %rdx, %r14
movq %rsi, (%rsp)
movq 0x48(%rsi), %rsi
movq (%rsi), %rax
movq %rbx, %rdi
callq *0x48(%rax)
cmpl $0x0, (%rbx)
jne 0x143bb
movq (%rsp), %rax
cmpb $0x0, 0x50(%rax)
jne 0x143bb
movq (%r14), %r12
cmpq %r14, %r12
je 0x143bb
leaq 0x28(%rsp), %r13
leaq 0x8(%rsp), %r15
movq 0x10(%r12), %rsi
cmpw $0x0, 0x18(%rsi)
jne 0x143a2
movq (%rsp), %rax
movq 0x38(%rax), %rbp
movq %r13, %rdi
callq 0x1ba98
movq 0x10(%r12), %rsi
movq %r15, %rdi
callq 0x1baba
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x17514
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1438e
callq 0x63f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x143a2
callq 0x63f0
movq (%r12), %r12
cmpq %r14, %r12
jne 0x14343
jmp 0x143bb
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 0x143e9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x143e9
callq 0x63f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x143fd
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1631c
movl %eax, %ebp
testb %al, %al
je 0x16315
movq 0x18(%r14), %rax
movl 0x2c(%rax), %eax
movl %eax, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x79f9
jmp 0x1630e
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6250
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 0x16384
movq 0x18(%r14), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
callq 0x1dfd0
movb $0x1, %bpl
testb %al, %al
je 0x16392
movq %rbx, %rdi
callq 0x64d0
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
addq $0x38, %r14
movq %r14, %rdi
callq 0x7a59
jmp 0x16397
callq 0x7ab1
movq 0x1dc3a(%rip), %rax     # 0x33fd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x64c0
xorl %ebp, %ebp
jmp 0x16375
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6250
movq 0x18(%r14), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
callq 0x1dfd0
movl %eax, %ebp
testb %al, %al
je 0x16597
movq %rbx, %rdi
callq 0x64d0
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x7c28
jmp 0x16588
// File: /workspace/github_cpp_makefile_star2_O3/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 0x11332
movq %r14, %rdi
callq 0x6040
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x6250
movq 0x20(%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11566
movl %eax, %ebp
testb %al, %al
je 0x165fb
movq %rbx, %rdi
callq 0x64d0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x7c8a
jmp 0x165e6
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1666b
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 0x6250
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %r15, %rdx
callq *0x78(%rax)
movq %r14, %rdi
testb %al, %al
je 0x16672
callq 0x64d0
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
callq 0x7cec
jmp 0x16677
callq 0x7d4e
xorl %eax, %eax
jmp 0x16665
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq %rsi, %rax
shlq $0x34, %rax
je 0x16688
xorl %eax, %eax
retq
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
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 0x16727
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x6250
testq %rbx, %rbx
je 0x1670d
xorl %r12d, %r12d
cmpq %r15, %rbx
movq %r15, %r13
cmovbq %rbx, %r13
movq 0x10(%r14), %rdi
movq 0x8(%rsp), %rsi
movq (%rdi), %rax
movq %r13, %rdx
movq %r12, %rcx
callq *0x48(%rax)
testq %rax, %rax
je 0x1672e
addq %r13, %r12
subq %r13, %rbx
jne 0x166e1
movq 0x8(%rsp), %rdi
callq 0x6480
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x7e35
jmp 0x16738
leaq 0x8(%rsp), %rdi
callq 0x7dba
xorl %eax, %eax
jmp 0x16719
// File: /workspace/github_cpp_makefile_star2_O3/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 0x167ac
testb %al, %al
je 0x16787
addq 0x40(%rbx), %r14
movq %r14, 0x48(%rbx)
movq %rbx, %rdi
callq 0x16856
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
je 0x1678e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x7e98
jmp 0x16793
callq 0x7eef
movq 0x1d83e(%rip), %rax     # 0x33fd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x64c0
xorl %eax, %eax
jmp 0x1677f
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x11332
movq %r14, %rdi
callq 0x6040
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x6250
movq 0x10(%r15), %rdi
movq 0x40(%r15), %rcx
movq (%rdi), %rax
movq %rbx, %rsi
movq %r14, %rdx
callq *0x50(%rax)
cmpq %r14, %rax
jne 0x1682a
movq 0x20(%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11566
movb $0x1, %bpl
testb %al, %al
je 0x16838
movq %rbx, %rdi
callq 0x64d0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
addq $0x40, %r15
movq %r15, %rdi
callq 0x7f46
jmp 0x1683d
callq 0x7f9e
movq 0x1d794(%rip), %rax     # 0x33fd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x64c0
xorl %ebp, %ebp
jmp 0x16815
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1e170
testb %al, %al
je 0x16919
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 0x64d0
testb %bpl, %bpl
je 0x16921
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x1692e
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 0x6250
movq 0x10(%rbx), %rdi
movq 0x48(%rbx), %rcx
movq (%rdi), %rax
movq %r14, %rsi
movq %r15, %rdx
callq *0x50(%rax)
cmpq %r15, %rax
jne 0x16935
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %r15, %rdx
callq *0x78(%rax)
movq %r14, %rdi
testb %al, %al
je 0x16942
callq 0x64d0
movb $0x1, %al
jmp 0x16923
movq %r14, %rdi
callq 0x64d0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x7ff5
jmp 0x16921
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8057
jmp 0x16921
callq 0x80d2
jmp 0x16921
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x169a0
testb %al, %al
je 0x16975
movq %rbx, %rdi
callq 0x16a40
testb %al, %al
je 0x1697c
movq %rbx, %rdi
callq 0x16b24
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
je 0x16983
popq %rbx
retq
callq 0x813e
jmp 0x16988
callq 0x8195
jmp 0x16988
callq 0x81ec
movq 0x1d649(%rip), %rax     # 0x33fd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x64c0
xorl %eax, %eax
jmp 0x16973
// File: /workspace/github_cpp_makefile_star2_O3/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 0x16a1b
movq (%rsp), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x6250
movq 0x20(%rbx), %rdi
movq (%rsp), %rsi
movq %r14, %rdx
callq 0x11430
testb %al, %al
je 0x16a22
movq (%rsp), %rsi
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rcx
movq (%rdi), %rax
movq %r14, %rdx
callq *0x48(%rax)
cmpq %r14, %rax
jne 0x16a2c
movq (%rsp), %rdi
callq 0x6480
movq 0x20(%rbx), %rdi
callq 0x11412
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x832b
jmp 0x16a3b
movq %rsp, %rdi
callq 0x8243
jmp 0x16a3b
addq $0x40, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x82b0
xorl %eax, %eax
jmp 0x16a13
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x16b01
movq (%rsp), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x6250
movq 0x28(%rbx), %rdi
movq (%rsp), %rsi
movq (%rdi), %rax
movq %r14, %rdx
callq *0x70(%rax)
testb %al, %al
je 0x16b08
movq (%rsp), %rsi
movq 0x10(%rbx), %rdi
movq 0x48(%rbx), %rcx
movq (%rdi), %rax
movq %r14, %rdx
callq *0x48(%rax)
cmpq %r14, %rax
jne 0x16b12
movq (%rsp), %rdi
callq 0x6480
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 0x16aed
movq 0x18(%rbx), %rdi
movl $0xfc3, %edx            # imm = 0xFC3
movq %r14, %rsi
callq 0x1e10e
movl %eax, %ebx
movq %r14, %rdi
callq 0x64d0
jmp 0x16af7
movq %r14, %rdi
callq 0x64d0
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x8476
jmp 0x16af5
movq %rsp, %rdi
callq 0x838e
jmp 0x16af5
addq $0x48, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x83fb
jmp 0x16af5
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x16b9b
movq (%rsp), %r14
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
xorl %esi, %esi
callq 0x6250
movq 0x18(%rbx), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rsi
callq 0x1df80
testb %al, %al
je 0x16ba2
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 0x16bac
movq (%rsp), %rdi
callq 0x6480
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x85c1
jmp 0x16bbb
movq %rsp, %rdi
callq 0x84d9
jmp 0x16bbb
addq $0x38, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x8546
xorl %eax, %eax
jmp 0x16b93
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6580
testl %eax, %eax
jne 0x16c71
movq (%r14), %rax
movq 0x1d8(%rax), %r12
movq %r12, %rdi
callq 0x20d3a
xorl %r15d, %r15d
cmpl $0x2, %eax
ja 0x16c5d
movl 0x3c(%r12), %edx
movq %r14, %rdi
movl %ebp, %esi
callq 0x16c8e
movl %eax, %r15d
movq %rbx, %rdi
callq 0x6350
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x62b0
jmp 0x16c7a
movq %rax, %r14
movq %rbx, %rdi
callq 0x6350
movq %r14, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x170ac
movl %esi, %r15d
movb 0x40(%r12), %cl
shlq %cl, %r15
movq 0x48(%r14), %rdi
movl 0x50(%r14), %edx
xorl %esi, %esi
callq 0x6250
movq 0x48(%r14), %rsi
movl 0x50(%r14), %edx
movq %r12, %rdi
movq %r15, %rcx
callq 0x20cb0
movl %eax, %ebp
testb %al, %al
je 0x17110
movq %rsp, %r12
movq %r12, %rdi
callq 0x1b740
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 0x17194
movq %rsp, %rdi
callq 0x1b74c
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1b74c
movq %rbx, %rdi
callq 0x6670
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1b510
leaq 0x8(%r14), %rdi
movq %r15, %rsi
callq 0x1afe0
leaq 0x10(%r14), %rcx
cmpq %rcx, %rax
je 0x17c62
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 0xa7cc
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 0x17c7d
callq 0x63f0
jmp 0x17c7d
movq 0x8(%rbx), %rdx
xorl %r14d, %r14d
leaq 0xaf7c(%rip), %rcx      # 0x22bec
movq %rbx, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x65d0
cmpb $0x1, 0x8(%rsp)
jne 0x17c8d
movq (%rsp), %rdi
callq 0x1b644
movl %r14d, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0xe09d
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x17cb9
callq 0x63f0
jmp 0x17cb9
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1812a
movq %rbx, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x19e42
leaq 0x8(%r15), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1afe0
leaq 0x10(%r15), %rcx
cmpq %rcx, %rax
je 0x17dda
movq %rbx, 0x10(%rsp)
leaq 0x38(%r15), %r13
movq %rax, 0x8(%rsp)
leaq 0x40(%rax), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1afe0
movq %rax, %rbx
xorl %r14d, %r14d
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1b06a
cmpq %r14, %rax
jbe 0x17d73
movq 0x48(%rbx), %rdx
cmpq 0x8(%r12), %rdx
jne 0x17d63
testq %rdx, %rdx
je 0x17d68
movq (%r12), %rsi
movq 0x40(%rbx), %rdi
callq 0x6420
testl %eax, %eax
je 0x17d68
incq %r14
jmp 0x17d32
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1b1da
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1b06a
testq %rax, %rax
movq 0x8(%rsp), %r12
jne 0x17dcd
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 0xa7cc
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 0x17dcd
callq 0x63f0
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x1b1da
cmpb $0x1, 0x20(%rsp)
jne 0x17deb
movq 0x18(%rsp), %rdi
callq 0x1ad6e
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 0x17e1d
callq 0x63f0
jmp 0x17e1d
movq %rax, %rdi
callq 0xe09d
jmp 0x17e1a
jmp 0x17e1a
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x18110
movq %rbx, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1801f
movq %rdx, %r15
subq %rdx, %r14
movl $0xe8, %edi
callq 0x6410
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x18b2a
jmp 0x18037
movl $0x70, %edi
callq 0x6410
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1897a
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
jmp 0x18042
movq %rax, %r14
movq %rbx, %rdi
callq 0x63f0
movq %r14, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1afd8(%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 0x18a13
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 0x18a6c
movq %rax, (%rsi)
addq $0x8, 0x48(%rbx)
jmp 0x18a77
movq %r14, %rdi
movq %r12, %rdx
callq 0x18f4e
addq $0x50, %r13
decq %r15
jne 0x18a4c
movl $0x50, %edi
callq 0x6410
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 0x6410
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 0x18b05
movq %rax, %r15
addq $0x8, %rbx
movq (%r14), %rdi
testq %rdi, %rdi
je 0x18b19
callq 0x63f0
movq %rbx, %rdi
callq 0x19084
movq %r15, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/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>>>::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 LRUMap<K,D>::Get(K key, D& data){
    Node<K,D> *node = cached_map[key];
    if(node){
        detach(node);
        attach(node);
        data = node->data;
	return true;
    }
    else{
        data = D();
	return false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r14
addq $0x8, %rdi
callq 0x1911a
movq (%rax), %r15
testq %r15, %r15
je 0x18e8a
movq 0x40(%r15), %rax
movq 0x48(%r15), %rcx
movq %rcx, 0x48(%rax)
movq %rax, 0x40(%rcx)
movq 0x58(%r14), %rax
movq %rax, 0x40(%r15)
movq 0x48(%rax), %rcx
movq %rcx, 0x48(%r15)
movq %r15, 0x48(%rax)
movq 0x48(%r15), %rax
movq %r15, 0x40(%rax)
leaq 0x20(%r15), %rsi
movq %rbx, %rdi
callq 0x6240
jmp 0x18ebf
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x64a0
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x18ebf
callq 0x63f0
testq %r15, %r15
setne %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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>>>::Delete(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool LRUMap<K,D>::Delete(K key){
    Node<K,D> *node = cached_map[key];
    if(node){
        detach(node);
	free_entries.push_back(node);
	cached_map.erase(node->key);
	return true;
    }
    else{
	return false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x8(%rdi), %rbx
movq %rbx, %rdi
callq 0x1911a
movq (%rax), %r12
movq %r12, (%rsp)
testq %r12, %r12
je 0x18f3b
movq 0x40(%r12), %rax
movq 0x48(%r12), %rcx
movq %rcx, 0x48(%rax)
movq %rax, 0x40(%rcx)
movq 0x48(%r14), %rsi
cmpq 0x50(%r14), %rsi
je 0x18f1e
movq %r12, (%rsi)
addq $0x8, 0x48(%r14)
movq %r12, %rsi
jmp 0x18f33
addq $0x40, %r14
movq %rsp, %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x19642
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x1954a
testq %r12, %r12
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::KVSlice::~KVSlice()
KVSlice::~KVSlice() {
    if (deepCopy_) {
        delete[] key_;
        delete[] data_;
    }
    if (digest_) {
        delete digest_;
    }
    if (entry_) {
        delete entry_;
    }
    if (entryGC_) {
        delete entryGC_;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x34(%rdi)
jne 0x1b7d4
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1b7c6
callq 0x64d0
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x1b7d4
callq 0x64d0
movq 0x20(%rbx), %r14
testq %r14, %r14
je 0x1b7ed
movq %r14, %rdi
callq 0x12d00
movq %r14, %rdi
callq 0x63f0
movq 0x28(%rbx), %r14
testq %r14, %r14
je 0x1b806
movq %r14, %rdi
callq 0x1119a
movq %r14, %rdi
callq 0x63f0
movq 0x38(%rbx), %rbx
testq %rbx, %rbx
je 0x1b826
movq %rbx, %rdi
callq 0x1119a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x63f0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::KVSlice::calcDigest()
void KVSlice::calcDigest() {
    if (digest_) {
        delete digest_;
        digest_=nullptr;
    }
    digest_ = new Kvdb_Digest();
    Kvdb_Key vkey(key_, keyLength_);
    KeyDigestHandle::CalcDigest(&vkey, *digest_);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %r14
testq %r14, %r14
je 0x1b9b3
movq %r14, %rdi
callq 0x12d00
movq %r14, %rdi
callq 0x63f0
movq $0x0, 0x20(%rbx)
movl $0x14, %edi
callq 0x6410
movq %rax, %r14
movq %rax, %rdi
callq 0x12ce4
movq %r14, 0x20(%rbx)
movq (%rbx), %rsi
movl 0x8(%rbx), %edx
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x12cce
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x12d50
leaq 0xc(%rsp), %rdi
callq 0x12ccc
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0xc(%rsp), %rdi
callq 0x12ccc
jmp 0x1ba17
movq %rax, %rbx
movq %r14, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6670
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::copyHelper(hlkvds::SegBase const&)
void SegBase::copyHelper(const SegBase& toBeCopied) {
    segId_ = toBeCopied.segId_;
    vol_ = toBeCopied.vol_;
    segSize_ = toBeCopied.segSize_;
    headPos_ = toBeCopied.headPos_;
    tailPos_ = toBeCopied.tailPos_;
    keyNum_ = toBeCopied.keyNum_;
    keyAlignedNum_ = toBeCopied.keyAlignedNum_;
    memcpy(dataBuf_, toBeCopied.dataBuf_, segSize_);
    sliceList_ = toBeCopied.sliceList_;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %eax
movl %eax, (%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
movslq 0x10(%rsi), %rdx
movups 0x10(%rsi), %xmm0
movups %xmm0, 0x10(%rdi)
movl 0x20(%rsi), %eax
movl %eax, 0x20(%rdi)
movq 0x40(%rdi), %rdi
movq 0x40(%rsi), %rsi
callq 0x6380
cmpq %rbx, %r14
je 0x1be10
addq $0x28, %r14
movq 0x28(%rbx), %rsi
addq $0x28, %rbx
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1cfd4
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::Put(hlkvds::KVSlice*)
void SegBase::Put(KVSlice* slice) {
    if (slice->IsAlignedData()) {
        headPos_ += IndexManager::SizeOfDataHeader() + slice->GetKeyLen();
        tailPos_ -= ALIGNED_SIZE;
        keyAlignedNum_++;
    } else {
        headPos_ += IndexManager::SizeOfDataHeader() + slice->GetKeyLen() + slice->GetDataLen();
    }
    keyNum_++;
    sliceList_.push_back(slice);
    __DEBUG("Put request key = %s", slice->GetKeyStr().c_str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movzwl 0x18(%rsi), %ecx
movzwl 0x8(%rsi), %edx
movl 0x14(%rdi), %eax
cmpl $0x1000, %ecx           # imm = 0x1000
jne 0x1bea8
addl %edx, %eax
addl $0x20, %eax
movl %eax, 0x14(%rbx)
addl $0xfffff000, 0x18(%rbx) # imm = 0xFFFFF000
incl 0x20(%rbx)
jmp 0x1beb2
addl %edx, %ecx
addl %ecx, %eax
addl $0x20, %eax
movl %eax, 0x14(%rbx)
incl 0x1c(%rbx)
leaq 0x28(%rbx), %r15
movl $0x18, %edi
callq 0x6410
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x6080
incq 0x38(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::TryPutList(std::__cxx11::list<hlkvds::KVSlice*, std::allocator<hlkvds::KVSlice*>>&)
bool SegBase::TryPutList(std::list<KVSlice*> &slice_list) {
    uint32_t freeSize = tailPos_ - headPos_;
    uint32_t needSize = 0;
    for (list<KVSlice *>::iterator iter = slice_list.begin(); iter != slice_list.end(); iter++) {
        KVSlice *slice = *iter;
        needSize += slice->GetDataLen() + slice->GetKeyLen() + IndexManager::SizeOfDataHeader();
    }
    return freeSize > needSize;

}

// Assembly:
movl 0x14(%rdi), %eax
movl 0x18(%rdi), %ecx
movq (%rsi), %rdi
xorl %edx, %edx
cmpq %rsi, %rdi
je 0x1bf0c
movq 0x10(%rdi), %r8
movq (%rdi), %r9
movzwl 0x18(%r8), %edi
addl %edx, %edi
movzwl 0x8(%r8), %edx
addl %edi, %edx
addl $0x20, %edx
movq %r9, %rdi
cmpq %rsi, %r9
jne 0x1beec
subl %eax, %ecx
cmpl %edx, %ecx
seta %al
retq
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::WriteSegToDevice()
bool SegBase::WriteSegToDevice() {
    if (segId_ < 0)
    {
        __ERROR("Not set seg_id to segment");
        return false;
    }
    fillEntryToSlice();
    __DEBUG("Begin write seg, free size %u, seg id: %d, key num: %d", tailPos_-headPos_ , segId_, keyNum_);
    return _writeDataToDevice();
}

// Assembly:
pushq %rbx
cmpl $0x0, (%rdi)
js 0x1bf59
movq %rdi, %rbx
callq 0x1bf62
movq %rbx, %rdi
popq %rbx
jmp 0x1c162
callq 0x8768
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegBase::_writeDataToDevice()
bool SegBase::_writeDataToDevice() {
    posix_memalign((void **)&dataBuf_, 4096, segSize_);

    copyToDataBuf();
    uint64_t offset = 0;
    vol_->CalcSegOffsetFromId(segId_, offset);

    bool ret = vol_->Write(dataBuf_, segSize_, offset);

    free(dataBuf_);
    dataBuf_ = NULL;

    return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x40, %rdi
movslq 0x10(%rbx), %rdx
movl $0x1000, %esi           # imm = 0x1000
callq 0x6200
movq %rbx, %rdi
callq 0x1c1c4
movq 0x8(%rbx), %rdi
movl (%rbx), %eax
cmpl %eax, 0x3c(%rdi)
jbe 0x1c195
movb 0x40(%rdi), %cl
shlq %cl, %rax
jmp 0x1c197
xorl %eax, %eax
movq 0x40(%rbx), %rsi
movslq 0x10(%rbx), %rdx
movq %rax, %rcx
callq 0x20ce2
movl %eax, %ebp
movq 0x40(%rbx), %rdi
callq 0x6480
movq $0x0, 0x40(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::operator=(hlkvds::SegForReq const&)
SegForReq& SegForReq::operator=(const SegForReq& toBeCopied) {
    if (this == &toBeCopied) {
        return *this;
    }

    SegBase::operator=(toBeCopied);
    idxMgr_ = toBeCopied.idxMgr_;
    timeout_ = toBeCopied.timeout_;
    startTime_ = toBeCopied.startTime_;
    persistTime_ = toBeCopied.persistTime_;
    isCompletion_ = toBeCopied.isCompletion_;
    hasReq_ = toBeCopied.hasReq_;
    reqCommited_.store(toBeCopied.reqCommited_.load());
    reqList_ = toBeCopied.reqList_;
    delReqList_ = toBeCopied.delReqList_;
    return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x1c583
movq %rsi, %r14
movq %rbx, %rdi
callq 0x1bdb8
movq 0x48(%r14), %rax
movq %rax, 0x48(%rbx)
movl 0x50(%r14), %eax
movl %eax, 0x50(%rbx)
leaq 0x58(%r14), %rsi
leaq 0x58(%rbx), %rdi
callq 0x209bc
leaq 0x68(%r14), %rsi
leaq 0x68(%rbx), %rdi
callq 0x209bc
movb 0x78(%r14), %al
movb %al, 0x78(%rbx)
movb 0x79(%r14), %al
movb %al, 0x79(%rbx)
movl 0x7c(%r14), %eax
xchgl %eax, 0x7c(%rbx)
movl $0x80, %edi
leaq (%r14,%rdi), %rdx
addq %rbx, %rdi
movq 0x80(%r14), %rsi
callq 0x1d178
movl $0xc0, %edi
leaq (%r14,%rdi), %rdx
addq %rbx, %rdi
movq 0xc0(%r14), %rsi
callq 0x1d31c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::TryPut(hlkvds::Request*)
bool SegForReq::TryPut(Request* req) {
    if (isCompletion_) {
        return false;
    }
    KVSlice *slice= &req->GetSlice();
    return SegBase::TryPut(slice);
}

// Assembly:
cmpb $0x0, 0x78(%rdi)
je 0x1c681
xorl %eax, %eax
retq
movq 0x8(%rsi), %rax
movl 0x18(%rdi), %ecx
subl 0x14(%rdi), %ecx
movzwl 0x18(%rax), %edx
movzwl 0x8(%rax), %eax
addl %edx, %eax
addl $0x20, %eax
cmpl %eax, %ecx
seta %al
retq
// File: /workspace/github_cpp_makefile_star2_O3/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::Put(hlkvds::Request*)
void SegForReq::Put(Request* req) {
    KVSlice *slice = &req->GetSlice();
    if (GetKeyNum() == 0) {
        hasReq_ = true;
        startTime_.Update();
    }
    SegBase::Put(slice);
    reqList_.push_back(req);
    req->SetSeg(this);
    __DEBUG("Put request key = %s", req->GetSlice().GetKeyStr().c_str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %r15
cmpl $0x0, 0x1c(%rdi)
jne 0x1c6c1
movb $0x1, 0x79(%r14)
leaq 0x58(%r14), %rdi
callq 0x209a4
movq %r14, %rdi
movq %r15, %rsi
callq 0x1be76
leaq 0x80(%r14), %r15
movl $0x18, %edi
callq 0x6410
movq %rbx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x6080
incq 0x90(%r14)
movq %r14, 0x68(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop