PopFxVerifyDependencies

_EXCEPTION_DISPOSITION __stdcall PopFxVerifyDependencies(
        _KNOWN_CONTROLLER_TYPE a1,
        _KNOWN_CONTROLLER_TYPE a2,
        _KNOWN_CONTROLLER_TYPE a3,
        _KNOWN_CONTROLLER_TYPE a4,
        _KNOWN_CONTROLLER_TYPE a5){
  __int64 v5; 
  _DWORD *v7; 
  _EXCEPTION_DISPOSITION v8; 
  VOID **PoolWithTag; 
  unsigned int v10; 
  unsigned int v11; 
  _DWORD *v12; 
  __int64 v13; 
  int v14; 
  unsigned int *v15; 
  unsigned int v16; 
  unsigned int v17; 
  __int64 v18; 
  unsigned int v19; 
  unsigned int v21; 
  unsigned int v22; 
  __int64 v23; 
  int v24; 
  __int64 v25; 

  v5 = *(_QWORD *)&a2;
  v7 = *(_DWORD **)&a1;
  v8 = ExceptionContinueExecution;
  PoolWithTag = ExAllocatePoolWithTag(1ui64, 4i64 * (unsigned int)a3, 1297630800i64);
  if( !PoolWithTag )
    return -1073741670;
  v10 = 0;
  v11 = 0;
  if( a3 )
  {
    v12 = v7;
    while( 1 )
    {
      if( !*v12 )
      {
        *((_DWORD *)PoolWithTag + v10++) = v11;
        if( v10 )
          break;
      }
LABEL_26:
      ++v11;
      v12 += 3;
      if( v11 >= a3 )
        goto LABEL_17;
    }
    while( 1 )
    {
      v13 = *((unsigned int *)PoolWithTag + v10 - 1);
      if( (unsigned int)v13 >= a3 )
        break;
      v14 = v7[3 * v13];
      if( v14 == 2 )
        break;
      _mm_lfence();
      v15 = *(unsigned int **)(*(_QWORD *)(*(_QWORD *)(v5 + 832) + 8 * v13) + 176i64);
      _mm_lfence();
      if( v14 == 1 )
      {
        v7[3 * v13] = 2;
        --v10;
        v16 = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(v5 + 832) + 8i64 * (unsigned int)v13) + 172i64);
        if( v16 )
        {
          v17 = v7[3 * v13 + 1];
          v18 = v16;
          do
          {
            v19 = v7[3 * *v15 + 1];
            if( v19 > v17 )
            {
              v17 = v7[3 * *v15 + 1];
              v7[3 * v13 + 1] = v19;
            }
            v15 += 2;
            --v18;
          }
          while( v18 );
          if( ++v7[3 * v13 + 1] > 4u )
            break;
        }
      }
      else
      {
        v7[3 * v13] = 1;
        v21 = 0;
        v22 = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(v5 + 832) + 8i64 * (unsigned int)v13) + 172i64);
        if( v22 )
        {
          do
          {
            v23 = *v15;
            v24 = v7[3 * v23];
            if( v24 == 1 )
              goto LABEL_16;
            if( !v24 )
            {
              if( v10 >= a3 )
                goto LABEL_16;
              v25 = v10++;
              *((_DWORD *)PoolWithTag + v25) = v23;
            }
            ++v21;
            v15 += 2;
          }
          while( v21 < v22 );
        }
      }
      if( !v10 )
        goto LABEL_26;
    }
LABEL_16:
    v8 = -1073741811;
  }
LABEL_17:
  ExFreePoolWithTag(PoolWithTag, 0x4D584650u);
  return v8;
}

Referenced by:

PopFxRegisterDeviceWorker