EtwpUpdateLastBranchTracingEvents

INT64 __fastcall EtwpUpdateLastBranchTracingEvents(INT64 a1, INT64 a2, UINT64 a3){
  unsigned int v3; 
  INT64 result; 
  __int64 i; 
  signed __int32 v8[14]; 
  v3 = a3;
  if( !EtwpLastBranchSupportedOptions )
    return 3221225659i64;
  if( !(_DWORD)a3 || (unsigned int)a3 > 4 )
    return 3221225485i64;
  if( *(_QWORD *)(a1 + 1008) || (result = EtwpAllocateLbrData(a1), (int)result >= 0) )
  {
    for( i = 0i64; ; i = (unsigned int)(i + 1) )
    {
      v8[8] = i;
      if( (unsigned int)i >= v3 )
        break;
      *(_WORD *)(*(_QWORD *)(a1 + 1008) + 2 * i + 12) = *(_WORD *)(a2 + 4 * i);
    }
    _InterlockedOr(v8, 0);
    *(_DWORD *)(*(_QWORD *)(a1 + 1008) + 8i64) = v3;
    return 0i64;
  }
  return result;
}

Referenced by:

EtwSetPerformanceTraceInformation