// File: tonymuu[P]distributed-kv-store/MP2Node.cpp
// Function: MP2Node::handleUpdateMessage(Message)
void MP2Node::handleUpdateMessage(Message msg) {
    Message reply(msg.transID, memberNode->addr, REPLY, msg.key, msg.value, msg.replica);
    if (!updateKeyValue(msg.key, msg.value, msg.replica)) {
        log->logUpdateFail(&msg.fromAddr, false, msg.transID, msg.key, msg.value);
        reply.success = false;
    } else {
        log->logUpdateSuccess(&msg.fromAddr, false, msg.transID, msg.key, msg.value);
        reply.success = true;
    }
    sendMessage(msg.fromAddr, reply);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rsi, -0x228(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x238(%rbp)
movl 0x50(%rsi), %ecx
movl %ecx, -0x22c(%rbp)
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq -0x8e(%rbp), %rdi
callq 0x18e40
movq -0x228(%rbp), %rsi
addq $0x8, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x4160
movq -0x228(%rbp), %rsi
addq $0x28, %rsi
leaq -0xd0(%rbp), %rdi
callq 0x4160
jmp 0x20c52
movl -0x22c(%rbp), %esi
movq -0x228(%rbp), %rax
movl 0x4(%rax), %ecx
movq %rsp, %rax
movl %ecx, (%rax)
leaq -0x88(%rbp), %rdi
leaq -0x8e(%rbp), %rdx
movl $0x4, %ecx
leaq -0xb0(%rbp), %r8
leaq -0xd0(%rbp), %r9
callq 0x2a410
jmp 0x20c8f
leaq -0xd0(%rbp), %rdi
callq 0x4200
leaq -0xb0(%rbp), %rdi
callq 0x4200
movq -0x228(%rbp), %rsi
addq $0x8, %rsi
leaq -0x100(%rbp), %rdi
callq 0x4160
jmp 0x20cc0
movq -0x228(%rbp), %rsi
addq $0x28, %rsi
leaq -0x120(%rbp), %rdi
callq 0x4160
jmp 0x20cd9
movq -0x238(%rbp), %rdi
movq -0x228(%rbp), %rax
movl 0x4(%rax), %ecx
leaq -0x100(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x201c0
movb %al, -0x239(%rbp)
jmp 0x20d05
movb -0x239(%rbp), %al
xorb $-0x1, %al
movb %al, -0x23a(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x4200
leaq -0x100(%rbp), %rdi
callq 0x4200
movb -0x23a(%rbp), %al
testb $0x1, %al
jne 0x20d3a
jmp 0x20ec1
movq -0x228(%rbp), %rsi
movq -0x238(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x250(%rbp)
movq %rsi, %rax
addq $0x48, %rax
movq %rax, -0x248(%rbp)
movl 0x50(%rsi), %eax
movl %eax, -0x240(%rbp)
addq $0x8, %rsi
leaq -0x140(%rbp), %rdi
callq 0x4160
jmp 0x20d7c
movq -0x228(%rbp), %rsi
addq $0x28, %rsi
leaq -0x160(%rbp), %rdi
callq 0x4160
jmp 0x20d95
movl -0x240(%rbp), %ecx
movq -0x248(%rbp), %rsi
movq -0x250(%rbp), %rdi
xorl %edx, %edx
leaq -0x140(%rbp), %r8
leaq -0x160(%rbp), %r9
callq 0x18760
jmp 0x20dc0
leaq -0x160(%rbp), %rdi
callq 0x4200
leaq -0x140(%rbp), %rdi
callq 0x4200
movb $0x0, -0x34(%rbp)
jmp 0x20fa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x20e13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x4200
leaq -0xb0(%rbp), %rdi
callq 0x4200
jmp 0x2103d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x21031
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x20e6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x4200
leaq -0x100(%rbp), %rdi
callq 0x4200
jmp 0x21031
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x20eb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4200
leaq -0x140(%rbp), %rdi
callq 0x4200
jmp 0x21031
movq -0x228(%rbp), %rsi
movq -0x238(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x268(%rbp)
movq %rsi, %rax
addq $0x48, %rax
movq %rax, -0x260(%rbp)
movl 0x50(%rsi), %eax
movl %eax, -0x254(%rbp)
addq $0x8, %rsi
leaq -0x180(%rbp), %rdi
callq 0x4160
jmp 0x20f03
movq -0x228(%rbp), %rsi
addq $0x28, %rsi
leaq -0x1a0(%rbp), %rdi
callq 0x4160
jmp 0x20f1c
movl -0x254(%rbp), %ecx
movq -0x260(%rbp), %rsi
movq -0x268(%rbp), %rdi
xorl %edx, %edx
leaq -0x180(%rbp), %r8
leaq -0x1a0(%rbp), %r9
callq 0x182a0
jmp 0x20f47
leaq -0x1a0(%rbp), %rdi
callq 0x4200
leaq -0x180(%rbp), %rdi
callq 0x4200
movb $0x1, -0x34(%rbp)
jmp 0x20fa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x20f97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x4200
leaq -0x180(%rbp), %rdi
callq 0x4200
jmp 0x21031
movq -0x228(%rbp), %rsi
addq $0x48, %rsi
leaq -0x1a6(%rbp), %rdi
callq 0x18e40
jmp 0x20fc1
leaq -0x220(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x2a530
jmp 0x20fd6
movq -0x238(%rbp), %rdi
leaq -0x1a6(%rbp), %rsi
leaq -0x220(%rbp), %rdx
callq 0x1f440
jmp 0x20ff2
leaq -0x220(%rbp), %rdi
callq 0x21f90
leaq -0x88(%rbp), %rdi
callq 0x21f90
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x21f90
leaq -0x88(%rbp), %rdi
callq 0x21f90
movq -0xd8(%rbp), %rdi
callq 0x45b0
nopl (%rax)