PfPrefetchRequestVerify

INT64 __fastcall PfPrefetchRequestVerify(UINT64 a1, UINT64 a2){
  __int64 v3; 
  INT64 result; 
  __int64 v5; 
  UINT64 v6; 
  unsigned int v7; 
  __int64 v8; 
  int v9; 
  __int64 v10; 
  UINT64 v11; 
  UINT64 v12; 
  __int64 v13; 
  int v14; 
  UINT64 v15; 
  __int64 v16; 
  __int128 v17; 
  INT64 v18[2]; 
  __int128 v19; 
  __int128 v20; 
  __int64 v21; 
  int v22; 
  v21 = 0i64;
  v22 = 0;
  *(_OWORD *)v18 = 0i64;
  v19 = 0i64;
  v20 = 0i64;
  v17 = 0i64;
  if( (unsigned int)a2 < 0x80 )
    return 1000i64;
  if( *(_DWORD *)a1 != 13 )
    return 1500i64;
  v3 = *(unsigned int *)(a1 + 4);
  if( (_DWORD)a2 != (_DWORD)v3 )
    return 2000i64;
  if( a1 + v3 < a1 )
    return 2500i64;
  if( (unsigned __int16)*(_DWORD *)(a1 + 28) >= 8u )
    return 3000i64;
  if( *(_WORD *)(a1 + 30) >= 8u )
    return 3200i64;
  if( (*(_DWORD *)(a1 + 80) & 0xC0) != 0 )
    return 3400i64;
  if( *(_BYTE *)(a1 + 81) >= 6u )
    return 3600i64;
  result = PfPrefetchRequestPrepareForVerify((unsigned int *)a1, a2, (__int64)v18);
  if( !(_DWORD)result )
  {
    if( PfRequestRangeCheck((unsigned int *)v18, *(_DWORD *)(a1 + 32), 40 * *(_DWORD *)(a1 + 8), 8, 1) )
    {
      _mm_lfence();
      v5 = 0i64;
      v6 = a1 + *(unsigned int *)(a1 + 32);
      if( *(_DWORD *)(a1 + 8) )
      {
        while( 1 )
        {
          LODWORD(v17) = *(_DWORD *)(v6 + 40 * v5 + 32);
          DWORD2(v17) = *(_DWORD *)(v6 + 40 * v5 + 24);
          result = PfPrefetchRequestVerifyPath(a1, (__int64)v18, (unsigned int *)&v17);
          if( (_DWORD)result )
            break;
          v7 = *(_DWORD *)(v6 + 40 * v5 + 12) >> 1;
          if( !v7 )
            return 13000i64;
          if( v7 > DWORD1(v19) )
            return 14000i64;
          v8 = *(unsigned int *)(v6 + 40 * v5 + 16);
          if( !PfRequestRangeCheck((unsigned int *)&v18[1] + 1, *(_DWORD *)(v6 + 40 * v5 + 16), 48 * v7, 8, 1) )
            return 15000i64;
          v10 = 0i64;
          v11 = a1 + v8;
          if( v9 )
          {
            do
            {
              v12 = v11 + 48 * v10;
              if( *(_DWORD *)(v12 + 32) || *(_DWORD *)(v12 + 40) )
              {
                result = PfPrefetchRequestVerifyPath(a1, (__int64)v18, (unsigned int *)(v12 + 32));
                if( (_DWORD)result )
                  return result;
              }
              result = PfPrefetchRequestVerifyRanges(
                         a1,
                         (INT64)v18,
                         (UINT64 *)(v12 + 16),
                         (*(_DWORD *)v12 & 1) != 0 ? 512 : 4096);
              if( (_DWORD)result )
                return result;
              v10 = (unsigned int)(v10 + 1);
            }
            while( (unsigned int)v10 < *(_DWORD *)(v6 + 40 * v5 + 12) >> 1 );
          }
          v5 = (unsigned int)(v5 + 1);
          if( (unsigned int)v5 >= *(_DWORD *)(a1 + 8) )
            goto LABEL_22;
        }
      }
      else
      {
LABEL_22:
        v13 = *(unsigned int *)(a1 + 56);
        if( PfRequestRangeCheck((unsigned int *)&v20 + 1, *(_DWORD *)(a1 + 56), 40 * *(_DWORD *)(a1 + 20), 8, 1) )
        {
          v15 = a1 + v13;
          v16 = 0i64;
          if( v14 )
          {
            while( 1 )
            {
              result = PfPrefetchRequestVerifyRanges(
                         a1,
                         (INT64)v18,
                         (UINT64 *)(v15 + 8 * ((unsigned int)v16 + 3i64 + 4 * v16)),
                         4096i64);
              if( (_DWORD)result )
                break;
              v16 = (unsigned int)(v16 + 1);
              if( (unsigned int)v16 >= *(_DWORD *)(a1 + 20) )
                return 0i64;
            }
          }
          else
          {
            return 0i64;
          }
        }
        else
        {
          return 40000i64;
        }
      }
    }
    else
    {
      return 12500i64;
    }
  }
  return result;
}

Referenced by:

PfpPrefetchRequest