PnpBusTypeGuidGetIndex

__int64 __fastcall PnpBusTypeGuidGetIndex(VOID *Source1){
  unsigned int v2; 
  char *v3; 
  __int128 v5; 
  __int64 v6; 
  VOID **PoolWithTag; 
  VOID **v8; 
  PVOID v9; 

  ExAcquireFastMutex(&stru_140C45220);
  v2 = 0;
  if( !dword_140C451C8 )
    goto LABEL_7;
  do
  {
    v3 = (char *)qword_140C45218 + 16 * v2;
    if( Source1 == v3 )
      break;
    if( RtlCompareMemory(Source1, v3, 16) == (_SIZE_T *)16 )
      break;
    ++v2;
  }
  while( v2 < dword_140C451C8 );
  if( v2 == dword_140C451C8 )
  {
LABEL_7:
    if( v2 == dword_140C451CC )
    {
      PoolWithTag = ExAllocatePoolWithTag(1ui64, 16i64 * (v2 + 1), 1970499664i64);
      v8 = PoolWithTag;
      if( PoolWithTag )
      {
        v9 = qword_140C45218;
        memmove(PoolWithTag, qword_140C45218, 16 * dword_140C451C8);
        ++dword_140C451CC;
        if( v9 )
          ExFreePoolWithTag(v9, 0);
        qword_140C45218 = v8;
      }
      else
      {
        v2 = -1;
      }
    }
    if( v2 != -1 )
    {
      v5 = *(_OWORD *)Source1;
      v6 = 2i64 * dword_140C451C8++;
      *(_OWORD *)((char *)qword_140C45218 + 8 * v6) = v5;
    }
  }
  KeReleaseGuardedMutex(&stru_140C45220);
  return(unsigned __int16)v2;
}

Referenced by:

PnpQueryBusInformation