HvlpAffinityToHvProcessorSet

__int64 __fastcall HvlpAffinityToHvProcessorSet(__int64 a1, _QWORD *a2, unsigned int a3){
  unsigned __int64 v3; 
  unsigned int v6; 
  __int64 v7; 
  char v8; 
  __int64 v9; 
  unsigned __int16 *v10[2]; 
  __int16 v11; 
  int v12; 
  __int16 v13; 
  int v14; 
  v3 = a3;
  v12 = 0;
  v13 = 0;
  v14 = 0;
  a2[1] = 0i64;
  if( a1 )
  {
    *a2 = 0i64;
    v6 = 0;
    v10[1] = *(unsigned __int16 **)(a1 + 8);
    v11 = 0;
    v10[0] = (unsigned __int16 *)a1;
    while( !(unsigned int)KeEnumerateNextProcessor(&v14, v10) )
    {
      v7 = (unsigned __int8)HvlpVirtualProcessorMapping[2 * v14];
      v8 = HvlpVirtualProcessorMapping[2 * v14 + 1];
      if( (unsigned int)v7 >= v6 )
      {
        if( 8 * (unsigned __int64)(unsigned int)(v7 + 1) > v3 )
          return 0xFFFFFFFFi64;
        memset((INT64)&a2[v6 + 2], 0i64);
        v6 = v7 + 1;
      }
      a2[v7 + 2] |= 1i64 << v8;
    }
    if( v6 == 64 )
      v9 = -1i64;
    else
      v9 = (1i64 << v6) - 1;
    a2[1] = v9;
    return 8 * v6;
  }
  else
  {
    *a2 = 1i64;
    return 0i64;
  }
}

Referenced by:

HvlMapDeviceInterrupt
HvlRetargetDeviceInterrupt
HvlpFastFlushAddressSpaceTbEx
HvlpFastFlushListTbEx
HvlpFastSendSyntheticClusterIpiEx
HvlpSlowFlushAddressSpaceTbEx
HvlpSlowFlushListTbEx
HvlpSlowSendSyntheticClusterIpiEx