// File: /workspace/github_cpp_makefile_star2_O2/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 0xd8e2
leaq 0xa0(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x70(%rsp), %rbx
andl $0x0, (%rbx)
andq $0x0, 0x8(%rbx)
movq %rbx, 0x10(%rbx)
movq %rbx, 0x18(%rbx)
andq $0x0, 0x20(%rbx)
xorl %eax, %eax
cmpq %rax, 0x30(%r15)
je 0x11bf5
leaq 0x8(%r15), %rsi
leaq 0x68(%rsp), %rdi
callq 0x127ae
jmp 0x11bff
leaq 0x68(%rsp), %rsi
callq 0x11e02
movq 0x80(%rsp), %r12
leaq 0x40(%r15), %rax
movq %rax, 0x38(%rsp)
leaq 0x68(%r15), %rax
movq %rax, 0x10(%rsp)
movq %r15, 0x28(%rsp)
leaq 0x70(%r15), %rax
movq %rax, 0x30(%rsp)
leaq 0x18(%rsp), %r13
cmpq %rbx, %r12
je 0x11d75
andw $0x0, 0x1c(%rsp)
andl $0x0, 0x18(%rsp)
movq 0x20(%r12), %rsi
movq %r13, %rdx
callq 0x11fac
testb %al, %al
je 0x11d65
movq %r14, %rdi
movq %r13, %rsi
callq 0xe0ae
cmpq 0x38(%rsp), %rax
jne 0x11d65
leaq 0x20(%r12), %rbp
movq (%rbp), %rsi
xorl %edx, %edx
callq 0x1204e
testb %al, %al
je 0x11d65
movq (%rbp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x120ec
testb %al, %al
je 0x11d65
movq %r14, %rdi
movq %r13, %rsi
callq 0xcb94
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x12ed4
movq %rax, %r15
cmpq 0x30(%rsp), %rax
je 0x11d06
leaq 0x28(%r15), %rdi
movq %rdi, 0x20(%rsp)
movq %rbp, %rsi
callq 0x6591
testb %al, %al
je 0x11d06
movl 0x48(%r15), %eax
cmpl 0xc(%rsp), %eax
jne 0x11d06
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x1270c
movq %rax, %rdi
movq 0x20(%rsp), %rsi
callq 0x12772
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x131f6
jmp 0x11d65
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
andq $0x0, 0x48(%rsp)
movb $0x0, 0x50(%rsp)
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x41b0
movl 0xc(%rsp), %edx
movl %edx, 0x60(%rsp)
callq 0x12186
movl %eax, 0x64(%rsp)
cmpl $-0x1, %eax
je 0x11d5b
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x1270c
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x12772
leaq 0x40(%rsp), %rdi
callq 0x4170
movq %r12, %rdi
callq 0x42c0
movq %rax, %r12
jmp 0x11c2c
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x11b2e
leaq 0x98(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x12b42
movq %rbx, %rdi
callq 0x12206
leaq 0x68(%rsp), %rdi
callq 0x4ffc
leaq 0x98(%rsp), %rdi
callq 0x12ade
movb $0x1, %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11de0
jmp 0x11de0
jmp 0x11de0
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4170
jmp 0x11de3
jmp 0x11de0
jmp 0x11de0
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x4ffc
leaq 0x98(%rsp), %rdi
callq 0x12ade
movq %rbx, %rdi
callq 0x4410