; 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: nounwind uwtable
declare dso_local i32 @landenf(float noundef, i32 noundef, ptr 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: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; Function Attrs: nounwind uwtable
define dso_local <2 x float> @ellip_cdf(<2 x float> noundef %0, float noundef %1, i32 noundef %2) #3 {
  %4 = alloca { float, float }, align 4
  %5 = alloca { float, float }, align 4
  %6 = alloca float, align 4
  %7 = alloca i32, align 4
  %8 = alloca { float, float }, align 4
  %9 = alloca { float, float }, align 4
  %10 = alloca { float, float }, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca { float, float }, align 4
  %15 = alloca { float, float }, align 4
  store <2 x float> %0, ptr %5, align 4
  store float %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %16 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %17 = load float, ptr %16, align 4
  %18 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %19 = load float, ptr %18, align 4
  %20 = fpext float %17 to double
  %21 = fpext float %19 to double
  %22 = fmul double %20, 0x400921FB54442D18
  %23 = fmul double %21, 0x400921FB54442D18
  %24 = fmul double %22, 5.000000e-01
  %25 = fmul double %23, 5.000000e-01
  %26 = fptrunc double %24 to float
  %27 = fptrunc double %25 to float
  %28 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %29 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %26, ptr %28, align 4
  store float %27, ptr %29, align 4
  %30 = load <2 x float>, ptr %9, align 4
  %31 = call <2 x float> @ccosf(<2 x float> noundef %30) #5
  store <2 x float> %31, ptr %10, align 4
  %32 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %33 = load float, ptr %32, align 4
  %34 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  %35 = load float, ptr %34, align 4
  %36 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %37 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  store float %33, ptr %36, align 4
  store float %35, ptr %37, align 4
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = call ptr @llvm.stacksave.p0()
  store ptr %40, ptr %11, align 8
  %41 = alloca float, i64 %39, align 16
  store i64 %39, ptr %12, align 8
  %42 = load float, ptr %6, align 4, !tbaa !5
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = call i32 @landenf(float noundef %42, i32 noundef %43, ptr noundef %41)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %45 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %45, ptr %13, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %103, %3
  %47 = load i32, ptr %13, align 4, !tbaa !9
  %48 = icmp ugt i32 %47, 0
  br i1 %48, label %49, label %106

49:                                               ; preds = %46
  %50 = load i32, ptr %13, align 4, !tbaa !9
  %51 = sub i32 %50, 1
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds float, ptr %41, i64 %52
  %54 = load float, ptr %53, align 4, !tbaa !5
  %55 = fadd float 1.000000e+00, %54
  %56 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %57 = load float, ptr %56, align 4
  %58 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %59 = load float, ptr %58, align 4
  %60 = fmul float %55, %57
  %61 = fmul float %55, %59
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = sub i32 %62, 1
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds float, ptr %41, i64 %64
  %66 = load float, ptr %65, align 4, !tbaa !5
  %67 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %68 = load float, ptr %67, align 4
  %69 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %70 = load float, ptr %69, align 4
  %71 = fmul float %66, %68
  %72 = fmul float %66, %70
  %73 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %74 = load float, ptr %73, align 4
  %75 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %76 = load float, ptr %75, align 4
  %77 = fmul float %71, %74
  %78 = fmul float %72, %76
  %79 = fmul float %71, %76
  %80 = fmul float %72, %74
  %81 = fsub float %77, %78
  %82 = fadd float %79, %80
  %83 = fcmp uno float %81, %81
  br i1 %83, label %84, label %92, !prof !11

84:                                               ; preds = %49
  %85 = fcmp uno float %82, %82
  br i1 %85, label %86, label %92, !prof !11

86:                                               ; preds = %84
  %87 = call <2 x float> @__mulsc3(float noundef %71, float noundef %72, float noundef %74, float noundef %76) #5
  store <2 x float> %87, ptr %14, align 4
  %88 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 0
  %89 = load float, ptr %88, align 4
  %90 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 1
  %91 = load float, ptr %90, align 4
  br label %92

92:                                               ; preds = %86, %84, %49
  %93 = phi float [ %81, %49 ], [ %81, %84 ], [ %89, %86 ]
  %94 = phi float [ %82, %49 ], [ %82, %84 ], [ %91, %86 ]
  %95 = fadd float 1.000000e+00, %93
  %96 = call <2 x float> @__divsc3(float noundef %60, float noundef %61, float noundef %95, float noundef %94) #5
  store <2 x float> %96, ptr %15, align 4
  %97 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 0
  %98 = load float, ptr %97, align 4
  %99 = getelementptr inbounds { float, float }, ptr %15, i32 0, i32 1
  %100 = load float, ptr %99, align 4
  %101 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %102 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  store float %98, ptr %101, align 4
  store float %100, ptr %102, align 4
  br label %103

103:                                              ; preds = %92
  %104 = load i32, ptr %13, align 4, !tbaa !9
  %105 = add i32 %104, -1
  store i32 %105, ptr %13, align 4, !tbaa !9
  br label %46, !llvm.loop !12

106:                                              ; preds = %46
  %107 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %108 = load float, ptr %107, align 4
  %109 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %110 = load float, ptr %109, align 4
  %111 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %112 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  store float %108, ptr %111, align 4
  store float %110, ptr %112, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  %113 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %113)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %114 = load <2 x float>, ptr %4, align 4
  ret <2 x float> %114
}

; Function Attrs: nounwind
declare <2 x float> @ccosf(<2 x float> noundef) #4

declare <2 x float> @__mulsc3(float, float, float, float)

declare <2 x float> @__divsc3(float, float, float, float)

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 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="64" "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 "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 }

!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 = !{!"branch_weights", i32 1, i32 1048575}
!12 = distinct !{!12, !13}
!13 = !{!"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"

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

; Function Attrs: nounwind uwtable
define dso_local <2 x float> @ellip_cdf(<2 x float> noundef %0, float noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = fpext <2 x float> %0 to <2 x double>
  %5 = fmul <2 x double> %4, <double 0x400921FB54442D18, double 0x400921FB54442D18>
  %6 = fmul <2 x double> %5, <double 5.000000e-01, double 5.000000e-01>
  %7 = fptrunc <2 x double> %6 to <2 x float>
  %8 = tail call <2 x float> @ccosf(<2 x float> noundef %7) #3
  %9 = zext i32 %2 to i64
  %10 = alloca float, i64 %9, align 16
  %11 = call i32 @landenf(float noundef %1, i32 noundef %2, ptr noundef nonnull %10)
  %.not22 = icmp eq i32 %2, 0
  br i1 %.not22, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %38
  %indvars.iv = phi i64 [ %13, %38 ], [ %9, %3 ]
  %12 = phi <2 x float> [ %42, %38 ], [ %8, %3 ]
  %13 = add nsw i64 %indvars.iv, -1
  %14 = getelementptr inbounds float, ptr %10, i64 %13
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = fadd float %15, 1.000000e+00
  %17 = shufflevector <2 x float> %12, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %18 = extractelement <2 x float> %12, i64 0
  %19 = fmul float %18, %16
  %20 = extractelement <2 x float> %12, i64 1
  %21 = fmul float %20, %16
  %22 = insertelement <2 x float> poison, float %15, i64 0
  %23 = shufflevector <2 x float> %22, <2 x float> poison, <2 x i32> zeroinitializer
  %24 = fmul <2 x float> %12, %23
  %25 = fmul <2 x float> %12, %24
  %26 = fmul <2 x float> %17, %24
  %shift = shufflevector <2 x float> %25, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %27 = fsub <2 x float> %25, %shift
  %28 = extractelement <2 x float> %27, i64 0
  %shift28 = shufflevector <2 x float> %26, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %29 = fadd <2 x float> %26, %shift28
  %30 = extractelement <2 x float> %29, i64 0
  %31 = fcmp uno float %28, 0.000000e+00
  br i1 %31, label %32, label %38, !prof !9

32:                                               ; preds = %.lr.ph
  %33 = fcmp uno float %30, 0.000000e+00
  br i1 %33, label %34, label %38, !prof !9

34:                                               ; preds = %32
  %35 = extractelement <2 x float> %24, i64 0
  %36 = extractelement <2 x float> %24, i64 1
  %37 = call <2 x float> @__mulsc3(float noundef %35, float noundef %36, float noundef %18, float noundef %20) #3
  %.sroa.01.0.vec.extract = extractelement <2 x float> %37, i64 0
  %.sroa.01.4.vec.extract = extractelement <2 x float> %37, i64 1
  br label %38

38:                                               ; preds = %34, %32, %.lr.ph
  %39 = phi float [ %28, %.lr.ph ], [ %28, %32 ], [ %.sroa.01.0.vec.extract, %34 ]
  %40 = phi float [ %30, %.lr.ph ], [ %30, %32 ], [ %.sroa.01.4.vec.extract, %34 ]
  %41 = fadd float %39, 1.000000e+00
  %42 = call <2 x float> @__divsc3(float noundef %19, float noundef %21, float noundef %41, float noundef %40) #3
  %.not.wide = icmp eq i64 %13, 0
  br i1 %.not.wide, label %._crit_edge, label %.lr.ph, !llvm.loop !10

._crit_edge:                                      ; preds = %38, %3
  %43 = phi <2 x float> [ %8, %3 ], [ %42, %38 ]
  ret <2 x float> %43
}

; Function Attrs: nounwind
declare <2 x float> @ccosf(<2 x float> noundef) local_unnamed_addr #2

declare <2 x float> @__mulsc3(float, float, float, float) local_unnamed_addr

declare <2 x float> @__divsc3(float, float, float, float) local_unnamed_addr

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 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { 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 = { 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 = !{!"branch_weights", i32 1, i32 1048575}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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