; LLVM IR from attractivechaos/klib :: kmath (kmin_hj)

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

; Function Attrs: nounwind uwtable
define dso_local double @kmin_hj(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, double noundef %4, double noundef %5, i32 noundef %6) #0 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca double, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca double, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store double %4, ptr %12, align 8, !tbaa !11
  store double %5, ptr %13, align 8, !tbaa !11
  store i32 %6, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !9
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = call noalias ptr @calloc(i64 noundef %24, i64 noundef 8) #7
  store ptr %25, ptr %17, align 8, !tbaa !5
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = call noalias ptr @calloc(i64 noundef %27, i64 noundef 8) #7
  store ptr %28, ptr %18, align 8, !tbaa !5
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %59, %7
  %30 = load i32, ptr %20, align 4, !tbaa !9
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = icmp ne i32 %30, %31
  br i1 %32, label %33, label %62

33:                                               ; preds = %29
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = load i32, ptr %20, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds double, ptr %34, i64 %36
  %38 = load double, ptr %37, align 8, !tbaa !11
  %39 = call double @llvm.fabs.f64(double %38)
  %40 = load double, ptr %12, align 8, !tbaa !11
  %41 = fmul double %39, %40
  %42 = load ptr, ptr %18, align 8, !tbaa !5
  %43 = load i32, ptr %20, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds double, ptr %42, i64 %44
  store double %41, ptr %45, align 8, !tbaa !11
  %46 = load ptr, ptr %18, align 8, !tbaa !5
  %47 = load i32, ptr %20, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds double, ptr %46, i64 %48
  %50 = load double, ptr %49, align 8, !tbaa !11
  %51 = fcmp oeq double %50, 0.000000e+00
  br i1 %51, label %52, label %58

52:                                               ; preds = %33
  %53 = load double, ptr %12, align 8, !tbaa !11
  %54 = load ptr, ptr %18, align 8, !tbaa !5
  %55 = load i32, ptr %20, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds double, ptr %54, i64 %56
  store double %53, ptr %57, align 8, !tbaa !11
  br label %58

58:                                               ; preds = %52, %33
  br label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %20, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %20, align 4, !tbaa !9
  br label %29, !llvm.loop !13

62:                                               ; preds = %29
  %63 = load double, ptr %12, align 8, !tbaa !11
  store double %63, ptr %19, align 8, !tbaa !11
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = call double %64(i32 noundef %65, ptr noundef %66, ptr noundef %67)
  store double %68, ptr %15, align 8, !tbaa !11
  store double %68, ptr %16, align 8, !tbaa !11
  %69 = load i32, ptr %21, align 4, !tbaa !9
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %21, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %252, %62
  %72 = load ptr, ptr %17, align 8, !tbaa !5
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = mul i64 %75, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %72, ptr align 8 %73, i64 %76, i1 false)
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = load ptr, ptr %17, align 8, !tbaa !5
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = load double, ptr %15, align 8, !tbaa !11
  %82 = load ptr, ptr %18, align 8, !tbaa !5
  %83 = call double @__kmin_hj_aux(ptr noundef %77, i32 noundef %78, ptr noundef %79, ptr noundef %80, double noundef %81, ptr noundef %82, ptr noundef %21)
  store double %83, ptr %16, align 8, !tbaa !11
  br label %84

84:                                               ; preds = %221, %71
  %85 = load double, ptr %16, align 8, !tbaa !11
  %86 = load double, ptr %15, align 8, !tbaa !11
  %87 = fcmp olt double %85, %86
  br i1 %87, label %88, label %222

88:                                               ; preds = %84
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %157, %88
  %90 = load i32, ptr %20, align 4, !tbaa !9
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = icmp ne i32 %90, %91
  br i1 %92, label %93, label %160

93:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = load i32, ptr %20, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds double, ptr %94, i64 %96
  %98 = load double, ptr %97, align 8, !tbaa !11
  store double %98, ptr %22, align 8, !tbaa !11
  %99 = load ptr, ptr %17, align 8, !tbaa !5
  %100 = load i32, ptr %20, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds double, ptr %99, i64 %101
  %103 = load double, ptr %102, align 8, !tbaa !11
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = load i32, ptr %20, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds double, ptr %104, i64 %106
  %108 = load double, ptr %107, align 8, !tbaa !11
  %109 = fcmp ogt double %103, %108
  br i1 %109, label %110, label %117

110:                                              ; preds = %93
  %111 = load ptr, ptr %18, align 8, !tbaa !5
  %112 = load i32, ptr %20, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds double, ptr %111, i64 %113
  %115 = load double, ptr %114, align 8, !tbaa !11
  %116 = call double @llvm.fabs.f64(double %115)
  br label %125

117:                                              ; preds = %93
  %118 = load ptr, ptr %18, align 8, !tbaa !5
  %119 = load i32, ptr %20, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds double, ptr %118, i64 %120
  %122 = load double, ptr %121, align 8, !tbaa !11
  %123 = call double @llvm.fabs.f64(double %122)
  %124 = fsub double 0.000000e+00, %123
  br label %125

125:                                              ; preds = %117, %110
  %126 = phi double [ %116, %110 ], [ %124, %117 ]
  %127 = load ptr, ptr %18, align 8, !tbaa !5
  %128 = load i32, ptr %20, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds double, ptr %127, i64 %129
  store double %126, ptr %130, align 8, !tbaa !11
  %131 = load ptr, ptr %17, align 8, !tbaa !5
  %132 = load i32, ptr %20, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds double, ptr %131, i64 %133
  %135 = load double, ptr %134, align 8, !tbaa !11
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = load i32, ptr %20, align 4, !tbaa !9
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds double, ptr %136, i64 %138
  store double %135, ptr %139, align 8, !tbaa !11
  %140 = load ptr, ptr %17, align 8, !tbaa !5
  %141 = load i32, ptr %20, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds double, ptr %140, i64 %142
  %144 = load double, ptr %143, align 8, !tbaa !11
  %145 = load ptr, ptr %17, align 8, !tbaa !5
  %146 = load i32, ptr %20, align 4, !tbaa !9
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds double, ptr %145, i64 %147
  %149 = load double, ptr %148, align 8, !tbaa !11
  %150 = fadd double %144, %149
  %151 = load double, ptr %22, align 8, !tbaa !11
  %152 = fsub double %150, %151
  %153 = load ptr, ptr %17, align 8, !tbaa !5
  %154 = load i32, ptr %20, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds double, ptr %153, i64 %155
  store double %152, ptr %156, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %157

157:                                              ; preds = %125
  %158 = load i32, ptr %20, align 4, !tbaa !9
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %20, align 4, !tbaa !9
  br label %89, !llvm.loop !15

160:                                              ; preds = %89
  %161 = load double, ptr %16, align 8, !tbaa !11
  store double %161, ptr %15, align 8, !tbaa !11
  %162 = load i32, ptr %21, align 4, !tbaa !9
  %163 = load i32, ptr %14, align 4, !tbaa !9
  %164 = icmp sge i32 %162, %163
  br i1 %164, label %165, label %166

165:                                              ; preds = %160
  br label %222

166:                                              ; preds = %160
  %167 = load ptr, ptr %8, align 8, !tbaa !5
  %168 = load i32, ptr %9, align 4, !tbaa !9
  %169 = load ptr, ptr %17, align 8, !tbaa !5
  %170 = load ptr, ptr %11, align 8, !tbaa !5
  %171 = call double %167(i32 noundef %168, ptr noundef %169, ptr noundef %170)
  store double %171, ptr %16, align 8, !tbaa !11
  %172 = load i32, ptr %21, align 4, !tbaa !9
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %21, align 4, !tbaa !9
  %174 = load ptr, ptr %8, align 8, !tbaa !5
  %175 = load i32, ptr %9, align 4, !tbaa !9
  %176 = load ptr, ptr %17, align 8, !tbaa !5
  %177 = load ptr, ptr %11, align 8, !tbaa !5
  %178 = load double, ptr %16, align 8, !tbaa !11
  %179 = load ptr, ptr %18, align 8, !tbaa !5
  %180 = call double @__kmin_hj_aux(ptr noundef %174, i32 noundef %175, ptr noundef %176, ptr noundef %177, double noundef %178, ptr noundef %179, ptr noundef %21)
  store double %180, ptr %16, align 8, !tbaa !11
  %181 = load double, ptr %16, align 8, !tbaa !11
  %182 = load double, ptr %15, align 8, !tbaa !11
  %183 = fcmp oge double %181, %182
  br i1 %183, label %184, label %185

184:                                              ; preds = %166
  br label %222

185:                                              ; preds = %166
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %186

186:                                              ; preds = %213, %185
  %187 = load i32, ptr %20, align 4, !tbaa !9
  %188 = load i32, ptr %9, align 4, !tbaa !9
  %189 = icmp ne i32 %187, %188
  br i1 %189, label %190, label %216

190:                                              ; preds = %186
  %191 = load ptr, ptr %17, align 8, !tbaa !5
  %192 = load i32, ptr %20, align 4, !tbaa !9
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds double, ptr %191, i64 %193
  %195 = load double, ptr %194, align 8, !tbaa !11
  %196 = load ptr, ptr %10, align 8, !tbaa !5
  %197 = load i32, ptr %20, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds double, ptr %196, i64 %198
  %200 = load double, ptr %199, align 8, !tbaa !11
  %201 = fsub double %195, %200
  %202 = call double @llvm.fabs.f64(double %201)
  %203 = load ptr, ptr %18, align 8, !tbaa !5
  %204 = load i32, ptr %20, align 4, !tbaa !9
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds double, ptr %203, i64 %205
  %207 = load double, ptr %206, align 8, !tbaa !11
  %208 = call double @llvm.fabs.f64(double %207)
  %209 = fmul double 5.000000e-01, %208
  %210 = fcmp ogt double %202, %209
  br i1 %210, label %211, label %212

211:                                              ; preds = %190
  br label %216

212:                                              ; preds = %190
  br label %213

213:                                              ; preds = %212
  %214 = load i32, ptr %20, align 4, !tbaa !9
  %215 = add nsw i32 %214, 1
  store i32 %215, ptr %20, align 4, !tbaa !9
  br label %186, !llvm.loop !16

216:                                              ; preds = %211, %186
  %217 = load i32, ptr %20, align 4, !tbaa !9
  %218 = load i32, ptr %9, align 4, !tbaa !9
  %219 = icmp eq i32 %217, %218
  br i1 %219, label %220, label %221

220:                                              ; preds = %216
  br label %222

221:                                              ; preds = %216
  br label %84, !llvm.loop !17

222:                                              ; preds = %220, %184, %165, %84
  %223 = load double, ptr %19, align 8, !tbaa !11
  %224 = load double, ptr %13, align 8, !tbaa !11
  %225 = fcmp oge double %223, %224
  br i1 %225, label %226, label %251

226:                                              ; preds = %222
  %227 = load i32, ptr %21, align 4, !tbaa !9
  %228 = load i32, ptr %14, align 4, !tbaa !9
  %229 = icmp sge i32 %227, %228
  br i1 %229, label %230, label %231

230:                                              ; preds = %226
  br label %253

231:                                              ; preds = %226
  %232 = load double, ptr %12, align 8, !tbaa !11
  %233 = load double, ptr %19, align 8, !tbaa !11
  %234 = fmul double %233, %232
  store double %234, ptr %19, align 8, !tbaa !11
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %235

235:                                              ; preds = %247, %231
  %236 = load i32, ptr %20, align 4, !tbaa !9
  %237 = load i32, ptr %9, align 4, !tbaa !9
  %238 = icmp ne i32 %236, %237
  br i1 %238, label %239, label %250

239:                                              ; preds = %235
  %240 = load double, ptr %12, align 8, !tbaa !11
  %241 = load ptr, ptr %18, align 8, !tbaa !5
  %242 = load i32, ptr %20, align 4, !tbaa !9
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds double, ptr %241, i64 %243
  %245 = load double, ptr %244, align 8, !tbaa !11
  %246 = fmul double %245, %240
  store double %246, ptr %244, align 8, !tbaa !11
  br label %247

247:                                              ; preds = %239
  %248 = load i32, ptr %20, align 4, !tbaa !9
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %20, align 4, !tbaa !9
  br label %235, !llvm.loop !18

250:                                              ; preds = %235
  br label %252

251:                                              ; preds = %222
  br label %253

252:                                              ; preds = %250
  br label %71

253:                                              ; preds = %251, %230
  %254 = load ptr, ptr %17, align 8, !tbaa !5
  call void @free(ptr noundef %254) #6
  %255 = load ptr, ptr %18, align 8, !tbaa !5
  call void @free(ptr noundef %255) #6
  %256 = load double, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  ret double %256
}

; 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,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

; 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 uwtable
declare hidden double @__kmin_hj_aux(ptr noundef, i32 noundef, ptr noundef, ptr noundef, double noundef, ptr 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: nounwind
declare void @free(ptr noundef) #5

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,1) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}


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

; Function Attrs: nounwind uwtable
define dso_local double @kmin_hj(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, double noundef %4, double noundef %5, i32 noundef %6) local_unnamed_addr #0 {
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  %9 = sext i32 %1 to i64
  %10 = tail call noalias ptr @calloc(i64 noundef %9, i64 noundef 8) #8
  %11 = tail call noalias ptr @calloc(i64 noundef %9, i64 noundef 8) #8
  %.not113 = icmp eq i32 %1, 0
  br i1 %.not113, label %._crit_edge.thread, label %.lr.ph.preheader

._crit_edge.thread:                               ; preds = %7
  %12 = tail call double %0(i32 noundef %1, ptr noundef %2, ptr noundef %3) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %.split.us.preheader

.lr.ph.preheader:                                 ; preds = %7
  %13 = zext i32 %1 to i64
  %min.iters.check = icmp ult i32 %1, 4
  br i1 %min.iters.check, label %.lr.ph.preheader206, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %13, 4294967292
  %broadcast.splatinsert = insertelement <2 x double> poison, double %4, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %14 = getelementptr inbounds double, ptr %2, i64 %index
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %wide.load = load <2 x double>, ptr %14, align 8, !tbaa !9
  %wide.load171 = load <2 x double>, ptr %15, align 8, !tbaa !9
  %16 = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %wide.load)
  %17 = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %wide.load171)
  %18 = fmul <2 x double> %16, %broadcast.splat
  %19 = fmul <2 x double> %17, %broadcast.splat
  %20 = getelementptr inbounds double, ptr %11, i64 %index
  %21 = fcmp oeq <2 x double> %18, zeroinitializer
  %22 = fcmp oeq <2 x double> %19, zeroinitializer
  %23 = select <2 x i1> %21, <2 x double> %broadcast.splat, <2 x double> %18
  %24 = select <2 x i1> %22, <2 x double> %broadcast.splat, <2 x double> %19
  %25 = getelementptr inbounds i8, ptr %20, i64 16
  store <2 x double> %23, ptr %20, align 8, !tbaa !9
  store <2 x double> %24, ptr %25, align 8, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %26 = icmp eq i64 %index.next, %n.vec
  br i1 %26, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %13
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader206

.lr.ph.preheader206:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader206, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader206 ]
  %27 = getelementptr inbounds double, ptr %2, i64 %indvars.iv
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = tail call double @llvm.fabs.f64(double %28)
  %30 = fmul double %29, %4
  %31 = getelementptr inbounds double, ptr %11, i64 %indvars.iv
  %32 = fcmp oeq double %30, 0.000000e+00
  %storemerge = select i1 %32, double %4, double %30
  store double %storemerge, ptr %31, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.not = icmp eq i64 %indvars.iv.next, %13
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %33 = tail call double %0(i32 noundef %1, ptr noundef nonnull %2, ptr noundef %3) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  %34 = shl nsw i64 %9, 3
  br i1 %.not113, label %.split.us.preheader, label %.split.preheader

.split.preheader:                                 ; preds = %._crit_edge
  %35 = zext i32 %1 to i64
  %min.iters.check189 = icmp eq i32 %1, 1
  %n.vec192 = and i64 %13, 4294967294
  %cmp.n200 = icmp eq i64 %n.vec192, %13
  %min.iters.check174 = icmp ult i32 %1, 4
  %n.vec177 = and i64 %13, 4294967292
  %broadcast.splatinsert183 = insertelement <2 x double> poison, double %4, i64 0
  %broadcast.splat184 = shufflevector <2 x double> %broadcast.splatinsert183, <2 x double> poison, <2 x i32> zeroinitializer
  %cmp.n186 = icmp eq i64 %n.vec177, %13
  br label %.split

.split.us.preheader:                              ; preds = %._crit_edge.thread, %._crit_edge
  %36 = phi i64 [ 0, %._crit_edge.thread ], [ %34, %._crit_edge ]
  %37 = phi double [ %12, %._crit_edge.thread ], [ %33, %._crit_edge ]
  br label %.split.us

.split.us:                                        ; preds = %.split.us.preheader, %.loopexit110.us
  %.098.us = phi double [ %42, %.loopexit110.us ], [ %4, %.split.us.preheader ]
  %.0.us = phi double [ %.2.us, %.loopexit110.us ], [ %37, %.split.us.preheader ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %2, i64 %36, i1 false)
  %38 = call double @__kmin_hj_aux(ptr noundef %0, i32 noundef 0, ptr noundef %10, ptr noundef %3, double noundef %.0.us, ptr noundef %11, ptr noundef nonnull %8)
  %39 = fcmp olt double %38, %.0.us
  br i1 %39, label %._crit_edge118.us.us, label %.thread.us

.thread.us:                                       ; preds = %._crit_edge118.us.us, %44, %.split.us
  %.1100.us = phi double [ %38, %.split.us ], [ %48, %44 ], [ %38, %._crit_edge118.us.us ]
  %.2.us = phi double [ %.0.us, %.split.us ], [ %38, %44 ], [ %38, %._crit_edge118.us.us ]
  %40 = fcmp oge double %.098.us, %5
  %41 = load i32, ptr %8, align 4
  %.not107.us = icmp slt i32 %41, %6
  %or.cond.us = select i1 %40, i1 %.not107.us, i1 false
  br i1 %or.cond.us, label %.loopexit110.us, label %.split144.us

.loopexit110.us:                                  ; preds = %.thread.us
  %42 = fmul double %.098.us, %4
  br label %.split.us

._crit_edge118.us.us:                             ; preds = %.split.us
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %.not105.us.us = icmp slt i32 %43, %6
  br i1 %.not105.us.us, label %44, label %.thread.us

44:                                               ; preds = %._crit_edge118.us.us
  %45 = call double %0(i32 noundef 0, ptr noundef %10, ptr noundef %3) #7
  %46 = load i32, ptr %8, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %8, align 4, !tbaa !5
  %48 = call double @__kmin_hj_aux(ptr noundef %0, i32 noundef 0, ptr noundef %10, ptr noundef %3, double noundef %45, ptr noundef %11, ptr noundef nonnull %8)
  br label %.thread.us

.split.loopexit:                                  ; preds = %.lr.ph142, %middle.block172
  br label %.split, !llvm.loop !16

.split:                                           ; preds = %.split.loopexit, %.split.preheader
  %.098 = phi double [ %4, %.split.preheader ], [ %96, %.split.loopexit ]
  %.0 = phi double [ %33, %.split.preheader ], [ %.2, %.split.loopexit ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %2, i64 %34, i1 false)
  %49 = call double @__kmin_hj_aux(ptr noundef %0, i32 noundef %1, ptr noundef %10, ptr noundef %3, double noundef %.0, ptr noundef nonnull %11, ptr noundef nonnull %8)
  %50 = fcmp olt double %49, %.0
  br i1 %50, label %.lr.ph117.preheader, label %.thread

.loopexit:                                        ; preds = %.preheader
  %51 = fcmp olt double %80, %.099125
  br i1 %51, label %.lr.ph117.preheader, label %.thread

.lr.ph117.preheader:                              ; preds = %.split, %.loopexit
  %.099125 = phi double [ %80, %.loopexit ], [ %49, %.split ]
  br i1 %min.iters.check189, label %.lr.ph117.preheader201, label %vector.body194

vector.body194:                                   ; preds = %.lr.ph117.preheader, %vector.body194
  %index195 = phi i64 [ %index.next199, %vector.body194 ], [ 0, %.lr.ph117.preheader ]
  %52 = getelementptr inbounds double, ptr %2, i64 %index195
  %wide.load196 = load <2 x double>, ptr %52, align 8, !tbaa !9
  %53 = getelementptr inbounds double, ptr %10, i64 %index195
  %wide.load197 = load <2 x double>, ptr %53, align 8, !tbaa !9
  %54 = fcmp ogt <2 x double> %wide.load197, %wide.load196
  %55 = getelementptr inbounds double, ptr %11, i64 %index195
  %wide.load198 = load <2 x double>, ptr %55, align 8, !tbaa !9
  %56 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %wide.load198)
  %57 = fsub <2 x double> zeroinitializer, %56
  %58 = select <2 x i1> %54, <2 x double> %56, <2 x double> %57
  store <2 x double> %58, ptr %55, align 8, !tbaa !9
  store <2 x double> %wide.load197, ptr %52, align 8, !tbaa !9
  %59 = fadd <2 x double> %wide.load197, %wide.load197
  %60 = fsub <2 x double> %59, %wide.load196
  store <2 x double> %60, ptr %53, align 8, !tbaa !9
  %index.next199 = add nuw i64 %index195, 2
  %61 = icmp eq i64 %index.next199, %n.vec192
  br i1 %61, label %middle.block187, label %vector.body194, !llvm.loop !17

middle.block187:                                  ; preds = %vector.body194
  br i1 %cmp.n200, label %._crit_edge118, label %.lr.ph117.preheader201

.lr.ph117.preheader201:                           ; preds = %middle.block187, %.lr.ph117.preheader
  %indvars.iv150.ph = phi i64 [ 0, %.lr.ph117.preheader ], [ %n.vec192, %middle.block187 ]
  br label %.lr.ph117

.lr.ph117:                                        ; preds = %.lr.ph117.preheader201, %.lr.ph117
  %indvars.iv150 = phi i64 [ %indvars.iv.next151, %.lr.ph117 ], [ %indvars.iv150.ph, %.lr.ph117.preheader201 ]
  %62 = getelementptr inbounds double, ptr %2, i64 %indvars.iv150
  %63 = load double, ptr %62, align 8, !tbaa !9
  %64 = getelementptr inbounds double, ptr %10, i64 %indvars.iv150
  %65 = load double, ptr %64, align 8, !tbaa !9
  %66 = fcmp ogt double %65, %63
  %67 = getelementptr inbounds double, ptr %11, i64 %indvars.iv150
  %68 = load double, ptr %67, align 8, !tbaa !9
  %69 = call double @llvm.fabs.f64(double %68)
  %70 = fsub double 0.000000e+00, %69
  %71 = select i1 %66, double %69, double %70
  %72 = getelementptr inbounds double, ptr %11, i64 %indvars.iv150
  store double %71, ptr %72, align 8, !tbaa !9
  store double %65, ptr %62, align 8, !tbaa !9
  %73 = fadd double %65, %65
  %74 = fsub double %73, %63
  store double %74, ptr %64, align 8, !tbaa !9
  %indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1
  %.not104 = icmp eq i64 %indvars.iv.next151, %35
  br i1 %.not104, label %._crit_edge118, label %.lr.ph117, !llvm.loop !18

._crit_edge118:                                   ; preds = %.lr.ph117, %middle.block187
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %.not105 = icmp slt i32 %75, %6
  br i1 %.not105, label %76, label %.thread

76:                                               ; preds = %._crit_edge118
  %77 = call double %0(i32 noundef %1, ptr noundef nonnull %10, ptr noundef %3) #7
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %8, align 4, !tbaa !5
  %80 = call double @__kmin_hj_aux(ptr noundef %0, i32 noundef %1, ptr noundef nonnull %10, ptr noundef %3, double noundef %77, ptr noundef nonnull %11, ptr noundef nonnull %8)
  %81 = fcmp ult double %80, %.099125
  br i1 %81, label %.preheader, label %.thread

82:                                               ; preds = %.preheader
  %indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 1
  %.not106 = icmp eq i64 %indvars.iv.next154, %35
  br i1 %.not106, label %.thread, label %.preheader, !llvm.loop !19

.preheader:                                       ; preds = %76, %82
  %indvars.iv153 = phi i64 [ %indvars.iv.next154, %82 ], [ 0, %76 ]
  %83 = getelementptr inbounds double, ptr %10, i64 %indvars.iv153
  %84 = load double, ptr %83, align 8, !tbaa !9
  %85 = getelementptr inbounds double, ptr %2, i64 %indvars.iv153
  %86 = load double, ptr %85, align 8, !tbaa !9
  %87 = fsub double %84, %86
  %88 = call double @llvm.fabs.f64(double %87)
  %89 = getelementptr inbounds double, ptr %11, i64 %indvars.iv153
  %90 = load double, ptr %89, align 8, !tbaa !9
  %91 = call double @llvm.fabs.f64(double %90)
  %92 = fmul double %91, 5.000000e-01
  %93 = fcmp ogt double %88, %92
  br i1 %93, label %.loopexit, label %82

.thread:                                          ; preds = %.loopexit, %._crit_edge118, %76, %82, %.split
  %.1100 = phi double [ %49, %.split ], [ %80, %82 ], [ %80, %.loopexit ], [ %.099125, %._crit_edge118 ], [ %80, %76 ]
  %.2 = phi double [ %.0, %.split ], [ %.099125, %82 ], [ %.099125, %76 ], [ %.099125, %._crit_edge118 ], [ %.099125, %.loopexit ]
  %94 = fcmp oge double %.098, %5
  %95 = load i32, ptr %8, align 4
  %.not107 = icmp slt i32 %95, %6
  %or.cond = select i1 %94, i1 %.not107, i1 false
  br i1 %or.cond, label %.lr.ph142.preheader, label %.split144.us

.lr.ph142.preheader:                              ; preds = %.thread
  %96 = fmul double %.098, %4
  br i1 %min.iters.check174, label %.lr.ph142.preheader202, label %vector.body179

vector.body179:                                   ; preds = %.lr.ph142.preheader, %vector.body179
  %index180 = phi i64 [ %index.next185, %vector.body179 ], [ 0, %.lr.ph142.preheader ]
  %97 = getelementptr inbounds double, ptr %11, i64 %index180
  %98 = getelementptr inbounds i8, ptr %97, i64 16
  %wide.load181 = load <2 x double>, ptr %97, align 8, !tbaa !9
  %wide.load182 = load <2 x double>, ptr %98, align 8, !tbaa !9
  %99 = fmul <2 x double> %wide.load181, %broadcast.splat184
  %100 = fmul <2 x double> %wide.load182, %broadcast.splat184
  store <2 x double> %99, ptr %97, align 8, !tbaa !9
  store <2 x double> %100, ptr %98, align 8, !tbaa !9
  %index.next185 = add nuw i64 %index180, 4
  %101 = icmp eq i64 %index.next185, %n.vec177
  br i1 %101, label %middle.block172, label %vector.body179, !llvm.loop !20

middle.block172:                                  ; preds = %vector.body179
  br i1 %cmp.n186, label %.split.loopexit, label %.lr.ph142.preheader202

.lr.ph142.preheader202:                           ; preds = %middle.block172, %.lr.ph142.preheader
  %indvars.iv156.ph = phi i64 [ 0, %.lr.ph142.preheader ], [ %n.vec177, %middle.block172 ]
  br label %.lr.ph142

.lr.ph142:                                        ; preds = %.lr.ph142.preheader202, %.lr.ph142
  %indvars.iv156 = phi i64 [ %indvars.iv.next157, %.lr.ph142 ], [ %indvars.iv156.ph, %.lr.ph142.preheader202 ]
  %102 = getelementptr inbounds double, ptr %11, i64 %indvars.iv156
  %103 = load double, ptr %102, align 8, !tbaa !9
  %104 = fmul double %103, %4
  store double %104, ptr %102, align 8, !tbaa !9
  %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
  %.not108 = icmp eq i64 %indvars.iv.next157, %35
  br i1 %.not108, label %.split.loopexit, label %.lr.ph142, !llvm.loop !21

.split144.us:                                     ; preds = %.thread, %.thread.us
  %.us-phi145 = phi double [ %.1100.us, %.thread.us ], [ %.1100, %.thread ]
  call void @free(ptr noundef %10) #7
  call void @free(ptr noundef %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  ret double %.us-phi145
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

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

; Function Attrs: nounwind uwtable
declare hidden double @__kmin_hj_aux(ptr noundef, i32 noundef, ptr noundef, ptr noundef, double noundef, ptr 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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fabs.v2f64(<2 x double>) #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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !13, !14}
!18 = distinct !{!18, !12, !14, !13}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12, !13, !14}
!21 = distinct !{!21, !12, !14, !13}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass