// File: /workspace/github_cpp_makefile_star2_O1/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 0xed96
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 0x13c9f
leaq 0x8(%r15), %rsi
leaq 0x68(%rsp), %rdi
callq 0x14a72
jmp 0x13ca9
leaq 0x68(%rsp), %rsi
callq 0x13f16
movq %r15, 0x28(%rsp)
movq 0x80(%rsp), %r15
cmpq %rbx, %r15
je 0x13e78
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 0x14184
testb %al, %al
je 0x13e64
movq %r14, %rdi
movq %r13, %rsi
callq 0xf5f6
cmpq 0x60(%rsp), %rax
jne 0x13e64
leaq 0x20(%r15), %rbp
movq (%rbp), %rsi
xorl %edx, %edx
callq 0x14238
testb %al, %al
je 0x13e64
movq (%rbp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x142e4
testb %al, %al
je 0x13e64
movq %r14, %rdi
movq %r13, %rsi
callq 0xdd4e
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x15174
movq %rax, %r12
cmpq 0x58(%rsp), %rax
je 0x13de3
movq 0x30(%r12), %rdx
cmpq 0x28(%r15), %rdx
jne 0x13de3
movq %r12, %rax
addq $0x28, %rax
movq %rax, 0x18(%rsp)
testq %rdx, %rdx
je 0x13d9d
movq (%rbp), %rsi
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x4280
testl %eax, %eax
jne 0x13de3
movl 0x48(%r12), %eax
cmpl 0xc(%rsp), %eax
jne 0x13de3
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x149da
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 0x1564c
jmp 0x13e64
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 0x1438a
movl %eax, 0x54(%rsp)
cmpl $-0x1, %eax
je 0x13e48
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x149da
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 0x13e64
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4270
movq %r15, %rdi
callq 0x42d0
movq %rax, %r15
cmpq %rbx, %rax
jne 0x13ce4
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x13bd8
leaq 0x68(%rbx), %rdi
leaq 0x98(%rsp), %rsi
callq 0x14e08
movq %rbx, %rdi
callq 0x14418
leaq 0x68(%rsp), %rdi
callq 0x525e
leaq 0x98(%rsp), %rdi
callq 0x14d90
movb $0x1, %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13ef4
jmp 0x13ef4
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x13ef7
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0x13ef7
jmp 0x13ef4
jmp 0x13ef4
jmp 0x13ef4
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x525e
leaq 0x98(%rsp), %rdi
callq 0x14d90
movq %rbx, %rdi
callq 0x43e0