// File: /workspace/github_cpp_makefile_star2_O1/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 $0x148, %rsp            # imm = 0x148
movq %rdx, %rbx
movq %rdi, %r15
addq $0xa8, %rdi
callq 0xdefe
movq %rax, %r13
leaq 0xb0(%r15), %r14
cmpq %r14, %rax
je 0xa49b
leaq 0x188(%r13), %rdi
movzwl 0xa(%rbx), %eax
leaq 0x140(%rsp), %rsi
movw %ax, 0x4(%rsi)
movl 0x6(%rbx), %eax
movl %eax, (%rsi)
callq 0xe946
leaq 0x190(%r13), %rdx
movq %rax, 0x10(%rsp)
cmpq %rdx, %rax
setne %al
jmp 0xa4a6
movq $0x0, 0x10(%rsp)
xorl %eax, %eax
cmpq %r14, %r13
testb %al, %al
je 0xa81f
movq %r15, 0xc8(%rsp)
movb $0x0, 0xe(%rsp)
leaq 0x15(%rbx), %rsi
movzbl 0x10(%rbx), %eax
addq $-0x4, %rax
andq $-0x8, %rax
leaq (%rbx,%rax), %rdx
addq $0x15, %rdx
leaq 0xf8(%rsp), %r12
leaq 0x48(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rcx
callq 0xd650
movq (%r12), %r14
cmpq %r12, %r14
je 0xa7e0
leaq 0x38(%r13), %rax
movq %rax, 0xf0(%rsp)
leaq 0x68(%r13), %rax
movq %rax, 0xe8(%rsp)
leaq 0x40(%r13), %rax
movq %rax, 0xe0(%rsp)
leaq 0x70(%r13), %rax
addq $0x98, %r13
addq $0x28, 0x10(%rsp)
movq %r13, 0xd0(%rsp)
movq %rax, 0xd8(%rsp)
movzwl 0x14(%r14), %eax
movw %ax, 0x4c(%rsp)
movl 0x10(%r14), %eax
movl %eax, 0x48(%rsp)
movq 0xf0(%rsp), %rdi
movq %rbx, %rsi
callq 0xf5f6
movq %rax, %r15
leaq 0x10(%r14), %rbp
movzwl 0x4(%rbp), %eax
movw %ax, 0x4c(%rsp)
movl (%rbp), %eax
movl %eax, 0x48(%rsp)
movq 0xe8(%rsp), %rdi
movq %rbx, %rsi
callq 0xf5f6
xorq 0xe0(%rsp), %r15
movq %rax, %rcx
movq 0xd8(%rsp), %rdx
xorq %rdx, %rcx
orq %r15, %rcx
je 0xa7b9
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpq %rdx, %rax
sete 0xf(%rsp)
setne %bl
movzwl 0x4(%rbp), %eax
movw %ax, 0x24(%rsp)
movl (%rbp), %eax
movl %eax, 0x20(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x28(%rsp), %rdi
leaq 0xbc6a(%rip), %rdx      # 0x16249
movq %rdx, %rsi
callq 0x6476
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
xorl %r13d, %r13d
movq %r13, 0x50(%rsp)
movb %r13b, 0x58(%rsp)
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movq %r13, 0x70(%rsp)
movb %r13b, 0x78(%rsp)
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq %r13, 0x90(%rsp)
movb %r13b, 0x98(%rsp)
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq %r13, 0xb0(%rsp)
movb %r13b, 0xb8(%rsp)
movq %rbp, %rdi
callq 0xc606
movb %bl, %r15b
xorps %xmm1, %xmm1
movaps %xmm1, 0x120(%rsp)
movaps %xmm1, 0x130(%rsp)
movaps %xmm1, 0x110(%rsp)
leaq 0x118(%rsp), %rax
movq %rax, 0x128(%rsp)
movq %rax, 0x130(%rsp)
movq $0x0, 0x138(%rsp)
movl %r13d, 0x18(%rsp)
movw $0x0, 0x1c(%rsp)
movb 0xf(%rsp), %al
movb %al, %r12b
xorps %xmm1, %xmm1
movq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movl $0x1, %ecx
movl %r15d, %r8d
movl %r12d, %r9d
leaq 0xe(%rsp), %rax
pushq %rax
movl $0x1, %eax
pushq %rax
leaq 0x28(%rsp), %rdi
pushq %rdi
pushq %rax
leaq 0x130(%rsp), %r15
pushq %r15
pushq %r13
pushq %rax
leaq 0x80(%rsp), %rbx
pushq %rbx
pushq %r13
leaq 0x70(%rsp), %rax
pushq %rax
callq 0x8748
addq $0x50, %rsp
movq %r15, %rdi
callq 0x612a
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
leaq 0xf8(%rsp), %r12
movq 0xd0(%rsp), %r13
je 0xa73e
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4270
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xa763
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4270
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xa77f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4270
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xa79b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4270
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xa7d4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0xa7d4
movzwl 0x4(%rbp), %eax
movw %ax, 0x4c(%rsp)
movl (%rbp), %eax
movl %eax, 0x48(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
callq 0xf512
movq (%r14), %r14
cmpq %r12, %r14
jne 0xa540
cmpb $0x0, 0xe(%rsp)
je 0xa7fd
movq 0xc8(%rsp), %rax
movq 0x30(%rax), %rdi
testq %rdi, %rdi
je 0xa7fd
movq (%rdi), %rax
callq *(%rax)
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0xa81f
movq (%rdi), %rbx
movl $0x18, %esi
callq 0x4270
movq %rbx, %rdi
cmpq %r12, %rbx
jne 0xa80a
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa876
jmp 0xa876
movq %rax, %r14
jmp 0xa84c
jmp 0xa876
movq %rax, %r14
leaq 0x110(%rsp), %rdi
callq 0x612a
leaq 0x48(%rsp), %rdi
callq 0xc160
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xa879
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4270
jmp 0xa879
jmp 0xa876
movq %rax, %r14
movq 0xf8(%rsp), %rdi
leaq 0xf8(%rsp), %r15
cmpq %r15, %rdi
je 0xa8a3
movq (%rdi), %rbx
movl $0x18, %esi
callq 0x4270
movq %rbx, %rdi
cmpq %r15, %rbx
jne 0xa88e
movq %r14, %rdi
callq 0x43e0
nop