PfSnCheckActionsNeeded

__int64 __fastcall PfSnCheckActionsNeeded(__int64 a1, int a2, _ETHREAD *a3, int *a4, int *a5){
  int v8; 
  unsigned int v9; 
  int v10; 
  NTSTATUS DefaultPagePriority; 
  unsigned int v12; 
  unsigned int v13; 
  unsigned int v14; 
  unsigned __int8 *v15; 
  __int64 v16; 
  __int64 v17; 
  __int64 v18; 
  unsigned __int64 v19; 
  UINT64 v20; 
  UINT64 v21; 
  UINT64 v22; 
  UINT64 v23; 
  UINT64 PageListCount; 
  _ETHREAD *CurrentThread; 
  UINT64 v26; 
  INT64 v27; 
  __int64 v28; 
  _DWORD *v29; 
  unsigned int v30; 
  unsigned int v31; 
  unsigned int v32; 
  int v33; 
  int v35[2]; 
  __int64 v36; 
  int *v37; 
  int *v38; 
  UINT64 SystemInformationLength[22]; 

  v36 = a1;
  v38 = a5;
  v37 = a4;
  memset(SystemInformationLength, 0i64, sizeof(SystemInformationLength));
  v35[1] = 0;
  v8 = 3;
  v35[0] = 0;
  v9 = 3;
  v10 = 23;
  if( (dword_140C4FFF0 & 8) != 0 )
  {
    v10 = 22;
    v8 = 22;
  }
  else
  {
    PsGetPagePriorityThread(a3);
    DefaultPagePriority = MmGetDefaultPagePriority();
    v13 = DefaultPagePriority;
    v14 = DefaultPagePriority - 1;
    if( v12 > DefaultPagePriority - 1 )
      v12 = DefaultPagePriority;
    if( v12 <= v14 )
    {
      v8 = 2;
      v10 = 2;
    }
    else
    {
      if( (dword_140C50290 & 0x10) != 0 && !a2 )
      {
        v9 = 1;
        v10 = 14;
      }
      v15 = (unsigned __int8 *)a1;
      v16 = 314159i64;
      v17 = 8i64;
      do
      {
        v18 = *v15;
        v15 += 8;
        v16 = *(v15 - 1)
            + 37
            * (*(v15 - 2)
             + 37
             * (*(v15 - 3)
              + 37 * (*(v15 - 4) + 37 * (*(v15 - 5) + 37 * (*(v15 - 6) + 37 * (*(v15 - 7) + 37 * (v18 + 37 * v16)))))));
        --v17;
      }
      while( v17 );
      v19 = (KUSER_SHARED_DATA.TickCountQuad * KUSER_SHARED_DATA.TickCountMultiplier) >> 24;
      MmQueryMemoryListInformation((VOID *)0xFFFFFFFFFFFFFFFFi64, (UINT64)SystemInformationLength, (UINT64 *)0xB0);
      v20 = PfpGetPageListCount(&SystemInformationLength[13], 0i64, 7ui64) << 12 >> 18;
      v22 = PfpGetPageListCount(&SystemInformationLength[13], v13, v21) << 12 >> 18;
      PageListCount = PfpGetPageListCount(&SystemInformationLength[13], v14, v23);
      CurrentThread = (_ETHREAD *)KeGetCurrentThread();
      v26 = PageListCount << 12 >> 18;
      --CurrentThread->Tcb.KernelApcDisable;
      ExAcquireResourceExclusiveLite((UINT64)&Resource, 1, v27);
      v28 = PfSnPrefetchCacheEntryGet(&unk_140C501F8, v36, v16, v35);
      v29 = (_DWORD *)v28;
      if( v28 )
      {
        if( v35[0] )
        {
          v8 = 13;
          if( v9 >= 2 )
            v10 = 13;
        }
        else
        {
          v30 = v19 - *(_DWORD *)(v28 + 108);
          v31 = *(_DWORD *)(v28 + 112);
          v32 = v9 & 0xFFFFFFFE;
          v8 = (v30 < v31) + 4;
          if( v30 >= v31 )
            v32 = v9;
          v9 = v32;
          if( v32 >= 2 )
          {
            v10 = 4;
            if( (dword_140C4FFF0 & 2) == 0 )
            {
              if( v30 >= 0x1B7740 )
              {
                if( v30 >= 0x36EE80 )
                  v33 = v20 - v29[26];
                else
                  v33 = v26 - v29[25];
              }
              else
              {
                v33 = v22 - v29[24];
              }
              if( !v33 )
              {
                v9 = v32 & 0xFFFFFFFD;
                v10 = 7;
              }
            }
          }
        }
        v29[27] = v19;
        v29[24] = v22;
        v29[25] = v26;
        v29[26] = v20;
      }
      else
      {
        v10 = 3;
      }
      ExReleaseResourceLite(&Resource);
      KeLeaveCriticalRegionThread(KeGetCurrentThread());
    }
  }
  *v37 = v8;
  *v38 = v10;
  return v9;
}

Referenced by:

PfSnBeginScenario