; LLVM IR from pantor/ruckig :: src/ruckig/brake.ll (ZN6ruckig12BrakeProfile18acceleration_brakeEddddddd)

; 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"

%"class.ruckig::BrakeProfile" = type { double, %"struct.std::array", %"struct.std::array", %"struct.std::array", %"struct.std::array", %"struct.std::array" }
%"struct.std::array" = type { [2 x double] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6ruckig12BrakeProfile18acceleration_brakeEddddddd(ptr noundef nonnull align 8 dereferenceable(88) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7) #0 align 2 {
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store double %1, ptr %10, align 8, !tbaa !9
  store double %2, ptr %11, align 8, !tbaa !9
  store double %3, ptr %12, align 8, !tbaa !9
  store double %4, ptr %13, align 8, !tbaa !9
  store double %5, ptr %14, align 8, !tbaa !9
  store double %6, ptr %15, align 8, !tbaa !9
  store double %7, ptr %16, align 8, !tbaa !9
  %25 = load ptr, ptr %9, align 8
  %26 = load double, ptr %16, align 8, !tbaa !9
  %27 = fneg double %26
  %28 = getelementptr inbounds %"class.ruckig::BrakeProfile", ptr %25, i32 0, i32 2
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %28, i64 noundef 0) #4
  store double %27, ptr %29, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %30 = load double, ptr %11, align 8, !tbaa !9
  %31 = load double, ptr %14, align 8, !tbaa !9
  %32 = fsub double %30, %31
  %33 = load double, ptr %16, align 8, !tbaa !9
  %34 = fdiv double %32, %33
  store double %34, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %35 = load double, ptr %11, align 8, !tbaa !9
  %36 = load double, ptr %16, align 8, !tbaa !9
  %37 = fdiv double %35, %36
  store double %37, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %38 = load double, ptr %10, align 8, !tbaa !9
  %39 = load double, ptr %11, align 8, !tbaa !9
  %40 = load double, ptr %16, align 8, !tbaa !9
  %41 = fneg double %40
  %42 = load double, ptr %17, align 8, !tbaa !9
  %43 = call noundef double @_ZN6ruckig6v_at_tEdddd(double noundef %38, double noundef %39, double noundef %41, double noundef %42)
  store double %43, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %44 = load double, ptr %10, align 8, !tbaa !9
  %45 = load double, ptr %11, align 8, !tbaa !9
  %46 = load double, ptr %16, align 8, !tbaa !9
  %47 = fneg double %46
  %48 = load double, ptr %18, align 8, !tbaa !9
  %49 = call noundef double @_ZN6ruckig6v_at_tEdddd(double noundef %44, double noundef %45, double noundef %47, double noundef %48)
  store double %49, ptr %20, align 8, !tbaa !9
  %50 = load double, ptr %20, align 8, !tbaa !9
  %51 = load double, ptr %12, align 8, !tbaa !9
  %52 = fcmp ogt double %50, %51
  br i1 %52, label %53, label %56

53:                                               ; preds = %8
  %54 = load double, ptr %16, align 8, !tbaa !9
  %55 = fcmp ogt double %54, 0.000000e+00
  br i1 %55, label %63, label %56

56:                                               ; preds = %53, %8
  %57 = load double, ptr %20, align 8, !tbaa !9
  %58 = load double, ptr %12, align 8, !tbaa !9
  %59 = fcmp olt double %57, %58
  br i1 %59, label %60, label %71

60:                                               ; preds = %56
  %61 = load double, ptr %16, align 8, !tbaa !9
  %62 = fcmp olt double %61, 0.000000e+00
  br i1 %62, label %63, label %71

63:                                               ; preds = %60, %53
  %64 = load double, ptr %10, align 8, !tbaa !9
  %65 = load double, ptr %11, align 8, !tbaa !9
  %66 = load double, ptr %12, align 8, !tbaa !9
  %67 = load double, ptr %13, align 8, !tbaa !9
  %68 = load double, ptr %14, align 8, !tbaa !9
  %69 = load double, ptr %15, align 8, !tbaa !9
  %70 = load double, ptr %16, align 8, !tbaa !9
  call void @_ZN6ruckig12BrakeProfile14velocity_brakeEddddddd(ptr noundef nonnull align 8 dereferenceable(88) %25, double noundef %64, double noundef %65, double noundef %66, double noundef %67, double noundef %68, double noundef %69, double noundef %70)
  br label %120

71:                                               ; preds = %60, %56
  %72 = load double, ptr %19, align 8, !tbaa !9
  %73 = load double, ptr %13, align 8, !tbaa !9
  %74 = fcmp olt double %72, %73
  br i1 %74, label %75, label %78

75:                                               ; preds = %71
  %76 = load double, ptr %16, align 8, !tbaa !9
  %77 = fcmp ogt double %76, 0.000000e+00
  br i1 %77, label %85, label %78

78:                                               ; preds = %75, %71
  %79 = load double, ptr %19, align 8, !tbaa !9
  %80 = load double, ptr %13, align 8, !tbaa !9
  %81 = fcmp ogt double %79, %80
  br i1 %81, label %82, label %114

82:                                               ; preds = %78
  %83 = load double, ptr %16, align 8, !tbaa !9
  %84 = fcmp olt double %83, 0.000000e+00
  br i1 %84, label %85, label %114

85:                                               ; preds = %82, %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %86 = load double, ptr %19, align 8, !tbaa !9
  %87 = load double, ptr %13, align 8, !tbaa !9
  %88 = fsub double %86, %87
  %89 = fneg double %88
  %90 = load double, ptr %14, align 8, !tbaa !9
  %91 = fdiv double %89, %90
  store double %91, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %92 = load double, ptr %14, align 8, !tbaa !9
  %93 = fneg double %92
  %94 = load double, ptr %16, align 8, !tbaa !9
  %95 = fmul double 2.000000e+00, %94
  %96 = fdiv double %93, %95
  %97 = load double, ptr %19, align 8, !tbaa !9
  %98 = load double, ptr %12, align 8, !tbaa !9
  %99 = fsub double %97, %98
  %100 = load double, ptr %14, align 8, !tbaa !9
  %101 = fdiv double %99, %100
  %102 = fsub double %96, %101
  store double %102, ptr %22, align 8, !tbaa !9
  %103 = load double, ptr %17, align 8, !tbaa !9
  %104 = fadd double %103, 2.200000e-14
  %105 = getelementptr inbounds %"class.ruckig::BrakeProfile", ptr %25, i32 0, i32 1
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %105, i64 noundef 0) #4
  store double %104, ptr %106, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %107 = load double, ptr %22, align 8, !tbaa !9
  %108 = fsub double %107, 2.200000e-14
  store double %108, ptr %23, align 8, !tbaa !9
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %23)
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  store double 0.000000e+00, ptr %24, align 8, !tbaa !9
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %111 = load double, ptr %110, align 8, !tbaa !9
  %112 = getelementptr inbounds %"class.ruckig::BrakeProfile", ptr %25, i32 0, i32 1
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %112, i64 noundef 1) #4
  store double %111, ptr %113, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  br label %119

114:                                              ; preds = %82, %78
  %115 = load double, ptr %17, align 8, !tbaa !9
  %116 = fadd double %115, 2.200000e-14
  %117 = getelementptr inbounds %"class.ruckig::BrakeProfile", ptr %25, i32 0, i32 1
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %117, i64 noundef 0) #4
  store double %116, ptr %118, align 8, !tbaa !9
  br label %119

119:                                              ; preds = %114, %85
  br label %120

120:                                              ; preds = %119, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZN6ruckig6v_at_tEdddd(double noundef, double noundef, double noundef, double noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ruckig12BrakeProfile14velocity_brakeEddddddd(ptr noundef nonnull align 8 dereferenceable(88), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

attributes #0 = { mustprogress 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 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 = !{!"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 uwtable
define dso_local void @_ZN6ruckig12BrakeProfile18acceleration_brakeEddddddd(ptr noundef nonnull align 8 dereferenceable(88) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7) local_unnamed_addr #0 align 2 {
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = fneg double %7
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %13, i64 noundef 0) #4
  store double %12, ptr %14, align 8, !tbaa !5
  %15 = fsub double %2, %5
  %16 = fdiv double %15, %7
  %17 = fdiv double %2, %7
  %18 = tail call noundef double @_ZN6ruckig6v_at_tEdddd(double noundef %1, double noundef %2, double noundef %12, double noundef %16)
  %19 = tail call noundef double @_ZN6ruckig6v_at_tEdddd(double noundef %1, double noundef %2, double noundef %12, double noundef %17)
  %20 = fcmp ogt double %19, %3
  %21 = fcmp ogt double %7, 0.000000e+00
  %or.cond = and i1 %21, %20
  br i1 %or.cond, label %25, label %22

22:                                               ; preds = %8
  %23 = fcmp olt double %19, %3
  %24 = fcmp olt double %7, 0.000000e+00
  %or.cond3 = and i1 %24, %23
  br i1 %or.cond3, label %25, label %26

25:                                               ; preds = %22, %8
  tail call void @_ZN6ruckig12BrakeProfile14velocity_brakeEddddddd(ptr noundef nonnull align 8 dereferenceable(88) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7)
  br label %55

26:                                               ; preds = %22
  %27 = fcmp olt double %18, %4
  %or.cond5 = and i1 %21, %27
  %28 = fcmp ogt double %18, %4
  %or.cond7 = and i1 %24, %28
  %or.cond52 = or i1 %or.cond5, %or.cond7
  br i1 %or.cond52, label %29, label %51

29:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %30 = fsub double %18, %4
  %31 = fneg double %30
  %32 = fdiv double %31, %5
  store double %32, ptr %9, align 8, !tbaa !5
  %33 = fneg double %5
  %34 = fmul double %7, 2.000000e+00
  %35 = fsub double %18, %3
  %36 = insertelement <2 x double> poison, double %33, i64 0
  %37 = insertelement <2 x double> %36, double %35, i64 1
  %38 = insertelement <2 x double> poison, double %34, i64 0
  %39 = insertelement <2 x double> %38, double %5, i64 1
  %40 = fdiv <2 x double> %37, %39
  %shift = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %41 = fsub <2 x double> %40, %shift
  %42 = extractelement <2 x double> %41, i64 0
  %43 = fadd double %16, 2.200000e-14
  %44 = getelementptr inbounds i8, ptr %0, i64 8
  %45 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %44, i64 noundef 0) #4
  store double %43, ptr %45, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  %46 = fadd double %42, -2.200000e-14
  store double %46, ptr %10, align 8, !tbaa !5
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  store double 0.000000e+00, ptr %11, align 8, !tbaa !5
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %49 = load double, ptr %48, align 8, !tbaa !5
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %44, i64 noundef 1) #4
  store double %49, ptr %50, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %55

51:                                               ; preds = %26
  %52 = fadd double %16, 2.200000e-14
  %53 = getelementptr inbounds i8, ptr %0, i64 8
  %54 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %53, i64 noundef 0) #4
  store double %52, ptr %54, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %29, %51, %25
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZN6ruckig6v_at_tEdddd(double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ruckig12BrakeProfile14velocity_brakeEddddddd(ptr noundef nonnull align 8 dereferenceable(88), double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

attributes #0 = { mustprogress 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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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