; LLVM IR from pantor/ruckig :: src/ruckig (velocity_third_step1)

; 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::VelocityThirdOrderStep1" = type { double, double, double, double, double, double, %"struct.std::array" }
%"struct.std::array" = type { [3 x %"class.ruckig::Profile"] }
%"class.ruckig::Profile" = type <{ %"struct.std::array.0", %"struct.std::array.0", %"struct.std::array.0", %"struct.std::array.1", %"struct.std::array.1", %"struct.std::array.1", %"class.ruckig::BrakeProfile", %"class.ruckig::BrakeProfile", double, double, double, i32, i32, i32, [4 x i8] }>
%"struct.std::array.0" = type { [7 x double] }
%"struct.std::array.1" = type { [8 x double] }
%"class.ruckig::BrakeProfile" = type { double, %"struct.std::array.2", %"struct.std::array.2", %"struct.std::array.2", %"struct.std::array.2", %"struct.std::array.2" }
%"struct.std::array.2" = type { [2 x double] }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6ruckig7Profile18check_for_velocityILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE7EEEbddd(ptr noundef nonnull align 8 dereferenceable(572), double noundef, double noundef, double noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK6ruckig23VelocityThirdOrderStep120time_all_single_stepEPNS_7ProfileEddd(ptr noundef nonnull align 8 dereferenceable(1776) %0, ptr noundef %1, double noundef %2, double noundef %3, double noundef %4) #1 align 2 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store double %2, ptr %9, align 8, !tbaa !9
  store double %3, ptr %10, align 8, !tbaa !9
  store double %4, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr %7, align 8
  %13 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %12, i32 0, i32 1
  %14 = load double, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %12, i32 0, i32 0
  %16 = load double, ptr %15, align 8, !tbaa !14
  %17 = fsub double %14, %16
  %18 = call noundef double @_ZSt3absd(double noundef %17)
  %19 = fcmp ogt double %18, 0x3CB0000000000000
  br i1 %19, label %20, label %21

20:                                               ; preds = %5
  store i1 false, ptr %6, align 1
  br label %76

21:                                               ; preds = %5
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.ruckig::Profile", ptr %22, i32 0, i32 0
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %23, i64 noundef 0) #3
  store double 0.000000e+00, ptr %24, align 8, !tbaa !9
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = getelementptr inbounds %"class.ruckig::Profile", ptr %25, i32 0, i32 0
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %26, i64 noundef 1) #3
  store double 0.000000e+00, ptr %27, align 8, !tbaa !9
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.ruckig::Profile", ptr %28, i32 0, i32 0
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %29, i64 noundef 2) #3
  store double 0.000000e+00, ptr %30, align 8, !tbaa !9
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.ruckig::Profile", ptr %31, i32 0, i32 0
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %32, i64 noundef 3) #3
  store double 0.000000e+00, ptr %33, align 8, !tbaa !9
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.ruckig::Profile", ptr %34, i32 0, i32 0
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %35, i64 noundef 4) #3
  store double 0.000000e+00, ptr %36, align 8, !tbaa !9
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.ruckig::Profile", ptr %37, i32 0, i32 0
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %38, i64 noundef 5) #3
  store double 0.000000e+00, ptr %39, align 8, !tbaa !9
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.ruckig::Profile", ptr %40, i32 0, i32 0
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %41, i64 noundef 6) #3
  store double 0.000000e+00, ptr %42, align 8, !tbaa !9
  %43 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %12, i32 0, i32 0
  %44 = load double, ptr %43, align 8, !tbaa !14
  %45 = call noundef double @_ZSt3absd(double noundef %44)
  %46 = fcmp ogt double %45, 0x3CB0000000000000
  br i1 %46, label %47, label %62

47:                                               ; preds = %21
  %48 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %12, i32 0, i32 5
  %49 = load double, ptr %48, align 8, !tbaa !15
  %50 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %12, i32 0, i32 0
  %51 = load double, ptr %50, align 8, !tbaa !14
  %52 = fdiv double %49, %51
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.ruckig::Profile", ptr %53, i32 0, i32 0
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %54, i64 noundef 3) #3
  store double %52, ptr %55, align 8, !tbaa !9
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = load double, ptr %9, align 8, !tbaa !9
  %58 = load double, ptr %10, align 8, !tbaa !9
  %59 = call noundef zeroext i1 @_ZN6ruckig7Profile18check_for_velocityILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE7EEEbddd(ptr noundef nonnull align 8 dereferenceable(572) %56, double noundef 0.000000e+00, double noundef %57, double noundef %58)
  br i1 %59, label %60, label %61

60:                                               ; preds = %47
  store i1 true, ptr %6, align 1
  br label %76

61:                                               ; preds = %47
  br label %75

62:                                               ; preds = %21
  %63 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %12, i32 0, i32 5
  %64 = load double, ptr %63, align 8, !tbaa !15
  %65 = call noundef double @_ZSt3absd(double noundef %64)
  %66 = fcmp olt double %65, 0x3CB0000000000000
  br i1 %66, label %67, label %74

67:                                               ; preds = %62
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = load double, ptr %9, align 8, !tbaa !9
  %70 = load double, ptr %10, align 8, !tbaa !9
  %71 = call noundef zeroext i1 @_ZN6ruckig7Profile18check_for_velocityILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE7EEEbddd(ptr noundef nonnull align 8 dereferenceable(572) %68, double noundef 0.000000e+00, double noundef %69, double noundef %70)
  br i1 %71, label %72, label %73

72:                                               ; preds = %67
  store i1 true, ptr %6, align 1
  br label %76

73:                                               ; preds = %67
  br label %74

74:                                               ; preds = %73, %62
  br label %75

75:                                               ; preds = %74, %61
  store i1 false, ptr %6, align 1
  br label %76

76:                                               ; preds = %75, %72, %60, %20
  %77 = load i1, ptr %6, align 1
  ret i1 %77
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) #2

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 = { 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 #2 = { 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 #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 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTSN6ruckig23VelocityThirdOrderStep1E", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !13, i64 48}
!13 = !{!"_ZTSSt5arrayIN6ruckig7ProfileELm3EE", !7, i64 0}
!14 = !{!12, !10, i64 0}
!15 = !{!12, !10, i64 40}


; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6ruckig7Profile18check_for_velocityILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE7EEEbddd(ptr noundef nonnull align 8 dereferenceable(572), double noundef, double noundef, double noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK6ruckig23VelocityThirdOrderStep120time_all_single_stepEPNS_7ProfileEddd(ptr nocapture noundef nonnull readonly align 8 dereferenceable(1776) %0, ptr noundef %1, double noundef %2, double noundef %3, double noundef %4) local_unnamed_addr #0 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = load double, ptr %0, align 8, !tbaa !11
  %9 = fsub double %7, %8
  %10 = tail call noundef double @_ZSt3absd(double noundef %9)
  %11 = fcmp ogt double %10, 0x3CB0000000000000
  br i1 %11, label %36, label %12

12:                                               ; preds = %5
  %13 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef 0) #2
  store double 0.000000e+00, ptr %13, align 8, !tbaa !12
  %14 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef 1) #2
  store double 0.000000e+00, ptr %14, align 8, !tbaa !12
  %15 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef 2) #2
  store double 0.000000e+00, ptr %15, align 8, !tbaa !12
  %16 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef 3) #2
  store double 0.000000e+00, ptr %16, align 8, !tbaa !12
  %17 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef 4) #2
  store double 0.000000e+00, ptr %17, align 8, !tbaa !12
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef 5) #2
  store double 0.000000e+00, ptr %18, align 8, !tbaa !12
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef 6) #2
  store double 0.000000e+00, ptr %19, align 8, !tbaa !12
  %20 = load double, ptr %0, align 8, !tbaa !11
  %21 = tail call noundef double @_ZSt3absd(double noundef %20)
  %22 = fcmp ogt double %21, 0x3CB0000000000000
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = load double, ptr %23, align 8, !tbaa !13
  br i1 %22, label %25, label %30

25:                                               ; preds = %12
  %26 = load double, ptr %0, align 8, !tbaa !11
  %27 = fdiv double %24, %26
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef 3) #2
  store double %27, ptr %28, align 8, !tbaa !12
  %29 = tail call noundef zeroext i1 @_ZN6ruckig7Profile18check_for_velocityILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE7EEEbddd(ptr noundef nonnull align 8 dereferenceable(572) %1, double noundef 0.000000e+00, double noundef %2, double noundef %3)
  br i1 %29, label %36, label %35

30:                                               ; preds = %12
  %31 = tail call noundef double @_ZSt3absd(double noundef %24)
  %32 = fcmp olt double %31, 0x3CB0000000000000
  br i1 %32, label %33, label %35

33:                                               ; preds = %30
  %34 = tail call noundef zeroext i1 @_ZN6ruckig7Profile18check_for_velocityILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE7EEEbddd(ptr noundef nonnull align 8 dereferenceable(572) %1, double noundef 0.000000e+00, double noundef %2, double noundef %3)
  br i1 %34, label %36, label %35

35:                                               ; preds = %30, %33, %25
  br label %36

36:                                               ; preds = %33, %25, %5, %35
  %.0 = phi i1 [ false, %35 ], [ false, %5 ], [ true, %25 ], [ true, %33 ]
  ret i1 %.0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) local_unnamed_addr #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 = { 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 #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, !7, i64 8}
!6 = !{!"_ZTSN6ruckig23VelocityThirdOrderStep1E", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt5arrayIN6ruckig7ProfileELm3EE", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 40}


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