; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3Plane.ll (ZN7R3PlaneC2ERK7RNArrayIP7R3PointEi)

; 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.R3Plane = type { %class.R3Vector, double }
%class.R3Vector = type { [3 x double] }
%class.R3Point = type { [3 x double] }
%class.R3Triad = type { [3 x %class.R3Vector] }

@R3null_plane = external dso_local global %class.R3Plane, align 8
@R3null_vector = external global %class.R3Vector, align 8

declare void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0

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

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

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

declare void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7R3PlaneC2ERK7RNArrayIP7R3PointEi(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2) unnamed_addr #4 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %class.R3Point, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca %class.R3Triad, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %14 = load ptr, ptr %4, align 8
  %15 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %16 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  %17 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(24) @R3null_vector)
  %18 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 1
  store double 0.000000e+00, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %19)
  store i32 %20, ptr %7, align 4, !tbaa !9
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = icmp slt i32 %21, 3
  br i1 %22, label %23, label %25

23:                                               ; preds = %3
  %24 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN7R3PlaneaSERKS_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull align 8 dereferenceable(32) @R3null_plane)
  store i32 1, ptr %8, align 4
  br label %117

25:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #6
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_Z10R3CentroidRK7RNArrayIP7R3PointEPKd(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %9, ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef null)
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %91

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = sub nsw i32 %31, 1
  %33 = call noundef ptr @_ZNK7RNArrayIP7R3PointEixEi(ptr noundef nonnull align 8 dereferenceable(16) %30, i32 noundef %32)
  store ptr %33, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %86, %29
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %89

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = call noundef ptr @_ZNK7RNArrayIP7R3PointEixEi(ptr noundef nonnull align 8 dereferenceable(16) %40, i32 noundef %41)
  store ptr %42, ptr %12, align 8, !tbaa !5
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %43)
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  %46 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %45)
  %47 = fsub double %44, %46
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %48)
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %50)
  %52 = fadd double %49, %51
  %53 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %53, i32 noundef 0)
  %55 = load double, ptr %54, align 8, !tbaa !15
  %56 = call double @llvm.fmuladd.f64(double %47, double %52, double %55)
  store double %56, ptr %54, align 8, !tbaa !15
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %57)
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %59)
  %61 = fsub double %58, %60
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %62)
  %64 = load ptr, ptr %12, align 8, !tbaa !5
  %65 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %64)
  %66 = fadd double %63, %65
  %67 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %67, i32 noundef 1)
  %69 = load double, ptr %68, align 8, !tbaa !15
  %70 = call double @llvm.fmuladd.f64(double %61, double %66, double %69)
  store double %70, ptr %68, align 8, !tbaa !15
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %71)
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %73)
  %75 = fsub double %72, %74
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %76)
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %78)
  %80 = fadd double %77, %79
  %81 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %81, i32 noundef 2)
  %83 = load double, ptr %82, align 8, !tbaa !15
  %84 = call double @llvm.fmuladd.f64(double %75, double %80, double %83)
  store double %84, ptr %82, align 8, !tbaa !15
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %85, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %86

86:                                               ; preds = %39
  %87 = load i32, ptr %11, align 4, !tbaa !9
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %11, align 4, !tbaa !9
  br label %34, !llvm.loop !16

89:                                               ; preds = %38
  %90 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  call void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24) %90)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %96

91:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 72, ptr %13) #6
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_Z15R3PrincipleAxesRK7R3PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind writable sret(%class.R3Triad) align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(16) %92, ptr noundef null, ptr noundef null)
  %93 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3TriadixEi(ptr noundef nonnull align 8 dereferenceable(72) %13, i32 noundef 2)
  %94 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  %95 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %94, ptr noundef nonnull align 8 dereferenceable(24) %93)
  call void @llvm.lifetime.end.p0(i64 72, ptr %13) #6
  br label %96

96:                                               ; preds = %91, %89
  %97 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %97, i32 noundef 0)
  %99 = load double, ptr %98, align 8, !tbaa !15
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef 0)
  %101 = load double, ptr %100, align 8, !tbaa !15
  %102 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %102, i32 noundef 1)
  %104 = load double, ptr %103, align 8, !tbaa !15
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef 1)
  %106 = load double, ptr %105, align 8, !tbaa !15
  %107 = fmul double %104, %106
  %108 = call double @llvm.fmuladd.f64(double %99, double %101, double %107)
  %109 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 0
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %109, i32 noundef 2)
  %111 = load double, ptr %110, align 8, !tbaa !15
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef 2)
  %113 = load double, ptr %112, align 8, !tbaa !15
  %114 = call double @llvm.fmuladd.f64(double %111, double %113, double %108)
  %115 = fneg double %114
  %116 = getelementptr inbounds %class.R3Plane, ptr %14, i32 0, i32 1
  store double %115, ptr %116, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  store i32 0, ptr %8, align 4
  br label %117

117:                                              ; preds = %96, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %118 = load i32, ptr %8, align 4
  switch i32 %118, label %120 [
    i32 0, label %119
    i32 1, label %119
  ]

119:                                              ; preds = %117, %117
  ret void

120:                                              ; preds = %117
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16)) #5 align 2

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

declare void @_Z10R3CentroidRK7RNArrayIP7R3PointEPKd(ptr dead_on_unwind writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

declare void @_Z15R3PrincipleAxesRK7R3PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind writable sret(%class.R3Triad) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) #0

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

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

attributes #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { 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, !14, i64 24}
!12 = !{!"_ZTS7R3Plane", !13, i64 0, !14, i64 24}
!13 = !{!"_ZTS8R3Vector", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!14, !14, i64 0}
!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"

%class.R3Plane = type { %class.R3Vector, double }
%class.R3Vector = type { [3 x double] }
%class.R3Point = type { [3 x double] }
%class.R3Triad = type { [3 x %class.R3Vector] }

@R3null_plane = external dso_local global %class.R3Plane, align 8
@R3null_vector = external global %class.R3Vector, align 8

declare void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0

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

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

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

declare void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7R3PlaneC2ERK7RNArrayIP7R3PointEi(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2) unnamed_addr #4 align 2 {
  %4 = alloca %class.R3Point, align 8
  %5 = alloca %class.R3Triad, align 8
  tail call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %6 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) @R3null_vector)
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  store double 0.000000e+00, ptr %7, align 8, !tbaa !5
  %8 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %1)
  %9 = icmp slt i32 %8, 3
  br i1 %9, label %10, label %12

10:                                               ; preds = %3
  %11 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN7R3PlaneaSERKS_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) @R3null_plane)
  br label %64

12:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @_Z10R3CentroidRK7RNArrayIP7R3PointEPKd(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef null)
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %44, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %12
  %13 = add nsw i32 %8, -1
  %14 = call noundef ptr @_ZNK7RNArrayIP7R3PointEixEi(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %13)
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  call void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  br label %47

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.028 = phi i32 [ %43, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %.02527 = phi ptr [ %15, %.lr.ph ], [ %14, %.lr.ph.preheader ]
  %15 = call noundef ptr @_ZNK7RNArrayIP7R3PointEixEi(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %.028)
  %16 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %.02527)
  %17 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %18 = fsub double %16, %17
  %19 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %.02527)
  %20 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %21 = fadd double %19, %20
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 0)
  %23 = load double, ptr %22, align 8, !tbaa !11
  %24 = call double @llvm.fmuladd.f64(double %18, double %21, double %23)
  store double %24, ptr %22, align 8, !tbaa !11
  %25 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %.02527)
  %26 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %27 = fsub double %25, %26
  %28 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %.02527)
  %29 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %30 = fadd double %28, %29
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 1)
  %32 = load double, ptr %31, align 8, !tbaa !11
  %33 = call double @llvm.fmuladd.f64(double %27, double %30, double %32)
  store double %33, ptr %31, align 8, !tbaa !11
  %34 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %.02527)
  %35 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %36 = fsub double %34, %35
  %37 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %.02527)
  %38 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %39 = fadd double %37, %38
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 2)
  %41 = load double, ptr %40, align 8, !tbaa !11
  %42 = call double @llvm.fmuladd.f64(double %36, double %39, double %41)
  store double %42, ptr %40, align 8, !tbaa !11
  %43 = add nuw nsw i32 %.028, 1
  %exitcond.not = icmp eq i32 %43, %8
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

44:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %5) #6
  call void @_Z15R3PrincipleAxesRK7R3PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind nonnull writable sret(%class.R3Triad) align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef null, ptr noundef null)
  %45 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3TriadixEi(ptr noundef nonnull align 8 dereferenceable(72) %5, i32 noundef 2)
  %46 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %45)
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %5) #6
  br label %47

47:                                               ; preds = %44, %._crit_edge
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 0)
  %49 = load double, ptr %48, align 8, !tbaa !11
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %4, i32 noundef 0)
  %51 = load double, ptr %50, align 8, !tbaa !11
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 1)
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %4, i32 noundef 1)
  %55 = load double, ptr %54, align 8, !tbaa !11
  %56 = fmul double %53, %55
  %57 = call double @llvm.fmuladd.f64(double %49, double %51, double %56)
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 2)
  %59 = load double, ptr %58, align 8, !tbaa !11
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %4, i32 noundef 2)
  %61 = load double, ptr %60, align 8, !tbaa !11
  %62 = call double @llvm.fmuladd.f64(double %59, double %61, double %57)
  %63 = fneg double %62
  store double %63, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br label %64

64:                                               ; preds = %47, %10
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5 align 2

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

declare void @_Z10R3CentroidRK7RNArrayIP7R3PointEPKd(ptr dead_on_unwind writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

declare void @_Z15R3PrincipleAxesRK7R3PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind writable sret(%class.R3Triad) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { 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, !10, i64 24}
!6 = !{!"_ZTS7R3Plane", !7, i64 0, !10, i64 24}
!7 = !{!"_ZTS8R3Vector", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass