; LLVM IR from jgaeddert/liquid-dsp :: sandbox (ellip_func_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"

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

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @ellipkf(float noundef, i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local float @ellipdegf(float noundef %0, float noundef %1, i32 noundef %2) #3 {
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  store float %0, ptr %4, align 4, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %16 = load float, ptr %5, align 4, !tbaa !5
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = call i32 @ellipkf(float noundef %16, i32 noundef %17, ptr noundef %7, ptr noundef %8)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %19 = load float, ptr %8, align 4, !tbaa !5
  %20 = fpext float %19 to double
  %21 = fmul double 0xC00921FB54442D18, %20
  %22 = load float, ptr %7, align 4, !tbaa !5
  %23 = fpext float %22 to double
  %24 = fdiv double %21, %23
  %25 = fptrunc double %24 to float
  %26 = call float @expf(float noundef %25) #4, !tbaa !9
  store float %26, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %27 = load float, ptr %9, align 4, !tbaa !5
  %28 = load float, ptr %4, align 4, !tbaa !5
  %29 = fdiv float 1.000000e+00, %28
  %30 = call float @powf(float noundef %27, float noundef %29) #4
  store float %30, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store float 0.000000e+00, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %45, %3
  %32 = load i32, ptr %11, align 4, !tbaa !9
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = icmp ult i32 %32, %33
  br i1 %34, label %35, label %48

35:                                               ; preds = %31
  %36 = load float, ptr %10, align 4, !tbaa !5
  %37 = load i32, ptr %11, align 4, !tbaa !9
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = add i32 %38, 1
  %40 = mul i32 %37, %39
  %41 = uitofp i32 %40 to float
  %42 = call float @powf(float noundef %36, float noundef %41) #4
  %43 = load float, ptr %12, align 4, !tbaa !5
  %44 = fadd float %43, %42
  store float %44, ptr %12, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %35
  %46 = load i32, ptr %11, align 4, !tbaa !9
  %47 = add i32 %46, 1
  store i32 %47, ptr %11, align 4, !tbaa !9
  br label %31, !llvm.loop !11

48:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store float 0.000000e+00, ptr %13, align 4, !tbaa !5
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %62, %48
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = load i32, ptr %6, align 4, !tbaa !9
  %52 = icmp ult i32 %50, %51
  br i1 %52, label %53, label %65

53:                                               ; preds = %49
  %54 = load float, ptr %10, align 4, !tbaa !5
  %55 = load i32, ptr %11, align 4, !tbaa !9
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = mul i32 %55, %56
  %58 = uitofp i32 %57 to float
  %59 = call float @powf(float noundef %54, float noundef %58) #4
  %60 = load float, ptr %13, align 4, !tbaa !5
  %61 = fadd float %60, %59
  store float %61, ptr %13, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %53
  %63 = load i32, ptr %11, align 4, !tbaa !9
  %64 = add i32 %63, 1
  store i32 %64, ptr %11, align 4, !tbaa !9
  br label %49, !llvm.loop !13

65:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %66 = load float, ptr %12, align 4, !tbaa !5
  %67 = load float, ptr %13, align 4, !tbaa !5
  %68 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %67, float 1.000000e+00)
  %69 = fdiv float %66, %68
  store float %69, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %70 = load float, ptr %10, align 4, !tbaa !5
  %71 = call float @sqrtf(float noundef %70) #4
  %72 = fmul float 4.000000e+00, %71
  %73 = load float, ptr %14, align 4, !tbaa !5
  %74 = fmul float %72, %73
  %75 = load float, ptr %14, align 4, !tbaa !5
  %76 = fmul float %74, %75
  store float %76, ptr %15, align 4, !tbaa !5
  %77 = load float, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret float %77
}

; Function Attrs: nounwind
declare float @expf(float noundef) #1

; Function Attrs: nounwind
declare float @powf(float noundef, float noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 }

!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 = !{!"float", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @sqrtf(float noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @ellipkf(float noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local float @ellipdegf(float noundef %0, float noundef %1, i32 noundef %2) local_unnamed_addr #3 {
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %6 = call i32 @ellipkf(float noundef %1, i32 noundef %2, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %7 = load float, ptr %5, align 4, !tbaa !5
  %8 = fpext float %7 to double
  %9 = fmul double %8, 0xC00921FB54442D18
  %10 = load float, ptr %4, align 4, !tbaa !5
  %11 = fpext float %10 to double
  %12 = fdiv double %9, %11
  %13 = fptrunc double %12 to float
  %14 = call float @expf(float noundef %13) #4, !tbaa !9
  %15 = fdiv float 1.000000e+00, %0
  %16 = call float @powf(float noundef %14, float noundef %15) #4
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %17 = add i32 %2, -1
  %xtraiter = and i32 %2, 3
  %18 = icmp ult i32 %2, 4
  br i1 %18, label %.preheader.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i32 %2, -4
  br label %.lr.ph

.preheader.unr-lcssa:                             ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa39.ph = phi float [ poison, %.lr.ph.preheader ], [ %45, %.lr.ph ]
  %.027.unr = phi i32 [ 0, %.lr.ph.preheader ], [ %41, %.lr.ph ]
  %.02326.unr = phi float [ 0.000000e+00, %.lr.ph.preheader ], [ %45, %.lr.ph ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader.unr-lcssa, %.lr.ph.epil
  %.027.epil = phi i32 [ %19, %.lr.ph.epil ], [ %.027.unr, %.preheader.unr-lcssa ]
  %.02326.epil = phi float [ %23, %.lr.ph.epil ], [ %.02326.unr, %.preheader.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %.preheader.unr-lcssa ]
  %19 = add nuw i32 %.027.epil, 1
  %20 = mul i32 %19, %.027.epil
  %21 = uitofp i32 %20 to float
  %22 = call float @powf(float noundef %16, float noundef %21) #4
  %23 = fadd float %.02326.epil, %22
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.lr.ph.epil, !llvm.loop !11

.preheader:                                       ; preds = %.lr.ph.epil, %.preheader.unr-lcssa
  %.lcssa39 = phi float [ %.lcssa39.ph, %.preheader.unr-lcssa ], [ %23, %.lr.ph.epil ]
  %.not37 = icmp eq i32 %2, 1
  br i1 %.not37, label %._crit_edge, label %.lr.ph30.preheader

.lr.ph30.preheader:                               ; preds = %.preheader
  %24 = add i32 %2, -2
  %xtraiter41 = and i32 %17, 3
  %25 = icmp ult i32 %24, 3
  br i1 %25, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph30.preheader.new

.lr.ph30.preheader.new:                           ; preds = %.lr.ph30.preheader
  %unroll_iter45 = and i32 %17, -4
  br label %.lr.ph30

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.027 = phi i32 [ 0, %.lr.ph.preheader.new ], [ %41, %.lr.ph ]
  %.02326 = phi float [ 0.000000e+00, %.lr.ph.preheader.new ], [ %45, %.lr.ph ]
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %26 = or disjoint i32 %.027, 1
  %27 = mul i32 %26, %.027
  %28 = uitofp i32 %27 to float
  %29 = call float @powf(float noundef %16, float noundef %28) #4
  %30 = fadd float %.02326, %29
  %31 = or disjoint i32 %.027, 2
  %32 = mul i32 %31, %26
  %33 = uitofp i32 %32 to float
  %34 = call float @powf(float noundef %16, float noundef %33) #4
  %35 = fadd float %30, %34
  %36 = or disjoint i32 %.027, 3
  %37 = mul i32 %36, %31
  %38 = uitofp i32 %37 to float
  %39 = call float @powf(float noundef %16, float noundef %38) #4
  %40 = fadd float %35, %39
  %41 = add nuw i32 %.027, 4
  %42 = mul i32 %41, %36
  %43 = uitofp i32 %42 to float
  %44 = call float @powf(float noundef %16, float noundef %43) #4
  %45 = fadd float %40, %44
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.unr-lcssa, label %.lr.ph, !llvm.loop !13

.lr.ph30:                                         ; preds = %.lr.ph30, %.lr.ph30.preheader.new
  %.129 = phi i32 [ 1, %.lr.ph30.preheader.new ], [ %65, %.lr.ph30 ]
  %.02428 = phi float [ 0.000000e+00, %.lr.ph30.preheader.new ], [ %64, %.lr.ph30 ]
  %niter46 = phi i32 [ 0, %.lr.ph30.preheader.new ], [ %niter46.next.3, %.lr.ph30 ]
  %46 = mul i32 %.129, %.129
  %47 = uitofp i32 %46 to float
  %48 = call float @powf(float noundef %16, float noundef %47) #4
  %49 = fadd float %.02428, %48
  %50 = add nuw nsw i32 %.129, 1
  %51 = mul i32 %50, %50
  %52 = uitofp i32 %51 to float
  %53 = call float @powf(float noundef %16, float noundef %52) #4
  %54 = fadd float %49, %53
  %55 = add nuw nsw i32 %.129, 2
  %56 = mul i32 %55, %55
  %57 = uitofp i32 %56 to float
  %58 = call float @powf(float noundef %16, float noundef %57) #4
  %59 = fadd float %54, %58
  %60 = add nuw i32 %.129, 3
  %61 = mul i32 %60, %60
  %62 = uitofp i32 %61 to float
  %63 = call float @powf(float noundef %16, float noundef %62) #4
  %64 = fadd float %59, %63
  %65 = add nuw i32 %.129, 4
  %niter46.next.3 = add i32 %niter46, 4
  %niter46.ncmp.3 = icmp eq i32 %niter46.next.3, %unroll_iter45
  br i1 %niter46.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph30, !llvm.loop !15

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph30, %.lr.ph30.preheader
  %.lcssa.ph = phi float [ poison, %.lr.ph30.preheader ], [ %64, %.lr.ph30 ]
  %.129.unr = phi i32 [ 1, %.lr.ph30.preheader ], [ %65, %.lr.ph30 ]
  %.02428.unr = phi float [ 0.000000e+00, %.lr.ph30.preheader ], [ %64, %.lr.ph30 ]
  %lcmp.mod43.not = icmp eq i32 %xtraiter41, 0
  br i1 %lcmp.mod43.not, label %._crit_edge, label %.lr.ph30.epil

.lr.ph30.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph30.epil
  %.129.epil = phi i32 [ %70, %.lr.ph30.epil ], [ %.129.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.02428.epil = phi float [ %69, %.lr.ph30.epil ], [ %.02428.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter42 = phi i32 [ %epil.iter42.next, %.lr.ph30.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %66 = mul i32 %.129.epil, %.129.epil
  %67 = uitofp i32 %66 to float
  %68 = call float @powf(float noundef %16, float noundef %67) #4
  %69 = fadd float %.02428.epil, %68
  %70 = add nuw i32 %.129.epil, 1
  %epil.iter42.next = add i32 %epil.iter42, 1
  %epil.iter42.cmp.not = icmp eq i32 %epil.iter42.next, %xtraiter41
  br i1 %epil.iter42.cmp.not, label %._crit_edge, label %.lr.ph30.epil, !llvm.loop !16

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph30.epil, %3, %.preheader
  %.023.lcssa35 = phi float [ %.lcssa39, %.preheader ], [ 0.000000e+00, %3 ], [ %.lcssa39, %.lr.ph30.epil ], [ %.lcssa39, %._crit_edge.loopexit.unr-lcssa ]
  %.024.lcssa = phi float [ 0.000000e+00, %.preheader ], [ 0.000000e+00, %3 ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %69, %.lr.ph30.epil ]
  %71 = call float @llvm.fmuladd.f32(float %.024.lcssa, float 2.000000e+00, float 1.000000e+00)
  %72 = fdiv float %.023.lcssa35, %71
  %73 = call float @sqrtf(float noundef %16) #4
  %74 = fmul float %73, 4.000000e+00
  %75 = fmul float %72, %74
  %76 = fmul float %72, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  ret float %76
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @expf(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @powf(float noundef, float noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) "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 = { 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 }

!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 = !{!"float", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !12}


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