// File: tonymuu[P]distributed-kv-store/MP2Node.cpp
// Function: MP2Node::handleReadMessage(Message)
void MP2Node::handleReadMessage(Message msg) {
    string res = readKey(msg.key);
    Message reply(msg.transID, memberNode->addr, READREPLY, msg.key, res, msg.replica);
    if (res.empty()) {
        log->logReadFail(&msg.fromAddr, false, msg.transID, msg.key);
        reply.success = false;
    } else {
        log->logReadSuccess(&msg.fromAddr, false, msg.transID, msg.key, res);
        reply.success = true;
    }
    sendMessage(msg.fromAddr, reply);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rsi, -0x218(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x210(%rbp)
addq $0x8, %rsi
leaq -0x50(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x4160
movq -0x210(%rbp), %rsi
movq -0x208(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x20030
jmp 0x210a2
leaq -0x50(%rbp), %rdi
callq 0x4200
movq -0x218(%rbp), %rcx
movq -0x210(%rbp), %rax
movl 0x50(%rcx), %ecx
movl %ecx, -0x21c(%rbp)
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq -0xde(%rbp), %rdi
callq 0x18e40
jmp 0x210d8
movq -0x218(%rbp), %rsi
addq $0x8, %rsi
leaq -0x100(%rbp), %rdi
callq 0x4160
jmp 0x210f1
leaq -0x120(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4160
jmp 0x21103
movl -0x21c(%rbp), %esi
movq -0x218(%rbp), %rax
movl 0x4(%rax), %ecx
movq %rsp, %rax
movl %ecx, (%rax)
leaq -0xd8(%rbp), %rdi
leaq -0xde(%rbp), %rdx
movl $0x5, %ecx
leaq -0x100(%rbp), %r8
leaq -0x120(%rbp), %r9
callq 0x2a410
jmp 0x21140
leaq -0x120(%rbp), %rdi
callq 0x4200
leaq -0x100(%rbp), %rdi
callq 0x4200
leaq -0x30(%rbp), %rdi
callq 0x4580
testb $0x1, %al
jne 0x2116a
jmp 0x21278
movq -0x218(%rbp), %rsi
movq -0x210(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x230(%rbp)
movq %rsi, %rax
addq $0x48, %rax
movq %rax, -0x228(%rbp)
movl 0x50(%rsi), %eax
movl %eax, -0x220(%rbp)
addq $0x8, %rsi
leaq -0x140(%rbp), %rdi
callq 0x4160
jmp 0x211ac
movl -0x220(%rbp), %ecx
movq -0x228(%rbp), %rsi
movq -0x230(%rbp), %rdi
xorl %edx, %edx
leaq -0x140(%rbp), %r8
callq 0x18650
jmp 0x211d0
leaq -0x140(%rbp), %rdi
callq 0x4200
movb $0x0, -0x84(%rbp)
jmp 0x2134f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4200
jmp 0x213f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x213e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x21239
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x4200
leaq -0x100(%rbp), %rdi
callq 0x4200
jmp 0x213e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x213db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x4200
jmp 0x213db
movq -0x218(%rbp), %rsi
movq -0x210(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x248(%rbp)
movq %rsi, %rax
addq $0x48, %rax
movq %rax, -0x240(%rbp)
movl 0x50(%rsi), %eax
movl %eax, -0x234(%rbp)
addq $0x8, %rsi
leaq -0x160(%rbp), %rdi
callq 0x4160
jmp 0x212ba
leaq -0x180(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4160
jmp 0x212cc
movl -0x234(%rbp), %ecx
movq -0x240(%rbp), %rsi
movq -0x248(%rbp), %rdi
xorl %edx, %edx
leaq -0x160(%rbp), %r8
leaq -0x180(%rbp), %r9
callq 0x18150
jmp 0x212f7
leaq -0x180(%rbp), %rdi
callq 0x4200
leaq -0x160(%rbp), %rdi
callq 0x4200
movb $0x1, -0x84(%rbp)
jmp 0x2134f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2133e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x4200
leaq -0x160(%rbp), %rdi
callq 0x4200
jmp 0x213db
movq -0x218(%rbp), %rsi
addq $0x48, %rsi
leaq -0x186(%rbp), %rdi
callq 0x18e40
jmp 0x21368
leaq -0x200(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x2a530
jmp 0x2137d
movq -0x210(%rbp), %rdi
leaq -0x186(%rbp), %rsi
leaq -0x200(%rbp), %rdx
callq 0x1f440
jmp 0x21399
leaq -0x200(%rbp), %rdi
callq 0x21f90
leaq -0xd8(%rbp), %rdi
callq 0x21f90
leaq -0x30(%rbp), %rdi
callq 0x4200
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x21f90
leaq -0xd8(%rbp), %rdi
callq 0x21f90
leaq -0x30(%rbp), %rdi
callq 0x4200
movq -0x58(%rbp), %rdi
callq 0x45b0
nopl (%rax)