HalpInterruptSwapProcessorIdentifiers

NTSTATUS __stdcall HalpInterruptSwapProcessorIdentifiers(PVOID BugCheckParameter3){
  ULONG_PTR v1; 
  unsigned int v2; 
  NTSTATUS updated; 
  unsigned int v4; 
  unsigned int v5; 
  _DWORD *v7; 
  unsigned int v8; 
  INT64 v10; 
  INT64 v11; 
  unsigned int v12; 
  INT64 v13; 
  unsigned int *v14; 
  ULONG_PTR *v15; 
  ULONG_PTR *v16; 
  _QWORD *v17; 
  INT64 v18; 
  INT64 v19[2]; 
  __int64 v20; 
  INT64 v21[2]; 
  __int64 v22; 
  ULONG_PTR BugCheckParameter4; 
  _QWORD *v24; 
  BugCheckParameter4 = v1;
  updated = 0;
  v4 = 0;
  v20 = 0i64;
  v22 = 0i64;
  v5 = v2;
  *(_OWORD *)v19 = 0i64;
  *(_OWORD *)v21 = 0i64;
  if( v2 )
  {
    v7 = BugCheckParameter3;
    while( 1 )
    {
      v8 = 0;
      if( !(_DWORD)HalpInterruptProcessorCount )
        return -1073741275;
      while( *(_DWORD *)(((unsigned __int64)v8 << 6) + HalpInterruptProcessorState) != *v7 )
      {
        if( ++v8 >= (unsigned int)HalpInterruptProcessorCount )
          return -1073741275;
      }
      ++v4;
      ++v7;
      if( v4 >= v5 )
        goto LABEL_8;
    }
  }
  else
  {
LABEL_8:
    if( (unsigned __int8)HalpInterruptIsRemappingRequired() )
    {
      HalpUpdateIrtDestinationId(v10, (INT64)BugCheckParameter3, v11, v5);
      v11 = BugCheckParameter4;
    }
    v12 = 0;
    if( v5 )
    {
      v13 = v11 - (_QWORD)BugCheckParameter3;
      v14 = (unsigned int *)BugCheckParameter3;
      do
      {
        updated = HalpInterruptUpdateLocalUnitIdentifier(
                    *v14,
                    *(unsigned int *)((char *)v14 + v13),
                    (INT64)v21,
                    (INT64)v19);
        if( updated < 0 )
          goto LABEL_20;
        v15 = (ULONG_PTR *)HalpRegisteredInterruptControllers;
LABEL_17:
        while( v15 != &HalpRegisteredInterruptControllers )
        {
          v16 = v15;
          v15 = (ULONG_PTR *)*v15;
          v24 = v16 + 30;
          v17 = (_QWORD *)v16[30];
          if( (_QWORD *)*v24 != v24 )
          {
            while( 1 )
            {
              v18 = (INT64)v17;
              v17 = (_QWORD *)*v17;
              updated = HalpInterruptUpdateLinesPostSwap(v18, *v14, *(unsigned int *)((char *)v14 + v13), v21, v19);
              if( updated < 0 )
                break;
              if( v17 == v24 )
                goto LABEL_17;
            }
LABEL_20:
            KeBugCheckEx(
              0x5Cu,
              0x4000ui64,
              HalpInterruptProcessorState,
              (ULONG_PTR)BugCheckParameter3,
              BugCheckParameter4);
          }
        }
        ++v12;
        ++v14;
      }
      while( v12 < v5 );
    }
    HalpInterruptEnsureLineSwapComplete();
    HalpInterruptRestoreAllControllerState();
    return updated;
  }
}

Referenced by:

HalpDpReplaceControl