; LLVM IR from mackorone/mms :: old/v2/src/sim/Polygon.ll (ZNK3sim7Polygon4areaEv)

; 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.sim::MetersSquared" = type { %"class.sim::Area" }
%"class.sim::Area" = type { ptr, double }
%"class.sim::Meters" = type { %"class.sim::Distance" }
%"class.sim::Distance" = type { ptr, double }
%"class.sim::Polygon" = type { %"class.std::vector.55", %"class.std::vector.60" }
%"class.std::vector.55" = type { %"struct.std::_Vector_base.56" }
%"struct.std::_Vector_base.56" = type { %"struct.std::_Vector_base<sim::Cartesian, std::allocator<sim::Cartesian>>::_Vector_impl" }
%"struct.std::_Vector_base<sim::Cartesian, std::allocator<sim::Cartesian>>::_Vector_impl" = type { %"struct.std::_Vector_base<sim::Cartesian, std::allocator<sim::Cartesian>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sim::Cartesian, std::allocator<sim::Cartesian>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.60" = type { %"struct.std::_Vector_base.61" }
%"struct.std::_Vector_base.61" = type { %"struct.std::_Vector_base<sim::Triangle, std::allocator<sim::Triangle>>::_Vector_impl" }
%"struct.std::_Vector_base<sim::Triangle, std::allocator<sim::Triangle>>::_Vector_impl" = type { %"struct.std::_Vector_base<sim::Triangle, std::allocator<sim::Triangle>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sim::Triangle, std::allocator<sim::Triangle>>::_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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3sim7Polygon4areaEv(ptr dead_on_unwind noalias writable sret(%"class.sim::MetersSquared") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.sim::Meters", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.sim::Meters", align 8
  %12 = alloca %"class.sim::Meters", align 8
  %13 = alloca %"class.sim::Meters", align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store double 0.000000e+00, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %15

15:                                               ; preds = %63, %2
  %16 = load i32, ptr %6, align 4, !tbaa !11
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds %"class.sim::Polygon", ptr %14, i32 0, i32 0
  %19 = call noundef i64 @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #7
  %20 = icmp ult i64 %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %95

22:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %23 = load i32, ptr %6, align 4, !tbaa !11
  %24 = add nsw i32 %23, 1
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds %"class.sim::Polygon", ptr %14, i32 0, i32 0
  %27 = call noundef i64 @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #7
  %28 = urem i64 %25, %27
  %29 = trunc i64 %28 to i32
  store i32 %29, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #7
  %30 = getelementptr inbounds %"class.sim::Polygon", ptr %14, i32 0, i32 0
  %31 = load i32, ptr %6, align 4, !tbaa !11
  %32 = sext i32 %31 to i64
  %33 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %32)
  call void @_ZNK3sim10Coordinate4getXEv(ptr dead_on_unwind writable sret(%"class.sim::Meters") align 8 %8, ptr noundef nonnull align 8 dereferenceable(40) %33)
  %34 = invoke noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16) %8)
          to label %35 unwind label %66

35:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  %36 = getelementptr inbounds %"class.sim::Polygon", ptr %14, i32 0, i32 0
  %37 = load i32, ptr %7, align 4, !tbaa !11
  %38 = sext i32 %37 to i64
  %39 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %38)
          to label %40 unwind label %70

40:                                               ; preds = %35
  invoke void @_ZNK3sim10Coordinate4getYEv(ptr dead_on_unwind writable sret(%"class.sim::Meters") align 8 %11, ptr noundef nonnull align 8 dereferenceable(40) %39)
          to label %41 unwind label %70

41:                                               ; preds = %40
  %42 = invoke noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
          to label %43 unwind label %74

43:                                               ; preds = %41
  %44 = load double, ptr %5, align 8, !tbaa !9
  %45 = call double @llvm.fmuladd.f64(double %34, double %42, double %44)
  store double %45, ptr %5, align 8, !tbaa !9
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %46 = getelementptr inbounds %"class.sim::Polygon", ptr %14, i32 0, i32 0
  %47 = load i32, ptr %6, align 4, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %48)
  call void @_ZNK3sim10Coordinate4getYEv(ptr dead_on_unwind writable sret(%"class.sim::Meters") align 8 %12, ptr noundef nonnull align 8 dereferenceable(40) %49)
  %50 = invoke noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
          to label %51 unwind label %80

51:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #7
  %52 = getelementptr inbounds %"class.sim::Polygon", ptr %14, i32 0, i32 0
  %53 = load i32, ptr %7, align 4, !tbaa !11
  %54 = sext i32 %53 to i64
  %55 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %54)
          to label %56 unwind label %84

56:                                               ; preds = %51
  invoke void @_ZNK3sim10Coordinate4getXEv(ptr dead_on_unwind writable sret(%"class.sim::Meters") align 8 %13, ptr noundef nonnull align 8 dereferenceable(40) %55)
          to label %57 unwind label %84

57:                                               ; preds = %56
  %58 = invoke noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16) %13)
          to label %59 unwind label %88

59:                                               ; preds = %57
  %60 = load double, ptr %5, align 8, !tbaa !9
  %61 = fneg double %50
  %62 = call double @llvm.fmuladd.f64(double %61, double %58, double %60)
  store double %62, ptr %5, align 8, !tbaa !9
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %63

63:                                               ; preds = %59
  %64 = load i32, ptr %6, align 4, !tbaa !11
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %6, align 4, !tbaa !11
  br label %15, !llvm.loop !13

66:                                               ; preds = %22
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %9, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %10, align 4
  br label %79

70:                                               ; preds = %40, %35
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %9, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %10, align 4
  br label %78

74:                                               ; preds = %41
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %9, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %10, align 4
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #7
  br label %78

78:                                               ; preds = %74, %70
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  br label %79

79:                                               ; preds = %78, %66
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  br label %94

80:                                               ; preds = %43
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %9, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %10, align 4
  br label %93

84:                                               ; preds = %56, %51
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %9, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %10, align 4
  br label %92

88:                                               ; preds = %57
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %9, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %10, align 4
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #7
  br label %92

92:                                               ; preds = %88, %84
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  br label %93

93:                                               ; preds = %92, %80
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %94

94:                                               ; preds = %93, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %99

95:                                               ; preds = %21
  %96 = load double, ptr %5, align 8, !tbaa !9
  %97 = fdiv double %96, 2.000000e+00
  %98 = call noundef double @_ZSt3absd(double noundef %97)
  call void @_ZN3sim13MetersSquaredC1Ed(ptr noundef nonnull align 8 dereferenceable(16) %0, double noundef %98)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  ret void

99:                                               ; preds = %94
  %100 = load ptr, ptr %9, align 8
  %101 = load i32, ptr %10, align 4
  %102 = insertvalue { ptr, i32 } poison, ptr %100, 0
  %103 = insertvalue { ptr, i32 } %102, i32 %101, 1
  resume { ptr, i32 } %103
}

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

declare void @_ZNK3sim10Coordinate4getXEv(ptr dead_on_unwind writable sret(%"class.sim::Meters") align 8, ptr noundef nonnull align 8 dereferenceable(40)) #3

declare noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16)) #3

declare void @_ZNK3sim10Coordinate4getYEv(ptr dead_on_unwind writable sret(%"class.sim::Meters") align 8, ptr noundef nonnull align 8 dereferenceable(40)) #3

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

; Function Attrs: nounwind
declare void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

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

declare void @_ZN3sim13MetersSquaredC1Ed(ptr noundef nonnull align 8 dereferenceable(16), double noundef) unnamed_addr #3

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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

%"class.sim::MetersSquared" = type { %"class.sim::Area" }
%"class.sim::Area" = type { ptr, double }
%"class.sim::Meters" = type { %"class.sim::Distance" }
%"class.sim::Distance" = type { ptr, double }

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3sim7Polygon4areaEv(ptr dead_on_unwind noalias writable sret(%"class.sim::MetersSquared") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.sim::Meters", align 8
  %4 = alloca %"class.sim::Meters", align 8
  %5 = alloca %"class.sim::Meters", align 8
  %6 = alloca %"class.sim::Meters", align 8
  %7 = tail call noundef i64 @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge.loopexit:                             ; preds = %28
  %8 = fmul double %30, 5.000000e-01
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %.017.lcssa = phi double [ 0.000000e+00, %2 ], [ %8, %._crit_edge.loopexit ]
  %9 = call noundef double @_ZSt3absd(double noundef %.017.lcssa)
  call void @_ZN3sim13MetersSquaredC1Ed(ptr noundef nonnull align 8 dereferenceable(16) %0, double noundef %9)
  ret void

.lr.ph:                                           ; preds = %2, %28
  %indvars.iv = phi i64 [ %indvars.iv.next, %28 ], [ 0, %2 ]
  %.01733 = phi double [ %30, %28 ], [ 0.000000e+00, %2 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %10 = call noundef i64 @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  %11 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv)
  call void @_ZNK3sim10Coordinate4getXEv(ptr dead_on_unwind nonnull writable sret(%"class.sim::Meters") align 8 %3, ptr noundef nonnull align 8 dereferenceable(40) %11)
  %12 = invoke noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
          to label %13 unwind label %33

13:                                               ; preds = %.lr.ph
  %14 = urem i64 %indvars.iv.next, %10
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  %15 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %14)
          to label %16 unwind label %35

16:                                               ; preds = %13
  invoke void @_ZNK3sim10Coordinate4getYEv(ptr dead_on_unwind nonnull writable sret(%"class.sim::Meters") align 8 %4, ptr noundef nonnull align 8 dereferenceable(40) %15)
          to label %17 unwind label %35

17:                                               ; preds = %16
  %18 = invoke noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %19 unwind label %37

19:                                               ; preds = %17
  %20 = call double @llvm.fmuladd.f64(double %12, double %18, double %.01733)
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %21 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv)
  call void @_ZNK3sim10Coordinate4getYEv(ptr dead_on_unwind nonnull writable sret(%"class.sim::Meters") align 8 %5, ptr noundef nonnull align 8 dereferenceable(40) %21)
  %22 = invoke noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
          to label %23 unwind label %41

23:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %24 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %14)
          to label %25 unwind label %43

25:                                               ; preds = %23
  invoke void @_ZNK3sim10Coordinate4getXEv(ptr dead_on_unwind nonnull writable sret(%"class.sim::Meters") align 8 %6, ptr noundef nonnull align 8 dereferenceable(40) %24)
          to label %26 unwind label %43

26:                                               ; preds = %25
  %27 = invoke noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %28 unwind label %45

28:                                               ; preds = %26
  %29 = fneg double %22
  %30 = call double @llvm.fmuladd.f64(double %29, double %27, double %20)
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  %31 = call noundef i64 @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %32 = icmp ugt i64 %31, %indvars.iv.next
  br i1 %32, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !5

33:                                               ; preds = %.lr.ph
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %40

35:                                               ; preds = %16, %13
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %39

37:                                               ; preds = %17
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  br label %39

39:                                               ; preds = %37, %35
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %36, %35 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  br label %40

40:                                               ; preds = %39, %33
  %.pn.pn = phi { ptr, i32 } [ %.pn, %39 ], [ %34, %33 ]
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  br label %49

41:                                               ; preds = %19
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %48

43:                                               ; preds = %25, %23
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %47

45:                                               ; preds = %26
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #7
  br label %47

47:                                               ; preds = %45, %43
  %.pn22 = phi { ptr, i32 } [ %46, %45 ], [ %44, %43 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  br label %48

48:                                               ; preds = %47, %41
  %.pn22.pn = phi { ptr, i32 } [ %.pn22, %47 ], [ %42, %41 ]
  call void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %49

49:                                               ; preds = %48, %40
  %.pn22.pn.pn = phi { ptr, i32 } [ %.pn22.pn, %48 ], [ %.pn.pn, %40 ]
  resume { ptr, i32 } %.pn22.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIN3sim9CartesianESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

declare void @_ZNK3sim10Coordinate4getXEv(ptr dead_on_unwind writable sret(%"class.sim::Meters") align 8, ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3

declare noundef double @_ZNK3sim8Distance9getMetersEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

declare void @_ZNK3sim10Coordinate4getYEv(ptr dead_on_unwind writable sret(%"class.sim::Meters") align 8, ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3

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

; Function Attrs: nounwind
declare void @_ZN3sim8DistanceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

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

declare void @_ZN3sim13MetersSquaredC1Ed(ptr noundef nonnull align 8 dereferenceable(16), double noundef) unnamed_addr #3

attributes #0 = { mustprogress 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 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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