; LLVM IR from NVIDIA/DALI :: dali/c_api_2 (error_handling)

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

%"class.std::__exception_ptr::exception_ptr" = type { ptr }
%class.anon = type { ptr }

@_ZTISt16invalid_argument = external constant ptr
@_ZTIN4dali5c_api13InvalidHandleE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTISt12out_of_range = external constant ptr
@_ZTIN4dali11invalid_keyE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTISt13runtime_error = external constant ptr
@_ZTIN4dali9CUDAErrorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTISt9bad_alloc = external constant ptr
@_ZTIN4dali12CUDABadAllocE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTISt12system_error = external constant ptr
@_ZTISt9exception = external constant ptr
@_ZTIPKc = external constant ptr
@_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE = external dso_local constant { ptr, ptr }, align 8
@.str.34 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4dali5c_api11HandleErrorENSt15__exception_ptr13exception_ptrE(ptr noundef %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %"class.std::__exception_ptr::exception_ptr", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %class.anon, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @_ZNSt15__exception_ptr13exception_ptrC2EOS0_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %0) #8
  invoke void @_ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE(ptr noundef %4) #9
          to label %22 unwind label %23

22:                                               ; preds = %1
  unreachable

23:                                               ; preds = %1
  %24 = landingpad { ptr, i32 }
          catch ptr @_ZTIN4dali5c_api13InvalidHandleE
          catch ptr @_ZTIN4dali11invalid_keyE
          catch ptr @_ZTIN4dali9CUDAErrorE
          catch ptr @_ZTIN4dali12CUDABadAllocE
          catch ptr @_ZTISt9bad_alloc
          catch ptr @_ZTISt12out_of_range
          catch ptr @_ZTISt16invalid_argument
          catch ptr @_ZTISt12system_error
          catch ptr @_ZTISt13runtime_error
          catch ptr @_ZTISt9exception
          catch ptr @_ZTIPKc
          catch ptr @_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
          catch ptr null
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %5, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %6, align 4
  call void @_ZNSt15__exception_ptr13exception_ptrD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  br label %27

27:                                               ; preds = %23
  %28 = load i32, ptr %6, align 4
  %29 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN4dali5c_api13InvalidHandleE) #8
  %30 = icmp eq i32 %28, %29
  br i1 %30, label %31, label %41

31:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %32 = load ptr, ptr %5, align 8
  %33 = call ptr @__cxa_begin_catch(ptr %32) #8
  store ptr %33, ptr %21, align 8
  %34 = load ptr, ptr %21, align 8, !tbaa !5
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %35, i64 2
  %37 = load ptr, ptr %36, align 8
  %38 = call noundef ptr %37(ptr noundef nonnull align 8 dereferenceable(16) %34) #8
  %39 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483647, ptr noundef %38)
          to label %40 unwind label %321

40:                                               ; preds = %31
  store i32 %39, ptr %2, align 4
  store i32 1, ptr %14, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %327

41:                                               ; preds = %27
  %42 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN4dali11invalid_keyE) #8
  %43 = icmp eq i32 %28, %42
  br i1 %43, label %44, label %54

44:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %45 = load ptr, ptr %5, align 8
  %46 = call ptr @__cxa_begin_catch(ptr %45) #8
  store ptr %46, ptr %20, align 8
  %47 = load ptr, ptr %20, align 8, !tbaa !5
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = getelementptr inbounds ptr, ptr %48, i64 2
  %50 = load ptr, ptr %49, align 8
  %51 = call noundef ptr %50(ptr noundef nonnull align 8 dereferenceable(16) %47) #8
  %52 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483642, ptr noundef %51)
          to label %53 unwind label %316

53:                                               ; preds = %44
  store i32 %52, ptr %2, align 4
  store i32 1, ptr %14, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %327

54:                                               ; preds = %41
  %55 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN4dali9CUDAErrorE) #8
  %56 = icmp eq i32 %28, %55
  br i1 %56, label %57, label %74

57:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %58 = load ptr, ptr %5, align 8
  %59 = call ptr @__cxa_begin_catch(ptr %58) #8
  store ptr %59, ptr %19, align 8
  %60 = load ptr, ptr %19, align 8, !tbaa !5
  %61 = call noundef zeroext i1 @_ZNK4dali9CUDAError9is_rt_apiEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #8
  br i1 %61, label %62, label %289

62:                                               ; preds = %57
  %63 = load ptr, ptr %19, align 8, !tbaa !5
  %64 = call noundef i32 @_ZNK4dali9CUDAError8rt_errorEv(ptr noundef nonnull align 8 dereferenceable(24) %63) #8
  %65 = icmp eq i32 %64, 600
  br i1 %65, label %66, label %288

66:                                               ; preds = %62
  %67 = load ptr, ptr %19, align 8, !tbaa !5
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  %69 = getelementptr inbounds ptr, ptr %68, i64 2
  %70 = load ptr, ptr %69, align 8
  %71 = call noundef ptr %70(ptr noundef nonnull align 8 dereferenceable(16) %67) #8
  %72 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef 2, ptr noundef %71)
          to label %73 unwind label %284

73:                                               ; preds = %66
  store i32 %72, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %314

74:                                               ; preds = %54
  %75 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN4dali12CUDABadAllocE) #8
  %76 = icmp eq i32 %28, %75
  br i1 %76, label %77, label %87

77:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %78 = load ptr, ptr %5, align 8
  %79 = call ptr @__cxa_begin_catch(ptr %78) #8
  store ptr %79, ptr %18, align 8
  %80 = load ptr, ptr %18, align 8, !tbaa !5
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = getelementptr inbounds ptr, ptr %81, i64 2
  %83 = load ptr, ptr %82, align 8
  %84 = call noundef ptr %83(ptr noundef nonnull align 8 dereferenceable(72) %80) #8
  %85 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483392, ptr noundef %84)
          to label %86 unwind label %279

86:                                               ; preds = %77
  store i32 %85, ptr %2, align 4
  store i32 1, ptr %14, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %327

87:                                               ; preds = %74
  %88 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9bad_alloc) #8
  %89 = icmp eq i32 %28, %88
  br i1 %89, label %90, label %100

90:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %91 = load ptr, ptr %5, align 8
  %92 = call ptr @__cxa_begin_catch(ptr %91) #8
  store ptr %92, ptr %17, align 8
  %93 = load ptr, ptr %17, align 8, !tbaa !5
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  %95 = getelementptr inbounds ptr, ptr %94, i64 2
  %96 = load ptr, ptr %95, align 8
  %97 = call noundef ptr %96(ptr noundef nonnull align 8 dereferenceable(8) %93) #8
  %98 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483392, ptr noundef %97)
          to label %99 unwind label %274

99:                                               ; preds = %90
  store i32 %98, ptr %2, align 4
  store i32 1, ptr %14, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %327

100:                                              ; preds = %87
  %101 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt12out_of_range) #8
  %102 = icmp eq i32 %28, %101
  br i1 %102, label %103, label %113

103:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %104 = load ptr, ptr %5, align 8
  %105 = call ptr @__cxa_begin_catch(ptr %104) #8
  store ptr %105, ptr %16, align 8
  %106 = load ptr, ptr %16, align 8, !tbaa !5
  %107 = load ptr, ptr %106, align 8, !tbaa !9
  %108 = getelementptr inbounds ptr, ptr %107, i64 2
  %109 = load ptr, ptr %108, align 8
  %110 = call noundef ptr %109(ptr noundef nonnull align 8 dereferenceable(16) %106) #8
  %111 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483643, ptr noundef %110)
          to label %112 unwind label %269

112:                                              ; preds = %103
  store i32 %111, ptr %2, align 4
  store i32 1, ptr %14, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %327

113:                                              ; preds = %100
  %114 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt16invalid_argument) #8
  %115 = icmp eq i32 %28, %114
  br i1 %115, label %116, label %126

116:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %117 = load ptr, ptr %5, align 8
  %118 = call ptr @__cxa_begin_catch(ptr %117) #8
  store ptr %118, ptr %15, align 8
  %119 = load ptr, ptr %15, align 8, !tbaa !5
  %120 = load ptr, ptr %119, align 8, !tbaa !9
  %121 = getelementptr inbounds ptr, ptr %120, i64 2
  %122 = load ptr, ptr %121, align 8
  %123 = call noundef ptr %122(ptr noundef nonnull align 8 dereferenceable(16) %119) #8
  %124 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483646, ptr noundef %123)
          to label %125 unwind label %264

125:                                              ; preds = %116
  store i32 %124, ptr %2, align 4
  store i32 1, ptr %14, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %327

126:                                              ; preds = %113
  %127 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt12system_error) #8
  %128 = icmp eq i32 %28, %127
  br i1 %128, label %129, label %151

129:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %130 = load ptr, ptr %5, align 8
  %131 = call ptr @__cxa_begin_catch(ptr %130) #8
  store ptr %131, ptr %11, align 8
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt12system_error4codeEv(ptr noundef nonnull align 8 dereferenceable(32) %132) #8
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt10error_code8categoryEv(ptr noundef nonnull align 8 dereferenceable(16) %133) #8
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3_V216generic_categoryEv() #10
  %136 = invoke noundef zeroext i1 @_ZN4dali5c_api12_GLOBAL__N_113CategoryEqualERKNSt3_V214error_categoryES5_(ptr noundef nonnull align 8 dereferenceable(8) %134, ptr noundef nonnull align 8 dereferenceable(8) %135)
          to label %137 unwind label %225

137:                                              ; preds = %129
  br i1 %136, label %138, label %238

138:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %139 = getelementptr inbounds %class.anon, ptr %13, i32 0, i32 0
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %140, ptr %139, align 8, !tbaa !5
  %141 = invoke noundef i32 @"_ZZN4dali5c_api11HandleErrorENSt15__exception_ptr13exception_ptrEENK3$_0clEv"(ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %142 unwind label %229

142:                                              ; preds = %138
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  store i32 %141, ptr %12, align 4, !tbaa !11
  %143 = load i32, ptr %12, align 4, !tbaa !11
  %144 = load ptr, ptr %11, align 8, !tbaa !5
  %145 = load ptr, ptr %144, align 8, !tbaa !9
  %146 = getelementptr inbounds ptr, ptr %145, i64 2
  %147 = load ptr, ptr %146, align 8
  %148 = call noundef ptr %147(ptr noundef nonnull align 8 dereferenceable(16) %144) #8
  %149 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef %143, ptr noundef %148)
          to label %150 unwind label %233

150:                                              ; preds = %142
  store i32 %149, ptr %2, align 4
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %261

151:                                              ; preds = %126
  %152 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt13runtime_error) #8
  %153 = icmp eq i32 %28, %152
  br i1 %153, label %154, label %164

154:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %155 = load ptr, ptr %5, align 8
  %156 = call ptr @__cxa_begin_catch(ptr %155) #8
  store ptr %156, ptr %10, align 8
  %157 = load ptr, ptr %10, align 8, !tbaa !5
  %158 = load ptr, ptr %157, align 8, !tbaa !9
  %159 = getelementptr inbounds ptr, ptr %158, i64 2
  %160 = load ptr, ptr %159, align 8
  %161 = call noundef ptr %160(ptr noundef nonnull align 8 dereferenceable(16) %157) #8
  %162 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483644, ptr noundef %161)
          to label %163 unwind label %220

163:                                              ; preds = %154
  store i32 %162, ptr %2, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %327

164:                                              ; preds = %151
  %165 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #8
  %166 = icmp eq i32 %28, %165
  br i1 %166, label %167, label %177

167:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %168 = load ptr, ptr %5, align 8
  %169 = call ptr @__cxa_begin_catch(ptr %168) #8
  store ptr %169, ptr %9, align 8
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = load ptr, ptr %170, align 8, !tbaa !9
  %172 = getelementptr inbounds ptr, ptr %171, i64 2
  %173 = load ptr, ptr %172, align 8
  %174 = call noundef ptr %173(ptr noundef nonnull align 8 dereferenceable(8) %170) #8
  %175 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483136, ptr noundef %174)
          to label %176 unwind label %215

176:                                              ; preds = %167
  store i32 %175, ptr %2, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %327

177:                                              ; preds = %164
  %178 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIPKc) #8
  %179 = icmp eq i32 %28, %178
  br i1 %179, label %180, label %186

180:                                              ; preds = %177
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %181 = load ptr, ptr %5, align 8
  %182 = call ptr @__cxa_begin_catch(ptr %181) #8
  store ptr %182, ptr %8, align 8
  %183 = load ptr, ptr %8, align 8, !tbaa !5
  %184 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483136, ptr noundef %183)
          to label %185 unwind label %211

185:                                              ; preds = %180
  store i32 %184, ptr %2, align 4
  call void @__cxa_end_catch() #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %327

186:                                              ; preds = %177
  %187 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE) #8
  %188 = icmp eq i32 %28, %187
  br i1 %188, label %189, label %196

189:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %190 = load ptr, ptr %5, align 8
  %191 = call ptr @__cxa_begin_catch(ptr %190) #8
  store ptr %191, ptr %7, align 8
  %192 = load ptr, ptr %7, align 8, !tbaa !5
  %193 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %192) #8
  %194 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483136, ptr noundef %193)
          to label %195 unwind label %206

195:                                              ; preds = %189
  store i32 %194, ptr %2, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %327

196:                                              ; preds = %186
  %197 = load ptr, ptr %5, align 8
  %198 = call ptr @__cxa_begin_catch(ptr %197) #8
  %199 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483136, ptr noundef @.str.34)
          to label %200 unwind label %201

200:                                              ; preds = %196
  store i32 %199, ptr %2, align 4
  call void @__cxa_end_catch()
  br label %327

201:                                              ; preds = %196
  %202 = landingpad { ptr, i32 }
          cleanup
  %203 = extractvalue { ptr, i32 } %202, 0
  store ptr %203, ptr %5, align 8
  %204 = extractvalue { ptr, i32 } %202, 1
  store i32 %204, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %205 unwind label %334

205:                                              ; preds = %201
  br label %329

206:                                              ; preds = %189
  %207 = landingpad { ptr, i32 }
          cleanup
  %208 = extractvalue { ptr, i32 } %207, 0
  store ptr %208, ptr %5, align 8
  %209 = extractvalue { ptr, i32 } %207, 1
  store i32 %209, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %210 unwind label %334

210:                                              ; preds = %206
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %329

211:                                              ; preds = %180
  %212 = landingpad { ptr, i32 }
          cleanup
  %213 = extractvalue { ptr, i32 } %212, 0
  store ptr %213, ptr %5, align 8
  %214 = extractvalue { ptr, i32 } %212, 1
  store i32 %214, ptr %6, align 4
  call void @__cxa_end_catch() #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %329

215:                                              ; preds = %167
  %216 = landingpad { ptr, i32 }
          cleanup
  %217 = extractvalue { ptr, i32 } %216, 0
  store ptr %217, ptr %5, align 8
  %218 = extractvalue { ptr, i32 } %216, 1
  store i32 %218, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %219 unwind label %334

219:                                              ; preds = %215
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %329

220:                                              ; preds = %154
  %221 = landingpad { ptr, i32 }
          cleanup
  %222 = extractvalue { ptr, i32 } %221, 0
  store ptr %222, ptr %5, align 8
  %223 = extractvalue { ptr, i32 } %221, 1
  store i32 %223, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %224 unwind label %334

224:                                              ; preds = %220
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %329

225:                                              ; preds = %253, %245, %238, %129
  %226 = landingpad { ptr, i32 }
          cleanup
  %227 = extractvalue { ptr, i32 } %226, 0
  store ptr %227, ptr %5, align 8
  %228 = extractvalue { ptr, i32 } %226, 1
  store i32 %228, ptr %6, align 4
  br label %262

229:                                              ; preds = %138
  %230 = landingpad { ptr, i32 }
          cleanup
  %231 = extractvalue { ptr, i32 } %230, 0
  store ptr %231, ptr %5, align 8
  %232 = extractvalue { ptr, i32 } %230, 1
  store i32 %232, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %237

233:                                              ; preds = %142
  %234 = landingpad { ptr, i32 }
          cleanup
  %235 = extractvalue { ptr, i32 } %234, 0
  store ptr %235, ptr %5, align 8
  %236 = extractvalue { ptr, i32 } %234, 1
  store i32 %236, ptr %6, align 4
  br label %237

237:                                              ; preds = %233, %229
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %262

238:                                              ; preds = %137
  %239 = load ptr, ptr %11, align 8, !tbaa !5
  %240 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt12system_error4codeEv(ptr noundef nonnull align 8 dereferenceable(32) %239) #8
  %241 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt10error_code8categoryEv(ptr noundef nonnull align 8 dereferenceable(16) %240) #8
  %242 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt17iostream_categoryv() #10
  %243 = invoke noundef zeroext i1 @_ZN4dali5c_api12_GLOBAL__N_113CategoryEqualERKNSt3_V214error_categoryES5_(ptr noundef nonnull align 8 dereferenceable(8) %241, ptr noundef nonnull align 8 dereferenceable(8) %242)
          to label %244 unwind label %225

244:                                              ; preds = %238
  br i1 %243, label %245, label %253

245:                                              ; preds = %244
  %246 = load ptr, ptr %11, align 8, !tbaa !5
  %247 = load ptr, ptr %246, align 8, !tbaa !9
  %248 = getelementptr inbounds ptr, ptr %247, i64 2
  %249 = load ptr, ptr %248, align 8
  %250 = call noundef ptr %249(ptr noundef nonnull align 8 dereferenceable(16) %246) #8
  %251 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483639, ptr noundef %250)
          to label %252 unwind label %225

252:                                              ; preds = %245
  store i32 %251, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %261

253:                                              ; preds = %244
  %254 = load ptr, ptr %11, align 8, !tbaa !5
  %255 = load ptr, ptr %254, align 8, !tbaa !9
  %256 = getelementptr inbounds ptr, ptr %255, i64 2
  %257 = load ptr, ptr %256, align 8
  %258 = call noundef ptr %257(ptr noundef nonnull align 8 dereferenceable(16) %254) #8
  %259 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483641, ptr noundef %258)
          to label %260 unwind label %225

260:                                              ; preds = %253
  store i32 %259, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %261

261:                                              ; preds = %260, %252, %150
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %327

262:                                              ; preds = %237, %225
  invoke void @__cxa_end_catch()
          to label %263 unwind label %334

263:                                              ; preds = %262
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %329

264:                                              ; preds = %116
  %265 = landingpad { ptr, i32 }
          cleanup
  %266 = extractvalue { ptr, i32 } %265, 0
  store ptr %266, ptr %5, align 8
  %267 = extractvalue { ptr, i32 } %265, 1
  store i32 %267, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %268 unwind label %334

268:                                              ; preds = %264
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %329

269:                                              ; preds = %103
  %270 = landingpad { ptr, i32 }
          cleanup
  %271 = extractvalue { ptr, i32 } %270, 0
  store ptr %271, ptr %5, align 8
  %272 = extractvalue { ptr, i32 } %270, 1
  store i32 %272, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %273 unwind label %334

273:                                              ; preds = %269
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %329

274:                                              ; preds = %90
  %275 = landingpad { ptr, i32 }
          cleanup
  %276 = extractvalue { ptr, i32 } %275, 0
  store ptr %276, ptr %5, align 8
  %277 = extractvalue { ptr, i32 } %275, 1
  store i32 %277, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %278 unwind label %334

278:                                              ; preds = %274
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %329

279:                                              ; preds = %77
  %280 = landingpad { ptr, i32 }
          cleanup
  %281 = extractvalue { ptr, i32 } %280, 0
  store ptr %281, ptr %5, align 8
  %282 = extractvalue { ptr, i32 } %280, 1
  store i32 %282, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %283 unwind label %334

283:                                              ; preds = %279
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %329

284:                                              ; preds = %306, %296, %66
  %285 = landingpad { ptr, i32 }
          cleanup
  %286 = extractvalue { ptr, i32 } %285, 0
  store ptr %286, ptr %5, align 8
  %287 = extractvalue { ptr, i32 } %285, 1
  store i32 %287, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %315 unwind label %334

288:                                              ; preds = %62
  br label %306

289:                                              ; preds = %57
  %290 = load ptr, ptr %19, align 8, !tbaa !5
  %291 = call noundef zeroext i1 @_ZNK4dali9CUDAError10is_drv_apiEv(ptr noundef nonnull align 8 dereferenceable(24) %290) #8
  br i1 %291, label %292, label %305

292:                                              ; preds = %289
  %293 = load ptr, ptr %19, align 8, !tbaa !5
  %294 = call noundef i32 @_ZNK4dali9CUDAError9drv_errorEv(ptr noundef nonnull align 8 dereferenceable(24) %293) #8
  %295 = icmp eq i32 %294, 600
  br i1 %295, label %296, label %304

296:                                              ; preds = %292
  %297 = load ptr, ptr %19, align 8, !tbaa !5
  %298 = load ptr, ptr %297, align 8, !tbaa !9
  %299 = getelementptr inbounds ptr, ptr %298, i64 2
  %300 = load ptr, ptr %299, align 8
  %301 = call noundef ptr %300(ptr noundef nonnull align 8 dereferenceable(16) %297) #8
  %302 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef 2, ptr noundef %301)
          to label %303 unwind label %284

303:                                              ; preds = %296
  store i32 %302, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %314

304:                                              ; preds = %292
  br label %305

305:                                              ; preds = %304, %289
  br label %306

306:                                              ; preds = %305, %288
  %307 = load ptr, ptr %19, align 8, !tbaa !5
  %308 = load ptr, ptr %307, align 8, !tbaa !9
  %309 = getelementptr inbounds ptr, ptr %308, i64 2
  %310 = load ptr, ptr %309, align 8
  %311 = call noundef ptr %310(ptr noundef nonnull align 8 dereferenceable(16) %307) #8
  %312 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147418112, ptr noundef %311)
          to label %313 unwind label %284

313:                                              ; preds = %306
  store i32 %312, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %314

314:                                              ; preds = %313, %303, %73
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %327

315:                                              ; preds = %284
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %329

316:                                              ; preds = %44
  %317 = landingpad { ptr, i32 }
          cleanup
  %318 = extractvalue { ptr, i32 } %317, 0
  store ptr %318, ptr %5, align 8
  %319 = extractvalue { ptr, i32 } %317, 1
  store i32 %319, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %320 unwind label %334

320:                                              ; preds = %316
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %329

321:                                              ; preds = %31
  %322 = landingpad { ptr, i32 }
          cleanup
  %323 = extractvalue { ptr, i32 } %322, 0
  store ptr %323, ptr %5, align 8
  %324 = extractvalue { ptr, i32 } %322, 1
  store i32 %324, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %325 unwind label %334

325:                                              ; preds = %321
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %329

326:                                              ; No predecessors!
  unreachable

327:                                              ; preds = %314, %261, %200, %195, %185, %176, %163, %125, %112, %99, %86, %53, %40
  %328 = load i32, ptr %2, align 4
  ret i32 %328

329:                                              ; preds = %325, %320, %315, %283, %278, %273, %268, %263, %224, %219, %211, %210, %205
  %330 = load ptr, ptr %5, align 8
  %331 = load i32, ptr %6, align 4
  %332 = insertvalue { ptr, i32 } poison, ptr %330, 0
  %333 = insertvalue { ptr, i32 } %332, i32 %331, 1
  resume { ptr, i32 } %333

334:                                              ; preds = %321, %316, %284, %279, %274, %269, %264, %262, %220, %215, %206, %201
  %335 = landingpad { ptr, i32 }
          catch ptr null
  %336 = extractvalue { ptr, i32 } %335, 0
  call void @__clang_call_terminate(ptr %336) #11
  unreachable
}

; Function Attrs: noreturn
declare void @_ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE(ptr noundef) #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #4

declare ptr @__cxa_begin_catch(ptr)

declare void @__cxa_end_catch()

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN4dali5c_api12_GLOBAL__N_113CategoryEqualERKNSt3_V214error_categoryES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

; Function Attrs: nounwind willreturn memory(none)
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3_V216generic_categoryEv() #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @"_ZZN4dali5c_api11HandleErrorENSt15__exception_ptr13exception_ptrEENK3$_0clEv"(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: nounwind willreturn memory(none)
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt17iostream_categoryv() #7

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn "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 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 = { 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 = { nounwind memory(none) }
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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind willreturn memory(none) "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 = { nounwind }
attributes #9 = { noreturn }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS12daliResult_t", !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.std::__exception_ptr::exception_ptr" = type { ptr }
%class.anon = type { ptr }

@_ZTISt16invalid_argument = external constant ptr
@_ZTIN4dali5c_api13InvalidHandleE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTISt12out_of_range = external constant ptr
@_ZTIN4dali11invalid_keyE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTISt13runtime_error = external constant ptr
@_ZTIN4dali9CUDAErrorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTISt9bad_alloc = external constant ptr
@_ZTIN4dali12CUDABadAllocE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTISt12system_error = external constant ptr
@_ZTISt9exception = external constant ptr
@_ZTIPKc = external constant ptr
@_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE = external dso_local constant { ptr, ptr }, align 8
@.str.34 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4dali5c_api11HandleErrorENSt15__exception_ptr13exception_ptrE(ptr noundef nonnull %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::__exception_ptr::exception_ptr", align 8
  %3 = alloca %class.anon, align 8
  call void @_ZNSt15__exception_ptr13exception_ptrC2EOS0_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %0) #8
  invoke void @_ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE(ptr noundef nonnull %2) #9
          to label %4 unwind label %5

4:                                                ; preds = %1
  unreachable

5:                                                ; preds = %1
  %6 = landingpad { ptr, i32 }
          catch ptr @_ZTIN4dali5c_api13InvalidHandleE
          catch ptr @_ZTIN4dali11invalid_keyE
          catch ptr @_ZTIN4dali9CUDAErrorE
          catch ptr @_ZTIN4dali12CUDABadAllocE
          catch ptr @_ZTISt9bad_alloc
          catch ptr @_ZTISt12out_of_range
          catch ptr @_ZTISt16invalid_argument
          catch ptr @_ZTISt12system_error
          catch ptr @_ZTISt13runtime_error
          catch ptr @_ZTISt9exception
          catch ptr @_ZTIPKc
          catch ptr @_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
          catch ptr null
  %7 = extractvalue { ptr, i32 } %6, 0
  %8 = extractvalue { ptr, i32 } %6, 1
  call void @_ZNSt15__exception_ptr13exception_ptrD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #8
  %9 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN4dali5c_api13InvalidHandleE) #8
  %10 = icmp eq i32 %8, %9
  br i1 %10, label %11, label %19

11:                                               ; preds = %5
  %12 = call ptr @__cxa_begin_catch(ptr %7) #8
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  %15 = load ptr, ptr %14, align 8
  %16 = call noundef ptr %15(ptr noundef nonnull align 8 dereferenceable(16) %12) #8
  %17 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483647, ptr noundef %16)
          to label %18 unwind label %189

18:                                               ; preds = %11
  call void @__cxa_end_catch()
  br label %191

19:                                               ; preds = %5
  %20 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN4dali11invalid_keyE) #8
  %21 = icmp eq i32 %8, %20
  br i1 %21, label %22, label %30

22:                                               ; preds = %19
  %23 = call ptr @__cxa_begin_catch(ptr %7) #8
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 16
  %26 = load ptr, ptr %25, align 8
  %27 = call noundef ptr %26(ptr noundef nonnull align 8 dereferenceable(16) %23) #8
  %28 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483642, ptr noundef %27)
          to label %29 unwind label %187

29:                                               ; preds = %22
  call void @__cxa_end_catch()
  br label %191

30:                                               ; preds = %19
  %31 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN4dali9CUDAErrorE) #8
  %32 = icmp eq i32 %8, %31
  br i1 %32, label %33, label %39

33:                                               ; preds = %30
  %34 = call ptr @__cxa_begin_catch(ptr %7) #8
  %35 = call noundef zeroext i1 @_ZNK4dali9CUDAError9is_rt_apiEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #8
  br i1 %35, label %36, label %174

36:                                               ; preds = %33
  %37 = call noundef i32 @_ZNK4dali9CUDAError8rt_errorEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #8
  %38 = icmp eq i32 %37, 600
  br i1 %38, label %.invoke48, label %179

39:                                               ; preds = %30
  %40 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN4dali12CUDABadAllocE) #8
  %41 = icmp eq i32 %8, %40
  br i1 %41, label %42, label %50

42:                                               ; preds = %39
  %43 = call ptr @__cxa_begin_catch(ptr %7) #8
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %46 = load ptr, ptr %45, align 8
  %47 = call noundef ptr %46(ptr noundef nonnull align 8 dereferenceable(72) %43) #8
  %48 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483392, ptr noundef %47)
          to label %49 unwind label %170

49:                                               ; preds = %42
  call void @__cxa_end_catch()
  br label %191

50:                                               ; preds = %39
  %51 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9bad_alloc) #8
  %52 = icmp eq i32 %8, %51
  br i1 %52, label %53, label %61

53:                                               ; preds = %50
  %54 = call ptr @__cxa_begin_catch(ptr %7) #8
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 16
  %57 = load ptr, ptr %56, align 8
  %58 = call noundef ptr %57(ptr noundef nonnull align 8 dereferenceable(8) %54) #8
  %59 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483392, ptr noundef %58)
          to label %60 unwind label %168

60:                                               ; preds = %53
  call void @__cxa_end_catch()
  br label %191

61:                                               ; preds = %50
  %62 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt12out_of_range) #8
  %63 = icmp eq i32 %8, %62
  br i1 %63, label %64, label %72

64:                                               ; preds = %61
  %65 = call ptr @__cxa_begin_catch(ptr %7) #8
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i64 16
  %68 = load ptr, ptr %67, align 8
  %69 = call noundef ptr %68(ptr noundef nonnull align 8 dereferenceable(16) %65) #8
  %70 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483643, ptr noundef %69)
          to label %71 unwind label %166

71:                                               ; preds = %64
  call void @__cxa_end_catch()
  br label %191

72:                                               ; preds = %61
  %73 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt16invalid_argument) #8
  %74 = icmp eq i32 %8, %73
  br i1 %74, label %75, label %83

75:                                               ; preds = %72
  %76 = call ptr @__cxa_begin_catch(ptr %7) #8
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = getelementptr inbounds i8, ptr %77, i64 16
  %79 = load ptr, ptr %78, align 8
  %80 = call noundef ptr %79(ptr noundef nonnull align 8 dereferenceable(16) %76) #8
  %81 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483646, ptr noundef %80)
          to label %82 unwind label %164

82:                                               ; preds = %75
  call void @__cxa_end_catch()
  br label %191

83:                                               ; preds = %72
  %84 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt12system_error) #8
  %85 = icmp eq i32 %8, %84
  br i1 %85, label %86, label %99

86:                                               ; preds = %83
  %87 = call ptr @__cxa_begin_catch(ptr %7) #8
  %88 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt12system_error4codeEv(ptr noundef nonnull align 8 dereferenceable(32) %87) #8
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt10error_code8categoryEv(ptr noundef nonnull align 8 dereferenceable(16) %88) #8
  %90 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3_V216generic_categoryEv() #10
  %91 = call noundef zeroext i1 @_ZN4dali5c_api12_GLOBAL__N_113CategoryEqualERKNSt3_V214error_categoryES5_(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef nonnull align 8 dereferenceable(8) %90)
  br i1 %91, label %92, label %.invoke

92:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store ptr %87, ptr %3, align 8, !tbaa !8
  %93 = call noundef i32 @"_ZZN4dali5c_api11HandleErrorENSt15__exception_ptr13exception_ptrEENK3$_0clEv"(ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %94 = load ptr, ptr %87, align 8, !tbaa !5
  %95 = getelementptr inbounds i8, ptr %94, i64 16
  %96 = load ptr, ptr %95, align 8
  %97 = call noundef ptr %96(ptr noundef nonnull align 8 dereferenceable(16) %87) #8
  %98 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef %93, ptr noundef %97)
          to label %162 unwind label %151

99:                                               ; preds = %83
  %100 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt13runtime_error) #8
  %101 = icmp eq i32 %8, %100
  br i1 %101, label %102, label %110

102:                                              ; preds = %99
  %103 = call ptr @__cxa_begin_catch(ptr %7) #8
  %104 = load ptr, ptr %103, align 8, !tbaa !5
  %105 = getelementptr inbounds i8, ptr %104, i64 16
  %106 = load ptr, ptr %105, align 8
  %107 = call noundef ptr %106(ptr noundef nonnull align 8 dereferenceable(16) %103) #8
  %108 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483644, ptr noundef %107)
          to label %109 unwind label %147

109:                                              ; preds = %102
  call void @__cxa_end_catch()
  br label %191

110:                                              ; preds = %99
  %111 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #8
  %112 = icmp eq i32 %8, %111
  br i1 %112, label %113, label %121

113:                                              ; preds = %110
  %114 = call ptr @__cxa_begin_catch(ptr %7) #8
  %115 = load ptr, ptr %114, align 8, !tbaa !5
  %116 = getelementptr inbounds i8, ptr %115, i64 16
  %117 = load ptr, ptr %116, align 8
  %118 = call noundef ptr %117(ptr noundef nonnull align 8 dereferenceable(8) %114) #8
  %119 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483136, ptr noundef %118)
          to label %120 unwind label %145

120:                                              ; preds = %113
  call void @__cxa_end_catch()
  br label %191

121:                                              ; preds = %110
  %122 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIPKc) #8
  %123 = icmp eq i32 %8, %122
  br i1 %123, label %124, label %128

124:                                              ; preds = %121
  %125 = call ptr @__cxa_begin_catch(ptr %7) #8
  %126 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483136, ptr noundef %125)
          to label %127 unwind label %143

127:                                              ; preds = %124
  call void @__cxa_end_catch() #8
  br label %191

128:                                              ; preds = %121
  %129 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE) #8
  %130 = icmp eq i32 %8, %129
  %131 = call ptr @__cxa_begin_catch(ptr %7) #8
  br i1 %130, label %132, label %136

132:                                              ; preds = %128
  %133 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %131) #8
  %134 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483136, ptr noundef %133)
          to label %135 unwind label %141

135:                                              ; preds = %132
  call void @__cxa_end_catch()
  br label %191

136:                                              ; preds = %128
  %137 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef -2147483136, ptr noundef nonnull @.str.34)
          to label %138 unwind label %139

138:                                              ; preds = %136
  call void @__cxa_end_catch()
  br label %191

139:                                              ; preds = %136
  %140 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

141:                                              ; preds = %132
  %142 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

143:                                              ; preds = %124
  %144 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_end_catch() #8
  br label %192

145:                                              ; preds = %113
  %146 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

147:                                              ; preds = %102
  %148 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

149:                                              ; preds = %.invoke
  %150 = landingpad { ptr, i32 }
          cleanup
  br label %163

151:                                              ; preds = %92
  %152 = landingpad { ptr, i32 }
          cleanup
  br label %163

.invoke:                                          ; preds = %86
  %153 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt12system_error4codeEv(ptr noundef nonnull align 8 dereferenceable(32) %87) #8
  %154 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt10error_code8categoryEv(ptr noundef nonnull align 8 dereferenceable(16) %153) #8
  %155 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt17iostream_categoryv() #10
  %156 = call noundef zeroext i1 @_ZN4dali5c_api12_GLOBAL__N_113CategoryEqualERKNSt3_V214error_categoryES5_(ptr noundef nonnull align 8 dereferenceable(8) %154, ptr noundef nonnull align 8 dereferenceable(8) %155)
  %157 = load ptr, ptr %87, align 8, !tbaa !5
  %158 = getelementptr inbounds i8, ptr %157, i64 16
  %159 = load ptr, ptr %158, align 8
  %160 = call noundef ptr %159(ptr noundef nonnull align 8 dereferenceable(16) %87) #8
  %. = select i1 %156, i32 -2147483639, i32 -2147483641
  %161 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef %., ptr noundef %160)
          to label %162 unwind label %149

162:                                              ; preds = %.invoke, %92
  %.0 = phi i32 [ %98, %92 ], [ %161, %.invoke ]
  call void @__cxa_end_catch()
  br label %191

163:                                              ; preds = %151, %149
  %.pn = phi { ptr, i32 } [ %152, %151 ], [ %150, %149 ]
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

164:                                              ; preds = %75
  %165 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

166:                                              ; preds = %64
  %167 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

168:                                              ; preds = %53
  %169 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

170:                                              ; preds = %42
  %171 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

172:                                              ; preds = %.invoke48
  %173 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

174:                                              ; preds = %33
  %175 = call noundef zeroext i1 @_ZNK4dali9CUDAError10is_drv_apiEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #8
  br i1 %175, label %176, label %179

176:                                              ; preds = %174
  %177 = call noundef i32 @_ZNK4dali9CUDAError9drv_errorEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #8
  %178 = icmp eq i32 %177, 600
  br i1 %178, label %.invoke48, label %179

179:                                              ; preds = %174, %176, %36
  br label %.invoke48

.invoke48:                                        ; preds = %176, %36, %179
  %180 = phi i32 [ -2147418112, %179 ], [ 2, %36 ], [ 2, %176 ]
  %181 = load ptr, ptr %34, align 8, !tbaa !5
  %182 = getelementptr inbounds i8, ptr %181, i64 16
  %183 = load ptr, ptr %182, align 8
  %184 = call noundef ptr %183(ptr noundef nonnull align 8 dereferenceable(16) %34) #8
  %185 = invoke noundef i32 @_ZN4dali5c_api12SetLastErrorE12daliResult_tPKc(i32 noundef %180, ptr noundef %184)
          to label %186 unwind label %172

186:                                              ; preds = %.invoke48
  call void @__cxa_end_catch()
  br label %191

187:                                              ; preds = %22
  %188 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

189:                                              ; preds = %11
  %190 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %192 unwind label %193

191:                                              ; preds = %186, %162, %138, %135, %127, %120, %109, %82, %71, %60, %49, %29, %18
  %.2 = phi i32 [ %17, %18 ], [ %28, %29 ], [ %185, %186 ], [ %48, %49 ], [ %59, %60 ], [ %70, %71 ], [ %81, %82 ], [ %.0, %162 ], [ %108, %109 ], [ %119, %120 ], [ %126, %127 ], [ %134, %135 ], [ %137, %138 ]
  ret i32 %.2

192:                                              ; preds = %189, %187, %172, %170, %168, %166, %164, %163, %147, %145, %141, %139, %143
  %.pn46 = phi { ptr, i32 } [ %144, %143 ], [ %140, %139 ], [ %142, %141 ], [ %146, %145 ], [ %148, %147 ], [ %.pn, %163 ], [ %165, %164 ], [ %167, %166 ], [ %169, %168 ], [ %171, %170 ], [ %173, %172 ], [ %188, %187 ], [ %190, %189 ]
  resume { ptr, i32 } %.pn46

193:                                              ; preds = %189, %187, %172, %170, %168, %166, %164, %163, %147, %145, %141, %139
  %194 = landingpad { ptr, i32 }
          catch ptr null
  %195 = extractvalue { ptr, i32 } %194, 0
  call void @__clang_call_terminate(ptr %195) #11
  unreachable
}

; Function Attrs: noreturn
declare void @_ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE(ptr noundef) local_unnamed_addr #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #4

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare void @__cxa_end_catch() local_unnamed_addr

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN4dali5c_api12_GLOBAL__N_113CategoryEqualERKNSt3_V214error_categoryES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3_V216generic_categoryEv() local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @"_ZZN4dali5c_api11HandleErrorENSt15__exception_ptr13exception_ptrEENK3$_0clEv"(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt17iostream_categoryv() local_unnamed_addr #7

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn "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 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 = { 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 = { nofree nosync nounwind memory(none) }
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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { nounwind }
attributes #9 = { noreturn }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { 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,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass