KeOrAffinityEx

NTSTATUS __fastcall KeOrAffinityEx(INT8 *a1, WORD *a2, INT8 *a3){
  WORD *v6; 
  WORD v7; 
  NTSTATUS v8; 
  WORD v9; 
  unsigned __int64 v10; 
  bool v11; 
  __int64 v12; 
  __int64 v14; 
  char v15[176]; 

  memset(v15, 0i64, 0xA8u);
  if( !a3 )
    a3 = v15;
  v6 = a2;
  v7 = *(_WORD *)a1;
  if( *(_WORD *)a1 >= *a2 )
    v7 = *a2;
  if( *(_WORD *)a1 >= *a2 )
    v6 = (WORD *)a1;
  *((_WORD *)a3 + 1) = 20;
  v8 = 0;
  v9 = 0;
  for( *(_WORD *)a3 = *v6; v9 < v7; ++v9 )
  {
    v10 = 8i64 * v9;
    v11 = (*(_QWORD *)&a2[v10 / 2 + 4] | *(_QWORD *)&a1[v10 + 8]) == 0i64;
    *(_QWORD *)&a3[v10 + 8] = *(_QWORD *)&a2[v10 / 2 + 4] | *(_QWORD *)&a1[v10 + 8];
    if( !v11 )
      v8 = 1;
  }
  for( ; v9 < *v6; ++v9 )
  {
    v14 = *(_QWORD *)&v6[4 * v9 + 4];
    *(_QWORD *)&a3[8 * v9 + 8] = v14;
    if( v14 )
      v8 = 1;
  }
  if( a3 != v15 )
  {
    for( *((_DWORD *)a3 + 1) = 0; v9 < *((_WORD *)a3 + 1); *(_QWORD *)&a3[8 * v12 + 8] = 0i64 )
      v12 = v9++;
  }
  return v8;
}

Referenced by:

Amd64AddProfileSource
EmonAddProfileSource
KeQueryLogicalProcessorRelationship
KiForceIdleUpdateSchedulerParkState
KiForwardTick
KiStartProfileTarget
PpmCheckInitProcessors
PpmPerfApplyProcessorStates
PpmRegisterPerfStates
PpmUpdateProcessorPolicy