// File: /workspace/github_cpp_makefile_star2_O2/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 $0x218, %rsp            # imm = 0x218
movq %rdx, 0x18(%rsp)
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movq 0x58(%rdi), %rdi
callq 0xabe4
leaq 0xb8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %edx, %edx
movb %dl, (%rcx)
leaq 0xd8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %dl, (%rcx)
andq $0x0, -0x48(%rcx)
leaq 0xa8(%rsp), %rdi
movl $0x2, -0x38(%rcx)
movl 0x1aaa9(%rip), %edx     # 0x28910
leal 0x1(%rdx), %esi
movl %esi, 0x1aaa0(%rip)     # 0x28910
movl %edx, -0x40(%rcx)
movl %eax, -0x3c(%rcx)
movq %rbx, 0x20(%rsp)
movq %rbx, %rsi
callq 0x3170
leaq 0xc8(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x3170
leaq 0x98(%rsp), %rsi
movq 0x8(%rsp), %rax
leaq 0xc0(%rax), %rdi
leaq 0x90(%rsp), %rdx
callq 0x101c6
leaq 0x70(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x33a0
leaq 0x38(%rsp), %rdi
leaq 0x70(%rsp), %rdx
movq 0x8(%rsp), %rsi
callq 0xd97e
leaq 0x70(%rsp), %rdi
callq 0x3120
movl 0x98(%rsp), %eax
movl %eax, 0x14(%rsp)
xorl %r13d, %r13d
leaq 0x108(%rsp), %rbx
leaq 0xe8(%rsp), %r14
leaq 0x128(%rsp), %rbp
leaq 0x1a0(%rsp), %r12
xorl %r15d, %r15d
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r15, %rax
jbe 0xdff0
addq %r13, %rsi
leaq 0x50(%rsp), %rdi
callq 0x1060e
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq 0x32(%rsp), %rdi
callq 0xac20
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x33a0
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0x33a0
movq %rbp, %rdi
movl 0x14(%rsp), %esi
leaq 0x32(%rsp), %rdx
pushq $0x2
popq %rcx
movq %rbx, %r8
movq %r14, %r9
callq 0x11ef6
movq %r14, %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3120
movl %r15d, 0x12c(%rsp)
leaq 0x2c(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xac20
movq %r12, %rdi
movq %rbp, %rsi
callq 0x11e20
movq 0x8(%rsp), %rdi
leaq 0x2c(%rsp), %rsi
movq %r12, %rdx
callq 0xdb48
movq %r12, %rdi
callq 0xf3c4
movq %rbp, %rdi
callq 0xf3c4
leaq 0x50(%rsp), %rdi
callq 0x10604
incq %r15
addq $0x20, %r13
jmp 0xdf14
leaq 0x38(%rsp), %rdi
callq 0x97f8
leaq 0x90(%rsp), %rdi
callq 0xf3e8
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3120
jmp 0xe093
jmp 0xe02a
movq %rax, %rbx
jmp 0xe093
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x3120
jmp 0xe05b
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
callq 0xf3c4
jmp 0xe06d
movq %rax, %rbx
jmp 0xe089
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x3120
jmp 0xe07f
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0xf3c4
jmp 0xe07f
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x10604
leaq 0x38(%rsp), %rdi
callq 0x97f8
leaq 0x90(%rsp), %rdi
callq 0xf3e8
movq %rbx, %rdi
callq 0x3490