; LLVM IR from floppyhammer/scanline-algorithm-demo :: src/simple_math.ll (Z13bezier_coeffsffffPf)

; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z13bezier_coeffsffffPf(float noundef %0, float noundef %1, float noundef %2, float noundef %3, ptr noundef %4) #1 {
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  store float %0, ptr %6, align 4, !tbaa !5
  store float %1, ptr %7, align 4, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !5
  store float %3, ptr %9, align 4, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !9
  %11 = load float, ptr %6, align 4, !tbaa !5
  %12 = fneg float %11
  %13 = load float, ptr %7, align 4, !tbaa !5
  %14 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %13, float %12)
  %15 = load float, ptr %8, align 4, !tbaa !5
  %16 = call float @llvm.fmuladd.f32(float -3.000000e+00, float %15, float %14)
  %17 = load float, ptr %9, align 4, !tbaa !5
  %18 = fadd float %16, %17
  %19 = load ptr, ptr %10, align 8, !tbaa !9
  %20 = getelementptr inbounds float, ptr %19, i64 0
  store float %18, ptr %20, align 4, !tbaa !5
  %21 = load float, ptr %6, align 4, !tbaa !5
  %22 = load float, ptr %7, align 4, !tbaa !5
  %23 = fmul float 6.000000e+00, %22
  %24 = fneg float %23
  %25 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %21, float %24)
  %26 = load float, ptr %8, align 4, !tbaa !5
  %27 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %26, float %25)
  %28 = load ptr, ptr %10, align 8, !tbaa !9
  %29 = getelementptr inbounds float, ptr %28, i64 1
  store float %27, ptr %29, align 4, !tbaa !5
  %30 = load float, ptr %6, align 4, !tbaa !5
  %31 = load float, ptr %7, align 4, !tbaa !5
  %32 = fmul float 3.000000e+00, %31
  %33 = call float @llvm.fmuladd.f32(float -3.000000e+00, float %30, float %32)
  %34 = load ptr, ptr %10, align 8, !tbaa !9
  %35 = getelementptr inbounds float, ptr %34, i64 2
  store float %33, ptr %35, align 4, !tbaa !5
  %36 = load float, ptr %6, align 4, !tbaa !5
  %37 = load ptr, ptr %10, align 8, !tbaa !9
  %38 = getelementptr inbounds float, ptr %37, i64 3
  store float %36, ptr %38, align 4, !tbaa !5
  ret void
}

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

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @_Z13bezier_coeffsffffPf(float noundef %0, float noundef %1, float noundef %2, float noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #1 {
  %6 = fneg float %0
  %7 = tail call float @llvm.fmuladd.f32(float %1, float 3.000000e+00, float %6)
  %8 = tail call float @llvm.fmuladd.f32(float %2, float -3.000000e+00, float %7)
  %9 = fadd float %8, %3
  store float %9, ptr %4, align 4, !tbaa !5
  %10 = fmul float %1, -6.000000e+00
  %11 = tail call float @llvm.fmuladd.f32(float %0, float 3.000000e+00, float %10)
  %12 = getelementptr inbounds i8, ptr %4, i64 4
  %13 = fmul float %1, 3.000000e+00
  %14 = insertelement <2 x float> poison, float %2, i64 0
  %15 = insertelement <2 x float> %14, float %0, i64 1
  %16 = insertelement <2 x float> poison, float %11, i64 0
  %17 = insertelement <2 x float> %16, float %13, i64 1
  %18 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %15, <2 x float> <float 3.000000e+00, float -3.000000e+00>, <2 x float> %17)
  store <2 x float> %18, ptr %12, align 4, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %4, i64 12
  store float %0, ptr %19, align 4, !tbaa !5
  ret void
}

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

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

!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++ TBAA"}


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