; LLVM IR from AdaptiveCpp/AdaptiveCpp :: src/runtime/pcuda (pcuda_stream)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<hipsycl::rt::pcuda::stream *, std::allocator<hipsycl::rt::pcuda::stream *>>::_Vector_impl" }
%"struct.std::_Vector_base<hipsycl::rt::pcuda::stream *, std::allocator<hipsycl::rt::pcuda::stream *>>::_Vector_impl" = type { %"struct.std::_Vector_base<hipsycl::rt::pcuda::stream *, std::allocator<hipsycl::rt::pcuda::stream *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<hipsycl::rt::pcuda::stream *, std::allocator<hipsycl::rt::pcuda::stream *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.hipsycl::rt::device_id" = type { %"struct.hipsycl::rt::backend_descriptor", i32 }
%"struct.hipsycl::rt::backend_descriptor" = type { i32, i32, i32 }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"class.hipsycl::rt::source_location" = type <{ %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, [4 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.49" = type { i8 }
%"class.std::shared_ptr.62" = type { %"class.std::__shared_ptr.63" }
%"class.std::__shared_ptr.63" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::lock_guard" = type { ptr }
%"class.hipsycl::rt::pcuda::stream" = type { %"class.std::shared_ptr.62" }

@_ZN7hipsycl2rt5pcuda12_GLOBAL__N_115stream_registryE = external hidden global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [92 x i8], align 1
@__PRETTY_FUNCTION__._ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji = external hidden unnamed_addr constant [120 x i8], align 1
@__func__._ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [42 x i8], align 1
@_ZN7hipsycl2rt5pcuda12_GLOBAL__N_120stream_registry_lockE = external hidden global { %union.pthread_mutex_t }, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %1, i64 %2, i64 %3, i32 noundef %4, i32 noundef %5) #0 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca i32, align 4
  %8 = alloca %"class.hipsycl::rt::device_id", align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::unique_ptr", align 8
  %14 = alloca %"class.hipsycl::rt::device_id", align 4
  %15 = alloca %"class.hipsycl::rt::source_location", align 8
  %16 = alloca %"class.std::__cxx11::basic_string", align 8
  %17 = alloca %"class.std::allocator.49", align 1
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca %"class.std::__cxx11::basic_string", align 8
  %21 = alloca %"class.std::allocator.49", align 1
  %22 = alloca %"class.std::__cxx11::basic_string", align 8
  %23 = alloca %"class.std::allocator.49", align 1
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca %"class.std::shared_ptr.62", align 8
  %27 = alloca %"class.std::lock_guard", align 8
  %28 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  store i64 %2, ptr %28, align 4
  %29 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  store i64 %3, ptr %29, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !9
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %6
  br label %35

33:                                               ; preds = %6
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.2, i32 noundef 35, ptr noundef @__PRETTY_FUNCTION__._ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji) #9
  unreachable

34:                                               ; No predecessors!
  br label %35

35:                                               ; preds = %34, %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #10
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = call noundef ptr @_ZNK7hipsycl2rt5pcuda13pcuda_runtime6get_rtEv(ptr noundef nonnull align 8 dereferenceable(40) %36)
  %38 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZN7hipsycl2rt7runtime8backendsEv(ptr noundef nonnull align 8 dereferenceable(608) %37)
  %39 = call noundef i32 @_ZNK7hipsycl2rt9device_id11get_backendEv(ptr noundef nonnull align 4 dereferenceable(16) %8)
  %40 = call noundef ptr @_ZNK7hipsycl2rt15backend_manager3getENS0_10backend_idE(ptr noundef nonnull align 8 dereferenceable(72) %38, i32 noundef %39)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %8, i64 16, i1 false), !tbaa.struct !11
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %43 = load i64, ptr %42, align 4
  %44 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %45 = load i64, ptr %44, align 4
  %46 = load ptr, ptr %40, align 8, !tbaa !18
  %47 = getelementptr inbounds ptr, ptr %46, i64 9
  %48 = load ptr, ptr %47, align 8
  call void %48(ptr dead_on_unwind writable sret(%"class.std::unique_ptr") align 8 %13, ptr noundef nonnull align 8 dereferenceable(8) %40, i64 %43, i64 %45, i32 noundef %41)
  %49 = call noundef zeroext i1 @_ZNKSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EEcvbEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #10
  br i1 %49, label %80, label %50

50:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 72, ptr %15) #10
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #10
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #10
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef @__func__._ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji, ptr noundef nonnull align 1 dereferenceable(1) %17)
          to label %51 unwind label %56

51:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #10
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #10
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %21)
          to label %52 unwind label %60

52:                                               ; preds = %51
  invoke void @_ZN7hipsycl2rt15source_locationC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_i(ptr noundef nonnull align 8 dereferenceable(68) %15, ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(32) %20, i32 noundef 42)
          to label %53 unwind label %64

53:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 32, ptr %22) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #10
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %23) #10
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %22, ptr noundef @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %23)
          to label %54 unwind label %68

54:                                               ; preds = %53
  invoke void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_15source_locationE10pcudaErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(68) %15, i32 noundef 30, ptr noundef nonnull align 8 dereferenceable(32) %22)
          to label %55 unwind label %72

55:                                               ; preds = %54
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #10
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %23) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #10
  call void @_ZN7hipsycl2rt15source_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(68) %15) #10
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #10
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #10
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #10
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #10
  call void @llvm.lifetime.end.p0(i64 72, ptr %15) #10
  store i32 30, ptr %7, align 4
  store i32 1, ptr %24, align 4
  br label %112

56:                                               ; preds = %50
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %18, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %19, align 4
  br label %79

60:                                               ; preds = %51
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %18, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %19, align 4
  br label %78

64:                                               ; preds = %52
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %18, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %19, align 4
  br label %77

68:                                               ; preds = %53
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %18, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %19, align 4
  br label %76

72:                                               ; preds = %54
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %18, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %19, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #10
  br label %76

76:                                               ; preds = %72, %68
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %23) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #10
  call void @_ZN7hipsycl2rt15source_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(68) %15) #10
  br label %77

77:                                               ; preds = %76, %64
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #10
  br label %78

78:                                               ; preds = %77, %60
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #10
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #10
  br label %79

79:                                               ; preds = %78, %56
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #10
  call void @llvm.lifetime.end.p0(i64 72, ptr %15) #10
  br label %114

80:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #10
  %81 = call noundef ptr @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #10
  store ptr %81, ptr %25, align 8, !tbaa !5
  %82 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #11
          to label %83 unwind label %94

83:                                               ; preds = %80
  call void @llvm.memset.p0.i64(ptr align 16 %82, i8 0, i64 16, i1 false)
  call void @_ZN7hipsycl2rt5pcuda6streamC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %82) #10
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %82, ptr %84, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %26) #10
  %85 = load ptr, ptr %25, align 8, !tbaa !5
  invoke void @_ZNSt10shared_ptrIN7hipsycl2rt16inorder_executorEEC2IS2_vEEPT_(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef %85)
          to label %86 unwind label %98

86:                                               ; preds = %83
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  %89 = getelementptr inbounds %"class.hipsycl::rt::pcuda::stream", ptr %88, i32 0, i32 0
  %90 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN7hipsycl2rt16inorder_executorEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16) %89, ptr noundef nonnull align 8 dereferenceable(16) %26) #10
  call void @_ZNSt12__shared_ptrIN7hipsycl2rt16inorder_executorELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %26) #10
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #10
  invoke void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull align 8 dereferenceable(40) @_ZN7hipsycl2rt5pcuda12_GLOBAL__N_120stream_registry_lockE)
          to label %91 unwind label %102

91:                                               ; preds = %86
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIPN7hipsycl2rt5pcuda6streamESaIS4_EE9push_backERKS4_(ptr noundef nonnull align 8 dereferenceable(24) @_ZN7hipsycl2rt5pcuda12_GLOBAL__N_115stream_registryE, ptr noundef nonnull align 8 dereferenceable(8) %92)
          to label %93 unwind label %106

93:                                               ; preds = %91
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %27) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #10
  store i32 0, ptr %7, align 4
  store i32 1, ptr %24, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #10
  br label %112

94:                                               ; preds = %80
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %18, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %19, align 4
  br label %111

98:                                               ; preds = %83
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %18, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #10
  br label %111

102:                                              ; preds = %86
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %18, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %19, align 4
  br label %110

106:                                              ; preds = %91
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %18, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %19, align 4
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %27) #10
  br label %110

110:                                              ; preds = %106, %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #10
  br label %111

111:                                              ; preds = %110, %98, %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #10
  br label %114

112:                                              ; preds = %93, %55
  call void @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  %113 = load i32, ptr %7, align 4
  ret i32 %113

114:                                              ; preds = %111, %79
  call void @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr %18, align 8
  %117 = load i32, ptr %19, align 4
  %118 = insertvalue { ptr, i32 } poison, ptr %116, 0
  %119 = insertvalue { ptr, i32 } %118, i32 %117, 1
  resume { ptr, i32 } %119
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7hipsycl2rt5pcuda13pcuda_runtime6get_rtEv(ptr noundef nonnull align 8 dereferenceable(40)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZN7hipsycl2rt7runtime8backendsEv(ptr noundef nonnull align 8 dereferenceable(608)) #3 align 2

declare noundef ptr @_ZNK7hipsycl2rt15backend_manager3getENS0_10backend_idE(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) #4

declare noundef i32 @_ZNK7hipsycl2rt9device_id11get_backendEv(ptr noundef nonnull align 4 dereferenceable(16)) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EEcvbEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

declare void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_15source_locationE10pcudaErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(68), i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) #4

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7hipsycl2rt15source_locationC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_i(ptr noundef nonnull align 8 dereferenceable(68), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7hipsycl2rt15source_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(68)) unnamed_addr #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #7

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7hipsycl2rt5pcuda6streamC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt10shared_ptrIN7hipsycl2rt16inorder_executorEEC2IS2_vEEPT_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN7hipsycl2rt16inorder_executorEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN7hipsycl2rt5pcuda6streamESaIS4_EE9push_backERKS4_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrIN7hipsycl2rt16inorder_executorELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind }
attributes #11 = { builtin allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !14, i64 8, i64 4, !16, i64 12, i64 4, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"_ZTSN7hipsycl2rt10backend_idE", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_ZTSN7hipsycl2rt17hardware_platformE", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_ZTSN7hipsycl2rt12api_platformE", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !8, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<hipsycl::rt::pcuda::stream *, std::allocator<hipsycl::rt::pcuda::stream *>>::_Vector_impl" }
%"struct.std::_Vector_base<hipsycl::rt::pcuda::stream *, std::allocator<hipsycl::rt::pcuda::stream *>>::_Vector_impl" = type { %"struct.std::_Vector_base<hipsycl::rt::pcuda::stream *, std::allocator<hipsycl::rt::pcuda::stream *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<hipsycl::rt::pcuda::stream *, std::allocator<hipsycl::rt::pcuda::stream *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.hipsycl::rt::device_id" = type { %"struct.hipsycl::rt::backend_descriptor", i32 }
%"struct.hipsycl::rt::backend_descriptor" = type { i32, i32, i32 }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"class.hipsycl::rt::source_location" = type <{ %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, [4 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.49" = type { i8 }
%"class.std::shared_ptr.62" = type { %"class.std::__shared_ptr.63" }
%"class.std::__shared_ptr.63" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::lock_guard" = type { ptr }

@_ZN7hipsycl2rt5pcuda12_GLOBAL__N_115stream_registryE = external hidden global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [92 x i8], align 1
@__PRETTY_FUNCTION__._ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji = external hidden unnamed_addr constant [120 x i8], align 1
@__func__._ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [42 x i8], align 1
@_ZN7hipsycl2rt5pcuda12_GLOBAL__N_120stream_registry_lockE = external hidden global { %union.pthread_mutex_t }, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 31) i32 @_ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %1, i64 %2, i64 %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.hipsycl::rt::device_id", align 8
  %8 = alloca %"class.std::unique_ptr", align 8
  %9 = alloca %"class.hipsycl::rt::source_location", align 8
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::allocator.49", align 1
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::allocator.49", align 1
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca %"class.std::allocator.49", align 1
  %16 = alloca %"class.std::shared_ptr.62", align 8
  %17 = alloca %"class.std::lock_guard", align 8
  store i64 %2, ptr %7, align 8
  %18 = getelementptr inbounds i8, ptr %7, i64 8
  store i64 %3, ptr %18, align 8
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %19, label %20

19:                                               ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, i32 noundef 35, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji) #8
  unreachable

20:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %21 = tail call noundef ptr @_ZNK7hipsycl2rt5pcuda13pcuda_runtime6get_rtEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %22 = tail call noundef nonnull align 8 dereferenceable(72) ptr @_ZN7hipsycl2rt7runtime8backendsEv(ptr noundef nonnull align 8 dereferenceable(608) %21)
  %23 = call noundef i32 @_ZNK7hipsycl2rt9device_id11get_backendEv(ptr noundef nonnull align 4 dereferenceable(16) %7)
  %24 = call noundef ptr @_ZNK7hipsycl2rt15backend_manager3getENS0_10backend_idE(ptr noundef nonnull align 8 dereferenceable(72) %22, i32 noundef %23)
  %.sroa.0.0.copyload = load i64, ptr %7, align 8
  %.sroa.2.0.copyload = load i64, ptr %18, align 8
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 72
  %27 = load ptr, ptr %26, align 8
  call void %27(ptr dead_on_unwind nonnull writable sret(%"class.std::unique_ptr") align 8 %8, ptr noundef nonnull align 8 dereferenceable(8) %24, i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload, i32 noundef %5)
  %28 = call noundef zeroext i1 @_ZNKSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EEcvbEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  br i1 %28, label %49, label %29

29:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %9) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #9
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull @__func__._ZN7hipsycl2rt5pcuda6stream6createERPS2_PNS1_13pcuda_runtimeENS0_9device_idEji, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %30 unwind label %35

30:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %13) #9
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %31 unwind label %37

31:                                               ; preds = %30
  invoke void @_ZN7hipsycl2rt15source_locationC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_i(ptr noundef nonnull align 8 dereferenceable(68) %9, ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef 42)
          to label %32 unwind label %39

32:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %14) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %15) #9
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %15)
          to label %33 unwind label %41

33:                                               ; preds = %32
  invoke void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_15source_locationE10pcudaErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(68) %9, i32 noundef 30, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %34 unwind label %43

34:                                               ; preds = %33
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #9
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #9
  call void @_ZN7hipsycl2rt15source_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(68) %9) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #9
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #9
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %9) #9
  br label %67

35:                                               ; preds = %29
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %48

37:                                               ; preds = %30
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %47

39:                                               ; preds = %31
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %46

41:                                               ; preds = %32
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %45

43:                                               ; preds = %33
  %44 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #9
  br label %45

45:                                               ; preds = %43, %41
  %.pn = phi { ptr, i32 } [ %44, %43 ], [ %42, %41 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #9
  call void @_ZN7hipsycl2rt15source_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(68) %9) #9
  br label %46

46:                                               ; preds = %45, %39
  %.pn.pn = phi { ptr, i32 } [ %.pn, %45 ], [ %40, %39 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #9
  br label %47

47:                                               ; preds = %46, %37
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %46 ], [ %38, %37 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #9
  br label %48

48:                                               ; preds = %47, %35
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %47 ], [ %36, %35 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %9) #9
  br label %68

49:                                               ; preds = %20
  %50 = call noundef ptr @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  %51 = invoke noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #10
          to label %52 unwind label %58

52:                                               ; preds = %49
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %51, i8 0, i64 16, i1 false)
  call void @_ZN7hipsycl2rt5pcuda6streamC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %51) #9
  store ptr %51, ptr %0, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %16) #9
  invoke void @_ZNSt10shared_ptrIN7hipsycl2rt16inorder_executorEEC2IS2_vEEPT_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef %50)
          to label %53 unwind label %60

53:                                               ; preds = %52
  %54 = load ptr, ptr %0, align 8, !tbaa !8
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN7hipsycl2rt16inorder_executorEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16) %54, ptr noundef nonnull align 8 dereferenceable(16) %16) #9
  call void @_ZNSt12__shared_ptrIN7hipsycl2rt16inorder_executorELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #9
  invoke void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(40) @_ZN7hipsycl2rt5pcuda12_GLOBAL__N_120stream_registry_lockE)
          to label %56 unwind label %62

56:                                               ; preds = %53
  invoke void @_ZNSt6vectorIPN7hipsycl2rt5pcuda6streamESaIS4_EE9push_backERKS4_(ptr noundef nonnull align 8 dereferenceable(24) @_ZN7hipsycl2rt5pcuda12_GLOBAL__N_115stream_registryE, ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %57 unwind label %64

57:                                               ; preds = %56
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #9
  br label %67

58:                                               ; preds = %49
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %68

60:                                               ; preds = %52
  %61 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #9
  br label %68

62:                                               ; preds = %53
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %66

64:                                               ; preds = %56
  %65 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  br label %66

66:                                               ; preds = %64, %62
  %.pn22 = phi { ptr, i32 } [ %65, %64 ], [ %63, %62 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #9
  br label %68

67:                                               ; preds = %57, %34
  %.0 = phi i32 [ 0, %57 ], [ 30, %34 ]
  call void @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  ret i32 %.0

68:                                               ; preds = %58, %60, %66, %48
  %.pn22.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %48 ], [ %.pn22, %66 ], [ %61, %60 ], [ %59, %58 ]
  call void @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  resume { ptr, i32 } %.pn22.pn.pn
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7hipsycl2rt5pcuda13pcuda_runtime6get_rtEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZN7hipsycl2rt7runtime8backendsEv(ptr noundef nonnull align 8 dereferenceable(608)) local_unnamed_addr #3 align 2

declare noundef ptr @_ZNK7hipsycl2rt15backend_manager3getENS0_10backend_idE(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) local_unnamed_addr #4

declare noundef i32 @_ZNK7hipsycl2rt9device_id11get_backendEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EEcvbEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

declare void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_15source_locationE10pcudaErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(68), i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7hipsycl2rt15source_locationC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_i(ptr noundef nonnull align 8 dereferenceable(68), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7hipsycl2rt15source_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(68)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7hipsycl2rt5pcuda6streamC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt10shared_ptrIN7hipsycl2rt16inorder_executorEEC2IS2_vEEPT_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN7hipsycl2rt16inorder_executorEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN7hipsycl2rt5pcuda6streamESaIS4_EE9push_backERKS4_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN7hipsycl2rt16backend_executorESt14default_deleteIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrIN7hipsycl2rt16inorder_executorELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass