// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x3b8, %rsp            # imm = 0x3B8
movl %r9d, %eax
movl %r8d, %r9d
movq %rdx, %r11
movq %rsi, %rbx
movq %rdi, %r14
movb %al, %r8b
movb %cl, %r10b
movq 0x58(%rbp), %rax
movb 0x50(%rbp), %al
movq 0x48(%rbp), %rcx
movb 0x40(%rbp), %cl
movq 0x38(%rbp), %rdx
movb 0x30(%rbp), %dl
movb 0x28(%rbp), %sil
movq 0x20(%rbp), %rdi
movb 0x18(%rbp), %dil
movq 0x10(%rbp), %r15
movq %r14, -0x20(%rbp)
movq %rbx, -0x28(%rbp)
movq %r11, -0x30(%rbp)
andb $0x1, %r10b
movb %r10b, -0x31(%rbp)
movl %r9d, -0x38(%rbp)
andb $0x1, %r8b
movb %r8b, -0x39(%rbp)
andb $0x1, %dil
movb %dil, -0x3a(%rbp)
andb $0x1, %sil
movb %sil, -0x3b(%rbp)
movsd %xmm0, -0x48(%rbp)
movsd %xmm1, -0x50(%rbp)
andb $0x1, %dl
movb %dl, -0x51(%rbp)
andb $0x1, %cl
movb %cl, -0x52(%rbp)
andb $0x1, %al
movb %al, -0x53(%rbp)
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
callq 0x181c0
movq %rax, %rdi
callq 0x18f00
movq %rax, %rdi
callq 0x190d0
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
callq 0x181c0
movq %rax, %rdi
callq 0x18f00
movq %rax, %rdi
callq 0x19130
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x19100
testb $0x1, %al
jne 0x121ca
jmp 0x121fc
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
callq 0x6610
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0xb680
testb $0x1, %al
jne 0x121ed
jmp 0x121ef
jmp 0x121fc
jmp 0x121f1
leaq -0x60(%rbp), %rdi
callq 0x19180
jmp 0x12196
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
callq 0x181c0
movq %rax, %rdi
callq 0x18f00
movq %rax, %rdi
callq 0x19130
movq %rax, -0x70(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x191a0
testb $0x1, %al
jne 0x12233
jmp 0x123a4
movq 0x58(%rbp), %rax
movb $0x1, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x318(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x30c(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0x308(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0x300(%rbp)
movq %rax, %rcx
addq $0x20, %rcx
movq %rcx, -0x2f8(%rbp)
addq $0x40, %rax
movq %rax, -0x320(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x2e8(%rbp)
movq 0x38(%rbp), %rax
movq %rax, -0x328(%rbp)
movq 0x48(%rbp), %rsi
movq %rsi, %rdx
addq $0x6, %rdx
leaq -0x1a0(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x191d0
movq -0x330(%rbp), %r11
movq -0x328(%rbp), %r10
movq -0x320(%rbp), %rdi
movq -0x318(%rbp), %rsi
movl -0x30c(%rbp), %edx
movq -0x308(%rbp), %rcx
movq -0x300(%rbp), %r8
movq -0x2f8(%rbp), %r9
movsd -0x2f0(%rbp), %xmm0
movsd -0x2e8(%rbp), %xmm1
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rdi, (%rax)
leaq -0x170(%rbp), %rdi
callq 0x19240
jmp 0x12323
leaq -0x1a0(%rbp), %rdi
callq 0x8810
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
callq 0x181c0
movq %rax, %rdi
leaq -0x170(%rbp), %rsi
callq 0xd1f0
jmp 0x1234d
leaq -0x170(%rbp), %rdi
callq 0xac70
jmp 0x126c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x8810
jmp 0x12717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x170(%rbp), %rdi
callq 0xac70
jmp 0x12717
movq -0x30(%rbp), %rax
movq %rax, -0x338(%rbp)
testb $0x1, -0x39(%rbp)
je 0x123ce
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
callq 0x65f0
movl %eax, -0x33c(%rbp)
jmp 0x123d7
movl -0x38(%rbp), %eax
movl %eax, -0x33c(%rbp)
movl -0x33c(%rbp), %eax
movl %eax, -0x340(%rbp)
testb $0x1, -0x3a(%rbp)
je 0x12403
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
callq 0x18e60
movq %rax, -0x348(%rbp)
jmp 0x1240e
movq 0x10(%rbp), %rax
movq %rax, -0x348(%rbp)
movq -0x348(%rbp), %rax
movq %rax, -0x350(%rbp)
testb $0x1, -0x3b(%rbp)
je 0x1243c
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
callq 0x18e80
movq %rax, -0x358(%rbp)
jmp 0x12447
movq 0x20(%rbp), %rax
movq %rax, -0x358(%rbp)
movq -0x358(%rbp), %rax
movq %rax, -0x360(%rbp)
testb $0x1, -0x3b(%rbp)
je 0x12475
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
callq 0x18ea0
movq %rax, -0x368(%rbp)
jmp 0x12484
movq 0x20(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x368(%rbp)
movq -0x368(%rbp), %rax
movq %rax, -0x370(%rbp)
testb $0x1, -0x3b(%rbp)
je 0x124b2
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
callq 0x18ec0
movq %rax, -0x378(%rbp)
jmp 0x124c1
movq 0x20(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x378(%rbp)
movq -0x378(%rbp), %rax
movq %rax, -0x380(%rbp)
testb $0x1, -0x51(%rbp)
je 0x124f7
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
addq $0x90, %rdi
callq 0x19330
movsd %xmm0, -0x388(%rbp)
jmp 0x12504
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x388(%rbp)
movsd -0x388(%rbp), %xmm0
movsd %xmm0, -0x390(%rbp)
testb $0x1, -0x51(%rbp)
je 0x1253c
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
addq $0x90, %rdi
callq 0x19350
movsd %xmm0, -0x398(%rbp)
jmp 0x12549
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x398(%rbp)
movsd -0x398(%rbp), %xmm0
movsd %xmm0, -0x3a0(%rbp)
testb $0x1, -0x52(%rbp)
je 0x12579
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
callq 0x19370
movq %rax, -0x3a8(%rbp)
jmp 0x12584
movq 0x38(%rbp), %rax
movq %rax, -0x3a8(%rbp)
movq -0x3a8(%rbp), %rax
movq %rax, -0x3b0(%rbp)
testb $0x1, -0x53(%rbp)
je 0x125ba
leaq -0x60(%rbp), %rdi
callq 0x19160
movq %rax, %rdi
callq 0x19390
movq %rax, %rsi
leaq -0x2e0(%rbp), %rdi
callq 0xfb30
jmp 0x125d2
movq 0x48(%rbp), %rsi
movq 0x48(%rbp), %rdx
addq $0x6, %rdx
leaq -0x2e0(%rbp), %rdi
callq 0x191d0
movsd -0x3a0(%rbp), %xmm1
movsd -0x390(%rbp), %xmm0
movq -0x370(%rbp), %r9
movq -0x360(%rbp), %r8
movq -0x350(%rbp), %rcx
movl -0x340(%rbp), %edx
movq -0x338(%rbp), %rsi
movq -0x380(%rbp), %rdi
movq -0x3b0(%rbp), %r10
movq %rsp, %rax
leaq -0x2e0(%rbp), %r11
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rdi, (%rax)
leaq -0x2b0(%rbp), %rdi
callq 0x19240
jmp 0x12635
leaq -0x2e0(%rbp), %rdi
callq 0x8810
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
callq 0x181c0
movq %rax, %rdi
leaq -0x2b0(%rbp), %rsi
callq 0xd1f0
movb %al, -0x3b1(%rbp)
jmp 0x12665
movb -0x3b1(%rbp), %al
testb $0x1, %al
jne 0x12671
jmp 0x126ba
movq 0x58(%rbp), %rax
movb $0x1, (%rax)
jmp 0x126ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x8810
jmp 0x12717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0xac70
jmp 0x12717
leaq -0x2b0(%rbp), %rdi
callq 0xac70
testb $0x1, -0x31(%rbp)
je 0x126e3
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
movq -0x30(%rbp), %rsi
callq 0x18ff0
movl $0x0, (%rax)
movq 0x20(%rbp), %rdi
callq 0x5270
cmpq $0x0, %rax
jbe 0x12709
movq -0x28(%rbp), %rdi
addq $0x40, %rdi
movq -0x30(%rbp), %rsi
callq 0x18ff0
movl $0x0, (%rax)
addq $0x3b8, %rsp            # imm = 0x3B8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq -0x1a8(%rbp), %rdi
callq 0x5530
nopw %cs:(%rax,%rax)