// File: /workspace/github_cpp_makefile_star2_O1/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 0x138(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x128(%rsp), %rdi
callq 0x6810
leaq 0x118(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x79b1(%rip), %rdx      # 0x17358
leaq 0x108(%rsp), %rdi
movq %rdx, %rsi
callq 0xc290
movb $0x1, %bpl
leaq 0x128(%rsp), %rdx
leaq 0x108(%rsp), %rcx
movq %r14, %rdi
movl 0x8(%rsp), %esi
callq 0x12f8a
leaq 0x90(%rbx), %rdi
leaq 0x30(%rsp), %rdx
movq %r14, (%rdx)
xorl %ebp, %ebp
leaq 0xc(%rsp), %rsi
callq 0x13d6a
movq 0x108(%rsp), %rdi
cmpq %r12, %rdi
je 0xfa0e
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x128(%rsp), %rdi
cmpq %r15, %rdi
je 0xfa2b
movq 0x138(%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 0xd170
leaq 0xf8(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0xe8(%rsp), %rdi
callq 0x6810
leaq 0x2a(%rsp), %rdx
leaq 0xe8(%rsp), %r8
movq 0x10(%rsp), %rdi
movl %r15d, %esi
movl 0x8(%rsp), %ecx
callq 0x160c0
movq 0xe8(%rsp), %rdi
cmpq %r12, %rdi
je 0xfab1
movq 0xf8(%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 0xd170
leaq 0xd8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0x6810
leaq 0x24(%rsp), %rdx
leaq 0xc8(%rsp), %r8
movq %r15, %rdi
movl %r12d, %esi
movl 0x8(%rsp), %ecx
callq 0x160c0
movq 0xc8(%rsp), %rdi
cmpq %rbp, %rdi
je 0xfb32
movq 0xd8(%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 0xd170
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x6810
leaq 0x1e(%rsp), %rdx
leaq 0xa8(%rsp), %r8
movq %r12, %rdi
movl %ebp, %esi
movl 0x8(%rsp), %ecx
callq 0x160c0
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xfbb1
movq 0xb8(%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 0x6810
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0xffbc
movq 0x148(%rsp), %rdi
cmpq %r14, %rdi
movq 0x10(%rsp), %r14
je 0xfc0a
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x16384
movq 0x50(%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
movq 0x50(%rsp), %rdx
addq $0x8, %rdx
movq 0x30(%rsp), %rcx
movl 0x38(%rsp), %r8d
callq 0x6ed0
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
callq 0x16384
movq 0x50(%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
movq 0x50(%rsp), %rdx
addq $0x28, %rdx
movq 0x88(%rsp), %rcx
movl 0x90(%rsp), %r8d
callq 0x6ed0
leaq 0x68(%rsp), %rdi
movq %r12, %rsi
callq 0x16384
movq 0x50(%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
movq 0x50(%rsp), %rdx
addq $0x48, %rdx
movq 0x68(%rsp), %rcx
movl 0x70(%rsp), %r8d
callq 0x6ed0
movq 0x58(%r14), %rdi
leaq 0x68(%r14), %rax
cmpq %rax, %rdi
je 0xfcbe
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %rax
cmpq %rax, %rdi
je 0xfcd6
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x8(%r14), %rdi
movq %r14, %rax
addq $0x18, %rax
cmpq %rax, %rdi
je 0xfcf1
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 0xfd16
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x28(%r15), %rdi
leaq 0x38(%r15), %rax
cmpq %rax, %rdi
je 0xfd2e
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x8(%r15), %rdi
movq %r15, %rax
addq $0x18, %rax
cmpq %rax, %rdi
je 0xfd49
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 0xfd70
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x28(%r12), %rdi
leaq 0x38(%r12), %rax
cmpq %rax, %rdi
je 0xfd8a
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x8(%r12), %rdi
movq %r12, %rax
addq $0x18, %rax
cmpq %rax, %rdi
je 0xfda6
movq (%rax), %rsi
incq %rsi
callq 0x3280
movl $0x78, %esi
movq %r12, %rdi
callq 0x3280
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfdce
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfdef
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe0a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x50(%rsp), %rdi
callq 0xbc10
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe4b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfe4b
jmp 0xfe48
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe73
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfe73
jmp 0xfe70
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe93
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xfe93
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xbc10
jmp 0xffb4
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r14, %rdi
je 0xffb4
movq 0x158(%rsp), %rsi
incq %rsi
jmp 0xffaf
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xff3f
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xff3f
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %rbp, %rdi
je 0xff4c
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xff4c
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %r12, %rdi
je 0xff59
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0xff59
movq %rax, %rbx
movb $0x1, %bpl
jmp 0xff85
movq %rax, %rbx
movb $0x1, %bpl
jmp 0xffa2
movq %rax, %rbx
movl $0x78, %esi
movq %r12, %rdi
jmp 0xffaf
movq %rax, %rbx
movl $0x78, %esi
movq %r15, %rdi
jmp 0xffaf
movq %rax, %rbx
movl $0x78, %esi
movq 0x10(%rsp), %rdi
jmp 0xffaf
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r12, %rdi
je 0xff85
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x128(%rsp), %rdi
cmpq %r15, %rdi
je 0xffa2
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3280
testb %bpl, %bpl
je 0xffb4
movl $0x58, %esi
movq %r14, %rdi
callq 0x3280
movq %rbx, %rdi
callq 0x3450