HalpInterruptSetRemappedDestinationHv

__int64 __fastcall HalpInterruptSetRemappedDestinationHv(unsigned int *a1, int *a2, __int64 a3){
  int v5; 
  unsigned int v6; 
  int ControllerAndLineState; 
  __int64 v8; 
  ULONG_PTR *v9; 
  ULONG_PTR *v10; 
  int v11; 
  int v12; 
  unsigned __int64 v13; 
  __int64 v15; 
  __int64 v16; 
  char v17; 
  ULONG_PTR *v18; 
  v18 = 0i64;
  v16 = 0i64;
  v15 = 0i64;
  v5 = *a2;
  v17 = 0;
  if( !v5 )
  {
    if( a1 )
    {
      ControllerAndLineState = HalpInterruptFindControllerAndLineState(*a1, &v18, (ULONG_PTR *)&v15);
      if( ControllerAndLineState >= 0 )
      {
        v10 = v18;
        v11 = HalpHvRetargetIoApicDeviceInterrupt(*((_DWORD *)v18 + 58), v8, v15, a3, &v17);
        v6 = v11;
        if( v11 < 0 )
        {
          *((_DWORD *)v10 + 74) = v11;
          v10[38] = (ULONG_PTR)"minkernel\\hals\\lib\\interrupts\\common\\connect.c";
          HalpInterruptLastProblem = 37;
          *((_DWORD *)v10 + 73) = 37;
          *((_DWORD *)v10 + 78) = 742;
          return v6;
        }
        if( !v17 )
          return v6;
        v12 = HalpInterruptGsiToLine(*a1, &v16);
        if( v12 >= 0 )
        {
          v13 = (unsigned __int8)HalpAcquireHighLevelLock(&HalpInterruptLock);
          v6 = HalpInterruptSetLineStateInternal((__int64)v10, (__int64)&v16, v15);
          KxReleaseSpinLock(&HalpInterruptLock);
          __writecr8(v13);
          return v6;
        }
        *((_DWORD *)v10 + 74) = v12;
        HalpInterruptLastProblem = 18;
        v10[38] = (ULONG_PTR)"minkernel\\hals\\lib\\interrupts\\common\\connect.c";
        *((_DWORD *)v10 + 73) = 18;
        *((_DWORD *)v10 + 78) = 756;
      }
      else
      {
        v9 = v18;
        HalpInterruptLastProblem = 18;
        if( v18 )
        {
          *((_DWORD *)v18 + 74) = ControllerAndLineState;
          v9[38] = (ULONG_PTR)"minkernel\\hals\\lib\\interrupts\\common\\connect.c";
          *((_DWORD *)v9 + 73) = 18;
          *((_DWORD *)v9 + 78) = 727;
        }
      }
    }
    return(unsigned int)-1073741811;
  }
  if( v5 != 3 )
    return(unsigned int)-1073741811;
  v6 = HalpHvRetargetDeviceMsiInterrupt((INT64)a2, a3);
  if( (v6 & 0x80000000) != 0 )
    HalpInterruptLastProblem = 37;
  return v6;
}

Referenced by:

HalpInterruptSetDestination