// File: /workspace/github_cpp_makefile_star2_O3/zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::clientReadDelete(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, MessageType)
void MP2Node::clientReadDelete(string key, MessageType t) {
    // construct message
    int transID = this->lowestTransID++;
    this->transID2Bundle.emplace(transID, new Bundle(t, key, ""));

    Message *primary_message = new Message(transID, this->memberNode->addr, t, key);
    Message *secondary_message = new Message(transID, this->memberNode->addr, t, key);
    Message *tertiary_message = new Message(transID, this->memberNode->addr, t, key);

    // find primary replica position
    // size_t position = this->hashFunction(key);

    vector<Node> v = findNodes(key);
    // cout << "there are " << v.size() << " nodes for this key" << endl;

    // Address _toAddr = this->ring[position].nodeAddress;
    string primary_string = primary_message->toString();
    emulNet->ENsend(&(this->memberNode->addr), &(v[0].nodeAddress), (char *)primary_string.c_str(), primary_string.size());

    // _toAddr = this->ring[position+1].nodeAddress;
    string secondary_string = secondary_message->toString();
    emulNet->ENsend(&(this->memberNode->addr), &(v[1].nodeAddress), (char *)secondary_string.c_str(), secondary_string.size());

    // _toAddr = this->ring[position+2].nodeAddress;
    string tertiary_string = tertiary_message->toString();
    emulNet->ENsend(&(this->memberNode->addr), &(v[2].nodeAddress), (char *)tertiary_string.c_str(), tertiary_string.size());

    delete primary_message;
    delete secondary_message;
    delete tertiary_message;

    // these messages go to the three replicas and the coordinator waits for responses
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movl %edx, 0x8(%rsp)
movq %rsi, %r13
movq %rdi, %rbx
movl 0x88(%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x88(%rdi)
movl %eax, 0xc(%rsp)
movl $0x58, %edi
callq 0x3270
movq %rax, %r14
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x6790
leaq 0x138(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x7d2f(%rip), %rdx      # 0x17358
leaq 0x128(%rsp), %rdi
movq %rdx, %rsi
callq 0xc184
movb $0x1, %bpl
leaq 0x30(%rsp), %rdx
leaq 0x128(%rsp), %rcx
movq %r14, %rdi
movl 0x8(%rsp), %esi
callq 0x12ce2
leaq 0x90(%rbx), %rdi
leaq 0x50(%rsp), %rdx
movq %r14, (%rdx)
xorl %ebp, %ebp
leaq 0xc(%rsp), %rsi
callq 0x13ace
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0xf68d
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0xf6a4
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
movl $0x78, %edi
callq 0x3270
movq %rax, 0x10(%rsp)
movl 0xc(%rsp), %r15d
movq 0x50(%rbx), %rsi
addq $0x8, %rsi
leaq 0x2a(%rsp), %rdi
callq 0xd01c
leaq 0x118(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x108(%rsp), %rdi
callq 0x6790
leaq 0x2a(%rsp), %rdx
leaq 0x108(%rsp), %r8
movq 0x10(%rsp), %rdi
movl %r15d, %esi
movl 0x8(%rsp), %ecx
callq 0x15e18
movq 0x108(%rsp), %rdi
cmpq %r12, %rdi
je 0xf72a
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x3280
movl $0x78, %edi
callq 0x3270
movq %rax, %r15
movl 0xc(%rsp), %r12d
movq 0x50(%rbx), %rsi
addq $0x8, %rsi
leaq 0x24(%rsp), %rdi
callq 0xd01c
leaq 0xf8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0xe8(%rsp), %rdi
callq 0x6790
leaq 0x24(%rsp), %rdx
leaq 0xe8(%rsp), %r8
movq %r15, %rdi
movl %r12d, %esi
movl 0x8(%rsp), %ecx
callq 0x15e18
movq 0xe8(%rsp), %rdi
cmpq %rbp, %rdi
je 0xf7ab
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x3280
movl $0x78, %edi
callq 0x3270
movq %rax, %r12
movl 0xc(%rsp), %ebp
movq 0x50(%rbx), %rsi
addq $0x8, %rsi
leaq 0x1e(%rsp), %rdi
callq 0xd01c
leaq 0xd8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0x6790
leaq 0x1e(%rsp), %rdx
leaq 0xc8(%rsp), %r8
movq %r12, %rdi
movl %ebp, %esi
movl 0x8(%rsp), %ecx
callq 0x15e18
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0xf82a
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x158(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x148(%rsp), %r13
movq %r13, %rdi
callq 0x6790
leaq 0x70(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0xfc56
movq 0x148(%rsp), %rdi
cmpq %r14, %rdi
movq 0x10(%rsp), %r14
je 0xf883
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x160dc
movq 0x50(%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
movq 0x70(%rsp), %rdx
addq $0x8, %rdx
movq 0x50(%rsp), %rcx
movl 0x58(%rsp), %r8d
callq 0x6e4c
leaq 0xa8(%rsp), %rdi
movq %r15, %rsi
callq 0x160dc
movq 0x50(%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
movq 0x70(%rsp), %rdx
addq $0x28, %rdx
movq 0xa8(%rsp), %rcx
movl 0xb0(%rsp), %r8d
callq 0x6e4c
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0x160dc
movq 0x50(%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
movq 0x70(%rsp), %rdx
addq $0x48, %rdx
movq 0x88(%rsp), %rcx
movl 0x90(%rsp), %r8d
callq 0x6e4c
movq 0x58(%r14), %rdi
leaq 0x68(%r14), %rax
cmpq %rax, %rdi
je 0xf940
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %rax
cmpq %rax, %rdi
je 0xf958
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x8(%r14), %rdi
movq %r14, %rax
addq $0x18, %rax
cmpq %rax, %rdi
je 0xf973
movq (%rax), %rsi
incq %rsi
callq 0x3280
movl $0x78, %esi
movq %r14, %rdi
callq 0x3280
movq 0x58(%r15), %rdi
leaq 0x68(%r15), %rax
cmpq %rax, %rdi
je 0xf998
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x28(%r15), %rdi
leaq 0x38(%r15), %rax
cmpq %rax, %rdi
je 0xf9b0
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x8(%r15), %rdi
movq %r15, %rax
addq $0x18, %rax
cmpq %rax, %rdi
je 0xf9cb
movq (%rax), %rsi
incq %rsi
callq 0x3280
movl $0x78, %esi
movq %r15, %rdi
callq 0x3280
movq 0x58(%r12), %rdi
leaq 0x68(%r12), %rax
cmpq %rax, %rdi
je 0xf9f2
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x28(%r12), %rdi
leaq 0x38(%r12), %rax
cmpq %rax, %rdi
je 0xfa0c
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x8(%r12), %rdi
movq %r12, %rax
addq $0x18, %rax
cmpq %rax, %rdi
je 0xfa28
movq (%rax), %rsi
incq %rsi
callq 0x3280
movl $0x78, %esi
movq %r12, %rdi
callq 0x3280
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfa56
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfa77
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfa92
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x70(%rsp), %rdi
callq 0xbaf6
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfad9
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfad9
jmp 0xfad6
movq %rax, %rbx
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfb01
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfb01
jmp 0xfafe
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfb21
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfb21
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xbaf6
jmp 0xfc4d
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r14, %rdi
je 0xfc4d
movq 0x158(%rsp), %rsi
incq %rsi
jmp 0xfc48
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0xfbde
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfbde
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %rbp, %rdi
je 0xfbeb
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfbeb
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r12, %rdi
je 0xfbf8
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfbf8
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0xfc40
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfc40
movq %rax, %rbx
jmp 0xfc40
movq %rax, %rbx
movl $0x78, %esi
movq %r12, %rdi
jmp 0xfc48
movq %rax, %rbx
movl $0x78, %esi
movq %r15, %rdi
jmp 0xfc48
movq %rax, %rbx
movl $0x78, %esi
movq 0x10(%rsp), %rdi
jmp 0xfc48
movq %rax, %rbx
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0xfc24
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0xfc3b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
testb %bpl, %bpl
je 0xfc4d
movl $0x58, %esi
movq %r14, %rdi
callq 0x3280
movq %rbx, %rdi
callq 0x3450
nop