; LLVM IR from NKU-MobFly-Robotics/local-planning-benchmark :: move_base_benchmark/doc/metrics.ll (Z13ComputeSafetyRKSt6vectorI4DataSaIS0_EEd)

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

%struct.Data = type { double, double, double, double, double, double, double, double }

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [114 x i8], align 1
@__PRETTY_FUNCTION__._Z13ComputeSafetyRKSt6vectorI4DataSaIS0_EEd = external hidden unnamed_addr constant [62 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorI4DataSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z13ComputeSafetyRKSt6vectorI4DataSaIS0_EEd(ptr noundef nonnull align 8 dereferenceable(24) %0, double noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = call noundef zeroext i1 @_ZNKSt6vectorI4DataSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #3
  %12 = xor i1 %11, true
  br i1 %12, label %13, label %14

13:                                               ; preds = %2
  br label %16

14:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 78, ptr noundef @__PRETTY_FUNCTION__._Z13ComputeSafetyRKSt6vectorI4DataSaIS0_EEd) #4
  unreachable

15:                                               ; No predecessors!
  br label %16

16:                                               ; preds = %15, %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #3
  %19 = getelementptr inbounds %struct.Data, ptr %18, i32 0, i32 0
  %20 = load double, ptr %19, align 8, !tbaa !11
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %21) #3
  %23 = getelementptr inbounds %struct.Data, ptr %22, i32 0, i32 0
  %24 = load double, ptr %23, align 8, !tbaa !11
  %25 = fsub double %20, %24
  store double %25, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 -1, ptr %6, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 -1, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store double 0.000000e+00, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !13
  br label %26

26:                                               ; preds = %71, %16
  %27 = load i32, ptr %9, align 4, !tbaa !13
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = call noundef i64 @_ZNKSt6vectorI4DataSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #3
  %30 = trunc i64 %29 to i32
  %31 = icmp slt i32 %27, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %74

33:                                               ; preds = %26
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = load i32, ptr %9, align 4, !tbaa !13
  %36 = sext i32 %35 to i64
  %37 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %34, i64 noundef %36) #3
  %38 = getelementptr inbounds %struct.Data, ptr %37, i32 0, i32 6
  %39 = load double, ptr %38, align 8, !tbaa !15
  %40 = load double, ptr %4, align 8, !tbaa !9
  %41 = fcmp olt double %39, %40
  br i1 %41, label %42, label %50

42:                                               ; preds = %33
  %43 = load i32, ptr %6, align 4, !tbaa !13
  %44 = icmp eq i32 %43, -1
  br i1 %44, label %45, label %47

45:                                               ; preds = %42
  %46 = load i32, ptr %9, align 4, !tbaa !13
  store i32 %46, ptr %6, align 4, !tbaa !13
  br label %49

47:                                               ; preds = %42
  %48 = load i32, ptr %9, align 4, !tbaa !13
  store i32 %48, ptr %7, align 4, !tbaa !13
  br label %49

49:                                               ; preds = %47, %45
  br label %70

50:                                               ; preds = %33
  %51 = load i32, ptr %7, align 4, !tbaa !13
  %52 = icmp ne i32 %51, -1
  br i1 %52, label %53, label %69

53:                                               ; preds = %50
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = load i32, ptr %7, align 4, !tbaa !13
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef %56) #3
  %58 = getelementptr inbounds %struct.Data, ptr %57, i32 0, i32 0
  %59 = load double, ptr %58, align 8, !tbaa !11
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = load i32, ptr %6, align 4, !tbaa !13
  %62 = sext i32 %61 to i64
  %63 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef %62) #3
  %64 = getelementptr inbounds %struct.Data, ptr %63, i32 0, i32 0
  %65 = load double, ptr %64, align 8, !tbaa !11
  %66 = fsub double %59, %65
  %67 = load double, ptr %8, align 8, !tbaa !9
  %68 = fadd double %67, %66
  store double %68, ptr %8, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %53, %50
  store i32 -1, ptr %6, align 4, !tbaa !13
  store i32 -1, ptr %7, align 4, !tbaa !13
  br label %70

70:                                               ; preds = %69, %49
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %9, align 4, !tbaa !13
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %9, align 4, !tbaa !13
  br label %26, !llvm.loop !16

74:                                               ; preds = %32
  %75 = load double, ptr %8, align 8, !tbaa !9
  %76 = load double, ptr %5, align 8, !tbaa !9
  %77 = fdiv double %75, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret double %77
}

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 = { noreturn nounwind "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 = { nounwind }
attributes #4 = { noreturn 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 0}
!12 = !{!"_ZTS4Data", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !10, i64 48}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [114 x i8], align 1
@__PRETTY_FUNCTION__._Z13ComputeSafetyRKSt6vectorI4DataSaIS0_EEd = external hidden unnamed_addr constant [62 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4DataSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z13ComputeSafetyRKSt6vectorI4DataSaIS0_EEd(ptr noundef nonnull align 8 dereferenceable(24) %0, double noundef %1) local_unnamed_addr #0 {
  %3 = tail call noundef zeroext i1 @_ZNKSt6vectorI4DataSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  br i1 %3, label %4, label %5

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 78, ptr noundef nonnull @__PRETTY_FUNCTION__._Z13ComputeSafetyRKSt6vectorI4DataSaIS0_EEd) #3
  unreachable

5:                                                ; preds = %2
  %6 = tail call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = tail call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  %9 = load double, ptr %8, align 8, !tbaa !5
  %10 = tail call noundef i64 @_ZNKSt6vectorI4DataSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  %11 = trunc i64 %10 to i32
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %32, %5
  %.019.lcssa = phi double [ 0.000000e+00, %5 ], [ %.2, %32 ]
  %13 = fsub double %7, %9
  %14 = fdiv double %.019.lcssa, %13
  ret double %14

.lr.ph:                                           ; preds = %5, %32
  %indvars.iv = phi i64 [ %indvars.iv.next, %32 ], [ 0, %5 ]
  %.01926 = phi double [ %.2, %32 ], [ 0.000000e+00, %5 ]
  %.02025 = phi i32 [ %.121, %32 ], [ -1, %5 ]
  %.02224 = phi i32 [ %.123, %32 ], [ -1, %5 ]
  %15 = tail call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #2
  %16 = getelementptr inbounds i8, ptr %15, i64 48
  %17 = load double, ptr %16, align 8, !tbaa !10
  %18 = fcmp olt double %17, %1
  br i1 %18, label %19, label %22

19:                                               ; preds = %.lr.ph
  %20 = icmp eq i32 %.02224, -1
  %21 = trunc nuw nsw i64 %indvars.iv to i32
  %.0..022 = select i1 %20, i32 %21, i32 %.02224
  %.020..0 = select i1 %20, i32 %.02025, i32 %21
  br label %32

22:                                               ; preds = %.lr.ph
  %.not = icmp eq i32 %.02025, -1
  br i1 %.not, label %32, label %23

23:                                               ; preds = %22
  %24 = sext i32 %.02025 to i64
  %25 = tail call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %24) #2
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = sext i32 %.02224 to i64
  %28 = tail call noundef nonnull align 8 dereferenceable(64) ptr @_ZNKSt6vectorI4DataSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %27) #2
  %29 = load double, ptr %28, align 8, !tbaa !5
  %30 = fsub double %26, %29
  %31 = fadd double %.01926, %30
  br label %32

32:                                               ; preds = %22, %23, %19
  %.123 = phi i32 [ %.0..022, %19 ], [ -1, %23 ], [ -1, %22 ]
  %.121 = phi i32 [ %.020..0, %19 ], [ -1, %23 ], [ -1, %22 ]
  %.2 = phi double [ %.01926, %19 ], [ %31, %23 ], [ %.01926, %22 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = tail call noundef i64 @_ZNKSt6vectorI4DataSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  %sext = shl i64 %33, 32
  %34 = ashr exact i64 %sext, 32
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !11
}

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 = { noreturn nounwind "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 }
attributes #3 = { noreturn 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 = !{!"_ZTS4Data", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 48}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass