; LLVM IR from rdguez-mariano/fast_imas_IPOL :: libSimuTilts/splines.ll (Z7spline3Pff)

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z7spline3Pff(ptr noundef %0, float noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %6 = load float, ptr %4, align 4, !tbaa !9
  %7 = fpext float %6 to double
  %8 = fsub double 1.000000e+00, %7
  %9 = fptrunc double %8 to float
  store float %9, ptr %5, align 4, !tbaa !9
  %10 = load float, ptr %4, align 4, !tbaa !9
  %11 = fpext float %10 to double
  %12 = fmul double 0x3FC555555530AED6, %11
  %13 = load float, ptr %4, align 4, !tbaa !9
  %14 = fpext float %13 to double
  %15 = fmul double %12, %14
  %16 = load float, ptr %4, align 4, !tbaa !9
  %17 = fpext float %16 to double
  %18 = fmul double %15, %17
  %19 = fptrunc double %18 to float
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds float, ptr %20, i64 0
  store float %19, ptr %21, align 4, !tbaa !9
  %22 = load float, ptr %5, align 4, !tbaa !9
  %23 = fpext float %22 to double
  %24 = fmul double 5.000000e-01, %23
  %25 = load float, ptr %5, align 4, !tbaa !9
  %26 = fpext float %25 to double
  %27 = fmul double %24, %26
  %28 = load float, ptr %4, align 4, !tbaa !9
  %29 = fpext float %28 to double
  %30 = fadd double 1.000000e+00, %29
  %31 = fneg double %27
  %32 = call double @llvm.fmuladd.f64(double %31, double %30, double 0x3FE55555554C2BB5)
  %33 = fptrunc double %32 to float
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds float, ptr %34, i64 1
  store float %33, ptr %35, align 4, !tbaa !9
  %36 = load float, ptr %4, align 4, !tbaa !9
  %37 = fpext float %36 to double
  %38 = fmul double 5.000000e-01, %37
  %39 = load float, ptr %4, align 4, !tbaa !9
  %40 = fpext float %39 to double
  %41 = fmul double %38, %40
  %42 = load float, ptr %4, align 4, !tbaa !9
  %43 = fpext float %42 to double
  %44 = fsub double 2.000000e+00, %43
  %45 = fneg double %41
  %46 = call double @llvm.fmuladd.f64(double %45, double %44, double 0x3FE55555554C2BB5)
  %47 = fptrunc double %46 to float
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds float, ptr %48, i64 2
  store float %47, ptr %49, align 4, !tbaa !9
  %50 = load float, ptr %5, align 4, !tbaa !9
  %51 = fpext float %50 to double
  %52 = fmul double 0x3FC555555530AED6, %51
  %53 = load float, ptr %5, align 4, !tbaa !9
  %54 = fpext float %53 to double
  %55 = fmul double %52, %54
  %56 = load float, ptr %5, align 4, !tbaa !9
  %57 = fpext float %56 to double
  %58 = fmul double %55, %57
  %59 = fptrunc double %58 to float
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds float, ptr %60, i64 3
  store float %59, ptr %61, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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" }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !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 nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @_Z7spline3Pff(ptr nocapture noundef writeonly %0, float noundef %1) local_unnamed_addr #0 {
  %3 = fsub float 1.000000e+00, %1
  %4 = insertelement <2 x float> poison, float %3, i64 0
  %5 = insertelement <2 x float> %4, float %1, i64 1
  %6 = fpext <2 x float> %5 to <2 x double>
  %7 = extractelement <2 x double> %6, i64 1
  %8 = fmul double %7, 0x3FC555555530AED6
  %9 = fmul double %8, %7
  %10 = fmul double %9, %7
  %11 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> <i32 1, i32 1>
  %12 = fadd <2 x double> %11, <double 1.000000e+00, double poison>
  %13 = fsub <2 x double> <double poison, double 2.000000e+00>, %11
  %14 = shufflevector <2 x double> %12, <2 x double> %13, <2 x i32> <i32 0, i32 3>
  %15 = fmul <2 x double> %6, <double -5.000000e-01, double -5.000000e-01>
  %16 = fmul <2 x double> %15, %6
  %17 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %16, <2 x double> %14, <2 x double> <double 0x3FE55555554C2BB5, double 0x3FE55555554C2BB5>)
  %18 = extractelement <2 x double> %6, i64 0
  %19 = fmul double %18, 0x3FC555555530AED6
  %20 = fmul double %19, %18
  %21 = fmul double %20, %18
  %22 = insertelement <4 x double> poison, double %10, i64 0
  %23 = shufflevector <2 x double> %17, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
  %24 = shufflevector <4 x double> %22, <4 x double> %23, <4 x i32> <i32 0, i32 4, i32 5, i32 poison>
  %25 = insertelement <4 x double> %24, double %21, i64 3
  %26 = fptrunc <4 x double> %25 to <4 x float>
  store <4 x float> %26, ptr %0, align 4, !tbaa !5
  ret void
}

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

attributes #0 = { 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 #1 = { 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,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass