// File: /workspace/github_cpp_makefile_star2_O1/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 0x9086
movq 0x8(%rsp), %r13
leaq 0x20(%r13), %r12
leaq 0x98(%r13), %rbx
movq 0x50(%r13), %rsi
leaq 0x40(%r13), %rdx
movq %rbx, %rdi
callq 0xe6fc
movq 0x80(%r13), %rsi
leaq 0x70(%r13), %rdx
movq %rbx, %rdi
callq 0xe6fc
movq 0xb0(%r13), %rax
leaq 0xa0(%r13), %rcx
movq %rcx, 0x30(%rsp)
cmpq %rcx, %rax
je 0x8fcf
leaq 0x188(%r13), %rcx
movq %rcx, 0x28(%rsp)
leaq 0x190(%r13), %r15
leaq 0x1b8(%r13), %rcx
movq %rcx, 0x20(%rsp)
movq %rax, 0x10(%rsp)
leaq 0x20(%rax), %rbp
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xe946
cmpq %r15, %rax
setne %bl
movq 0x1a0(%r13), %r13
cmpq %r15, %r13
sete %cl
orb %bl, %cl
jne 0x8f5e
cmpq %r15, %rax
setne %bl
leaq 0x38(%r13), %rdi
movq %rbp, %rsi
callq 0xe3b4
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 0x8f5e
movq %rax, %r13
cmpq %r15, %rax
jne 0x8f2b
testb $0x1, %bl
jne 0x8fb5
movl $0x20, %edi
callq 0x4260
leaq 0x14af4(%rip), %rcx     # 0x1da68
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 0xe4a0
movq 0x10(%rsp), %rdi
callq 0x42d0
cmpq 0x30(%rsp), %rax
movq 0x8(%rsp), %r13
jne 0x8ef8
movq 0x1a0(%r13), %rbx
leaq 0x190(%r13), %rax
movq %rax, 0x10(%rsp)
cmpq %rax, %rbx
je 0x9086
movq 0x8(%rsp), %rax
leaq 0x1b8(%rax), %r15
movq 0x50(%rbx), %r13
leaq 0x40(%rbx), %rbp
cmpq %rbp, %r13
je 0x9070
movl 0x28(%r13), %eax
cmpl 0x4c(%r14), %eax
jl 0x9060
movl $0x20, %edi
callq 0x4260
leaq 0x14a49(%rip), %rcx     # 0x1da68
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 0xe4a0
movq %r13, %rdi
callq 0x41d0
movq %rax, %r13
cmpq %rbp, %rax
jne 0x9004
movq %rbx, %rdi
callq 0x41d0
movq %rax, %rbx
cmpq 0x10(%rsp), %rax
jne 0x8ff7
movl 0x20(%r14), %eax
notl %eax
testb $0x30, %al
jne 0x93a8
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 0xd00c
movq 0x170(%rbx), %rbp
leaq 0x160(%rbx), %rax
movq %rax, 0x20(%rsp)
cmpq %rax, %rbp
je 0x91c3
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 0xe9f6
movq %r13, %rdi
movq %rax, %rsi
callq 0xeb92
leaq 0x30(%rbp), %r14
movq %rbp, 0x28(%rsp)
movq 0x30(%rbp), %rbx
cmpq %r14, %rbx
je 0x91ab
leaq 0x10(%rbx), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0xe9f6
movq %r13, %rdi
movq %rax, %rsi
callq 0xeb92
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xec36
cmpq 0x30(%rsp), %rax
jne 0x9189
leaq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0xdd4e
movq %r12, %rdi
movq %rbp, %rsi
callq 0xece6
cmpq %r15, %rax
jne 0x91a6
leaq 0x68(%rsp), %rdi
movq %rbp, %rsi
callq 0xdd4e
movq (%rbx), %rbx
jmp 0x9149
movq 0x28(%rsp), %rdi
callq 0x42d0
movq %rax, %rbp
cmpq 0x20(%rsp), %rax
jne 0x9125
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %r12
movq 0x50(%rsp), %rbx
leaq 0x40(%rsp), %rbp
cmpq %rbp, %rbx
je 0x9254
movq 0x8(%rsp), %rax
leaq 0x1b8(%rax), %r14
leaq 0x147d2(%rip), %r13     # 0x1d9c0
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 0xe4a0
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rbx
cmpq %rbp, %rax
jne 0x91f3
leaq 0xa0(%rsp), %r13
movq 0x10(%r13), %rbx
cmpq %r13, %rbx
je 0x92de
movq 0x8(%rsp), %rax
leaq 0x1b8(%rax), %r14
leaq 0x14748(%rip), %rbp     # 0x1d9c0
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 0xe4a0
movq %rbx, %rdi
callq 0x41d0
movq %rax, %rbx
cmpq %r13, %rax
jne 0x927d
movq 0x80(%rsp), %rbx
leaq 0x70(%rsp), %rax
cmpq %rax, %rbx
movq 0x8(%rsp), %r13
je 0x9387
addq $0x1b8, %r13            # imm = 0x1B8
leaq 0x14649(%rip), %r15     # 0x1d950
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 0xe4a0
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rbx
leaq 0x70(%rsp), %rax
cmpq %rax, %rbx
jne 0x930e
leaq 0x98(%rsp), %rdi
callq 0x5ef6
leaq 0x68(%rsp), %rdi
callq 0x5f6e
leaq 0x38(%rsp), %rdi
callq 0x5f6e
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x93db
jmp 0x93cb
jmp 0x93cb
jmp 0x93cb
jmp 0x93cb
jmp 0x93cb
jmp 0x93cb
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x5ef6
leaq 0x68(%rsp), %rdi
callq 0x5f6e
leaq 0x38(%rsp), %rdi
callq 0x5f6e
movq %rbx, %rdi
callq 0x43e0
nop