// File: /workspace/github_cpp_makefile_star2_O2/dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::OnTurboChannelCapacitiesResponse(CMACAddress const&, HomePlugMMEs::TurboChannelCapacities::CResponse const&)
void CDlanMonitor::OnTurboChannelCapacitiesResponse(
  const CMACAddress& adapter, 
  const HomePlugMMEs::TurboChannelCapacities::CResponse& mme)
{
  std::map<CMACAddress,NetwAdapter>::iterator itNIC;
  std::map<CMACAddress,LocalDevice>::iterator itDevice; 
  
  if(((itNIC = m_mapNICs.find(adapter)) != m_mapNICs.end()) &&
    ((itDevice = itNIC->second.mapLocalDevices.find(mme.GetAddress())) != itNIC->second.mapLocalDevices.end()))
  {
    bool bUpdate = false;

    std::list<HomePlugMMEs::TurboChannelCapacities::TxCap> listCaps = mme.GetTxCapacities();
    for(std::list<HomePlugMMEs::TurboChannelCapacities::TxCap>::iterator itCap = listCaps.begin(); 
      (itCap != listCaps.end()); itCap++)
    {
      bool bUnknown =
        itNIC->second.setParamsAndStatsResponses.find(itCap->GetAddress()) != itNIC->second.setParamsAndStatsResponses.end();

      bool bTurbo =
        itNIC->second.setRemoteTurboResponses.find(itCap->GetAddress()) != itNIC->second.setRemoteTurboResponses.end();

      if(bUnknown || bTurbo)
      {
        UpdateRemoteDevice(itDevice->second, itCap->GetAddress(), true,
          bTurbo ? CDlanDevice::eTurbo : CDlanDevice::eHP1, !bTurbo, "", false, UserDataResponse(), true, 
          itCap->GetTxRate(), 0.0, false, 
          std::map<CMACAddress, CDlanDataRates>(), true, CMACAddress(), true, bUpdate);
      }
      else
      {
        itNIC->second.setDevicesToTrigger.insert(itCap->GetAddress());
      }
    }
    
    if(bUpdate)
      OnUpdate();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdx, %rbx
movq %rdi, %r14
addq $0xa8, %rdi
callq 0xccd4
movq %rax, %r15
leaq 0xb0(%r14), %rax
cmpq %rax, %r15
je 0x9640
leaq 0x188(%r15), %rdi
movzwl 0xa(%rbx), %eax
leaq 0x50(%rsp), %r13
movw %ax, 0x4(%r13)
movl 0x6(%rbx), %eax
movl %eax, (%r13)
movq %r13, %rsi
callq 0xd5b6
movq %rax, %r12
leaq 0x190(%r15), %rax
cmpq %rax, %r12
je 0x9640
movq %r14, 0x18(%rsp)
leaq 0x6(%rsp), %rax
movb $0x0, (%rax)
leaq 0x100(%rsp), %rdi
movq %rbx, %rsi
movq %rdi, %rbx
callq 0xafec
leaq 0x38(%r15), %rax
movq %rax, 0x48(%rsp)
leaq 0x68(%r15), %rax
movq %rax, 0x40(%rsp)
leaq 0x40(%r15), %rax
movq %rax, 0x38(%rsp)
leaq 0x70(%r15), %rax
addq $0x98, %r15
addq $0x28, %r12
movq %r12, 0x28(%rsp)
movq %rbx, %r12
movq %r15, 0x20(%rsp)
movq %rax, 0x30(%rsp)
movq (%r12), %r12
cmpq %rbx, %r12
je 0x9619
movzwl 0x14(%r12), %eax
movw %ax, 0x54(%rsp)
movl 0x10(%r12), %eax
movl %eax, 0x50(%rsp)
movq 0x48(%rsp), %rdi
movq %r13, %rsi
callq 0xe0ae
movq %rax, %r14
leaq 0x10(%r12), %rbp
movzwl 0x4(%rbp), %eax
movw %ax, 0x54(%rsp)
movl (%rbp), %eax
movl %eax, 0x50(%rsp)
movq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0xe0ae
xorq 0x38(%rsp), %r14
movq %rax, %rcx
movq 0x30(%rsp), %rdx
xorq %rdx, %rcx
orq %r14, %rcx
je 0x95f9
xorl %r13d, %r13d
xorl %r14d, %r14d
cmpq %rdx, %rax
sete %bl
setne %r15b
movzwl 0x4(%rbp), %eax
movw %ax, 0x14(%rsp)
movl (%rbp), %eax
movl %eax, 0x10(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0xad91(%rip), %rsi      # 0x14249
leaq 0x7(%rsp), %rdx
callq 0x4ab0
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
xorl %ecx, %ecx
movb %cl, 0x60(%rsp)
leaq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
andq $0x0, 0x78(%rsp)
movb %cl, 0x80(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
andq $0x0, 0x98(%rsp)
movb %cl, 0xa0(%rsp)
leaq 0xc0(%rsp), %rax
movq %rax, 0xb0(%rsp)
andq $0x0, 0xb8(%rsp)
movb %cl, 0xc0(%rsp)
movq %rbp, %rdi
callq 0xb022
xorps %xmm1, %xmm1
movaps %xmm1, 0xd0(%rsp)
andq $0x0, 0xe0(%rsp)
leaq 0xd8(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq %rax, 0xf0(%rsp)
andq $0x0, 0xf8(%rsp)
andw $0x0, 0xc(%rsp)
movb %r15b, %r14b
andl $0x0, 0x8(%rsp)
movb %bl, %r13b
xorps %xmm1, %xmm1
movq 0x28(%rsp), %rsi
leaq 0x10(%rsp), %rdx
pushq $0x1
popq %rcx
movl %r14d, %r8d
movl %r13d, %r9d
leaq 0x6(%rsp), %rax
pushq %rax
pushq %rcx
leaq 0x18(%rsp), %rax
pushq %rax
pushq %rcx
leaq 0xf0(%rsp), %r14
pushq %r14
pushq $0x0
pushq %rcx
leaq 0x88(%rsp), %r13
pushq %r13
pushq $0x0
leaq 0x160(%rsp), %rbx
pushq %rbx
callq 0x7f00
addq $0x50, %rsp
movq %r14, %rdi
callq 0x5a86
movq %r13, %rdi
callq 0x589e
movq %rbx, %rdi
callq 0x4170
movq 0x20(%rsp), %r15
leaq 0x100(%rsp), %rbx
jmp 0x941d
movzwl 0x4(%rbp), %eax
movw %ax, 0x54(%rsp)
movl (%rbp), %eax
movl %eax, 0x50(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0xdfea
jmp 0x941d
cmpb $0x0, 0x6(%rsp)
je 0x9633
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rdi
testq %rdi, %rdi
je 0x9633
movq (%rdi), %rax
callq *(%rax)
leaq 0x100(%rsp), %rdi
callq 0xc2da
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9688
jmp 0x9688
movq %rax, %rbx
jmp 0x966d
jmp 0x9688
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x5a86
leaq 0x50(%rsp), %rdi
callq 0x589e
leaq 0x118(%rsp), %rdi
callq 0x4170
jmp 0x968b
jmp 0x9688
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0xc2da
movq %rbx, %rdi
callq 0x4410