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

; 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] }

@RN_EPSILON = external global double, 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

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: mustprogress uwtable
define dso_local noundef double @_ZNK10R2Polyline13InteriorAngleEid(ptr noundef nonnull align 8 dereferenceable(64) %0, i32 noundef %1, double noundef %2) #2 align 2 {
  %4 = alloca double, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca %class.R2Vector, align 8
  %18 = alloca %class.R2Vector, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !11
  %22 = load ptr, ptr %5, align 8
  %23 = getelementptr inbounds %class.R2Polyline, ptr %22, i32 0, i32 2
  %24 = load i32, ptr %23, align 8, !tbaa !13
  %25 = icmp slt i32 %24, 3
  br i1 %25, label %26, label %27

26:                                               ; preds = %3
  store double 0.000000e+00, ptr %4, align 8
  br label %182

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

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

54:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 2, ptr %11, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %87, %54
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = getelementptr inbounds %class.R2Polyline, ptr %22, i32 0, i32 2
  %58 = load i32, ptr %57, align 8, !tbaa !13
  %59 = sdiv i32 %58, 3
  %60 = icmp slt i32 %56, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %55
  store i32 2, ptr %12, align 4
  br label %90

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

84:                                               ; preds = %62
  store i32 2, ptr %12, align 4
  br label %90

85:                                               ; preds = %62
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %86, ptr %9, align 8, !tbaa !5
  br label %87

87:                                               ; preds = %85
  %88 = load i32, ptr %11, align 4, !tbaa !9
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %11, align 4, !tbaa !9
  br label %55, !llvm.loop !21

90:                                               ; preds = %84, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %93

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

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

117:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 2, ptr %16, align 4, !tbaa !9
  br label %118

118:                                              ; preds = %147, %117
  %119 = load i32, ptr %16, align 4, !tbaa !9
  %120 = getelementptr inbounds %class.R2Polyline, ptr %22, i32 0, i32 2
  %121 = load i32, ptr %120, align 8, !tbaa !13
  %122 = sdiv i32 %121, 3
  %123 = icmp slt i32 %119, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %118
  store i32 5, ptr %12, align 4
  br label %150

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

144:                                              ; preds = %125
  store i32 5, ptr %12, align 4
  br label %150

145:                                              ; preds = %125
  %146 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %146, ptr %14, align 8, !tbaa !5
  br label %147

147:                                              ; preds = %145
  %148 = load i32, ptr %16, align 4, !tbaa !9
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %16, align 4, !tbaa !9
  br label %118, !llvm.loop !23

150:                                              ; preds = %144, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %151

151:                                              ; preds = %150
  br label %152

152:                                              ; preds = %151, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %153

153:                                              ; preds = %152, %93
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #4
  %154 = load ptr, ptr %8, align 8, !tbaa !5
  %155 = getelementptr inbounds %class.R2Polyline, ptr %22, i32 0, i32 1
  %156 = load ptr, ptr %155, align 8, !tbaa !20
  %157 = load i32, ptr %6, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds %class.R2Point, ptr %156, i64 %158
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %17, ptr noundef nonnull align 8 dereferenceable(16) %154, ptr noundef nonnull align 8 dereferenceable(16) %159)
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #4
  %160 = load ptr, ptr %13, align 8, !tbaa !5
  %161 = getelementptr inbounds %class.R2Polyline, ptr %22, i32 0, i32 1
  %162 = load ptr, ptr %161, align 8, !tbaa !20
  %163 = load i32, ptr %6, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds %class.R2Point, ptr %162, i64 %164
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %18, ptr noundef nonnull align 8 dereferenceable(16) %160, ptr noundef nonnull align 8 dereferenceable(16) %165)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %166 = call noundef double @_ZNK8R2Vector6LengthEv(ptr noundef nonnull align 8 dereferenceable(16) %17)
  store double %166, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %167 = call noundef double @_ZNK8R2Vector6LengthEv(ptr noundef nonnull align 8 dereferenceable(16) %18)
  store double %167, ptr %20, align 8, !tbaa !11
  %168 = load double, ptr %19, align 8, !tbaa !11
  %169 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %170 = call noundef i32 @_Z8RNIsZerodd(double noundef %168, double noundef %169)
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %177, label %172

172:                                              ; preds = %153
  %173 = load double, ptr %20, align 8, !tbaa !11
  %174 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %175 = call noundef i32 @_Z8RNIsZerodd(double noundef %173, double noundef %174)
  %176 = icmp ne i32 %175, 0
  br i1 %176, label %177, label %178

177:                                              ; preds = %172, %153
  store double -1.000000e+00, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %181

178:                                              ; preds = %172
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %179 = call noundef double @_Z15R2InteriorAngleRK8R2VectorS1_(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(16) %18)
  store double %179, ptr %21, align 8, !tbaa !11
  %180 = load double, ptr %21, align 8, !tbaa !11
  store double %180, ptr %4, align 8
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  br label %181

181:                                              ; preds = %178, %177
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %182

182:                                              ; preds = %181, %26
  %183 = load double, ptr %4, align 8
  ret double %183
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) #3

declare noundef double @_Z15R2InteriorAngleRK8R2VectorS1_(ptr noundef nonnull align 8 dereferenceable(16), 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] }

@RN_EPSILON = external local_unnamed_addr global double, 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

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: mustprogress uwtable
define dso_local noundef double @_ZNK10R2Polyline13InteriorAngleEid(ptr nocapture noundef nonnull readonly align 8 dereferenceable(64) %0, i32 noundef %1, double noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %class.R2Vector, align 8
  %5 = alloca %class.R2Vector, align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp slt i32 %7, 3
  br i1 %8, label %85, label %9

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

.thread65:                                        ; preds = %9
  %18 = add nsw i32 %1, 1
  %19 = srem i32 %18, %7
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds %class.R2Point, ptr %11, i64 %20
  %.pre = sext i32 %1 to i64
  br label %.loopexit

22:                                               ; preds = %9
  %23 = sext i32 %1 to i64
  %24 = getelementptr inbounds %class.R2Point, ptr %11, i64 %23
  %25 = tail call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %24)
  %26 = fcmp olt double %25, %2
  br i1 %26, label %.preheader67, label %.thread

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

.thread:                                          ; preds = %22
  %29 = add nsw i32 %1, 1
  %30 = load i32, ptr %6, align 8, !tbaa !5
  %31 = srem i32 %29, %30
  br label %49

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

.lr.ph:                                           ; preds = %.preheader67, %32
  %36 = phi i32 [ %.pre.pre, %32 ], [ %27, %.preheader67 ]
  %.04270 = phi ptr [ %42, %32 ], [ %16, %.preheader67 ]
  %.05269 = phi i32 [ %33, %32 ], [ 2, %.preheader67 ]
  %.05368 = phi double [ %44, %32 ], [ %25, %.preheader67 ]
  %37 = load ptr, ptr %10, align 8, !tbaa !16
  %38 = sub i32 %1, %.05269
  %39 = add nsw i32 %38, %36
  %40 = srem i32 %39, %36
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds %class.R2Point, ptr %37, i64 %41
  %43 = tail call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(16) %.04270)
  %44 = fadd double %.05368, %43
  %45 = fcmp ult double %44, %2
  %.pre.pre = load i32, ptr %6, align 8, !tbaa !5
  br i1 %45, label %32, label %._crit_edge

._crit_edge:                                      ; preds = %32, %.lr.ph, %.preheader67
  %46 = phi i32 [ %27, %.preheader67 ], [ %.pre.pre, %.lr.ph ], [ %.pre.pre, %32 ]
  %.3 = phi ptr [ %16, %.preheader67 ], [ %42, %.lr.ph ], [ %42, %32 ]
  %47 = add nsw i32 %1, 1
  %48 = srem i32 %47, %46
  br label %49

49:                                               ; preds = %._crit_edge, %.thread
  %.sink83 = phi i32 [ %48, %._crit_edge ], [ %31, %.thread ]
  %.364 = phi ptr [ %.3, %._crit_edge ], [ %16, %.thread ]
  %.sink = load ptr, ptr %10, align 8, !tbaa !16
  %50 = sext i32 %.sink83 to i64
  %51 = getelementptr inbounds %class.R2Point, ptr %.sink, i64 %50
  %52 = getelementptr inbounds %class.R2Point, ptr %.sink, i64 %23
  %53 = tail call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %51, ptr noundef nonnull align 8 dereferenceable(16) %52)
  %54 = fcmp olt double %53, %2
  %55 = load i32, ptr %6, align 8
  %56 = icmp sgt i32 %55, 8
  %or.cond = select i1 %54, i1 %56, i1 false
  br i1 %or.cond, label %.lr.ph76, label %.loopexit

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

.lr.ph76:                                         ; preds = %49, %57
  %62 = phi i32 [ %59, %57 ], [ %55, %49 ]
  %.04575 = phi i32 [ %58, %57 ], [ 2, %49 ]
  %.04674 = phi double [ %69, %57 ], [ %53, %49 ]
  %.04773 = phi ptr [ %67, %57 ], [ %51, %49 ]
  %63 = load ptr, ptr %10, align 8, !tbaa !16
  %64 = add nsw i32 %.04575, %1
  %65 = srem i32 %64, %62
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds %class.R2Point, ptr %63, i64 %66
  %68 = tail call noundef double @_Z10R2DistanceRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %67, ptr noundef nonnull align 8 dereferenceable(16) %.04773)
  %69 = fadd double %.04674, %68
  %70 = fcmp ult double %69, %2
  br i1 %70, label %57, label %.loopexit

.loopexit:                                        ; preds = %57, %.lr.ph76, %.thread65, %49
  %.pre-phi = phi i64 [ %.pre, %.thread65 ], [ %23, %49 ], [ %23, %.lr.ph76 ], [ %23, %57 ]
  %.363 = phi ptr [ %16, %.thread65 ], [ %.364, %49 ], [ %.364, %.lr.ph76 ], [ %.364, %57 ]
  %.351 = phi ptr [ %21, %.thread65 ], [ %51, %49 ], [ %67, %.lr.ph76 ], [ %67, %57 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %71 = load ptr, ptr %10, align 8, !tbaa !16
  %72 = getelementptr inbounds %class.R2Point, ptr %71, i64 %.pre-phi
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %.363, ptr noundef nonnull align 8 dereferenceable(16) %72)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  %73 = load ptr, ptr %10, align 8, !tbaa !16
  %74 = getelementptr inbounds %class.R2Point, ptr %73, i64 %.pre-phi
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %.351, ptr noundef nonnull align 8 dereferenceable(16) %74)
  %75 = call noundef double @_ZNK8R2Vector6LengthEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %76 = call noundef double @_ZNK8R2Vector6LengthEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %77 = load double, ptr @RN_EPSILON, align 8, !tbaa !20
  %78 = call noundef i32 @_Z8RNIsZerodd(double noundef %75, double noundef %77)
  %.not = icmp eq i32 %78, 0
  br i1 %.not, label %79, label %84

79:                                               ; preds = %.loopexit
  %80 = load double, ptr @RN_EPSILON, align 8, !tbaa !20
  %81 = call noundef i32 @_Z8RNIsZerodd(double noundef %76, double noundef %80)
  %.not61 = icmp eq i32 %81, 0
  br i1 %.not61, label %82, label %84

82:                                               ; preds = %79
  %83 = call noundef double @_Z15R2InteriorAngleRK8R2VectorS1_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %5)
  br label %84

84:                                               ; preds = %.loopexit, %79, %82
  %.0 = phi double [ %83, %82 ], [ -1.000000e+00, %79 ], [ -1.000000e+00, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br label %85

85:                                               ; preds = %3, %84
  %.1 = phi double [ %.0, %84 ], [ 0.000000e+00, %3 ]
  ret double %.1
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) local_unnamed_addr #3

declare noundef double @_Z15R2InteriorAngleRK8R2VectorS1_(ptr noundef nonnull align 8 dereferenceable(16), 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