MiCountBootRegions

INT64 __stdcall MiCountBootRegions(UINT64 a1, UINT64 a2, INT64 a3){
  INT64 v3; 
  int v4; 
  unsigned __int64 i; 
  char v7; 
  __int64 v9; 
  __int64 v10; 
  __int64 v11; 
  v3 = 0i64;
  v4 = a3;
  for( i = a1; i <= a2; i += 8i64 )
  {
    v7 = MI_READ_PTE_LOCK_FREE(i);
    if( (v7 & 1) != 0 )
    {
      if( v7 < 0 )
      {
        v9 = 1i64;
        if( v4 > 1 )
        {
          v11 = (unsigned int)(v4 - 1);
          do
          {
            v9 <<= 9;
            --v11;
          }
          while( v11 );
        }
        v3 += v9;
      }
      else if( v4 > 1 )
      {
        v10 = (__int64)((i << 25) - ((_QWORD)MmGetPteBase() << 25)) >> 16;
        v3 += MiCountBootRegions(v10, v10 + 4088, (unsigned int)(v4 - 1));
      }
      else if( v4 == 1 )
      {
        ++v3;
      }
    }
  }
  return v3;
}

Referenced by:

MiCountBootRegions
MiInitializeDynamicVa