// File: dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::SendRemoteDeviceBroadcasts(std::_Rb_tree_iterator<std::pair<CMACAddress const, CDlanMonitor::NetwAdapter>>)
void CDlanMonitor::SendRemoteDeviceBroadcasts(
  std::map<CMACAddress,NetwAdapter>::iterator itNIC)
{
  size_t iAvDeviceCnt = 0;
  for(std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.begin();
    (itLocalDevice != itNIC->second.mapLocalDevices.end()); ++itLocalDevice)
  {
    if(itLocalDevice->second.itPublicDevice->GetType() == CDlanDevice::eThunderbolt)
      iAvDeviceCnt++;
  }

  if(itNIC->second.mapLocalDevices.size() > iAvDeviceCnt)
  {
    if(((m_eMode & eMonitorHP1) == eMonitorHP1) || ((m_eMode & eMonitorTurbo) == eMonitorTurbo))
    {
      itNIC->second.queuePendingPackets.push(
        new HomePlugMMEs::ParamsAndStats::CRequest(CMACAddress::Broadcast(), itNIC->first));

      itNIC->second.queuePendingPackets.push(
        new HomePlugMMEs::TurboChannelCapacities::CRequest(CMACAddress::Broadcast(), itNIC->first, 
        HomePlugMMEs::TurboChannelCapacities::eDirectionFlagTxCaps));
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x18(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17dd0
movq %rax, -0x20(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17fc0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x17f90
testb $0x1, %al
jne 0x12cd6
jmp 0x12d15
leaq -0x20(%rbp), %rdi
callq 0x17e00
movq %rax, %rdi
addq $0x8, %rdi
addq $0x8, %rdi
callq 0x181c0
movq %rax, %rdi
callq 0x65f0
cmpl $0x2, %eax
jne 0x12d08
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12d0a
leaq -0x20(%rbp), %rdi
callq 0x18270
jmp 0x12ca3
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x184c0
cmpq -0x18(%rbp), %rax
jbe 0x12eba
movq -0x60(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x3, %eax
cmpl $0x3, %eax
je 0x12d5d
movq -0x60(%rbp), %rax
movl 0x20(%rax), %eax
andl $0xc, %eax
cmpl $0xc, %eax
jne 0x12eb8
leaq -0x8(%rbp), %rdi
callq 0x17d40
addq $0x198, %rax            # imm = 0x198
movq %rax, -0x70(%rbp)
movl $0x20, %edi
callq 0x5320
movq %rax, -0x68(%rbp)
movb $0x1, -0x45(%rbp)
leaq -0x36(%rbp), %rdi
callq 0x6940
jmp 0x12d8d
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq -0x68(%rbp), %rdi
movq %rax, %rdx
leaq -0x36(%rbp), %rsi
callq 0x184e0
jmp 0x12da8
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rax
movb $0x0, -0x45(%rbp)
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x182a0
jmp 0x12dc3
leaq -0x36(%rbp), %rdi
callq 0x6b70
leaq -0x8(%rbp), %rdi
callq 0x17d40
addq $0x198, %rax            # imm = 0x198
movq %rax, -0x80(%rbp)
movl $0x20, %edi
callq 0x5320
movq %rax, -0x78(%rbp)
movb $0x1, -0x57(%rbp)
leaq -0x56(%rbp), %rdi
callq 0x6940
jmp 0x12dfc
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq -0x78(%rbp), %rdi
movq %rax, %rdx
leaq -0x56(%rbp), %rsi
movl $0x1, %ecx
callq 0x18540
jmp 0x12e1c
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rax
movb $0x0, -0x57(%rbp)
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rsi
callq 0x182a0
jmp 0x12e37
leaq -0x56(%rbp), %rdi
callq 0x6b70
jmp 0x12eb8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x36(%rbp), %rdi
callq 0x6b70
testb $0x1, -0x45(%rbp)
jne 0x12e6d
jmp 0x12e7b
movq -0x68(%rbp), %rdi
movl $0x20, %esi
callq 0x5330
jmp 0x12ec3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12ea0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x56(%rbp), %rdi
callq 0x6b70
testb $0x1, -0x57(%rbp)
jne 0x12ea8
jmp 0x12eb6
movq -0x78(%rbp), %rdi
movl $0x20, %esi
callq 0x5330
jmp 0x12ec3
jmp 0x12eba
addq $0x80, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x5530
nopl (%rax)