MiUpdateSystemProtoPtesTree

INT64 __stdcall MiUpdateSystemProtoPtesTree(RTL_BALANCED_NODE *Node, INT64 a2){
  int v2; 
  unsigned __int64 v4; 
  unsigned __int64 v5; 
  _QWORD *v6; 
  bool v7; 
  _QWORD *v8; 
  INT64 result; 
  __int64 a2a; 
  __int64 v11; 
  v2 = a2;
  a2a = 0i64;
  v4 = MiObtainProtoBaseFromNode(Node, &a2a);
  v5 = ExAcquireSpinLockExclusive(&dword_140C4C880);
  if( !v2 )
  {
    RtlAvlRemoveNode((unsigned __int64 *)&qword_140C4C878, (__int64 *)Node);
    Node[1].Children[0] = (_RTL_BALANCED_NODE *)((unsigned __int64)Node[1].Children[0] & ~8ui64);
    goto LABEL_9;
  }
  v6 = qword_140C4C878;
  v7 = 0;
  if( !qword_140C4C878 )
    goto LABEL_8;
  while( 1 )
  {
    v11 = 0i64;
    if( v4 < MiObtainProtoBaseFromNode(v6, &v11) )
      break;
    v8 = (_QWORD *)v6[1];
    if( !v8 )
    {
      v7 = 1;
      goto LABEL_8;
    }
LABEL_5:
    v6 = v8;
  }
  v8 = (_QWORD *)*v6;
  if( *v6 )
    goto LABEL_5;
  v7 = 0;
LABEL_8:
  RtlAvlInsertNodeEx((unsigned __int64 *)&qword_140C4C878, (__int64)v6, v7, Node);
  Node[1].Children[0] = (_RTL_BALANCED_NODE *)((unsigned __int64)Node[1].Children[0] | 8);
LABEL_9:
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&dword_140C4C880);
  result = (unsigned int)KiIrqlFlags;
  __writecr8(v5);
  return result;
}

Referenced by:

MiAllocateFileExtents
MiAllocatePerSessionProtos
MiBuildImageControlArea
MiCreateImageFileMap
MiCreatePagingFileMap
MiCreatePrototypePtes
MiDeleteCachedSubsection
MiDeleteEmptySubsections
MiDeletePageFileSectionNodes
MiDeletePerSessionProtos
MiDeleteSubsectionPages
MiExtendSection
MiSegmentDelete