wil_details_FeatureReporting_RecordUsageInCache

struct wil_details_RecordUsageResult *__fastcall wil_details_FeatureReporting_RecordUsageInCache(
        struct wil_details_RecordUsageResult *retstr,
        struct wil_details_FeatureReportingCache *a2,
        __int64 a3){
  int v3; 
  struct wil_details_RecordUsageResult *v4; 
  int v5; 
  int v6; 
  int v7; 
  int v8; 
  int v9; 
  signed __int32 v10; 
  int v12; 
  unsigned __int32 v13; 
  int v14; 
  unsigned __int32 v15; 
  v3 = 0;
  v4 = retstr;
  *(_OWORD *)&retstr->queueBackground = 0i64;
  *(_QWORD *)&retstr->ignoredUse = 0i64;
  if( !(_DWORD)a3 )
    goto LABEL_26;
  if( (_DWORD)a3 == 1 )
  {
LABEL_25:
    wil_details_FeatureReporting_IncrementOpportunityInCache(
      (struct wil_details_FeatureReportingCache *)retstr,
      (enum wil_details_ServiceReportingKind)a3,
      a3,
      retstr);
    return v4;
  }
  if( (int)a3 <= 1 )
    goto LABEL_18;
  if( (int)a3 <= 3 )
  {
LABEL_8:
    v5 = 0;
    v6 = a3 - 2;
    if( v6 )
    {
      v7 = v6 - 1;
      if( v7 )
      {
        v8 = v7 - 3;
        if( v8 )
        {
          if( v8 == 1 )
            v5 = 16;
        }
        else
        {
          v5 = 4;
        }
      }
      else
      {
        v5 = 8;
      }
    }
    else
    {
      v5 = 2;
    }
    v9 = v5 | 1;
    _m_prefetchw(&dword_140CDB260);
    v10 = _InterlockedOr(&dword_140CDB260, v9);
    v4->queueBackground = (v10 & 1) == 0;
    LOBYTE(v3) = (v10 & v9 & 0xFFFFFFFE) == (v9 & 0xFFFFFFFE);
    v4->ignoredUse = v3;
    return v4;
  }
  if( (_DWORD)a3 == 4 )
  {
LABEL_26:
    wil_details_FeatureReporting_IncrementUsageInCache(
      (struct wil_details_FeatureReportingCache *)retstr,
      (enum wil_details_ServiceReportingKind)a3,
      a3,
      retstr);
    return v4;
  }
  if( (_DWORD)a3 == 5 )
    goto LABEL_25;
  if( (unsigned int)(a3 - 6) <= 1 )
    goto LABEL_8;
LABEL_18:
  v12 = a3 - 320;
  if( (unsigned int)(a3 - 320) < 0x40 )
  {
    v13 = dword_140CDB264;
    do
    {
      if( (v13 & 0x10) == 0 || (v14 = 1, ((v13 >> 5) & 0x3F) != v12) )
        v14 = 0;
      retstr->ignoredUse = v14;
      v15 = v13;
      v13 = _InterlockedCompareExchange(&dword_140CDB264, (32 * (v12 & 0x3F)) | v13 & 0xFFFFF81F | 0x10, v13);
    }
    while( v15 != v13 );
  }
  retstr->kindImmediate = a3;
  retstr->countImmediate = 1;
  retstr->payloadId = 0;
  return v4;
}

Referenced by:

wil_details_FeatureReporting_ReportUsageToServiceDirect