; LLVM IR from SakshayMahna/Robotics-Playground :: driving_ws/src/Frenet_Planner_Simulation/Frenet_Planner_AGV/frenet_planner_agv/s_e69bc07a (ZN6Spline6calcddEd)

; 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.Spline = type <{ %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6Spline12search_indexEd(ptr noundef nonnull align 8 dereferenceable(172), double noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN6Spline6calcddEd(ptr noundef nonnull align 8 dereferenceable(172) %0, double noundef %1) #2 align 2 {
  %3 = alloca double, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  %10 = load double, ptr %5, align 8, !tbaa !9
  %11 = getelementptr inbounds %class.Spline, ptr %9, i32 0, i32 5
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef 0) #4
  %13 = load double, ptr %12, align 8, !tbaa !9
  %14 = fcmp olt double %10, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %2
  store double -1.000000e+09, ptr %3, align 8
  br label %53

16:                                               ; preds = %2
  %17 = load double, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds %class.Spline, ptr %9, i32 0, i32 5
  %19 = getelementptr inbounds %class.Spline, ptr %9, i32 0, i32 7
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = sub nsw i32 %20, 1
  %22 = sext i32 %21 to i64
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %22) #4
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = fcmp ogt double %17, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %16
  store double -1.000000e+09, ptr %3, align 8
  br label %53

27:                                               ; preds = %16
  br label %28

28:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %29 = load double, ptr %5, align 8, !tbaa !9
  %30 = call noundef i32 @_ZN6Spline12search_indexEd(ptr noundef nonnull align 8 dereferenceable(172) %9, double noundef %29)
  store i32 %30, ptr %6, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %31 = load double, ptr %5, align 8, !tbaa !9
  %32 = getelementptr inbounds %class.Spline, ptr %9, i32 0, i32 5
  %33 = load i32, ptr %6, align 4, !tbaa !18
  %34 = sext i32 %33 to i64
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %34) #4
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = fsub double %31, %36
  store double %37, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %38 = getelementptr inbounds %class.Spline, ptr %9, i32 0, i32 2
  %39 = load i32, ptr %6, align 4, !tbaa !18
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %40) #4
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds %class.Spline, ptr %9, i32 0, i32 3
  %44 = load i32, ptr %6, align 4, !tbaa !18
  %45 = sext i32 %44 to i64
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %43, i64 noundef %45) #4
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = fmul double 6.000000e+00, %47
  %49 = load double, ptr %7, align 8, !tbaa !9
  %50 = fmul double %48, %49
  %51 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %42, double %50)
  store double %51, ptr %8, align 8, !tbaa !9
  %52 = load double, ptr %8, align 8, !tbaa !9
  store double %52, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %53

53:                                               ; preds = %28, %26, %15
  %54 = load double, ptr %3, align 8
  ret double %54
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !17, i64 168}
!12 = !{!"_ZTS6Spline", !13, i64 0, !13, i64 24, !13, i64 48, !13, i64 72, !13, i64 96, !13, i64 120, !13, i64 144, !17, i64 168}
!13 = !{!"_ZTSSt6vectorIdSaIdEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"int", !7, i64 0}
!18 = !{!17, !17, 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6Spline12search_indexEd(ptr noundef nonnull align 8 dereferenceable(172), double 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 uwtable
define dso_local noundef double @_ZN6Spline6calcddEd(ptr noundef nonnull align 8 dereferenceable(172) %0, double noundef %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 120
  %4 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0) #3
  %5 = load double, ptr %4, align 8, !tbaa !5
  %6 = fcmp ogt double %5, %1
  br i1 %6, label %30, label %7

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 168
  %9 = load i32, ptr %8, align 8, !tbaa !9
  %10 = add nsw i32 %9, -1
  %11 = sext i32 %10 to i64
  %12 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %11) #3
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = fcmp olt double %13, %1
  br i1 %14, label %30, label %15

15:                                               ; preds = %7
  %16 = tail call noundef i32 @_ZN6Spline12search_indexEd(ptr noundef nonnull align 8 dereferenceable(172) %0, double noundef %1)
  %17 = sext i32 %16 to i64
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %17) #3
  %19 = load double, ptr %18, align 8, !tbaa !5
  %20 = fsub double %1, %19
  %21 = getelementptr inbounds i8, ptr %0, i64 48
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %17) #3
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %0, i64 72
  %25 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %17) #3
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = fmul double %26, 6.000000e+00
  %28 = fmul double %20, %27
  %29 = tail call double @llvm.fmuladd.f64(double %23, double 2.000000e+00, double %28)
  br label %30

30:                                               ; preds = %7, %2, %15
  %.0 = phi double [ %29, %15 ], [ -1.000000e+09, %2 ], [ -1.000000e+09, %7 ]
  ret double %.0
}

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !16, i64 168}
!10 = !{!"_ZTS6Spline", !11, i64 0, !11, i64 24, !11, i64 48, !11, i64 72, !11, i64 96, !11, i64 120, !11, i64 144, !16, i64 168}
!11 = !{!"_ZTSSt6vectorIdSaIdEE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!"int", !7, i64 0}


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