LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
movq %rdx, %r15
movq %rdi, %r14
movq 0x18(%rdi), %rax
movq 0x20(%rdi), %rdi
movq 0x34(%rax), %rcx
movl 0x30(%rax), %r8d
callq 0xe80c
movq %r15, %rdi
callq 0x6040
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x6250
movq 0x10(%r14), %rdi
movq 0x40(%r14), %rcx
movq (%rdi), %rax
movq %rbx, %rsi
movq %r15, %rdx
callq *0x50(%rax)
cmpq %r15, %rax
jne 0x13adf
movq 0x20(%r14), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xe9c6
movb $0x1, %bpl
testb %al, %al
je 0x13b2f
movq %rbx, %rdi
callq 0x64c0
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x1e4f2(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0xb7af(%rip), %rsi      # 0x1f2a5
leaq 0xc81b(%rip), %rcx      # 0x20318
leaq 0xc53f(%rip), %r8       # 0x20043
movq %r15, %rdi
movq %rax, %rdx
movl $0x134, %r9d            # imm = 0x134
xorl %eax, %eax
callq 0x6580
movq (%r12), %rdi
movq 0x40(%r14), %rdx
leaq 0xc7fc(%rip), %rsi      # 0x20322
xorl %eax, %eax
callq 0x6580
jmp 0x13b7b
movq 0x1e4a2(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0xb760(%rip), %rsi      # 0x1f2a5
leaq 0xc7cc(%rip), %rcx      # 0x20318
leaq 0xc4f0(%rip), %r8       # 0x20043
movq %r14, %rdi
movq %rax, %rdx
movl $0x13a, %r9d            # imm = 0x13A
xorl %eax, %eax
callq 0x6580
movq (%r15), %rcx
leaq 0xc783(%rip), %rdi      # 0x202f3
pushq $0x24
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq 0x1e456(%rip), %rax     # 0x31fd8
movq (%rax), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
xorl %ebp, %ebp
jmp 0x13acc
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x13ebc
testb %al, %al
je 0x13dca
movq %rbx, %rdi
callq 0x14062
testb %al, %al
je 0x13e12
movq %rbx, %rdi
callq 0x14252
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
je 0x13e57
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x1e207(%rip), %r14     # 0x31fd8
movq (%r14), %rbx
callq 0x63c0
leaq 0xbd54(%rip), %rsi      # 0x1fb34
leaq 0xc39f(%rip), %rcx      # 0x20186
leaq 0xc255(%rip), %r8       # 0x20043
movq %rbx, %rdi
movq %rax, %rdx
movl $0xcb, %r9d
xorl %eax, %eax
callq 0x6580
movq (%r14), %rcx
leaq 0xc38b(%rip), %rdi      # 0x20196
pushq $0x15
jmp 0x13e9a
movq 0x1e1bf(%rip), %r14     # 0x31fd8
movq (%r14), %rbx
callq 0x63c0
leaq 0xbd0c(%rip), %rsi      # 0x1fb34
leaq 0xc357(%rip), %rcx      # 0x20186
leaq 0xc20d(%rip), %r8       # 0x20043
movq %rbx, %rdi
movq %rax, %rdx
movl $0xd0, %r9d
xorl %eax, %eax
callq 0x6580
movq (%r14), %rcx
leaq 0xc359(%rip), %rdi      # 0x201ac
pushq $0x14
jmp 0x13e9a
movq 0x1e17a(%rip), %r14     # 0x31fd8
movq (%r14), %rbx
callq 0x63c0
leaq 0xbcc7(%rip), %rsi      # 0x1fb34
leaq 0xc312(%rip), %rcx      # 0x20186
leaq 0xc1c8(%rip), %r8       # 0x20043
movq %rbx, %rdi
movq %rax, %rdx
movl $0xd5, %r9d
xorl %eax, %eax
callq 0x6580
movq (%r14), %rcx
leaq 0xc329(%rip), %rdi      # 0x201c1
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq 0x1e12e(%rip), %rax     # 0x31fd8
movq (%rax), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
xorl %eax, %eax
jmp 0x13dc2
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rax
movq 0x10(%rax), %rbx
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdx
callq 0x6200
testl %eax, %eax
js 0x13f49
movq (%rsp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x6250
movq 0x20(%r14), %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0xe8e2
testb %al, %al
je 0x13fa4
movq (%rsp), %rsi
movq 0x10(%r14), %rdi
movq 0x40(%r14), %rcx
movq (%rdi), %rax
movq %rbx, %rdx
callq *0x48(%rax)
cmpq %rbx, %rax
jne 0x13ff7
movq (%rsp), %rdi
callq 0x6470
movq 0x20(%r14), %rdi
callq 0xe8c4
movb $0x1, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x1e088(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0xb346(%rip), %rsi      # 0x1f2a5
leaq 0xc3ec(%rip), %rcx      # 0x20352
leaq 0xc0d6(%rip), %r8       # 0x20043
xorl %ebx, %ebx
movq %r14, %rdi
movq %rax, %rdx
movl $0x149, %r9d            # imm = 0x149
xorl %eax, %eax
callq 0x6580
movq (%r15), %rcx
leaq 0xc3db(%rip), %rdi      # 0x20367
pushq $0x30
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
jmp 0x13f3b
movq 0x1e02d(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0xb2eb(%rip), %rsi      # 0x1f2a5
leaq 0xc391(%rip), %rcx      # 0x20352
leaq 0xc07b(%rip), %r8       # 0x20043
xorl %ebx, %ebx
movq %r14, %rdi
movq %rax, %rdx
movl $0x14f, %r9d            # imm = 0x14F
xorl %eax, %eax
callq 0x6580
movq (%r15), %rcx
leaq 0xc3b1(%rip), %rdi      # 0x20398
pushq $0x20
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r15), %rsi
jmp 0x1404b
movq 0x1dfda(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0xb297(%rip), %rsi      # 0x1f2a5
leaq 0xc33d(%rip), %rcx      # 0x20352
leaq 0xc027(%rip), %r8       # 0x20043
xorl %ebx, %ebx
movq %r15, %rdi
movq %rax, %rdx
movl $0x155, %r9d            # imm = 0x155
xorl %eax, %eax
callq 0x6580
movq (%r12), %rdi
movq 0x40(%r14), %rdx
leaq 0xc379(%rip), %rsi      # 0x203b9
xorl %eax, %eax
callq 0x6580
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq (%rsp), %rdi
callq 0x6470
jmp 0x13f3b
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movl $0x1000, %edx           # imm = 0x1000
callq 0x6200
testl %eax, %eax
js 0x142db
movq (%rsp), %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6250
movq 0x18(%r14), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
callq 0x1ab9c
testb %al, %al
je 0x14336
movq (%rsp), %rsi
movq 0x10(%r14), %rdi
movq 0x38(%r14), %rcx
movq (%rdi), %rax
movl $0x1000, %edx           # imm = 0x1000
callq *0x48(%rax)
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x14389
movq (%rsp), %rdi
callq 0x6470
movb $0x1, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x1dcf6(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0xafb4(%rip), %rsi      # 0x1f2a5
leaq 0xbf4d(%rip), %rcx      # 0x20245
leaq 0xbd44(%rip), %r8       # 0x20043
xorl %ebx, %ebx
movq %r14, %rdi
movq %rax, %rdx
movl $0x106, %r9d            # imm = 0x106
xorl %eax, %eax
callq 0x6580
movq (%r15), %rcx
leaq 0xbf41(%rip), %rdi      # 0x2025f
pushq $0x35
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
jmp 0x142cd
movq 0x1dc9b(%rip), %r15     # 0x31fd8
movq (%r15), %r14
callq 0x63c0
leaq 0xaf59(%rip), %rsi      # 0x1f2a5
leaq 0xbef2(%rip), %rcx      # 0x20245
leaq 0xbce9(%rip), %r8       # 0x20043
xorl %ebx, %ebx
movq %r14, %rdi
movq %rax, %rdx
movl $0x10c, %r9d            # imm = 0x10C
xorl %eax, %eax
callq 0x6580
movq (%r15), %rcx
leaq 0xbf1c(%rip), %rdi      # 0x20295
pushq $0x25
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r15), %rsi
jmp 0x143dd
movq 0x1dc48(%rip), %r12     # 0x31fd8
movq (%r12), %r15
callq 0x63c0
leaq 0xaf05(%rip), %rsi      # 0x1f2a5
leaq 0xbe9e(%rip), %rcx      # 0x20245
leaq 0xbc95(%rip), %r8       # 0x20043
xorl %ebx, %ebx
movq %r15, %rdi
movq %rax, %rdx
movl $0x112, %r9d            # imm = 0x112
xorl %eax, %eax
callq 0x6580
movq (%r12), %rdi
movq 0x38(%r14), %rdx
leaq 0xbee9(%rip), %rsi      # 0x202bb
xorl %eax, %eax
callq 0x6580
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
movq (%rsp), %rdi
callq 0x6470
jmp 0x142cd
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0xbc3a
movq (%r14), %rax
movq 0x1d8(%rax), %r12
movq %r12, %rdi
callq 0x1df3c
xorl %r15d, %r15d
cmpl $0x2, %eax
ja 0x14489
movl 0x3c(%r12), %edx
movq %r14, %rdi
movl %ebp, %esi
callq 0x144b2
movl %eax, %r15d
movq %rbx, %rdi
callq 0x6340
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1449f
movq %rax, %r14
movq %rbx, %rdi
callq 0x6340
movq %r14, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1486a
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 0x1de02
movl %eax, %ebp
testb %al, %al
je 0x148ce
movq %rsp, %r12
movq %r12, %rdi
callq 0x182ec
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 0x14940
movq %rsp, %rdi
callq 0x182f8
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x182f8
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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), %rsi
movq %rsp, %rdi
callq 0x1566a
leaq 0x8(%r14), %rdi
movq %r15, %rsi
callq 0x17c6a
leaq 0x10(%r14), %rcx
cmpq %rcx, %rax
je 0x151fe
movq (%r14), %r14
addq $0x40, %rax
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x6530
movq (%r14), %rax
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq *0x18(%rax)
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x6788
jmp 0x1520f
leaq 0xa9f7(%rip), %rsi      # 0x1fbfc
movq %rbx, %rdi
callq 0x6730
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x15676
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6788
jmp 0x15235
movq %rax, %rbx
movq %rsp, %rdi
callq 0x15676
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/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, %r13
movq %rdi, %r15
leaq 0x70(%rdi), %rsi
leaq 0x18(%rsp), %rdi
callq 0x155f8
leaq 0x8(%r15), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x17c6a
leaq 0x10(%r15), %rcx
movq %rax, (%rsp)
cmpq %rcx, %rax
je 0x1532c
leaq 0x38(%r15), %rbp
movq (%rsp), %rax
leaq 0x40(%rax), %r12
movq %rbp, %rdi
movq %r12, %rsi
callq 0x17c6a
movq %rbx, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movq %rax, %rbx
addq $0x40, %rbx
pushq $-0x1
popq %r14
movq %rbp, %rdi
movq %r12, %rsi
callq 0x17cf4
incq %r14
cmpq %r14, %rax
jbe 0x152e3
movq %rbx, %rdi
movq %r13, %rsi
callq 0xd211
testb %al, %al
je 0x152b4
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x17e50
movq %rbp, %rdi
movq %r12, %rsi
callq 0x17cf4
movq 0x10(%rsp), %r14
testq %rax, %rax
jne 0x15320
movq (%r15), %rbx
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x6530
movq (%rbx), %rax
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq *0x20(%rax)
leaq 0x28(%rsp), %rdi
callq 0x6788
movq %r14, %rdi
movq (%rsp), %rsi
callq 0x17e50
leaq 0x18(%rsp), %rdi
callq 0x15650
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6788
jmp 0x1535d
jmp 0x1535a
jmp 0x1535a
jmp 0x1535a
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x15650
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x15591
movq %rdx, %r15
subq %rdx, %r14
movl $0xe8, %edi
callq 0x6410
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x15e7c
jmp 0x155a7
pushq $0x70
popq %rdi
callq 0x6410
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x15cf6
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
jmp 0x155b2
movq %rax, %r14
movq %rbx, %rdi
callq 0x63f0
movq %r14, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x50
popq %rcx
movq %r15, %rax
mulq %rcx
seto %cl
orq $0x8, %rax
leaq 0x1bc66(%rip), %rdx     # 0x31990
pushq $-0x1
popq %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)
andq $0x0, 0x50(%rbx)
callq 0x6040
movq %r15, (%rax)
leaq 0x8(%rax), %rcx
addq $0x38, %rax
imulq $0x50, %r15, %rdx
xorl %esi, %esi
leaq -0x20(%rax), %rdi
movq %rdi, -0x30(%rax)
andq $0x0, -0x28(%rax)
movb %sil, -0x20(%rax)
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %sil, (%rax)
addq $0x50, %rax
addq $-0x50, %rdx
jne 0x15d7f
movq %rcx, 0x68(%rbx)
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
subq $0x1, %r15
jb 0x15dd5
movq 0x68(%rbx), %rax
addq %r13, %rax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x161fe
addq $0x50, %r13
jmp 0x15db2
pushq $0x50
popq %rdi
callq 0x6410
movq %rax, %r15
addq $0x10, %rax
movq %rax, (%r15)
andq $0x0, 0x8(%r15)
xorl %eax, %eax
movb %al, 0x10(%r15)
movq %r15, %rcx
addq $0x30, %rcx
movq %rcx, 0x20(%r15)
andq $0x0, 0x28(%r15)
movb %al, 0x30(%r15)
movq %r15, 0x58(%rbx)
pushq $0x50
popq %rdi
callq 0x6410
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
andq $0x0, 0x8(%rax)
xorl %ecx, %ecx
movb %cl, 0x10(%rax)
movq %rax, %rdx
addq $0x30, %rdx
movq %rdx, 0x20(%rax)
andq $0x0, 0x28(%rax)
movb %cl, 0x30(%rax)
movq %rax, 0x60(%rbx)
andq $0x0, 0x40(%r15)
movq %rax, 0x48(%r15)
movq %r15, 0x40(%rax)
andq $0x0, 0x48(%rax)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x15e5c
movq %rax, %r15
addq $0x8, %rbx
movq %r14, %rdi
callq 0x1635e
movq %rbx, %rdi
callq 0x1636c
movq %r15, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rdi, %r14
addq $0x8, %rdi
callq 0x1642a
movq (%rax), %r15
testq %r15, %r15
je 0x16162
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 0x16189
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6490
movq %r14, %rdi
callq 0x6788
testq %r15, %r15
setne %al
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1642a
movq (%rax), %r12
movq %r12, (%rsp)
testq %r12, %r12
je 0x161ec
movq 0x40(%r12), %rax
movq 0x48(%r12), %rcx
movq %rcx, 0x48(%rax)
movq %rax, 0x40(%rcx)
addq $0x40, %r14
movq %rsp, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x16982
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x16874
testq %r12, %r12
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/./src/include/SLRUMap.h
// Function: dslab::SLRUMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::Put(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, 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)
bool SLRUMap<K,D>::Put(K key , D data, K& ukey, D& udata, bool same){
	D ldata;
	if( Get(key, ldata) ){//key exists, it should be now in protect segment, the segments should have been renewed
		return protect.Put(key, data, ukey, udata, same);//always false, no kv poped
	}else{// key does not exist
		return probation.Put(key, data, ukey, udata, same);//poped out or not is determined by probation segment
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %r9d, %ebp
movq %r8, (%rsp)
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x8(%rsp), %rdi
callq 0x6530
movq (%r15), %rax
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r15, %rdi
callq *0x18(%rax)
movl %eax, %r12d
leaq 0x8(%rsp), %rdi
callq 0x6788
testb %r12b, %r12b
je 0x16b45
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6530
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x6530
addq $0x8, %r15
movzbl %bpl, %r9d
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq (%rsp), %r8
callq 0x15f7c
jmp 0x16b82
leaq 0x68(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6530
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x6530
addq $0x78, %r15
movzbl %bpl, %r9d
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq (%rsp), %r8
callq 0x15f7c
movl %eax, %ebp
movq %rbx, %rdi
callq 0x6788
movq %r12, %rdi
callq 0x6788
leaq 0x28(%rsp), %rdi
callq 0x6788
movl %ebp, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x6788
jmp 0x16bd6
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x6788
jmp 0x16be0
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x16bf2
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x16bf2
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6788
jmp 0x16bfc
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6788
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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 0x18382
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x18374
callq 0x64c0
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x18382
callq 0x64c0
movq 0x20(%rbx), %r14
testq %r14, %r14
je 0x1839b
movq %r14, %rdi
callq 0x10252
movq %r14, %rdi
callq 0x63f0
movq 0x28(%rbx), %r14
testq %r14, %r14
je 0x183b4
movq %r14, %rdi
callq 0xe636
movq %r14, %rdi
callq 0x63f0
movq 0x38(%rbx), %rbx
testq %rbx, %rbx
je 0x183d4
movq %rbx, %rdi
callq 0xe636
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_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::KVSlice::copy_helper(hlkvds::KVSlice const&)
void KVSlice::copy_helper(const KVSlice& toBeCopied) {
    keyLength_ = toBeCopied.GetKeyLen();
    dataLength_ = toBeCopied.GetDataLen();
    key_ = toBeCopied.GetKey();
    data_ = toBeCopied.GetData();
    *digest_ = *toBeCopied.digest_;
    *entry_ = *toBeCopied.entry_;
    segId_ = toBeCopied.segId_;
    deepCopy_ = toBeCopied.deepCopy_;
    *entryGC_ = *toBeCopied.entryGC_;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzwl 0x8(%rsi), %eax
movl %eax, 0x8(%rdi)
movzwl 0x18(%rsi), %eax
movw %ax, 0x18(%rdi)
movq (%rsi), %rax
movq %rax, (%rdi)
movq 0x10(%rsi), %rax
movq %rax, 0x10(%rdi)
movq 0x20(%rsi), %rsi
movq 0x20(%rdi), %rdi
callq 0x10254
movq 0x28(%rbx), %rsi
movq 0x28(%r14), %rdi
callq 0xe6f6
movl 0x30(%rbx), %eax
movl %eax, 0x30(%r14)
movb 0x34(%rbx), %al
movb %al, 0x34(%r14)
movq 0x38(%rbx), %rsi
movq 0x38(%r14), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe6f6
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::KVSlice::KVSlice(char const*, int, char const*, int, bool)
KVSlice::KVSlice(const char* key, int key_len, const char* data, int data_len, bool deep_copy) :
    key_(NULL), keyLength_(key_len), data_(NULL), dataLength_(data_len),
            digest_(NULL), entry_(NULL), segId_(0), deepCopy_(deep_copy),
            entryGC_(NULL) {
    if (deepCopy_) {
        key_ = new char[key_len];
        data_ = new char[data_len];
        memcpy((void*)key_, key, key_len);
        memcpy((void*)data_, data, data_len);
    } else {
        key_ = key;
        data_ = data;
    }
    calcDigest();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movq %rdi, %rbx
andq $0x0, (%rdi)
movl %edx, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
movq %rsi, %r15
movw %bp, 0x18(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
andl $0x0, 0x30(%rdi)
movb %r9b, 0x34(%rdi)
andq $0x0, 0x38(%rdi)
testl %r9d, %r9d
je 0x18512
movslq %edx, %rdi
movq %rdi, 0x8(%rsp)
testl %edx, %edx
pushq $-0x1
popq %r13
cmovsq %r13, %rdi
movq %rcx, 0x10(%rsp)
callq 0x6040
movq %rax, %r14
movq %rax, (%rbx)
movslq %ebp, %r12
testl %ebp, %ebp
cmovnsq %r12, %r13
movq %r13, %rdi
callq 0x6040
movq %rax, %r13
movq %rax, 0x10(%rbx)
movq %r14, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
callq 0x6370
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x6370
jmp 0x18519
movq %r15, (%rbx)
movq %rcx, 0x10(%rbx)
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18530
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x18558
movq %r14, %rdi
callq 0x10252
movq %r14, %rdi
callq 0x63f0
andq $0x0, 0x20(%rbx)
pushq $0x14
popq %rdi
callq 0x6410
movq %rax, %r14
movq %rax, %rdi
callq 0x10238
movq %r14, 0x20(%rbx)
movq (%rbx), %rsi
movl 0x8(%rbx), %edx
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x10222
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x10286
leaq 0xc(%rsp), %rdi
callq 0x10220
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0xc(%rsp), %rdi
callq 0x10220
jmp 0x185ba
movq %rax, %rbx
movq %r14, %rdi
callq 0x63f0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/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 0x6370
addq $0x28, %rbx
addq $0x28, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x199b2
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %rax
movq %rsi, (%rsp)
movzwl 0x18(%rsi), %ecx
movzwl 0x8(%rsi), %edx
movl 0x14(%rdi), %eax
cmpl $0x1000, %ecx           # imm = 0x1000
jne 0x189a8
addl %edx, %eax
addl $0x20, %eax
movl %eax, 0x14(%rdi)
addl $0xfffff000, 0x18(%rdi) # imm = 0xFFFFF000
incl 0x20(%rdi)
jmp 0x189b2
addl %edx, %ecx
addl %ecx, %eax
addl $0x20, %eax
movl %eax, 0x14(%rdi)
incl 0x1c(%rdi)
addq $0x28, %rdi
movq %rsp, %rsi
callq 0xe040
popq %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
xorl %edx, %edx
movq %rsi, %rdi
movq (%rdi), %rdi
cmpq %rsi, %rdi
je 0x189f0
movq 0x10(%rdi), %r8
movzwl 0x18(%r8), %r9d
movzwl 0x8(%r8), %r8d
addl %r9d, %edx
addl %r8d, %edx
addl $0x20, %edx
jmp 0x189cf
subl %eax, %ecx
cmpl %edx, %ecx
seta %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
cmpl $0x0, (%rdi)
js 0x18a42
movq %rdi, %rbx
callq 0x18aa4
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x18ce4
movq 0x1958f(%rip), %r14     # 0x31fd8
movq (%r14), %rbx
callq 0x63c0
leaq 0x684d(%rip), %rsi      # 0x1f2a5
leaq 0x85e1(%rip), %rcx      # 0x21040
leaq 0x85eb(%rip), %r8       # 0x21051
movq %rbx, %rdi
movq %rax, %rdx
movl $0x115, %r9d            # imm = 0x115
xorl %eax, %eax
callq 0x6580
movq (%r14), %rcx
leaq 0x85dd(%rip), %rdi      # 0x21060
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x6750
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x64b0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x18d42
movq 0x8(%rbx), %rdi
movl (%rbx), %eax
cmpl %eax, 0x3c(%rdi)
jbe 0x18d17
movb 0x40(%rdi), %cl
shlq %cl, %rax
jmp 0x18d19
xorl %eax, %eax
movq 0x40(%rbx), %rsi
movslq 0x10(%rbx), %rdx
movq %rax, %rcx
callq 0x1de8e
movl %eax, %ebp
movq 0x40(%rbx), %rdi
callq 0x6470
andq $0x0, 0x40(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x19095
movq %rsi, %r14
movq %rbx, %rdi
callq 0x188d4
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 0x1db1a
leaq 0x68(%r14), %rsi
leaq 0x68(%rbx), %rdi
callq 0x1db1a
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), %rsi
addq %rbx, %rdi
callq 0x199ce
movl $0xc0, %edi
addq %rdi, %r14
addq %rbx, %rdi
movq %r14, %rsi
callq 0x199ea
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, (%rsp)
movq 0x8(%rsi), %r14
cmpl $0x0, 0x1c(%rdi)
jne 0x19186
movb $0x1, 0x79(%rbx)
leaq 0x58(%rbx), %rdi
callq 0x1db02
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1897c
leaq 0x80(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x19a06
movq (%r14), %rax
movq %rbx, 0x68(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::Notify(bool)
void SegForReq::Notify(bool stat) {
    std::lock_guard < std::mutex > l(mtx_);

    //Set logic timestamp to hashentry
    reqCommited_.store(GetKeyNum());

    int32_t keyNo = 0;
    persistTime_.Update();
    for (list<Request *>::iterator iter = reqList_.begin(); iter
            != reqList_.end(); iter++) {
        keyNo++;
        KVSlice *slice = &(*iter)->GetSlice();
        HashEntry &entry = slice->GetHashEntry();
        entry.SetLogicStamp(persistTime_, keyNo);

        if (!slice->GetData()) {
            delReqList_.push_back(entry);
        }
    }

    //notify and clean req.
    while (!reqList_.empty()) {
        Request *req = reqList_.front();
        reqList_.pop_front();
        req->SetWriteStat(stat);
        req->Signal();
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, 0xc(%rsp)
movq %rdi, %rbx
addq $0x98, %rdi
movq %rdi, 0x10(%rsp)
callq 0xbc3a
movl 0x1c(%rbx), %eax
xchgl %eax, 0x7c(%rbx)
leaq 0x68(%rbx), %rdi
movq %rdi, 0x20(%rsp)
callq 0x1db02
leaq 0x80(%rbx), %r12
addq $0xc0, %rbx
movq %rbx, 0x18(%rsp)
pushq $0x1
popq %r13
leaq 0x28(%rsp), %rbx
movq %r12, %r14
movq (%r14), %r14
cmpq %r12, %r14
je 0x19267
movq 0x10(%r14), %rax
movq 0x8(%rax), %r15
movq 0x28(%r15), %rbp
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x1db12
movq %rbp, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0xe734
movq %rbx, %rdi
callq 0x1db90
cmpq $0x0, 0x10(%r15)
jne 0x19262
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x19a12
incl %r13d
jmp 0x19217
movzbl 0xc(%rsp), %ebx
movq (%r12), %rax
cmpq %r12, %rax
je 0x19295
movq 0x10(%rax), %r15
movq %r12, %rdi
callq 0x19a1e
movq %r15, %rdi
movl %ebx, %esi
callq 0x187c8
movq %r15, %rdi
callq 0x18836
jmp 0x1926c
movq 0x10(%rsp), %rdi
callq 0x6340
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x192c1
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x1db90
jmp 0x192c4
jmp 0x192c1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
callq 0x6340
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::IsExpired()
bool SegForReq::IsExpired() {
    KVTime nowTime;
    if (!hasReq_) {
        return false;
    }
    int64_t interval = nowTime - startTime_;
    return (interval > timeout_);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x1db0a
cmpb $0x1, 0x79(%rbx)
jne 0x19303
leaq 0x58(%rbx), %rsi
movq %rsp, %rdi
callq 0x1db76
movl 0x50(%rbx), %ecx
cmpq %rcx, %rax
setg %bl
jmp 0x19305
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x1db90
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1db90
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForReq::CleanDeletedEntry()
void SegForReq::CleanDeletedEntry() {
    std::lock_guard < std::mutex > l(mtx_);
    for (list<HashEntry>::iterator iter = delReqList_.begin(); iter
            != delReqList_.end(); iter++) {
        idxMgr_->RemoveEntry(*iter);
    }
    delReqList_.clear();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x98(%rdi), %rbx
movq %rbx, %rdi
callq 0xbc3a
leaq 0xc0(%r14), %r15
movq %rsp, %r12
movq %r15, %rbp
movq (%rbp), %rbp
cmpq %r15, %rbp
je 0x19383
movq 0x48(%r14), %r13
leaq 0x10(%rbp), %rsi
movq %r12, %rdi
callq 0xe5d4
movq %r13, %rdi
movq %r12, %rsi
callq 0xf03a
movq %r12, %rdi
callq 0xe636
jmp 0x19355
movq %r15, %rdi
callq 0x19a26
movq %rbx, %rdi
callq 0x6340
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x193b2
movq %rax, %r14
movq %rsp, %rdi
callq 0xe636
movq %rbx, %rdi
callq 0x6340
movq %r14, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForSlice::operator=(hlkvds::SegForSlice const&)
SegForSlice& SegForSlice::operator=(const SegForSlice& toBeCopied) {
    if (this == &toBeCopied) {
        return *this;
    }
    SegBase::operator=(toBeCopied);
    idxMgr_ = toBeCopied.idxMgr_;
    return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x1942b
movq %rsi, %r14
movq %rbx, %rdi
callq 0x188d4
movq 0x48(%r14), %rax
movq %rax, 0x48(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegForMigrate::operator=(hlkvds::SegForMigrate const&)
SegForMigrate& SegForMigrate::operator=(const SegForMigrate& toBeCopied) {
    if (this == &toBeCopied) {
        return *this;
    }
    SegBase::operator=(toBeCopied);
    idxMgr_ = toBeCopied.idxMgr_;
    return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x194ab
movq %rsi, %r14
movq %rbx, %rdi
callq 0x188d4
movq 0x48(%r14), %rax
movq %rax, 0x48(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::Put(hlkvds::KVSlice*)
void SegLatencyFriendly::Put(KVSlice* slice) {
    headPos_ += IndexManager::SizeOfDataHeader() + slice->GetKeyLen() + slice->GetDataLen();
    keyNum_++;
    sliceList_.push_back(slice);
    __DEBUG("Put request key = %s", slice->GetKeyStr().c_str());
}

// Assembly:
pushq %rax
movq %rsp, %rax
movq %rsi, (%rax)
movzwl 0x8(%rsi), %ecx
movzwl 0x18(%rsi), %edx
leal 0x20(%rcx,%rdx), %ecx
movd %ecx, %xmm0
movq 0x18(%rdi), %xmm1
movaps 0x7a73(%rip), %xmm2     # 0x21030
movss %xmm0, %xmm2            # xmm2 = xmm0[0],xmm2[1,2,3]
paddd %xmm1, %xmm2
movq %xmm2, 0x18(%rdi)
addq $0x28, %rdi
movq %rax, %rsi
callq 0xe040
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::TryPutList(std::__cxx11::list<hlkvds::KVSlice*, std::allocator<hlkvds::KVSlice*>>&)
bool SegLatencyFriendly::TryPutList(std::list<KVSlice*> &slice_list) {
    uint32_t free_size = segSize_ - headPos_;
    uint32_t need_size = 0;
    for (list<KVSlice *>::iterator iter = slice_list.begin(); iter != slice_list.end(); iter++) {
        KVSlice *slice = *iter;
        need_size += slice->GetDataLen() + slice->GetKeyLen() + IndexManager::SizeOfDataHeader();
    }
    return free_size > need_size;
}

// Assembly:
movl 0x14(%rdi), %eax
movl 0x18(%rdi), %ecx
xorl %edx, %edx
movq %rsi, %rdi
movq (%rdi), %rdi
cmpq %rsi, %rdi
je 0x19604
movq 0x10(%rdi), %r8
movzwl 0x18(%r8), %r9d
movzwl 0x8(%r8), %r8d
addl %r9d, %edx
addl %r8d, %edx
addl $0x20, %edx
jmp 0x195e3
subl %ecx, %eax
cmpl %edx, %eax
seta %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::_writeDataToDevice()
bool SegLatencyFriendly::_writeDataToDevice() {
    checksumSize_ = headPos_ - SegBase::SizeOfSegOnDisk();
    uint32_t pages_num = headPos_ / getpagesize();
    uint32_t aligned_size = ( pages_num + 1 ) * getpagesize();

    posix_memalign((void**)&dataBuf_, 4096, aligned_size);

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

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

    free(dataBuf_);
    dataBuf_ = NULL;


    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r12
movl 0x18(%rdi), %ebx
leal -0x20(%rbx), %eax
movl %eax, 0x20(%rdi)
callq 0x66b0
movl %eax, %ecx
xorl %r15d, %r15d
movl %ebx, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %r14d
incl %r14d
imull %ecx, %r14d
leaq 0x40(%r12), %rbx
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq %r14, %rdx
callq 0x6200
movq %r12, %rdi
callq 0x198ca
movq (%r12), %rdi
movl 0x10(%r12), %eax
cmpl %eax, 0x3c(%rdi)
jbe 0x198a2
movb 0x40(%rdi), %cl
shlq %cl, %rax
movq %rax, %r15
movq (%rbx), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x1de8e
movl %eax, %ebp
movq (%rbx), %rdi
callq 0x6470
andq $0x0, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/src/Segment.cc
// Function: hlkvds::SegLatencyFriendly::copyToDataBuf()
void SegLatencyFriendly::copyToDataBuf() {
    uint64_t offset = 0;
    vol_->CalcSegOffsetFromId(segId_, offset);

    uint32_t offset_begin = 0;

    offset_begin += SegBase::SizeOfSegOnDisk();

    //aggregate iovec
    for (list<KVSlice *>::iterator iter = sliceList_.begin(); iter
            != sliceList_.end(); iter++) {
        KVSlice *slice = *iter;
        DataHeader *header =
                &slice->GetHashEntry().GetEntryOnDisk().GetDataHeader();
        char *data = (char *) slice->GetData();
        uint16_t data_len = slice->GetDataLen();

        char *key = (char *) slice->GetKey();
        uint16_t key_len = slice->GetKeyLen();
        memcpy(&(dataBuf_[offset_begin]), header, IndexManager::SizeOfDataHeader());
        __DEBUG("write key = %s, seg_id: %u, header offset: %u", slice->GetKey(), segId_, offset_begin);
        offset_begin += IndexManager::SizeOfDataHeader();
        memcpy(&(dataBuf_[offset_begin]), key, key_len);
        __DEBUG("write key = %s, key offset: %u", slice->GetKey(), offset_begin);
        offset_begin += key_len;
        memcpy(&(dataBuf_[offset_begin]), data, data_len);
        __DEBUG("write key = %s, data position: %u", slice->GetKey(), offset_begin);
        offset_begin += data_len;
    }

    // Generate SegHeaderOnDisk
    uint64_t timestamp = KVTime::GetNow();
    uint64_t trx_id = 0;
    uint32_t trx_segs = 0;
    uint32_t checksum_data = 0;
    SegHeaderOnDisk seg_header(timestamp, trx_id, trx_segs, checksum_data, checksumSize_, keyNum_);
    memcpy(dataBuf_, &seg_header, SegBase::SizeOfSegOnDisk());

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x28(%rdi), %r13
pushq $0x20
popq %rbp
movq %r13, 0x10(%rsp)
movq (%r13), %r13
cmpq 0x10(%rsp), %r13
je 0x19950
movq 0x10(%r13), %rax
movq 0x28(%rax), %rcx
movq (%rcx), %rcx
movq (%rax), %rsi
movq 0x10(%rax), %r15
movzwl 0x18(%rax), %r14d
movzwl 0x8(%rax), %r12d
movq 0x40(%rbx), %rax
movl %ebp, %edx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax,%rdx)
movups %xmm0, (%rax,%rdx)
leal 0x20(%rbp), %edi
addq 0x40(%rbx), %rdi
movq %r12, %rdx
callq 0x6370
addl %r12d, %ebp
addl $0x20, %ebp
movq 0x40(%rbx), %rdi
addq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6370
addl %r14d, %ebp
jmp 0x198e7
callq 0x1daa8
movl 0x1c(%rbx), %ecx
movl 0x20(%rbx), %r9d
movl %ecx, (%rsp)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1831c
movq 0x40(%rbx), %rax
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq %r14, %rdi
callq 0x182f8
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop