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

; 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.R3Vector = type { [3 x double] }
%class.R3Point = type { [3 x double] }
%class.R3Span = type { %class.R3Ray, %class.R3Point, double }
%class.R3Ray = type { %class.R3Line }
%class.R3Line = type { %class.R3Point, %class.R3Vector }
%class.R3Plane = type { %class.R3Vector, double }
%class.R3Triangle = type <{ %class.R3Surface, [3 x ptr], %class.R3Plane, %class.R3Box, %class.RNFlags, i32, [4 x i8] }>
%class.R3Surface = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.RNFlags = type { i64 }

@RN_EPSILON = external global double, align 8

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10R3Triangle12ClosestPointERK7R3Point(ptr dead_on_unwind noalias writable sret(%class.R3Point) align 8 %0, ptr noundef nonnull align 8 dereferenceable(132) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) unnamed_addr #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %class.R3Point, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %class.R3Point, align 8
  %13 = alloca %class.R3Point, align 8
  %14 = alloca %class.R3Span, align 8
  %15 = alloca %class.R3Vector, align 8
  %16 = alloca %class.R3Plane, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca %class.R3Point, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %21)
  %22 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK10R3Triangle5PlaneEv(ptr noundef nonnull align 8 dereferenceable(132) %20)
  call void @_ZN7R3Point7ProjectERK7R3Plane(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(32) %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %78, %3
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = icmp slt i32 %24, 3
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  store i32 2, ptr %9, align 4
  br label %81

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %28 = getelementptr inbounds %class.R3Triangle, ptr %20, i32 0, i32 1
  %29 = load i32, ptr %8, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [3 x ptr], ptr %28, i64 0, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  store ptr %32, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %33 = getelementptr inbounds %class.R3Triangle, ptr %20, i32 0, i32 1
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  %36 = srem i32 %35, 3
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [3 x ptr], ptr %33, i64 0, i64 %37
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  store ptr %39, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #5
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK16R3TriangleVertex8PositionEv(ptr noundef nonnull align 8 dereferenceable(100) %40)
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %41)
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #5
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK16R3TriangleVertex8PositionEv(ptr noundef nonnull align 8 dereferenceable(100) %42)
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(24) %43)
  call void @llvm.lifetime.start.p0(i64 80, ptr %14) #5
  call void @_ZN6R3SpanC1ERK7R3PointS2_(ptr noundef nonnull align 8 dereferenceable(80) %14, ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %13)
  %44 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %14)
  %45 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %46 = call noundef i32 @_Z8RNIsZerodd(double noundef %44, double noundef %45)
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %52

48:                                               ; preds = %27
  %49 = load ptr, ptr %20, align 8, !tbaa !13
  %50 = getelementptr inbounds ptr, ptr %49, i64 13
  %51 = load ptr, ptr %50, align 8
  call void %51(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %0, ptr noundef nonnull align 8 dereferenceable(132) %20)
  store i32 1, ptr %9, align 4
  br label %75

52:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #5
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span6VectorEv(ptr noundef nonnull align 8 dereferenceable(80) %14)
  %54 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10R3Triangle6NormalEv(ptr noundef nonnull align 8 dereferenceable(132) %20)
  call void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %15, ptr noundef nonnull align 8 dereferenceable(24) %53, ptr noundef nonnull align 8 dereferenceable(24) %54)
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #5
  call void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %15)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %55 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(24) %7)
  store double %55, ptr %17, align 8, !tbaa !11
  %56 = load double, ptr %17, align 8, !tbaa !11
  %57 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %58 = call noundef i32 @_Z12RNIsPositivedd(double noundef %56, double noundef %57)
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %74

60:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %61 = call noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80) %14, ptr noundef nonnull align 8 dereferenceable(24) %7)
  store double %61, ptr %18, align 8, !tbaa !11
  %62 = load double, ptr %18, align 8, !tbaa !11
  %63 = fcmp olt double %62, 0.000000e+00
  br i1 %63, label %64, label %65

64:                                               ; preds = %60
  store double 0.000000e+00, ptr %18, align 8, !tbaa !11
  br label %65

65:                                               ; preds = %64, %60
  %66 = load double, ptr %18, align 8, !tbaa !11
  %67 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %14)
  %68 = fcmp ogt double %66, %67
  br i1 %68, label %69, label %71

69:                                               ; preds = %65
  %70 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %14)
  store double %70, ptr %18, align 8, !tbaa !11
  br label %71

71:                                               ; preds = %69, %65
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #5
  %72 = load double, ptr %18, align 8, !tbaa !11
  call void @_ZNK6R3Span5PointEd(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %19, ptr noundef nonnull align 8 dereferenceable(80) %14, double noundef %72)
  %73 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %19)
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %74

74:                                               ; preds = %71, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  store i32 0, ptr %9, align 4
  br label %75

75:                                               ; preds = %74, %48
  call void @llvm.lifetime.end.p0(i64 80, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %76 = load i32, ptr %9, align 4
  switch i32 %76, label %81 [
    i32 0, label %77
  ]

77:                                               ; preds = %75
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %8, align 4, !tbaa !9
  br label %23, !llvm.loop !15

81:                                               ; preds = %75, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %82 = load i32, ptr %9, align 4
  switch i32 %82, label %84 [
    i32 2, label %83
  ]

83:                                               ; preds = %81
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %7)
  store i32 1, ptr %9, align 4
  br label %84

84:                                               ; preds = %83, %81
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  ret void
}

declare void @_ZN7R3Point7ProjectERK7R3Plane(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK10R3Triangle5PlaneEv(ptr noundef nonnull align 8 dereferenceable(132)) #2 align 2

declare void @_ZN6R3SpanC1ERK7R3PointS2_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span6VectorEv(ptr noundef nonnull align 8 dereferenceable(80)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10R3Triangle6NormalEv(ptr noundef nonnull align 8 dereferenceable(132)) #4 align 2

declare void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

declare noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z12RNIsPositivedd(double noundef, double noundef) #2

declare noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24)) #0

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

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

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 willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = { 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 #5 = { 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, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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.R3Vector = type { [3 x double] }
%class.R3Point = type { [3 x double] }
%class.R3Span = type { %class.R3Ray, %class.R3Point, double }
%class.R3Ray = type { %class.R3Line }
%class.R3Line = type { %class.R3Point, %class.R3Vector }
%class.R3Plane = type { %class.R3Vector, double }

@RN_EPSILON = external local_unnamed_addr global double, align 8

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10R3Triangle12ClosestPointERK7R3Point(ptr dead_on_unwind noalias writable sret(%class.R3Point) align 8 %0, ptr noundef nonnull align 8 dereferenceable(132) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) unnamed_addr #3 align 2 {
  %4 = alloca %class.R3Point, align 8
  %5 = alloca %class.R3Point, align 8
  %6 = alloca %class.R3Point, align 8
  %7 = alloca %class.R3Span, align 8
  %8 = alloca %class.R3Vector, align 8
  %9 = alloca %class.R3Plane, align 8
  %10 = alloca %class.R3Point, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %2)
  %11 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK10R3Triangle5PlaneEv(ptr noundef nonnull align 8 dereferenceable(132) %1)
  call void @_ZN7R3Point7ProjectERK7R3Plane(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(32) %11)
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  %16 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK16R3TriangleVertex8PositionEv(ptr noundef nonnull align 8 dereferenceable(100) %13)
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %16)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  %17 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK16R3TriangleVertex8PositionEv(ptr noundef nonnull align 8 dereferenceable(100) %15)
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %17)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %7) #5
  call void @_ZN6R3SpanC1ERK7R3PointS2_(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %18 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %19 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %20 = call noundef i32 @_Z8RNIsZerodd(double noundef %18, double noundef %19)
  %.not = icmp eq i32 %20, 0
  br i1 %.not, label %21, label %83

21:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #5
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span6VectorEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %23 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10R3Triangle6NormalEv(ptr noundef nonnull align 8 dereferenceable(132) %1)
  call void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef nonnull align 8 dereferenceable(24) %23)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #5
  call void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %8)
  %24 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(24) %4)
  %25 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %26 = call noundef i32 @_Z12RNIsPositivedd(double noundef %24, double noundef %25)
  %.not18 = icmp eq i32 %26, 0
  br i1 %.not18, label %36, label %27

27:                                               ; preds = %21
  %28 = call noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(24) %4)
  %29 = fcmp olt double %28, 0.000000e+00
  %.0 = select i1 %29, double 0.000000e+00, double %28
  %30 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %31 = fcmp ogt double %.0, %30
  br i1 %31, label %32, label %34

32:                                               ; preds = %27
  %33 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  br label %34

34:                                               ; preds = %32, %27
  %.1 = phi double [ %33, %32 ], [ %.0, %27 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #5
  call void @_ZNK6R3Span5PointEd(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %10, ptr noundef nonnull align 8 dereferenceable(80) %7, double noundef %.1)
  %35 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #5
  br label %36

36:                                               ; preds = %21, %34
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  %37 = load ptr, ptr %14, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %1, i64 24
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  %40 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK16R3TriangleVertex8PositionEv(ptr noundef nonnull align 8 dereferenceable(100) %37)
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %40)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  %41 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK16R3TriangleVertex8PositionEv(ptr noundef nonnull align 8 dereferenceable(100) %39)
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %41)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %7) #5
  call void @_ZN6R3SpanC1ERK7R3PointS2_(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %42 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %43 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %44 = call noundef i32 @_Z8RNIsZerodd(double noundef %42, double noundef %43)
  %.not.1 = icmp eq i32 %44, 0
  br i1 %.not.1, label %45, label %83

45:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #5
  %46 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span6VectorEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %47 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10R3Triangle6NormalEv(ptr noundef nonnull align 8 dereferenceable(132) %1)
  call void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %46, ptr noundef nonnull align 8 dereferenceable(24) %47)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #5
  call void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %8)
  %48 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(24) %4)
  %49 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %50 = call noundef i32 @_Z12RNIsPositivedd(double noundef %48, double noundef %49)
  %.not18.1 = icmp eq i32 %50, 0
  br i1 %.not18.1, label %60, label %51

51:                                               ; preds = %45
  %52 = call noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(24) %4)
  %53 = fcmp olt double %52, 0.000000e+00
  %.0.1 = select i1 %53, double 0.000000e+00, double %52
  %54 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %55 = fcmp ogt double %.0.1, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %51
  %57 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  br label %58

58:                                               ; preds = %56, %51
  %.1.1 = phi double [ %57, %56 ], [ %.0.1, %51 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #5
  call void @_ZNK6R3Span5PointEd(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %10, ptr noundef nonnull align 8 dereferenceable(80) %7, double noundef %.1.1)
  %59 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #5
  br label %60

60:                                               ; preds = %58, %45
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  %61 = load ptr, ptr %38, align 8, !tbaa !5
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  %63 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK16R3TriangleVertex8PositionEv(ptr noundef nonnull align 8 dereferenceable(100) %61)
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %63)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  %64 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK16R3TriangleVertex8PositionEv(ptr noundef nonnull align 8 dereferenceable(100) %62)
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %64)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %7) #5
  call void @_ZN6R3SpanC1ERK7R3PointS2_(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %65 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %66 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %67 = call noundef i32 @_Z8RNIsZerodd(double noundef %65, double noundef %66)
  %.not.2 = icmp eq i32 %67, 0
  br i1 %.not.2, label %68, label %83

68:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #5
  %69 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span6VectorEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %70 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10R3Triangle6NormalEv(ptr noundef nonnull align 8 dereferenceable(132) %1)
  call void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %69, ptr noundef nonnull align 8 dereferenceable(24) %70)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #5
  call void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %8)
  %71 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(24) %4)
  %72 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %73 = call noundef i32 @_Z12RNIsPositivedd(double noundef %71, double noundef %72)
  %.not18.2 = icmp eq i32 %73, 0
  br i1 %.not18.2, label %.critedge, label %74

74:                                               ; preds = %68
  %75 = call noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(24) %4)
  %76 = fcmp olt double %75, 0.000000e+00
  %.0.2 = select i1 %76, double 0.000000e+00, double %75
  %77 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %78 = fcmp ogt double %.0.2, %77
  br i1 %78, label %79, label %81

79:                                               ; preds = %74
  %80 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  br label %81

81:                                               ; preds = %79, %74
  %.1.2 = phi double [ %80, %79 ], [ %.0.2, %74 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #5
  call void @_ZNK6R3Span5PointEd(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %10, ptr noundef nonnull align 8 dereferenceable(80) %7, double noundef %.1.2)
  %82 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #5
  br label %.critedge

.critedge:                                        ; preds = %81, %68
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %4)
  br label %87

83:                                               ; preds = %60, %36, %3
  %84 = load ptr, ptr %1, align 8, !tbaa !11
  %85 = getelementptr inbounds i8, ptr %84, i64 104
  %86 = load ptr, ptr %85, align 8
  call void %86(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %0, ptr noundef nonnull align 8 dereferenceable(132) %1)
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  br label %87

87:                                               ; preds = %83, %.critedge
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  ret void
}

declare void @_ZN7R3Point7ProjectERK7R3Plane(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK10R3Triangle5PlaneEv(ptr noundef nonnull align 8 dereferenceable(132)) local_unnamed_addr #2 align 2

declare void @_ZN6R3SpanC1ERK7R3PointS2_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span6VectorEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10R3Triangle6NormalEv(ptr noundef nonnull align 8 dereferenceable(132)) local_unnamed_addr #4 align 2

declare void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

declare noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z12RNIsPositivedd(double noundef, double noundef) local_unnamed_addr #2

declare noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0

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

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

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 willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = { 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 #5 = { 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 = !{!"vtable pointer", !8, i64 0}


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