; LLVM IR from pantor/ruckig :: src/ruckig (position_second_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::PositionSecondOrderStep1" = type { double, 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 @_ZN6ruckig7Profile22check_for_second_orderILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE7EEEbdddd(ptr noundef nonnull align 8 dereferenceable(572), double noundef, double noundef, double noundef, double noundef) #0 align 2

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

22:                                               ; preds = %6
  store i1 false, ptr %7, align 1
  br label %78

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

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

62:                                               ; preds = %49
  store i1 true, ptr %7, align 1
  br label %78

63:                                               ; preds = %49
  br label %77

64:                                               ; preds = %23
  %65 = getelementptr inbounds %"class.ruckig::PositionSecondOrderStep1", ptr %14, i32 0, i32 6
  %66 = load double, ptr %65, align 8, !tbaa !15
  %67 = call noundef double @_ZSt3absd(double noundef %66)
  %68 = fcmp olt double %67, 0x3CB0000000000000
  br i1 %68, label %69, label %76

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

74:                                               ; preds = %69
  store i1 true, ptr %7, align 1
  br label %78

75:                                               ; preds = %69
  br label %76

76:                                               ; preds = %75, %64
  br label %77

77:                                               ; preds = %76, %63
  store i1 false, ptr %7, align 1
  br label %78

78:                                               ; preds = %77, %74, %62, %22
  %79 = load i1, ptr %7, align 1
  ret i1 %79
}

; 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 = !{!"_ZTSN6ruckig24PositionSecondOrderStep1E", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !13, i64 56}
!13 = !{!"_ZTSSt5arrayIN6ruckig7ProfileELm3EE", !7, i64 0}
!14 = !{!12, !10, i64 0}
!15 = !{!12, !10, i64 48}


; 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 @_ZN6ruckig7Profile22check_for_second_orderILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE7EEEbdddd(ptr noundef nonnull align 8 dereferenceable(572), double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0 align 2

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

13:                                               ; preds = %6
  %14 = 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 %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 1) #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 2) #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 3) #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 4) #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 5) #2
  store double 0.000000e+00, ptr %19, align 8, !tbaa !12
  %20 = 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 %20, align 8, !tbaa !12
  %21 = load double, ptr %0, align 8, !tbaa !11
  %22 = tail call noundef double @_ZSt3absd(double noundef %21)
  %23 = fcmp ogt double %22, 0x3CB0000000000000
  %24 = getelementptr inbounds i8, ptr %0, i64 48
  %25 = load double, ptr %24, align 8, !tbaa !13
  br i1 %23, label %26, label %31

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

31:                                               ; preds = %13
  %32 = tail call noundef double @_ZSt3absd(double noundef %25)
  %33 = fcmp olt double %32, 0x3CB0000000000000
  br i1 %33, label %34, label %36

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

36:                                               ; preds = %31, %34, %26
  br label %37

37:                                               ; preds = %34, %26, %6, %36
  %.0 = phi i1 [ false, %36 ], [ false, %6 ], [ true, %26 ], [ true, %34 ]
  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 = !{!"_ZTSN6ruckig24PositionSecondOrderStep1E", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56}
!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 48}


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