// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movq %rdx, -0x30(%rbp)
movq %rdi, %r14
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x20(%rax)
movq %rax, %r12
leaq 0x68(%r14), %r15
movq %r15, %rdi
callq 0x7330
testl %eax, %eax
jne 0x9dc8
movq 0x203d3(%rip), %rbx     # 0x29fd0
leaq 0x13caa(%rip), %rsi     # 0x1d8ae
movl $0x3, %edx
movq %rbx, %rdi
callq 0x7290
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0x7170
movq %rax, %r13
leaq 0x13c8b(%rip), %rsi     # 0x1d8b2
movl $0x6, %edx
movq %rax, %rdi
callq 0x7290
leaq 0x13c7e(%rip), %rsi     # 0x1d8b9
movl $0x6, %edx
movq %r13, %rdi
callq 0x7290
movq (%r12), %rax
movq %r12, %rdi
callq *0x38(%rax)
testq %rax, %rax
je 0x9c72
movq %rax, %rbx
movq %rax, %rdi
callq 0x7100
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7290
jmp 0x9c8d
movq (%r13), %rax
movq -0x18(%rax), %rax
movq %r13, %rdi
addq %rax, %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x7380
leaq 0x13455(%rip), %rsi     # 0x1d0e9
movl $0x1, %edx
movq %r13, %rdi
callq 0x7290
movq 0x18(%r12), %rbx
movq 0x18(%r14), %rax
cmpq %rax, %rbx
jne 0x9ccf
leaq 0x20(%r14), %rdi
leaq -0x70(%rbp), %rsi
movq %r12, (%rsi)
movq -0x30(%rbp), %rax
movq %rax, 0x8(%rsi)
callq 0x1392a
movb $0x1, %r13b
jmp 0x9d7a
movq 0x50(%r14), %rdi
movq 0x40(%rdi), %rcx
leaq -0x70(%rbp), %rsi
movq $0x0, 0x8(%rsi)
leaq 0x1fd2e(%rip), %rdx     # 0x29a18
movq %rdx, (%rsi)
movl $0x2, 0x10(%rsi)
movq %rax, 0x18(%rsi)
movq %rbx, 0x20(%rsi)
movq %rcx, 0x28(%rsi)
movq %r12, 0x30(%rsi)
movq -0x30(%rbp), %rax
movq %rax, 0x38(%rsi)
movq (%rdi), %rax
callq *0x50(%rax)
leaq 0x90(%r14), %rdi
movq %r15, %rsi
callq 0xc810
movq 0xd0(%r14), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq 0xd0(%r14), %rax
cmpl $0x1, 0x10(%rax)
setne %r13b
jne 0x9d7a
movq 0x2028a(%rip), %rdi     # 0x29fd0
leaq 0x13b73(%rip), %rsi     # 0x1d8c0
movl $0x7, %edx
callq 0x7290
movq 0x20272(%rip), %rdi     # 0x29fd0
movq %rbx, %rsi
callq 0x7170
leaq 0x13b5b(%rip), %rsi     # 0x1d8c8
movl $0xc, %edx
movq %rax, %rdi
callq 0x7290
movq 0x100(%r14), %rdi
testq %rdi, %rdi
je 0x9d9f
movq (%rdi), %rax
movq %r12, %rsi
callq *0x18(%rax)
testb %al, %al
je 0x9d9f
leaq 0x90(%r14), %rdi
callq 0x13c3e
movq %r14, %rdi
movq %r12, %rsi
movq -0x30(%rbp), %rdx
callq 0x1374c
movq %r15, %rdi
callq 0x7180
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x7160
nop