HalpIommuCreateIncreaseAliasTrack

NTSTATUS __stdcall HalpIommuCreateIncreaseAliasTrack(PVOID Src){
  _QWORD *v1; 
  __int64 v2; 
  _QWORD *v3; 
  __int64 v5; 
  _OWORD *v6; 
  _QWORD *v7; 
  __int64 v9; 
  int v10; 
  _QWORD *v11; 
  __int64 v12; 
  v2 = HalpRidAliasList;
  v3 = v1;
  while( 1 )
  {
    if( (__int64 *)v2 == &HalpRidAliasList )
    {
      v6 = (_OWORD *)HalpMmAllocCtxAlloc((__int64)Src, 32i64);
      v7 = v6;
      if( !v6 )
        return -1073741670;
      *v6 = 0i64;
      v6[1] = 0i64;
      v10 = HalpIommuCloneDeviceId(Src);
      if( v10 < 0 )
      {
        v12 = v7[2];
        if( v12 )
          HalpMmAllocCtxFree(v9, v12);
        HalpMmAllocCtxFree(v9, (__int64)v7);
      }
      else
      {
        v7[3] = 1i64;
        v11 = (_QWORD *)qword_140C49C08;
        if( *(__int64 **)qword_140C49C08 != &HalpRidAliasList )
          __fastfail(3u);
        *v7 = &HalpRidAliasList;
        v7[1] = v11;
        *v11 = v7;
        qword_140C49C08 = (__int64)v7;
        *v3 = v7;
      }
      return v10;
    }
    if( IidAreIdsStrictlyEqual(*(INT64 **)(v2 + 16), (INT64)Src) )
      break;
    v2 = *(_QWORD *)v5;
  }
  if( _InterlockedIncrement64((volatile signed __int64 *)(v5 + 24)) <= 1 )
    __fastfail(0xEu);
  *v3 = v5;
  return 0;
}

Referenced by:

HalpIommuUnblockDevice