// File: /workspace/github_cpp_makefile_star2_O3/dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::TriggerUnknownDevices(std::_Rb_tree_iterator<std::pair<CMACAddress const, CDlanMonitor::NetwAdapter>>)
void CDlanMonitor::TriggerUnknownDevices(
  std::map<CMACAddress,NetwAdapter>::iterator itNIC)
{
  if(((m_eMode & eMonitorHP1) == eMonitorHP1) || ((m_eMode & eMonitorTurbo) == eMonitorTurbo))
  {
    itNIC->second.setDevicesToTrigger.insert(
      itNIC->second.setParamsAndStatsResponses.begin(), itNIC->second.setParamsAndStatsResponses.end());
    itNIC->second.setDevicesToTrigger.insert(
      itNIC->second.setRemoteTurboResponses.begin(), itNIC->second.setRemoteTurboResponses.end());

    for(std::set<CMACAddress>::iterator itDeviceToTrigger = itNIC->second.setDevicesToTrigger.begin();
      (itDeviceToTrigger != itNIC->second.setDevicesToTrigger.end()); ++itDeviceToTrigger)
    {
      bool bIsWellKnown = false;

      if(itNIC->second.mapLocalDevices.find(*itDeviceToTrigger) != itNIC->second.mapLocalDevices.end())
        bIsWellKnown = true;

      for(std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.begin();
        (bIsWellKnown == false) && (itLocalDevice != itNIC->second.mapLocalDevices.end()); ++itLocalDevice)
      {
        if(itLocalDevice->second.mapRemoteDeviceAges.find(*itDeviceToTrigger) != itLocalDevice->second.mapRemoteDeviceAges.end())
          bIsWellKnown = true;
      }

      if(!bIsWellKnown)
      {
        itNIC->second.queuePendingPackets.push(
          new HomePlugMMEs::ParamsAndStats::CRequest(*itDeviceToTrigger, itNIC->first));
      }
    }

    for(std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.begin();
      (itLocalDevice != itNIC->second.mapLocalDevices.end()); ++itLocalDevice)
    {
      for(std::map<CMACAddress,int>::iterator itRemoteDevice = itLocalDevice->second.mapRemoteDeviceAges.begin();
        (itRemoteDevice != itLocalDevice->second.mapRemoteDeviceAges.end()); ++itRemoteDevice)
      {
        if(itRemoteDevice->second >= m_timings.RemoteRefreshAge)
        {
          itNIC->second.queuePendingPackets.push(
            new HomePlugMMEs::ParamsAndStats::CRequest(itRemoteDevice->first, itNIC->first));
        }
      }
    }
  }

  if((m_eMode & eMonitorThunderbolt) == eMonitorThunderbolt)
  {
    std::set<CMACAddress> setGetVersion, setGetUserData;
    std::map<CMACAddress,std::string> mapUnknownGetVersionResponses = itNIC->second.mapGetVersionResponses;
  
    for(std::map<CMACAddress,NetworkInfoResponse>::const_iterator itNetworkInfo = itNIC->second.mapNetworkInfoResponses.begin();
      itNetworkInfo != itNIC->second.mapNetworkInfoResponses.end(); ++itNetworkInfo)
    {
      mapUnknownGetVersionResponses.erase(itNetworkInfo->first);
    
      for(std::list<HomePlugAvMMEs::ThunderNetworkInfo::StationInfo>::const_iterator itStation = itNetworkInfo->second.stations.begin();
        itStation != itNetworkInfo->second.stations.end(); ++itStation)
      {
        mapUnknownGetVersionResponses.erase(itStation->GetAddress());

        if(itNIC->second.mapGetVersionResponses.find(itStation->GetAddress()) == itNIC->second.mapGetVersionResponses.end())
          setGetVersion.insert(itStation->GetAddress());

        if(itNIC->second.mapUserDataResponses.find(itStation->GetAddress()) == itNIC->second.mapUserDataResponses.end())
          setGetUserData.insert(itStation->GetAddress());
      }
    }

    for(std::set<CMACAddress>::iterator it = setGetVersion.begin(); it != setGetVersion.end(); ++it)
    {
      itNIC->second.queuePendingPackets.push(new HomePlugAvMMEs::ThunderGetVersion::CRequest(*it, itNIC->first));
    }

    for(std::map<CMACAddress,std::string>::iterator it = mapUnknownGetVersionResponses.begin(); 
      it != mapUnknownGetVersionResponses.end(); ++it)
    {
      itNIC->second.queuePendingPackets.push(new HomePlugAvMMEs::ThunderGetVersion::CRequest(it->first, itNIC->first));
    }

    for(std::set<CMACAddress>::iterator it = setGetUserData.begin(); it != setGetUserData.end(); ++it)
    {
      itNIC->second.queuePendingPackets.push(new HomePlugAvMMEs::ThunderReadModuleData::CRequest(*it, itNIC->first, 
        HomePlugAvMMEs::ThunderReadModuleData::ePib, 208, 36));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
movl 0x20(%rdi), %eax
notl %eax
testb $0x3, %al
setne %cl
testb $0xc, %al
setne %al
testb %al, %cl
jne 0x8f02
movq 0x8(%rsp), %r13
leaq 0x20(%r13), %r12
leaq 0x98(%r13), %rbx
movq 0x50(%r13), %rsi
leaq 0x40(%r13), %rdx
movq %rbx, %rdi
callq 0xe4a4
movq 0x80(%r13), %rsi
leaq 0x70(%r13), %rdx
movq %rbx, %rdi
callq 0xe4a4
movq 0xb0(%r13), %rax
leaq 0xa0(%r13), %rbx
cmpq %rbx, %rax
je 0x8e4b
leaq 0x188(%r13), %rcx
movq %rcx, 0x30(%rsp)
leaq 0x190(%r13), %r15
leaq 0x1b8(%r13), %rcx
movq %rcx, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %rax, 0x10(%rsp)
leaq 0x20(%rax), %rbp
movq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0xe6ee
cmpq %r15, %rax
setne %cl
movq 0x1a0(%r13), %r13
cmpq %r15, %r13
sete %dl
orb %cl, %dl
je 0x8da2
cmpq %r15, %rax
jne 0x8e33
jmp 0x8de1
xorl %ebx, %ebx
leaq 0x38(%r13), %rdi
movq %rbp, %rsi
callq 0xe154
leaq 0x40(%r13), %rcx
cmpq %rcx, %rax
movzbl %bl, %ebx
movl $0x1, %eax
cmovnel %eax, %ebx
movq %r13, %rdi
callq 0x41d0
testb $0x1, %bl
jne 0x8dd7
movq %rax, %r13
cmpq %r15, %rax
jne 0x8da4
testb $0x1, %bl
movq 0x28(%rsp), %rbx
jne 0x8e33
movl $0x20, %edi
callq 0x4260
leaq 0x14c66(%rip), %rcx     # 0x1da58
movq %rcx, (%rax)
movl (%rbp), %ecx
movl %ecx, 0x8(%rax)
movzwl 0x4(%rbp), %ecx
movw %cx, 0xc(%rax)
movl (%r12), %ecx
movl %ecx, 0xe(%rax)
movzwl 0x4(%r12), %ecx
movw %cx, 0x12(%rax)
movl $0x7017b88, 0x14(%rax)  # imm = 0x7017B88
movb $0x0, 0x18(%rax)
movq %rax, 0x38(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xe242
movq 0x10(%rsp), %rdi
callq 0x42d0
cmpq %rbx, %rax
movq 0x8(%rsp), %r13
jne 0x8d6a
movq 0x1a0(%r13), %rbx
leaq 0x190(%r13), %rax
movq %rax, 0x10(%rsp)
cmpq %rax, %rbx
je 0x8f02
movq 0x8(%rsp), %rax
leaq 0x1b8(%rax), %r15
movq 0x50(%rbx), %r13
leaq 0x40(%rbx), %rbp
cmpq %rbp, %r13
je 0x8eec
movl 0x28(%r13), %eax
cmpl 0x4c(%r14), %eax
jl 0x8edc
movl $0x20, %edi
callq 0x4260
leaq 0x14bbd(%rip), %rcx     # 0x1da58
movq %rcx, (%rax)
movl 0x20(%r13), %ecx
movl %ecx, 0x8(%rax)
movzwl 0x24(%r13), %ecx
movw %cx, 0xc(%rax)
movl (%r12), %ecx
movl %ecx, 0xe(%rax)
movzwl 0x4(%r12), %ecx
movw %cx, 0x12(%rax)
movl $0x7017b88, 0x14(%rax)  # imm = 0x7017B88
movb $0x0, 0x18(%rax)
movq %rax, 0x38(%rsp)
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
callq 0xe242
movq %r13, %rdi
callq 0x41d0
movq %rax, %r13
cmpq %rbp, %rax
jne 0x8e80
movq %rbx, %rdi
callq 0x41d0
movq %rax, %rbx
cmpq 0x10(%rsp), %rax
jne 0x8e73
movl 0x20(%r14), %eax
notl %eax
testb $0x30, %al
jne 0x9224
leaq 0x40(%rsp), %rcx
xorl %eax, %eax
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x70(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq 0x8(%rsp), %rbx
leaq 0xf8(%rbx), %rsi
leaq 0x98(%rsp), %rdi
movq %rsi, 0x10(%rsp)
callq 0xcd8e
movq 0x170(%rbx), %rbp
leaq 0x160(%rbx), %rax
movq %rax, 0x20(%rsp)
cmpq %rax, %rbp
je 0x903f
movq 0x8(%rsp), %rax
leaq 0x100(%rax), %rcx
movq %rcx, 0x30(%rsp)
leaq 0x128(%rax), %r12
leaq 0x130(%rax), %r15
leaq 0x98(%rsp), %r13
leaq 0x20(%rbp), %rsi
movq %r13, %rdi
callq 0xe7a0
movq %r13, %rdi
movq %rax, %rsi
callq 0xe944
leaq 0x30(%rbp), %r14
movq %rbp, 0x28(%rsp)
movq 0x30(%rbp), %rbx
cmpq %r14, %rbx
je 0x9027
leaq 0x10(%rbx), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0xe7a0
movq %r13, %rdi
movq %rax, %rsi
callq 0xe944
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xe9e8
cmpq 0x30(%rsp), %rax
jne 0x9005
leaq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0xdaf2
movq %r12, %rdi
movq %rbp, %rsi
callq 0xea9a
cmpq %r15, %rax
jne 0x9022
leaq 0x68(%rsp), %rdi
movq %rbp, %rsi
callq 0xdaf2
movq (%rbx), %rbx
jmp 0x8fc5
movq 0x28(%rsp), %rdi
callq 0x42d0
movq %rax, %rbp
cmpq 0x20(%rsp), %rax
jne 0x8fa1
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %r12
movq 0x50(%rsp), %rbx
leaq 0x40(%rsp), %rbp
cmpq %rbp, %rbx
je 0x90d0
movq 0x8(%rsp), %rax
leaq 0x1b8(%rax), %r14
leaq 0x14946(%rip), %r13     # 0x1d9b0
leaq 0x18(%rsp), %r15
movl $0x20, %edi
callq 0x4260
movq %r13, (%rax)
movl 0x20(%rbx), %ecx
movl %ecx, 0x8(%rax)
movzwl 0x24(%rbx), %ecx
movw %cx, 0xc(%rax)
movl (%r12), %ecx
movl %ecx, 0xe(%rax)
movzwl 0x4(%r12), %ecx
movw %cx, 0x12(%rax)
movw $0xe188, 0x14(%rax)     # imm = 0xE188
movb $0x0, 0x16(%rax)
movl $0xb000a000, 0x17(%rax) # imm = 0xB000A000
movb $0x52, 0x1b(%rax)
movq %rax, 0x18(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xe242
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rbx
cmpq %rbp, %rax
jne 0x906f
leaq 0xa0(%rsp), %r13
movq 0x10(%r13), %rbx
cmpq %r13, %rbx
je 0x915a
movq 0x8(%rsp), %rax
leaq 0x1b8(%rax), %r14
leaq 0x148bc(%rip), %rbp     # 0x1d9b0
leaq 0x18(%rsp), %r15
movl $0x20, %edi
callq 0x4260
movq %rbp, (%rax)
movl 0x20(%rbx), %ecx
movl %ecx, 0x8(%rax)
movzwl 0x24(%rbx), %ecx
movw %cx, 0xc(%rax)
movl (%r12), %ecx
movl %ecx, 0xe(%rax)
movzwl 0x4(%r12), %ecx
movw %cx, 0x12(%rax)
movw $0xe188, 0x14(%rax)     # imm = 0xE188
movb $0x0, 0x16(%rax)
movl $0xb000a000, 0x17(%rax) # imm = 0xB000A000
movb $0x52, 0x1b(%rax)
movq %rax, 0x18(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xe242
movq %rbx, %rdi
callq 0x41d0
movq %rax, %rbx
cmpq %r13, %rax
jne 0x90f9
movq 0x80(%rsp), %rbx
leaq 0x70(%rsp), %rax
cmpq %rax, %rbx
movq 0x8(%rsp), %r13
je 0x9203
addq $0x1b8, %r13            # imm = 0x1B8
leaq 0x147bd(%rip), %r15     # 0x1d940
xorl %ebp, %ebp
leaq 0x18(%rsp), %r14
movl $0x28, %edi
callq 0x4260
movq %r15, (%rax)
movl 0x20(%rbx), %ecx
movl %ecx, 0x8(%rax)
movzwl 0x24(%rbx), %ecx
movw %cx, 0xc(%rax)
movl (%r12), %ecx
movl %ecx, 0xe(%rax)
movzwl 0x4(%r12), %ecx
movw %cx, 0x12(%rax)
movw $0xe188, 0x14(%rax)     # imm = 0xE188
movb %bpl, 0x16(%rax)
movw $0xa024, 0x17(%rax)     # imm = 0xA024
movl $0x252b000, 0x19(%rax)  # imm = 0x252B000
movb %bpl, 0x1d(%rax)
movw $0xd0, 0x1e(%rax)
movl $0x24, 0x20(%rax)
movq %rax, 0x18(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0xe242
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rbx
leaq 0x70(%rsp), %rax
cmpq %rax, %rbx
jne 0x918a
leaq 0x98(%rsp), %rdi
callq 0x5eac
leaq 0x68(%rsp), %rdi
callq 0x5f24
leaq 0x38(%rsp), %rdi
callq 0x5f24
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x9257
jmp 0x9247
jmp 0x9247
jmp 0x9247
jmp 0x9247
jmp 0x9247
jmp 0x9247
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x5eac
leaq 0x68(%rsp), %rdi
callq 0x5f24
leaq 0x38(%rsp), %rdi
callq 0x5f24
movq %rbx, %rdi
callq 0x43e0
nop