HalGetInterruptTargetInformation

__int64 __fastcall HalGetInterruptTargetInformation(int a1, int a2, __int64 a3){
  bool v6; 
  int v7; 
  int v8; 
  __int64 result; 
  ULONG_PTR i; 
  unsigned int ProcessorIndexFromNumber; 
  __int64 v12; 
  __int64 v13; 
  __int64 v14; 
  if( a1 && a1 != 2 )
  {
    HalpInterruptLastProblem = 19;
    return 3221225485i64;
  }
  *(_QWORD *)(a3 + 4) = 0i64;
  *(_QWORD *)(a3 + 12) = 0i64;
  v6 = HalpInterruptPhysicalModeOnly == 0;
  *(_DWORD *)a3 = a1;
  if( v6 && HalpInterruptLogicalMode )
    v7 = (HalpInterruptClusterModeEnabled != 0) + 2;
  else
    v7 = 1;
  *(_DWORD *)(a3 + 20) = v7;
  if( (unsigned __int8)HalpInterruptIsMsiSupported(0i64) )
    *(_DWORD *)(a3 + 8) = 1;
  if( (HalpFeatureBits & 0x80u) != 0 )
    *(_DWORD *)(a3 + 8) |= 8u;
  if( a1 != 2 )
  {
    v8 = 0;
    result = 3221226021i64;
    if( !(_DWORD)HalpInterruptProcessorCount )
      return result;
    for( i = HalpInterruptProcessorState; !*(_BYTE *)(i + 13) || *(_DWORD *)i != a2; i += 64i64 )
    {
      if( ++v8 >= (unsigned int)HalpInterruptProcessorCount )
        return result;
    }
    *(_DWORD *)(a3 + 4) = *(_DWORD *)(i + 16);
    ProcessorIndexFromNumber = KeGetProcessorIndexFromNumber((_PROCESSOR_NUMBER *)(i + 16));
    v12 = HalpInterruptTargets;
    v13 = 3i64 * ProcessorIndexFromNumber;
    if( v7 == 1
      || (v14 = qword_140C4B7A8[*(unsigned __int16 *)(i + 16)], _bittest64(&v14, *(unsigned __int8 *)(i + 18))) )
    {
      *(_DWORD *)(a3 + 12) = 0;
      *(_DWORD *)(a3 + 20) = 1;
    }
    else
    {
      *(_DWORD *)(a3 + 20) = v7;
      if( v7 == 2 )
      {
        *(_DWORD *)(a3 + 12) = *(_DWORD *)(v12 + 8 * v13 + 8);
      }
      else
      {
        *(_DWORD *)(a3 + 12) = *(_DWORD *)(v12 + 8 * v13 + 12);
        *(_DWORD *)(a3 + 16) = *(_DWORD *)(v12 + 8 * v13 + 8);
      }
    }
  }
  return 0i64;
}

Referenced by:

PoInitSystem