// File: /workspace/github_cpp_makefile_star2_O2/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 $0x168, %rsp            # imm = 0x168
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movl %r9d, %r15d
movl %r8d, 0xc(%rsp)
movl %ecx, 0x34(%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movq 0x1c8(%rsp), %rax
movq %rax, 0x28(%rsp)
movb 0x1b8(%rsp), %r13b
movb 0x1a8(%rsp), %r12b
movq 0x1a0(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0xb0, %ebp
addq 0x8(%rsi), %rbp
movq (%rbp), %rbp
movq 0x8(%r14), %rax
leaq 0xb0(%rax), %rcx
cmpq %rcx, %rbp
je 0x7f8a
leaq 0x10(%rbp), %rdi
movq %rbx, %rsi
callq 0x5b4d
testb %al, %al
je 0x7f62
movq 0x8(%r14), %rax
addq $0xb0, %rax
cmpq %rax, %rbp
je 0x8052
testb %r15b, %r15b
je 0x7fa5
movl 0x18(%rbp), %eax
movl %eax, 0xc(%rsp)
leaq 0x20(%rbp), %rax
testb %r12b, %r12b
movq 0x20(%rsp), %rcx
cmovneq %rax, %rcx
movq %rcx, 0x20(%rsp)
leaq 0x40(%rbp), %r15
leaq 0x60(%rbp), %rax
leaq 0x80(%rbp), %rcx
movq 0x1b0(%rsp), %rdx
leaq 0x20(%rdx), %r12
testb %r13b, %r13b
cmovneq %rax, %r12
cmoveq %rdx, %r15
leaq 0x40(%rdx), %r13
cmovneq %rcx, %r13
cmpb $0x0, 0x1c0(%rsp)
je 0x800e
movsd 0xa0(%rbp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xa8(%rbp), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0xb0(%rbp), %rax
cmpb $0x0, 0x1d0(%rsp)
movq 0x28(%rsp), %rcx
cmovneq %rax, %rcx
movq %rcx, 0x28(%rsp)
cmpb $0x0, 0x1e0(%rsp)
je 0x80e2
addq $0xe0, %rbp
leaq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0x7048
jmp 0x80f8
movq 0x1e8(%rsp), %rax
movb $0x1, (%rax)
movq 0x1b0(%rsp), %rbp
leaq 0x20(%rbp), %r15
leaq 0x40(%rbp), %r13
movq 0x1d8(%rsp), %rsi
leaq 0x6(%rsi), %rdx
leaq 0x38(%rsp), %r12
movq %r12, %rdi
callq 0xacee
subq $0x8, %rsp
leaq 0x70(%rsp), %rdi
movq %rbx, %rsi
movl 0x14(%rsp), %edx
movq 0x1a8(%rsp), %rcx
movq %rbp, %r8
movq %r15, %r9
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
pushq %r12
pushq 0x1d8(%rsp)
pushq %r13
callq 0xad32
addq $0x20, %rsp
leaq 0x38(%rsp), %rdi
callq 0x595a
movq 0x8(%r14), %rdi
addq $0x10, %rdi
leaq 0x68(%rsp), %rsi
callq 0x632c
jmp 0x815f
movq 0x1d8(%rsp), %rsi
leaq 0x6(%rsi), %rdx
leaq 0x38(%rsp), %rdi
callq 0xacee
subq $0x8, %rsp
leaq 0x40(%rsp), %rax
leaq 0x70(%rsp), %rdi
movq %rbx, %rsi
movl 0x14(%rsp), %edx
movq 0x28(%rsp), %rcx
movq %r15, %r8
movq %r12, %r9
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
pushq %rax
pushq 0x38(%rsp)
pushq %r13
callq 0xad32
addq $0x20, %rsp
leaq 0x38(%rsp), %rdi
callq 0x595a
movq 0x8(%r14), %rdi
addq $0x10, %rdi
leaq 0x68(%rsp), %rsi
callq 0x632c
testb %al, %al
je 0x815f
movq 0x1e8(%rsp), %rax
movb $0x1, (%rax)
leaq 0x68(%rsp), %rdi
callq 0x5a60
cmpb $0x0, 0x34(%rsp)
je 0x817f
leaq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0xac88
andl $0x0, (%rax)
movq 0x1b0(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x81a0
addq $0x40, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xac88
andl $0x0, (%rax)
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x81b6
jmp 0x81c5
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x5a60
jmp 0x81d2
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x595a
movq %rbx, %rdi
callq 0x4410