HalpNumaSwapP0NodeToFront

VOID __stdcall HalpNumaSwapP0NodeToFront(){
  __int64 v0; 
  unsigned int v1; 
  unsigned int v2; 
  __int64 v3; 
  int v4; 
  int v5; 
  unsigned int v6; 
  _DWORD *v7; 
  unsigned int v8; 
  __int64 v9; 
  _DWORD *v10; 
  int v11; 
  _DWORD *v12; 
  int v13; 
  __int64 v14; 
  __int64 v15; 
  __int16 v16; 
  __int64 v17; 
  __int64 v18; 
  __int64 v19; 
  __int64 v20; 
  int v21; 
  __int64 v22; 
  __int64 v23; 
  WCHAR v24; 
  UINT64 ChannelCount; 
  UINT64 MemoryRangeCount; 
  UINT64 ProcCount; 
  UINT64 NodeCount; 
  LODWORD(ChannelCount) = 0;
  LODWORD(NodeCount) = 0;
  LODWORD(MemoryRangeCount) = 0;
  LODWORD(ProcCount) = 0;
  if( HalpAcpiSrat )
  {
    v0 = HalpNumaConfig;
    if( HalpNumaConfig )
    {
      if( (unsigned __int8)HalpGetNumaProcMemoryCount(&NodeCount, &ProcCount, &MemoryRangeCount, &ChannelCount)
        && (LODWORD(ChannelCount) = 0, (int)HalpInterruptGetIdentifiers(0i64, &ChannelCount, 0i64) >= 0) )
      {
        v1 = *(_DWORD *)(v0 + 60);
        v2 = 0;
        if( v1 )
        {
          while( *(_DWORD *)(*(_QWORD *)v0 + 4i64 * v2) != (_DWORD)ChannelCount )
          {
            if( ++v2 >= v1 )
              return;
          }
          v3 = HalpNumaConfig;
          v4 = 0;
          v5 = *(_DWORD *)(*(_QWORD *)(HalpNumaConfig + 16) + 4i64 * v2);
          v6 = *(_DWORD *)(HalpNumaConfig + 56);
          if( v6 )
          {
            v7 = *(_DWORD **)(HalpNumaConfig + 24);
            while( v7[v4] != v5 )
            {
              if( ++v4 >= v6 )
                return;
            }
            if( v4 )
            {
              v8 = 1;
              v7[v4] = *v7;
              **(_DWORD **)(v3 + 24) = v5;
              v9 = HalpNumaConfig;
              v10 = *(_DWORD **)(HalpNumaConfig + 32);
              v11 = v10[v4];
              v10[v4] = *v10;
              **(_DWORD **)(v9 + 32) = v11;
              v12 = *(_DWORD **)(v9 + 40);
              v13 = v12[v4];
              v12[v4] = *v12;
              for( **(_DWORD **)(v9 + 40) = v13; v8 < *(_DWORD *)(v3 + 56); ++v8 )
              {
                if( v8 != v4 )
                {
                  v14 = HalpNumaConfig;
                  v15 = *(_QWORD *)(HalpNumaConfig + 48);
                  v16 = *(_WORD *)(v15 + 2i64 * (v8 + v4 * *(_DWORD *)(HalpNumaConfig + 64)));
                  *(_WORD *)(v15 + 2i64 * (v8 + v4 * *(_DWORD *)(HalpNumaConfig + 64))) = *(_WORD *)(v15 + 2i64 * v8);
                  *(_WORD *)(*(_QWORD *)(v14 + 48) + 2i64 * v8) = v16;
                  v17 = *(_QWORD *)(v14 + 48);
                  v18 = v8 * *(_DWORD *)(v14 + 64);
                  LOWORD(v15) = *(_WORD *)(v17 + 2i64 * (unsigned int)(v4 + v18));
                  *(_WORD *)(v17 + 2i64 * (unsigned int)(v4 + v18)) = *(_WORD *)(v17 + 2 * v18);
                  *(_WORD *)(*(_QWORD *)(v14 + 48) + 2i64 * v8 * *(_DWORD *)(v14 + 64)) = v15;
                }
              }
              if( (_DWORD)MemoryRangeCount )
              {
                v19 = 0i64;
                v20 = (unsigned int)MemoryRangeCount;
                do
                {
                  v21 = *(_DWORD *)(v19 + *(_QWORD *)&HalpNumaMemoryRanges + 8);
                  if( v21 )
                  {
                    if( v21 == v4 )
                      *(_DWORD *)(v19 + *(_QWORD *)&HalpNumaMemoryRanges + 8) = 0;
                  }
                  else
                  {
                    *(_DWORD *)(v19 + *(_QWORD *)&HalpNumaMemoryRanges + 8) = v4;
                  }
                  v19 += 16i64;
                  --v20;
                }
                while( v20 );
              }
              if( HalpChannelMemoryRangeCount )
              {
                v22 = 0i64;
                v23 = (unsigned int)HalpChannelMemoryRangeCount;
                do
                {
                  v24 = HalpChannelMemoryRanges[v22 + 5];
                  if( v24 )
                  {
                    if( v24 == (_WORD)v4 )
                      HalpChannelMemoryRanges[v22 + 5] = 0;
                  }
                  else
                  {
                    HalpChannelMemoryRanges[v22 + 5] = v4;
                  }
                  v22 += 8i64;
                  --v23;
                }
                while( v23 );
              }
            }
          }
        }
      }
      else
      {
        HalpNumaConfig = 0i64;
      }
    }
  }
}

Referenced by:

HalpAcpiInitSystem