// File: /workspace/github_cpp_makefile_star2_O2/yasz24[P]eau2/src/network/./../application/../store/kvstore.h
// Function: KVStore::put(Key*, Value*)
bool put(Key* k, Value* value) {
        Key *key = k->clone();
        store_mtx_.lock(); //acquire lock ownership
        std::cout << "KV " << this_node_ <<" put: " << "\nkey: " << key->serialize() << "\n";
        size_t target = key->node();
        bool res = true;
        if (target == this->this_node_) {
            local_store_.insert(std::pair<Key*, Value*>(key, value));
        } else {
            Put put(key, value, this_node_, target, network_->msg_id);
            network_->send_msg(&put); // send put msg over the network to appropriate KVStore.
            store_mtx_.wait();
            received_msg->serialize();
            Message* m = received_msg; //wait to receive resp. Ack or Nack.
            //expect Ack or Nack
            if (m->kind_ == MsgKind::Nack) {
                std::cout<< "put on " << target << "node failed\n";
                res = false;
            }  
        }
        // notification procedure.
        resolve_local_wait(key);
        //loop through pendingGets, and resolve any that should be.
        resolve_remote_wait(key, value);
        store_mtx_.unlock();
        return res;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r15
movq %rdi, %r14
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x20(%rax)
movq %rax, %r12
leaq 0x68(%r14), %rdi
movq %rdi, -0x38(%rbp)
callq 0xbc5c
movq 0x1b6c9(%rip), %rdi     # 0x24fc0
leaq 0xefb5(%rip), %rsi      # 0x188b3
callq 0x7240
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x7190
leaq 0xefa1(%rip), %rsi      # 0x188b7
movq %rax, %rdi
callq 0x7240
leaq 0xef99(%rip), %rsi      # 0x188be
movq %rax, %rdi
callq 0x7240
movq %rax, %rbx
movq (%r12), %rax
movq %r12, %rdi
callq *0x38(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x7240
leaq 0xe79d(%rip), %rsi      # 0x180e9
movq %rax, %rdi
callq 0x7240
movq 0x18(%r12), %r13
movq 0x18(%r14), %rax
cmpq %rax, %r13
jne 0x997d
leaq 0x20(%r14), %rdi
leaq -0x78(%rbp), %rsi
movq %r12, (%rsi)
movq %r15, 0x8(%rsi)
callq 0x11e7e
movb $0x1, %bl
jmp 0x9a17
leaq 0x58(%r14), %rbx
movq 0x50(%r14), %rdi
movq 0x40(%rdi), %rcx
leaq -0x78(%rbp), %rsi
andq $0x0, 0x8(%rsi)
leaq 0x1b067(%rip), %rdx     # 0x24a00
movq %rdx, (%rsi)
movl $0x2, 0x10(%rsi)
movq %rax, 0x18(%rsi)
movq %r13, 0x20(%rsi)
movq %rcx, 0x28(%rsi)
movq %r12, 0x30(%rsi)
movq %r15, -0x30(%rbp)
movq %r15, 0x38(%rsi)
movq (%rdi), %rax
callq *0x50(%rax)
movq %rbx, %rdi
callq 0xbb4a
movq 0xd0(%r14), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq 0xd0(%r14), %rax
cmpl $0x1, 0x10(%rax)
setne %bl
jne 0x9a13
movq 0x1b5d3(%rip), %rdi     # 0x24fc0
leaq 0xeed1(%rip), %rsi      # 0x188c5
callq 0x7240
movq %rax, %rdi
movq %r13, %rsi
callq 0x7190
leaq 0xeec2(%rip), %rsi      # 0x188cd
movq %rax, %rdi
callq 0x7240
movq -0x30(%rbp), %r15
movq %r14, %rdi
movq %r12, %rsi
callq 0x11cee
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x11d2a
movq -0x38(%rbp), %rdi
callq 0x71a0
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq