// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdx, %r15
movq %rdi, %rbx
addq $0xa8, %rdi
callq 0xccd4
movq %rax, %r12
leaq 0xb0(%rbx), %rax
cmpq %rax, %r12
je 0xa080
cmpb $0x0, 0x14(%r15)
jne 0xa080
movq %rbx, 0x30(%rsp)
movb $0x0, 0x7(%rsp)
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0xb2ae
movzwl 0xa(%r15), %eax
leaq 0x40(%rsp), %rsi
movw %ax, 0x4(%rsi)
movl 0x6(%r15), %eax
movl %eax, (%rsi)
leaq 0xf8(%r12), %rdi
callq 0xb328
leaq 0x6(%r15), %r14
leaq 0x98(%rsp), %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42f0
movq %rbx, %rdi
callq 0x4170
leaq 0x128(%r12), %rdi
movzwl 0x4(%r14), %eax
movw %ax, 0x4(%rbx)
movl (%r14), %eax
movl %eax, (%rbx)
leaq 0x98(%rsp), %rbx
movq %rbx, %rsi
callq 0xd86c
movq %rax, %rbp
leaq 0x130(%r12), %rax
movq %rax, 0x18(%rsp)
leaq 0x158(%r12), %rdi
movzwl 0x4(%r14), %eax
movw %ax, 0x4(%rbx)
movl (%r14), %eax
movl %eax, (%rbx)
movq %r15, %rbx
leaq 0x98(%rsp), %r15
movq %r15, %rsi
callq 0xe6bc
movq %rax, 0x10(%rsp)
leaq 0x160(%r12), %rax
movq %rax, 0x28(%rsp)
leaq 0xc8(%r12), %rdi
movzwl 0x4(%r14), %eax
movw %ax, 0x4(%r15)
movl (%r14), %eax
movl %eax, (%r15)
leaq 0x98(%rsp), %r13
movq %r13, %rsi
callq 0xe0ae
leaq 0xd0(%r12), %rcx
cmpq %rcx, %rax
movq %rbp, 0x20(%rsp)
je 0x9d1b
movzwl 0x4(%r14), %eax
movw %ax, 0x11c(%rsp)
movl (%r14), %eax
movl %eax, 0x118(%rsp)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb2ae
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
je 0x9f6e
leaq 0x28(%rax), %rsi
leaq 0x98(%rsp), %rdi
callq 0xb032
jmp 0x9fbc
movq %rbx, 0x80(%rsp)
movq 0x170(%r12), %rbx
leaq 0x188(%r12), %rax
movq %rax, 0x88(%rsp)
addq $0x190, %r12            # imm = 0x190
leaq 0x28(%rbp), %rax
movq %rax, 0x78(%rsp)
xorl %r15d, %r15d
movq %r12, 0x38(%rsp)
testb $0x1, %r15b
jne 0xa066
cmpq 0x28(%rsp), %rbx
je 0xa066
leaq 0x20(%rbx), %rsi
movq 0x88(%rsp), %rdi
callq 0xd5b6
cmpq %r12, %rax
je 0x9f5e
movq %rbx, 0x10(%rsp)
leaq 0x30(%rbx), %rbp
addq $0x28, %rax
movq %rax, 0x90(%rsp)
movq %rbp, %rbx
testb $0x1, %r15b
jne 0x9f54
movq (%rbx), %rbx
cmpq %rbp, %rbx
je 0x9f54
leaq 0x10(%rbx), %r12
movzwl 0x4(%r14), %eax
movw %ax, 0x9c(%rsp)
movl (%r14), %eax
movl %eax, 0x98(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x5b4d
testb %al, %al
je 0x9d9a
leaq 0x118(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0xb2ae
movq 0x20(%rsp), %r15
cmpq 0x18(%rsp), %r15
je 0x9e0d
movq %r13, %rdi
movq 0x78(%rsp), %rsi
callq 0xb032
jmp 0x9e8f
leaq 0xa8(%rsp), %rax
movq %rax, 0x98(%rsp)
andq $0x0, 0xa0(%rsp)
xorl %ecx, %ecx
movb %cl, 0xa8(%rsp)
leaq 0xc8(%rsp), %rax
movq %rax, 0xb8(%rsp)
andq $0x0, 0xc0(%rsp)
movb %cl, 0xc8(%rsp)
leaq 0xe8(%rsp), %rax
movq %rax, 0xd8(%rsp)
andq $0x0, 0xe0(%rsp)
movb %cl, 0xe8(%rsp)
leaq 0x108(%rsp), %rax
movq %rax, 0xf8(%rsp)
andq $0x0, 0x100(%rsp)
movb %cl, 0x108(%rsp)
xorl %eax, %eax
cmpq 0x18(%rsp), %r15
sete %al
movl 0x1c(%rbx), %ecx
movl 0x20(%rbx), %edx
cvtsi2sd %rcx, %xmm0
movsd 0xa4dc(%rip), %xmm2     # 0x14388
mulsd %xmm2, %xmm0
movsd 0xa4d8(%rip), %xmm3     # 0x14390
mulsd %xmm3, %xmm0
cvtsi2sd %rdx, %xmm1
mulsd %xmm2, %xmm1
andq $0x0, 0x50(%rsp)
mulsd %xmm3, %xmm1
xorpd %xmm2, %xmm2
movapd %xmm2, 0x40(%rsp)
leaq 0x48(%rsp), %rcx
movq %rcx, 0x58(%rsp)
movq %rcx, 0x60(%rsp)
andq $0x0, 0x68(%rsp)
leaq 0x16(%rbx), %rdi
movq 0x90(%rsp), %rsi
movq %r12, %rdx
pushq $0x1
popq %rcx
pushq $0x2
popq %r8
xorl %r9d, %r9d
leaq 0x7(%rsp), %r10
pushq %r10
pushq $0x0
pushq %rdi
pushq $0x1
leaq 0x60(%rsp), %r15
pushq %r15
pushq $0x0
pushq %rax
pushq %r13
pushq $0x0
leaq 0x160(%rsp), %r12
pushq %r12
callq 0x7f00
addq $0x50, %rsp
movq %r15, %rdi
callq 0x5a86
movq %r13, %rdi
callq 0x589e
movq %r12, %rdi
callq 0x4170
movb $0x1, %r15b
jmp 0x9d9a
movq 0x38(%rsp), %r12
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x42c0
movq %rax, %rbx
jmp 0x9d53
leaq 0xa8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0xc8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0xe8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x108(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
movq 0x10(%rsp), %rcx
cmpq 0x28(%rsp), %rcx
je 0x9fda
movzwl 0x2c(%rcx), %eax
movw %ax, 0xc(%rsp)
movl 0x28(%rcx), %eax
movl %eax, 0x8(%rsp)
jmp 0x9fe5
andw $0x0, 0xc(%rsp)
andl $0x0, 0x8(%rsp)
xorl %eax, %eax
cmpq 0x28(%rsp), %rcx
sete %al
xorl %ecx, %ecx
movq 0x18(%rsp), %rdx
cmpq %rdx, 0x20(%rsp)
sete %cl
subq $0x40, %rsp
leaq 0x47(%rsp), %rdx
movq %rdx, 0x30(%rsp)
leaq 0x48(%rsp), %rdx
movq %rdx, 0x20(%rsp)
movq %r13, 0x10(%rsp)
movq %r15, (%rsp)
movl %eax, 0x28(%rsp)
movl %ecx, 0x18(%rsp)
andl $0x0, 0x8(%rsp)
leaq 0x158(%rsp), %rdx
pushq $0x1
popq %rcx
pushq $0x2
popq %r8
movq 0x70(%rsp), %rdi
movq %r12, %rsi
xorl %r9d, %r9d
callq 0x7bd4
addq $0x40, %rsp
leaq 0x98(%rsp), %rdi
callq 0x589e
leaq 0x40(%rsp), %rdi
callq 0x4170
cmpb $0x1, 0x7(%rsp)
jne 0xa080
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rdi
testq %rdi, %rdi
je 0xa080
movq (%rdi), %rax
callq *(%rax)
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xa0a7
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x589e
leaq 0x40(%rsp), %rdi
jmp 0xa0e7
movq %rax, %rbx
jmp 0xa0ec
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0xa0e7
movq %rax, %rbx
jmp 0xa0df
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x5a86
leaq 0x98(%rsp), %rdi
callq 0x589e
leaq 0x118(%rsp), %rdi
callq 0x4170
movq %rbx, %rdi
callq 0x4410