HalpInterruptSetDestinationInternal

__int64 __fastcall HalpInterruptSetDestinationInternal(__int64 *a1, __int64 a2, __int64 a3){
  UINT64 v5; 
  ULONG_PTR *v6; 
  __int64 v7; 
  ULONG_PTR *Lines; 
  _BYTE *v9; 
  char v10; 
  __int64 v11; 
  __int128 v12; 
  __int128 v13; 
  UINT64 *v14; 
  int v15; 
  __int128 v17; 
  ULONG_PTR v18; 
  __int128 v19; 
  int v20[8]; 
  __int128 v21; 
  __int128 v22; 
  __int128 v23; 
  __int64 v24; 
  UINT64 a1a; 
  a1a = *a1;
  HalpInterruptApplyOverrides(&a1a, 0i64, 0i64);
  LODWORD(v5) = a1a;
  while( 1 )
  {
    v6 = HalpInterruptLookupController(v5);
    v7 = (__int64)v6;
    if( !v6 )
    {
      HalpInterruptLastProblem = 17;
      return(unsigned int)-1073741275;
    }
    if( (v6[28] & 2) != 0 )
      KeBugCheckEx(0x5Cu, 0x200ui64, HalpInterruptLastProblem, (ULONG_PTR)v6, 0x7931847ui64);
    Lines = HalpInterruptFindLines((int *)&a1a);
    if( !Lines )
    {
      *(_DWORD *)(v7 + 296) = 0;
      HalpInterruptLastProblem = 18;
      *(_DWORD *)(v7 + 292) = 18;
      *(_QWORD *)(v7 + 304) = "minkernel\\hals\\lib\\interrupts\\common\\connect.c";
      *(_DWORD *)(v7 + 312) = 1067;
      return(unsigned int)-1073741275;
    }
    v9 = (_BYTE *)Lines[6];
    if( *v9 )
    {
      *(_DWORD *)(v7 + 296) = 0;
      HalpInterruptLastProblem = 19;
      v15 = -1073741811;
      *(_DWORD *)(v7 + 292) = 19;
      *(_QWORD *)(v7 + 304) = "minkernel\\hals\\lib\\interrupts\\common\\connect.c";
      *(_DWORD *)(v7 + 312) = 1080;
      return(unsigned int)v15;
    }
    v10 = 1;
    v11 = Lines[5];
    v12 = *(_OWORD *)(v11 + 16);
    v21 = *(_OWORD *)v11;
    v13 = *(_OWORD *)(v11 + 32);
    v22 = v12;
    *(_QWORD *)&v12 = *(_QWORD *)(v11 + 48);
    v23 = v13;
    v24 = v12;
    HalpInterruptDestinationToTarget((__int64)v9, a2, v11 + 24);
    v14 = (UINT64 *)(v11 + 16);
    HalpInterruptFindBestRouting(&a1a, *(_QWORD *)a3);
    _InterlockedOr(v20, 0);
    v15 = HalpInterruptSetLineStateInternal(v7, (__int64)&a1a, v11);
    if( v15 < 0 )
      break;
    v10 = 0;
    if( *(_DWORD *)(v11 + 20) == *(_DWORD *)(a3 + 4) && *(_DWORD *)v14 == *(_DWORD *)a3 )
      goto LABEL_9;
    v5 = *v14;
    a1a = *v14;
  }
  *(_DWORD *)(v7 + 296) = v15;
  HalpInterruptLastProblem = 7;
  *(_DWORD *)(v7 + 292) = 7;
  *(_QWORD *)(v7 + 304) = "minkernel\\hals\\lib\\interrupts\\common\\connect.c";
  *(_DWORD *)(v7 + 312) = 1119;
LABEL_9:
  if( v15 < 0 && v10 )
  {
    v17 = v22;
    v18 = Lines[5];
    *(_OWORD *)v18 = v21;
    v19 = v23;
    *(_OWORD *)(v18 + 16) = v17;
    *(_QWORD *)&v17 = v24;
    *(_OWORD *)(v18 + 32) = v19;
    *(_QWORD *)(v18 + 48) = v17;
  }
  return(unsigned int)v15;
}

Referenced by:

HalpInterruptSetDestination