; LLVM IR from PaddlePaddle/FastDeploy :: third_party/onnx/onnx (onnxifi_wrapper)

; 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"

%struct.onnxifi_library = type { ptr, i32, %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.onnxifi_backend_id_wrapper = type { i32, ptr, ptr }

@num_libraries = external hidden global i32, align 4
@libraries = external hidden global ptr, align 8
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [97 x i8], align 1
@__PRETTY_FUNCTION__.onnxGetBackendIDs = external hidden unnamed_addr constant [56 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @onnxGetBackendIDs(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @load_all_libraries_once()
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %2
  br label %26

23:                                               ; preds = %2
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load i64, ptr %24, align 8, !tbaa !9
  br label %26

26:                                               ; preds = %23, %22
  %27 = phi i64 [ 0, %22 ], [ %25, %23 ]
  store i64 %27, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 0, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store ptr null, ptr %10, align 8, !tbaa !5
  %28 = load i64, ptr %7, align 8, !tbaa !9
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %30, label %42

30:                                               ; preds = %26
  %31 = load i64, ptr %7, align 8, !tbaa !9
  %32 = mul i64 %31, 8
  %33 = call noalias ptr @malloc(i64 noundef %32) #8
  store ptr %33, ptr %10, align 8, !tbaa !5
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %37

36:                                               ; preds = %30
  store i32 1025, ptr %6, align 4, !tbaa !11
  br label %169

37:                                               ; preds = %30
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = load i64, ptr %7, align 8, !tbaa !9
  %40 = mul i64 %39, 8
  call void @llvm.memset.p0.i64(ptr align 8 %38, i8 0, i64 %40, i1 false)
  br label %41

41:                                               ; preds = %37
  br label %42

42:                                               ; preds = %41, %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %43

43:                                               ; preds = %145, %42
  %44 = load i64, ptr %11, align 8, !tbaa !9
  %45 = load i32, ptr @num_libraries, align 4, !tbaa !11
  %46 = zext i32 %45 to i64
  %47 = icmp ult i64 %44, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %43
  store i32 3, ptr %12, align 4
  br label %148

49:                                               ; preds = %43
  %50 = load i64, ptr %7, align 8, !tbaa !9
  %51 = load i64, ptr %8, align 8, !tbaa !9
  %52 = icmp ugt i64 %50, %51
  br i1 %52, label %53, label %126

53:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %54 = load i64, ptr %7, align 8, !tbaa !9
  %55 = load i64, ptr %8, align 8, !tbaa !9
  %56 = sub i64 %54, %55
  store i64 %56, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %57 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %57, ptr %14, align 8, !tbaa !9
  %58 = load ptr, ptr @libraries, align 8, !tbaa !5
  %59 = load i64, ptr %11, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.onnxifi_library, ptr %58, i64 %59
  %61 = getelementptr inbounds %struct.onnxifi_library, ptr %60, i32 0, i32 2
  %62 = getelementptr inbounds %struct.anon, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !13
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = load i64, ptr %8, align 8, !tbaa !9
  %66 = getelementptr inbounds ptr, ptr %64, i64 %65
  %67 = call i32 %63(ptr noundef %66, ptr noundef %14)
  store i32 %67, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %68 = load i64, ptr %14, align 8, !tbaa !9
  %69 = load i64, ptr %13, align 8, !tbaa !9
  %70 = icmp ult i64 %68, %69
  br i1 %70, label %71, label %73

71:                                               ; preds = %53
  %72 = load i64, ptr %14, align 8, !tbaa !9
  br label %75

73:                                               ; preds = %53
  %74 = load i64, ptr %13, align 8, !tbaa !9
  br label %75

75:                                               ; preds = %73, %71
  %76 = phi i64 [ %72, %71 ], [ %74, %73 ]
  store i64 %76, ptr %15, align 8, !tbaa !9
  %77 = load i32, ptr %6, align 4, !tbaa !11
  switch i32 %77, label %121 [
    i32 0, label %78
    i32 1, label %78
  ]

78:                                               ; preds = %75, %75
  %79 = load ptr, ptr @libraries, align 8, !tbaa !5
  %80 = load i64, ptr %11, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct.onnxifi_library, ptr %79, i64 %80
  %82 = load i64, ptr %15, align 8, !tbaa !9
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = load i64, ptr %8, align 8, !tbaa !9
  %85 = getelementptr inbounds ptr, ptr %83, i64 %84
  %86 = call i32 @wrap_backend_ids(ptr noundef %81, i64 noundef %82, ptr noundef %85)
  store i32 %86, ptr %6, align 4, !tbaa !11
  %87 = load i32, ptr %6, align 4, !tbaa !11
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %114

89:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store i64 0, ptr %16, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %110, %89
  %91 = load i64, ptr %16, align 8, !tbaa !9
  %92 = load i64, ptr %15, align 8, !tbaa !9
  %93 = icmp ult i64 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 7, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %113

95:                                               ; preds = %90
  %96 = load ptr, ptr @libraries, align 8, !tbaa !5
  %97 = load i64, ptr %11, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.onnxifi_library, ptr %96, i64 %97
  %99 = getelementptr inbounds %struct.onnxifi_library, ptr %98, i32 0, i32 2
  %100 = getelementptr inbounds %struct.anon, ptr %99, i32 0, i32 1
  %101 = load ptr, ptr %100, align 8, !tbaa !13
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = load i64, ptr %16, align 8, !tbaa !9
  %104 = getelementptr inbounds ptr, ptr %102, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !5
  %106 = call i32 %101(ptr noundef %105)
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load i64, ptr %16, align 8, !tbaa !9
  %109 = getelementptr inbounds ptr, ptr %107, i64 %108
  store ptr null, ptr %109, align 8, !tbaa !5
  br label %110

110:                                              ; preds = %95
  %111 = load i64, ptr %16, align 8, !tbaa !9
  %112 = add i64 %111, 1
  store i64 %112, ptr %16, align 8, !tbaa !9
  br label %90, !llvm.loop !14

113:                                              ; preds = %94
  store i32 2, ptr %12, align 4
  br label %123

114:                                              ; preds = %78
  %115 = load i64, ptr %15, align 8, !tbaa !9
  %116 = load i64, ptr %9, align 8, !tbaa !9
  %117 = add i64 %116, %115
  store i64 %117, ptr %9, align 8, !tbaa !9
  %118 = load i64, ptr %14, align 8, !tbaa !9
  %119 = load i64, ptr %8, align 8, !tbaa !9
  %120 = add i64 %119, %118
  store i64 %120, ptr %8, align 8, !tbaa !9
  br label %122

121:                                              ; preds = %75
  store i32 2, ptr %12, align 4
  br label %123

122:                                              ; preds = %114
  store i32 0, ptr %12, align 4
  br label %123

123:                                              ; preds = %122, %121, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %124 = load i32, ptr %12, align 4
  switch i32 %124, label %148 [
    i32 0, label %125
  ]

125:                                              ; preds = %123
  br label %144

126:                                              ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  store i64 0, ptr %17, align 8, !tbaa !9
  %127 = load ptr, ptr @libraries, align 8, !tbaa !5
  %128 = load i64, ptr %11, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.onnxifi_library, ptr %127, i64 %128
  %130 = getelementptr inbounds %struct.onnxifi_library, ptr %129, i32 0, i32 2
  %131 = getelementptr inbounds %struct.anon, ptr %130, i32 0, i32 0
  %132 = load ptr, ptr %131, align 8, !tbaa !13
  %133 = call i32 %132(ptr noundef null, ptr noundef %17)
  store i32 %133, ptr %6, align 4, !tbaa !11
  %134 = load i32, ptr %6, align 4, !tbaa !11
  %135 = icmp ne i32 %134, 1
  br i1 %135, label %136, label %137

136:                                              ; preds = %126
  store i32 2, ptr %12, align 4
  br label %141

137:                                              ; preds = %126
  %138 = load i64, ptr %17, align 8, !tbaa !9
  %139 = load i64, ptr %8, align 8, !tbaa !9
  %140 = add i64 %139, %138
  store i64 %140, ptr %8, align 8, !tbaa !9
  store i32 0, ptr %12, align 4
  br label %141

141:                                              ; preds = %137, %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  %142 = load i32, ptr %12, align 4
  switch i32 %142, label %148 [
    i32 0, label %143
  ]

143:                                              ; preds = %141
  br label %144

144:                                              ; preds = %143, %125
  br label %145

145:                                              ; preds = %144
  %146 = load i64, ptr %11, align 8, !tbaa !9
  %147 = add i64 %146, 1
  store i64 %147, ptr %11, align 8, !tbaa !9
  br label %43, !llvm.loop !16

148:                                              ; preds = %141, %123, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %149 = load i32, ptr %12, align 4
  switch i32 %149, label %205 [
    i32 3, label %150
    i32 2, label %169
  ]

150:                                              ; preds = %148
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = icmp eq ptr %151, null
  br i1 %152, label %153, label %156

153:                                              ; preds = %150
  %154 = load i64, ptr %8, align 8, !tbaa !9
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %154, ptr %155, align 8, !tbaa !9
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %205

156:                                              ; preds = %150
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = load ptr, ptr %10, align 8, !tbaa !5
  %159 = load i64, ptr %9, align 8, !tbaa !9
  %160 = mul i64 %159, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %157, ptr align 8 %158, i64 %160, i1 false)
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %161) #7
  %162 = load i64, ptr %8, align 8, !tbaa !9
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %162, ptr %163, align 8, !tbaa !9
  %164 = load i64, ptr %8, align 8, !tbaa !9
  %165 = load i64, ptr %7, align 8, !tbaa !9
  %166 = icmp ule i64 %164, %165
  %167 = zext i1 %166 to i64
  %168 = select i1 %166, i32 0, i32 1
  store i32 %168, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %205

169:                                              ; preds = %148, %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  store i64 0, ptr %18, align 8, !tbaa !9
  br label %170

170:                                              ; preds = %199, %169
  %171 = load i64, ptr %18, align 8, !tbaa !9
  %172 = load i64, ptr %9, align 8, !tbaa !9
  %173 = icmp ult i64 %171, %172
  br i1 %173, label %175, label %174

174:                                              ; preds = %170
  store i32 10, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %202

175:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %176 = load ptr, ptr %10, align 8, !tbaa !5
  %177 = load i64, ptr %18, align 8, !tbaa !9
  %178 = getelementptr inbounds ptr, ptr %176, i64 %177
  %179 = load ptr, ptr %178, align 8, !tbaa !5
  store ptr %179, ptr %19, align 8, !tbaa !5
  %180 = load ptr, ptr %19, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.onnxifi_backend_id_wrapper, ptr %180, i32 0, i32 0
  %182 = load i32, ptr %181, align 8, !tbaa !17
  %183 = icmp eq i32 %182, 786249572
  br i1 %183, label %184, label %185

184:                                              ; preds = %175
  br label %186

185:                                              ; preds = %175
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 431, ptr noundef @__PRETTY_FUNCTION__.onnxGetBackendIDs) #9
  unreachable

186:                                              ; preds = %184
  %187 = load ptr, ptr %19, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.onnxifi_backend_id_wrapper, ptr %187, i32 0, i32 2
  %189 = load ptr, ptr %188, align 8, !tbaa !19
  %190 = getelementptr inbounds %struct.onnxifi_library, ptr %189, i32 0, i32 2
  %191 = getelementptr inbounds %struct.anon, ptr %190, i32 0, i32 1
  %192 = load ptr, ptr %191, align 8, !tbaa !13
  %193 = load ptr, ptr %19, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.onnxifi_backend_id_wrapper, ptr %193, i32 0, i32 1
  %195 = load ptr, ptr %194, align 8, !tbaa !20
  %196 = call i32 %192(ptr noundef %195)
  %197 = load ptr, ptr %19, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %197, i8 0, i64 24, i1 false)
  %198 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %198) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %199

199:                                              ; preds = %186
  %200 = load i64, ptr %18, align 8, !tbaa !9
  %201 = add i64 %200, 1
  store i64 %201, ptr %18, align 8, !tbaa !9
  br label %170, !llvm.loop !21

202:                                              ; preds = %174
  %203 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %203) #7
  %204 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %204, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %205

205:                                              ; preds = %202, %156, %153, %148
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %206 = load i32, ptr %3, align 4
  ret i32 %206
}

; Function Attrs: nounwind uwtable
declare hidden void @load_all_libraries_once() #0

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

; Function Attrs: nounwind uwtable
declare hidden i32 @wrap_backend_ids(ptr noundef, i64 noundef, ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { 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 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !12, i64 0}
!18 = !{!"onnxifi_backend_id_wrapper", !12, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!18, !6, i64 16}
!20 = !{!18, !6, i64 8}
!21 = distinct !{!21, !15}


; 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"

%struct.onnxifi_library = type { ptr, i32, %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@num_libraries = external hidden local_unnamed_addr global i32, align 4
@libraries = external hidden local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [97 x i8], align 1
@__PRETTY_FUNCTION__.onnxGetBackendIDs = external hidden unnamed_addr constant [56 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @onnxGetBackendIDs(ptr noundef writeonly %0, ptr nocapture noundef %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  tail call void @load_all_libraries_once()
  %5 = icmp eq ptr %0, null
  br i1 %5, label %.thread, label %6

6:                                                ; preds = %2
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %.thread, label %8

8:                                                ; preds = %6
  %9 = shl i64 %7, 3
  %calloc = tail call ptr @calloc(i64 1, i64 %9)
  %10 = icmp eq ptr %calloc, null
  br i1 %10, label %._crit_edge, label %.thread

.thread:                                          ; preds = %8, %2, %6
  %11 = phi i64 [ 0, %6 ], [ 0, %2 ], [ %7, %8 ]
  %.078 = phi ptr [ null, %6 ], [ null, %2 ], [ %calloc, %8 ]
  %12 = load i32, ptr @num_libraries, align 4, !tbaa !9
  %.not135 = icmp eq i32 %12, 0
  br i1 %.not135, label %.thread102, label %.lr.ph

.lr.ph:                                           ; preds = %.thread, %43
  %.069129 = phi i64 [ %.372, %43 ], [ 0, %.thread ]
  %.077128 = phi i64 [ %44, %43 ], [ 0, %.thread ]
  %.080127 = phi i64 [ %.282, %43 ], [ 0, %.thread ]
  %13 = icmp ugt i64 %11, %.069129
  br i1 %13, label %14, label %37

14:                                               ; preds = %.lr.ph
  %15 = sub i64 %11, %.069129
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store i64 %15, ptr %3, align 8, !tbaa !5
  %16 = load ptr, ptr @libraries, align 8, !tbaa !11
  %17 = getelementptr inbounds %struct.onnxifi_library, ptr %16, i64 %.077128, i32 2
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  %19 = getelementptr inbounds ptr, ptr %.078, i64 %.069129
  %20 = call i32 %18(ptr noundef %19, ptr noundef nonnull %3) #7
  %21 = load i64, ptr %3, align 8
  %22 = call i64 @llvm.umin.i64(i64 %21, i64 %15)
  %switch = icmp ult i32 %20, 2
  br i1 %switch, label %23, label %.thread107

23:                                               ; preds = %14
  %24 = load ptr, ptr @libraries, align 8, !tbaa !11
  %25 = getelementptr inbounds %struct.onnxifi_library, ptr %24, i64 %.077128
  %26 = call i32 @wrap_backend_ids(ptr noundef %25, i64 noundef %22, ptr noundef %19)
  %.not93 = icmp eq i32 %26, 0
  br i1 %.not93, label %34, label %.preheader

.preheader:                                       ; preds = %23
  %.not136 = icmp eq i64 %22, 0
  br i1 %.not136, label %.thread107, label %.lr.ph132

.lr.ph132:                                        ; preds = %.preheader, %.lr.ph132
  %.067131 = phi i64 [ %33, %.lr.ph132 ], [ 0, %.preheader ]
  %27 = load ptr, ptr @libraries, align 8, !tbaa !11
  %28 = getelementptr inbounds %struct.onnxifi_library, ptr %27, i64 %.077128, i32 2, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = getelementptr inbounds ptr, ptr %.078, i64 %.067131
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = call i32 %29(ptr noundef %31) #7
  store ptr null, ptr %30, align 8, !tbaa !11
  %33 = add nuw i64 %.067131, 1
  %exitcond.not = icmp eq i64 %33, %22
  br i1 %exitcond.not, label %.thread107, label %.lr.ph132, !llvm.loop !14

.thread107:                                       ; preds = %14, %.lr.ph132, %.preheader
  %.1.ph = phi i32 [ %26, %.preheader ], [ %26, %.lr.ph132 ], [ %20, %14 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %.loopexit

34:                                               ; preds = %23
  %35 = add i64 %22, %.080127
  %36 = load i64, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %43

37:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  store i64 0, ptr %4, align 8, !tbaa !5
  %38 = load ptr, ptr @libraries, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct.onnxifi_library, ptr %38, i64 %.077128, i32 2
  %40 = load ptr, ptr %39, align 8, !tbaa !13
  %41 = call i32 %40(ptr noundef null, ptr noundef nonnull %4) #7
  %.not92 = icmp eq i32 %41, 1
  %42 = load i64, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br i1 %.not92, label %43, label %.loopexit

43:                                               ; preds = %34, %37
  %.282 = phi i64 [ %35, %34 ], [ %.080127, %37 ]
  %.pn = phi i64 [ %36, %34 ], [ %42, %37 ]
  %.372 = add i64 %.pn, %.069129
  %44 = add nuw nsw i64 %.077128, 1
  %45 = load i32, ptr @num_libraries, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = icmp ult i64 %44, %46
  br i1 %47, label %.lr.ph, label %.thread102.loopexit, !llvm.loop !16

.thread102.loopexit:                              ; preds = %43
  %48 = shl i64 %.282, 3
  br label %.thread102

.thread102:                                       ; preds = %.thread102.loopexit, %.thread
  %.080.lcssa = phi i64 [ 0, %.thread ], [ %48, %.thread102.loopexit ]
  %.069.lcssa = phi i64 [ 0, %.thread ], [ %.372, %.thread102.loopexit ]
  br i1 %5, label %49, label %50

49:                                               ; preds = %.thread102
  store i64 %.069.lcssa, ptr %1, align 8, !tbaa !5
  br label %66

50:                                               ; preds = %.thread102
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %0, ptr align 8 %.078, i64 %.080.lcssa, i1 false)
  call void @free(ptr noundef %.078) #7
  store i64 %.069.lcssa, ptr %1, align 8, !tbaa !5
  %.not94 = icmp ugt i64 %.069.lcssa, %11
  %51 = zext i1 %.not94 to i32
  br label %66

.loopexit:                                        ; preds = %37, %.thread107
  %.4 = phi i32 [ %.1.ph, %.thread107 ], [ %41, %37 ]
  %.not137 = icmp eq i64 %.080127, 0
  br i1 %.not137, label %._crit_edge, label %.lr.ph134

._crit_edge:                                      ; preds = %57, %8, %.loopexit
  %.4157 = phi i32 [ %.4, %.loopexit ], [ 1025, %8 ], [ %.4, %57 ]
  %.179156 = phi ptr [ %.078, %.loopexit ], [ null, %8 ], [ %.078, %57 ]
  call void @free(ptr noundef %.179156) #7
  br label %66

.lr.ph134:                                        ; preds = %.loopexit, %57
  %.066133 = phi i64 [ %65, %57 ], [ 0, %.loopexit ]
  %52 = getelementptr inbounds ptr, ptr %.078, i64 %.066133
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  %54 = load i32, ptr %53, align 8, !tbaa !17
  %55 = icmp eq i32 %54, 786249572
  br i1 %55, label %57, label %56

56:                                               ; preds = %.lr.ph134
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 431, ptr noundef nonnull @__PRETTY_FUNCTION__.onnxGetBackendIDs) #8
  unreachable

57:                                               ; preds = %.lr.ph134
  %58 = getelementptr inbounds i8, ptr %53, i64 16
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = getelementptr inbounds i8, ptr %59, i64 24
  %61 = load ptr, ptr %60, align 8, !tbaa !13
  %62 = getelementptr inbounds i8, ptr %53, i64 8
  %63 = load ptr, ptr %62, align 8, !tbaa !20
  %64 = call i32 %61(ptr noundef %63) #7
  call void @free(ptr noundef nonnull %53) #7
  %65 = add nuw i64 %.066133, 1
  %exitcond151.not = icmp eq i64 %65, %.080127
  br i1 %exitcond151.not, label %._crit_edge, label %.lr.ph134, !llvm.loop !21

66:                                               ; preds = %._crit_edge, %50, %49
  %.0 = phi i32 [ %.4157, %._crit_edge ], [ 1, %49 ], [ %51, %50 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden void @load_all_libraries_once() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden i32 @wrap_backend_ids(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress 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) #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #5

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #6

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !10, i64 0}
!18 = !{!"onnxifi_backend_id_wrapper", !10, i64 0, !12, i64 8, !12, i64 16}
!19 = !{!18, !12, i64 16}
!20 = !{!18, !12, i64 8}
!21 = distinct !{!21, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass