RtlpGenericStrideWorker

UINT8 __stdcall RtlpGenericStrideWorker(UINT64 Pattern, UINT64 Inverse, PVOID VirtualAddress){
  unsigned __int64 v3; 
  unsigned int v4; 
  unsigned __int64 v5; 
  unsigned int v6; 
  unsigned __int64 v7; 
  int v8; 
  unsigned __int64 v9; 
  __int64 v10; 
  __int64 v11; 
  _DWORD *i; 
  struct _KPRCB *CurrentPrcb; 
  __int64 v14; 
  char *j; 
  struct _KPRCB *v16; 
  __int64 v17; 
  char *k; 
  _DWORD *m; 
  signed __int32 v21[22]; 
  v4 = Inverse;
  v5 = v3 + 4096;
  v6 = 0;
  v7 = v3;
  v8 = Pattern;
  v9 = (v3 >> 2) - 12 * ((unsigned __int64)(((v3 >> 2) * (unsigned __int128)0xAAAAAAAAAAAAAAABui64) >> 64) >> 3);
  while( 2 )
  {
    v10 = 2 * v6 - (unsigned int)v9;
    v11 = (unsigned int)v10;
    if( (unsigned int)v9 > 2 * v6 )
      v11 = (unsigned int)(v10 + 12);
    for( i = (_DWORD *)(v7 + 4 * v11); (unsigned __int64)i < v5; i += 12 )
    {
      *i = v8;
      i[1] = v8;
    }
    CurrentPrcb = KeGetCurrentPrcb();
    v14 = *((unsigned int *)CurrentPrcb + 58);
    if( *((_DWORD *)CurrentPrcb + 58) )
    {
      _InterlockedOr(v21, 0);
      for( j = (char *)(v7 & ~(v14 - 1)); (unsigned __int64)j < v5; j += v14 )
        _mm_clflush(j);
    }
    RtlpFillMemoryWithInverseStride(v4, v6, VirtualAddress);
    v16 = KeGetCurrentPrcb();
    v17 = *((unsigned int *)v16 + 58);
    if( *((_DWORD *)v16 + 58) )
    {
      _InterlockedOr(v21, 0);
      for( k = (char *)(v7 & ~(v17 - 1)); (unsigned __int64)k < v5; k += v17 )
        _mm_clflush(k);
    }
    if( (unsigned int)v9 > 2 * v6 )
      v10 = (unsigned int)(v10 + 12);
    for( m = (_DWORD *)(v7 + 4 * v10); (unsigned __int64)m < v5; m += 12 )
    {
      if( *m != v8 || m[1] != v8 )
        return 0;
    }
    if( ++v6 < 6 )
      continue;
    break;
  }
  return 1;
}

Referenced by:

RtlScrubMemory