// File: /workspace/github_cpp_makefile_star2_O3/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 $0x108, %rsp            # imm = 0x108
movq %rdx, %r15
movq %rdi, %rbx
addq $0xa8, %rdi
callq 0xdc9e
movq %rax, %r14
leaq 0xb0(%rbx), %rax
cmpq %rax, %r14
je 0xab99
cmpb $0x0, 0x14(%r15)
jne 0xab99
cmpb $0x2, 0x18(%r15)
jne 0xab99
movb $0x0, 0x7(%rsp)
movzwl 0x1a(%r15), %eax
cmpl $0xd0, %eax
je 0xa858
cmpl $0x40, %eax
jne 0xab84
cmpl $0x24, 0x1c(%r15)
jne 0xab84
leaq 0xc8(%r14), %rdi
movzwl 0xa(%r15), %eax
leaq 0x88(%rsp), %r12
movw %ax, 0x4(%r12)
movl 0x6(%r15), %eax
movl %eax, (%r12)
movq %r12, %rsi
callq 0xf2c0
leaq 0x128(%r14), %rdi
movzwl 0xa(%r15), %eax
movw %ax, 0x4(%r12)
movl 0x6(%r15), %eax
movl %eax, (%r12)
leaq 0x88(%rsp), %r12
movq %r12, %rsi
callq 0xea9a
movq %rax, %rbp
leaq 0xf8(%r14), %rdi
movzwl 0xa(%r15), %eax
movw %ax, 0x4(%r12)
movl 0x6(%r15), %eax
movl %eax, (%r12)
leaq 0x88(%rsp), %rsi
callq 0xe9e8
movq %rax, %r12
leaq 0x100(%r14), %rax
cmpq %rax, %r12
je 0xab84
addq $0x6, %r15
movq %r14, %r13
addq $0x130, %r13            # imm = 0x130
movzwl 0x4(%r15), %eax
movw %ax, 0x14(%rsp)
movl (%r15), %eax
movl %eax, 0x10(%rsp)
cmpq %r13, %rbp
je 0xaa07
leaq 0x28(%rbp), %rsi
leaq 0x88(%rsp), %rdi
callq 0xc418
jmp 0xaa51
cmpl $0x24, 0x1c(%r15)
jne 0xab84
leaq 0x24(%r15), %rsi
leaq 0xf4(%r15), %rdx
leaq 0x70(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x60(%rsp), %r12
movq %r12, %rdi
callq 0xd536
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0xc502
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0xa8ab
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4270
movzwl 0xa(%r15), %eax
leaq 0x10(%rsp), %rsi
movw %ax, 0x4(%rsi)
movl 0x6(%r15), %eax
movl %eax, (%rsi)
leaq 0x128(%r14), %rdi
callq 0xc68e
leaq 0x88(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0xc70c
addq $0x6, %r15
movzwl 0x4(%r15), %eax
leaq 0x10(%rsp), %rsi
movw %ax, 0x4(%rsi)
movl (%r15), %eax
movl %eax, (%rsi)
leaq 0x188(%r14), %rdi
callq 0xe6ee
movq %rax, %rbp
movq %r14, %rax
addq $0x190, %rax            # imm = 0x190
cmpq %rax, %rbp
je 0xa9b3
movzwl 0x4(%r15), %eax
movw %ax, 0x44(%rsp)
movl (%r15), %eax
movl %eax, 0x40(%rsp)
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xb912(%rip), %rdx      # 0x16249
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x642c
xorl %eax, %eax
leaq 0x8(%rsp), %r10
movl %eax, (%r10)
movw $0x0, 0x4(%r10)
subq $0x8, %rsp
leaq 0xf(%rsp), %r11
movl $0x1, %ebp
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
pushq %r11
pushq %rbp
pushq %r10
pushq %rax
pushq %r12
pushq %rbp
pushq %r15
callq 0x80e6
addq $0x40, %rsp
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0xab77
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0xab77
movq 0x1a0(%r14), %r13
cmpq %rbp, %r13
je 0xab77
leaq 0x10(%rsp), %r14
movzwl 0x4(%r15), %eax
movw %ax, 0x14(%rsp)
movl (%r15), %eax
movl %eax, 0x10(%rsp)
leaq 0x38(%r13), %rdi
movq %r14, %rsi
callq 0xe154
leaq 0x40(%r13), %rcx
cmpq %rcx, %rax
jne 0xaab6
movq %r13, %rdi
callq 0x41d0
movq %rax, %r13
cmpq %rbp, %rax
jne 0xa9c8
jmp 0xab77
leaq 0x98(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %ecx, %ecx
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
leaq 0xb8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
leaq 0xf8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
addq $0x28, %r12
xorl %eax, %eax
cmpq %r13, %rbp
sete %al
xorl %r10d, %r10d
leaq 0x40(%rsp), %r11
movl %r10d, (%r11)
movw $0x0, 0x4(%r11)
subq $0x8, %rsp
leaq 0xf(%rsp), %r15
leaq 0x18(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %ecx
movl $0x2, %r8d
movl $0x0, %r9d
pushq %r15
pushq $0x1
pushq %r11
pushq %rax
leaq 0xb0(%rsp), %rax
pushq %rax
pushq %r10
pushq %r12
callq 0x80e6
addq $0x40, %rsp
jmp 0xab77
movzwl 0x4(%r15), %eax
movw %ax, 0xc(%rsp)
movl (%r15), %eax
movl %eax, 0x8(%rsp)
leaq 0x50(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0xb772(%rip), %rdx      # 0x16249
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x642c
addq $0x28, %r13
leaq 0x18(%rsp), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x80(%rsp), %r10
movl %eax, (%r10)
movw $0x0, 0x4(%r10)
leaq 0x7(%rsp), %r11
movl $0x1, %edi
leaq 0x8(%rsp), %rdx
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq %r13, %rsi
xorl %ecx, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
pushq %r11
pushq %rdi
pushq %r10
pushq %rdi
pushq %r14
pushq %rdi
pushq %rax
pushq %r12
pushq %rdi
pushq %r15
callq 0x85ba
addq $0x50, %rsp
leaq 0x10(%rsp), %rdi
callq 0x60e0
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0xab77
movq 0x50(%rsp), %rsi
jmp 0xa9a6
leaq 0x88(%rsp), %rdi
callq 0xbf00
cmpb $0x1, 0x7(%rsp)
jne 0xab99
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0xab99
movq (%rdi), %rax
callq *(%rax)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x60e0
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0xac16
movq 0x50(%rsp), %rsi
jmp 0xabe2
jmp 0xac13
movq %rax, %rbx
jmp 0xac23
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0xac16
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0xac16
jmp 0xac13
movq %rax, %rbx
jmp 0xac16
jmp 0xac13
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0xac23
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0xac23
jmp 0xac13
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf00
movq %rbx, %rdi
callq 0x43e0
nop