// File: /workspace/github_cpp_makefile_star2_O3/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::RefreshAdapters()
bool CPacketInterfaceLinux::RefreshAdapters()
{
  m_macs.clear();

  std::map<CMACAddress,Interface> newifcs;
  
  std::set<std::string> setIfNames;
  
  if(m_ifcFilter.empty())
    GetInterfaceNames(setIfNames);
  else
    setIfNames = m_ifcFilter;
  
  for(std::set<std::string>::iterator itIfName = setIfNames.begin(); 
    itIfName != setIfNames.end(); ++itIfName)
  {
    CMACAddress mac;
    if (GetCMACAddress(itIfName->c_str(), mac) && m_macs.find(mac) == m_macs.end())
    {
      int ifindex;
      if(InterfaceIsActive(itIfName->c_str(), !m_ifcFilter.empty()) && GetInterfaceIndex(itIfName->c_str(), ifindex))
      {
        m_macs.insert(mac);
        std::map<CMACAddress,Interface>::iterator itIfc;
        if(((itIfc = m_ifcs.find(mac)) != m_ifcs.end()) &&
          (itIfc->second.ifname == *itIfName) && 
          (itIfc->second.ifindex == ifindex))
        {
          newifcs[mac] = itIfc->second;
          m_ifcs.erase(itIfc);
        }
        else
        {
          Interface newIfc;
          newIfc.ifname = *itIfName;
          newIfc.ifindex = ifindex;
          newIfc.fdsocket = openNewSocket(itIfName->c_str(), ifindex);
          if(newIfc.fdsocket != -1)
            newifcs[mac] = newIfc;
        }
      }
    }
  }

  closeAllSockets();
  m_ifcs = newifcs;

  AttachFilter();

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %r15
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0xeb4c
leaq 0xa0(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq 0x70(%rsp), %rbx
movl %ecx, (%rbx)
movq %rcx, 0x8(%rbx)
movq %rbx, 0x10(%rbx)
movq %rbx, 0x18(%rbx)
movq %rcx, 0x20(%rbx)
cmpq %rcx, 0x30(%r15)
je 0x1375f
leaq 0x8(%r15), %rsi
leaq 0x68(%rsp), %rdi
callq 0x144c4
jmp 0x13769
leaq 0x68(%rsp), %rsi
callq 0x139d6
movq %r15, 0x28(%rsp)
movq 0x80(%rsp), %r15
cmpq %rbx, %r15
je 0x13938
movq 0x28(%rsp), %rax
leaq 0x40(%rax), %rcx
movq %rcx, 0x60(%rsp)
leaq 0x68(%rax), %rcx
movq %rcx, 0x20(%rsp)
addq $0x70, %rax
movq %rax, 0x58(%rsp)
leaq 0x10(%rsp), %r13
movw $0x0, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
movq 0x20(%r15), %rsi
movq %r13, %rdx
callq 0x13c1e
testb %al, %al
je 0x13924
movq %r14, %rdi
movq %r13, %rsi
callq 0xf3a4
cmpq 0x60(%rsp), %rax
jne 0x13924
leaq 0x20(%r15), %rbp
movq (%rbp), %rsi
xorl %edx, %edx
callq 0x13cca
testb %al, %al
je 0x13924
movq (%rbp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x13d6e
testb %al, %al
je 0x13924
movq %r14, %rdi
movq %r13, %rsi
callq 0xdaf2
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x14bc2
movq %rax, %r12
cmpq 0x58(%rsp), %rax
je 0x138a3
movq 0x30(%r12), %rdx
cmpq 0x28(%r15), %rdx
jne 0x138a3
movq %r12, %rax
addq $0x28, %rax
movq %rax, 0x18(%rsp)
testq %rdx, %rdx
je 0x1385d
movq (%rbp), %rsi
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x4280
testl %eax, %eax
jne 0x138a3
movl 0x48(%r12), %eax
cmpl 0xc(%rsp), %eax
jne 0x138a3
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x1442c
movq %rax, %rbp
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x41a0
movq 0x48(%r12), %rax
movq %rax, 0x20(%rbp)
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x1508e
jmp 0x13924
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x41a0
movl 0xc(%rsp), %edx
movl %edx, 0x50(%rsp)
callq 0x13e10
movl %eax, 0x54(%rsp)
cmpl $-0x1, %eax
je 0x13908
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x1442c
movq %rax, %r12
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x41a0
movq 0x50(%rsp), %rax
movq %rax, 0x20(%r12)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x13924
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4270
movq %r15, %rdi
callq 0x42d0
movq %rax, %r15
cmpq %rbx, %rax
jne 0x137a4
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x13698
leaq 0x68(%rbx), %rdi
leaq 0x98(%rsp), %rsi
callq 0x14858
movq %rbx, %rdi
callq 0x13ea2
leaq 0x68(%rsp), %rdi
callq 0x522c
leaq 0x98(%rsp), %rdi
callq 0x147e0
movb $0x1, %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x139b4
jmp 0x139b4
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x139b7
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0x139b7
jmp 0x139b4
jmp 0x139b4
jmp 0x139b4
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x522c
leaq 0x98(%rsp), %rdi
callq 0x147e0
movq %rbx, %rdi
callq 0x43e0