; LLVM IR from jgaeddert/liquid-dsp :: sandbox (minsearch2_test)

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

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [80 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local double @function(double noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, 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 i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 10, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store double 0x3FF3333340000000, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store double 2.000000e+00, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store double 0x3FE6666660000000, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store double 0x3EB0C6F7A0000000, ptr %8, align 8, !tbaa !9
  %18 = load double, ptr %4, align 8, !tbaa !9
  %19 = load double, ptr %6, align 8, !tbaa !9
  %20 = fsub double %18, %19
  store double %20, ptr %3, align 8, !tbaa !9
  %21 = load double, ptr %4, align 8, !tbaa !9
  %22 = load double, ptr %6, align 8, !tbaa !9
  %23 = fadd double %21, %22
  store double %23, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store double 0.000000e+00, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %124, %0
  %25 = load i32, ptr %14, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = icmp ult i32 %25, %26
  br i1 %27, label %28, label %127

28:                                               ; preds = %24
  %29 = load double, ptr %3, align 8, !tbaa !9
  %30 = load double, ptr %5, align 8, !tbaa !9
  %31 = fadd double %29, %30
  %32 = fmul double 5.000000e-01, %31
  store double %32, ptr %4, align 8, !tbaa !9
  %33 = load double, ptr %3, align 8, !tbaa !9
  %34 = call double @function(double noundef %33)
  store double %34, ptr %9, align 8, !tbaa !9
  %35 = load double, ptr %4, align 8, !tbaa !9
  %36 = call double @function(double noundef %35)
  store double %36, ptr %10, align 8, !tbaa !9
  %37 = load double, ptr %5, align 8, !tbaa !9
  %38 = call double @function(double noundef %37)
  store double %38, ptr %11, align 8, !tbaa !9
  %39 = load double, ptr %5, align 8, !tbaa !9
  %40 = load double, ptr %4, align 8, !tbaa !9
  %41 = fcmp ogt double %39, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %28
  br label %44

43:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 62, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

44:                                               ; preds = %42
  %45 = load double, ptr %4, align 8, !tbaa !9
  %46 = load double, ptr %3, align 8, !tbaa !9
  %47 = fcmp ogt double %45, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %44
  br label %50

49:                                               ; preds = %44
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 63, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

50:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %51 = load double, ptr %9, align 8, !tbaa !9
  %52 = load double, ptr %4, align 8, !tbaa !9
  %53 = load double, ptr %4, align 8, !tbaa !9
  %54 = load double, ptr %5, align 8, !tbaa !9
  %55 = load double, ptr %5, align 8, !tbaa !9
  %56 = fmul double %54, %55
  %57 = fneg double %56
  %58 = call double @llvm.fmuladd.f64(double %52, double %53, double %57)
  %59 = load double, ptr %10, align 8, !tbaa !9
  %60 = load double, ptr %5, align 8, !tbaa !9
  %61 = load double, ptr %5, align 8, !tbaa !9
  %62 = load double, ptr %3, align 8, !tbaa !9
  %63 = load double, ptr %3, align 8, !tbaa !9
  %64 = fmul double %62, %63
  %65 = fneg double %64
  %66 = call double @llvm.fmuladd.f64(double %60, double %61, double %65)
  %67 = fmul double %59, %66
  %68 = call double @llvm.fmuladd.f64(double %51, double %58, double %67)
  %69 = load double, ptr %11, align 8, !tbaa !9
  %70 = load double, ptr %3, align 8, !tbaa !9
  %71 = load double, ptr %3, align 8, !tbaa !9
  %72 = load double, ptr %4, align 8, !tbaa !9
  %73 = load double, ptr %4, align 8, !tbaa !9
  %74 = fmul double %72, %73
  %75 = fneg double %74
  %76 = call double @llvm.fmuladd.f64(double %70, double %71, double %75)
  %77 = call double @llvm.fmuladd.f64(double %69, double %76, double %68)
  store double %77, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %78 = load double, ptr %9, align 8, !tbaa !9
  %79 = load double, ptr %4, align 8, !tbaa !9
  %80 = load double, ptr %5, align 8, !tbaa !9
  %81 = fsub double %79, %80
  %82 = load double, ptr %10, align 8, !tbaa !9
  %83 = load double, ptr %5, align 8, !tbaa !9
  %84 = load double, ptr %3, align 8, !tbaa !9
  %85 = fsub double %83, %84
  %86 = fmul double %82, %85
  %87 = call double @llvm.fmuladd.f64(double %78, double %81, double %86)
  %88 = load double, ptr %11, align 8, !tbaa !9
  %89 = load double, ptr %3, align 8, !tbaa !9
  %90 = load double, ptr %4, align 8, !tbaa !9
  %91 = fsub double %89, %90
  %92 = call double @llvm.fmuladd.f64(double %88, double %91, double %87)
  store double %92, ptr %16, align 8, !tbaa !9
  %93 = load double, ptr %15, align 8, !tbaa !9
  %94 = fmul double 5.000000e-01, %93
  %95 = load double, ptr %16, align 8, !tbaa !9
  %96 = fdiv double %94, %95
  store double %96, ptr %12, align 8, !tbaa !9
  %97 = load double, ptr %12, align 8, !tbaa !9
  %98 = load double, ptr %4, align 8, !tbaa !9
  %99 = fsub double %97, %98
  store double %99, ptr %13, align 8, !tbaa !9
  %100 = load i32, ptr %14, align 4, !tbaa !5
  %101 = load double, ptr %12, align 8, !tbaa !9
  %102 = load double, ptr %12, align 8, !tbaa !9
  %103 = fsub double %102, 0x3FF921FB54442D18
  %104 = load double, ptr %13, align 8, !tbaa !9
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %100, double noundef %101, double noundef %103, double noundef %104)
  %106 = load double, ptr %7, align 8, !tbaa !9
  %107 = load double, ptr %6, align 8, !tbaa !9
  %108 = fmul double %107, %106
  store double %108, ptr %6, align 8, !tbaa !9
  %109 = load double, ptr %12, align 8, !tbaa !9
  %110 = load double, ptr %6, align 8, !tbaa !9
  %111 = fsub double %109, %110
  store double %111, ptr %3, align 8, !tbaa !9
  %112 = load double, ptr %12, align 8, !tbaa !9
  %113 = load double, ptr %6, align 8, !tbaa !9
  %114 = fadd double %112, %113
  store double %114, ptr %5, align 8, !tbaa !9
  %115 = load double, ptr %13, align 8, !tbaa !9
  %116 = call double @llvm.fabs.f64(double %115)
  %117 = load double, ptr %8, align 8, !tbaa !9
  %118 = fcmp olt double %116, %117
  br i1 %118, label %119, label %120

119:                                              ; preds = %50
  store i32 2, ptr %17, align 4
  br label %121

120:                                              ; preds = %50
  store i32 0, ptr %17, align 4
  br label %121

121:                                              ; preds = %120, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  %122 = load i32, ptr %17, align 4
  switch i32 %122, label %131 [
    i32 0, label %123
    i32 2, label %127
  ]

123:                                              ; preds = %121
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %14, align 4, !tbaa !5
  %126 = add i32 %125, 1
  store i32 %126, ptr %14, align 4, !tbaa !5
  br label %24, !llvm.loop !11

127:                                              ; preds = %121, %24
  %128 = load double, ptr %12, align 8, !tbaa !9
  %129 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %128, double noundef 0x3FF921FB54442D18)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %130 = load i32, ptr %1, align 4
  ret i32 %130

131:                                              ; preds = %121
  unreachable
}

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

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

declare i32 @printf(ptr noundef, ...) #4

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

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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { "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 = { nounwind }
attributes #6 = { 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 = !{!"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}
!12 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [80 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local double @function(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  br label %1

1:                                                ; preds = %0, %38
  %.05867 = phi double [ 0xBFE9999980000000, %0 ], [ %41, %38 ]
  %.05966 = phi i32 [ 0, %0 ], [ %42, %38 ]
  %.06165 = phi double [ 0x40099999A0000000, %0 ], [ %40, %38 ]
  %.06264 = phi double [ 2.000000e+00, %0 ], [ %39, %38 ]
  %2 = fadd double %.06165, %.05867
  %3 = fmul double %2, 5.000000e-01
  %4 = tail call double @function(double noundef %.05867)
  %5 = tail call double @function(double noundef %3)
  %6 = tail call double @function(double noundef %.06165)
  %7 = fcmp ogt double %.06165, %3
  br i1 %7, label %9, label %8

8:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 62, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #4
  unreachable

9:                                                ; preds = %1
  %10 = fcmp ogt double %3, %.05867
  br i1 %10, label %12, label %11

11:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 63, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #4
  unreachable

12:                                               ; preds = %9
  %13 = fneg double %.06165
  %14 = fmul double %.06165, %13
  %15 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %14)
  %16 = fneg double %.05867
  %17 = fmul double %.05867, %16
  %18 = tail call double @llvm.fmuladd.f64(double %.06165, double %.06165, double %17)
  %19 = fmul double %18, %5
  %20 = tail call double @llvm.fmuladd.f64(double %4, double %15, double %19)
  %21 = fneg double %3
  %22 = fmul double %3, %21
  %23 = tail call double @llvm.fmuladd.f64(double %.05867, double %.05867, double %22)
  %24 = tail call double @llvm.fmuladd.f64(double %6, double %23, double %20)
  %25 = fsub double %3, %.06165
  %26 = fsub double %.06165, %.05867
  %27 = fmul double %26, %5
  %28 = tail call double @llvm.fmuladd.f64(double %4, double %25, double %27)
  %29 = fsub double %.05867, %3
  %30 = tail call double @llvm.fmuladd.f64(double %6, double %29, double %28)
  %31 = fmul double %24, 5.000000e-01
  %32 = fdiv double %31, %30
  %33 = fsub double %32, %3
  %34 = fadd double %32, 0xBFF921FB54442D18
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.05966, double noundef %32, double noundef %34, double noundef %33)
  %36 = tail call double @llvm.fabs.f64(double %33)
  %37 = fcmp olt double %36, 0x3EB0C6F7A0000000
  br i1 %37, label %43, label %38

38:                                               ; preds = %12
  %39 = fmul double %.06264, 0x3FE6666660000000
  %40 = fadd double %39, %32
  %41 = fsub double %32, %39
  %42 = add nuw nsw i32 %.05966, 1
  %exitcond.not = icmp eq i32 %42, 10
  br i1 %exitcond.not, label %43, label %1, !llvm.loop !5

43:                                               ; preds = %12, %38
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %32, double noundef 0x3FF921FB54442D18)
  ret i32 0
}

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nofree 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 #4 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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