// File: /workspace/github_cpp_makefile_star2_O3/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 %ecx, 0x4(%rsp)
movq %rdx, %rbx
movq %rsi, %rax
movb 0x1d0(%rsp), %cl
movq 0x1c8(%rsp), %rsi
movb 0x1c0(%rsp), %dl
movb 0x1b0(%rsp), %dil
movb 0x1a8(%rsp), %r14b
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 0x86de
movl 0x10(%rax), %ebp
xorl (%rbx), %ebp
movzwl 0x14(%rax), %r15d
xorw 0x4(%rbx), %r15w
movzwl %r15w, %r15d
orl %ebp, %r15d
jne 0x861d
testb %r9b, %r9b
je 0x864a
movl 0x18(%rax), %r8d
movl %r8d, 0x24(%rsp)
leaq 0x20(%rax), %r9
testb %r10b, %r10b
cmovneq %r9, %r13
leaq 0x40(%rax), %rbp
leaq 0x60(%rax), %r9
leaq 0x80(%rax), %r10
movq 0x1a0(%rsp), %r11
leaq 0x20(%r11), %r15
testb %r14b, %r14b
cmovneq %r9, %r15
cmoveq %r11, %rbp
leaq 0x40(%r11), %r12
cmovneq %r10, %r12
testb %dil, %dil
je 0x869d
movsd 0xa0(%rax), %xmm0
movsd 0xa8(%rax), %xmm1
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x18(%rsp)
leaq 0xb0(%rax), %rdi
testb %dl, %dl
movq 0x1b8(%rsp), %r14
cmovneq %rdi, %r14
testb %cl, %cl
je 0x8775
addq $0xe0, %rax
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x725e
jmp 0x8783
movq 0x1d8(%rsp), %rax
movb $0x1, (%rax)
movq 0x1a0(%rsp), %rbp
leaq 0x20(%rbp), %r15
movl %r8d, %r14d
leaq 0x40(%rbp), %r12
leaq 0x6(%rsi), %rdx
leaq 0x28(%rsp), %rdi
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
callq 0xc15e
subq $0x8, %rsp
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
movl %r14d, %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 0x1c8(%rsp)
pushq %r12
callq 0xc1da
addq $0x20, %rsp
leaq 0x28(%rsp), %rdi
callq 0x5f24
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x10, %rdi
leaq 0x58(%rsp), %rsi
callq 0x64c4
jmp 0x87eb
leaq 0x6(%rsi), %rdx
leaq 0x28(%rsp), %rdi
callq 0xc15e
subq $0x8, %rsp
leaq 0x30(%rsp), %rax
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
movl 0x2c(%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 0xc1da
addq $0x20, %rsp
leaq 0x28(%rsp), %rdi
callq 0x5f24
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x10, %rdi
leaq 0x58(%rsp), %rsi
callq 0x64c4
testb %al, %al
je 0x87eb
movq 0x1d8(%rsp), %rax
movb $0x1, (%rax)
leaq 0x128(%rsp), %rdi
callq 0x5f24
leaq 0xf8(%rsp), %r15
movq %r15, %rdi
callq 0x60e0
movq -0x30(%r15), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x8829
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movl 0x4(%rsp), %ebp
je 0x884e
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x886f
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4270
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x888a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4270
testb %bpl, %bpl
je 0x88a6
movq 0x8(%rsp), %rax
leaq 0x10(%rax), %rdi
movq %rbx, %rsi
callq 0xc0e0
movl $0x0, (%rax)
movq 0x1a0(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x88cc
movq 0x8(%rsp), %rdi
addq $0x40, %rdi
movq %rbx, %rsi
callq 0xc0e0
movl $0x0, (%rax)
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x88e2
jmp 0x88f1
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xc26e
jmp 0x88fe
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5f24
movq %rbx, %rdi
callq 0x43e0