IoStartDiskIoAttributionForContext

VOID __stdcall IoStartDiskIoAttributionForContext(VOID *Context){
  unsigned __int8 v2; 
  unsigned __int64 v3; 
  unsigned __int64 v4; 
  BOOL v5; 
  int v6; 
  unsigned __int64 v7; 

  v2 = ExAcquireSpinLockExclusive((INT64 *)&stru_140C452E0 + 139);
  v3 = *(&stru_140C452E0 + 214);
  v4 = v2;
  if( (*(&stru_140C452E0 + 1720) & 1) != 0 && *(&stru_140C452E0 + 214) )
    v3 = ((unsigned __int64)&stru_140C452E0 + 1712) ^ *(&stru_140C452E0 + 214);
  v5 = 0;
  v6 = *(&stru_140C452E0 + 1720) & 1;
  if( v3 )
  {
    while( 1 )
    {
      if( IopDiskIoAttributionTreeCompare((char *)Context + 24, (_RTL_BALANCED_NODE *)v3) < 0 )
      {
        v7 = *(_QWORD *)v3;
        if( v6 )
        {
          if( !v7 )
            goto LABEL_15;
          v7 ^= v3;
        }
        if( !v7 )
        {
LABEL_15:
          v5 = 0;
          break;
        }
      }
      else
      {
        v7 = *(_QWORD *)(v3 + 8);
        if( v6 )
        {
          if( !v7 )
            goto LABEL_16;
          v7 ^= v3;
        }
        if( !v7 )
        {
LABEL_16:
          v5 = 1;
          break;
        }
      }
      v3 = v7;
    }
  }
  RtlRbInsertNodeEx((UINT64 *)&stru_140C452E0 + 214, v3, v5, (UINT64)Context);
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&stru_140C452E0 + 139);
  __writecr8(v4);
}

Referenced by:

PspIoRateEntryActivate
PspSetJobIoAttribution