// File: /workspace/github_cpp_makefile_star2_O3/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: MP1Node::PublishToAll(MessageHdr const&, unsigned long)
void MP1Node::PublishToAll(const MessageHdr &msg, size_t size)
{
    // std::cout << "Start PublishToAll "
    // << " " << this_node_ << "," << msg.msgType << "\n";
    for (int i = 0; i < memberNode->memberList.size(); ++i)
    {
        auto &e = memberNode->memberList[i];
        if (e.getid() == this_node_)
            continue;
        Address a(std::to_string(e.getid()) + ":" + std::to_string(e.getport()));
        if (!emulNet->ENsend(&memberNode->addr, &a, (char *)&msg, size))
        {
            // failed to send to this node.
        }
    }
    // std::cout << "End PublishToAll\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq 0x20(%rdi), %rcx
movq 0x28(%rcx), %rax
cmpq %rax, 0x30(%rcx)
je 0x5101
movq %rdi, %r15
xorl %r14d, %r14d
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
movq %rdi, 0x88(%rsp)
leaq (%r14,%r14,2), %rcx
leaq (%rax,%rcx,8), %rbp
movq %rbp, %rdi
callq 0xcdae
cmpl 0xa4(%r15), %eax
je 0x50de
movq %rbp, %rdi
callq 0xcdae
movl %eax, %r13d
movl %eax, %r12d
negl %r12d
cmovsl %eax, %r12d
movl $0x1, %ebx
cmpl $0xa, %r12d
jb 0x4e82
movl $0x4, %ebx
movl %r12d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x4e7b
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x4e80
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x4e82
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebx
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x4e4d
addl $-0x3, %ebx
jmp 0x4e82
addl $-0x2, %ebx
jmp 0x4e82
decl %ebx
shrl $0x1f, %r13d
leal (%rbx,%r13), %esi
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x68(%rsp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x32f0
addq 0x68(%rsp), %r13
movq %r13, %rdi
movl %ebx, %esi
movl %r12d, %edx
callq 0x5c6b
movq %r15, %rdi
leaq 0x13edb(%rip), %rsi     # 0x18d9d
callq 0x34a0
leaq 0x18(%rsp), %rsi
movq %rsi, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4eef
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x4ef5
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbp, %rdi
callq 0xcdb2
leaq 0x58(%rsp), %rbp
movswl %ax, %r13d
movl %r13d, %ebx
negl %ebx
cmovsl %r13d, %ebx
movl $0x1, %r12d
cmpl $0xa, %ebx
jb 0x4f5b
movl $0x2, %r12d
cmpl $0x64, %ebx
jb 0x4f5b
movl $0x3, %r12d
cmpl $0x3e8, %ebx            # imm = 0x3E8
jb 0x4f5b
cmpl $0x2710, %ebx           # imm = 0x2710
movl $0x5, %r12d
sbbl $0x0, %r12d
shrl $0x1f, %r13d
leal (%r12,%r13), %esi
movq %rbp, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
movl $0x2d, %edx
callq 0x32f0
movl %r13d, %edi
addq 0x48(%rsp), %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x5c6b
movq 0x8(%rsp), %rcx
movl $0xf, %edi
leaq 0x18(%rsp), %rbx
cmpq %rbx, %rcx
je 0x4fa2
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %r8
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
leaq 0x38(%rsp), %r12
leaq 0xa2(%rsp), %r13
jbe 0x4fdb
movl $0xf, %edi
cmpq %rbp, %rsi
je 0x4fd6
movq 0x58(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x4fe7
leaq 0x8(%rsp), %rdi
callq 0x30d0
jmp 0x4ff5
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32c0
movq %r12, 0x28(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x5015
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x501d
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq %r13, %rdi
leaq 0x28(%rsp), %rsi
callq 0x572e
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x505e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
movq 0x88(%rsp), %r15
je 0x507d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5094
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
je 0x50ba
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x8(%r15), %rdi
movq 0x20(%r15), %rsi
addq $0x8, %rsi
movq %r13, %rdx
movq 0x90(%rsp), %rcx
movq 0x98(%rsp), %r8
callq 0x6994
incq %r14
movq 0x20(%r15), %rcx
movq 0x28(%rcx), %rax
movq 0x30(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
imulq %rbx, %rcx
cmpq %r14, %rcx
ja 0x4e03
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x5137
movq %rax, %rbx
jmp 0x5174
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x5137
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x5158
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x5158
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5174
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x5190
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3470