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

; 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.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }
%class.R3MeshSearchTreeNode = type { ptr, [2 x ptr], double, i32, %class.RNArray, %class.RNArray }
%class.RNArray = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%class.R3MeshSearchTreeFace = type { ptr, double, i32, i32 }
%class.R3MeshSearchTree = type { ptr, ptr, i32, i32 }

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [98 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@RN_INFINITY = external global double, align 8

declare i32 @__gxx_personality_v0(...)

declare void @_Z7RNAbortPKcz(ptr noundef, ...) #0

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

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

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

declare void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #0

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

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

; Function Attrs: nounwind
declare void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_SF_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(64), double noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef, ptr noundef) #5 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(64) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef nonnull align 8 dereferenceable(56) %8) #5 align 2 personality ptr @__gxx_personality_v0 {
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca double, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca double, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  %25 = alloca double, align 8
  %26 = alloca %class.R3Box, align 8
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca %class.R3Box, align 8
  %30 = alloca %class.R3Box, align 8
  %31 = alloca %class.R3Box, align 8
  %32 = alloca i32, align 4
  %33 = 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 double %3, ptr %13, align 8, !tbaa !9
  store ptr %4, ptr %14, align 8, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !5
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  store ptr %8, ptr %18, align 8, !tbaa !5
  %34 = load ptr, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = load ptr, ptr %18, align 8, !tbaa !5
  %37 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %35, ptr noundef nonnull align 8 dereferenceable(56) %36, ptr noundef null, ptr noundef null, ptr noundef %19)
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %9
  store i32 1, ptr %20, align 4
  br label %311

40:                                               ; preds = %9
  %41 = load double, ptr %19, align 8, !tbaa !9
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  %43 = load double, ptr %42, align 8, !tbaa !9
  %44 = fcmp ogt double %41, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %40
  store i32 1, ptr %20, align 4
  br label %311

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

47:                                               ; preds = %84, %46
  %48 = load i32, ptr %21, align 4, !tbaa !11
  %49 = load ptr, ptr %17, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %49, i32 0, i32 4
  %51 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %50)
  %52 = icmp slt i32 %48, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %47
  store i32 2, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %87

54:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %55 = load ptr, ptr %17, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %55, i32 0, i32 4
  %57 = load i32, ptr %21, align 4, !tbaa !11
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %56, i32 noundef %57)
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  store ptr %59, ptr %22, align 8, !tbaa !5
  %60 = load ptr, ptr %22, align 8, !tbaa !5
  %61 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %60, i32 0, i32 3
  %62 = load i32, ptr %61, align 4, !tbaa !13
  %63 = getelementptr inbounds %class.R3MeshSearchTree, ptr %34, i32 0, i32 3
  %64 = load i32, ptr %63, align 4, !tbaa !15
  %65 = icmp eq i32 %62, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %54
  store i32 4, ptr %20, align 4
  br label %81

67:                                               ; preds = %54
  %68 = getelementptr inbounds %class.R3MeshSearchTree, ptr %34, i32 0, i32 3
  %69 = load i32, ptr %68, align 4, !tbaa !15
  %70 = load ptr, ptr %22, align 8, !tbaa !5
  %71 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %70, i32 0, i32 3
  store i32 %69, ptr %71, align 4, !tbaa !13
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = load double, ptr %13, align 8, !tbaa !9
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = load ptr, ptr %15, align 8, !tbaa !5
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  %78 = load ptr, ptr %22, align 8, !tbaa !5
  %79 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %78, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8, !tbaa !17
  call void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_SF_(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(48) %72, ptr noundef nonnull align 8 dereferenceable(64) %73, double noundef %74, ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef %76, ptr noundef %77, ptr noundef %80)
  store i32 0, ptr %20, align 4
  br label %81

81:                                               ; preds = %67, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  %82 = load i32, ptr %20, align 4
  switch i32 %82, label %319 [
    i32 0, label %83
    i32 4, label %84
  ]

83:                                               ; preds = %81
  br label %84

84:                                               ; preds = %83, %81
  %85 = load i32, ptr %21, align 4, !tbaa !11
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %21, align 4, !tbaa !11
  br label %47, !llvm.loop !18

87:                                               ; preds = %53
  %88 = load ptr, ptr %17, align 8, !tbaa !5
  %89 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %88, i32 0, i32 1
  %90 = getelementptr inbounds [2 x ptr], ptr %89, i64 0, i64 0
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = icmp ne ptr %91, null
  br i1 %92, label %93, label %268

93:                                               ; preds = %87
  %94 = load ptr, ptr %17, align 8, !tbaa !5
  %95 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %94, i32 0, i32 1
  %96 = getelementptr inbounds [2 x ptr], ptr %95, i64 0, i64 1
  %97 = load ptr, ptr %96, align 8, !tbaa !5
  %98 = icmp ne ptr %97, null
  br i1 %98, label %100, label %99

99:                                               ; preds = %93
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.4, i32 noundef 1030, ptr noundef @.str.2)
  br label %100

100:                                              ; preds = %99, %93
  %101 = load ptr, ptr %17, align 8, !tbaa !5
  %102 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %101, i32 0, i32 5
  %103 = call noundef i32 @_ZNK8RNVArray7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %102)
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %106, label %105

105:                                              ; preds = %100
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.8, i32 noundef 1031, ptr noundef @.str.2)
  br label %106

106:                                              ; preds = %105, %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %107 = load ptr, ptr %11, align 8, !tbaa !5
  %108 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %107)
  %109 = load ptr, ptr %17, align 8, !tbaa !5
  %110 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %109, i32 0, i32 3
  %111 = load i32, ptr %110, align 8, !tbaa !20
  %112 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %108, i32 noundef %111)
  %113 = load ptr, ptr %17, align 8, !tbaa !5
  %114 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %113, i32 0, i32 2
  %115 = load double, ptr %114, align 8, !tbaa !24
  %116 = fsub double %112, %115
  store double %116, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %117 = load ptr, ptr %11, align 8, !tbaa !5
  %118 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %117)
  %119 = load ptr, ptr %17, align 8, !tbaa !5
  %120 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %119, i32 0, i32 3
  %121 = load i32, ptr %120, align 8, !tbaa !20
  %122 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %118, i32 noundef %121)
  store double %122, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %123 = load double, ptr %23, align 8, !tbaa !9
  %124 = load double, ptr %24, align 8, !tbaa !9
  %125 = fmul double %123, %124
  %126 = fcmp olt double %125, 0.000000e+00
  br i1 %126, label %127, label %132

127:                                              ; preds = %106
  %128 = load double, ptr %23, align 8, !tbaa !9
  %129 = fneg double %128
  %130 = load double, ptr %24, align 8, !tbaa !9
  %131 = fdiv double %129, %130
  br label %134

132:                                              ; preds = %106
  %133 = load double, ptr @RN_INFINITY, align 8, !tbaa !9
  br label %134

134:                                              ; preds = %132, %127
  %135 = phi double [ %131, %127 ], [ %133, %132 ]
  store double %135, ptr %25, align 8, !tbaa !9
  %136 = load double, ptr %23, align 8, !tbaa !9
  %137 = fcmp ole double %136, 0.000000e+00
  br i1 %137, label %138, label %202

138:                                              ; preds = %134
  %139 = load double, ptr %25, align 8, !tbaa !9
  %140 = load double, ptr %13, align 8, !tbaa !9
  %141 = fcmp oge double %139, %140
  br i1 %141, label %142, label %169

142:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 56, ptr %26) #6
  %143 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %26, ptr noundef nonnull align 8 dereferenceable(56) %143)
  %144 = load ptr, ptr %17, align 8, !tbaa !5
  %145 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %144, i32 0, i32 2
  %146 = load double, ptr %145, align 8, !tbaa !24
  %147 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %26, i32 noundef 1)
          to label %148 unwind label %165

148:                                              ; preds = %142
  %149 = load ptr, ptr %17, align 8, !tbaa !5
  %150 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %149, i32 0, i32 3
  %151 = load i32, ptr %150, align 8, !tbaa !20
  %152 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %147, i32 noundef %151)
          to label %153 unwind label %165

153:                                              ; preds = %148
  store double %146, ptr %152, align 8, !tbaa !9
  %154 = load ptr, ptr %11, align 8, !tbaa !5
  %155 = load ptr, ptr %12, align 8, !tbaa !5
  %156 = load double, ptr %13, align 8, !tbaa !9
  %157 = load ptr, ptr %14, align 8, !tbaa !5
  %158 = load ptr, ptr %15, align 8, !tbaa !5
  %159 = load ptr, ptr %16, align 8, !tbaa !5
  %160 = load ptr, ptr %17, align 8, !tbaa !5
  %161 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %160, i32 0, i32 1
  %162 = getelementptr inbounds [2 x ptr], ptr %161, i64 0, i64 0
  %163 = load ptr, ptr %162, align 8, !tbaa !5
  invoke void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(48) %154, ptr noundef nonnull align 8 dereferenceable(64) %155, double noundef %156, ptr noundef nonnull align 8 dereferenceable(8) %157, ptr noundef %158, ptr noundef %159, ptr noundef %163, ptr noundef nonnull align 8 dereferenceable(56) %26)
          to label %164 unwind label %165

164:                                              ; preds = %153
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %26) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %26) #6
  br label %169

165:                                              ; preds = %153, %148, %142
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %27, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %28, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %26) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %26) #6
  br label %267

169:                                              ; preds = %164, %138
  %170 = load double, ptr %25, align 8, !tbaa !9
  %171 = load ptr, ptr %14, align 8, !tbaa !5
  %172 = load double, ptr %171, align 8, !tbaa !9
  %173 = fcmp olt double %170, %172
  br i1 %173, label %174, label %201

174:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 56, ptr %29) #6
  %175 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %29, ptr noundef nonnull align 8 dereferenceable(56) %175)
  %176 = load ptr, ptr %17, align 8, !tbaa !5
  %177 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %176, i32 0, i32 2
  %178 = load double, ptr %177, align 8, !tbaa !24
  %179 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %29, i32 noundef 0)
          to label %180 unwind label %197

180:                                              ; preds = %174
  %181 = load ptr, ptr %17, align 8, !tbaa !5
  %182 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %181, i32 0, i32 3
  %183 = load i32, ptr %182, align 8, !tbaa !20
  %184 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %179, i32 noundef %183)
          to label %185 unwind label %197

185:                                              ; preds = %180
  store double %178, ptr %184, align 8, !tbaa !9
  %186 = load ptr, ptr %11, align 8, !tbaa !5
  %187 = load ptr, ptr %12, align 8, !tbaa !5
  %188 = load double, ptr %13, align 8, !tbaa !9
  %189 = load ptr, ptr %14, align 8, !tbaa !5
  %190 = load ptr, ptr %15, align 8, !tbaa !5
  %191 = load ptr, ptr %16, align 8, !tbaa !5
  %192 = load ptr, ptr %17, align 8, !tbaa !5
  %193 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %192, i32 0, i32 1
  %194 = getelementptr inbounds [2 x ptr], ptr %193, i64 0, i64 1
  %195 = load ptr, ptr %194, align 8, !tbaa !5
  invoke void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(48) %186, ptr noundef nonnull align 8 dereferenceable(64) %187, double noundef %188, ptr noundef nonnull align 8 dereferenceable(8) %189, ptr noundef %190, ptr noundef %191, ptr noundef %195, ptr noundef nonnull align 8 dereferenceable(56) %29)
          to label %196 unwind label %197

196:                                              ; preds = %185
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %29) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %29) #6
  br label %201

197:                                              ; preds = %185, %180, %174
  %198 = landingpad { ptr, i32 }
          cleanup
  %199 = extractvalue { ptr, i32 } %198, 0
  store ptr %199, ptr %27, align 8
  %200 = extractvalue { ptr, i32 } %198, 1
  store i32 %200, ptr %28, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %29) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %29) #6
  br label %267

201:                                              ; preds = %196, %169
  br label %266

202:                                              ; preds = %134
  %203 = load double, ptr %25, align 8, !tbaa !9
  %204 = load double, ptr %13, align 8, !tbaa !9
  %205 = fcmp oge double %203, %204
  br i1 %205, label %206, label %233

206:                                              ; preds = %202
  call void @llvm.lifetime.start.p0(i64 56, ptr %30) #6
  %207 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %30, ptr noundef nonnull align 8 dereferenceable(56) %207)
  %208 = load ptr, ptr %17, align 8, !tbaa !5
  %209 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %208, i32 0, i32 2
  %210 = load double, ptr %209, align 8, !tbaa !24
  %211 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %30, i32 noundef 0)
          to label %212 unwind label %229

212:                                              ; preds = %206
  %213 = load ptr, ptr %17, align 8, !tbaa !5
  %214 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %213, i32 0, i32 3
  %215 = load i32, ptr %214, align 8, !tbaa !20
  %216 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %211, i32 noundef %215)
          to label %217 unwind label %229

217:                                              ; preds = %212
  store double %210, ptr %216, align 8, !tbaa !9
  %218 = load ptr, ptr %11, align 8, !tbaa !5
  %219 = load ptr, ptr %12, align 8, !tbaa !5
  %220 = load double, ptr %13, align 8, !tbaa !9
  %221 = load ptr, ptr %14, align 8, !tbaa !5
  %222 = load ptr, ptr %15, align 8, !tbaa !5
  %223 = load ptr, ptr %16, align 8, !tbaa !5
  %224 = load ptr, ptr %17, align 8, !tbaa !5
  %225 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %224, i32 0, i32 1
  %226 = getelementptr inbounds [2 x ptr], ptr %225, i64 0, i64 1
  %227 = load ptr, ptr %226, align 8, !tbaa !5
  invoke void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(48) %218, ptr noundef nonnull align 8 dereferenceable(64) %219, double noundef %220, ptr noundef nonnull align 8 dereferenceable(8) %221, ptr noundef %222, ptr noundef %223, ptr noundef %227, ptr noundef nonnull align 8 dereferenceable(56) %30)
          to label %228 unwind label %229

228:                                              ; preds = %217
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %30) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %30) #6
  br label %233

229:                                              ; preds = %217, %212, %206
  %230 = landingpad { ptr, i32 }
          cleanup
  %231 = extractvalue { ptr, i32 } %230, 0
  store ptr %231, ptr %27, align 8
  %232 = extractvalue { ptr, i32 } %230, 1
  store i32 %232, ptr %28, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %30) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %30) #6
  br label %267

233:                                              ; preds = %228, %202
  %234 = load double, ptr %25, align 8, !tbaa !9
  %235 = load ptr, ptr %14, align 8, !tbaa !5
  %236 = load double, ptr %235, align 8, !tbaa !9
  %237 = fcmp olt double %234, %236
  br i1 %237, label %238, label %265

238:                                              ; preds = %233
  call void @llvm.lifetime.start.p0(i64 56, ptr %31) #6
  %239 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %31, ptr noundef nonnull align 8 dereferenceable(56) %239)
  %240 = load ptr, ptr %17, align 8, !tbaa !5
  %241 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %240, i32 0, i32 2
  %242 = load double, ptr %241, align 8, !tbaa !24
  %243 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %31, i32 noundef 1)
          to label %244 unwind label %261

244:                                              ; preds = %238
  %245 = load ptr, ptr %17, align 8, !tbaa !5
  %246 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %245, i32 0, i32 3
  %247 = load i32, ptr %246, align 8, !tbaa !20
  %248 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %243, i32 noundef %247)
          to label %249 unwind label %261

249:                                              ; preds = %244
  store double %242, ptr %248, align 8, !tbaa !9
  %250 = load ptr, ptr %11, align 8, !tbaa !5
  %251 = load ptr, ptr %12, align 8, !tbaa !5
  %252 = load double, ptr %13, align 8, !tbaa !9
  %253 = load ptr, ptr %14, align 8, !tbaa !5
  %254 = load ptr, ptr %15, align 8, !tbaa !5
  %255 = load ptr, ptr %16, align 8, !tbaa !5
  %256 = load ptr, ptr %17, align 8, !tbaa !5
  %257 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %256, i32 0, i32 1
  %258 = getelementptr inbounds [2 x ptr], ptr %257, i64 0, i64 0
  %259 = load ptr, ptr %258, align 8, !tbaa !5
  invoke void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(48) %250, ptr noundef nonnull align 8 dereferenceable(64) %251, double noundef %252, ptr noundef nonnull align 8 dereferenceable(8) %253, ptr noundef %254, ptr noundef %255, ptr noundef %259, ptr noundef nonnull align 8 dereferenceable(56) %31)
          to label %260 unwind label %261

260:                                              ; preds = %249
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %31) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %31) #6
  br label %265

261:                                              ; preds = %249, %244, %238
  %262 = landingpad { ptr, i32 }
          cleanup
  %263 = extractvalue { ptr, i32 } %262, 0
  store ptr %263, ptr %27, align 8
  %264 = extractvalue { ptr, i32 } %262, 1
  store i32 %264, ptr %28, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %31) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %31) #6
  br label %267

265:                                              ; preds = %260, %233
  br label %266

266:                                              ; preds = %265, %201
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %310

267:                                              ; preds = %261, %229, %197, %165
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %314

268:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #6
  store i32 0, ptr %32, align 4, !tbaa !11
  br label %269

269:                                              ; preds = %306, %268
  %270 = load i32, ptr %32, align 4, !tbaa !11
  %271 = load ptr, ptr %17, align 8, !tbaa !5
  %272 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %271, i32 0, i32 5
  %273 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %272)
  %274 = icmp slt i32 %270, %273
  br i1 %274, label %276, label %275

275:                                              ; preds = %269
  store i32 5, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #6
  br label %309

276:                                              ; preds = %269
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #6
  %277 = load ptr, ptr %17, align 8, !tbaa !5
  %278 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %277, i32 0, i32 5
  %279 = load i32, ptr %32, align 4, !tbaa !11
  %280 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %278, i32 noundef %279)
  %281 = load ptr, ptr %280, align 8, !tbaa !5
  store ptr %281, ptr %33, align 8, !tbaa !5
  %282 = load ptr, ptr %33, align 8, !tbaa !5
  %283 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %282, i32 0, i32 3
  %284 = load i32, ptr %283, align 4, !tbaa !13
  %285 = getelementptr inbounds %class.R3MeshSearchTree, ptr %34, i32 0, i32 3
  %286 = load i32, ptr %285, align 4, !tbaa !15
  %287 = icmp eq i32 %284, %286
  br i1 %287, label %288, label %289

288:                                              ; preds = %276
  store i32 7, ptr %20, align 4
  br label %303

289:                                              ; preds = %276
  %290 = getelementptr inbounds %class.R3MeshSearchTree, ptr %34, i32 0, i32 3
  %291 = load i32, ptr %290, align 4, !tbaa !15
  %292 = load ptr, ptr %33, align 8, !tbaa !5
  %293 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %292, i32 0, i32 3
  store i32 %291, ptr %293, align 4, !tbaa !13
  %294 = load ptr, ptr %11, align 8, !tbaa !5
  %295 = load ptr, ptr %12, align 8, !tbaa !5
  %296 = load double, ptr %13, align 8, !tbaa !9
  %297 = load ptr, ptr %14, align 8, !tbaa !5
  %298 = load ptr, ptr %15, align 8, !tbaa !5
  %299 = load ptr, ptr %16, align 8, !tbaa !5
  %300 = load ptr, ptr %33, align 8, !tbaa !5
  %301 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %300, i32 0, i32 0
  %302 = load ptr, ptr %301, align 8, !tbaa !17
  call void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_SF_(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(48) %294, ptr noundef nonnull align 8 dereferenceable(64) %295, double noundef %296, ptr noundef nonnull align 8 dereferenceable(8) %297, ptr noundef %298, ptr noundef %299, ptr noundef %302)
  store i32 0, ptr %20, align 4
  br label %303

303:                                              ; preds = %289, %288
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #6
  %304 = load i32, ptr %20, align 4
  switch i32 %304, label %319 [
    i32 0, label %305
    i32 7, label %306
  ]

305:                                              ; preds = %303
  br label %306

306:                                              ; preds = %305, %303
  %307 = load i32, ptr %32, align 4, !tbaa !11
  %308 = add nsw i32 %307, 1
  store i32 %308, ptr %32, align 4, !tbaa !11
  br label %269, !llvm.loop !25

309:                                              ; preds = %275
  br label %310

310:                                              ; preds = %309, %266
  store i32 0, ptr %20, align 4
  br label %311

311:                                              ; preds = %310, %45, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  %312 = load i32, ptr %20, align 4
  switch i32 %312, label %319 [
    i32 0, label %313
    i32 1, label %313
  ]

313:                                              ; preds = %311, %311
  ret void

314:                                              ; preds = %267
  %315 = load ptr, ptr %27, align 8
  %316 = load i32, ptr %28, align 4
  %317 = insertvalue { ptr, i32 } poison, ptr %315, 0
  %318 = insertvalue { ptr, i32 } %317, i32 %316, 1
  resume { ptr, i32 } %318

319:                                              ; preds = %311, %303, %81
  unreachable
}

declare noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #2 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 = { 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 #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 = { nounwind "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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 20}
!14 = !{!"_ZTS20R3MeshSearchTreeFace", !6, i64 0, !10, i64 8, !12, i64 16, !12, i64 20}
!15 = !{!16, !12, i64 20}
!16 = !{!"_ZTS16R3MeshSearchTree", !6, i64 0, !6, i64 8, !12, i64 16, !12, i64 20}
!17 = !{!14, !6, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !12, i64 32}
!21 = !{!"_ZTS20R3MeshSearchTreeNode", !6, i64 0, !7, i64 8, !10, i64 24, !12, i64 32, !22, i64 40, !22, i64 56}
!22 = !{!"_ZTS7RNArrayIP20R3MeshSearchTreeFaceE", !23, i64 0}
!23 = !{!"_ZTS8RNVArray", !6, i64 0, !12, i64 8, !12, i64 12}
!24 = !{!21, !10, i64 24}
!25 = distinct !{!25, !19}


; 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.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [98 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@RN_INFINITY = external local_unnamed_addr global double, align 8

declare i32 @__gxx_personality_v0(...)

declare void @_Z7RNAbortPKcz(ptr noundef, ...) 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

declare void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #0

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

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

; Function Attrs: nounwind
declare void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_SF_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(64), double noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5 align 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 #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(64) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef nonnull align 8 dereferenceable(56) %8) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %10 = alloca double, align 8
  %11 = alloca %class.R3Box, align 8
  %12 = alloca %class.R3Box, align 8
  %13 = alloca %class.R3Box, align 8
  %14 = alloca %class.R3Box, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %15 = call noundef i32 @_Z12R3IntersectsRK5R3RayRK5R3BoxP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(56) %8, ptr noundef null, ptr noundef null, ptr noundef nonnull %10)
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %.loopexit, label %16

16:                                               ; preds = %9
  %17 = load double, ptr %10, align 8, !tbaa !5
  %18 = load double, ptr %4, align 8, !tbaa !5
  %19 = fcmp ogt double %17, %18
  br i1 %19, label %.loopexit, label %.preheader104

.preheader104:                                    ; preds = %16
  %20 = getelementptr inbounds i8, ptr %7, i64 40
  %21 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %20)
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader104
  %23 = getelementptr inbounds i8, ptr %0, i64 20
  br label %30

._crit_edge:                                      ; preds = %39, %.preheader104
  %24 = getelementptr inbounds i8, ptr %7, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %.not100 = icmp eq ptr %25, null
  br i1 %.not100, label %.preheader, label %43

.preheader:                                       ; preds = %._crit_edge
  %26 = getelementptr inbounds i8, ptr %7, i64 56
  %27 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %26)
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph107, label %.loopexit

.lr.ph107:                                        ; preds = %.preheader
  %29 = getelementptr inbounds i8, ptr %0, i64 20
  br label %119

30:                                               ; preds = %.lr.ph, %39
  %.096105 = phi i32 [ 0, %.lr.ph ], [ %40, %39 ]
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %20, i32 noundef %.096105)
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %32, i64 20
  %34 = load i32, ptr %33, align 4, !tbaa !11
  %35 = load i32, ptr %23, align 4, !tbaa !14
  %36 = icmp eq i32 %34, %35
  br i1 %36, label %39, label %37

37:                                               ; preds = %30
  store i32 %35, ptr %33, align 4, !tbaa !11
  %38 = load ptr, ptr %32, align 8, !tbaa !16
  call void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_SF_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(64) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef %38)
  br label %39

39:                                               ; preds = %30, %37
  %40 = add nuw nsw i32 %.096105, 1
  %41 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %20)
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %30, label %._crit_edge, !llvm.loop !17

43:                                               ; preds = %._crit_edge
  %44 = getelementptr inbounds i8, ptr %7, i64 16
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %.not101 = icmp eq ptr %45, null
  br i1 %.not101, label %46, label %47

46:                                               ; preds = %43
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, i32 noundef 1030, ptr noundef nonnull @.str.2)
  br label %47

47:                                               ; preds = %46, %43
  %48 = getelementptr inbounds i8, ptr %7, i64 56
  %49 = call noundef i32 @_ZNK8RNVArray7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %48)
  %.not102 = icmp eq i32 %49, 0
  br i1 %.not102, label %50, label %51

50:                                               ; preds = %47
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.8, i32 noundef 1031, ptr noundef nonnull @.str.2)
  br label %51

51:                                               ; preds = %50, %47
  %52 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %53 = getelementptr inbounds i8, ptr %7, i64 32
  %54 = load i32, ptr %53, align 8, !tbaa !19
  %55 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %52, i32 noundef %54)
  %56 = getelementptr inbounds i8, ptr %7, i64 24
  %57 = load double, ptr %56, align 8, !tbaa !23
  %58 = fsub double %55, %57
  %59 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %60 = load i32, ptr %53, align 8, !tbaa !19
  %61 = call noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24) %59, i32 noundef %60)
  %62 = fmul double %58, %61
  %63 = fcmp olt double %62, 0.000000e+00
  %64 = fneg double %58
  %65 = fdiv double %64, %61
  %66 = load double, ptr @RN_INFINITY, align 8
  %67 = select i1 %63, double %65, double %66
  %68 = fcmp ugt double %58, 0.000000e+00
  %69 = fcmp ult double %67, %3
  br i1 %68, label %94, label %70

70:                                               ; preds = %51
  br i1 %69, label %81, label %71

71:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %11) #6
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %11, ptr noundef nonnull align 8 dereferenceable(56) %8)
  %72 = load double, ptr %56, align 8, !tbaa !23
  %73 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %11, i32 noundef 1)
  %74 = load i32, ptr %53, align 8, !tbaa !19
  %75 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %73, i32 noundef %74)
          to label %76 unwind label %79

76:                                               ; preds = %71
  store double %72, ptr %75, align 8, !tbaa !5
  %77 = load ptr, ptr %24, align 8, !tbaa !9
  invoke void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(64) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef %77, ptr noundef nonnull align 8 dereferenceable(56) %11)
          to label %78 unwind label %79

78:                                               ; preds = %76
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %11) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #6
  br label %81

79:                                               ; preds = %76, %71
  %80 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %11) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #6
  br label %118

81:                                               ; preds = %78, %70
  %82 = load double, ptr %4, align 8, !tbaa !5
  %83 = fcmp olt double %67, %82
  br i1 %83, label %84, label %.loopexit

84:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %12) #6
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %12, ptr noundef nonnull align 8 dereferenceable(56) %8)
  %85 = load double, ptr %56, align 8, !tbaa !23
  %86 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %12, i32 noundef 0)
  %87 = load i32, ptr %53, align 8, !tbaa !19
  %88 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %86, i32 noundef %87)
          to label %89 unwind label %92

89:                                               ; preds = %84
  store double %85, ptr %88, align 8, !tbaa !5
  %90 = load ptr, ptr %44, align 8, !tbaa !9
  invoke void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(64) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef %90, ptr noundef nonnull align 8 dereferenceable(56) %12)
          to label %91 unwind label %92

91:                                               ; preds = %89
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %12) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #6
  br label %.loopexit

92:                                               ; preds = %89, %84
  %93 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %12) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #6
  br label %118

94:                                               ; preds = %51
  br i1 %69, label %105, label %95

95:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %13) #6
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %13, ptr noundef nonnull align 8 dereferenceable(56) %8)
  %96 = load double, ptr %56, align 8, !tbaa !23
  %97 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %13, i32 noundef 0)
  %98 = load i32, ptr %53, align 8, !tbaa !19
  %99 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %97, i32 noundef %98)
          to label %100 unwind label %103

100:                                              ; preds = %95
  store double %96, ptr %99, align 8, !tbaa !5
  %101 = load ptr, ptr %44, align 8, !tbaa !9
  invoke void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(64) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef %101, ptr noundef nonnull align 8 dereferenceable(56) %13)
          to label %102 unwind label %103

102:                                              ; preds = %100
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %13) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %13) #6
  br label %105

103:                                              ; preds = %100, %95
  %104 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %13) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %13) #6
  br label %118

105:                                              ; preds = %102, %94
  %106 = load double, ptr %4, align 8, !tbaa !5
  %107 = fcmp olt double %67, %106
  br i1 %107, label %108, label %.loopexit

108:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %14) #6
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %14, ptr noundef nonnull align 8 dereferenceable(56) %8)
  %109 = load double, ptr %56, align 8, !tbaa !23
  %110 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %14, i32 noundef 1)
  %111 = load i32, ptr %53, align 8, !tbaa !19
  %112 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %110, i32 noundef %111)
          to label %113 unwind label %116

113:                                              ; preds = %108
  store double %109, ptr %112, align 8, !tbaa !5
  %114 = load ptr, ptr %24, align 8, !tbaa !9
  invoke void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(64) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef %114, ptr noundef nonnull align 8 dereferenceable(56) %14)
          to label %115 unwind label %116

115:                                              ; preds = %113
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %14) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %14) #6
  br label %.loopexit

116:                                              ; preds = %113, %108
  %117 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %14) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %14) #6
  br label %118

118:                                              ; preds = %116, %103, %92, %79
  %.pn = phi { ptr, i32 } [ %93, %92 ], [ %80, %79 ], [ %117, %116 ], [ %104, %103 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  resume { ptr, i32 } %.pn

119:                                              ; preds = %.lr.ph107, %128
  %.0106 = phi i32 [ 0, %.lr.ph107 ], [ %129, %128 ]
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %26, i32 noundef %.0106)
  %121 = load ptr, ptr %120, align 8, !tbaa !9
  %122 = getelementptr inbounds i8, ptr %121, i64 20
  %123 = load i32, ptr %122, align 4, !tbaa !11
  %124 = load i32, ptr %29, align 4, !tbaa !14
  %125 = icmp eq i32 %123, %124
  br i1 %125, label %128, label %126

126:                                              ; preds = %119
  store i32 %124, ptr %122, align 4, !tbaa !11
  %127 = load ptr, ptr %121, align 8, !tbaa !16
  call void @_ZNK16R3MeshSearchTree16FindIntersectionERK5R3RayR18R3MeshIntersectiondRdPFiRK7R3PointRK8R3VectorP6R3MeshP10R3MeshFacePvESG_SF_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(64) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef %127)
  br label %128

128:                                              ; preds = %119, %126
  %129 = add nuw nsw i32 %.0106, 1
  %130 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %26)
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %119, label %.loopexit, !llvm.loop !24

.loopexit:                                        ; preds = %128, %.preheader, %105, %115, %81, %91, %16, %9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK8R3VectorixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #2 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 = { 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 #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 = { nounwind "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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 20}
!12 = !{!"_ZTS20R3MeshSearchTreeFace", !10, i64 0, !6, i64 8, !13, i64 16, !13, i64 20}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 20}
!15 = !{!"_ZTS16R3MeshSearchTree", !10, i64 0, !10, i64 8, !13, i64 16, !13, i64 20}
!16 = !{!12, !10, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !13, i64 32}
!20 = !{!"_ZTS20R3MeshSearchTreeNode", !10, i64 0, !7, i64 8, !6, i64 24, !13, i64 32, !21, i64 40, !21, i64 56}
!21 = !{!"_ZTS7RNArrayIP20R3MeshSearchTreeFaceE", !22, i64 0}
!22 = !{!"_ZTS8RNVArray", !10, i64 0, !13, i64 8, !13, i64 12}
!23 = !{!20, !6, i64 24}
!24 = distinct !{!24, !18}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass