// File: /workspace/github_cpp_makefile_star2_O1/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, %r15d
movl %r8d, 0xc(%rsp)
movl %ecx, %r14d
movq %rsi, %rbx
movq %rdi, %rbp
leaq 0x20(%rsi), %r13
leaq 0x188(%rsi), %r12
movq %r12, %rdi
movq %rdx, (%rsp)
movq %rdx, %rsi
callq 0xe946
leaq 0x190(%rbx), %rdx
cmpq %rdx, %rax
je 0x82a5
movq 0x220(%rsp), %rdx
testb %r14b, %r14b
movq %rax, %rbp
je 0x8239
movl $0x0, 0x28(%rbp)
movb 0x1f8(%rsp), %al
testb %r15b, %r15b
movq 0x200(%rsp), %r12
movq 0x210(%rsp), %rbx
movl 0xc(%rsp), %ecx
movq 0x1f0(%rsp), %r8
je 0x8268
movq 0x30(%rbp), %rcx
movl 0x18(%rcx), %ecx
movb 0x208(%rsp), %sil
testb %al, %al
movq %rdx, %r15
je 0x827f
movq 0x30(%rbp), %r8
addq $0x20, %r8
movq %r12, %r9
testb %sil, %sil
je 0x828f
movq 0x30(%rbp), %r9
addq $0x40, %r9
testb %sil, %sil
je 0x8477
movq 0x30(%rbp), %rax
addq $0x60, %rax
jmp 0x847c
movq 0x220(%rsp), %rax
movb $0x1, (%rax)
leaq 0x90(%rbp), %r14
movq %r14, %r15
movq (%rsp), %rdx
movl 0xc(%rsp), %ecx
movq 0x1f0(%rsp), %r8
movq (%r15), %r15
cmpq %r14, %r15
je 0x8359
movl 0xa0(%r15), %eax
movl (%r13), %edi
bswapl %eax
bswapl %edi
cmpl %edi, %eax
jne 0x830a
movzwl 0xa4(%r15), %eax
movzwl 0x4(%r13), %esi
rolw $0x8, %ax
rolw $0x8, %si
movzwl %ax, %eax
movzwl %si, %edi
xorl %esi, %esi
cmpl %edi, %eax
je 0x8316
cmpl %edi, %eax
movl $0x0, %esi
sbbl %esi, %esi
orl $0x1, %esi
testl %esi, %esi
jg 0x8359
movl 0x10(%r15), %eax
movl (%rdx), %edi
bswapl %eax
bswapl %edi
cmpl %edi, %eax
jne 0x8345
movzwl 0x14(%r15), %eax
movzwl 0x4(%rdx), %esi
rolw $0x8, %ax
rolw $0x8, %si
movzwl %ax, %eax
movzwl %si, %edi
xorl %esi, %esi
cmpl %edi, %eax
je 0x8351
cmpl %edi, %eax
movl $0x0, %esi
sbbl %esi, %esi
orl $0x1, %esi
testl %esi, %esi
jle 0x82ca
movq 0x200(%rsp), %r9
leaq 0x20(%r9), %rax
leaq 0x40(%r9), %r10
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r11
movaps %xmm0, (%r11)
movq $0x0, 0x10(%r11)
movq %r11, 0x8(%r11)
movq %r11, (%r11)
leaq 0x90(%rsp), %rdi
movq %r13, %rsi
pushq %r11
pushq 0x218(%rsp)
pushq %r10
pushq %rax
callq 0xc1c6
addq $0x20, %rsp
leaq 0x10(%rsp), %rdi
callq 0x606e
leaq 0x90(%rsp), %rsi
movq %r14, %rdi
callq 0xee20
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x4060
incq 0xa0(%rbp)
xorl %esi, %esi
leaq 0x160(%rsp), %rcx
movl %esi, -0x18(%rcx)
movq %r14, -0x10(%rcx)
movl %esi, (%rcx)
movq %rsi, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rsi, 0x20(%rcx)
leaq 0x190(%rsp), %rax
movl %esi, (%rax)
movq %rsi, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rsi, 0x20(%rax)
movq (%rsp), %r8
movl (%r8), %edi
leaq 0x30(%rsp), %rdx
movl %edi, -0x20(%rdx)
movzwl 0x4(%r8), %edi
movw %di, -0x1c(%rdx)
movups -0x48(%rax), %xmm0
movups %xmm0, -0x18(%rdx)
movl %esi, (%rdx)
movb $0x1, %sil
testb %sil, %sil
jne 0x8541
xorl %edi, %edi
movq %rdi, 0x38(%rsp)
leaq 0x180(%rsp), %rsi
movups -0x10(%rsi), %xmm0
movups %xmm0, 0x40(%rsp)
movq %rdx, 0x8
movq (%rsi), %rdx
movq %rdx, 0x50(%rsp)
movq %rdi, -0x18(%rsi)
movq %rcx, -0x10(%rsi)
movq %rcx, -0x8(%rsi)
jmp 0x8556
leaq 0x20(%r12), %rax
movb 0x218(%rsp), %dl
testb %sil, %sil
je 0x8492
movq 0x30(%rbp), %r10
subq $-0x80, %r10
jmp 0x8497
leaq 0x40(%r12), %r10
testb %dl, %dl
je 0x84a4
movl $0xa6, %ebx
addq 0x30(%rbp), %rbx
movl $0xb0, %r11d
addq 0x30(%rbp), %r11
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
movq (%rsp), %rdx
pushq %r11
pushq %rbx
pushq %r10
pushq %rax
callq 0xc1c6
addq $0x20, %rsp
movq 0x30(%rbp), %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0xd3be
testb %al, %al
jne 0x84fc
movb $0x1, (%r15)
movq 0x30(%rbp), %rdi
addq $0x10, %rdi
leaq 0x90(%rsp), %rsi
callq 0xc2d0
leaq 0x130(%rsp), %r14
movq %r14, %rdi
callq 0x606e
movq -0x30(%r14), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x852d
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jmp 0x865e
leaq 0x50(%rsp), %rsi
movq $0x0, -0x18(%rsi)
movq %rdx, -0x10(%rsi)
movq %rdx, -0x8(%rsi)
movq $0x0, (%rsi)
leaq 0x60(%rsp), %rdx
movq 0x198(%rsp), %rsi
movl $0x0, (%rdx)
testq %rsi, %rsi
je 0x85ac
movq %rsi, 0x68(%rsp)
leaq 0x1b0(%rsp), %rcx
movups -0x10(%rcx), %xmm0
movups %xmm0, 0x70(%rsp)
movq %rdx, 0x8(%rsi)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
movq $0x0, -0x18(%rcx)
movq %rax, -0x10(%rcx)
movq %rax, -0x8(%rcx)
jmp 0x85c4
leaq 0x80(%rsp), %rcx
movq $0x0, -0x18(%rcx)
movq %rdx, -0x10(%rcx)
movq %rdx, -0x8(%rcx)
movq $0x0, (%rcx)
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0xeeda
movq %rax, %rbp
leaq 0x58(%rsp), %rdi
callq 0x5d58
leaq 0x28(%rsp), %rdi
callq 0x5d58
leaq 0x188(%rsp), %rdi
callq 0x5d58
leaq 0x158(%rsp), %rdi
callq 0x5d58
cmpl $0x3, 0x2c(%rbx)
jl 0x8616
movl $0x2, 0x2c(%rbx)
leaq 0x130(%rsp), %r14
movq %r14, %rdi
callq 0x606e
movq -0x30(%r14), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x8647
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movq 0x200(%rsp), %r12
movq (%rsp), %rbx
je 0x8674
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8695
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x86b6
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4270
cmpq $0x0, 0x8(%r12)
je 0x86d0
leaq 0x68(%rbp), %rdi
movq %rbx, %rsi
callq 0xc34a
movl $0x0, (%rax)
addq $0x28, %rbp
movq %rbp, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x5d58
leaq 0x28(%rsp), %rdi
callq 0x5d58
leaq 0x188(%rsp), %rdi
callq 0x5d58
leaq 0x158(%rsp), %rdi
callq 0x5d58
jmp 0x871f
movq %rax, %rbx
jmp 0x8733
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x606e
jmp 0x8740
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xc25a
movq %rbx, %rdi
callq 0x43e0