// File: /workspace/github_cpp_makefile_star2_O3/dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::UpdateLocalDevice(std::_Rb_tree_iterator<std::pair<CMACAddress const, CDlanMonitor::NetwAdapter>>, CMACAddress const&, bool, CDlanDevice::teType, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool, CDlanMonitor::UserDataResponse const&, bool, CMACAddress const&, bool, bool&)
CDlanMonitor::LocalDevice& CDlanMonitor::UpdateLocalDevice(
  std::map<CMACAddress,NetwAdapter>::iterator itNIC,
  const CMACAddress& addr,
  bool bResetAge,
  CDlanDevice::teType type,
  bool bKeepType,
  const std::string& version,
  bool bKeepVersion,
  const UserDataResponse& userData,
  bool bKeepUserData,
  const CMACAddress& cco,
  bool bKeepCCo,
  bool& bUpdate)
{
  std::map<CMACAddress,LocalDevice>::iterator itDevice = itNIC->second.mapLocalDevices.find(addr);

  if(itDevice == itNIC->second.mapLocalDevices.end())
  {
    bUpdate = true;

    CDlanLocalDeviceList::iterator itPubDevice = m_listLocalDevices.begin();
    for( ; itPubDevice != m_listLocalDevices.end(); itPubDevice++)
      if((itPubDevice->GetNICAddress() > itNIC->first) || (itPubDevice->GetAddress() > addr))
        break;

    CDlanLocalDevice localDevice(itNIC->first, addr, type, version, 
      userData.strMft, userData.strUser, userData.strAvln, cco);
    itPubDevice = m_listLocalDevices.insert(itPubDevice, localDevice);
    itDevice = itNIC->second.mapLocalDevices.insert(std::make_pair(addr, LocalDevice(itPubDevice))).first;

    if(itNIC->second.iFastBroadcastCnt > 2)
      itNIC->second.iFastBroadcastCnt = 2;
  }
  else 
  {
    if(bResetAge)
      itDevice->second.iAge = 0;

    CDlanLocalDevice updatedDevice(itNIC->first, addr,
      bKeepType ? itDevice->second.itPublicDevice->GetType() : type,
      bKeepVersion ? itDevice->second.itPublicDevice->GetVersion() : version,
      bKeepUserData ? itDevice->second.itPublicDevice->GetManufacturingString() : userData.strMft,
      bKeepUserData ? itDevice->second.itPublicDevice->GetUserDeviceName() : userData.strUser,
      bKeepUserData ? itDevice->second.itPublicDevice->GetUserNetworkName() : userData.strAvln,
      bKeepCCo ? itDevice->second.itPublicDevice->GetCCoAddress() : cco,
      itDevice->second.itPublicDevice->GetRemoteDevices());
  
    if(*itDevice->second.itPublicDevice != updatedDevice)
    {
      bUpdate = true;
      *itDevice->second.itPublicDevice = updatedDevice;
    }
  }

  if(userData.strMft.size() > 0)
    itDevice->second.mapUserDataAges[addr] = 0;

  return itDevice->second; 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movl %r9d, %r13d
movl %r8d, 0x4(%rsp)
movl %ecx, %r14d
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x20(%rsi), %rbp
leaq 0x188(%rsi), %r15
movq %r15, %rdi
movq %rdx, 0x8(%rsp)
movq %rdx, %rsi
callq 0xe6ee
leaq 0x190(%rbx), %rdx
cmpq %rdx, %rax
je 0x81a0
movq 0x220(%rsp), %rdx
testb %r14b, %r14b
movq %rax, %r15
je 0x8147
movl $0x0, 0x28(%r15)
movb 0x1f8(%rsp), %cl
testb %r13b, %r13b
movl 0x4(%rsp), %ebx
movq 0x1f0(%rsp), %r8
je 0x8166
movq 0x30(%r15), %rax
movl 0x18(%rax), %ebx
movb 0x208(%rsp), %al
testb %cl, %cl
movq %rdx, %r13
je 0x817c
movq 0x30(%r15), %r8
addq $0x20, %r8
movb 0x218(%rsp), %cl
testb %al, %al
je 0x8416
movq 0x30(%r15), %r10
leaq 0x40(%r10), %r9
leaq 0x60(%r10), %rax
subq $-0x80, %r10
jmp 0x8426
movq %r15, 0x10(%rsp)
movq 0x220(%rsp), %rax
movb $0x1, (%rax)
leaq 0x90(%r12), %r13
movq %r13, %r15
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %rdx
movq (%r15), %r15
cmpq %r13, %r15
je 0x8251
movl 0xa0(%r15), %eax
movl (%rbp), %esi
bswapl %eax
bswapl %esi
cmpl %esi, %eax
jne 0x8202
movzwl 0xa4(%r15), %eax
movzwl 0x4(%rbp), %esi
rolw $0x8, %ax
rolw $0x8, %si
movzwl %ax, %eax
movzwl %si, %esi
xorl %edi, %edi
cmpl %esi, %eax
je 0x820e
cmpl %esi, %eax
movl $0x0, %edi
sbbl %edi, %edi
orl $0x1, %edi
testl %edi, %edi
jg 0x8251
movl 0x10(%r15), %eax
movl (%rdx), %esi
bswapl %eax
bswapl %esi
cmpl %esi, %eax
jne 0x823d
movzwl 0x14(%r15), %eax
movzwl 0x4(%rdx), %esi
rolw $0x8, %ax
rolw $0x8, %si
movzwl %ax, %eax
movzwl %si, %esi
xorl %edi, %edi
cmpl %esi, %eax
je 0x8249
cmpl %esi, %eax
movl $0x0, %edi
sbbl %edi, %edi
orl $0x1, %edi
testl %edi, %edi
jle 0x81c4
movq 0x200(%rsp), %r9
leaq 0x20(%r9), %rax
leaq 0x40(%r9), %r10
leaq 0xd0(%rsp), %r11
movq %r11, 0x8(%r11)
movq %r11, (%r11)
movq $0x0, 0x10(%r11)
leaq 0x18(%rsp), %rdi
movq %rbp, %rsi
movq %rdx, %rbp
movq 0x1f0(%rsp), %r8
pushq %r11
pushq 0x218(%rsp)
pushq %r10
pushq %rax
callq 0xbf66
addq $0x20, %rsp
leaq 0xd0(%rsp), %rdi
callq 0x6024
leaq 0x18(%rsp), %rsi
movq %r13, %rdi
callq 0xebd6
movq 0x10(%rsp), %r13
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x4060
incq 0xa0(%r12)
xorl %eax, %eax
leaq 0x160(%rsp), %rcx
movl %eax, -0x18(%rcx)
movq %r14, -0x10(%rcx)
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x190(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movl (%rbp), %edx
leaq 0xf0(%rsp), %rsi
movl %edx, -0x20(%rsi)
movzwl 0x4(%rbp), %edx
movw %dx, -0x1c(%rsi)
movups -0x48(%rcx), %xmm0
movups %xmm0, -0x18(%rsi)
movq %rax, 0x8(%rsi)
movq %rsi, 0x10(%rsi)
movq %rsi, 0x18(%rsi)
movq %rax, 0x20(%rsi)
movl %eax, (%rsi)
leaq 0x120(%rsp), %rcx
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movl %eax, (%rcx)
leaq 0xd0(%rsp), %rsi
movq %r13, %rdi
callq 0xec90
movq %rax, %r15
leaq 0x118(%rsp), %rdi
callq 0x5d0e
leaq 0xe8(%rsp), %rdi
callq 0x5d0e
leaq 0x188(%rsp), %rdi
callq 0x5d0e
leaq 0x158(%rsp), %rdi
callq 0x5d0e
cmpl $0x3, 0x2c(%rbx)
jl 0x83b0
movl $0x2, 0x2c(%rbx)
leaq 0xb8(%rsp), %r14
movq %r14, %rdi
callq 0x6024
movq -0x30(%r14), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x83e1
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x83fc
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movq %rbp, %rbx
jne 0x84f2
jmp 0x84ff
movq 0x200(%rsp), %r9
leaq 0x20(%r9), %rax
leaq 0x40(%r9), %r10
movq 0x30(%r15), %r11
leaq 0xa6(%r11), %rdx
testb %cl, %cl
movq 0x210(%rsp), %r12
cmovneq %rdx, %r12
addq $0xb0, %r11
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
movl %ebx, %ecx
pushq %r11
pushq %r12
pushq %r10
pushq %rax
callq 0xbf66
addq $0x20, %rsp
movq 0x30(%r15), %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0xd140
testb %al, %al
jne 0x8493
movb $0x1, (%r13)
movq 0x30(%r15), %rdi
addq $0x10, %rdi
leaq 0x18(%rsp), %rsi
callq 0xc070
leaq 0xb8(%rsp), %r14
movq %r14, %rdi
callq 0x6024
movq -0x30(%r14), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x84c4
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movq 0x8(%rsp), %rbx
je 0x84e4
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x84ff
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x851a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4270
movq 0x200(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x853b
leaq 0x68(%r15), %rdi
movq %rbx, %rsi
callq 0xc0e0
movl $0x0, (%rax)
addq $0x28, %r15
movq %r15, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x5d0e
leaq 0xe8(%rsp), %rdi
callq 0x5d0e
leaq 0x188(%rsp), %rdi
callq 0x5d0e
leaq 0x158(%rsp), %rdi
callq 0x5d0e
jmp 0x8590
movq %rax, %rbx
jmp 0x85a7
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x6024
jmp 0x85b1
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xbffa
movq %rbx, %rdi
callq 0x43e0
nop