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

; 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.hipsycl::rt::device_id" = type { %"struct.hipsycl::rt::backend_descriptor", i32 }
%"struct.hipsycl::rt::backend_descriptor" = type { i32, i32, i32 }
%class.anon.139 = type { ptr, ptr }
%"class.hipsycl::rt::memory_location" = type { %"class.hipsycl::rt::device_id", %"class.hipsycl::rt::static_array", %"class.hipsycl::rt::static_array", i64, i8, ptr, %"class.std::shared_ptr.140" }
%"class.hipsycl::rt::static_array" = type { %"struct.std::array.68" }
%"struct.std::array.68" = type { [3 x i64] }
%"class.std::shared_ptr.140" = type { %"class.std::__shared_ptr.141" }
%"class.std::__shared_ptr.141" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.hipsycl::rt::static_array.143" = type { %"struct.std::array.144" }
%"struct.std::array.144" = type { [1 x i64] }
%"class.hipsycl::rt::memcpy_operation" = type { %"class.hipsycl::rt::operation", %"class.hipsycl::rt::memory_location", %"class.hipsycl::rt::memory_location", %"class.hipsycl::rt::static_array" }
%"class.hipsycl::rt::operation" = type { ptr, %"class.hipsycl::rt::instrumentation_set" }
%"class.hipsycl::rt::instrumentation_set" = type <{ %"class.std::vector.145", %"struct.std::atomic", [7 x i8] }>
%"class.std::vector.145" = type { %"struct.std::_Vector_base.146" }
%"struct.std::_Vector_base.146" = type { %"struct.std::_Vector_base<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>, std::allocator<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>, std::allocator<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>, std::allocator<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>, std::allocator<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i8 }
%"class.hipsycl::rt::result" = type { %"class.std::unique_ptr" }
%"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.67" }
%"struct.std::_Head_base.67" = type { ptr }
%"class.std::shared_ptr.150" = type { %"class.std::__shared_ptr.151" }
%"class.std::__shared_ptr.151" = type { ptr, %"class.std::__shared_count" }

@.str = external hidden unnamed_addr constant [97 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__.pcudaMemcpyAsync = external hidden unnamed_addr constant [112 x i8], align 1

; 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) #0

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

declare noundef nonnull align 8 dereferenceable(104) ptr @_ZN7hipsycl2rt5pcuda17pcuda_application3getEv() #2

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

declare noundef i32 @_ZN7hipsycl2rt5pcuda27get_most_recent_pcuda_errorEv() #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN7hipsycl2rt5pcuda12_GLOBAL__N_122queue_or_default_queueEPNS1_6streamE(ptr noundef) #3

declare noundef zeroext i1 @_ZNK7hipsycl2rt6result10is_successEv(ptr noundef nonnull align 8 dereferenceable(8)) #2

declare void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_6resultE10pcudaError(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

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

declare noundef nonnull align 8 dereferenceable(40) ptr @_ZN7hipsycl2rt5pcuda17pcuda_application8pcuda_rtEv(ptr noundef nonnull align 8 dereferenceable(104)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7hipsycl2rt5pcuda13pcuda_runtime6get_rtEv(ptr noundef nonnull align 8 dereferenceable(40)) #3 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)) #5 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local i32 @pcudaMemcpyAsync(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3, ptr noundef %4) #3 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %"class.hipsycl::rt::device_id", align 4
  %16 = alloca ptr, align 8
  %17 = alloca %"class.hipsycl::rt::device_id", align 4
  %18 = alloca %class.anon.139, align 8
  %19 = alloca %"class.hipsycl::rt::device_id", align 4
  %20 = alloca %"class.hipsycl::rt::device_id", align 4
  %21 = alloca %"class.hipsycl::rt::memory_location", align 8
  %22 = alloca %"class.hipsycl::rt::device_id", align 4
  %23 = alloca %"class.hipsycl::rt::static_array", align 8
  %24 = alloca %"class.hipsycl::rt::static_array", align 8
  %25 = alloca %"class.hipsycl::rt::static_array.143", align 8
  %26 = alloca %"class.hipsycl::rt::memory_location", align 8
  %27 = alloca %"class.hipsycl::rt::device_id", align 4
  %28 = alloca %"class.hipsycl::rt::static_array", align 8
  %29 = alloca %"class.hipsycl::rt::static_array", align 8
  %30 = alloca %"class.hipsycl::rt::static_array.143", align 8
  %31 = alloca ptr, align 8
  %32 = alloca i32, align 4
  %33 = alloca %"class.hipsycl::rt::memcpy_operation", align 8
  %34 = alloca %"class.hipsycl::rt::static_array", align 8
  %35 = alloca %"class.hipsycl::rt::static_array.143", align 8
  %36 = alloca %"class.hipsycl::rt::result", align 8
  %37 = alloca %"class.std::shared_ptr.150", align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !11
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %38 = call noundef i32 @_ZN7hipsycl2rt5pcuda27get_most_recent_pcuda_errorEv()
  store i32 %38, ptr %12, align 4, !tbaa !13
  %39 = load i32, ptr %12, align 4, !tbaa !13
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %43

41:                                               ; preds = %5
  %42 = load i32, ptr %12, align 4, !tbaa !13
  store i32 %42, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %152

43:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = call noundef ptr @_ZN7hipsycl2rt5pcuda12_GLOBAL__N_122queue_or_default_queueEPNS1_6streamE(ptr noundef %44)
  store ptr %45, ptr %14, align 8, !tbaa !5
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %49, label %48

48:                                               ; preds = %43
  store i32 38, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %151

49:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #9
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  %51 = load ptr, ptr %50, align 8, !tbaa !15
  %52 = getelementptr inbounds ptr, ptr %51, i64 9
  %53 = load ptr, ptr %52, align 8
  %54 = call { i64, i64 } %53(ptr noundef nonnull align 8 dereferenceable(8) %50)
  %55 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %56 = extractvalue { i64, i64 } %54, 0
  store i64 %56, ptr %55, align 4
  %57 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %58 = extractvalue { i64, i64 } %54, 1
  store i64 %58, ptr %57, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %59 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZN7hipsycl2rt5pcuda17pcuda_application3getEv()
  %60 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN7hipsycl2rt5pcuda17pcuda_application8pcuda_rtEv(ptr noundef nonnull align 8 dereferenceable(104) %59)
  %61 = call noundef ptr @_ZNK7hipsycl2rt5pcuda13pcuda_runtime6get_rtEv(ptr noundef nonnull align 8 dereferenceable(40) %60)
  %62 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZN7hipsycl2rt7runtime8backendsEv(ptr noundef nonnull align 8 dereferenceable(608) %61)
  %63 = call noundef i32 @_ZNK7hipsycl2rt9device_id11get_backendEv(ptr noundef nonnull align 4 dereferenceable(16) %15)
  %64 = call noundef ptr @_ZNK7hipsycl2rt15backend_manager3getENS0_10backend_idE(ptr noundef nonnull align 8 dereferenceable(72) %62, i32 noundef %63)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %15, i64 16, i1 false), !tbaa.struct !17
  %65 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 0
  %66 = load i64, ptr %65, align 4
  %67 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 1
  %68 = load i64, ptr %67, align 4
  %69 = load ptr, ptr %64, align 8, !tbaa !15
  %70 = getelementptr inbounds ptr, ptr %69, i64 5
  %71 = load ptr, ptr %70, align 8
  %72 = call noundef ptr %71(ptr noundef nonnull align 8 dereferenceable(8) %64, i64 %66, i64 %68)
  store ptr %72, ptr %16, align 8, !tbaa !5
  %73 = load ptr, ptr %16, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %76

75:                                               ; preds = %49
  br label %78

76:                                               ; preds = %49
  call void @__assert_fail(ptr noundef @.str.62, ptr noundef @.str, i32 noundef 683, ptr noundef @__PRETTY_FUNCTION__.pcudaMemcpyAsync) #10
  unreachable

77:                                               ; No predecessors!
  br label %78

78:                                               ; preds = %77, %75
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #9
  %79 = getelementptr inbounds %class.anon.139, ptr %18, i32 0, i32 0
  store ptr %16, ptr %79, align 8, !tbaa !5
  %80 = getelementptr inbounds %class.anon.139, ptr %18, i32 0, i32 1
  store ptr %15, ptr %80, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #9
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = call { i64, i64 } @"_ZZ16pcudaMemcpyAsyncENK3$_0clEPKv"(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef %81)
  %83 = getelementptr inbounds { i64, i64 }, ptr %19, i32 0, i32 0
  %84 = extractvalue { i64, i64 } %82, 0
  store i64 %84, ptr %83, align 4
  %85 = getelementptr inbounds { i64, i64 }, ptr %19, i32 0, i32 1
  %86 = extractvalue { i64, i64 } %82, 1
  store i64 %86, ptr %85, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #9
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = call { i64, i64 } @"_ZZ16pcudaMemcpyAsyncENK3$_0clEPKv"(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef %87)
  %89 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 0
  %90 = extractvalue { i64, i64 } %88, 0
  store i64 %90, ptr %89, align 4
  %91 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 1
  %92 = extractvalue { i64, i64 } %88, 1
  store i64 %92, ptr %91, align 4
  call void @llvm.lifetime.start.p0(i64 104, ptr %21) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %19, i64 16, i1 false), !tbaa.struct !17
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %23, i8 0, i64 24, i1 false)
  %94 = load i64, ptr %9, align 8, !tbaa !9
  call void @_ZN7hipsycl2rt12static_arrayILi1EEC2Em(ptr noundef nonnull align 8 dereferenceable(8) %25, i64 noundef %94)
  %95 = getelementptr inbounds %"class.hipsycl::rt::static_array.143", ptr %25, i32 0, i32 0
  %96 = getelementptr inbounds %"struct.std::array.144", ptr %95, i32 0, i32 0
  %97 = load i64, ptr %96, align 8
  call void @_ZN7hipsycl2rt15embed_in_range3ILi1EEENS0_12static_arrayILi3EEENS2_IXT_EEE(ptr dead_on_unwind writable sret(%"class.hipsycl::rt::static_array") align 8 %24, i64 %97)
  %98 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 0
  %99 = load i64, ptr %98, align 4
  %100 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 1
  %101 = load i64, ptr %100, align 4
  call void @_ZN7hipsycl2rt15memory_locationC1ENS0_9device_idEPvNS0_12static_arrayILi3EEES5_m(ptr noundef nonnull align 8 dereferenceable(104) %21, i64 %99, i64 %101, ptr noundef %93, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8 %23, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8 %24, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 104, ptr %26) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %20, i64 16, i1 false), !tbaa.struct !17
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %28, i8 0, i64 24, i1 false)
  %103 = load i64, ptr %9, align 8, !tbaa !9
  invoke void @_ZN7hipsycl2rt12static_arrayILi1EEC2Em(ptr noundef nonnull align 8 dereferenceable(8) %30, i64 noundef %103)
          to label %104 unwind label %130

104:                                              ; preds = %78
  %105 = getelementptr inbounds %"class.hipsycl::rt::static_array.143", ptr %30, i32 0, i32 0
  %106 = getelementptr inbounds %"struct.std::array.144", ptr %105, i32 0, i32 0
  %107 = load i64, ptr %106, align 8
  invoke void @_ZN7hipsycl2rt15embed_in_range3ILi1EEENS0_12static_arrayILi3EEENS2_IXT_EEE(ptr dead_on_unwind writable sret(%"class.hipsycl::rt::static_array") align 8 %29, i64 %107)
          to label %108 unwind label %130

108:                                              ; preds = %104
  %109 = getelementptr inbounds { i64, i64 }, ptr %27, i32 0, i32 0
  %110 = load i64, ptr %109, align 4
  %111 = getelementptr inbounds { i64, i64 }, ptr %27, i32 0, i32 1
  %112 = load i64, ptr %111, align 4
  invoke void @_ZN7hipsycl2rt15memory_locationC1ENS0_9device_idEPvNS0_12static_arrayILi3EEES5_m(ptr noundef nonnull align 8 dereferenceable(104) %26, i64 %110, i64 %112, ptr noundef %102, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8 %28, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8 %29, i64 noundef 1)
          to label %113 unwind label %130

113:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 272, ptr %33) #9
  %114 = load i64, ptr %9, align 8, !tbaa !9
  invoke void @_ZN7hipsycl2rt12static_arrayILi1EEC2Em(ptr noundef nonnull align 8 dereferenceable(8) %35, i64 noundef %114)
          to label %115 unwind label %134

115:                                              ; preds = %113
  %116 = getelementptr inbounds %"class.hipsycl::rt::static_array.143", ptr %35, i32 0, i32 0
  %117 = getelementptr inbounds %"struct.std::array.144", ptr %116, i32 0, i32 0
  %118 = load i64, ptr %117, align 8
  invoke void @_ZN7hipsycl2rt15embed_in_range3ILi1EEENS0_12static_arrayILi3EEENS2_IXT_EEE(ptr dead_on_unwind writable sret(%"class.hipsycl::rt::static_array") align 8 %34, i64 %118)
          to label %119 unwind label %134

119:                                              ; preds = %115
  invoke void @_ZN7hipsycl2rt16memcpy_operationC1ERKNS0_15memory_locationES4_NS0_12static_arrayILi3EEE(ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef nonnull align 8 dereferenceable(104) %21, ptr noundef nonnull align 8 dereferenceable(104) %26, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8 %34)
          to label %120 unwind label %134

120:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #9
  %121 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %37) #9
  call void @_ZNSt10shared_ptrIN7hipsycl2rt8dag_nodeEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr null) #9
  %122 = load ptr, ptr %121, align 8, !tbaa !15
  %123 = getelementptr inbounds ptr, ptr %122, i64 2
  %124 = load ptr, ptr %123, align 8
  invoke void %124(ptr dead_on_unwind writable sret(%"class.hipsycl::rt::result") align 8 %36, ptr noundef nonnull align 8 dereferenceable(8) %121, ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef nonnull align 8 dereferenceable(16) %37)
          to label %125 unwind label %138

125:                                              ; preds = %120
  call void @_ZNSt12__shared_ptrIN7hipsycl2rt8dag_nodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %37) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %37) #9
  %126 = invoke noundef zeroext i1 @_ZNK7hipsycl2rt6result10is_successEv(ptr noundef nonnull align 8 dereferenceable(8) %36)
          to label %127 unwind label %142

127:                                              ; preds = %125
  br i1 %126, label %146, label %128

128:                                              ; preds = %127
  invoke void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_6resultE10pcudaError(ptr noundef nonnull align 8 dereferenceable(8) %36, i32 noundef 30)
          to label %129 unwind label %142

129:                                              ; preds = %128
  store i32 30, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %147

130:                                              ; preds = %108, %104, %78
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %31, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %32, align 4
  br label %150

134:                                              ; preds = %119, %115, %113
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %31, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %32, align 4
  br label %149

138:                                              ; preds = %120
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %31, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %32, align 4
  call void @_ZNSt12__shared_ptrIN7hipsycl2rt8dag_nodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %37) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %37) #9
  br label %148

142:                                              ; preds = %128, %125
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %31, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %32, align 4
  call void @_ZN7hipsycl2rt6resultD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %36) #9
  br label %148

146:                                              ; preds = %127
  store i32 0, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %147

147:                                              ; preds = %146, %129
  call void @_ZN7hipsycl2rt6resultD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %36) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #9
  call void @_ZN7hipsycl2rt16memcpy_operationD2Ev(ptr noundef nonnull align 8 dereferenceable(272) %33) #9
  call void @llvm.lifetime.end.p0(i64 272, ptr %33) #9
  call void @_ZN7hipsycl2rt15memory_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %26) #9
  call void @llvm.lifetime.end.p0(i64 104, ptr %26) #9
  call void @_ZN7hipsycl2rt15memory_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %21) #9
  call void @llvm.lifetime.end.p0(i64 104, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #9
  br label %151

148:                                              ; preds = %142, %138
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #9
  call void @_ZN7hipsycl2rt16memcpy_operationD2Ev(ptr noundef nonnull align 8 dereferenceable(272) %33) #9
  br label %149

149:                                              ; preds = %148, %134
  call void @llvm.lifetime.end.p0(i64 272, ptr %33) #9
  call void @_ZN7hipsycl2rt15memory_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %26) #9
  br label %150

150:                                              ; preds = %149, %130
  call void @llvm.lifetime.end.p0(i64 104, ptr %26) #9
  call void @_ZN7hipsycl2rt15memory_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %21) #9
  call void @llvm.lifetime.end.p0(i64 104, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %154

151:                                              ; preds = %147, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %152

152:                                              ; preds = %151, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  %153 = load i32, ptr %6, align 4
  ret i32 %153

154:                                              ; preds = %150
  %155 = load ptr, ptr %31, align 8
  %156 = load i32, ptr %32, align 4
  %157 = insertvalue { ptr, i32 } poison, ptr %155, 0
  %158 = insertvalue { ptr, i32 } %157, i32 %156, 1
  resume { ptr, i32 } %158
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { i64, i64 } @"_ZZ16pcudaMemcpyAsyncENK3$_0clEPKv"(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #7 align 2

; 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: mustprogress uwtable
declare dso_local void @_ZN7hipsycl2rt15embed_in_range3ILi1EEENS0_12static_arrayILi3EEENS2_IXT_EEE(ptr dead_on_unwind noalias writable sret(%"class.hipsycl::rt::static_array") align 8, i64) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7hipsycl2rt12static_arrayILi1EEC2Em(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) unnamed_addr #5 align 2

declare void @_ZN7hipsycl2rt15memory_locationC1ENS0_9device_idEPvNS0_12static_arrayILi3EEES5_m(ptr noundef nonnull align 8 dereferenceable(104), i64, i64, ptr noundef, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8, i64 noundef) unnamed_addr #2

declare void @_ZN7hipsycl2rt16memcpy_operationC1ERKNS0_15memory_locationES4_NS0_12static_arrayILi3EEE(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(104), ptr noundef nonnull align 8 dereferenceable(104), ptr noundef byval(%"class.hipsycl::rt::static_array") align 8) unnamed_addr #2

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

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

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

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 #4 = { 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 #5 = { 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 = { 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 #7 = { inlinehint 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind }
attributes #10 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS15pcudaMemcpyKind", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTS10pcudaError", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{i64 0, i64 4, !18, i64 4, i64 4, !20, i64 8, i64 4, !22, i64 12, i64 4, !24}
!18 = !{!19, !19, i64 0}
!19 = !{!"_ZTSN7hipsycl2rt10backend_idE", !7, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"_ZTSN7hipsycl2rt17hardware_platformE", !7, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"_ZTSN7hipsycl2rt12api_platformE", !7, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"int", !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.hipsycl::rt::device_id" = type { %"struct.hipsycl::rt::backend_descriptor", i32 }
%"struct.hipsycl::rt::backend_descriptor" = type { i32, i32, i32 }
%class.anon.139 = type { ptr, ptr }
%"class.hipsycl::rt::memory_location" = type { %"class.hipsycl::rt::device_id", %"class.hipsycl::rt::static_array", %"class.hipsycl::rt::static_array", i64, i8, ptr, %"class.std::shared_ptr.140" }
%"class.hipsycl::rt::static_array" = type { %"struct.std::array.68" }
%"struct.std::array.68" = type { [3 x i64] }
%"class.std::shared_ptr.140" = type { %"class.std::__shared_ptr.141" }
%"class.std::__shared_ptr.141" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.hipsycl::rt::static_array.143" = type { %"struct.std::array.144" }
%"struct.std::array.144" = type { [1 x i64] }
%"class.hipsycl::rt::memcpy_operation" = type { %"class.hipsycl::rt::operation", %"class.hipsycl::rt::memory_location", %"class.hipsycl::rt::memory_location", %"class.hipsycl::rt::static_array" }
%"class.hipsycl::rt::operation" = type { ptr, %"class.hipsycl::rt::instrumentation_set" }
%"class.hipsycl::rt::instrumentation_set" = type <{ %"class.std::vector.145", %"struct.std::atomic", [7 x i8] }>
%"class.std::vector.145" = type { %"struct.std::_Vector_base.146" }
%"struct.std::_Vector_base.146" = type { %"struct.std::_Vector_base<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>, std::allocator<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>, std::allocator<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>, std::allocator<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>, std::allocator<std::pair<std::type_index, std::shared_ptr<hipsycl::rt::instrumentation>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i8 }
%"class.hipsycl::rt::result" = type { %"class.std::unique_ptr" }
%"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.67" }
%"struct.std::_Head_base.67" = type { ptr }
%"class.std::shared_ptr.150" = type { %"class.std::__shared_ptr.151" }
%"class.std::__shared_ptr.151" = type { ptr, %"class.std::__shared_count" }

@.str = external hidden unnamed_addr constant [97 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__.pcudaMemcpyAsync = external hidden unnamed_addr constant [112 x i8], align 1

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

declare noundef nonnull align 8 dereferenceable(104) ptr @_ZN7hipsycl2rt5pcuda17pcuda_application3getEv() local_unnamed_addr #1

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

declare noundef i32 @_ZN7hipsycl2rt5pcuda27get_most_recent_pcuda_errorEv() local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN7hipsycl2rt5pcuda12_GLOBAL__N_122queue_or_default_queueEPNS1_6streamE(ptr noundef) local_unnamed_addr #2

declare noundef zeroext i1 @_ZNK7hipsycl2rt6result10is_successEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

declare void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_6resultE10pcudaError(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

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

declare noundef nonnull align 8 dereferenceable(40) ptr @_ZN7hipsycl2rt5pcuda17pcuda_application8pcuda_rtEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7hipsycl2rt5pcuda13pcuda_runtime6get_rtEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 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 #4 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @pcudaMemcpyAsync(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3, ptr noundef %4) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.hipsycl::rt::device_id", align 8
  %7 = alloca ptr, align 8
  %8 = alloca %class.anon.139, align 8
  %9 = alloca %"class.hipsycl::rt::memory_location", align 8
  %10 = alloca %"class.hipsycl::rt::static_array", align 8
  %11 = alloca %"class.hipsycl::rt::static_array", align 8
  %12 = alloca %"class.hipsycl::rt::static_array.143", align 8
  %13 = alloca %"class.hipsycl::rt::memory_location", align 8
  %14 = alloca %"class.hipsycl::rt::static_array", align 8
  %15 = alloca %"class.hipsycl::rt::static_array", align 8
  %16 = alloca %"class.hipsycl::rt::static_array.143", align 8
  %17 = alloca %"class.hipsycl::rt::memcpy_operation", align 8
  %18 = alloca %"class.hipsycl::rt::static_array", align 8
  %19 = alloca %"class.hipsycl::rt::static_array.143", align 8
  %20 = alloca %"class.hipsycl::rt::result", align 8
  %21 = alloca %"class.std::shared_ptr.150", align 8
  %22 = tail call noundef i32 @_ZN7hipsycl2rt5pcuda27get_most_recent_pcuda_errorEv()
  %.not = icmp eq i32 %22, 0
  br i1 %.not, label %23, label %78

23:                                               ; preds = %5
  %24 = tail call noundef ptr @_ZN7hipsycl2rt5pcuda12_GLOBAL__N_122queue_or_default_queueEPNS1_6streamE(ptr noundef %4)
  %.not30 = icmp eq ptr %24, null
  br i1 %.not30, label %78, label %25

25:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  %26 = load ptr, ptr %24, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 72
  %28 = load ptr, ptr %27, align 8
  %29 = tail call { i64, i64 } %28(ptr noundef nonnull align 8 dereferenceable(8) %24)
  %30 = extractvalue { i64, i64 } %29, 0
  store i64 %30, ptr %6, align 8
  %31 = getelementptr inbounds i8, ptr %6, i64 8
  %32 = extractvalue { i64, i64 } %29, 1
  store i64 %32, ptr %31, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %33 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZN7hipsycl2rt5pcuda17pcuda_application3getEv()
  %34 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZN7hipsycl2rt5pcuda17pcuda_application8pcuda_rtEv(ptr noundef nonnull align 8 dereferenceable(104) %33)
  %35 = tail call noundef ptr @_ZNK7hipsycl2rt5pcuda13pcuda_runtime6get_rtEv(ptr noundef nonnull align 8 dereferenceable(40) %34)
  %36 = tail call noundef nonnull align 8 dereferenceable(72) ptr @_ZN7hipsycl2rt7runtime8backendsEv(ptr noundef nonnull align 8 dereferenceable(608) %35)
  %37 = call noundef i32 @_ZNK7hipsycl2rt9device_id11get_backendEv(ptr noundef nonnull align 4 dereferenceable(16) %6)
  %38 = call noundef ptr @_ZNK7hipsycl2rt15backend_manager3getENS0_10backend_idE(ptr noundef nonnull align 8 dereferenceable(72) %36, i32 noundef %37)
  %.sroa.06.0.copyload = load i64, ptr %6, align 8
  %.sroa.27.0.copyload = load i64, ptr %31, align 8
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 40
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef ptr %41(ptr noundef nonnull align 8 dereferenceable(8) %38, i64 %.sroa.06.0.copyload, i64 %.sroa.27.0.copyload)
  store ptr %42, ptr %7, align 8, !tbaa !8
  %.not31 = icmp eq ptr %42, null
  br i1 %.not31, label %43, label %44

43:                                               ; preds = %25
  call void @__assert_fail(ptr noundef nonnull @.str.62, ptr noundef nonnull @.str, i32 noundef 683, ptr noundef nonnull @__PRETTY_FUNCTION__.pcudaMemcpyAsync) #9
  unreachable

44:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #8
  store ptr %7, ptr %8, align 8, !tbaa !8
  %45 = getelementptr inbounds i8, ptr %8, i64 8
  store ptr %6, ptr %45, align 8, !tbaa !8
  %46 = call { i64, i64 } @"_ZZ16pcudaMemcpyAsyncENK3$_0clEPKv"(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef %1)
  %47 = extractvalue { i64, i64 } %46, 0
  %48 = extractvalue { i64, i64 } %46, 1
  %49 = call { i64, i64 } @"_ZZ16pcudaMemcpyAsyncENK3$_0clEPKv"(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef %0)
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %9) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %10, i8 0, i64 24, i1 false)
  call void @_ZN7hipsycl2rt12static_arrayILi1EEC2Em(ptr noundef nonnull align 8 dereferenceable(8) %12, i64 noundef %2)
  %50 = load i64, ptr %12, align 8
  call void @_ZN7hipsycl2rt15embed_in_range3ILi1EEENS0_12static_arrayILi3EEENS2_IXT_EEE(ptr dead_on_unwind nonnull writable sret(%"class.hipsycl::rt::static_array") align 8 %11, i64 %50)
  call void @_ZN7hipsycl2rt15memory_locationC1ENS0_9device_idEPvNS0_12static_arrayILi3EEES5_m(ptr noundef nonnull align 8 dereferenceable(104) %9, i64 %47, i64 %48, ptr noundef %1, ptr noundef nonnull byval(%"class.hipsycl::rt::static_array") align 8 %10, ptr noundef nonnull byval(%"class.hipsycl::rt::static_array") align 8 %11, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %13) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %14, i8 0, i64 24, i1 false)
  call void @_ZN7hipsycl2rt12static_arrayILi1EEC2Em(ptr noundef nonnull align 8 dereferenceable(8) %16, i64 noundef %2)
  %51 = load i64, ptr %16, align 8
  invoke void @_ZN7hipsycl2rt15embed_in_range3ILi1EEENS0_12static_arrayILi3EEENS2_IXT_EEE(ptr dead_on_unwind nonnull writable sret(%"class.hipsycl::rt::static_array") align 8 %15, i64 %51)
          to label %52 unwind label %66

52:                                               ; preds = %44
  %53 = extractvalue { i64, i64 } %49, 1
  %54 = extractvalue { i64, i64 } %49, 0
  invoke void @_ZN7hipsycl2rt15memory_locationC1ENS0_9device_idEPvNS0_12static_arrayILi3EEES5_m(ptr noundef nonnull align 8 dereferenceable(104) %13, i64 %54, i64 %53, ptr noundef %0, ptr noundef nonnull byval(%"class.hipsycl::rt::static_array") align 8 %14, ptr noundef nonnull byval(%"class.hipsycl::rt::static_array") align 8 %15, i64 noundef 1)
          to label %55 unwind label %66

55:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 272, ptr nonnull %17) #8
  call void @_ZN7hipsycl2rt12static_arrayILi1EEC2Em(ptr noundef nonnull align 8 dereferenceable(8) %19, i64 noundef %2)
  %56 = load i64, ptr %19, align 8
  invoke void @_ZN7hipsycl2rt15embed_in_range3ILi1EEENS0_12static_arrayILi3EEENS2_IXT_EEE(ptr dead_on_unwind nonnull writable sret(%"class.hipsycl::rt::static_array") align 8 %18, i64 %56)
          to label %57 unwind label %68

57:                                               ; preds = %55
  invoke void @_ZN7hipsycl2rt16memcpy_operationC1ERKNS0_15memory_locationES4_NS0_12static_arrayILi3EEE(ptr noundef nonnull align 8 dereferenceable(272) %17, ptr noundef nonnull align 8 dereferenceable(104) %9, ptr noundef nonnull align 8 dereferenceable(104) %13, ptr noundef nonnull byval(%"class.hipsycl::rt::static_array") align 8 %18)
          to label %58 unwind label %68

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %21) #8
  call void @_ZNSt10shared_ptrIN7hipsycl2rt8dag_nodeEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr null) #8
  %59 = load ptr, ptr %24, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 16
  %61 = load ptr, ptr %60, align 8
  invoke void %61(ptr dead_on_unwind nonnull writable sret(%"class.hipsycl::rt::result") align 8 %20, ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(272) %17, ptr noundef nonnull align 8 dereferenceable(16) %21)
          to label %62 unwind label %70

62:                                               ; preds = %58
  call void @_ZNSt12__shared_ptrIN7hipsycl2rt8dag_nodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %21) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %21) #8
  %63 = invoke noundef zeroext i1 @_ZNK7hipsycl2rt6result10is_successEv(ptr noundef nonnull align 8 dereferenceable(8) %20)
          to label %64 unwind label %72

64:                                               ; preds = %62
  br i1 %63, label %74, label %65

65:                                               ; preds = %64
  invoke void @_ZN7hipsycl2rt5pcuda20register_pcuda_errorERKNS0_6resultE10pcudaError(ptr noundef nonnull align 8 dereferenceable(8) %20, i32 noundef 30)
          to label %74 unwind label %72

66:                                               ; preds = %52, %44
  %67 = landingpad { ptr, i32 }
          cleanup
  br label %77

68:                                               ; preds = %57, %55
  %69 = landingpad { ptr, i32 }
          cleanup
  br label %76

70:                                               ; preds = %58
  %71 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt12__shared_ptrIN7hipsycl2rt8dag_nodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %21) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %21) #8
  br label %75

72:                                               ; preds = %65, %62
  %73 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7hipsycl2rt6resultD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  br label %75

74:                                               ; preds = %64, %65
  %.025 = phi i32 [ 30, %65 ], [ 0, %64 ]
  call void @_ZN7hipsycl2rt6resultD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #8
  call void @_ZN7hipsycl2rt16memcpy_operationD2Ev(ptr noundef nonnull align 8 dereferenceable(272) %17) #8
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %17) #8
  call void @_ZN7hipsycl2rt15memory_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %13) #8
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %13) #8
  call void @_ZN7hipsycl2rt15memory_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %9) #8
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  br label %78

75:                                               ; preds = %72, %70
  %.pn = phi { ptr, i32 } [ %73, %72 ], [ %71, %70 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #8
  call void @_ZN7hipsycl2rt16memcpy_operationD2Ev(ptr noundef nonnull align 8 dereferenceable(272) %17) #8
  br label %76

76:                                               ; preds = %75, %68
  %.pn.pn = phi { ptr, i32 } [ %.pn, %75 ], [ %69, %68 ]
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %17) #8
  call void @_ZN7hipsycl2rt15memory_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %13) #8
  br label %77

77:                                               ; preds = %76, %66
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %76 ], [ %67, %66 ]
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %13) #8
  call void @_ZN7hipsycl2rt15memory_locationD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %9) #8
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  resume { ptr, i32 } %.pn.pn.pn

78:                                               ; preds = %74, %23, %5
  %.227 = phi i32 [ %22, %5 ], [ %.025, %74 ], [ 38, %23 ]
  ret i32 %.227
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { i64, i64 } @"_ZZ16pcudaMemcpyAsyncENK3$_0clEPKv"(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #6 align 2

; 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: mustprogress uwtable
declare dso_local void @_ZN7hipsycl2rt15embed_in_range3ILi1EEENS0_12static_arrayILi3EEENS2_IXT_EEE(ptr dead_on_unwind noalias writable sret(%"class.hipsycl::rt::static_array") align 8, i64) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7hipsycl2rt12static_arrayILi1EEC2Em(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) unnamed_addr #4 align 2

declare void @_ZN7hipsycl2rt15memory_locationC1ENS0_9device_idEPvNS0_12static_arrayILi3EEES5_m(ptr noundef nonnull align 8 dereferenceable(104), i64, i64, ptr noundef, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8, ptr noundef byval(%"class.hipsycl::rt::static_array") align 8, i64 noundef) unnamed_addr #1

declare void @_ZN7hipsycl2rt16memcpy_operationC1ERKNS0_15memory_locationES4_NS0_12static_arrayILi3EEE(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(104), ptr noundef nonnull align 8 dereferenceable(104), ptr noundef byval(%"class.hipsycl::rt::static_array") align 8) unnamed_addr #1

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = { 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 #4 = { 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 #5 = { 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 #6 = { inlinehint 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { 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 = !{!"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,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass