// File: /workspace/github_cpp_makefile_star2_O1/yangwanyuan[P]HLKVDS/./src/include/LRUMap.h
// Function: dslab::LRUMap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::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 LRUMap<K,D>::Put(K key , D data, K& update_key, D& update_data, bool same){
    update_key = K();
    update_data = D();
    Node<K,D> *node = cached_map[key];
    bool poped;
    if(node){//key exist
        detach(node);
	if(!same){
	        node->data = data;
	}
        attach(node);
	poped = false;//no data poped out
    }
    else{
        if(free_entries.empty()){
            node = tail->prev;
	    update_key = node->key;
	    update_data = node->data;
            detach(node);
            cached_map.erase(node->key);
	    poped = true;//data poped out
        }
        else{
            node = free_entries.back();
            free_entries.pop_back();
	    poped = false;//no data poped out
        }
        node->key = key;
        node->data = data;
        cached_map[key] = node;
        attach(node);
    }
    return poped;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r9d, 0xc(%rsp)
movq %r8, %r13
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
leaq 0x18(%rsp), %r12
movq %rcx, %rdi
movq %r12, %rsi
callq 0x64b0
movq (%r12), %rdi
cmpq %rbp, %rdi
je 0x18c89
callq 0x6400
leaq 0x18(%rsp), %r12
movq %rbp, (%r12)
movq $0x0, 0x8(%r12)
movb $0x0, 0x10(%r12)
movq %r13, %rdi
movq %r12, %rsi
callq 0x64b0
movq (%r12), %rdi
cmpq %rbp, %rdi
je 0x18cba
callq 0x6400
leaq 0x8(%rbx), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x190c6
movq (%rax), %r12
testq %r12, %r12
je 0x18d1b
movq 0x40(%r12), %rax
movq 0x48(%r12), %rcx
movq %rcx, 0x48(%rax)
movq 0x48(%r12), %rcx
movq %rax, 0x40(%rcx)
cmpb $0x0, 0xc(%rsp)
jne 0x18cfe
leaq 0x20(%r12), %rdi
movq 0x10(%rsp), %rsi
callq 0x6250
movq 0x58(%rbx), %rax
movq %rax, 0x40(%r12)
movq 0x48(%rax), %rcx
movq %rcx, 0x48(%r12)
movq %r12, 0x48(%rax)
xorl %eax, %eax
jmp 0x18dbe
movq 0x48(%rbx), %rax
cmpq %rax, 0x40(%rbx)
sete %cl
movl %ecx, 0xc(%rsp)
je 0x18d3a
movq -0x8(%rax), %r12
addq $-0x8, %rax
movq %rax, 0x48(%rbx)
jmp 0x18d7c
movq 0x60(%rbx), %rax
movq 0x40(%rax), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x6250
leaq 0x20(%r12), %rsi
movq %r13, %rdi
callq 0x6250
movq 0x40(%r12), %rax
movq 0x48(%r12), %rcx
movq %rcx, 0x48(%rax)
movq 0x48(%r12), %rcx
movq %rax, 0x40(%rcx)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x19500
movq %r12, %rdi
movq %r15, %rsi
callq 0x6250
leaq 0x20(%r12), %rdi
movq 0x10(%rsp), %rsi
callq 0x6250
movq %rbp, %rdi
movq %r15, %rsi
callq 0x190c6
movq %r12, (%rax)
movq 0x58(%rbx), %rax
movq %rax, 0x40(%r12)
movq 0x48(%rax), %rcx
movq %rcx, 0x48(%r12)
movq %r12, 0x48(%rax)
movl 0xc(%rsp), %eax
movq 0x48(%r12), %rcx
movq %r12, 0x40(%rcx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq