wil_details_FeatureStateCache_ReevaluateCachedFeatureEnabledState

NTSTATUS __stdcall wil_details_FeatureStateCache_ReevaluateCachedFeatureEnabledState(
        INT32 *a1,
        INT64 a2,
        const PUSER_THREAD_START_ROUTINE *a3){
  unsigned int v3; 
  signed __int32 v5; 
  unsigned __int16 exchange64; 
  int v8; 
  signed __int32 v9; 
  INT64 v11; 
  INT64 v12; 

  v3 = 0;
  LODWORD(v11) = 0;
  v12 = a2;
  v5 = a2;
  if( *(&stru_140CF2E80 + 986) )
    v3 = (*(&stru_140CF2E80 + 986))();
  exchange64 = wil_details_GetCurrentFeatureEnabledState((wil_details_FeatureDescriptor *)a3, &v11).exchange64;
  if( !*((_BYTE *)a3 + 20) )
    LODWORD(v11) = v3 != 0 ? v11 : 0;
  while( 1 )
  {
    v8 = v5;
    LODWORD(v12) = v5;
    if( (_DWORD)v11 && (v5 & 1) == 0 )
    {
      v8 = v5 ^ (exchange64 ^ (unsigned __int16)v5) & 0x278 | 1;
      LODWORD(v12) = v8;
    }
    if( (v5 & 2) == 0 )
    {
      v8 = ((unsigned __int16)v8 ^ exchange64) & 0x100 ^ v8 | 2;
      LODWORD(v12) = v8;
    }
    v9 = _InterlockedCompareExchange(a1, v8, v5);
    if( v5 == v9 )
      break;
    v5 = v9;
  }
  if( (v5 & 2) == 0 && *(&stru_140CF2E80 + 985) )
    (*(&stru_140CF2E80 + 985))(a1, *((unsigned __int8 *)a3 + 20), v3);
  if( !(_DWORD)v11 )
    LODWORD(v12) = ((unsigned __int16)v8 ^ exchange64) & 0x278 ^ v8;
  return v12;
}

Referenced by:

wil_details_FeatureStateCache_GetCachedFeatureEnabledState