; 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 uwtable
define dso_local void @_ZNK6ruckig23VelocityThirdOrderStep19time_acc0ERPNS_7ProfileEdddb(ptr noundef nonnull align 8 dereferenceable(1776) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, double noundef %2, double noundef %3, double noundef %4, i1 noundef zeroext %5) #0 align 2 {
  %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
  %12 = alloca i8, align 1
  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
  %13 = zext i1 %5 to i8
  store i8 %13, ptr %12, align 1, !tbaa !11
  %14 = load ptr, ptr %7, align 8
  %15 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %14, i32 0, i32 0
  %16 = load double, ptr %15, align 8, !tbaa !13
  %17 = fneg double %16
  %18 = load double, ptr %9, align 8, !tbaa !9
  %19 = fadd double %17, %18
  %20 = load double, ptr %11, align 8, !tbaa !9
  %21 = fdiv double %19, %20
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.ruckig::Profile", ptr %23, i32 0, i32 0
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %24, i64 noundef 0) #4
  store double %21, ptr %25, align 8, !tbaa !9
  %26 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %14, i32 0, i32 0
  %27 = load double, ptr %26, align 8, !tbaa !13
  %28 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %14, i32 0, i32 0
  %29 = load double, ptr %28, align 8, !tbaa !13
  %30 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %14, i32 0, i32 1
  %31 = load double, ptr %30, align 8, !tbaa !16
  %32 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %14, i32 0, i32 1
  %33 = load double, ptr %32, align 8, !tbaa !16
  %34 = fmul double %31, %33
  %35 = call double @llvm.fmuladd.f64(double %27, double %29, double %34)
  %36 = load double, ptr %9, align 8, !tbaa !9
  %37 = fmul double 2.000000e+00, %36
  %38 = load double, ptr %11, align 8, !tbaa !9
  %39 = fmul double %37, %38
  %40 = fdiv double %35, %39
  %41 = load double, ptr %9, align 8, !tbaa !9
  %42 = load double, ptr %11, align 8, !tbaa !9
  %43 = fdiv double %41, %42
  %44 = fsub double %40, %43
  %45 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %14, i32 0, i32 5
  %46 = load double, ptr %45, align 8, !tbaa !17
  %47 = load double, ptr %9, align 8, !tbaa !9
  %48 = fdiv double %46, %47
  %49 = fadd double %44, %48
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.ruckig::Profile", ptr %51, i32 0, i32 0
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %52, i64 noundef 1) #4
  store double %49, ptr %53, align 8, !tbaa !9
  %54 = getelementptr inbounds %"class.ruckig::VelocityThirdOrderStep1", ptr %14, i32 0, i32 1
  %55 = load double, ptr %54, align 8, !tbaa !16
  %56 = fneg double %55
  %57 = load double, ptr %9, align 8, !tbaa !9
  %58 = fadd double %56, %57
  %59 = load double, ptr %11, align 8, !tbaa !9
  %60 = fdiv double %58, %59
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = getelementptr inbounds %"class.ruckig::Profile", ptr %62, i32 0, i32 0
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %63, i64 noundef 2) #4
  store double %60, ptr %64, align 8, !tbaa !9
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = getelementptr inbounds %"class.ruckig::Profile", ptr %66, i32 0, i32 0
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %67, i64 noundef 3) #4
  store double 0.000000e+00, ptr %68, align 8, !tbaa !9
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = getelementptr inbounds %"class.ruckig::Profile", ptr %70, i32 0, i32 0
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %71, i64 noundef 4) #4
  store double 0.000000e+00, ptr %72, align 8, !tbaa !9
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = getelementptr inbounds %"class.ruckig::Profile", ptr %74, i32 0, i32 0
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %75, i64 noundef 5) #4
  store double 0.000000e+00, ptr %76, align 8, !tbaa !9
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = getelementptr inbounds %"class.ruckig::Profile", ptr %78, i32 0, i32 0
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %79, i64 noundef 6) #4
  store double 0.000000e+00, ptr %80, align 8, !tbaa !9
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = load double, ptr %11, align 8, !tbaa !9
  %84 = load double, ptr %9, align 8, !tbaa !9
  %85 = load double, ptr %10, align 8, !tbaa !9
  %86 = call noundef zeroext i1 @_ZN6ruckig7Profile18check_for_velocityILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE2EEEbddd(ptr noundef nonnull align 8 dereferenceable(572) %82, double noundef %83, double noundef %84, double noundef %85)
  br i1 %86, label %87, label %89

87:                                               ; preds = %6
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZNK6ruckig23VelocityThirdOrderStep111add_profileERPNS_7ProfileE(ptr noundef nonnull align 8 dereferenceable(1776) %14, ptr noundef nonnull align 8 dereferenceable(8) %88)
  br label %89

89:                                               ; preds = %87, %6
  ret void
}

; 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) #1 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK6ruckig23VelocityThirdOrderStep111add_profileERPNS_7ProfileE(ptr noundef nonnull align 8 dereferenceable(1776), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 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 speculatable willreturn memory(none) }
attributes #3 = { inlinehint 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 #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}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTSN6ruckig23VelocityThirdOrderStep1E", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !15, i64 48}
!15 = !{!"_ZTSSt5arrayIN6ruckig7ProfileELm3EE", !7, i64 0}
!16 = !{!14, !10, i64 8}
!17 = !{!14, !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 uwtable
define dso_local void @_ZNK6ruckig23VelocityThirdOrderStep19time_acc0ERPNS_7ProfileEdddb(ptr noundef nonnull align 8 dereferenceable(1776) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, double noundef %2, double noundef %3, double noundef %4, i1 noundef zeroext %5) local_unnamed_addr #0 align 2 {
  %7 = load double, ptr %0, align 8, !tbaa !5
  %8 = fsub double %2, %7
  %9 = fdiv double %8, %4
  %10 = load ptr, ptr %1, align 8, !tbaa !11
  %11 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %10, i64 noundef 0) #4
  store double %9, ptr %11, align 8, !tbaa !13
  %12 = load double, ptr %0, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = load double, ptr %13, align 8, !tbaa !14
  %15 = fmul double %14, %14
  %16 = tail call double @llvm.fmuladd.f64(double %12, double %12, double %15)
  %17 = fmul double %2, 2.000000e+00
  %18 = fmul double %17, %4
  %19 = fdiv double %2, %4
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  %21 = load <2 x double>, ptr %20, align 8
  %22 = insertelement <2 x double> %21, double %16, i64 1
  %23 = insertelement <2 x double> poison, double %2, i64 0
  %24 = insertelement <2 x double> %23, double %18, i64 1
  %25 = fdiv <2 x double> %22, %24
  %26 = extractelement <2 x double> %25, i64 1
  %27 = fsub double %26, %19
  %28 = extractelement <2 x double> %25, i64 0
  %29 = fadd double %28, %27
  %30 = load ptr, ptr %1, align 8, !tbaa !11
  %31 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %30, i64 noundef 1) #4
  store double %29, ptr %31, align 8, !tbaa !13
  %32 = load double, ptr %13, align 8, !tbaa !14
  %33 = fsub double %2, %32
  %34 = fdiv double %33, %4
  %35 = load ptr, ptr %1, align 8, !tbaa !11
  %36 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %35, i64 noundef 2) #4
  store double %34, ptr %36, align 8, !tbaa !13
  %37 = load ptr, ptr %1, align 8, !tbaa !11
  %38 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %37, i64 noundef 3) #4
  store double 0.000000e+00, ptr %38, align 8, !tbaa !13
  %39 = load ptr, ptr %1, align 8, !tbaa !11
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %39, i64 noundef 4) #4
  store double 0.000000e+00, ptr %40, align 8, !tbaa !13
  %41 = load ptr, ptr %1, align 8, !tbaa !11
  %42 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %41, i64 noundef 5) #4
  store double 0.000000e+00, ptr %42, align 8, !tbaa !13
  %43 = load ptr, ptr %1, align 8, !tbaa !11
  %44 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm7EEixEm(ptr noundef nonnull align 8 dereferenceable(56) %43, i64 noundef 6) #4
  store double 0.000000e+00, ptr %44, align 8, !tbaa !13
  %45 = load ptr, ptr %1, align 8, !tbaa !11
  %46 = tail call noundef zeroext i1 @_ZN6ruckig7Profile18check_for_velocityILNS0_12ControlSignsE0ELNS0_13ReachedLimitsE2EEEbddd(ptr noundef nonnull align 8 dereferenceable(572) %45, double noundef %4, double noundef %2, double noundef %3)
  br i1 %46, label %47, label %48

47:                                               ; preds = %6
  tail call void @_ZNK6ruckig23VelocityThirdOrderStep111add_profileERPNS_7ProfileE(ptr noundef nonnull align 8 dereferenceable(1776) %0, ptr noundef nonnull align 8 dereferenceable(8) %1)
  br label %48

48:                                               ; preds = %47, %6
  ret void
}

; 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 #1 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK6ruckig23VelocityThirdOrderStep111add_profileERPNS_7ProfileE(ptr noundef nonnull align 8 dereferenceable(1776), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 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 speculatable willreturn memory(none) }
attributes #3 = { inlinehint 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 #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, !7, i64 0}
!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 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 8}


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