HalpPciConvertDevicePathToRid

NTSTATUS __stdcall HalpPciConvertDevicePathToRid(INT64 a1){
  unsigned __int16 v2; 
  NTSTATUS result; 
  unsigned __int8 *v4; 
  unsigned __int8 v5; 
  unsigned int v6; 
  unsigned __int8 v7; 
  unsigned __int8 v8; 
  __int64 v9; 
  __int16 v10; 
  unsigned __int8 v11; 

  *(_WORD *)(a1 + 4) = 0;
  v2 = *(_WORD *)(a1 + 6);
  if( !v2 )
    return -1073741811;
  v4 = *(unsigned __int8 **)(a1 + 8);
  v5 = *(_BYTE *)(a1 + 3);
  v6 = 1;
  v11 = v5;
  v7 = *v4;
  v8 = v4[1];
  if( v2 <= 1u )
  {
LABEL_6:
    v10 = v8 | (unsigned __int16)(8 * (v7 | (unsigned __int16)(32 * v5)));
    result = 0;
    *(_WORD *)(a1 + 4) = v10;
  }
  else
  {
    while( 1 )
    {
      result = HalpPciReadSecondaryBusNumber(*(_WORD *)a1, v5, v7, v8, &v11);
      if( result < 0 )
        break;
      v9 = v6++;
      v7 = v4[2 * v9];
      v8 = v4[2 * v9 + 1];
      v5 = v11;
      if( v6 >= *(unsigned __int16 *)(a1 + 6) )
        goto LABEL_6;
    }
  }
  return result;
}

Referenced by:

HalpIommuDetermineReservedPciRid