// File: yasz24[P]eau2/src/network/./../application/../store/kvstore.h
// Function: KVStore::resolve_remote_wait(Key*, Value*)
void resolve_remote_wait(Key* key, Value* val) {
        size_t outstandingReqs = pendingGets.length();

        if (outstandingReqs > 0) {
            for (size_t i = 0; i < outstandingReqs; i++) {
                WaitAndGet* req = dynamic_cast<WaitAndGet*>(pendingGets.get(i));
                if (req->key_->equals(key)) {
                    //compose a response to the sender
                    Reply resp(val->serialize(), this_node_, req->sender_, network_->msg_id);
                    //send the message
                    network_->send_msg(&resp);
                }   
            }
            WaitAndGet dummy(key, 0, 0, 0);
            //remove the req from pending reqs list.
            while (pendingGets.get(&dummy) != -1 ) {
                pendingGets.remove(pendingGets.get(&dummy));
            }
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
addq $0xd8, %rdi
callq 0x11670
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jbe 0x1dccc
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x1dc1c
movq -0xb8(%rbp), %rdi
addq $0xd8, %rdi
movq -0x28(%rbp), %rsi
callq 0xbc50
movq %rax, -0xc0(%rbp)
cmpq $0x0, %rax
je 0x1db5e
movq -0xc0(%rbp), %rdi
leaq 0x1c57b(%rip), %rsi     # 0x3a0c0
leaq 0x1df54(%rip), %rdx     # 0x3baa0
xorl %eax, %eax
movl %eax, %ecx
callq 0x82f0
movq %rax, -0xc8(%rbp)
jmp 0x1db69
xorl %eax, %eax
movq %rax, -0xc8(%rbp)
jmp 0x1db69
movq -0xc8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rsi
movq (%rdi), %rax
callq *0x18(%rax)
testb $0x1, %al
jne 0x1db8c
jmp 0x1dc09
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
movq %rax, %rsi
movq -0xb8(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x18(%rax), %rdx
movq 0x50(%rax), %rax
movq 0x40(%rax), %r8
leaq -0x68(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x1e5f0
movq -0xb8(%rbp), %rax
movq -0xd0(%rbp), %rsi
movq 0x50(%rax), %rdi
movq (%rdi), %rax
movq 0x50(%rax), %rax
callq *%rax
jmp 0x1dbe4
leaq -0x68(%rbp), %rdi
callq 0x1e660
jmp 0x1dc09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x1e660
jmp 0x1dcd5
jmp 0x1dc0b
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1db05
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x1e680
movq -0xb8(%rbp), %rdi
addq $0xd8, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x1e6f0
movl %eax, -0xd4(%rbp)
jmp 0x1dc59
movl -0xd4(%rbp), %eax
cmpl $-0x1, %eax
je 0x1dcc0
movq -0xb8(%rbp), %rdi
addq $0xd8, %rdi
movq %rdi, -0xe0(%rbp)
leaq -0xb0(%rbp), %rsi
callq 0x1e6f0
movl %eax, -0xd8(%rbp)
jmp 0x1dc8d
movq -0xe0(%rbp), %rdi
movl -0xd8(%rbp), %eax
movslq %eax, %rsi
callq 0xbd50
jmp 0x1dca4
jmp 0x1dc37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x1e770
jmp 0x1dcd5
leaq -0xb0(%rbp), %rdi
callq 0x1e770
addq $0xe0, %rsp
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x8400
nop