PopFxUpdateGlobalDeviceAccountingInfo

INT64 __stdcall PopFxUpdateGlobalDeviceAccountingInfo(UINT64 a1, UINT64 a2){
  INT64 result; 
  UINT64 v3; 
  __int64 v4; 
  __int64 *i; 
  result = qword_140C246E8;
  if( qword_140C246E8 < a1 )
  {
    v3 = a1 - qword_140C246E8;
    qword_140C246F0 += a1 - qword_140C246E8;
    if( a1 - qword_140C246E8 < a2 )
    {
      qword_140C246F8 += v3;
    }
    else
    {
      v4 = 0i64;
      for( i = PopFxAccountingBucketLimits; ; ++i )
      {
        if( v3 >= *i )
        {
          result = (unsigned int)(v4 + 1);
          if( v3 < PopFxAccountingBucketLimits[result] )
            break;
        }
        v4 = (unsigned int)(v4 + 1);
        if( (unsigned int)v4 >= 5 )
          return result;
      }
      ++*(_QWORD *)&PopFxGlobalDeviceAccountingInfo[8 * v4 + 32];
      *(_QWORD *)&PopFxGlobalDeviceAccountingInfo[8 * v4 + 72] += v3;
    }
  }
  return result;
}

Referenced by:

PopFxSetDripsBlockedByDeviceActivity
PopFxSetGlobalDeviceAccountingEnabled