; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Graphics (R3SceneElement)

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

@RN_EPSILON = external global double, align 8

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK14R3SceneElement10IntersectsERK5R3RayPP7R3ShapeP7R3PointP8R3VectorPddd(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, double noundef %6, double noundef %7) #3 align 2 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca %class.R3Point, align 8
  %21 = alloca %class.R3Vector, align 8
  %22 = alloca double, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !5
  store double %6, ptr %16, align 8, !tbaa !9
  store double %7, ptr %17, align 8, !tbaa !9
  %26 = load ptr, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %27 = load double, ptr %17, align 8, !tbaa !9
  store double %27, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #4
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %20)
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #4
  call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %21)
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %28 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK14R3SceneElement4BBoxEv(ptr noundef nonnull align 8 dereferenceable(96) %26)
  %29 = load ptr, ptr %11, align 8, !tbaa !5
  %30 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %29)
  %31 = call noundef i32 @_Z10R3ContainsRK5R3BoxRK7R3Point(ptr noundef nonnull align 8 dereferenceable(56) %28, ptr noundef nonnull align 8 dereferenceable(24) %30)
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %47, label %33

33:                                               ; preds = %8
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK14R3SceneElement4BBoxEv(ptr noundef nonnull align 8 dereferenceable(96) %26)
  %36 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %34, ptr noundef nonnull align 8 dereferenceable(56) %35, ptr noundef null, ptr noundef null, ptr noundef %18)
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %39, label %38

38:                                               ; preds = %33
  store i32 0, ptr %9, align 4
  store i32 1, ptr %23, align 4
  br label %108

39:                                               ; preds = %33
  %40 = load double, ptr %18, align 8, !tbaa !9
  %41 = load double, ptr %17, align 8, !tbaa !9
  %42 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %43 = call noundef i32 @_Z11RNIsGreaterddd(double noundef %40, double noundef %41, double noundef %42)
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %39
  store i32 0, ptr %9, align 4
  store i32 1, ptr %23, align 4
  br label %108

46:                                               ; preds = %39
  br label %47

47:                                               ; preds = %46, %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  store i32 0, ptr %24, align 4, !tbaa !11
  br label %48

48:                                               ; preds = %99, %47
  %49 = load i32, ptr %24, align 4, !tbaa !11
  %50 = call noundef i32 @_ZNK14R3SceneElement7NShapesEv(ptr noundef nonnull align 8 dereferenceable(96) %26)
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  store i32 2, ptr %23, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %102

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %54 = load i32, ptr %24, align 4, !tbaa !11
  %55 = call noundef ptr @_ZNK14R3SceneElement5ShapeEi(ptr noundef nonnull align 8 dereferenceable(96) %26, i32 noundef %54)
  store ptr %55, ptr %25, align 8, !tbaa !5
  %56 = load ptr, ptr %25, align 8, !tbaa !5
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = load ptr, ptr %56, align 8, !tbaa !13
  %59 = getelementptr inbounds ptr, ptr %58, i64 59
  %60 = load ptr, ptr %59, align 8
  %61 = call noundef i32 %60(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef nonnull align 8 dereferenceable(48) %57, ptr noundef %20, ptr noundef %21, ptr noundef %22)
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %98

63:                                               ; preds = %53
  %64 = load double, ptr %22, align 8, !tbaa !9
  %65 = load double, ptr %16, align 8, !tbaa !9
  %66 = fcmp oge double %64, %65
  br i1 %66, label %67, label %97

67:                                               ; preds = %63
  %68 = load double, ptr %22, align 8, !tbaa !9
  %69 = load double, ptr %19, align 8, !tbaa !9
  %70 = fcmp ole double %68, %69
  br i1 %70, label %71, label %97

71:                                               ; preds = %67
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %77

74:                                               ; preds = %71
  %75 = load ptr, ptr %25, align 8, !tbaa !5
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %75, ptr %76, align 8, !tbaa !5
  br label %77

77:                                               ; preds = %74, %71
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = icmp ne ptr %78, null
  br i1 %79, label %80, label %83

80:                                               ; preds = %77
  %81 = load ptr, ptr %13, align 8, !tbaa !5
  %82 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %81, ptr noundef nonnull align 8 dereferenceable(24) %20)
  br label %83

83:                                               ; preds = %80, %77
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %89

86:                                               ; preds = %83
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %87, ptr noundef nonnull align 8 dereferenceable(24) %21)
  br label %89

89:                                               ; preds = %86, %83
  %90 = load ptr, ptr %15, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %95

92:                                               ; preds = %89
  %93 = load double, ptr %22, align 8, !tbaa !9
  %94 = load ptr, ptr %15, align 8, !tbaa !5
  store double %93, ptr %94, align 8, !tbaa !9
  br label %95

95:                                               ; preds = %92, %89
  %96 = load double, ptr %22, align 8, !tbaa !9
  store double %96, ptr %19, align 8, !tbaa !9
  br label %97

97:                                               ; preds = %95, %67, %63
  br label %98

98:                                               ; preds = %97, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %24, align 4, !tbaa !11
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %24, align 4, !tbaa !11
  br label %48, !llvm.loop !15

102:                                              ; preds = %52
  %103 = load double, ptr %19, align 8, !tbaa !9
  %104 = load double, ptr %17, align 8, !tbaa !9
  %105 = fcmp oeq double %103, %104
  %106 = zext i1 %105 to i64
  %107 = select i1 %105, i32 0, i32 1
  store i32 %107, ptr %9, align 4
  store i32 1, ptr %23, align 4
  br label %108

108:                                              ; preds = %102, %45, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  %109 = load i32, ptr %9, align 4
  ret i32 %109
}

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

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

declare noundef i32 @_Z10R3ContainsRK5R3BoxRK7R3Point(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(24)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

declare 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 uwtable
declare dso_local noundef i32 @_Z11RNIsGreaterddd(double noundef, double noundef, double noundef) #0

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 = !{!"int", !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.R3Point = type { [3 x double] }
%class.R3Vector = type { [3 x double] }

@RN_EPSILON = external local_unnamed_addr global double, align 8

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZNK14R3SceneElement10IntersectsERK5R3RayPP7R3ShapeP7R3PointP8R3VectorPddd(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef writeonly %2, ptr noundef %3, ptr noundef %4, ptr noundef writeonly %5, double noundef %6, double noundef %7) local_unnamed_addr #3 align 2 {
  %9 = alloca double, align 8
  %10 = alloca %class.R3Point, align 8
  %11 = alloca %class.R3Vector, align 8
  %12 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #4
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #4
  call void @_ZN8R3VectorC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #4
  %13 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK14R3SceneElement4BBoxEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
  %14 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %15 = call noundef i32 @_Z10R3ContainsRK5R3BoxRK7R3Point(ptr noundef nonnull align 8 dereferenceable(56) %13, ptr noundef nonnull align 8 dereferenceable(24) %14)
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %16, label %23

16:                                               ; preds = %8
  %17 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK14R3SceneElement4BBoxEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
  %18 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(56) %17, ptr noundef null, ptr noundef null, ptr noundef nonnull %9)
  %.not30 = icmp eq i32 %18, 0
  br i1 %.not30, label %104, label %19

19:                                               ; preds = %16
  %20 = load double, ptr %9, align 8, !tbaa !5
  %21 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %22 = call noundef i32 @_Z11RNIsGreaterddd(double noundef %20, double noundef %7, double noundef %21)
  %.not31 = icmp eq i32 %22, 0
  br i1 %.not31, label %23, label %104

23:                                               ; preds = %19, %8
  %24 = call noundef i32 @_ZNK14R3SceneElement7NShapesEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %23
  %.not33 = icmp eq ptr %2, null
  %.not34 = icmp eq ptr %3, null
  %.not35 = icmp eq ptr %4, null
  %.not36 = icmp eq ptr %5, null
  br i1 %.not34, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %42
  %.02338.us = phi i32 [ %43, %42 ], [ 0, %.lr.ph ]
  %.02437.us = phi double [ %.1.us, %42 ], [ %7, %.lr.ph ]
  %26 = call noundef ptr @_ZNK14R3SceneElement5ShapeEi(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef %.02338.us)
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = getelementptr inbounds i8, ptr %27, i64 472
  %29 = load ptr, ptr %28, align 8
  %30 = call noundef i32 %29(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %.not32.us = icmp eq i32 %30, 0
  br i1 %.not32.us, label %42, label %31

31:                                               ; preds = %.lr.ph.split.us
  %32 = load double, ptr %12, align 8, !tbaa !5
  %33 = fcmp ult double %32, %6
  %34 = fcmp ugt double %32, %.02437.us
  %or.cond.us = select i1 %33, i1 true, i1 %34
  br i1 %or.cond.us, label %42, label %35

35:                                               ; preds = %31
  br i1 %.not33, label %37, label %36

36:                                               ; preds = %35
  store ptr %26, ptr %2, align 8, !tbaa !11
  br label %37

37:                                               ; preds = %36, %35
  br i1 %.not35, label %40, label %38

38:                                               ; preds = %37
  %39 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %11)
  %.pre56.pre = load double, ptr %12, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %38, %37
  %.pre56 = phi double [ %.pre56.pre, %38 ], [ %32, %37 ]
  br i1 %.not36, label %42, label %41

41:                                               ; preds = %40
  store double %.pre56, ptr %5, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %40, %41, %31, %.lr.ph.split.us
  %.1.us = phi double [ %.02437.us, %31 ], [ %.02437.us, %.lr.ph.split.us ], [ %.pre56, %41 ], [ %.pre56, %40 ]
  %43 = add nuw nsw i32 %.02338.us, 1
  %44 = call noundef i32 @_ZNK14R3SceneElement7NShapesEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !13

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

.lr.ph.split.split.us:                            ; preds = %.lr.ph.split, %60
  %.02338.us39 = phi i32 [ %61, %60 ], [ 0, %.lr.ph.split ]
  %.02437.us40 = phi double [ %.1.us43, %60 ], [ %7, %.lr.ph.split ]
  %46 = call noundef ptr @_ZNK14R3SceneElement5ShapeEi(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef %.02338.us39)
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = getelementptr inbounds i8, ptr %47, i64 472
  %49 = load ptr, ptr %48, align 8
  %50 = call noundef i32 %49(ptr noundef nonnull align 8 dereferenceable(8) %46, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %.not32.us41 = icmp eq i32 %50, 0
  br i1 %.not32.us41, label %60, label %51

51:                                               ; preds = %.lr.ph.split.split.us
  %52 = load double, ptr %12, align 8, !tbaa !5
  %53 = fcmp ult double %52, %6
  %54 = fcmp ugt double %52, %.02437.us40
  %or.cond.us42 = select i1 %53, i1 true, i1 %54
  br i1 %or.cond.us42, label %60, label %55

55:                                               ; preds = %51
  br i1 %.not33, label %57, label %56

56:                                               ; preds = %55
  store ptr %46, ptr %2, align 8, !tbaa !11
  br label %57

57:                                               ; preds = %56, %55
  %58 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %10)
  %.pre = load double, ptr %12, align 8, !tbaa !5
  br i1 %.not36, label %60, label %59

59:                                               ; preds = %57
  store double %.pre, ptr %5, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %57, %59, %51, %.lr.ph.split.split.us
  %.1.us43 = phi double [ %.02437.us40, %51 ], [ %.02437.us40, %.lr.ph.split.split.us ], [ %.pre, %59 ], [ %.pre, %57 ]
  %61 = add nuw nsw i32 %.02338.us39, 1
  %62 = call noundef i32 @_ZNK14R3SceneElement7NShapesEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %.lr.ph.split.split.us, label %._crit_edge, !llvm.loop !13

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

.lr.ph.split.split.split.us:                      ; preds = %.lr.ph.split.split, %79
  %.02338.us46 = phi i32 [ %80, %79 ], [ 0, %.lr.ph.split.split ]
  %.02437.us47 = phi double [ %.1.us50, %79 ], [ %7, %.lr.ph.split.split ]
  %64 = call noundef ptr @_ZNK14R3SceneElement5ShapeEi(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef %.02338.us46)
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  %66 = getelementptr inbounds i8, ptr %65, i64 472
  %67 = load ptr, ptr %66, align 8
  %68 = call noundef i32 %67(ptr noundef nonnull align 8 dereferenceable(8) %64, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %.not32.us48 = icmp eq i32 %68, 0
  br i1 %.not32.us48, label %79, label %69

69:                                               ; preds = %.lr.ph.split.split.split.us
  %70 = load double, ptr %12, align 8, !tbaa !5
  %71 = fcmp ult double %70, %6
  %72 = fcmp ugt double %70, %.02437.us47
  %or.cond.us49 = select i1 %71, i1 true, i1 %72
  br i1 %or.cond.us49, label %79, label %73

73:                                               ; preds = %69
  br i1 %.not33, label %75, label %74

74:                                               ; preds = %73
  store ptr %64, ptr %2, align 8, !tbaa !11
  br label %75

75:                                               ; preds = %74, %73
  %76 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %10)
  %77 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %11)
  %78 = load double, ptr %12, align 8, !tbaa !5
  br label %79

79:                                               ; preds = %75, %69, %.lr.ph.split.split.split.us
  %.1.us50 = phi double [ %78, %75 ], [ %.02437.us47, %69 ], [ %.02437.us47, %.lr.ph.split.split.split.us ]
  %80 = add nuw nsw i32 %.02338.us46, 1
  %81 = call noundef i32 @_ZNK14R3SceneElement7NShapesEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %.lr.ph.split.split.split.us, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %100, %79, %60, %42, %23
  %.024.lcssa = phi double [ %7, %23 ], [ %.1.us, %42 ], [ %.1.us43, %60 ], [ %.1.us50, %79 ], [ %.1, %100 ]
  %83 = fcmp une double %.024.lcssa, %7
  %84 = zext i1 %83 to i32
  br label %104

.lr.ph.split.split.split:                         ; preds = %.lr.ph.split.split, %100
  %.02338 = phi i32 [ %101, %100 ], [ 0, %.lr.ph.split.split ]
  %.02437 = phi double [ %.1, %100 ], [ %7, %.lr.ph.split.split ]
  %85 = call noundef ptr @_ZNK14R3SceneElement5ShapeEi(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef %.02338)
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  %87 = getelementptr inbounds i8, ptr %86, i64 472
  %88 = load ptr, ptr %87, align 8
  %89 = call noundef i32 %88(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %.not32 = icmp eq i32 %89, 0
  br i1 %.not32, label %100, label %90

90:                                               ; preds = %.lr.ph.split.split.split
  %91 = load double, ptr %12, align 8, !tbaa !5
  %92 = fcmp ult double %91, %6
  %93 = fcmp ugt double %91, %.02437
  %or.cond = select i1 %92, i1 true, i1 %93
  br i1 %or.cond, label %100, label %94

94:                                               ; preds = %90
  br i1 %.not33, label %96, label %95

95:                                               ; preds = %94
  store ptr %85, ptr %2, align 8, !tbaa !11
  br label %96

96:                                               ; preds = %95, %94
  %97 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %10)
  %98 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %11)
  %99 = load double, ptr %12, align 8, !tbaa !5
  store double %99, ptr %5, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %90, %96, %.lr.ph.split.split.split
  %.1 = phi double [ %99, %96 ], [ %.02437, %90 ], [ %.02437, %.lr.ph.split.split.split ]
  %101 = add nuw nsw i32 %.02338, 1
  %102 = call noundef i32 @_ZNK14R3SceneElement7NShapesEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %.lr.ph.split.split.split, label %._crit_edge, !llvm.loop !13

104:                                              ; preds = %19, %16, %._crit_edge
  %.0 = phi i32 [ %84, %._crit_edge ], [ 0, %16 ], [ 0, %19 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  ret i32 %.0
}

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

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

declare noundef i32 @_Z10R3ContainsRK5R3BoxRK7R3Point(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

declare 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 uwtable
declare dso_local noundef i32 @_Z11RNIsGreaterddd(double noundef, double noundef, double noundef) local_unnamed_addr #0

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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