MiUpdatePfnPriority

CHAR __fastcall MiUpdatePfnPriority(INT64 a1){
  CHAR v1; 
  unsigned int PfnPriority; 
  __int64 v3; 
  unsigned int v4; 
  __int64 v5; 
  unsigned int v6; 
  unsigned int v7; 
  CHAR v8; 
  int v9; 
  char v10; 
  v1 = -1;
  PfnPriority = MiGetPfnPriority(a1);
  v7 = PfnPriority;
  if( v6 != PfnPriority )
  {
    v8 = 0;
    if( v6 >= PfnPriority
      || v4
      && (PfnPriority <= 5
       || (LOBYTE(v9) = MI_PFN_IS_PROTO((UNICODE_STRING *)v3, (UNICODE_STRING *)PfnPriority, v4, (PWCHAR)v5), !v9)) )
    {
      v10 = *(_BYTE *)(v3 + 34) & 7;
      if( v10 == 2 )
      {
        if( v7
          || (*(_DWORD *)(v3 + 16) & 0x400i64) != 0
          || !(unsigned int)MiIsPteInStore(
                              *(_QWORD *)(qword_140C4E388 + 8 * ((*(_QWORD *)(v3 + 40) >> 39) & 0x3FFi64)),
                              *(_QWORD *)(v3 + 16)) )
        {
          MiRelinkStandbyPage((_MMPFN *)v5, v6, v4);
        }
      }
      else if( v10 != 6 || (*(_QWORD *)(v3 + 24) & 0x3FFFFFFFFFFFFFFFui64) <= 1 || v6 >= v7 )
      {
        *(_BYTE *)(v5 + 35) ^= (*(_BYTE *)(v5 + 35) ^ v6) & 7;
        if( v7 < 5 )
        {
          v1 = -1;
          if( v6 == 5 )
            return v8;
        }
        else if( v6 < 5 )
        {
          return 7;
        }
      }
    }
  }
  return v1;
}

Referenced by:

MiActOnPte
MiConvertPrivateToProto
MiDeprioritizeVirtualAddresses
MiPfPutPagesInTransition
MiResolveTransitionFault
MiUpdatePrefetchPriority
NtLockVirtualMemory