KiStopProfileTarget

VOID __stdcall KiStopProfileTarget(UINT64 Argument){
  __int64 v1; 
  unsigned __int8 CurrentIrql; 
  __int64 v4; 
  __int64 v5; 
  _QWORD *v6; 
  _QWORD *v7; 
  _QWORD *v8; 
  int v9; 
  __int64 v11; 
  _QWORD *v12; 
  struct _KPRCB *CurrentPrcb; 
  int v14[8]; 
  __int128 v15; 
  __int64 v16; 
  unsigned int v17; 
  v1 = *(_QWORD *)Argument;
  v17 = 0;
  v15 = 0i64;
  v16 = 0i64;
  CurrentIrql = KeGetCurrentIrql();
  __writecr8((unsigned __int8)KiProfileIrql);
  if( !_InterlockedDecrement((volatile signed __int32 *)(Argument + 8)) && *(_BYTE *)(v1 + 242) )
  {
    *(_BYTE *)(v1 + 242) = 0;
    v4 = v1 + 8;
    v5 = *(_QWORD *)(v1 + 8);
    if( v5 != v1 + 8 )
    {
      v6 = *(_QWORD **)(v1 + 16);
      if( *(_QWORD *)(v5 + 8) != v4 || *v6 != v4 )
        goto LABEL_21;
      *v6 = v5;
      *(_QWORD *)(v5 + 8) = v6;
    }
    v7 = (_QWORD *)KiProfileSourceListHead;
    do
    {
      v8 = v7;
      v7 = (_QWORD *)*v7;
    }
    while( *((_DWORD *)v8 + 4) != *(__int16 *)(v1 + 240) );
    *((_QWORD *)&v15 + 1) = *(_QWORD *)(v1 + 80);
    *(_QWORD *)&v15 = v1 + 72;
    while( !(unsigned int)KeEnumerateNextProcessor(&v17, (unsigned __int16 **)&v15) )
    {
      v9 = v17;
      if( (*((_DWORD *)v8 + v17 + 48))-- == 1 )
        KeAddProcessorAffinityEx((_WORD *)(Argument + 16), v9);
    }
    _InterlockedOr(v14, 0);
    KeSubtractAffinityEx((_KAFFINITY_EX *)(v8 + 3), (_KAFFINITY_EX *)(Argument + 16), (_KAFFINITY_EX *)(v8 + 3));
    if( !(unsigned int)KeIsEmptyAffinityEx((_WORD *)v8 + 12) )
      goto LABEL_17;
    v11 = *v8;
    v12 = (_QWORD *)v8[1];
    if( *(_QWORD **)(*v8 + 8i64) == v8 && (_QWORD *)*v12 == v8 )
    {
      *v12 = v11;
      *(_QWORD *)(v11 + 8) = v12;
      *(_QWORD *)(Argument + 184) = v8;
LABEL_17:
      *(_BYTE *)(Argument + 192) = 1;
      goto LABEL_18;
    }
LABEL_21:
    __fastfail(3u);
  }
LABEL_18:
  _InterlockedAdd((volatile signed __int32 *)(Argument + 12), 0xFFFFFFFF);
  while( *(int *)(Argument + 12) > 0 )
    _mm_pause();
  CurrentPrcb = KeGetCurrentPrcb();
  if( (*(_QWORD *)(Argument + 8i64 * *((unsigned __int8 *)CurrentPrcb + 208) + 24) & *((_QWORD *)CurrentPrcb + 25)) != 0i64 )
    (*((void(__fastcall **)(_QWORD, _QWORD))HalpProfileInterface[0] + 2))((unsigned int)*(__int16 *)(v1 + 240), 0i64);
  __writecr8(CurrentIrql);
}

Referenced by:

KeStopProfile