; LLVM IR from AdaptiveCpp/AdaptiveCpp :: src/runtime/pcuda/pcuda_thread_state.ll (ZN7hipsycl2rt5pcuda18thread_local_stateD2Ev)

; 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.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.5" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.11" = 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.20" = type { i8 }
%"class.hipsycl::rt::pcuda::thread_local_state" = type { ptr, i32, i32, i32, %"class.std::vector", %"class.std::optional" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<std::vector<hipsycl::rt::pcuda::thread_local_state::per_device_data>>, std::allocator<std::vector<std::vector<hipsycl::rt::pcuda::thread_local_state::per_device_data>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<std::vector<hipsycl::rt::pcuda::thread_local_state::per_device_data>>, std::allocator<std::vector<std::vector<hipsycl::rt::pcuda::thread_local_state::per_device_data>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<std::vector<hipsycl::rt::pcuda::thread_local_state::per_device_data>>, std::allocator<std::vector<std::vector<hipsycl::rt::pcuda::thread_local_state::per_device_data>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<std::vector<hipsycl::rt::pcuda::thread_local_state::per_device_data>>, std::allocator<std::vector<std::vector<hipsycl::rt::pcuda::thread_local_state::per_device_data>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload_base.base", [7 x i8] }
%"struct.std::_Optional_payload_base.base" = type <{ %"union.std::_Optional_payload_base<hipsycl::rt::pcuda::thread_local_state::kernel_call_configuration>::_Storage", i8 }>
%"union.std::_Optional_payload_base<hipsycl::rt::pcuda::thread_local_state::kernel_call_configuration>::_Storage" = type { %"struct.hipsycl::rt::pcuda::thread_local_state::kernel_call_configuration" }
%"struct.hipsycl::rt::pcuda::thread_local_state::kernel_call_configuration" = type { %struct.dim3, %struct.dim3, i64, ptr }
%struct.dim3 = type { i32, i32, i32 }
%"struct.hipsycl::rt::pcuda::thread_local_state::per_device_data" = type { %"class.std::optional.12" }
%"class.std::optional.12" = type { %"struct.std::_Optional_base.13" }
%"struct.std::_Optional_base.13" = type { %"struct.std::_Optional_payload.15" }
%"struct.std::_Optional_payload.15" = type { %"struct.std::_Optional_payload_base.base.17", [7 x i8] }
%"struct.std::_Optional_payload_base.base.17" = type <{ %"union.std::_Optional_payload_base<hipsycl::rt::pcuda::stream *>::_Storage", i8 }>
%"union.std::_Optional_payload_base<hipsycl::rt::pcuda::stream *>::_Storage" = type { ptr }

@__func__._ZN7hipsycl2rt5pcuda18thread_local_stateD2Ev = external hidden unnamed_addr constant [20 x i8], align 1
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7hipsycl2rt5pcuda18thread_local_stateD2Ev(ptr noundef nonnull align 8 dereferenceable(96) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator.11", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator.11", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.hipsycl::rt::source_location", align 8
  %18 = alloca %"class.std::__cxx11::basic_string", align 8
  %19 = alloca %"class.std::allocator.20", align 1
  %20 = alloca %"class.std::__cxx11::basic_string", align 8
  %21 = alloca %"class.std::allocator.20", align 1
  %22 = alloca %"class.std::__cxx11::basic_string", align 8
  %23 = alloca %"class.std::allocator.20", align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %24 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %25 = getelementptr inbounds %"class.hipsycl::rt::pcuda::thread_local_state", ptr %24, i32 0, i32 4
  store ptr %25, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = call ptr @_ZNSt6vectorIS_IS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EESaIS8_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  %28 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %4, i32 0, i32 0
  store ptr %27, ptr %28, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = call ptr @_ZNSt6vectorIS_IS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EESaIS8_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #6
  %31 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  store ptr %30, ptr %31, align 8
  br label %32

32:                                               ; preds = %91, %1
  %33 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt6vectorIS1_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EESaIS8_EES1_ISA_SaISA_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %33, label %35, label %34

34:                                               ; preds = %32
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %93

35:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %36 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt6vectorIS1_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EESaIS8_EES1_ISA_SaISA_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  store ptr %36, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %37, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = call ptr @_ZNSt6vectorIS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #6
  %40 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %9, i32 0, i32 0
  store ptr %39, ptr %40, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = call ptr @_ZNSt6vectorIS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #6
  %43 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %10, i32 0, i32 0
  store ptr %42, ptr %43, align 8
  br label %44

44:                                               ; preds = %88, %35
  %45 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EES1_IS8_SaIS8_EEEEbRKNS_17__normal_iteratorIT_T0_EESH_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  br i1 %45, label %47, label %46

46:                                               ; preds = %44
  store i32 4, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %90

47:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EES1_IS8_SaIS8_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  store ptr %48, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %49, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = call ptr @_ZNSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %50) #6
  %52 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.11", ptr %13, i32 0, i32 0
  store ptr %51, ptr %52, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %53 = load ptr, ptr %12, align 8, !tbaa !5
  %54 = call ptr @_ZNSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #6
  %55 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.11", ptr %14, i32 0, i32 0
  store ptr %54, ptr %55, align 8
  br label %56

56:                                               ; preds = %85, %47
  %57 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESt6vectorIS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  br i1 %57, label %59, label %58

58:                                               ; preds = %56
  store i32 6, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %87

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESt6vectorIS5_SaIS5_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  store ptr %60, ptr %15, align 8, !tbaa !5
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.hipsycl::rt::pcuda::thread_local_state::per_device_data", ptr %61, i32 0, i32 0
  %63 = call noundef zeroext i1 @_ZNKSt8optionalIPN7hipsycl2rt5pcuda6streamEE9has_valueEv(ptr noundef nonnull align 8 dereferenceable(16) %62) #6
  br i1 %63, label %64, label %84

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %65 = load ptr, ptr %15, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.hipsycl::rt::pcuda::thread_local_state::per_device_data", ptr %65, i32 0, i32 0
  %67 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNRSt8optionalIPN7hipsycl2rt5pcuda6streamEE5valueEv(ptr noundef nonnull align 8 dereferenceable(16) %66)
          to label %68 unwind label %95

68:                                               ; preds = %64
  %69 = load ptr, ptr %67, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.hipsycl::rt::pcuda::thread_local_state", ptr %24, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !9
  %72 = invoke noundef i32 @_ZN7hipsycl2rt5pcuda6stream7destroyEPS2_PNS1_13pcuda_runtimeE(ptr noundef %69, ptr noundef %71)
          to label %73 unwind label %95

73:                                               ; preds = %68
  store i32 %72, ptr %16, align 4, !tbaa !21
  %74 = load i32, ptr %16, align 4, !tbaa !21
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %83

76:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 72, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %19) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %18, ptr noundef @__func__._ZN7hipsycl2rt5pcuda18thread_local_stateD2Ev, ptr noundef nonnull align 1 dereferenceable(1) %19)
          to label %77 unwind label %95

77:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef @.str, ptr noundef nonnull align 1 dereferenceable(1) %21)
          to label %78 unwind label %95

78:                                               ; preds = %77
  invoke void @_ZN7hipsycl2rt15source_locationC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_i(ptr noundef nonnull align 8 dereferenceable(68) %17, ptr noundef nonnull align 8 dereferenceable(32) %18, ptr noundef nonnull align 8 dereferenceable(32) %20, i32 noundef 34)
          to label %79 unwind label %95

79:                                               ; preds = %78
  %80 = load i32, ptr %16, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 32, ptr %22) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %23) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %22, ptr noundef @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %23)
          to label %81 unwind label %95

81:                                               ; preds = %79
  invoke void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_15source_locationE10pcudaErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(68) %17, i32 noundef %80, ptr noundef nonnull align 8 dereferenceable(32) %22)
          to label %82 unwind label %95

82:                                               ; preds = %81
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %23) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #6
  call void @_ZN7hipsycl2rt15source_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(68) %17) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %19) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 72, ptr %17) #6
  br label %83

83:                                               ; preds = %82, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %84

84:                                               ; preds = %83, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %85

85:                                               ; preds = %84
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESt6vectorIS5_SaIS5_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  br label %56

87:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %88

88:                                               ; preds = %87
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EES1_IS8_SaIS8_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  br label %44

90:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %91

91:                                               ; preds = %90
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt6vectorIS1_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EESaIS8_EES1_ISA_SaISA_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  br label %32

93:                                               ; preds = %34
  %94 = getelementptr inbounds %"class.hipsycl::rt::pcuda::thread_local_state", ptr %24, i32 0, i32 4
  call void @_ZNSt6vectorIS_IS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EESaIS8_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %94) #6
  ret void

95:                                               ; preds = %81, %79, %78, %77, %76, %68, %64
  %96 = landingpad { ptr, i32 }
          catch ptr null
  %97 = extractvalue { ptr, i32 } %96, 0
  call void @__clang_call_terminate(ptr %97) #7
  unreachable
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

declare noundef i32 @_ZN7hipsycl2rt5pcuda6stream7destroyEPS2_PNS1_13pcuda_runtimeE(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNRSt8optionalIPN7hipsycl2rt5pcuda6streamEE5valueEv(ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #5

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)) #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #4 align 2

; 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 #4 align 2

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

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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { 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 #5 = { noinline noreturn nounwind uwtable "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 = { nounwind }
attributes #7 = { noreturn nounwind }

!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, !6, i64 0}
!10 = !{!"_ZTSN7hipsycl2rt5pcuda18thread_local_stateE", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 24, !16, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSSt6vectorIS_IS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EESaIS8_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseISt6vectorIS0_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS5_EESaIS7_EESaIS9_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseISt6vectorIS0_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS5_EESaIS7_EESaIS9_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseISt6vectorIS0_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS5_EESaIS7_EESaIS9_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"_ZTSSt8optionalIN7hipsycl2rt5pcuda18thread_local_state25kernel_call_configurationEE", !17, i64 0}
!17 = !{!"_ZTSSt14_Optional_baseIN7hipsycl2rt5pcuda18thread_local_state25kernel_call_configurationELb1ELb1EE", !18, i64 0}
!18 = !{!"_ZTSSt17_Optional_payloadIN7hipsycl2rt5pcuda18thread_local_state25kernel_call_configurationELb1ELb1ELb1EE", !19, i64 0}
!19 = !{!"_ZTSSt22_Optional_payload_baseIN7hipsycl2rt5pcuda18thread_local_state25kernel_call_configurationEE", !7, i64 0, !20, i64 40}
!20 = !{!"bool", !7, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"_ZTS10pcudaError", !7, 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.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.5" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.11" = 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.20" = type { i8 }

@__func__._ZN7hipsycl2rt5pcuda18thread_local_stateD2Ev = external hidden unnamed_addr constant [20 x i8], align 1
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7hipsycl2rt5pcuda18thread_local_stateD2Ev(ptr noundef nonnull align 8 dereferenceable(96) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator.11", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.11", align 8
  %8 = alloca %"class.hipsycl::rt::source_location", align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.std::allocator.20", align 1
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca %"class.std::allocator.20", align 1
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  %14 = alloca %"class.std::allocator.20", align 1
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %16 = tail call ptr @_ZNSt6vectorIS_IS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EESaIS8_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #6
  store ptr %16, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %17 = tail call ptr @_ZNSt6vectorIS_IS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EESaIS8_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #6
  store ptr %17, ptr %3, align 8
  %18 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt6vectorIS1_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EESaIS8_EES1_ISA_SaISA_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br i1 %18, label %.lr.ph16, label %._crit_edge17

._crit_edge17:                                    ; preds = %._crit_edge14, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @_ZNSt6vectorIS_IS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EESaIS8_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #6
  ret void

.lr.ph16:                                         ; preds = %1, %._crit_edge14
  %19 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt6vectorIS1_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EESaIS8_EES1_ISA_SaISA_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %20 = call ptr @_ZNSt6vectorIS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  store ptr %20, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %21 = call ptr @_ZNSt6vectorIS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  store ptr %21, ptr %5, align 8
  %22 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EES1_IS8_SaIS8_EEEEbRKNS_17__normal_iteratorIT_T0_EESH_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %22, label %.lr.ph13, label %._crit_edge14

._crit_edge14:                                    ; preds = %._crit_edge, %.lr.ph16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt6vectorIS1_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EESaIS8_EES1_ISA_SaISA_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %24 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt6vectorIS1_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EESaIS8_EES1_ISA_SaISA_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br i1 %24, label %.lr.ph16, label %._crit_edge17

.lr.ph13:                                         ; preds = %.lr.ph16, %._crit_edge
  %25 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EES1_IS8_SaIS8_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %26 = call ptr @_ZNSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #6
  store ptr %26, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %27 = call ptr @_ZNSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #6
  store ptr %27, ptr %7, align 8
  %28 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESt6vectorIS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br i1 %28, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %46, %.lr.ph13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EES1_IS8_SaIS8_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %30 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt6vectorIN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS6_EES1_IS8_SaIS8_EEEEbRKNS_17__normal_iteratorIT_T0_EESH_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %30, label %.lr.ph13, label %._crit_edge14

.lr.ph:                                           ; preds = %.lr.ph13, %46
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESt6vectorIS5_SaIS5_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %32 = call noundef zeroext i1 @_ZNKSt8optionalIPN7hipsycl2rt5pcuda6streamEE9has_valueEv(ptr noundef nonnull align 8 dereferenceable(16) %31) #6
  br i1 %32, label %33, label %46

33:                                               ; preds = %.lr.ph
  %34 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNRSt8optionalIPN7hipsycl2rt5pcuda6streamEE5valueEv(ptr noundef nonnull align 8 dereferenceable(16) %31)
          to label %35 unwind label %49

35:                                               ; preds = %33
  %36 = load ptr, ptr %34, align 8, !tbaa !5
  %37 = load ptr, ptr %0, align 8, !tbaa !9
  %38 = invoke noundef i32 @_ZN7hipsycl2rt5pcuda6stream7destroyEPS2_PNS1_13pcuda_runtimeE(ptr noundef %36, ptr noundef %37)
          to label %39 unwind label %49

39:                                               ; preds = %35
  %.not = icmp eq i32 %38, 0
  br i1 %.not, label %46, label %40

40:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull @__func__._ZN7hipsycl2rt5pcuda18thread_local_stateD2Ev, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %41 unwind label %49

41:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %12) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull @.str, ptr noundef nonnull align 1 dereferenceable(1) %12)
          to label %42 unwind label %49

42:                                               ; preds = %41
  invoke void @_ZN7hipsycl2rt15source_locationC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_i(ptr noundef nonnull align 8 dereferenceable(68) %8, ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %11, i32 noundef 34)
          to label %43 unwind label %49

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %14) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %14)
          to label %44 unwind label %49

44:                                               ; preds = %43
  invoke void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_15source_locationE10pcudaErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(68) %8, i32 noundef %38, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %45 unwind label %49

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

46:                                               ; preds = %39, %45, %.lr.ph
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESt6vectorIS5_SaIS5_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %48 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESt6vectorIS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br i1 %48, label %.lr.ph, label %._crit_edge

49:                                               ; preds = %44, %43, %42, %41, %40, %35, %33
  %50 = landingpad { ptr, i32 }
          catch ptr null
  %51 = extractvalue { ptr, i32 } %50, 0
  call void @__clang_call_terminate(ptr %51) #7
  unreachable
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

declare noundef i32 @_ZN7hipsycl2rt5pcuda6stream7destroyEPS2_PNS1_13pcuda_runtimeE(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNRSt8optionalIPN7hipsycl2rt5pcuda6streamEE5valueEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #5

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 #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #4 align 2

; 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 #4 align 2

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

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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { 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 #5 = { noinline noreturn nounwind uwtable "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 = { nounwind }
attributes #7 = { noreturn nounwind }

!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, !6, i64 0}
!10 = !{!"_ZTSN7hipsycl2rt5pcuda18thread_local_stateE", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 24, !16, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSSt6vectorIS_IS_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS4_EESaIS6_EESaIS8_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseISt6vectorIS0_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS5_EESaIS7_EESaIS9_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseISt6vectorIS0_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS5_EESaIS7_EESaIS9_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseISt6vectorIS0_IN7hipsycl2rt5pcuda18thread_local_state15per_device_dataESaIS5_EESaIS7_EESaIS9_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"_ZTSSt8optionalIN7hipsycl2rt5pcuda18thread_local_state25kernel_call_configurationEE", !17, i64 0}
!17 = !{!"_ZTSSt14_Optional_baseIN7hipsycl2rt5pcuda18thread_local_state25kernel_call_configurationELb1ELb1EE", !18, i64 0}
!18 = !{!"_ZTSSt17_Optional_payloadIN7hipsycl2rt5pcuda18thread_local_state25kernel_call_configurationELb1ELb1ELb1EE", !19, i64 0}
!19 = !{!"_ZTSSt22_Optional_payload_baseIN7hipsycl2rt5pcuda18thread_local_state25kernel_call_configurationEE", !7, i64 0, !20, i64 40}
!20 = !{!"bool", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass