; LLVM IR from jgaeddert/liquid-dsp :: sandbox (math_cexpf_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
define dso_local <2 x float> @sandbox_cexpf(<2 x float> noundef %0) #0 {
  %2 = alloca { float, float }, align 4
  %3 = alloca { float, float }, align 4
  %4 = alloca float, align 4
  %5 = alloca { float, float }, align 4
  %6 = alloca { float, float }, align 4
  %7 = alloca { float, float }, align 4
  store <2 x float> %0, ptr %3, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %8 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %9 = load float, ptr %8, align 4
  %10 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %11 = load float, ptr %10, align 4
  %12 = call float @expf(float noundef %9) #3, !tbaa !5
  store float %12, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %13 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %14 = load float, ptr %13, align 4
  %15 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %16 = load float, ptr %15, align 4
  %17 = call float @cosf(float noundef %16) #3
  %18 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %19 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  store float %17, ptr %18, align 4
  store float 0.000000e+00, ptr %19, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %20 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %21 = load float, ptr %20, align 4
  %22 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %23 = load float, ptr %22, align 4
  %24 = call float @sinf(float noundef %23) #3
  %25 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %26 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  store float %24, ptr %25, align 4
  store float 0.000000e+00, ptr %26, align 4
  %27 = load float, ptr %4, align 4, !tbaa !9
  %28 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %29 = load float, ptr %28, align 4
  %30 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %31 = load float, ptr %30, align 4
  %32 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %33 = load float, ptr %32, align 4
  %34 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %35 = load float, ptr %34, align 4
  %36 = fmul float 0.000000e+00, %33
  %37 = fmul float 1.000000e+00, %35
  %38 = fmul float 0.000000e+00, %35
  %39 = fmul float 1.000000e+00, %33
  %40 = fsub float %36, %37
  %41 = fadd float %38, %39
  %42 = fcmp uno float %40, %40
  br i1 %42, label %43, label %51, !prof !11

43:                                               ; preds = %1
  %44 = fcmp uno float %41, %41
  br i1 %44, label %45, label %51, !prof !11

45:                                               ; preds = %43
  %46 = call <2 x float> @__mulsc3(float noundef 0.000000e+00, float noundef 1.000000e+00, float noundef %33, float noundef %35) #3
  store <2 x float> %46, ptr %7, align 4
  %47 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %48 = load float, ptr %47, align 4
  %49 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %50 = load float, ptr %49, align 4
  br label %51

51:                                               ; preds = %45, %43, %1
  %52 = phi float [ %40, %1 ], [ %40, %43 ], [ %48, %45 ]
  %53 = phi float [ %41, %1 ], [ %41, %43 ], [ %50, %45 ]
  %54 = fadd float %29, %52
  %55 = fadd float %31, %53
  %56 = fmul float %27, %54
  %57 = fmul float %27, %55
  %58 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 0
  %59 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 1
  store float %56, ptr %58, align 4
  store float %57, ptr %59, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %60 = load <2 x float>, ptr %2, align 4
  ret <2 x float> %60
}

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

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

; Function Attrs: nounwind
declare float @cosf(float noundef) #2

; Function Attrs: nounwind
declare float @sinf(float noundef) #2

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!"branch_weights", i32 1, i32 1048575}


; 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 <2 x float> @sandbox_cexpf(<2 x float> noundef %0) local_unnamed_addr #0 {
  %.sroa.04.0.vec.extract = extractelement <2 x float> %0, i64 0
  %2 = tail call float @expf(float noundef %.sroa.04.0.vec.extract) #2, !tbaa !5
  %.sroa.04.4.vec.extract10 = extractelement <2 x float> %0, i64 1
  %3 = tail call float @cosf(float noundef %.sroa.04.4.vec.extract10) #2
  %4 = tail call float @sinf(float noundef %.sroa.04.4.vec.extract10) #2
  %5 = fmul float %4, 0.000000e+00
  %6 = fcmp uno float %5, 0.000000e+00
  %7 = insertelement <2 x float> poison, float %5, i64 0
  %8 = insertelement <2 x float> %7, float %4, i64 1
  br i1 %6, label %9, label %13, !prof !9

9:                                                ; preds = %1
  %10 = fcmp uno float %4, 0.000000e+00
  br i1 %10, label %11, label %13, !prof !9

11:                                               ; preds = %9
  %12 = tail call <2 x float> @__mulsc3(float noundef 0.000000e+00, float noundef 1.000000e+00, float noundef %4, float noundef 0.000000e+00) #2
  br label %13

13:                                               ; preds = %11, %9, %1
  %14 = phi <2 x float> [ %8, %1 ], [ %8, %9 ], [ %12, %11 ]
  %15 = insertelement <2 x float> <float poison, float 0.000000e+00>, float %3, i64 0
  %16 = fadd <2 x float> %15, %14
  %17 = insertelement <2 x float> poison, float %2, i64 0
  %18 = shufflevector <2 x float> %17, <2 x float> poison, <2 x i32> zeroinitializer
  %19 = fmul <2 x float> %18, %16
  ret <2 x float> %19
}

; 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 @cosf(float noundef) local_unnamed_addr #1

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

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

attributes #0 = { 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 #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 = { 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 = !{!"branch_weights", i32 1, i32 1048575}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass