// File: dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::OnThunderGetVersionConfirm(CMACAddress const&, HomePlugAvMMEs::ThunderGetVersion::CConfirm const&)
void CDlanMonitor::OnThunderGetVersionConfirm(
  const CMACAddress& adapter, 
  const HomePlugAvMMEs::ThunderGetVersion::CConfirm& mme)
{
  std::map<CMACAddress,NetwAdapter>::iterator itNIC;

  if(((itNIC = m_mapNICs.find(adapter)) != m_mapNICs.end()) &&
    (mme.GetStatus() == HomePlugAvMMEs::ThunderGetVersion::eSuccess))
  {
    bool bUpdate = false;

    itNIC->second.mapGetVersionResponses[mme.GetAddress()] = mme.GetVersion();

    std::map<CMACAddress,UserDataResponse>::iterator itUserData = itNIC->second.mapUserDataResponses.find(mme.GetAddress());
    bool bKeepUserData = (itUserData == itNIC->second.mapUserDataResponses.end());
    
    std::map<CMACAddress,NetworkInfoResponse>::const_iterator itNetworkInfo = itNIC->second.mapNetworkInfoResponses.find(mme.GetAddress());
    bool bKeepCCo = (itNetworkInfo == itNIC->second.mapNetworkInfoResponses.end());

    if(itNIC->second.setReadModDataResponses.find(mme.GetAddress()) != itNIC->second.setReadModDataResponses.end())
    {
      UpdateLocalDevice(itNIC, mme.GetAddress(), true, CDlanDevice::eThunderbolt, false, 
        mme.GetVersion(), false, bKeepUserData ? UserDataResponse() : itUserData->second, bKeepUserData, 
        bKeepCCo ? CMACAddress::Null() : itNetworkInfo->second.ccoAddr, bKeepCCo, bUpdate);
    }
    else
    {
      bool bDone = false;
      for(itNetworkInfo = itNIC->second.mapNetworkInfoResponses.begin();
        !bDone && (itNetworkInfo != itNIC->second.mapNetworkInfoResponses.end()); ++itNetworkInfo)
      {
        std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.find(itNetworkInfo->first);
        if(itLocalDevice != itNIC->second.mapLocalDevices.end())
        {
          for(std::list<HomePlugAvMMEs::ThunderNetworkInfo::StationInfo>::const_iterator itStation = itNetworkInfo->second.stations.begin();
            !bDone && (itStation != itNetworkInfo->second.stations.end()); ++itStation)
          {
            if(itStation->GetAddress() == mme.GetAddress())
            {
              UpdateRemoteDevice(itLocalDevice->second, itStation->GetAddress(), true,
                CDlanDevice::eThunderbolt, false, mme.GetVersion(), false, 
                bKeepUserData ? UserDataResponse() : itUserData->second, bKeepUserData,
                itStation->GetTxRawRate(), itStation->GetRxRawRate(), false, 
                std::map<CMACAddress, CDlanDataRates>(), true, itStation->GetFirstBridgedAddress(), false, bUpdate);
              bDone = true;
            }
          }
        }
      }
    }

    if(bUpdate)
      OnUpdate();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3e0, %rsp            # imm = 0x3E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2b0(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x193b0
movq -0x2b0(%rbp), %rdi
addq $0xa8, %rdi
movq -0x10(%rbp), %rsi
callq 0x17a40
movq -0x2b0(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
addq $0xa8, %rdi
callq 0x17a70
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x17cb0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x2a1(%rbp)
jne 0x15fd3
jmp 0x15feb
movq -0x18(%rbp), %rdi
callq 0x1a510
movzbl %al, %eax
cmpl $0x0, %eax
sete %al
movb %al, -0x2a1(%rbp)
movb -0x2a1(%rbp), %al
testb $0x1, %al
jne 0x15ffa
jmp 0x16969
movb $0x0, -0x31(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x1a530
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0xd8, %rax
movq %rax, -0x2b8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x5e(%rbp), %rdi
callq 0x1a730
jmp 0x16030
movq -0x2b8(%rbp), %rdi
leaq -0x5e(%rbp), %rsi
callq 0x1a650
movq %rax, -0x2c0(%rbp)
jmp 0x16049
movq -0x2c0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movq %rsi, -0x2e0(%rbp)
callq 0x53f0
leaq -0x5e(%rbp), %rdi
callq 0x6b70
movq -0x2e0(%rbp), %rdi
callq 0x5240
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0x108, %rax            # imm = 0x108
movq %rax, -0x2d8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x7e(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x1a730
movq -0x2d8(%rbp), %rdi
movq -0x2d0(%rbp), %rsi
callq 0x188d0
movq %rax, -0x2c8(%rbp)
jmp 0x160bb
movq -0x2c8(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x7e(%rbp), %rdi
callq 0x6b70
leaq -0x20(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x17d40
movq %rax, %rdi
addq $0x108, %rdi            # imm = 0x108
callq 0x18900
movq %rax, -0x88(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x188a0
movq -0x300(%rbp), %rdi
movb %al, -0x7f(%rbp)
callq 0x17d40
addq $0x138, %rax            # imm = 0x138
movq %rax, -0x2f8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x9e(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x1a730
movq -0x2f8(%rbp), %rdi
movq -0x2f0(%rbp), %rsi
callq 0x1a760
movq %rax, -0x2e8(%rbp)
jmp 0x16154
movq -0x2e8(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
movq %rdi, -0x330(%rbp)
leaq -0x98(%rbp), %rsi
callq 0x18670
leaq -0x9e(%rbp), %rdi
callq 0x6b70
leaq -0x20(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x17d40
movq %rax, %rdi
addq $0x138, %rdi            # imm = 0x138
callq 0x186c0
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x328(%rbp)
leaq -0xb0(%rbp), %rsi
callq 0x18670
movq -0x330(%rbp), %rdi
movq -0x328(%rbp), %rsi
callq 0x1a790
movq -0x320(%rbp), %rdi
movb %al, -0x9f(%rbp)
callq 0x17d40
addq $0xa8, %rax
movq %rax, -0x318(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xbe(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x1a730
movq -0x318(%rbp), %rdi
movq -0x310(%rbp), %rsi
callq 0x197a0
movq %rax, -0x308(%rbp)
jmp 0x1622d
movq -0x308(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0xa0, %rdi
callq 0x179e0
movq %rax, -0xc8(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xe190
movb %al, -0x331(%rbp)
leaq -0xbe(%rbp), %rdi
callq 0x6b70
movb -0x331(%rbp), %al
testb $0x1, %al
jne 0x16292
jmp 0x164d7
movq -0x20(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xd6(%rbp), %rdi
callq 0x1a730
movq -0x18(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x1a530
jmp 0x162bf
testb $0x1, -0x7f(%rbp)
je 0x162d5
leaq -0x178(%rbp), %rdi
callq 0x18100
jmp 0x162d3
jmp 0x162f5
leaq -0x78(%rbp), %rdi
callq 0x19f80
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x178(%rbp), %rdi
callq 0x19fa0
jmp 0x162f3
jmp 0x162f5
movb -0x7f(%rbp), %al
movb %al, -0x332(%rbp)
testb $0x1, -0x9f(%rbp)
je 0x16317
leaq -0x17e(%rbp), %rdi
callq 0xb750
jmp 0x16315
jmp 0x1633a
leaq -0x90(%rbp), %rdi
callq 0x18720
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x17e(%rbp), %rdi
callq 0xc3b0
jmp 0x16338
jmp 0x1633a
movq -0x2b0(%rbp), %rdi
movb -0x332(%rbp), %cl
movq -0xd0(%rbp), %rsi
movzbl -0x9f(%rbp), %edx
movq %rsp, %rax
leaq -0x31(%rbp), %r8
movq %r8, 0x30(%rax)
andl $0x1, %edx
movl %edx, 0x28(%rax)
leaq -0x17e(%rbp), %rdx
movq %rdx, 0x20(%rax)
movzbl %cl, %ecx
andl $0x1, %ecx
movl %ecx, 0x18(%rax)
leaq -0x178(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0xf8(%rbp), %rcx
movq %rcx, (%rax)
movl $0x0, 0x8(%rax)
leaq -0xd6(%rbp), %rdx
movl $0x1, %ecx
movl $0x2, %r8d
xorl %r9d, %r9d
callq 0x11920
jmp 0x163b2
leaq -0x17e(%rbp), %rdi
callq 0x6b70
leaq -0x178(%rbp), %rdi
callq 0x9d10
leaq -0xf8(%rbp), %rdi
callq 0x5240
leaq -0xd6(%rbp), %rdi
callq 0x6b70
jmp 0x16955
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x1640a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x5e(%rbp), %rdi
callq 0x6b70
leaq -0x58(%rbp), %rdi
callq 0x5240
jmp 0x16972
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x7e(%rbp), %rdi
callq 0x6b70
jmp 0x16972
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x9e(%rbp), %rdi
callq 0x6b70
jmp 0x16972
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xbe(%rbp), %rdi
callq 0x6b70
jmp 0x16972
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x164c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x164ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x164ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x17e(%rbp), %rdi
callq 0x6b70
leaq -0x178(%rbp), %rdi
callq 0x9d10
leaq -0xf8(%rbp), %rdi
callq 0x5240
leaq -0xd6(%rbp), %rdi
callq 0x6b70
jmp 0x16972
movb $0x0, -0x17f(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x18640
movq %rax, -0x190(%rbp)
leaq -0x188(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x18670
movq -0x188(%rbp), %rax
movq %rax, -0x90(%rbp)
xorl %eax, %eax
testb $0x1, -0x17f(%rbp)
movb %al, -0x333(%rbp)
jne 0x16582
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x186c0
movq %rax, -0x1a0(%rbp)
leaq -0x198(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x18670
leaq -0x90(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x18690
movb %al, -0x333(%rbp)
movb -0x333(%rbp), %al
testb $0x1, %al
jne 0x16591
jmp 0x16953
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0x8, %rax
addq $0x160, %rax            # imm = 0x160
movq %rax, -0x340(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x18720
movq -0x340(%rbp), %rdi
movq %rax, %rsi
callq 0x185e0
movq %rax, -0x1a8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17fc0
movq %rax, -0x1b0(%rbp)
leaq -0x1a8(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x17f90
testb $0x1, %al
jne 0x1660c
jmp 0x16940
leaq -0x90(%rbp), %rdi
callq 0x18720
movq %rax, %rdi
addq $0x8, %rdi
addq $0x8, %rdi
callq 0x18750
movq %rax, -0x1b8(%rbp)
xorl %eax, %eax
testb $0x1, -0x17f(%rbp)
movb %al, -0x341(%rbp)
jne 0x1667c
leaq -0x90(%rbp), %rdi
callq 0x18720
movq %rax, %rdi
addq $0x8, %rdi
addq $0x8, %rdi
callq 0x187b0
movq %rax, -0x1c0(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x18780
movb %al, -0x341(%rbp)
movb -0x341(%rbp), %al
testb $0x1, %al
jne 0x1668b
jmp 0x1693e
leaq -0x1b8(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x18800
movq %rax, -0x358(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x1c6(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x1a730
movq -0x358(%rbp), %rdi
movq -0x350(%rbp), %rsi
callq 0xb680
movb %al, -0x342(%rbp)
jmp 0x166d8
leaq -0x1c6(%rbp), %rdi
callq 0x6b70
movb -0x342(%rbp), %al
testb $0x1, %al
jne 0x166f3
jmp 0x1692b
leaq -0x1a8(%rbp), %rdi
callq 0x17e00
addq $0x8, %rax
movq %rax, -0x368(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x18800
movq %rax, -0x360(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x1e8(%rbp), %rdi
callq 0x1a530
testb $0x1, -0x7f(%rbp)
je 0x1674b
leaq -0x268(%rbp), %rdi
callq 0x18100
jmp 0x16749
jmp 0x1676b
leaq -0x78(%rbp), %rdi
callq 0x19f80
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x268(%rbp), %rdi
callq 0x19fa0
jmp 0x16769
jmp 0x1676b
movb -0x7f(%rbp), %al
movb %al, -0x371(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x1a7c0
movsd %xmm0, -0x370(%rbp)
jmp 0x16792
leaq -0x1b8(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x1a7f0
movsd %xmm0, -0x380(%rbp)
jmp 0x167b0
xorps %xmm0, %xmm0
movaps %xmm0, -0x280(%rbp)
movaps %xmm0, -0x290(%rbp)
movaps %xmm0, -0x2a0(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x18220
leaq -0x1b8(%rbp), %rdi
callq 0x187e0
movq %rax, %rdi
callq 0x1a820
movq %rax, -0x388(%rbp)
jmp 0x167f1
movsd -0x380(%rbp), %xmm1
movsd -0x370(%rbp), %xmm0
movq -0x360(%rbp), %rdx
movq -0x368(%rbp), %rsi
movq -0x2b0(%rbp), %rdi
movb -0x371(%rbp), %cl
movq -0x388(%rbp), %r8
movq %rsp, %rax
movq %rax, -0x390(%rbp)
leaq -0x31(%rbp), %r9
movq %r9, 0x48(%rax)
movq %r8, 0x38(%rax)
leaq -0x2a0(%rbp), %r8
movq %r8, 0x28(%rax)
movzbl %cl, %ecx
andl $0x1, %ecx
movl %ecx, 0x18(%rax)
leaq -0x268(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x1e8(%rbp), %rcx
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 0x16893
leaq -0x2a0(%rbp), %rdi
callq 0xacb0
leaq -0x268(%rbp), %rdi
callq 0x9d10
leaq -0x1e8(%rbp), %rdi
callq 0x5240
movb $0x1, -0x17f(%rbp)
jmp 0x1692b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1c6(%rbp), %rdi
callq 0x6b70
jmp 0x16972
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x1691d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x16911
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0xacb0
leaq -0x268(%rbp), %rdi
callq 0x9d10
leaq -0x1e8(%rbp), %rdi
callq 0x5240
jmp 0x16972
jmp 0x1692d
leaq -0x1b8(%rbp), %rdi
callq 0x18930
jmp 0x1662f
jmp 0x16940
jmp 0x16942
leaq -0x90(%rbp), %rdi
callq 0x18950
jmp 0x16522
jmp 0x16955
testb $0x1, -0x31(%rbp)
je 0x16967
movq -0x2b0(%rbp), %rdi
callq 0x17980
jmp 0x16969
addq $0x3e0, %rsp            # imm = 0x3E0
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x5530
nopl (%rax,%rax)