// File: /workspace/github_cpp_makefile_star2_O1/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 0x51bd
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 0xced2
cmpl 0xa4(%r15), %eax
je 0x519a
movq %rbp, %rdi
callq 0xced2
movl %eax, %r13d
movl %eax, %r12d
negl %r12d
cmovsl %eax, %r12d
movl $0x1, %ebx
cmpl $0xa, %r12d
jb 0x4f3c
movl $0x4, %ebx
movl %r12d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x4f35
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x4f3a
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x4f3c
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebx
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x4f07
addl $-0x3, %ebx
jmp 0x4f3c
addl $-0x2, %ebx
jmp 0x4f3c
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 0x5d13
movq %r15, %rdi
leaq 0x13e61(%rip), %rsi     # 0x18ddd
callq 0x34a0
leaq 0x18(%rsp), %rsi
movq %rsi, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4fa9
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x4faf
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 0xced6
leaq 0x38(%rsp), %rbp
movswl %ax, %r13d
movl %r13d, %ebx
negl %ebx
cmovsl %r13d, %ebx
movl $0x1, %r12d
cmpl $0xa, %ebx
jb 0x5015
movl $0x2, %r12d
cmpl $0x64, %ebx
jb 0x5015
movl $0x3, %r12d
cmpl $0x3e8, %ebx            # imm = 0x3E8
jb 0x5015
cmpl $0x2710, %ebx           # imm = 0x2710
movl $0x5, %r12d
sbbl $0x0, %r12d
shrl $0x1f, %r13d
leal (%r12,%r13), %esi
movq %rbp, 0x28(%rsp)
leaq 0x28(%rsp), %rdi
movl $0x2d, %edx
callq 0x32f0
movl %r13d, %edi
addq 0x28(%rsp), %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x5d13
movq 0x8(%rsp), %rcx
movl $0xf, %esi
leaq 0x18(%rsp), %rbx
cmpq %rbx, %rcx
je 0x505c
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %r8
movq 0x30(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
leaq 0x58(%rsp), %r12
leaq 0xa2(%rsp), %r13
jbe 0x5092
movl $0xf, %esi
cmpq %rbp, 0x28(%rsp)
je 0x508d
movq 0x38(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x50a3
movq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x30d0
jmp 0x50b1
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32c0
movq %r12, 0x48(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x50d1
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x50d9
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq %r13, %rdi
leaq 0x48(%rsp), %rsi
callq 0x57dc
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x511a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
movq 0x88(%rsp), %r15
je 0x5139
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5150
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 0x5176
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 0x69dc
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 0x4ebd
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x51f3
movq %rax, %rbx
jmp 0x5230
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x51f3
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5214
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x5214
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5230
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x524c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3470