MiObtainProtoBaseFromNode

__int64 __fastcall MiObtainProtoBaseFromNode(_QWORD *a1, _QWORD *a2){
  unsigned __int64 v3; 
  __int64 v4; 
  __int64 v5; 
  __int64 result; 
  int v7; 
  int v8; 
  __int64 v9; 
  __int64 v10; 
  __int64 v11; 
  __int64 v12; 
  int v13; 

  v3 = a1[3] & 7i64;
  if( v3 > 4 )
    return 0i64;
  if( !(_DWORD)v3 )
  {
    v4 = *(a1 - 13);
    v5 = *((unsigned int *)a1 - 17);
LABEL_4:
    *a2 = v5;
    return v4;
  }
  v7 = v3 - 1;
  if( !v7 )
  {
    result = *(a1 - 6);
    *a2 = *((unsigned int *)a1 - 3);
    return result;
  }
  v8 = v7 - 1;
  if( v8 )
  {
    v13 = v8 - 1;
    if( !v13 )
    {
      result = a1[6];
      *a2 = a1[4];
      return result;
    }
    if( v13 == 1 )
    {
      v4 = a1[4];
      v5 = a1[5];
      goto LABEL_4;
    }
    return 0i64;
  }
  v9 = *(a1 - 7) + 128i64;
  v10 = 0i64;
  v11 = *(_QWORD *)(*(a1 - 7) + 136i64);
  do
  {
    v12 = *(unsigned int *)(v9 + 44);
    v9 = *(_QWORD *)(v9 + 16);
    v10 += v12;
  }
  while( v9 );
  *a2 = v10;
  return v11;
}

Referenced by:

MiGetPrototypePteBoundaries
MiGetPrototypePteRanges
MiReferencePfBackedSection
MiReplaceSystemProtoPtesNode
MiUpdateSystemProtoPtesTree