; LLVM IR from jmbr/libpme6 :: spline.ll (ZNK7spline4clEd)

; 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: mustprogress nounwind uwtable
define dso_local noundef double @_ZNK7spline4clEd(ptr noundef nonnull align 1 dereferenceable(1) %0, double noundef %1) #0 align 2 {
  %3 = alloca double, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  %6 = load ptr, ptr %4, align 8
  %7 = load double, ptr %5, align 8, !tbaa !9
  %8 = fcmp olt double 0.000000e+00, %7
  br i1 %8, label %9, label %19

9:                                                ; preds = %2
  %10 = load double, ptr %5, align 8, !tbaa !9
  %11 = fcmp olt double %10, 1.000000e+00
  br i1 %11, label %12, label %19

12:                                               ; preds = %9
  %13 = load double, ptr %5, align 8, !tbaa !9
  %14 = fmul double 0x3FC5555555555555, %13
  %15 = load double, ptr %5, align 8, !tbaa !9
  %16 = fmul double %14, %15
  %17 = load double, ptr %5, align 8, !tbaa !9
  %18 = fmul double %16, %17
  store double %18, ptr %3, align 8
  br label %59

19:                                               ; preds = %9, %2
  %20 = load double, ptr %5, align 8, !tbaa !9
  %21 = fcmp ole double 1.000000e+00, %20
  br i1 %21, label %22, label %32

22:                                               ; preds = %19
  %23 = load double, ptr %5, align 8, !tbaa !9
  %24 = fcmp olt double %23, 2.000000e+00
  br i1 %24, label %25, label %32

25:                                               ; preds = %22
  %26 = load double, ptr %5, align 8, !tbaa !9
  %27 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %26, double 2.000000e+00)
  %28 = load double, ptr %5, align 8, !tbaa !9
  %29 = call double @llvm.fmuladd.f64(double %27, double %28, double -2.000000e+00)
  %30 = load double, ptr %5, align 8, !tbaa !9
  %31 = call double @llvm.fmuladd.f64(double %29, double %30, double 0x3FE5555555555555)
  store double %31, ptr %3, align 8
  br label %59

32:                                               ; preds = %22, %19
  %33 = load double, ptr %5, align 8, !tbaa !9
  %34 = fcmp ole double 2.000000e+00, %33
  br i1 %34, label %35, label %45

35:                                               ; preds = %32
  %36 = load double, ptr %5, align 8, !tbaa !9
  %37 = fcmp olt double %36, 3.000000e+00
  br i1 %37, label %38, label %45

38:                                               ; preds = %35
  %39 = load double, ptr %5, align 8, !tbaa !9
  %40 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %39, double -4.000000e+00)
  %41 = load double, ptr %5, align 8, !tbaa !9
  %42 = call double @llvm.fmuladd.f64(double %40, double %41, double 1.000000e+01)
  %43 = load double, ptr %5, align 8, !tbaa !9
  %44 = call double @llvm.fmuladd.f64(double %42, double %43, double 0xC01D555555555555)
  store double %44, ptr %3, align 8
  br label %59

45:                                               ; preds = %35, %32
  %46 = load double, ptr %5, align 8, !tbaa !9
  %47 = fcmp ole double 3.000000e+00, %46
  br i1 %47, label %48, label %58

48:                                               ; preds = %45
  %49 = load double, ptr %5, align 8, !tbaa !9
  %50 = fcmp olt double %49, 4.000000e+00
  br i1 %50, label %51, label %58

51:                                               ; preds = %48
  %52 = load double, ptr %5, align 8, !tbaa !9
  %53 = call double @llvm.fmuladd.f64(double 0xBFC5555555555555, double %52, double 2.000000e+00)
  %54 = load double, ptr %5, align 8, !tbaa !9
  %55 = call double @llvm.fmuladd.f64(double %53, double %54, double -8.000000e+00)
  %56 = load double, ptr %5, align 8, !tbaa !9
  %57 = call double @llvm.fmuladd.f64(double %55, double %56, double 0x4025555555555555)
  store double %57, ptr %3, align 8
  br label %59

58:                                               ; preds = %48, %45
  store double 0.000000e+00, ptr %3, align 8
  br label %59

59:                                               ; preds = %58, %51, %38, %25, %12
  %60 = load double, ptr %3, align 8
  ret double %60
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

attributes #0 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !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(none) uwtable
define dso_local noundef double @_ZNK7spline4clEd(ptr nocapture noundef nonnull readnone align 1 dereferenceable(1) %0, double noundef %1) local_unnamed_addr #0 align 2 {
  %3 = fcmp ogt double %1, 0.000000e+00
  %4 = fcmp olt double %1, 1.000000e+00
  %or.cond = and i1 %3, %4
  br i1 %or.cond, label %5, label %9

5:                                                ; preds = %2
  %6 = fmul double %1, 0x3FC5555555555555
  %7 = fmul double %6, %1
  %8 = fmul double %7, %1
  br label %30

9:                                                ; preds = %2
  %10 = fcmp oge double %1, 1.000000e+00
  %11 = fcmp olt double %1, 2.000000e+00
  %or.cond3 = and i1 %10, %11
  br i1 %or.cond3, label %12, label %16

12:                                               ; preds = %9
  %13 = tail call double @llvm.fmuladd.f64(double %1, double -5.000000e-01, double 2.000000e+00)
  %14 = tail call double @llvm.fmuladd.f64(double %13, double %1, double -2.000000e+00)
  %15 = tail call double @llvm.fmuladd.f64(double %14, double %1, double 0x3FE5555555555555)
  br label %30

16:                                               ; preds = %9
  %17 = fcmp oge double %1, 2.000000e+00
  %18 = fcmp olt double %1, 3.000000e+00
  %or.cond5 = and i1 %17, %18
  br i1 %or.cond5, label %19, label %23

19:                                               ; preds = %16
  %20 = tail call double @llvm.fmuladd.f64(double %1, double 5.000000e-01, double -4.000000e+00)
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %1, double 1.000000e+01)
  %22 = tail call double @llvm.fmuladd.f64(double %21, double %1, double 0xC01D555555555555)
  br label %30

23:                                               ; preds = %16
  %24 = fcmp oge double %1, 3.000000e+00
  %25 = fcmp olt double %1, 4.000000e+00
  %or.cond7 = and i1 %24, %25
  br i1 %or.cond7, label %26, label %30

26:                                               ; preds = %23
  %27 = tail call double @llvm.fmuladd.f64(double %1, double 0xBFC5555555555555, double 2.000000e+00)
  %28 = tail call double @llvm.fmuladd.f64(double %27, double %1, double -8.000000e+00)
  %29 = tail call double @llvm.fmuladd.f64(double %28, double %1, double 0x4025555555555555)
  br label %30

30:                                               ; preds = %23, %26, %19, %12, %5
  %.0 = phi double [ %8, %5 ], [ %15, %12 ], [ %22, %19 ], [ %29, %26 ], [ 0.000000e+00, %23 ]
  ret double %.0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass