// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::UpdateRemoteDevice(CDlanMonitor::LocalDevice&, CMACAddress const&, bool, CDlanDevice::teType, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool, CDlanMonitor::UserDataResponse const&, bool, double, double, bool, std::map<CMACAddress, CDlanDataRates, std::less<CMACAddress>, std::allocator<std::pair<CMACAddress const, CDlanDataRates>>> const&, bool, CMACAddress const&, bool, bool&)
void CDlanMonitor::UpdateRemoteDevice(
  LocalDevice& localDevice,
  const CMACAddress& addr,
  bool bResetAge,
  CDlanDevice::teType type,
  bool bKeepType,
  const std::string& version,
  bool bKeepVersion,
  const UserDataResponse& userData,
  bool bKeepUserData,
  double tx,
  double rx,
  bool bKeepRates,
  const std::map<CMACAddress, CDlanDataRates>& remoteDataRates,
  bool bKeepRemoteRates,
  const CMACAddress& firstBridgedAddr,
  bool bKeepBrdgAddr,
  bool& bUpdate)
{
  CDlanRemoteDeviceList::const_iterator itPublicRemoteDevice = localDevice.itPublicDevice->GetRemoteDevices().begin();
  for( ; itPublicRemoteDevice != localDevice.itPublicDevice->GetRemoteDevices().end(); ++itPublicRemoteDevice)
  {
    if(itPublicRemoteDevice->GetAddress() == addr)
      break;
  }
  
  if(itPublicRemoteDevice == localDevice.itPublicDevice->GetRemoteDevices().end())
  {
    bUpdate = true;

    CDlanRemoteDevice remoteDevice(addr, type, version, 
      userData.strMft, userData.strUser, userData.strAvln, tx, rx, 
      remoteDataRates, std::set<CMACAddress>(&firstBridgedAddr, &firstBridgedAddr+ 1));
    localDevice.itPublicDevice->UpdateRemoteDevice(remoteDevice);
  }
  else
  {
    CDlanRemoteDevice remoteDevice(addr, 
      bKeepType ? itPublicRemoteDevice->GetType() : type,
      bKeepVersion ? itPublicRemoteDevice->GetVersion() : version,
      bKeepUserData ? itPublicRemoteDevice->GetManufacturingString() : userData.strMft,
      bKeepUserData ? itPublicRemoteDevice->GetUserDeviceName() : userData.strUser,
      bKeepUserData ? itPublicRemoteDevice->GetUserNetworkName() : userData.strAvln,
      bKeepRates ? itPublicRemoteDevice->GetTxRate() : tx,
      bKeepRates ? itPublicRemoteDevice->GetRxRate() : rx,
      bKeepRemoteRates ? itPublicRemoteDevice->GetRemoteRates() : remoteDataRates,
      bKeepBrdgAddr ? itPublicRemoteDevice->GetBridgedAddresses() : std::set<CMACAddress>(&firstBridgedAddr, &firstBridgedAddr + 1));
      
    if(localDevice.itPublicDevice->UpdateRemoteDevice(remoteDevice))
      bUpdate = true;
  }

  if(bResetAge)
    localDevice.mapRemoteDeviceAges[addr] = 0;
  
  if(userData.strMft.size() > 0)
    localDevice.mapUserDataAges[addr] = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movl %r8d, 0x4(%rsp)
movl %ecx, 0x24(%rsp)
movq %rdx, %rbx
movq %rsi, %rax
movb 0x1d0(%rsp), %cl
movq 0x1c8(%rsp), %rsi
movb 0x1c0(%rsp), %dl
movq 0x1b8(%rsp), %r14
movb 0x1b0(%rsp), %dil
movb 0x1a8(%rsp), %r8b
movb 0x198(%rsp), %r10b
movq 0x190(%rsp), %r13
movl $0xb0, %r11d
movq %rax, 0x8(%rsp)
addq 0x8(%rax), %r11
movq %r11, %rax
movq (%rax), %rax
cmpq %r11, %rax
je 0x87d8
movl 0x10(%rax), %ebp
xorl (%rbx), %ebp
movzwl 0x14(%rax), %r15d
xorw 0x4(%rbx), %r15w
movzwl %r15w, %r15d
orl %ebp, %r15d
jne 0x87b8
cmpq %r11, %rax
je 0x887b
testb %r9b, %r9b
je 0x87ef
movl 0x18(%rax), %r9d
movl %r9d, 0x4(%rsp)
leaq 0x20(%rax), %r9
testb %r10b, %r10b
cmovneq %r9, %r13
leaq 0x40(%rax), %rbp
leaq 0x60(%rax), %r9
movq 0x1a0(%rsp), %r11
leaq 0x20(%r11), %r15
leaq 0x80(%rax), %r10
testb %r8b, %r8b
cmoveq %r11, %rbp
cmovneq %r9, %r15
leaq 0x40(%r11), %r12
cmovneq %r10, %r12
testb %dil, %dil
je 0x8835
movsd 0xa0(%rax), %xmm0
testb %dil, %dil
je 0x8842
movsd 0xa8(%rax), %xmm1
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x18(%rsp)
leaq 0xb0(%rax), %rdi
testb %dl, %dl
cmovneq %rdi, %r14
testb %cl, %cl
je 0x890b
addq $0xe0, %rax
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x7344
jmp 0x8919
movq 0x1d8(%rsp), %rax
movb $0x1, (%rax)
movq 0x1a0(%rsp), %rbp
leaq 0x20(%rbp), %r15
leaq 0x40(%rbp), %r12
leaq 0x6(%rsi), %rdx
leaq 0x28(%rsp), %rdi
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
callq 0xc3c8
subq $0x8, %rsp
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
movq %r13, %rcx
movq %rbp, %r8
movq %r15, %r9
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
leaq 0x30(%rsp), %rax
pushq %rax
pushq %r14
pushq %r12
callq 0xc44a
addq $0x20, %rsp
leaq 0x28(%rsp), %rdi
callq 0x5f6e
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x10, %rdi
leaq 0x58(%rsp), %rsi
callq 0x6508
jmp 0x8981
leaq 0x6(%rsi), %rdx
leaq 0x28(%rsp), %rdi
callq 0xc3c8
subq $0x8, %rsp
leaq 0x30(%rsp), %rax
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
movq %r13, %rcx
movq %rbp, %r8
movq %r15, %r9
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
pushq %rax
pushq %r14
pushq %r12
callq 0xc44a
addq $0x20, %rsp
leaq 0x28(%rsp), %rdi
callq 0x5f6e
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x10, %rdi
leaq 0x58(%rsp), %rsi
callq 0x6508
testb %al, %al
je 0x8981
movq 0x1d8(%rsp), %rax
movb $0x1, (%rax)
leaq 0x128(%rsp), %rdi
callq 0x5f6e
leaq 0xf8(%rsp), %r15
movq %r15, %rdi
callq 0x612a
movq -0x30(%r15), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x89bf
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x89e0
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8a01
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8a1c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4270
cmpb $0x0, 0x24(%rsp)
je 0x8a3a
movq 0x8(%rsp), %rax
leaq 0x10(%rax), %rdi
movq %rbx, %rsi
callq 0xc34a
movl $0x0, (%rax)
movq 0x1a0(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x8a60
movq 0x8(%rsp), %rdi
addq $0x40, %rdi
movq %rbx, %rsi
callq 0xc34a
movl $0x0, (%rax)
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8a76
jmp 0x8a85
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xc4de
jmp 0x8a92
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5f6e
movq %rbx, %rdi
callq 0x43e0