// File: tonymuu[P]distributed-kv-store/MP2Node.cpp
// Function: MP2Node::clientRead(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void MP2Node::clientRead(string key){
    // start a transaction
    Transaction transaction(READ, par->getcurrtime());
    transaction.key = key;
    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, READ, key);
        msg.replica = static_cast<ReplicaType>(i);
        sendMessage(node.nodeAddress, msg);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rsi, -0x210(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x218(%rbp)
movq 0x58(%rax), %rdi
callq 0x18c60
movl %eax, %edx
leaq -0x68(%rbp), %rdi
movl $0x1, %esi
callq 0x21950
movq -0x210(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x4050
jmp 0x1f520
movq -0x218(%rbp), %rdi
addq $0xc0, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x21f40
movb %dl, -0x221(%rbp)
movq %rax, -0x220(%rbp)
jmp 0x1f54a
movq -0x210(%rbp), %rsi
movb -0x221(%rbp), %al
movq -0x220(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movb %al, -0x80(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x4160
jmp 0x1f576
movq -0x218(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0x1f030
jmp 0x1f592
leaq -0xc0(%rbp), %rdi
callq 0x4200
movl -0x60(%rbp), %eax
movl %eax, -0xc4(%rbp)
movl $0x0, -0xc8(%rbp)
movslq -0xc8(%rbp), %rax
movq %rax, -0x230(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x150e0
movq %rax, %rcx
movq -0x230(%rbp), %rax
cmpq %rcx, %rax
jae 0x1f7a4
movslq -0xc8(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x16ff0
movq %rax, %rsi
leaq -0xe8(%rbp), %rdi
callq 0x26240
jmp 0x1f602
movq -0x218(%rbp), %rax
movl -0xc4(%rbp), %ecx
movl %ecx, -0x234(%rbp)
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq -0x166(%rbp), %rdi
callq 0x18e40
jmp 0x1f62b
movq -0x210(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4160
jmp 0x1f640
movl -0x234(%rbp), %esi
leaq -0x160(%rbp), %rdi
leaq -0x166(%rbp), %rdx
movl $0x1, %ecx
leaq -0x188(%rbp), %r8
callq 0x2a760
jmp 0x1f667
leaq -0x188(%rbp), %rdi
callq 0x4200
movl -0xc8(%rbp), %eax
movl %eax, -0x15c(%rbp)
leaq -0xe0(%rbp), %rsi
leaq -0x18e(%rbp), %rdi
callq 0x18e40
jmp 0x1f694
leaq -0x208(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x2a530
jmp 0x1f6a9
movq -0x218(%rbp), %rdi
leaq -0x18e(%rbp), %rsi
leaq -0x208(%rbp), %rdx
callq 0x1f440
jmp 0x1f6c5
leaq -0x208(%rbp), %rdi
callq 0x21f90
leaq -0x160(%rbp), %rdi
callq 0x21f90
leaq -0xe8(%rbp), %rdi
callq 0x26200
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x1f5b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x1f7ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x4200
jmp 0x1f7ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x1f7c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x1f796
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x4200
jmp 0x1f796
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x1f78a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x21f90
leaq -0x160(%rbp), %rdi
callq 0x21f90
leaq -0xe8(%rbp), %rdi
callq 0x26200
jmp 0x1f7c2
leaq -0xa0(%rbp), %rdi
callq 0x15080
leaq -0x68(%rbp), %rdi
callq 0x21fd0
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
leaq -0xa0(%rbp), %rdi
callq 0x15080
leaq -0x68(%rbp), %rdi
callq 0x21fd0
movq -0x70(%rbp), %rdi
callq 0x45b0