KiDetermineRetpolineEnablement

VOID __fastcall KiDetermineRetpolineEnablement(INT64 a1, INT64 a2, INT8 a3){
  CHAR *v4; 
  CHAR *v5; 
  __int64 v6; 
  __int128 a3a; 
  v4 = *(CHAR **)(a1 + 216);
  a3a = 0i64;
  if( !v4 || !strstr(v4, "SAFEBOOT:") )
  {
    v5 = *(CHAR **)(a1 + 216);
    if( !v5 || !strstr(v5, "MININT") )
    {
      if( (KiFeatureSettings & 0x20000) != 0 || (*(_DWORD *)(*(_QWORD *)(a1 + 240) + 132i64) & 0x1000) != 0 )
        _InterlockedAnd(&KiSpeculationFeatures, 0xFBFFFFFF);
      else
        _InterlockedOr(&KiSpeculationFeatures, 0x4000000u);
      if( !KiIsPgiKernel() )
      {
        KiDetectHardwareSpecControlFeatures((INT64)KeGetCurrentPrcb(), 0, &a3a, 0i64);
        if( (KiFeatureSettings & 5) == 0 && (a3a & 4) != 0 )
        {
          v6 = *(_QWORD *)(a1 + 240);
          if( *(_DWORD *)(v6 + 3468) )
          {
            if( !*(_DWORD *)(v6 + 3464)
              && (a3a & 1) == 0
              && ((KiFeatureSettings & 0x200) != 0 || (KiFeatureSettings & 0x100) == 0 && (a3a & 0x200) == 0) )
            {
              _InterlockedOr(&KiSpeculationFeatures, 0x2000000u);
            }
          }
        }
      }
    }
  }
}

Referenced by:

KiInitializeBootStructures