// File: /workspace/github_cpp_makefile_star2_O3/tonymuu[P]distributed-kv-store/MP2Node.cpp
// Function: MP2Node::clientUpdate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void MP2Node::clientUpdate(string key, string value){
    // start a transaction
    Transaction transaction(UPDATE, par->getcurrtime());
    transaction.key = key;
    transaction.value = value;
    txMap.emplace(transaction.txId, transaction);

    // send messages to all nodes who should hold the key
    auto nodes = findNodes(key);
    int txId = transaction.txId;
    for (int i = 0; i < nodes.size(); i++) {
        auto node = nodes[i];
        Message msg(txId, memberNode->addr, UPDATE, key, value);
        msg.replica = static_cast<ReplicaType>(i);
        sendMessage(node.nodeAddress, msg);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdx, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movq 0x58(%rdi), %rdi
callq 0xc87e
leaq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
xorl %ecx, %ecx
movq %rcx, -0x8(%rdx)
movb %cl, (%rdx)
leaq 0xe8(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq %rcx, -0x8(%rsi)
movb %cl, (%rsi)
movq %rcx, -0x48(%rsi)
movl $0x2, -0x38(%rsi)
movl 0x1b896(%rip), %ecx     # 0x2b900
leal 0x1(%rcx), %edx
movl %edx, 0x1b88d(%rip)     # 0x2b900
movl %ecx, -0x40(%rsi)
movl %eax, -0x3c(%rsi)
movq %r14, %rsi
callq 0x3160
leaq 0xd8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3160
leaq 0xa8(%rsp), %rsi
leaq 0xc0(%r15), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x1348a
leaq 0x90(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x5a4e
leaq 0x48(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %r15, %rsi
callq 0xf940
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x10105
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x48(%rsp), %rsi
cmpq %rsi, 0x50(%rsp)
je 0x10334
movl 0xa8(%rsp), %eax
movl %eax, 0xc(%rsp)
xorl %r12d, %r12d
leaq 0x170(%rsp), %rdi
xorl %ebp, %ebp
addq %r12, %rsi
movq %rdi, %r13
callq 0x13914
movq 0x50(%r15), %rsi
addq $0x8, %rsi
leaq 0x22(%rsp), %rdi
callq 0xc8c4
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x5a4e
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x5a4e
leaq 0xf8(%rsp), %rdi
movl 0xc(%rsp), %esi
leaq 0x22(%rsp), %rdx
movl $0x2, %ecx
leaq 0x28(%rsp), %r8
movq %rbx, %r9
callq 0x15e54
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x101cd
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x101e9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32c0
movl %ebp, 0xfc(%rsp)
leaq 0x1c(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0xc8c4
leaq 0x190(%rsp), %rbx
movq %rbx, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x15d5a
movq %r15, %rdi
leaq 0x1c(%rsp), %rsi
movq %rbx, %rdx
callq 0xfbc4
movq 0x1e8(%rsp), %rdi
leaq 0x1f8(%rsp), %rax
cmpq %rax, %rdi
je 0x1024f
movq 0x1f8(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x1b8(%rsp), %rdi
leaq 0x1c8(%rsp), %rax
cmpq %rax, %rdi
je 0x10274
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x198(%rsp), %rdi
leaq 0x1a8(%rsp), %rax
cmpq %rax, %rdi
je 0x10299
movq 0x1a8(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x150(%rsp), %rdi
leaq 0x160(%rsp), %rax
cmpq %rax, %rdi
je 0x102be
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x102e3
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x10308
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x32c0
movq %r13, %rdi
callq 0x13908
movq %r13, %rdi
incq %rbp
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
addq $0x20, %r12
cmpq %rbp, %rax
ja 0x1012d
leaq 0x48(%rsp), %rdi
callq 0xb4a6
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x10363
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x10388
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x32c0
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x10452
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32c0
jmp 0x10452
jmp 0x103c5
movq %rax, %rbx
jmp 0x10452
movq %rax, %rbx
jmp 0x10448
movq %rax, %rbx
jmp 0x103f6
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x103f6
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1043b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32c0
jmp 0x1043b
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x1263c
jmp 0x1042e
movq %rax, %rbx
jmp 0x1043b
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x1263c
leaq 0x170(%rsp), %rdi
callq 0x13908
leaq 0x48(%rsp), %rdi
callq 0xb4a6
leaq 0xa0(%rsp), %rdi
callq 0x1268c
movq %rbx, %rdi
callq 0x34b0
nop