PipIommuRetrieveDeviceId

__int64 __fastcall PipIommuRetrieveDeviceId(_QWORD *a1, _QWORD *a2){
  VOID **v2; 
  unsigned int(__fastcall *v3)(_QWORD, _QWORD, _QWORD, UINT64 *); 
  VOID **PoolWithTag; 
  int v7; 
  __int64 result; 
  UINT64 NumberOfBytes; 

  NumberOfBytes = 0i64;
  v2 = 0i64;
  v3 = (unsigned int(__fastcall *)(_QWORD, _QWORD, _QWORD, UINT64 *))a1[8];
  if( !v3 )
  {
    v7 = -1073741637;
    goto LABEL_8;
  }
  if( v3(a1[1], 0i64, 0i64, &NumberOfBytes) != -1073741789 || !NumberOfBytes )
  {
    v7 = -1073741823;
LABEL_7:
    if( v7 >= 0 )
      goto LABEL_8;
    goto LABEL_12;
  }
  PoolWithTag = ExAllocatePoolWithTag(1ui64, NumberOfBytes, 1685089872i64);
  v2 = PoolWithTag;
  if( !PoolWithTag )
  {
    v7 = -1073741670;
    goto LABEL_8;
  }
  memset(PoolWithTag, 0i64, NumberOfBytes);
  v7 = ((__int64(__fastcall *)(_QWORD, UINT64, VOID **, _QWORD))a1[8])(a1[1], NumberOfBytes, v2, 0i64);
  if( v7 >= 0 )
  {
    PipIommuValidateDeviceId(a1, (INT64)v2, NumberOfBytes);
    goto LABEL_7;
  }
LABEL_12:
  if( v2 )
  {
    ExFreePoolWithTag(v2, 0x64706E50u);
    v2 = 0i64;
  }
LABEL_8:
  result = (unsigned int)v7;
  *a2 = v2;
  return result;
}

Referenced by:

PiIommuAllocateExtension