HalpUpdateConfigurationFromMsct

VOID __stdcall HalpUpdateConfigurationFromMsct(
        UINT64 *NodeCount,
        UINT64 MaxNodeCount,
        UINT64 *ProcCount,
        UINT64 MaxProcCount,
        UINT64 *ClockDomainCount,
        UINT64 *ProximityId,
        UINT64 *NodeCapacity,
        UINT64 *ProcessorProximity){
  unsigned int v8; 
  unsigned int v9; 
  __int64 v10; 
  __int64 v11; 
  unsigned int v12; 
  unsigned int v13; 
  unsigned __int64 v14; 
  __int64 v15; 
  unsigned int *v16; 
  unsigned int v17; 
  __int64 v18; 
  unsigned __int64 v19; 
  unsigned int *v20; 
  __int64 v21; 
  unsigned int v22; 
  unsigned int v23; 
  unsigned int v24; 
  unsigned int v25; 
  unsigned int v26; 
  __int64 v27; 
  __int64 v28; 
  unsigned int i; 
  __int64 v30; 
  int v31; 
  unsigned int v32; 
  __int64 v33; 
  unsigned int v34; 
  unsigned __int64 v35; 
  __int64 v36; 

  v8 = MaxProcCount;
  v9 = MaxNodeCount;
  v10 = *(unsigned int *)(*(&CmpDummyThreadEvent + 877) + 4i64);
  if( (unsigned int)v10 >= 0x38 )
  {
    v11 = *(unsigned int *)(*(&CmpDummyThreadEvent + 877) + 36i64);
    if( (unsigned int)v10 >= (unsigned int)v11
      && (unsigned int)v11 >= 0x38
      && (!ClockDomainCount
       || (unsigned int)(*(_DWORD *)(*(&CmpDummyThreadEvent + 877) + 44i64) + 1) >= *(_DWORD *)ClockDomainCount) )
    {
      v12 = *(_DWORD *)(*(&CmpDummyThreadEvent + 877) + 40i64) + 1;
      if( v12 <= (unsigned int)MaxNodeCount )
      {
        v13 = *(_DWORD *)NodeCount;
        if( *(_DWORD *)NodeCount <= (unsigned int)MaxNodeCount
          && (!(_DWORD)MaxProcCount || *(_DWORD *)ProcCount <= (unsigned int)MaxProcCount) )
        {
          LODWORD(v14) = 0;
          v15 = *(&CmpDummyThreadEvent + 877) + v11;
          v34 = 0;
          v16 = (unsigned int *)(*(&CmpDummyThreadEvent + 877) + v11 + 2);
          v17 = 0;
          v18 = *(&CmpDummyThreadEvent + 877) + v11;
          v19 = *(&CmpDummyThreadEvent + 877) + v10;
          v20 = v16;
          v35 = v19;
LABEL_29:
          if( (unsigned __int64)v16 > v19
            || (v21 = *(unsigned __int8 *)(v18 + 1), (unsigned __int8)v21 < 2u)
            || (v36 = v18 + v21, v18 + v21 > v19) )
          {
            if( (unsigned int)v14 == (1i64 << v13) - 1 && v12 == v17 )
            {
              if( (unsigned __int64)v20 <= v19 )
              {
                do
                {
                  v28 = *(unsigned __int8 *)(v15 + 1);
                  if( (unsigned __int8)v28 < 2u || v15 + v28 > v35 )
                    break;
                  for( i = *v20; i <= *(_DWORD *)(v15 + 6); ++i )
                  {
                    v30 = 0i64;
                    v31 = *(_DWORD *)(v15 + 10);
                    if( *(_DWORD *)NodeCount )
                    {
                      while( *((_DWORD *)ProximityId + v30) != i )
                      {
                        v30 = (unsigned int)(v30 + 1);
                        if( (unsigned int)v30 >= *(_DWORD *)NodeCount )
                          goto LABEL_41;
                      }
                      v31 -= *((_DWORD *)NodeCapacity + v30);
                    }
LABEL_41:
                    *((_DWORD *)NodeCapacity + v30) = *(_DWORD *)(v15 + 10);
                    if( (_DWORD)v30 == *(_DWORD *)NodeCount )
                    {
                      *((_DWORD *)ProximityId + v30) = i;
                      ++*(_DWORD *)NodeCount;
                    }
                    v32 = *(_DWORD *)ProcCount;
                    *(_DWORD *)ProcCount += v31;
                    if( ProcessorProximity && v31 )
                    {
                      do
                      {
                        v33 = v32++;
                        *((_DWORD *)ProcessorProximity + v33) = i;
                        --v31;
                      }
                      while( v31 );
                    }
                  }
                  v15 += *(unsigned __int8 *)(v15 + 1);
                  v20 = (unsigned int *)(v15 + 2);
                }
                while( v15 + 2 <= v35 );
              }
              if( ClockDomainCount )
                *(_DWORD *)ClockDomainCount = *(_DWORD *)(*(&CmpDummyThreadEvent + 877) + 44i64) + 1;
            }
          }
          else
          {
            v22 = *(_DWORD *)(v18 + 6);
            v23 = *v16;
            if( v22 >= *v16 )
            {
              v24 = v22 - v23 + 1;
              if( v24 <= v9 )
              {
                v17 += v24;
                if( v17 <= v9 )
                {
                  v25 = *(_DWORD *)(v18 + 10);
                  if( v25 <= 0x500 && (!v8 || v25 <= v8) )
                  {
                    v26 = v24 * v25 + v34;
                    v34 = v26;
                    if( v26 <= 0x500 && (!v8 || v26 <= v8) )
                    {
                      while( 1 )
                      {
                        v27 = 0i64;
                        if( v13 )
                        {
                          while( *((_DWORD *)ProximityId + v27) != v23 )
                          {
                            v27 = (unsigned int)(v27 + 1);
                            if( (unsigned int)v27 >= v13 )
                              goto LABEL_27;
                          }
                          v14 = (unsigned int)v14 | (unsigned __int64)(1i64 << v27);
                          if( *((_DWORD *)NodeCapacity + (unsigned int)v27) > v25 )
                            break;
                        }
LABEL_27:
                        if( ++v23 > v22 )
                        {
                          v18 = v36;
                          v19 = v35;
                          v16 = (unsigned int *)(v36 + 2);
                          goto LABEL_29;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Referenced by:

HalpGetNumaProcMemoryCount
HalpNumaInitializeStaticConfiguration