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

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

    if((mme.GetLength() == 64) && (mme.GetOffset() == 36))
    {
      itNIC->second.setReadModDataResponses.insert(mme.GetAddress());

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

      std::map<CMACAddress,std::string>::const_iterator itVersion;
      if((itVersion = itNIC->second.mapGetVersionResponses.find(mme.GetAddress())) != itNIC->second.mapGetVersionResponses.end())
      {
        UpdateLocalDevice(itNIC, mme.GetAddress(), true, CDlanDevice::eThunderbolt, false,
          itVersion->second, false, bKeepUserData ? UserDataResponse() : itUserData->second, bKeepUserData, 
          CMACAddress::Null(), true, bUpdate);
      }
    }
    else if((mme.GetLength() == 208) && (mme.GetOffset() == 36))
    {
      UserDataResponse userData(mme.GetData());

      itNIC->second.mapUserDataResponses[mme.GetAddress()] = userData;

      if(itNIC->second.mapLocalDevices.find(mme.GetAddress()) != itNIC->second.mapLocalDevices.end())
      {
        UpdateLocalDevice(itNIC, mme.GetAddress(), false,
          CDlanDevice::eThunderbolt, true, "", true, userData, false, CMACAddress::Null(), true, bUpdate);
      }
      else
      {
        for(std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.begin();
          (itLocalDevice != itNIC->second.mapLocalDevices.end()); ++itLocalDevice)
        {
          if(itLocalDevice->second.mapRemoteDeviceAges.find(mme.GetAddress()) != itLocalDevice->second.mapRemoteDeviceAges.end())
          {
            UpdateRemoteDevice(itLocalDevice->second, mme.GetAddress(), false,
              CDlanDevice::eThunderbolt, true, "", true, userData, false, 0.0, 0.0, true,
              std::map<CMACAddress, CDlanDataRates>(), true, CMACAddress(), true, bUpdate);
            break;
          }
        }
      }
    }

    if(bUpdate)
      OnUpdate();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdx, %r15
movq %rdi, %rbx
addq $0xa8, %rdi
callq 0xccd4
movq %rax, %r14
leaq 0xb0(%rbx), %rax
cmpq %rax, %r14
je 0x9b0d
cmpb $0x0, 0x14(%r15)
jne 0x9b0d
cmpb $0x2, 0x18(%r15)
jne 0x9b0d
movb $0x0, 0x5e(%rsp)
movzwl 0x1a(%r15), %eax
cmpl $0xd0, %eax
je 0x97ee
cmpl $0x40, %eax
jne 0x9af8
cmpl $0x24, 0x1c(%r15)
jne 0x9af8
leaq 0xc8(%r14), %rdi
movzwl 0xa(%r15), %eax
leaq 0xc8(%rsp), %r12
movw %ax, 0x4(%r12)
movl 0x6(%r15), %eax
movl %eax, (%r12)
movq %r12, %rsi
callq 0xdfea
leaq 0x128(%r14), %rdi
movzwl 0xa(%r15), %eax
movw %ax, 0x4(%r12)
movl 0x6(%r15), %eax
movl %eax, (%r12)
leaq 0xc8(%rsp), %r12
movq %r12, %rsi
callq 0xd86c
movq %rax, %rbp
leaq 0xf8(%r14), %rdi
movzwl 0xa(%r15), %eax
movw %ax, 0x4(%r12)
movl 0x6(%r15), %eax
movl %eax, (%r12)
leaq 0xc8(%rsp), %rsi
callq 0xd82e
movq %rax, %r13
leaq 0x100(%r14), %rax
cmpq %rax, %r13
je 0x9af8
addq $0x6, %r15
movq %r14, %r12
addq $0x130, %r12            # imm = 0x130
movzwl 0x4(%r15), %eax
movw %ax, 0x74(%rsp)
movl (%r15), %eax
movl %eax, 0x70(%rsp)
cmpq %r12, %rbp
je 0x996b
leaq 0x28(%rbp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xb032
jmp 0x99b9
cmpl $0x24, 0x1c(%r15)
jne 0x9af8
leaq 0x148(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xb0ae
leaq 0xc8(%rsp), %rdi
movq %r12, %rsi
callq 0xb0e6
leaq 0x148(%rsp), %rdi
callq 0x58c6
movzwl 0xa(%r15), %eax
leaq 0x70(%rsp), %rsi
movw %ax, 0x4(%rsi)
movl 0x6(%r15), %eax
movl %eax, (%rsi)
leaq 0x128(%r14), %rdi
callq 0xb204
leaq 0xc8(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0xb26a
addq $0x6, %r15
movzwl 0x4(%r15), %eax
leaq 0x70(%rsp), %rsi
movw %ax, 0x4(%rsi)
movl (%r15), %eax
movl %eax, (%rsi)
leaq 0x188(%r14), %rdi
callq 0xd5b6
movq %rax, %rbp
movq %r14, %rax
addq $0x190, %rax            # imm = 0x190
cmpq %rax, %rbp
je 0x991f
movzwl 0x4(%r15), %eax
movw %ax, 0xac(%rsp)
movl (%r15), %eax
movl %eax, 0xa8(%rsp)
leaq 0xa997(%rip), %rsi      # 0x14249
leaq 0x70(%rsp), %r15
leaq 0x68(%rsp), %rdx
movq %r15, %rdi
callq 0x4ab0
leaq 0x60(%rsp), %rax
andw $0x0, 0x4(%rax)
andl $0x0, (%rax)
leaq 0x5e(%rsp), %rcx
movq %rcx, 0x30(%rsp)
pushq $0x1
popq %r9
movl %r9d, 0x28(%rsp)
movq %rax, 0x20(%rsp)
movq %r12, 0x10(%rsp)
movl %r9d, 0x8(%rsp)
movq %r15, (%rsp)
andl $0x0, 0x18(%rsp)
leaq 0xa8(%rsp), %rdx
pushq $0x2
popq %r8
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x7bd4
leaq 0x70(%rsp), %rdi
jmp 0x9ae6
movq 0x1a0(%r14), %r14
leaq 0x70(%rsp), %r13
cmpq %rbp, %r14
je 0x9aeb
movzwl 0x4(%r15), %eax
movw %ax, 0x74(%rsp)
movl (%r15), %eax
movl %eax, 0x70(%rsp)
leaq 0x38(%r14), %rdi
movq %r13, %rsi
callq 0xd10c
leaq 0x40(%r14), %rcx
cmpq %rcx, %rax
jne 0x9a25
movq %r14, %rdi
callq 0x41e0
movq %rax, %r14
jmp 0x992b
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0xf8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x118(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x138(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
addq $0x28, %r13
xorl %eax, %eax
cmpq %r12, %rbp
sete %al
leaq 0xa8(%rsp), %rcx
andw $0x0, 0x4(%rcx)
andl $0x0, (%rcx)
leaq 0x5e(%rsp), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, 0x20(%rsp)
movl %eax, 0x18(%rsp)
leaq 0xc8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r13, (%rsp)
movl $0x1, 0x28(%rsp)
andl $0x0, 0x8(%rsp)
leaq 0x70(%rsp), %rdx
pushq $0x1
popq %rcx
pushq $0x2
popq %r8
movq %rbx, %rdi
movq %r14, %rsi
xorl %r9d, %r9d
callq 0x7bd4
jmp 0x9aeb
movzwl 0x4(%r15), %eax
movw %ax, 0x64(%rsp)
movl (%r15), %eax
movl %eax, 0x60(%rsp)
leaq 0xa80c(%rip), %rsi      # 0x14249
leaq 0xa8(%rsp), %r15
leaq 0x5f(%rsp), %rdx
movq %r15, %rdi
callq 0x4ab0
leaq 0x78(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x68(%rsp), %rax
andw $0x0, 0x4(%rax)
addq $0x28, %r14
andl $0x0, (%rax)
leaq 0x5e(%rsp), %rcx
movq %rcx, 0x48(%rsp)
pushq $0x1
popq %r9
movl %r9d, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movl %r9d, 0x30(%rsp)
movq %r13, 0x28(%rsp)
movl %r9d, 0x20(%rsp)
movq %r12, 0x10(%rsp)
movl %r9d, 0x8(%rsp)
movq %r15, (%rsp)
andl $0x0, 0x18(%rsp)
leaq 0x60(%rsp), %rdx
pushq $0x2
popq %r8
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x7f00
leaq 0x70(%rsp), %rdi
callq 0x5a86
leaq 0xa8(%rsp), %rdi
callq 0x4170
leaq 0xc8(%rsp), %rdi
callq 0x589e
cmpb $0x1, 0x5e(%rsp)
jne 0x9b0d
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x9b0d
movq (%rdi), %rax
callq *(%rax)
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x5a86
leaq 0xa8(%rsp), %rdi
jmp 0x9b45
jmp 0x9b66
movq %rax, %rbx
jmp 0x9b76
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x4170
jmp 0x9b69
jmp 0x9b66
jmp 0x9b66
jmp 0x9b66
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x58c6
jmp 0x9b76
jmp 0x9b66
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x589e
movq %rbx, %rdi
callq 0x4410