CmFcpManagerDrainUsageNotifications

void __fastcall CmFcpManagerDrainUsageNotifications(_EX_PUSH_LOCK *a1, char a2){
  _EX_PUSH_LOCK *v2; 
  _EX_PUSH_LOCK *v3; 
  __int64 v4; 
  INT64 v5; 
  _DWORD *bf_0; 
  int v7; 
  UINT32 NextForwardRunSet; 
  unsigned int v9; 
  UINT32 v10; 
  __int64 v11; 
  NTSTATUS v12; 
  unsigned int v13; 
  INT64 v14; 
  UINT64 *v15; 
  _RTL_BITMAP BitMapHeader; 
  unsigned int StartingRunIndex; 
  INT64 v20; 

  v20 = 0i64;
  v2 = a1;
  v3 = a1 + 38;
  v4 = v3->_bf_0 & 1;
  RtlUpdateSwapReference(v3, (v4 - 1) & 1);
  RtlpFcBufferManagerReferenceBuffers((__int64)&v2[14], (__int64)&v15, &v20);
  v5 = v20;
  bf_0 = (_DWORD *)v2[v4 + 43]._bf_0;
  *(&BitMapHeader.SizeOfBitMap + 1) = 0;
  StartingRunIndex = 0;
  v7 = 0;
  v14 = *(_QWORD *)(v20 + 64);
  v15 = *(UINT64 **)(v20 + 56);
  BitMapHeader.Buffer = bf_0 + 2;
  BitMapHeader.SizeOfBitMap = 64;
  NextForwardRunSet = RtlFindNextForwardRunSet(&BitMapHeader, 0, &StartingRunIndex);
  if( NextForwardRunSet )
  {
    do
    {
      v9 = StartingRunIndex;
      v10 = StartingRunIndex + NextForwardRunSet;
      if( StartingRunIndex < StartingRunIndex + NextForwardRunSet )
      {
        v11 = 3i64 * StartingRunIndex;
        do
        {
          if( !bf_0[v11 + 4] || a2 )
          {
            v12 = RtlpFcSendFeatureUsageNotifications((INT64)&bf_0[v11 + 5], v15, v14);
            v13 = bf_0[v11 + 4] + 1;
            bf_0[v11 + 4] = v13;
            if( v12 < 0 && (v12 == -1073741801 || v12 == -1073741670 || v12 != -1073741275) && v13 >= 5 )
            {
              ++v7;
            }
            else
            {
              *(_QWORD *)&bf_0[v11 + 4] = 0i64;
              bf_0[v11 + 6] = 0;
              _bittestandreset(bf_0 + 2, v9);
              --*bf_0;
            }
          }
          ++v9;
          v11 += 3i64;
        }
        while( v9 < v10 );
      }
      NextForwardRunSet = RtlFindNextForwardRunSet(&BitMapHeader, v10, &StartingRunIndex);
    }
    while( NextForwardRunSet );
    v2 = a1;
    v5 = v20;
  }
  RtlpFcBufferManagerDereferenceBuffers(&v2[14]._bf_0, v5);
  if( v7 )
    CmFcpManagerArmFeatureUsageRetryTimer((__int64)v2);
}

Referenced by:

CmFcManagerDrainAllFeatureUsageNotifications
CmFcpManagerDrainUsageNotificationsWorker
CmFcpManagerRetryUsageNotificationsWorker
CmFcpManagerSoftwareHiveReady