// File: 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
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0xb0(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x58, %rdi
callq 0x11df0
movq 0x2e459(%rip), %rdi     # 0x3bfc0
leaq 0x1edca(%rip), %rsi     # 0x2c938
callq 0x8280
movq %rax, %rdi
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x80a0
movq %rax, %rdi
leaq 0x1edac(%rip), %rsi     # 0x2c93c
callq 0x8280
movq %rax, %rdi
leaq 0x1eda4(%rip), %rsi     # 0x2c943
callq 0x8280
movq %rax, -0xb8(%rbp)
movq -0x20(%rbp), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0x8280
movq %rax, %rdi
leaq 0x1e55f(%rip), %rsi     # 0x2c12d
callq 0x8280
movq -0x20(%rbp), %rdi
callq 0x11e10
movq -0xb0(%rbp), %rcx
movq %rax, -0x28(%rbp)
movb $0x1, -0x29(%rbp)
movq -0x28(%rbp), %rax
cmpq 0x18(%rcx), %rax
jne 0xdc34
movq -0xb0(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xc0(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x1d990
movq -0xc0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1d950
movq %rax, -0x50(%rbp)
movb %dl, -0x48(%rbp)
jmp 0xdd4c
movq -0xb0(%rbp), %rax
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %r8
movq 0x18(%rax), %rcx
movq 0x50(%rax), %rax
movq 0x40(%rax), %r9
leaq -0x90(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x1d9c0
movq -0xb0(%rbp), %rax
movq -0xc8(%rbp), %rsi
movq 0x50(%rax), %rdi
movq (%rdi), %rax
movq 0x50(%rax), %rax
callq *%rax
jmp 0xdc83
movq -0xb0(%rbp), %rdi
addq $0x58, %rdi
callq 0x11f70
jmp 0xdc95
movq -0xb0(%rbp), %rax
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xdcae
movq -0xb0(%rbp), %rax
movq 0xd0(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jne 0xdd40
movq 0x2e2e9(%rip), %rdi     # 0x3bfc0
leaq 0x1ec6c(%rip), %rsi     # 0x2c94a
callq 0x8280
movq %rax, -0xd0(%rbp)
jmp 0xdcec
movq -0xd0(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x80a0
movq %rax, -0xd8(%rbp)
jmp 0xdd05
movq -0xd8(%rbp), %rdi
leaq 0x1ec3f(%rip), %rsi     # 0x2c952
callq 0x8280
jmp 0xdd1a
movb $0x0, -0x29(%rbp)
jmp 0xdd40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x1da40
jmp 0xdd8e
leaq -0x90(%rbp), %rdi
callq 0x1da40
movq -0xb0(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1da60
movq -0xb0(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1dac0
movq -0xb0(%rbp), %rdi
addq $0x58, %rdi
callq 0x121e0
movb -0x29(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x8400
nopw (%rax,%rax)