VslpFlushBufferArray

VOID **__stdcall VslpFlushBufferArray(){
  VOID **result; 
  unsigned int v1; 
  __int64 v2; 
  unsigned int v3; 
  VOID ***v4; 
  bool v5; 
  __int64 v6; 
  unsigned int v7; 
  int v8; 
  VOID **v9; 
  _DWORD *v10; 
  UINT64 *v11; 
  result = (VOID **)VslpEventLog;
  v1 = 0;
  v2 = *((unsigned int *)VslpEventLog + 2);
  v3 = *(_DWORD *)VslpEventLog;
  v4 = (VOID ***)((char *)VslpEventLog + 8 * v2 + 24);
  if( (_DWORD)v2 )
  {
    do
    {
      result = *v4;
      v5 = !_BitScanForward64((unsigned __int64 *)&v6, (unsigned __int64)*v4);
      if( !v5 )
      {
        v7 = v1 << 6;
        do
        {
          v8 = v7 + v6;
          if( v7 + (unsigned int)v6 >= v3 )
            break;
          if( _interlockedbittestandreset64((volatile signed __int32 *)v4, (unsigned int)v6) == 1 )
          {
            result = (VOID **)ExAllocatePoolWithTag(NonPagedPoolNx, 0x10ui64, 0x54736D56ui64);
            v9 = result;
            if( !result )
              return result;
            v10 = VslpEventLog;
            *(_DWORD *)result = v8;
            result[1] = (char *)&v10[4 * v10[2] + 6] + (unsigned int)(v8 * v10[1]);
            ExAcquireRundownProtection((PEX_RUNDOWN_REF)&VslpBufferFlushRundown);
            v11 = VslpLoggerId;
            *((_WORD *)v9[1] + 21) = (_WORD)VslpLoggerId;
            if( (EtwSendTraceBuffer(v11, (INT64)v9[1], 0i64) & 0x80000000) != 0i64 )
              ExReleaseRundownProtection((PEX_RUNDOWN_REF)&VslpBufferFlushRundown);
          }
          result = *v4;
          v5 = !_BitScanForward64((unsigned __int64 *)&v6, (unsigned __int64)*v4);
        }
        while( !v5 );
      }
      ++v1;
      ++v4;
    }
    while( v1 < (unsigned int)v2 );
  }
  return result;
}

Referenced by:

VslpSkFlushBufferCallback
VslpSkStopProfiling