; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Polyline.ll (ZNK10R2Polyline6NormalEid)

; 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.R2Vector = type { [2 x double] }
%class.R2Polyline = type { %class.R2Curve, ptr, i32, %class.R2Box }
%class.R2Curve = type { %class.R2Shape }
%class.R2Shape = type { ptr }
%class.R2Box = type { %class.R2Solid, %class.R2Point, %class.R2Point }
%class.R2Solid = type { %class.R2Shape }
%class.R2Point = type { [2 x double] }

@R2null_vector = external global %class.R2Vector, align 8

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

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

declare noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10R2Polyline6NormalEid(ptr dead_on_unwind noalias writable sret(%class.R2Vector) align 8 %0, ptr noundef nonnull align 8 dereferenceable(64) %1, i32 noundef %2, double noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca %class.R2Vector, align 8
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store double %3, ptr %8, align 8, !tbaa !11
  %19 = load ptr, ptr %6, align 8
  %20 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %21 = load i32, ptr %20, align 8, !tbaa !13
  %22 = icmp slt i32 %21, 3
  br i1 %22, label %23, label %24

23:                                               ; preds = %4
  call void @_ZN8R2VectorC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) @R2null_vector)
  br label %158

24:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %25 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = sub nsw i32 %27, 1
  %29 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %30 = load i32, ptr %29, align 8, !tbaa !13
  %31 = add nsw i32 %28, %30
  %32 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %33 = load i32, ptr %32, align 8, !tbaa !13
  %34 = srem i32 %31, %33
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds %class.R2Point, ptr %26, i64 %35
  store ptr %36, ptr %9, align 8, !tbaa !5
  %37 = load double, ptr %8, align 8, !tbaa !11
  %38 = fcmp ogt double %37, 0.000000e+00
  br i1 %38, label %39, label %90

39:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %40, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !20
  %44 = load i32, ptr %7, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds %class.R2Point, ptr %43, i64 %45
  %47 = call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 8 dereferenceable(16) %46)
  store double %47, ptr %11, align 8, !tbaa !11
  %48 = load double, ptr %11, align 8, !tbaa !11
  %49 = load double, ptr %8, align 8, !tbaa !11
  %50 = fcmp olt double %48, %49
  br i1 %50, label %51, label %89

51:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 2, ptr %12, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %84, %51
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %55 = load i32, ptr %54, align 8, !tbaa !13
  %56 = sdiv i32 %55, 3
  %57 = icmp slt i32 %53, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %52
  store i32 2, ptr %13, align 4
  br label %87

59:                                               ; preds = %52
  %60 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 1
  %61 = load ptr, ptr %60, align 8, !tbaa !20
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = sub nsw i32 %62, %63
  %65 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %66 = load i32, ptr %65, align 8, !tbaa !13
  %67 = add nsw i32 %64, %66
  %68 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %69 = load i32, ptr %68, align 8, !tbaa !13
  %70 = srem i32 %67, %69
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %class.R2Point, ptr %61, i64 %71
  store ptr %72, ptr %9, align 8, !tbaa !5
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %73, ptr noundef nonnull align 8 dereferenceable(16) %74)
  %76 = load double, ptr %11, align 8, !tbaa !11
  %77 = fadd double %76, %75
  store double %77, ptr %11, align 8, !tbaa !11
  %78 = load double, ptr %11, align 8, !tbaa !11
  %79 = load double, ptr %8, align 8, !tbaa !11
  %80 = fcmp oge double %78, %79
  br i1 %80, label %81, label %82

81:                                               ; preds = %59
  store i32 2, ptr %13, align 4
  br label %87

82:                                               ; preds = %59
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %83, ptr %10, align 8, !tbaa !5
  br label %84

84:                                               ; preds = %82
  %85 = load i32, ptr %12, align 4, !tbaa !9
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %12, align 4, !tbaa !9
  br label %52, !llvm.loop !21

87:                                               ; preds = %81, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %90

90:                                               ; preds = %89, %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %91 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 1
  %92 = load ptr, ptr %91, align 8, !tbaa !20
  %93 = load i32, ptr %7, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  %95 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %96 = load i32, ptr %95, align 8, !tbaa !13
  %97 = srem i32 %94, %96
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds %class.R2Point, ptr %92, i64 %98
  store ptr %99, ptr %14, align 8, !tbaa !5
  %100 = load double, ptr %8, align 8, !tbaa !11
  %101 = fcmp ogt double %100, 0.000000e+00
  br i1 %101, label %102, label %150

102:                                              ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %103, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  %105 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 1
  %106 = load ptr, ptr %105, align 8, !tbaa !20
  %107 = load i32, ptr %7, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds %class.R2Point, ptr %106, i64 %108
  %110 = call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %104, ptr noundef nonnull align 8 dereferenceable(16) %109)
  store double %110, ptr %16, align 8, !tbaa !11
  %111 = load double, ptr %16, align 8, !tbaa !11
  %112 = load double, ptr %8, align 8, !tbaa !11
  %113 = fcmp olt double %111, %112
  br i1 %113, label %114, label %149

114:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 2, ptr %17, align 4, !tbaa !9
  br label %115

115:                                              ; preds = %144, %114
  %116 = load i32, ptr %17, align 4, !tbaa !9
  %117 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %118 = load i32, ptr %117, align 8, !tbaa !13
  %119 = sdiv i32 %118, 3
  %120 = icmp slt i32 %116, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %115
  store i32 5, ptr %13, align 4
  br label %147

122:                                              ; preds = %115
  %123 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 1
  %124 = load ptr, ptr %123, align 8, !tbaa !20
  %125 = load i32, ptr %7, align 4, !tbaa !9
  %126 = load i32, ptr %17, align 4, !tbaa !9
  %127 = add nsw i32 %125, %126
  %128 = getelementptr inbounds %class.R2Polyline, ptr %19, i32 0, i32 2
  %129 = load i32, ptr %128, align 8, !tbaa !13
  %130 = srem i32 %127, %129
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds %class.R2Point, ptr %124, i64 %131
  store ptr %132, ptr %14, align 8, !tbaa !5
  %133 = load ptr, ptr %14, align 8, !tbaa !5
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %133, ptr noundef nonnull align 8 dereferenceable(16) %134)
  %136 = load double, ptr %16, align 8, !tbaa !11
  %137 = fadd double %136, %135
  store double %137, ptr %16, align 8, !tbaa !11
  %138 = load double, ptr %16, align 8, !tbaa !11
  %139 = load double, ptr %8, align 8, !tbaa !11
  %140 = fcmp oge double %138, %139
  br i1 %140, label %141, label %142

141:                                              ; preds = %122
  store i32 5, ptr %13, align 4
  br label %147

142:                                              ; preds = %122
  %143 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %143, ptr %15, align 8, !tbaa !5
  br label %144

144:                                              ; preds = %142
  %145 = load i32, ptr %17, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %17, align 4, !tbaa !9
  br label %115, !llvm.loop !23

147:                                              ; preds = %141, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %148

148:                                              ; preds = %147
  br label %149

149:                                              ; preds = %148, %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %150

150:                                              ; preds = %149, %90
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #4
  %151 = load ptr, ptr %14, align 8, !tbaa !5
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %18, ptr noundef nonnull align 8 dereferenceable(16) %151, ptr noundef nonnull align 8 dereferenceable(16) %152)
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R2VectorixEi(ptr noundef nonnull align 8 dereferenceable(16) %18, i32 noundef 1)
  %154 = load double, ptr %153, align 8, !tbaa !11
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R2VectorixEi(ptr noundef nonnull align 8 dereferenceable(16) %18, i32 noundef 0)
  %156 = load double, ptr %155, align 8, !tbaa !11
  %157 = fneg double %156
  call void @_ZN8R2VectorC1Edd(ptr noundef nonnull align 8 dereferenceable(16) %0, double noundef %154, double noundef %157)
  call void @_ZN8R2Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %158

158:                                              ; preds = %150, %23
  ret void
}

declare void @_ZN8R2VectorC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

declare void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R2VectorixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

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

declare void @_ZN8R2Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 16}
!14 = !{!"_ZTS10R2Polyline", !15, i64 0, !6, i64 8, !10, i64 16, !17, i64 24}
!15 = !{!"_ZTS7R2Curve", !16, i64 0}
!16 = !{!"_ZTS7R2Shape"}
!17 = !{!"_ZTS5R2Box", !18, i64 0, !19, i64 8, !19, i64 24}
!18 = !{!"_ZTS7R2Solid", !16, i64 0}
!19 = !{!"_ZTS7R2Point", !7, i64 0}
!20 = !{!14, !6, i64 8}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; 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.R2Vector = type { [2 x double] }
%class.R2Point = type { [2 x double] }

@R2null_vector = external global %class.R2Vector, align 8

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

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

declare noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10R2Polyline6NormalEid(ptr dead_on_unwind noalias writable sret(%class.R2Vector) align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(64) %1, i32 noundef %2, double noundef %3) local_unnamed_addr #2 align 2 {
  %5 = alloca %class.R2Vector, align 8
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp slt i32 %7, 3
  br i1 %8, label %9, label %10

9:                                                ; preds = %4
  tail call void @_ZN8R2VectorC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) @R2null_vector)
  br label %77

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  %13 = add nsw i32 %2, -1
  %14 = add nsw i32 %13, %7
  %15 = srem i32 %14, %7
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds %class.R2Point, ptr %12, i64 %16
  %18 = fcmp ogt double %3, 0.000000e+00
  br i1 %18, label %23, label %.thread56

.thread56:                                        ; preds = %10
  %19 = add nsw i32 %2, 1
  %20 = srem i32 %19, %7
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds %class.R2Point, ptr %12, i64 %21
  br label %.loopexit

23:                                               ; preds = %10
  %24 = sext i32 %2 to i64
  %25 = getelementptr inbounds %class.R2Point, ptr %12, i64 %24
  %26 = tail call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(16) %25)
  %27 = fcmp olt double %26, %3
  br i1 %27, label %.preheader58, label %.thread

.preheader58:                                     ; preds = %23
  %28 = load i32, ptr %6, align 8, !tbaa !5
  %29 = icmp sgt i32 %28, 8
  br i1 %29, label %.lr.ph, label %._crit_edge

.thread:                                          ; preds = %23
  %30 = add nsw i32 %2, 1
  %31 = load i32, ptr %6, align 8, !tbaa !5
  %32 = srem i32 %30, %31
  br label %50

33:                                               ; preds = %.lr.ph
  %34 = add nuw nsw i32 %.03961, 1
  %35 = sdiv i32 %.pre.pre, 3
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %.lr.ph, label %._crit_edge, !llvm.loop !17

.lr.ph:                                           ; preds = %.preheader58, %33
  %37 = phi i32 [ %.pre.pre, %33 ], [ %28, %.preheader58 ]
  %.03961 = phi i32 [ %34, %33 ], [ 2, %.preheader58 ]
  %.04060 = phi double [ %45, %33 ], [ %26, %.preheader58 ]
  %.04159 = phi ptr [ %43, %33 ], [ %17, %.preheader58 ]
  %38 = load ptr, ptr %11, align 8, !tbaa !16
  %39 = sub i32 %2, %.03961
  %40 = add nsw i32 %39, %37
  %41 = srem i32 %40, %37
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds %class.R2Point, ptr %38, i64 %42
  %44 = tail call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 8 dereferenceable(16) %.04159)
  %45 = fadd double %.04060, %44
  %46 = fcmp ult double %45, %3
  %.pre.pre = load i32, ptr %6, align 8, !tbaa !5
  br i1 %46, label %33, label %._crit_edge

._crit_edge:                                      ; preds = %33, %.lr.ph, %.preheader58
  %47 = phi i32 [ %28, %.preheader58 ], [ %.pre.pre, %.lr.ph ], [ %.pre.pre, %33 ]
  %.345 = phi ptr [ %17, %.preheader58 ], [ %43, %.lr.ph ], [ %43, %33 ]
  %48 = add nsw i32 %2, 1
  %49 = srem i32 %48, %47
  br label %50

50:                                               ; preds = %._crit_edge, %.thread
  %.sink74 = phi i32 [ %49, %._crit_edge ], [ %32, %.thread ]
  %.34555 = phi ptr [ %.345, %._crit_edge ], [ %17, %.thread ]
  %.sink = load ptr, ptr %11, align 8, !tbaa !16
  %51 = sext i32 %.sink74 to i64
  %52 = getelementptr inbounds %class.R2Point, ptr %.sink, i64 %51
  %53 = getelementptr inbounds %class.R2Point, ptr %.sink, i64 %24
  %54 = tail call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %52, ptr noundef nonnull align 8 dereferenceable(16) %53)
  %55 = fcmp olt double %54, %3
  %56 = load i32, ptr %6, align 8
  %57 = icmp sgt i32 %56, 8
  %or.cond = select i1 %55, i1 %57, i1 false
  br i1 %or.cond, label %.lr.ph67, label %.loopexit

58:                                               ; preds = %.lr.ph67
  %59 = add nuw nsw i32 %.066, 1
  %60 = load i32, ptr %6, align 8, !tbaa !5
  %61 = sdiv i32 %60, 3
  %62 = icmp slt i32 %59, %61
  br i1 %62, label %.lr.ph67, label %.loopexit, !llvm.loop !19

.lr.ph67:                                         ; preds = %50, %58
  %63 = phi i32 [ %60, %58 ], [ %56, %50 ]
  %.066 = phi i32 [ %59, %58 ], [ 2, %50 ]
  %.03665 = phi double [ %70, %58 ], [ %54, %50 ]
  %.03764 = phi ptr [ %68, %58 ], [ %52, %50 ]
  %64 = load ptr, ptr %11, align 8, !tbaa !16
  %65 = add nsw i32 %.066, %2
  %66 = srem i32 %65, %63
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds %class.R2Point, ptr %64, i64 %67
  %69 = tail call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull align 8 dereferenceable(16) %.03764)
  %70 = fadd double %.03665, %69
  %71 = fcmp ult double %70, %3
  br i1 %71, label %58, label %.loopexit

.loopexit:                                        ; preds = %58, %.lr.ph67, %.thread56, %50
  %.34554 = phi ptr [ %.34555, %50 ], [ %17, %.thread56 ], [ %.34555, %.lr.ph67 ], [ %.34555, %58 ]
  %.3 = phi ptr [ %52, %50 ], [ %22, %.thread56 ], [ %68, %.lr.ph67 ], [ %68, %58 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %.3, ptr noundef nonnull align 8 dereferenceable(16) %.34554)
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R2VectorixEi(ptr noundef nonnull align 8 dereferenceable(16) %5, i32 noundef 1)
  %73 = load double, ptr %72, align 8, !tbaa !20
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R2VectorixEi(ptr noundef nonnull align 8 dereferenceable(16) %5, i32 noundef 0)
  %75 = load double, ptr %74, align 8, !tbaa !20
  %76 = fneg double %75
  call void @_ZN8R2VectorC1Edd(ptr noundef nonnull align 8 dereferenceable(16) %0, double noundef %73, double noundef %76)
  call void @_ZN8R2Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  br label %77

77:                                               ; preds = %.loopexit, %9
  ret void
}

declare void @_ZN8R2VectorC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

declare void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R2VectorixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

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

declare void @_ZN8R2Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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, !12, i64 16}
!6 = !{!"_ZTS10R2Polyline", !7, i64 0, !9, i64 8, !12, i64 16, !13, i64 24}
!7 = !{!"_ZTS7R2Curve", !8, i64 0}
!8 = !{!"_ZTS7R2Shape"}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"_ZTS5R2Box", !14, i64 0, !15, i64 8, !15, i64 24}
!14 = !{!"_ZTS7R2Solid", !8, i64 0}
!15 = !{!"_ZTS7R2Point", !10, i64 0}
!16 = !{!6, !9, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!21, !21, i64 0}
!21 = !{!"double", !10, i64 0}


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