; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes (R3Isect)

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

; 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 nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #1

declare void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z12R3IntersectsRK5R3RayRK10R3TriangleP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(132), ptr noundef, ptr noundef, ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z12R3IntersectsRK5R3RayRK15R3TriangleArrayP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(96) %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca %class.R3Point, align 8
  %16 = alloca %class.R3Vector, align 8
  %17 = alloca double, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK15R3TriangleArray3BoxEv(ptr noundef nonnull align 8 dereferenceable(96) %19)
  %21 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %18, ptr noundef nonnull align 8 dereferenceable(56) %20, ptr noundef null, ptr noundef null, ptr noundef null)
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %24, label %23

23:                                               ; preds = %5
  store i32 0, ptr %6, align 4
  br label %69

24:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store double 0x47EFFFFFE0000000, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %58, %24
  %26 = load i32, ptr %14, align 4, !tbaa !9
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = call noundef i32 @_ZNK15R3TriangleArray10NTrianglesEv(ptr noundef nonnull align 8 dereferenceable(96) %27)
  %29 = icmp slt i32 %26, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %61

31:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #5
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %15)
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #5
  call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %16)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = load i32, ptr %14, align 4, !tbaa !9
  %35 = call noundef ptr @_ZNK15R3TriangleArray8TriangleEi(ptr noundef nonnull align 8 dereferenceable(96) %33, i32 noundef %34)
  %36 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK10R3TriangleP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %32, ptr noundef nonnull align 8 dereferenceable(132) %35, ptr noundef %15, ptr noundef %16, ptr noundef %17)
  %37 = icmp eq i32 %36, 1
  br i1 %37, label %38, label %57

38:                                               ; preds = %31
  %39 = load double, ptr %17, align 8, !tbaa !11
  %40 = load double, ptr %13, align 8, !tbaa !11
  %41 = fcmp olt double %39, %40
  br i1 %41, label %42, label %56

42:                                               ; preds = %38
  store i32 1, ptr %12, align 4, !tbaa !9
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %48

45:                                               ; preds = %42
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %46, ptr noundef nonnull align 8 dereferenceable(24) %15)
  br label %48

48:                                               ; preds = %45, %42
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %54

51:                                               ; preds = %48
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %52, ptr noundef nonnull align 8 dereferenceable(24) %16)
  br label %54

54:                                               ; preds = %51, %48
  %55 = load double, ptr %17, align 8, !tbaa !11
  store double %55, ptr %13, align 8, !tbaa !11
  br label %56

56:                                               ; preds = %54, %38
  br label %57

57:                                               ; preds = %56, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %14, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %14, align 4, !tbaa !9
  br label %25, !llvm.loop !13

61:                                               ; preds = %30
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %67

64:                                               ; preds = %61
  %65 = load double, ptr %13, align 8, !tbaa !11
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  store double %65, ptr %66, align 8, !tbaa !11
  br label %67

67:                                               ; preds = %64, %61
  %68 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %68, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %69

69:                                               ; preds = %67, %23
  %70 = load i32, ptr %6, align 4
  ret i32 %70
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(56) ptr @_ZNK15R3TriangleArray3BoxEv(ptr noundef nonnull align 8 dereferenceable(96)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK15R3TriangleArray10NTrianglesEv(ptr noundef nonnull align 8 dereferenceable(96)) #4 align 2

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

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

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 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 #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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

; 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 nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1

declare void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z12R3IntersectsRK5R3RayRK10R3TriangleP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(132), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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 #1

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z12R3IntersectsRK5R3RayRK15R3TriangleArrayP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(96) %1, ptr noundef %2, ptr noundef %3, ptr noundef writeonly %4) local_unnamed_addr #2 {
  %6 = alloca %class.R3Point, align 8
  %7 = alloca %class.R3Vector, align 8
  %8 = alloca double, align 8
  %9 = tail call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK15R3TriangleArray3BoxEv(ptr noundef nonnull align 8 dereferenceable(96) %1)
  %10 = tail call noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(56) %9, ptr noundef null, ptr noundef null, ptr noundef null)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %59, label %.preheader

.preheader:                                       ; preds = %5
  %11 = tail call noundef i32 @_ZNK15R3TriangleArray10NTrianglesEv(ptr noundef nonnull align 8 dereferenceable(96) %1)
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %.not25 = icmp eq ptr %2, null
  %.not26 = icmp eq ptr %3, null
  br i1 %.not25, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph
  br i1 %.not26, label %.lr.ph.split.us.split.us, label %.lr.ph.split.us.split

.lr.ph.split.us.split.us:                         ; preds = %.lr.ph.split.us, %.lr.ph.split.us.split.us
  %.030.us.us = phi i32 [ %18, %.lr.ph.split.us.split.us ], [ 0, %.lr.ph.split.us ]
  %.01729.us.us = phi double [ %.1.us.us, %.lr.ph.split.us.split.us ], [ 0x47EFFFFFE0000000, %.lr.ph.split.us ]
  %.01828.us.us = phi i32 [ %.119.us.us, %.lr.ph.split.us.split.us ], [ 0, %.lr.ph.split.us ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %13 = call noundef ptr @_ZNK15R3TriangleArray8TriangleEi(ptr noundef nonnull align 8 dereferenceable(96) %1, i32 noundef %.030.us.us)
  %14 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK10R3TriangleP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(132) %13, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %15 = icmp eq i32 %14, 1
  %16 = load double, ptr %8, align 8
  %17 = fcmp olt double %16, %.01729.us.us
  %or.cond.us.us = select i1 %15, i1 %17, i1 false
  %.119.us.us = select i1 %or.cond.us.us, i32 1, i32 %.01828.us.us
  %.1.us.us = select i1 %or.cond.us.us, double %16, double %.01729.us.us
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  %18 = add nuw nsw i32 %.030.us.us, 1
  %19 = call noundef i32 @_ZNK15R3TriangleArray10NTrianglesEv(ptr noundef nonnull align 8 dereferenceable(96) %1)
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %.lr.ph.split.us.split.us, label %._crit_edge, !llvm.loop !5

.lr.ph.split.us.split:                            ; preds = %.lr.ph.split.us, %29
  %.030.us = phi i32 [ %30, %29 ], [ 0, %.lr.ph.split.us ]
  %.01729.us = phi double [ %.1.us, %29 ], [ 0x47EFFFFFE0000000, %.lr.ph.split.us ]
  %.01828.us = phi i32 [ %.119.us, %29 ], [ 0, %.lr.ph.split.us ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %21 = call noundef ptr @_ZNK15R3TriangleArray8TriangleEi(ptr noundef nonnull align 8 dereferenceable(96) %1, i32 noundef %.030.us)
  %22 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK10R3TriangleP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(132) %21, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %23 = icmp eq i32 %22, 1
  %24 = load double, ptr %8, align 8
  %25 = fcmp olt double %24, %.01729.us
  %or.cond.us = select i1 %23, i1 %25, i1 false
  br i1 %or.cond.us, label %26, label %29

26:                                               ; preds = %.lr.ph.split.us.split
  %27 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %7)
  %28 = load double, ptr %8, align 8, !tbaa !7
  br label %29

29:                                               ; preds = %26, %.lr.ph.split.us.split
  %.119.us = phi i32 [ 1, %26 ], [ %.01828.us, %.lr.ph.split.us.split ]
  %.1.us = phi double [ %28, %26 ], [ %.01729.us, %.lr.ph.split.us.split ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  %30 = add nuw nsw i32 %.030.us, 1
  %31 = call noundef i32 @_ZNK15R3TriangleArray10NTrianglesEv(ptr noundef nonnull align 8 dereferenceable(96) %1)
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.lr.ph.split.us.split, label %._crit_edge, !llvm.loop !5

.lr.ph.split:                                     ; preds = %.lr.ph
  br i1 %.not26, label %.lr.ph.split.split.us, label %.lr.ph.split.split

.lr.ph.split.split.us:                            ; preds = %.lr.ph.split, %41
  %.030.us33 = phi i32 [ %42, %41 ], [ 0, %.lr.ph.split ]
  %.01729.us34 = phi double [ %.1.us38, %41 ], [ 0x47EFFFFFE0000000, %.lr.ph.split ]
  %.01828.us35 = phi i32 [ %.119.us37, %41 ], [ 0, %.lr.ph.split ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %33 = call noundef ptr @_ZNK15R3TriangleArray8TriangleEi(ptr noundef nonnull align 8 dereferenceable(96) %1, i32 noundef %.030.us33)
  %34 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK10R3TriangleP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(132) %33, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %35 = icmp eq i32 %34, 1
  %36 = load double, ptr %8, align 8
  %37 = fcmp olt double %36, %.01729.us34
  %or.cond.us36 = select i1 %35, i1 %37, i1 false
  br i1 %or.cond.us36, label %38, label %41

38:                                               ; preds = %.lr.ph.split.split.us
  %39 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %40 = load double, ptr %8, align 8, !tbaa !7
  br label %41

41:                                               ; preds = %38, %.lr.ph.split.split.us
  %.119.us37 = phi i32 [ 1, %38 ], [ %.01828.us35, %.lr.ph.split.split.us ]
  %.1.us38 = phi double [ %40, %38 ], [ %.01729.us34, %.lr.ph.split.split.us ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  %42 = add nuw nsw i32 %.030.us33, 1
  %43 = call noundef i32 @_ZNK15R3TriangleArray10NTrianglesEv(ptr noundef nonnull align 8 dereferenceable(96) %1)
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %.lr.ph.split.split.us, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %54, %41, %29, %.lr.ph.split.us.split.us, %.preheader
  %.018.lcssa = phi i32 [ 0, %.preheader ], [ %.119.us.us, %.lr.ph.split.us.split.us ], [ %.119.us, %29 ], [ %.119.us37, %41 ], [ %.119, %54 ]
  %.017.lcssa = phi double [ 0x47EFFFFFE0000000, %.preheader ], [ %.1.us.us, %.lr.ph.split.us.split.us ], [ %.1.us, %29 ], [ %.1.us38, %41 ], [ %.1, %54 ]
  %.not24 = icmp eq ptr %4, null
  br i1 %.not24, label %59, label %58

.lr.ph.split.split:                               ; preds = %.lr.ph.split, %54
  %.030 = phi i32 [ %55, %54 ], [ 0, %.lr.ph.split ]
  %.01729 = phi double [ %.1, %54 ], [ 0x47EFFFFFE0000000, %.lr.ph.split ]
  %.01828 = phi i32 [ %.119, %54 ], [ 0, %.lr.ph.split ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %45 = call noundef ptr @_ZNK15R3TriangleArray8TriangleEi(ptr noundef nonnull align 8 dereferenceable(96) %1, i32 noundef %.030)
  %46 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK10R3TriangleP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(132) %45, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %47 = icmp eq i32 %46, 1
  %48 = load double, ptr %8, align 8
  %49 = fcmp olt double %48, %.01729
  %or.cond = select i1 %47, i1 %49, i1 false
  br i1 %or.cond, label %50, label %54

50:                                               ; preds = %.lr.ph.split.split
  %51 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %52 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %7)
  %53 = load double, ptr %8, align 8, !tbaa !7
  br label %54

54:                                               ; preds = %50, %.lr.ph.split.split
  %.119 = phi i32 [ 1, %50 ], [ %.01828, %.lr.ph.split.split ]
  %.1 = phi double [ %53, %50 ], [ %.01729, %.lr.ph.split.split ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  %55 = add nuw nsw i32 %.030, 1
  %56 = call noundef i32 @_ZNK15R3TriangleArray10NTrianglesEv(ptr noundef nonnull align 8 dereferenceable(96) %1)
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %.lr.ph.split.split, label %._crit_edge, !llvm.loop !5

58:                                               ; preds = %._crit_edge
  store double %.017.lcssa, ptr %4, align 8, !tbaa !7
  br label %59

59:                                               ; preds = %._crit_edge, %58, %5
  %.020 = phi i32 [ 0, %5 ], [ %.018.lcssa, %58 ], [ %.018.lcssa, %._crit_edge ]
  ret i32 %.020
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(56) ptr @_ZNK15R3TriangleArray3BoxEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK15R3TriangleArray10NTrianglesEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #4 align 2

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

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

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 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass