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

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

@RN_EPSILON = external global double, align 8
@R3xyz_triad = external global %class.R3Triad, align 8

declare noundef i32 @_Z10R3ContainsRK5R3BoxRK7R3Point(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(24)) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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)) #0

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

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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56)) #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) #4 align 2

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

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

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: mustprogress uwtable
define dso_local noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #5 {
  %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 %class.R3Point, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %class.R3Vector, 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
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = call noundef i32 @_ZNK5R3Box7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(56) %24)
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %28

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

28:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %12)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %30)
  %32 = call noundef i32 @_Z10R3ContainsRK5R3BoxRK7R3Point(ptr noundef nonnull align 8 dereferenceable(56) %29, ptr noundef nonnull align 8 dereferenceable(24) %31)
  store i32 %32, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %248, %28
  %34 = load i32, ptr %15, align 4, !tbaa !9
  %35 = icmp sle i32 %34, 2
  br i1 %35, label %37, label %36

36:                                               ; preds = %33
  store i32 2, ptr %16, align 4
  br label %251

37:                                               ; preds = %33
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %38)
  %40 = load i32, ptr %15, align 4, !tbaa !9
  %41 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %39, i32 noundef %40)
  %42 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %43 = call noundef i32 @_Z12RNIsPositivedd(double noundef %41, double noundef %42)
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %79

45:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %46 = load i32, ptr %14, align 4, !tbaa !9
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %53

48:                                               ; preds = %45
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56) %49)
  %51 = load i32, ptr %15, align 4, !tbaa !9
  %52 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %50, i32 noundef %51)
  br label %58

53:                                               ; preds = %45
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MinEv(ptr noundef nonnull align 8 dereferenceable(56) %54)
  %56 = load i32, ptr %15, align 4, !tbaa !9
  %57 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %55, i32 noundef %56)
  br label %58

58:                                               ; preds = %53, %48
  %59 = phi double [ %52, %48 ], [ %57, %53 ]
  store double %59, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %60 = load double, ptr %17, align 8, !tbaa !11
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %61)
  %63 = load i32, ptr %15, align 4, !tbaa !9
  %64 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %62, i32 noundef %63)
  %65 = fsub double %60, %64
  store double %65, ptr %18, align 8, !tbaa !11
  %66 = load double, ptr %18, align 8, !tbaa !11
  %67 = fcmp olt double %66, 0.000000e+00
  br i1 %67, label %68, label %69

68:                                               ; preds = %58
  store i32 4, ptr %16, align 4
  br label %76

69:                                               ; preds = %58
  %70 = load double, ptr %18, align 8, !tbaa !11
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %71)
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %72, i32 noundef %73)
  %75 = fdiv double %70, %74
  store double %75, ptr %13, align 8, !tbaa !11
  store i32 0, ptr %16, align 4
  br label %76

76:                                               ; preds = %69, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  %77 = load i32, ptr %16, align 4
  switch i32 %77, label %257 [
    i32 0, label %78
    i32 4, label %248
  ]

78:                                               ; preds = %76
  br label %123

79:                                               ; preds = %37
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %80)
  %82 = load i32, ptr %15, align 4, !tbaa !9
  %83 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %81, i32 noundef %82)
  %84 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %85 = call noundef i32 @_Z12RNIsNegativedd(double noundef %83, double noundef %84)
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %121

87:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %88 = load i32, ptr %14, align 4, !tbaa !9
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %95

90:                                               ; preds = %87
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MinEv(ptr noundef nonnull align 8 dereferenceable(56) %91)
  %93 = load i32, ptr %15, align 4, !tbaa !9
  %94 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %92, i32 noundef %93)
  br label %100

95:                                               ; preds = %87
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56) %96)
  %98 = load i32, ptr %15, align 4, !tbaa !9
  %99 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %97, i32 noundef %98)
  br label %100

100:                                              ; preds = %95, %90
  %101 = phi double [ %94, %90 ], [ %99, %95 ]
  store double %101, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %102 = load double, ptr %19, align 8, !tbaa !11
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %103)
  %105 = load i32, ptr %15, align 4, !tbaa !9
  %106 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %104, i32 noundef %105)
  %107 = fsub double %102, %106
  store double %107, ptr %20, align 8, !tbaa !11
  %108 = load double, ptr %20, align 8, !tbaa !11
  %109 = fcmp ogt double %108, 0.000000e+00
  br i1 %109, label %110, label %111

110:                                              ; preds = %100
  store i32 4, ptr %16, align 4
  br label %118

111:                                              ; preds = %100
  %112 = load double, ptr %20, align 8, !tbaa !11
  %113 = load ptr, ptr %7, align 8, !tbaa !5
  %114 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %113)
  %115 = load i32, ptr %15, align 4, !tbaa !9
  %116 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %114, i32 noundef %115)
  %117 = fdiv double %112, %116
  store double %117, ptr %13, align 8, !tbaa !11
  store i32 0, ptr %16, align 4
  br label %118

118:                                              ; preds = %111, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  %119 = load i32, ptr %16, align 4
  switch i32 %119, label %257 [
    i32 0, label %120
    i32 4, label %248
  ]

120:                                              ; preds = %118
  br label %122

121:                                              ; preds = %79
  br label %248

122:                                              ; preds = %120
  br label %123

123:                                              ; preds = %122, %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %124 = load i32, ptr %15, align 4, !tbaa !9
  %125 = add nsw i32 %124, 1
  %126 = srem i32 %125, 3
  store i32 %126, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %127 = load i32, ptr %15, align 4, !tbaa !9
  %128 = add nsw i32 %127, 2
  %129 = srem i32 %128, 3
  store i32 %129, ptr %22, align 4, !tbaa !9
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %130)
  %132 = load i32, ptr %15, align 4, !tbaa !9
  %133 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %131, i32 noundef %132)
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %134)
  %136 = load i32, ptr %15, align 4, !tbaa !9
  %137 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %135, i32 noundef %136)
  %138 = load double, ptr %13, align 8, !tbaa !11
  %139 = call double @llvm.fmuladd.f64(double %137, double %138, double %133)
  %140 = load i32, ptr %15, align 4, !tbaa !9
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %140)
  store double %139, ptr %141, align 8, !tbaa !11
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %142)
  %144 = load i32, ptr %21, align 4, !tbaa !9
  %145 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %143, i32 noundef %144)
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %146)
  %148 = load i32, ptr %21, align 4, !tbaa !9
  %149 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %147, i32 noundef %148)
  %150 = load double, ptr %13, align 8, !tbaa !11
  %151 = call double @llvm.fmuladd.f64(double %149, double %150, double %145)
  %152 = load i32, ptr %21, align 4, !tbaa !9
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %152)
  store double %151, ptr %153, align 8, !tbaa !11
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %154)
  %156 = load i32, ptr %22, align 4, !tbaa !9
  %157 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %155, i32 noundef %156)
  %158 = load ptr, ptr %7, align 8, !tbaa !5
  %159 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %158)
  %160 = load i32, ptr %22, align 4, !tbaa !9
  %161 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %159, i32 noundef %160)
  %162 = load double, ptr %13, align 8, !tbaa !11
  %163 = call double @llvm.fmuladd.f64(double %161, double %162, double %157)
  %164 = load i32, ptr %22, align 4, !tbaa !9
  %165 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %164)
  store double %163, ptr %165, align 8, !tbaa !11
  %166 = load i32, ptr %21, align 4, !tbaa !9
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %166)
  %168 = load double, ptr %167, align 8, !tbaa !11
  %169 = load ptr, ptr %8, align 8, !tbaa !5
  %170 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56) %169)
  %171 = load i32, ptr %21, align 4, !tbaa !9
  %172 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %170, i32 noundef %171)
  %173 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %174 = call noundef i32 @_Z15RNIsLessOrEqualddd(double noundef %168, double noundef %172, double noundef %173)
  %175 = icmp ne i32 %174, 0
  br i1 %175, label %176, label %244

176:                                              ; preds = %123
  %177 = load i32, ptr %21, align 4, !tbaa !9
  %178 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %177)
  %179 = load double, ptr %178, align 8, !tbaa !11
  %180 = load ptr, ptr %8, align 8, !tbaa !5
  %181 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MinEv(ptr noundef nonnull align 8 dereferenceable(56) %180)
  %182 = load i32, ptr %21, align 4, !tbaa !9
  %183 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %181, i32 noundef %182)
  %184 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %185 = call noundef i32 @_Z18RNIsGreaterOrEqualddd(double noundef %179, double noundef %183, double noundef %184)
  %186 = icmp ne i32 %185, 0
  br i1 %186, label %187, label %244

187:                                              ; preds = %176
  %188 = load i32, ptr %22, align 4, !tbaa !9
  %189 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %188)
  %190 = load double, ptr %189, align 8, !tbaa !11
  %191 = load ptr, ptr %8, align 8, !tbaa !5
  %192 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56) %191)
  %193 = load i32, ptr %22, align 4, !tbaa !9
  %194 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %192, i32 noundef %193)
  %195 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %196 = call noundef i32 @_Z15RNIsLessOrEqualddd(double noundef %190, double noundef %194, double noundef %195)
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %198, label %244

198:                                              ; preds = %187
  %199 = load i32, ptr %22, align 4, !tbaa !9
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %199)
  %201 = load double, ptr %200, align 8, !tbaa !11
  %202 = load ptr, ptr %8, align 8, !tbaa !5
  %203 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MinEv(ptr noundef nonnull align 8 dereferenceable(56) %202)
  %204 = load i32, ptr %22, align 4, !tbaa !9
  %205 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %203, i32 noundef %204)
  %206 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %207 = call noundef i32 @_Z18RNIsGreaterOrEqualddd(double noundef %201, double noundef %205, double noundef %206)
  %208 = icmp ne i32 %207, 0
  br i1 %208, label %209, label %244

209:                                              ; preds = %198
  %210 = load ptr, ptr %11, align 8, !tbaa !5
  %211 = icmp ne ptr %210, null
  br i1 %211, label %212, label %215

212:                                              ; preds = %209
  %213 = load double, ptr %13, align 8, !tbaa !11
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  store double %213, ptr %214, align 8, !tbaa !11
  br label %215

215:                                              ; preds = %212, %209
  %216 = load ptr, ptr %9, align 8, !tbaa !5
  %217 = icmp ne ptr %216, null
  br i1 %217, label %218, label %221

218:                                              ; preds = %215
  %219 = load ptr, ptr %9, align 8, !tbaa !5
  %220 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %219, ptr noundef nonnull align 8 dereferenceable(24) %12)
  br label %221

221:                                              ; preds = %218, %215
  %222 = load ptr, ptr %10, align 8, !tbaa !5
  %223 = icmp ne ptr %222, null
  br i1 %223, label %224, label %243

224:                                              ; preds = %221
  %225 = load ptr, ptr %7, align 8, !tbaa !5
  %226 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %225)
  %227 = load i32, ptr %15, align 4, !tbaa !9
  %228 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %226, i32 noundef %227)
  %229 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %230 = call noundef i32 @_Z12RNIsNegativedd(double noundef %228, double noundef %229)
  %231 = icmp ne i32 %230, 0
  br i1 %231, label %232, label %237

232:                                              ; preds = %224
  %233 = load i32, ptr %15, align 4, !tbaa !9
  %234 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Triad4AxisEi(ptr noundef nonnull align 8 dereferenceable(72) @R3xyz_triad, i32 noundef %233)
  %235 = load ptr, ptr %10, align 8, !tbaa !5
  %236 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %235, ptr noundef nonnull align 8 dereferenceable(24) %234)
  br label %242

237:                                              ; preds = %224
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #6
  %238 = load i32, ptr %15, align 4, !tbaa !9
  %239 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Triad4AxisEi(ptr noundef nonnull align 8 dereferenceable(72) @R3xyz_triad, i32 noundef %238)
  call void @_ZngRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %23, ptr noundef nonnull align 8 dereferenceable(24) %239)
  %240 = load ptr, ptr %10, align 8, !tbaa !5
  %241 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %240, ptr noundef nonnull align 8 dereferenceable(24) %23)
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #6
  br label %242

242:                                              ; preds = %237, %232
  br label %243

243:                                              ; preds = %242, %221
  store i32 4, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %245

244:                                              ; preds = %198, %187, %176, %123
  store i32 0, ptr %16, align 4
  br label %245

245:                                              ; preds = %244, %243
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  %246 = load i32, ptr %16, align 4
  switch i32 %246, label %251 [
    i32 0, label %247
  ]

247:                                              ; preds = %245
  br label %248

248:                                              ; preds = %247, %121, %118, %76
  %249 = load i32, ptr %15, align 4, !tbaa !9
  %250 = add nsw i32 %249, 1
  store i32 %250, ptr %15, align 4, !tbaa !9
  br label %33, !llvm.loop !13

251:                                              ; preds = %245, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %252 = load i32, ptr %16, align 4
  switch i32 %252, label %254 [
    i32 2, label %253
  ]

253:                                              ; preds = %251
  store i32 0, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %254

254:                                              ; preds = %253, %251
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  br label %255

255:                                              ; preds = %254, %27
  %256 = load i32, ptr %6, align 4
  ret i32 %256

257:                                              ; preds = %118, %76
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Triad4AxisEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) #4 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 willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #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, !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.R3Triad = type { [3 x %class.R3Vector] }
%class.R3Vector = type { [3 x double] }
%class.R3Point = type { [3 x double] }

@RN_EPSILON = external local_unnamed_addr global double, align 8
@R3xyz_triad = external global %class.R3Triad, align 8

declare noundef i32 @_Z10R3ContainsRK5R3BoxRK7R3Point(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(24)) local_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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 #0

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

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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56)) 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 #4 align 2

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

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

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 uwtable
define dso_local noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef %2, ptr noundef %3, ptr noundef writeonly %4) local_unnamed_addr #5 {
  %6 = alloca %class.R3Point, align 8
  %7 = alloca %class.R3Vector, align 8
  %8 = tail call noundef i32 @_ZNK5R3Box7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %9, label %114

9:                                                ; preds = %5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %10 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %11 = call noundef i32 @_Z10R3ContainsRK5R3BoxRK7R3Point(ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef nonnull align 8 dereferenceable(24) %10)
  %.not100 = icmp eq i32 %11, 0
  br label %12

12:                                               ; preds = %9, %112
  %.087122 = phi i32 [ 0, %9 ], [ %113, %112 ]
  %13 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %14 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %13, i32 noundef %.087122)
  %15 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %16 = call noundef i32 @_Z12RNIsPositivedd(double noundef %14, double noundef %15)
  %.not97 = icmp eq i32 %16, 0
  br i1 %.not97, label %28, label %17

17:                                               ; preds = %12
  br i1 %.not100, label %20, label %18

18:                                               ; preds = %17
  %19 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  br label %22

20:                                               ; preds = %17
  %21 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MinEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  br label %22

22:                                               ; preds = %20, %18
  %.sink = phi ptr [ %21, %20 ], [ %19, %18 ]
  %23 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %.sink, i32 noundef %.087122)
  %24 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %25 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %24, i32 noundef %.087122)
  %26 = fsub double %23, %25
  %27 = fcmp olt double %26, 0.000000e+00
  br i1 %27, label %112, label %.thread

28:                                               ; preds = %12
  %29 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %30 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %29, i32 noundef %.087122)
  %31 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %32 = call noundef i32 @_Z12RNIsNegativedd(double noundef %30, double noundef %31)
  %.not98 = icmp eq i32 %32, 0
  br i1 %.not98, label %112, label %33

33:                                               ; preds = %28
  br i1 %.not100, label %36, label %34

34:                                               ; preds = %33
  %35 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MinEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  br label %38

36:                                               ; preds = %33
  %37 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  br label %38

38:                                               ; preds = %36, %34
  %.sink126 = phi ptr [ %37, %36 ], [ %35, %34 ]
  %39 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %.sink126, i32 noundef %.087122)
  %40 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %41 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %40, i32 noundef %.087122)
  %42 = fsub double %39, %41
  %43 = fcmp ogt double %42, 0.000000e+00
  br i1 %43, label %112, label %.thread

.thread:                                          ; preds = %38, %22
  %.sink127 = phi double [ %26, %22 ], [ %42, %38 ]
  %44 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %45 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %44, i32 noundef %.087122)
  %46 = fdiv double %.sink127, %45
  %47 = add nuw nsw i32 %.087122, 1
  %.cmp.not = icmp eq i32 %.087122, 2
  %48 = select i1 %.cmp.not, i32 0, i32 %47
  %.urem119 = add nsw i32 %.087122, -1
  %.cmp120 = icmp eq i32 %.087122, 0
  %49 = select i1 %.cmp120, i32 2, i32 %.urem119
  %50 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %51 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %50, i32 noundef %.087122)
  %52 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %53 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %52, i32 noundef %.087122)
  %54 = call double @llvm.fmuladd.f64(double %53, double %46, double %51)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %.087122)
  store double %54, ptr %55, align 8, !tbaa !5
  %56 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %57 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %56, i32 noundef %48)
  %58 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %59 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %58, i32 noundef %48)
  %60 = call double @llvm.fmuladd.f64(double %59, double %46, double %57)
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %48)
  store double %60, ptr %61, align 8, !tbaa !5
  %62 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %63 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %62, i32 noundef %49)
  %64 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %65 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %64, i32 noundef %49)
  %66 = call double @llvm.fmuladd.f64(double %65, double %46, double %63)
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %49)
  store double %66, ptr %67, align 8, !tbaa !5
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %48)
  %69 = load double, ptr %68, align 8, !tbaa !5
  %70 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  %71 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %70, i32 noundef %48)
  %72 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %73 = call noundef i32 @_Z15RNIsLessOrEqualddd(double noundef %69, double noundef %71, double noundef %72)
  %.not101 = icmp eq i32 %73, 0
  br i1 %.not101, label %112, label %74

74:                                               ; preds = %.thread
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %48)
  %76 = load double, ptr %75, align 8, !tbaa !5
  %77 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MinEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  %78 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %77, i32 noundef %48)
  %79 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %80 = call noundef i32 @_Z18RNIsGreaterOrEqualddd(double noundef %76, double noundef %78, double noundef %79)
  %.not102 = icmp eq i32 %80, 0
  br i1 %.not102, label %112, label %81

81:                                               ; preds = %74
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %49)
  %83 = load double, ptr %82, align 8, !tbaa !5
  %84 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MaxEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  %85 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %84, i32 noundef %49)
  %86 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %87 = call noundef i32 @_Z15RNIsLessOrEqualddd(double noundef %83, double noundef %85, double noundef %86)
  %.not103 = icmp eq i32 %87, 0
  br i1 %.not103, label %112, label %88

88:                                               ; preds = %81
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %49)
  %90 = load double, ptr %89, align 8, !tbaa !5
  %91 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Box3MinEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  %92 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %91, i32 noundef %49)
  %93 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %94 = call noundef i32 @_Z18RNIsGreaterOrEqualddd(double noundef %90, double noundef %92, double noundef %93)
  %.not104 = icmp eq i32 %94, 0
  br i1 %.not104, label %112, label %95

95:                                               ; preds = %88
  %.not105 = icmp eq ptr %4, null
  br i1 %.not105, label %97, label %96

96:                                               ; preds = %95
  store double %46, ptr %4, align 8, !tbaa !5
  br label %97

97:                                               ; preds = %96, %95
  %.not106 = icmp eq ptr %2, null
  br i1 %.not106, label %100, label %98

98:                                               ; preds = %97
  %99 = 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)
  br label %100

100:                                              ; preds = %98, %97
  %.not107 = icmp eq ptr %3, null
  br i1 %.not107, label %.critedge, label %101

101:                                              ; preds = %100
  %102 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %103 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %102, i32 noundef %.087122)
  %104 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %105 = call noundef i32 @_Z12RNIsNegativedd(double noundef %103, double noundef %104)
  %.not108 = icmp eq i32 %105, 0
  br i1 %.not108, label %109, label %106

106:                                              ; preds = %101
  %107 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Triad4AxisEi(ptr noundef nonnull align 8 dereferenceable(72) @R3xyz_triad, i32 noundef %.087122)
  %108 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %107)
  br label %.critedge

109:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  %110 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Triad4AxisEi(ptr noundef nonnull align 8 dereferenceable(72) @R3xyz_triad, i32 noundef %.087122)
  call void @_ZngRK8R3Vector(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %110)
  %111 = 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)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %.critedge

112:                                              ; preds = %38, %22, %88, %81, %74, %.thread, %28
  %113 = add nuw nsw i32 %.087122, 1
  %exitcond = icmp eq i32 %113, 3
  br i1 %exitcond, label %.critedge, label %12, !llvm.loop !9

.critedge:                                        ; preds = %112, %106, %109, %100
  %spec.select = phi i32 [ 4, %106 ], [ 4, %109 ], [ 4, %100 ], [ 0, %112 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  br label %114

114:                                              ; preds = %5, %.critedge
  %.5 = phi i32 [ %spec.select, %.critedge ], [ 0, %5 ]
  ret i32 %.5
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Triad4AxisEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) local_unnamed_addr #4 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 willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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