HalpPciConvertDevicePathToRid

INT64 __fastcall HalpPciConvertDevicePathToRid(INT64 a1){
  INT64 v1; 
  unsigned __int16 v3; 
  INT64 result; 
  unsigned __int8 *v5; 
  unsigned __int8 v6; 
  unsigned int v7; 
  unsigned __int8 v8; 
  unsigned __int8 v9; 
  __int64 v10; 
  __int16 v11; 
  unsigned __int8 v12; 
  *(_WORD *)(a1 + 4) = 0;
  v3 = *(_WORD *)(a1 + 6);
  if( !v3 )
    return 3221225485i64;
  v5 = *(unsigned __int8 **)(a1 + 8);
  v6 = *(_BYTE *)(a1 + 3);
  v7 = 1;
  v12 = v6;
  v8 = *v5;
  v9 = v5[1];
  if( v3 <= 1u )
  {
LABEL_6:
    v11 = v9 | (unsigned __int16)(8 * (v8 | (unsigned __int16)(32 * v6)));
    result = 0i64;
    *(_WORD *)(a1 + 4) = v11;
  }
  else
  {
    while( 1 )
    {
      LOBYTE(v1) = v6;
      LOWORD(result) = HalpPciReadSecondaryBusNumber(*(unsigned __int16 *)a1, v1);
      if( (int)result < 0 )
        break;
      v10 = v7++;
      v8 = v5[2 * v10];
      v9 = v5[2 * v10 + 1];
      v6 = v12;
      if( v7 >= *(unsigned __int16 *)(a1 + 6) )
        goto LABEL_6;
    }
  }
  return result;
}

Referenced by:

HalpIommuDetermineReservedPciRid