// File: dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::ThunderNetworkInfo(std::_Rb_tree_iterator<std::pair<CMACAddress const, CDlanMonitor::NetwAdapter>>, CMACAddress const&, CDlanMonitor::NetworkInfoResponse const&)
void CDlanMonitor::ThunderNetworkInfo(
  std::map<CMACAddress,NetwAdapter>::iterator itNIC,  
  const CMACAddress& addr, 
  const NetworkInfoResponse& nwinfo)
{
  bool bUpdate = false;
    
  itNIC->second.mapNetworkInfoResponses[addr] = nwinfo;
    
  std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.find(addr);
  if(itLocalDevice != itNIC->second.mapLocalDevices.end())
  {
    for(std::list<HomePlugAvMMEs::ThunderNetworkInfo::StationInfo>::const_iterator itStation = nwinfo.stations.begin();
      (itStation != nwinfo.stations.end()); itStation++)
    {
      std::map<CMACAddress,std::string>::const_iterator itVersion;
      if((itVersion = itNIC->second.mapGetVersionResponses.find(itStation->GetAddress())) != 
        itNIC->second.mapGetVersionResponses.end())
      {
        std::map<CMACAddress,UserDataResponse>::iterator itUserData = itNIC->second.mapUserDataResponses.find(itStation->GetAddress());
        bool bKeepUserData = (itUserData == itNIC->second.mapUserDataResponses.end());

        UpdateRemoteDevice(itLocalDevice->second, itStation->GetAddress(), true,
          CDlanDevice::eThunderbolt, false, itVersion->second, false, 
          bKeepUserData ? UserDataResponse() : itUserData->second, bKeepUserData,
          itStation->GetTxRawRate(), itStation->GetRxRawRate(), false, 
          std::map<CMACAddress, CDlanDataRates>(), true, itStation->GetFirstBridgedAddress(), false, bUpdate);
      }
    }
  }
  else
  {
    for(std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.begin();
      (itLocalDevice != itNIC->second.mapLocalDevices.end()); ++itLocalDevice)
    {
      if(itLocalDevice->second.mapRemoteDeviceAges.find(addr) != itLocalDevice->second.mapRemoteDeviceAges.end())
      {
        std::map<CMACAddress, CDlanDataRates> remoteDataRates;
        for(std::list<HomePlugAvMMEs::ThunderNetworkInfo::StationInfo>::const_iterator itStation = nwinfo.stations.begin(); 
          (itStation != nwinfo.stations.end()); itStation++)
        {
          remoteDataRates[itStation->GetAddress()] = CDlanDataRates(itStation->GetTxRawRate(), itStation->GetRxRawRate());
        }
        
        UpdateRemoteDevice(itLocalDevice->second, addr, false, CDlanDevice::eThunderbolt, false, 
          "", true, UserDataResponse(), true, 0.0, 0.0, true, remoteDataRates, false, CMACAddress(), true, bUpdate);

        break;
      }
    }

    if(bUpdate)
      OnUpdate();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x290(%rbp)
movb $0x0, -0x21(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x130, %rdi            # imm = 0x130
movq -0x18(%rbp), %rsi
callq 0x1ac00
movq -0x288(%rbp), %rsi
movq %rax, %rdi
callq 0x1ace0
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
movq -0x18(%rbp), %rsi
callq 0x185e0
movq %rax, -0x30(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17fc0
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x17f90
testb $0x1, %al
jne 0x16e2e
jmp 0x17189
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x18750
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x187b0
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x18780
testb $0x1, %al
jne 0x16e66
jmp 0x17184
leaq -0x50(%rbp), %rdi
callq 0x19ef0
leaq -0x8(%rbp), %rdi
callq 0x17d40
addq $0x8, %rax
addq $0xd0, %rax
movq %rax, -0x298(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x18800
movq -0x298(%rbp), %rdi
movq %rax, %rsi
callq 0x18840
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x19f40
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0xd0, %rdi
callq 0x18870
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x19f40
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x19f10
testb $0x1, %al
jne 0x16f05
jmp 0x1716b
leaq -0x8(%rbp), %rdi
callq 0x17d40
addq $0x8, %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0x2b8(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x18800
movq -0x2b8(%rbp), %rdi
movq %rax, %rsi
callq 0x188d0
movq %rax, -0x78(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x18900
movq %rax, -0x88(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x188a0
andb $0x1, %al
movb %al, -0x79(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x17e00
addq $0x8, %rax
movq %rax, -0x2b0(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x18800
movq %rax, -0x2a8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x19f60
addq $0x8, %rax
movq %rax, -0x2a0(%rbp)
testb $0x1, -0x79(%rbp)
je 0x16fcf
leaq -0x108(%rbp), %rdi
callq 0x18100
jmp 0x16feb
leaq -0x78(%rbp), %rdi
callq 0x19f80
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x108(%rbp), %rdi
callq 0x19fa0
movb -0x79(%rbp), %al
movb %al, -0x2c1(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x1a7c0
movsd %xmm0, -0x2c0(%rbp)
jmp 0x1700f
leaq -0x40(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x1a7f0
movsd %xmm0, -0x2d0(%rbp)
jmp 0x1702a
xorps %xmm0, %xmm0
movaps %xmm0, -0x130(%rbp)
movaps %xmm0, -0x140(%rbp)
movaps %xmm0, -0x150(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x18220
leaq -0x40(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x1a820
movq %rax, -0x2d8(%rbp)
jmp 0x17068
movsd -0x2d0(%rbp), %xmm1
movsd -0x2c0(%rbp), %xmm0
movq -0x2a8(%rbp), %rdx
movq -0x2b0(%rbp), %rsi
movq -0x290(%rbp), %rdi
movq -0x2a0(%rbp), %rcx
movb -0x2c1(%rbp), %r8b
movq -0x2d8(%rbp), %r9
movq %rsp, %rax
movq %rax, -0x2e0(%rbp)
leaq -0x21(%rbp), %r10
movq %r10, 0x48(%rax)
movq %r9, 0x38(%rax)
leaq -0x150(%rbp), %r9
movq %r9, 0x28(%rax)
movzbl %r8b, %r8d
andl $0x1, %r8d
movl %r8d, 0x18(%rax)
leaq -0x108(%rbp), %r8
movq %r8, 0x10(%rax)
movq %rcx, (%rax)
movl $0x0, 0x40(%rax)
movl $0x1, 0x30(%rax)
movl $0x0, 0x20(%rax)
movl $0x0, 0x8(%rax)
movl $0x1, %ecx
movl $0x2, %r8d
xorl %r9d, %r9d
callq 0x120e0
jmp 0x1710e
leaq -0x150(%rbp), %rdi
callq 0xacb0
leaq -0x108(%rbp), %rdi
callq 0x9d10
jmp 0x1716b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x1715a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xacb0
leaq -0x108(%rbp), %rdi
callq 0x9d10
jmp 0x1758c
jmp 0x1716d
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x1aa30
movq %rax, -0x158(%rbp)
jmp 0x16e3f
jmp 0x17583
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17dd0
movq %rax, -0x160(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17fc0
movq %rax, -0x168(%rbp)
leaq -0x160(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x17f90
testb $0x1, %al
jne 0x171eb
jmp 0x1756f
leaq -0x160(%rbp), %rdi
callq 0x17e00
movq %rax, %rdi
addq $0x8, %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
callq 0x18080
movq %rax, -0x170(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x17e00
movq %rax, %rdi
addq $0x8, %rdi
addq $0x10, %rdi
callq 0x180b0
movq %rax, -0x178(%rbp)
leaq -0x170(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x18050
testb $0x1, %al
jne 0x17251
jmp 0x1755c
leaq -0x1a8(%rbp), %rdi
callq 0x18220
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x18750
movq %rax, -0x1b0(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x187b0
movq %rax, -0x1b8(%rbp)
leaq -0x1b0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x18780
testb $0x1, %al
jne 0x172a1
jmp 0x1737c
leaq -0x1b0(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x1a7c0
movsd %xmm0, -0x2e8(%rbp)
jmp 0x172bf
leaq -0x1b0(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x1a7f0
movsd %xmm0, -0x2f0(%rbp)
jmp 0x172dd
movsd -0x2f0(%rbp), %xmm1
movsd -0x2e8(%rbp), %xmm0
leaq -0x1c8(%rbp), %rdi
callq 0x1ad20
jmp 0x172fb
leaq -0x1b0(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x18800
movq %rax, -0x2f8(%rbp)
jmp 0x17318
movq -0x2f8(%rbp), %rsi
leaq -0x1a8(%rbp), %rdi
callq 0x1ad50
movq %rax, -0x300(%rbp)
jmp 0x17334
movq -0x300(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0xe320
jmp 0x17349
jmp 0x1734b
leaq -0x1b0(%rbp), %rdi
xorl %esi, %esi
callq 0x1aa30
movq %rax, -0x1d0(%rbp)
jmp 0x17271
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x1754e
leaq -0x160(%rbp), %rdi
callq 0x17e00
addq $0x8, %rax
movq %rax, -0x318(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x310(%rbp)
leaq -0x1f1(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0x5540
movq -0x308(%rbp), %rdx
leaq 0x20da2(%rip), %rsi     # 0x38161
leaq -0x1f0(%rbp), %rdi
callq 0x62a0
jmp 0x173cd
leaq -0x278(%rbp), %rdi
callq 0x18100
jmp 0x173db
movq %rsp, %rax
movl $0x0, (%rax)
leaq -0x27e(%rbp), %rdi
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x6230
jmp 0x17401
movq -0x310(%rbp), %rdx
movq -0x318(%rbp), %rsi
movq -0x290(%rbp), %rdi
movq %rsp, %rax
movq %rax, -0x320(%rbp)
leaq -0x21(%rbp), %rcx
movq %rcx, 0x48(%rax)
leaq -0x27e(%rbp), %rcx
movq %rcx, 0x38(%rax)
leaq -0x1a8(%rbp), %rcx
movq %rcx, 0x28(%rax)
leaq -0x278(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x1f0(%rbp), %rcx
movq %rcx, (%rax)
movl $0x1, 0x40(%rax)
movl $0x0, 0x30(%rax)
movl $0x1, 0x20(%rax)
movl $0x1, 0x18(%rax)
movl $0x1, 0x8(%rax)
movl $0x2, %r8d
xorl %r9d, %r9d
xorps %xmm1, %xmm1
movl %r9d, %ecx
movaps %xmm1, %xmm0
callq 0x120e0
jmp 0x1748f
leaq -0x27e(%rbp), %rdi
callq 0x6b70
leaq -0x278(%rbp), %rdi
callq 0x9d10
leaq -0x1f0(%rbp), %rdi
callq 0x5240
leaq -0x1f1(%rbp), %rdi
callq 0x5380
leaq -0x1a8(%rbp), %rdi
callq 0xacb0
jmp 0x1756f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x17542
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x17536
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x1752a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x27e(%rbp), %rdi
callq 0x6b70
leaq -0x278(%rbp), %rdi
callq 0x9d10
leaq -0x1f0(%rbp), %rdi
callq 0x5240
leaq -0x1f1(%rbp), %rdi
callq 0x5380
leaq -0x1a8(%rbp), %rdi
callq 0xacb0
jmp 0x1758c
jmp 0x1755e
leaq -0x160(%rbp), %rdi
callq 0x18270
jmp 0x171ac
testb $0x1, -0x21(%rbp)
je 0x17581
movq -0x290(%rbp), %rdi
callq 0x17980
jmp 0x17583
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0x110(%rbp), %rdi
callq 0x5530
nopl (%rax,%rax)