HalpInterruptSwapProcessorIdentifiers

NTSTATUS __stdcall HalpInterruptSwapProcessorIdentifiers(PVOID BugCheckParameter3){
  void *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; 
  int *v14; 
  PVOID *v15; 
  PVOID *v16; 
  _QWORD *v17; 
  __int64 v18; 
  INT64 v19[2]; 
  __int64 v20; 
  INT64 v21[2]; 
  __int64 v22; 
  PVOID 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)qword_140C50640 )
        return -1073741275;
      while( *((_DWORD *)HalpInterruptProcessorState + 16 * (unsigned __int64)v8) != *v7 )
      {
        if( ++v8 >= (unsigned int)qword_140C50640 )
          return -1073741275;
      }
      ++v4;
      ++v7;
      if( v4 >= v5 )
        goto LABEL_8;
    }
  }
  else
  {
LABEL_8:
    if( (unsigned __int8)HalpInterruptIsRemappingRequired() )
    {
      HalpUpdateIrtDestinationId(v10, (INT64)BugCheckParameter3, v11, v5);
      v11 = (INT64)BugCheckParameter4;
    }
    v12 = 0;
    if( v5 )
    {
      v13 = v11 - (_QWORD)BugCheckParameter3;
      v14 = (int *)BugCheckParameter3;
      do
      {
        updated = HalpInterruptUpdateLocalUnitIdentifier(
                    (unsigned int)*v14,
                    *(unsigned int *)((char *)v14 + v13),
                    (INT64)v21,
                    (INT64)v19);
        if( updated < 0 )
          goto LABEL_20;
        v15 = (PVOID *)qword_140C4B850;
LABEL_17:
        while( v15 != &qword_140C4B850 )
        {
          v16 = v15;
          v15 = (PVOID *)*v15;
          v24 = v16 + 30;
          v17 = v16[30];
          if( (_QWORD *)*v24 != v24 )
          {
            while( 1 )
            {
              v18 = (__int64)v17;
              v17 = (_QWORD *)*v17;
              updated = HalpInterruptUpdateLinesPostSwap(v18, *v14, *(int *)((char *)v14 + v13), v21, v19);
              if( updated < 0 )
                break;
              if( v17 == v24 )
                goto LABEL_17;
            }
LABEL_20:
            KeBugCheckEx(0x5Cu, (PVOID)0x4000, HalpInterruptProcessorState, BugCheckParameter3, BugCheckParameter4);
          }
        }
        ++v12;
        ++v14;
      }
      while( v12 < v5 );
    }
    HalpInterruptEnsureLineSwapComplete();
    HalpInterruptRestoreAllControllerState();
    return updated;
  }
}

Referenced by:

HalpDpReplaceControl