// File: /workspace/github_cpp_makefile_star2_O2/dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::RemoveDevices(bool&, bool, std::set<CMACAddress, std::less<CMACAddress>, std::allocator<CMACAddress>> const&)
void CDlanMonitor::RemoveDevices(
  bool& bUpdate,
  bool bAge,    
  const std::set<CMACAddress>& setForceRemove)
{
  for(std::map<CMACAddress,NetwAdapter>::iterator itNIC = m_mapNICs.begin(); 
    (itNIC != m_mapNICs.end()); ++itNIC)
  {
    std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.begin();
    while(itLocalDevice != itNIC->second.mapLocalDevices.end())
    {
      if(bAge) ++itLocalDevice->second.iAge;

      if((itLocalDevice->second.iAge == m_timings.LocalVanishedAge) || 
        (setForceRemove.find(itLocalDevice->first) != setForceRemove.end()))
      {
        bUpdate = true;
        m_listLocalDevices.erase(itLocalDevice->second.itPublicDevice);
        itNIC->second.mapLocalDevices.erase(itLocalDevice++);
      }
      else
      {
        std::map<CMACAddress,int>::iterator itUserDataAge;
        if(bAge &&
          ((itUserDataAge = itLocalDevice->second.mapUserDataAges.find(itLocalDevice->first)) != itLocalDevice->second.mapUserDataAges.end()) &&
          (++itUserDataAge->second == m_timings.LocalVanishedAge))
        {
          UpdateLocalDevice(itNIC, itLocalDevice->first, false, CDlanDevice::eThunderbolt, true, 
            "", true, UserDataResponse(), false, CMACAddress::Null(), true, bUpdate);
          itLocalDevice->second.mapUserDataAges.erase(itUserDataAge);
        }

        std::map<CMACAddress,int>::iterator itRemoteDevice = itLocalDevice->second.mapRemoteDeviceAges.begin();
        while(itRemoteDevice != itLocalDevice->second.mapRemoteDeviceAges.end())
        {
          if(bAge) ++itRemoteDevice->second;
        
          if((itRemoteDevice->second == m_timings.RemoteVanishedAge) ||
            (setForceRemove.find(itRemoteDevice->first) != setForceRemove.end()))
          {
            bUpdate = true;
            itLocalDevice->second.itPublicDevice->RemoveRemoteDevice(itRemoteDevice->first);
            itLocalDevice->second.mapRemoteDeviceAges.erase(itRemoteDevice++);
          }
          else
          {
            if(bAge &&
              ((itUserDataAge = itLocalDevice->second.mapUserDataAges.find(itRemoteDevice->first)) != itLocalDevice->second.mapUserDataAges.end()) &&
              (++itUserDataAge->second == m_timings.RemoteVanishedAge))
            {
              UpdateRemoteDevice(itLocalDevice->second, itRemoteDevice->first, false,
                CDlanDevice::eThunderbolt, true, "", true, UserDataResponse(), false, 0.0, 0.0, true, 
                std::map<CMACAddress, CDlanDataRates>(), true, CMACAddress(), true, bUpdate);
              itLocalDevice->second.mapUserDataAges.erase(itUserDataAge);
            }

            ++itRemoteDevice;
          }
        }
        ++itLocalDevice;
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movl %edx, %ebp
movq %rsi, 0x28(%rsp)
movq 0xc0(%rdi), %rdx
leaq 0xb0(%rdi), %rax
movq %rax, 0xc8(%rsp)
movq %rcx, 0x40(%rsp)
leaq 0x8(%rcx), %rax
movq %rax, 0x38(%rsp)
movq %rdi, 0x10(%rsp)
leaq 0x90(%rdi), %r15
movq %r15, 0xd0(%rsp)
cmpq 0xc8(%rsp), %rdx
je 0x772e
leaq 0x188(%rdx), %rax
movq %rax, 0xf0(%rsp)
movq 0x1a0(%rdx), %r13
movq %rdx, 0x30(%rsp)
leaq 0x190(%rdx), %rax
movq %rax, 0xf8(%rsp)
cmpq 0xf8(%rsp), %r13
je 0x771c
movl 0x28(%r13), %eax
testb %bpl, %bpl
je 0x7343
incl %eax
movl %eax, 0x28(%r13)
movq 0x10(%rsp), %rcx
cmpl 0x48(%rcx), %eax
je 0x7365
leaq 0x20(%r13), %r12
movq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0xcf7c
cmpq 0x38(%rsp), %rax
je 0x7399
movq 0x28(%rsp), %rax
movb $0x1, (%rax)
movq 0x30(%r13), %rsi
movq %r15, %rdi
callq 0xaa58
movq %r13, %rdi
callq 0x41e0
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
movq %r13, %rsi
callq 0xd01a
movq %rbx, %r13
jmp 0x7326
testb %bpl, %bpl
je 0x74ce
leaq 0x68(%r13), %rdi
movq %rdi, 0x20(%rsp)
movq %r12, %rsi
callq 0xd10c
movq %rax, %r14
leaq 0x70(%r13), %rax
cmpq %rax, %r14
je 0x74ce
movl 0x28(%r14), %eax
incl %eax
movl %eax, 0x28(%r14)
movq 0x10(%rsp), %rcx
cmpl 0x48(%rcx), %eax
jne 0x74ce
leaq 0x100(%rsp), %rbx
movq %rbx, %rdi
leaq 0xce5c(%rip), %rsi      # 0x14249
leaq 0x18(%rsp), %rdx
callq 0x4ab0
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
andq $0x0, 0x50(%rsp)
xorl %ecx, %ecx
movb %cl, 0x58(%rsp)
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
andq $0x0, 0x70(%rsp)
movb %cl, 0x78(%rsp)
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
andq $0x0, 0x90(%rsp)
movb %cl, 0x98(%rsp)
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
andq $0x0, 0xb0(%rsp)
andw $0x0, 0x13c(%rsp)
movb %cl, 0xb8(%rsp)
andl $0x0, 0x138(%rsp)
subq $0x8, %rsp
movq 0x18(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq %r12, %rdx
xorl %ecx, %ecx
pushq $0x2
popq %r8
pushq $0x1
popq %r9
pushq 0x30(%rsp)
pushq %r9
leaq 0x150(%rsp), %rax
pushq %rax
pushq $0x0
leaq 0x70(%rsp), %r12
pushq %r12
pushq %r9
pushq %rbx
callq 0x7bd4
addq $0x40, %rsp
movq %r12, %rdi
callq 0x589e
movq %rbx, %rdi
callq 0x4170
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0xd182
leaq 0x28(%r13), %rax
movq %rax, 0xe0(%rsp)
leaq 0x38(%r13), %r12
movq 0x50(%r13), %rbx
leaq 0x40(%r13), %r15
leaq 0x68(%r13), %rax
movq %rax, 0x20(%rsp)
leaq 0x70(%r13), %rax
movq %rax, 0xe8(%rsp)
cmpq %r15, %rbx
je 0x7704
movl 0x28(%rbx), %eax
testb %bpl, %bpl
je 0x7511
incl %eax
movl %eax, 0x28(%rbx)
leaq 0x20(%rbx), %r14
movq 0x10(%rsp), %rcx
cmpl 0x50(%rcx), %eax
je 0x7533
movq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0xcf7c
cmpq 0x38(%rsp), %rax
je 0x7566
movq 0x28(%rsp), %rax
movb $0x1, (%rax)
movq 0x30(%r13), %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x63ac
movq %rbx, %rdi
callq 0x41e0
movq %rax, %r14
movq %r12, %rdi
movq %rbx, %rsi
callq 0xd182
movq %r14, %rbx
jmp 0x74fb
testb %bpl, %bpl
je 0x76f4
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0xd10c
cmpq 0xe8(%rsp), %rax
je 0x76f4
movl 0x28(%rax), %edx
incl %edx
movl %edx, 0x28(%rax)
movq 0x10(%rsp), %rcx
cmpl 0x50(%rcx), %edx
jne 0x76f4
movq %rax, 0xd8(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0xcc92(%rip), %rsi      # 0x14249
leaq 0xf(%rsp), %rdx
callq 0x4ab0
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
andq $0x0, 0x50(%rsp)
xorl %ecx, %ecx
movb %cl, 0x58(%rsp)
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
andq $0x0, 0x70(%rsp)
movb %cl, 0x78(%rsp)
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
andq $0x0, 0x90(%rsp)
movb %cl, 0x98(%rsp)
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
andq $0x0, 0xb0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x100(%rsp)
andq $0x0, 0x110(%rsp)
leaq 0x108(%rsp), %rax
movq %rax, 0x118(%rsp)
movq %rax, 0x120(%rsp)
andq $0x0, 0x128(%rsp)
andw $0x0, 0x1c(%rsp)
movb %cl, 0xb8(%rsp)
andl $0x0, 0x18(%rsp)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq 0xe0(%rsp), %rsi
movq %r14, %rdx
xorl %ecx, %ecx
pushq $0x2
popq %r8
pushq $0x1
popq %r9
pushq 0x28(%rsp)
pushq %r9
leaq 0x28(%rsp), %rax
pushq %rax
pushq %r9
leaq 0x120(%rsp), %r14
pushq %r14
pushq %r9
pushq $0x0
leaq 0x80(%rsp), %r14
pushq %r14
pushq %r9
leaq 0x180(%rsp), %rax
pushq %rax
callq 0x7f00
addq $0x50, %rsp
leaq 0x100(%rsp), %rdi
callq 0x5a86
movq %r14, %rdi
callq 0x589e
leaq 0x138(%rsp), %rdi
callq 0x4170
movq 0x20(%rsp), %rdi
movq 0xd8(%rsp), %rsi
callq 0xd182
movq %rbx, %rdi
callq 0x41e0
movq %rax, %rbx
jmp 0x74fb
movq %r13, %rdi
callq 0x41e0
movq %rax, %r13
movq 0xd0(%rsp), %r15
jmp 0x7326
movq 0x30(%rsp), %rdi
callq 0x41e0
movq %rax, %rdx
jmp 0x72ee
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x589e
leaq 0x100(%rsp), %rdi
jmp 0x777b
jmp 0x7782
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x5a86
leaq 0x48(%rsp), %rdi
callq 0x589e
leaq 0x138(%rsp), %rdi
callq 0x4170
jmp 0x7785
movq %rax, %rbx
movq %rbx, %rdi
callq 0x4410
nop