// File: /workspace/github_cpp_makefile_star2_O1/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 0xdefe
movq %rax, %r14
leaq 0xb0(%rbx), %rax
cmpq %rax, %r14
je 0xad3f
cmpb $0x0, 0x14(%r15)
jne 0xad3f
cmpb $0x2, 0x18(%r15)
jne 0xad3f
movb $0x0, 0x7(%rsp)
movzwl 0x1a(%r15), %eax
cmpq $0x40, %rax
jne 0xa9f0
cmpl $0x24, 0x1c(%r15)
jne 0xa9f0
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 0xf512
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 0xece6
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 0xec36
movq %rax, %r12
leaq 0x100(%r14), %rax
cmpq %rax, %r12
je 0xad2a
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 0xab55
leaq 0x28(%rbp), %rsi
leaq 0x88(%rsp), %rdi
callq 0xc688
jmp 0xab9f
cmpl $0xd0, %eax
jne 0xad2a
cmpl $0x24, 0x1c(%r15)
jne 0xad2a
leaq 0x24(%r15), %rsi
leaq (%r15,%rax), %rdx
addq $0x24, %rdx
leaq 0x70(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x60(%rsp), %r12
movq %r12, %rdi
callq 0xd7ba
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0xc772
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0xaa4f
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 0xc8fe
leaq 0x88(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0xc97c
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 0xe946
movq %r14, %rbp
addq $0x190, %rbp            # imm = 0x190
cmpq %rbp, %rax
je 0xac04
movzwl 0x4(%r15), %eax
movw %ax, 0x44(%rsp)
movl (%r15), %eax
movl %eax, 0x40(%rsp)
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xb770(%rip), %rdx      # 0x16249
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x6476
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 0x81d6
addq $0x40, %rsp
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0xad1d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0xad1d
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 0x81d6
addq $0x40, %rsp
jmp 0xad1d
movq 0x1a0(%r14), %r13
cmpq %rbp, %r13
je 0xad1d
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 0xe3b4
leaq 0x40(%r13), %rcx
cmpq %rcx, %rax
jne 0xac54
movq %r13, %rdi
callq 0x41d0
movq %rax, %r13
cmpq %rbp, %rax
jne 0xac19
jmp 0xad1d
movzwl 0x4(%r15), %eax
movw %ax, 0xc(%rsp)
movl (%r15), %eax
movl %eax, 0x8(%rsp)
leaq 0x50(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0xb5d4(%rip), %rdx      # 0x16249
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x6476
addq $0x28, %r13
leaq 0x18(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x8(%rax)
movaps %xmm0, 0x18(%rax)
movaps %xmm0, -0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq $0x0, 0x20(%rax)
xorl %eax, %eax
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 0x8748
addq $0x50, %rsp
leaq 0x10(%rsp), %rdi
callq 0x612a
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0xad1d
movq 0x50(%rsp), %rsi
jmp 0xab48
leaq 0x88(%rsp), %rdi
callq 0xc160
cmpb $0x1, 0x7(%rsp)
jne 0xad3f
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0xad3f
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 0x612a
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0xadbc
movq 0x50(%rsp), %rsi
jmp 0xad83
jmp 0xadb9
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0xadbc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0xadbc
jmp 0xadb9
movq %rax, %rbx
jmp 0xadc9
jmp 0xadb9
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0xadc9
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0xadc9
movq %rax, %rbx
jmp 0xadbc
jmp 0xadb9
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xc160
movq %rbx, %rdi
callq 0x43e0
nop