; 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

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: mustprogress uwtable
declare dso_local void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_SC_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), 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: mustprogress uwtable
declare dso_local noundef double @_ZNK16R3MeshSearchTree15DistanceSquaredERK7R3PointRK5R3Boxd(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(56), double noundef) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(64) %3, double noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef nonnull align 8 dereferenceable(56) %9) #5 align 2 personality ptr @__gxx_personality_v0 {
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca double, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca double, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca ptr, 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 %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %2, ptr %13, align 8, !tbaa !5
  store ptr %3, ptr %14, align 8, !tbaa !5
  store double %4, ptr %15, align 8, !tbaa !9
  store ptr %5, ptr %16, align 8, !tbaa !5
  store ptr %6, ptr %17, align 8, !tbaa !5
  store ptr %7, ptr %18, align 8, !tbaa !5
  store ptr %8, ptr %19, align 8, !tbaa !5
  store ptr %9, ptr %20, align 8, !tbaa !5
  %34 = load ptr, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %35 = load ptr, ptr %12, align 8, !tbaa !5
  %36 = load ptr, ptr %20, align 8, !tbaa !5
  %37 = load ptr, ptr %16, align 8, !tbaa !5
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = call noundef double @_ZNK16R3MeshSearchTree15DistanceSquaredERK7R3PointRK5R3Boxd(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 8 dereferenceable(56) %36, double noundef %38)
  store double %39, ptr %21, align 8, !tbaa !9
  %40 = load double, ptr %21, align 8, !tbaa !9
  %41 = load ptr, ptr %16, align 8, !tbaa !5
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = fcmp oge double %40, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %10
  store i32 1, ptr %22, align 4
  br label %304

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

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

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

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

65:                                               ; preds = %53
  store i32 4, ptr %22, align 4
  br label %81

66:                                               ; preds = %53
  %67 = getelementptr inbounds %class.R3MeshSearchTree, ptr %34, i32 0, i32 3
  %68 = load i32, ptr %67, align 4, !tbaa !15
  %69 = load ptr, ptr %24, align 8, !tbaa !5
  %70 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %69, i32 0, i32 3
  store i32 %68, ptr %70, align 4, !tbaa !13
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = load ptr, ptr %13, align 8, !tbaa !5
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  %74 = load double, ptr %15, align 8, !tbaa !9
  %75 = load ptr, ptr %16, align 8, !tbaa !5
  %76 = load ptr, ptr %17, align 8, !tbaa !5
  %77 = load ptr, ptr %18, align 8, !tbaa !5
  %78 = load ptr, ptr %24, 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 @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_SC_(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %71, ptr noundef nonnull align 8 dereferenceable(24) %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 %22, align 4
  br label %81

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

83:                                               ; preds = %81
  br label %84

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

87:                                               ; preds = %52
  %88 = load ptr, ptr %19, 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 %260

93:                                               ; preds = %87
  %94 = load ptr, ptr %19, 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 510, ptr noundef @.str.2)
  br label %100

100:                                              ; preds = %99, %93
  %101 = load ptr, ptr %19, 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 511, ptr noundef @.str.2)
  br label %106

106:                                              ; preds = %105, %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  %108 = load ptr, ptr %19, align 8, !tbaa !5
  %109 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %108, i32 0, i32 3
  %110 = load i32, ptr %109, align 8, !tbaa !20
  %111 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %107, i32 noundef %110)
  %112 = load ptr, ptr %19, align 8, !tbaa !5
  %113 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %112, i32 0, i32 2
  %114 = load double, ptr %113, align 8, !tbaa !24
  %115 = fsub double %111, %114
  store double %115, ptr %25, align 8, !tbaa !9
  %116 = load double, ptr %25, align 8, !tbaa !9
  %117 = fcmp ole double %116, 0.000000e+00
  br i1 %117, label %118, label %188

118:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 56, ptr %26) #6
  %119 = load ptr, ptr %20, align 8, !tbaa !5
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %26, ptr noundef nonnull align 8 dereferenceable(56) %119)
  %120 = load ptr, ptr %19, align 8, !tbaa !5
  %121 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %120, i32 0, i32 2
  %122 = load double, ptr %121, align 8, !tbaa !24
  %123 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %26, i32 noundef 1)
          to label %124 unwind label %173

124:                                              ; preds = %118
  %125 = load ptr, ptr %19, align 8, !tbaa !5
  %126 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %125, i32 0, i32 3
  %127 = load i32, ptr %126, align 8, !tbaa !20
  %128 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %123, i32 noundef %127)
          to label %129 unwind label %173

129:                                              ; preds = %124
  store double %122, ptr %128, align 8, !tbaa !9
  %130 = load ptr, ptr %12, align 8, !tbaa !5
  %131 = load ptr, ptr %13, align 8, !tbaa !5
  %132 = load ptr, ptr %14, align 8, !tbaa !5
  %133 = load double, ptr %15, align 8, !tbaa !9
  %134 = load ptr, ptr %16, align 8, !tbaa !5
  %135 = load ptr, ptr %17, align 8, !tbaa !5
  %136 = load ptr, ptr %18, align 8, !tbaa !5
  %137 = load ptr, ptr %19, align 8, !tbaa !5
  %138 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %137, i32 0, i32 1
  %139 = getelementptr inbounds [2 x ptr], ptr %138, i64 0, i64 0
  %140 = load ptr, ptr %139, align 8, !tbaa !5
  invoke void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %130, ptr noundef nonnull align 8 dereferenceable(24) %131, ptr noundef nonnull align 8 dereferenceable(64) %132, double noundef %133, ptr noundef nonnull align 8 dereferenceable(8) %134, ptr noundef %135, ptr noundef %136, ptr noundef %140, ptr noundef nonnull align 8 dereferenceable(56) %26)
          to label %141 unwind label %173

141:                                              ; preds = %129
  %142 = load double, ptr %25, align 8, !tbaa !9
  %143 = load double, ptr %25, align 8, !tbaa !9
  %144 = fmul double %142, %143
  %145 = load ptr, ptr %16, align 8, !tbaa !5
  %146 = load double, ptr %145, align 8, !tbaa !9
  %147 = fcmp olt double %144, %146
  br i1 %147, label %148, label %186

148:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 56, ptr %29) #6
  %149 = load ptr, ptr %20, align 8, !tbaa !5
  invoke void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %29, ptr noundef nonnull align 8 dereferenceable(56) %149)
          to label %150 unwind label %177

150:                                              ; preds = %148
  %151 = load ptr, ptr %19, align 8, !tbaa !5
  %152 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %151, i32 0, i32 2
  %153 = load double, ptr %152, align 8, !tbaa !24
  %154 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %29, i32 noundef 0)
          to label %155 unwind label %181

155:                                              ; preds = %150
  %156 = load ptr, ptr %19, align 8, !tbaa !5
  %157 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %156, i32 0, i32 3
  %158 = load i32, ptr %157, align 8, !tbaa !20
  %159 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %154, i32 noundef %158)
          to label %160 unwind label %181

160:                                              ; preds = %155
  store double %153, ptr %159, align 8, !tbaa !9
  %161 = load ptr, ptr %12, align 8, !tbaa !5
  %162 = load ptr, ptr %13, align 8, !tbaa !5
  %163 = load ptr, ptr %14, align 8, !tbaa !5
  %164 = load double, ptr %15, align 8, !tbaa !9
  %165 = load ptr, ptr %16, align 8, !tbaa !5
  %166 = load ptr, ptr %17, align 8, !tbaa !5
  %167 = load ptr, ptr %18, align 8, !tbaa !5
  %168 = load ptr, ptr %19, align 8, !tbaa !5
  %169 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %168, i32 0, i32 1
  %170 = getelementptr inbounds [2 x ptr], ptr %169, i64 0, i64 1
  %171 = load ptr, ptr %170, align 8, !tbaa !5
  invoke void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %161, ptr noundef nonnull align 8 dereferenceable(24) %162, ptr noundef nonnull align 8 dereferenceable(64) %163, double noundef %164, ptr noundef nonnull align 8 dereferenceable(8) %165, ptr noundef %166, ptr noundef %167, ptr noundef %171, ptr noundef nonnull align 8 dereferenceable(56) %29)
          to label %172 unwind label %181

172:                                              ; preds = %160
  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 %186

173:                                              ; preds = %129, %124, %118
  %174 = landingpad { ptr, i32 }
          cleanup
  %175 = extractvalue { ptr, i32 } %174, 0
  store ptr %175, ptr %27, align 8
  %176 = extractvalue { ptr, i32 } %174, 1
  store i32 %176, ptr %28, align 4
  br label %187

177:                                              ; preds = %148
  %178 = landingpad { ptr, i32 }
          cleanup
  %179 = extractvalue { ptr, i32 } %178, 0
  store ptr %179, ptr %27, align 8
  %180 = extractvalue { ptr, i32 } %178, 1
  store i32 %180, ptr %28, align 4
  br label %185

181:                                              ; preds = %160, %155, %150
  %182 = landingpad { ptr, i32 }
          cleanup
  %183 = extractvalue { ptr, i32 } %182, 0
  store ptr %183, ptr %27, align 8
  %184 = extractvalue { ptr, i32 } %182, 1
  store i32 %184, ptr %28, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %29) #6
  br label %185

185:                                              ; preds = %181, %177
  call void @llvm.lifetime.end.p0(i64 56, ptr %29) #6
  br label %187

186:                                              ; preds = %172, %141
  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 %258

187:                                              ; preds = %185, %173
  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 %259

188:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 56, ptr %30) #6
  %189 = load ptr, ptr %20, align 8, !tbaa !5
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %30, ptr noundef nonnull align 8 dereferenceable(56) %189)
  %190 = load ptr, ptr %19, align 8, !tbaa !5
  %191 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %190, i32 0, i32 2
  %192 = load double, ptr %191, align 8, !tbaa !24
  %193 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %30, i32 noundef 0)
          to label %194 unwind label %243

194:                                              ; preds = %188
  %195 = load ptr, ptr %19, align 8, !tbaa !5
  %196 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %195, i32 0, i32 3
  %197 = load i32, ptr %196, align 8, !tbaa !20
  %198 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %193, i32 noundef %197)
          to label %199 unwind label %243

199:                                              ; preds = %194
  store double %192, ptr %198, align 8, !tbaa !9
  %200 = load ptr, ptr %12, align 8, !tbaa !5
  %201 = load ptr, ptr %13, align 8, !tbaa !5
  %202 = load ptr, ptr %14, align 8, !tbaa !5
  %203 = load double, ptr %15, align 8, !tbaa !9
  %204 = load ptr, ptr %16, align 8, !tbaa !5
  %205 = load ptr, ptr %17, align 8, !tbaa !5
  %206 = load ptr, ptr %18, align 8, !tbaa !5
  %207 = load ptr, ptr %19, align 8, !tbaa !5
  %208 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %207, i32 0, i32 1
  %209 = getelementptr inbounds [2 x ptr], ptr %208, i64 0, i64 1
  %210 = load ptr, ptr %209, align 8, !tbaa !5
  invoke void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %200, ptr noundef nonnull align 8 dereferenceable(24) %201, ptr noundef nonnull align 8 dereferenceable(64) %202, double noundef %203, ptr noundef nonnull align 8 dereferenceable(8) %204, ptr noundef %205, ptr noundef %206, ptr noundef %210, ptr noundef nonnull align 8 dereferenceable(56) %30)
          to label %211 unwind label %243

211:                                              ; preds = %199
  %212 = load double, ptr %25, align 8, !tbaa !9
  %213 = load double, ptr %25, align 8, !tbaa !9
  %214 = fmul double %212, %213
  %215 = load ptr, ptr %16, align 8, !tbaa !5
  %216 = load double, ptr %215, align 8, !tbaa !9
  %217 = fcmp olt double %214, %216
  br i1 %217, label %218, label %256

218:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 56, ptr %31) #6
  %219 = load ptr, ptr %20, align 8, !tbaa !5
  invoke void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %31, ptr noundef nonnull align 8 dereferenceable(56) %219)
          to label %220 unwind label %247

220:                                              ; preds = %218
  %221 = load ptr, ptr %19, align 8, !tbaa !5
  %222 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %221, i32 0, i32 2
  %223 = load double, ptr %222, align 8, !tbaa !24
  %224 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %31, i32 noundef 1)
          to label %225 unwind label %251

225:                                              ; preds = %220
  %226 = load ptr, ptr %19, align 8, !tbaa !5
  %227 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %226, i32 0, i32 3
  %228 = load i32, ptr %227, align 8, !tbaa !20
  %229 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %224, i32 noundef %228)
          to label %230 unwind label %251

230:                                              ; preds = %225
  store double %223, ptr %229, align 8, !tbaa !9
  %231 = load ptr, ptr %12, align 8, !tbaa !5
  %232 = load ptr, ptr %13, align 8, !tbaa !5
  %233 = load ptr, ptr %14, align 8, !tbaa !5
  %234 = load double, ptr %15, align 8, !tbaa !9
  %235 = load ptr, ptr %16, align 8, !tbaa !5
  %236 = load ptr, ptr %17, align 8, !tbaa !5
  %237 = load ptr, ptr %18, align 8, !tbaa !5
  %238 = load ptr, ptr %19, align 8, !tbaa !5
  %239 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %238, i32 0, i32 1
  %240 = getelementptr inbounds [2 x ptr], ptr %239, i64 0, i64 0
  %241 = load ptr, ptr %240, align 8, !tbaa !5
  invoke void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %231, ptr noundef nonnull align 8 dereferenceable(24) %232, ptr noundef nonnull align 8 dereferenceable(64) %233, double noundef %234, ptr noundef nonnull align 8 dereferenceable(8) %235, ptr noundef %236, ptr noundef %237, ptr noundef %241, ptr noundef nonnull align 8 dereferenceable(56) %31)
          to label %242 unwind label %251

242:                                              ; preds = %230
  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 %256

243:                                              ; preds = %199, %194, %188
  %244 = landingpad { ptr, i32 }
          cleanup
  %245 = extractvalue { ptr, i32 } %244, 0
  store ptr %245, ptr %27, align 8
  %246 = extractvalue { ptr, i32 } %244, 1
  store i32 %246, ptr %28, align 4
  br label %257

247:                                              ; preds = %218
  %248 = landingpad { ptr, i32 }
          cleanup
  %249 = extractvalue { ptr, i32 } %248, 0
  store ptr %249, ptr %27, align 8
  %250 = extractvalue { ptr, i32 } %248, 1
  store i32 %250, ptr %28, align 4
  br label %255

251:                                              ; preds = %230, %225, %220
  %252 = landingpad { ptr, i32 }
          cleanup
  %253 = extractvalue { ptr, i32 } %252, 0
  store ptr %253, ptr %27, align 8
  %254 = extractvalue { ptr, i32 } %252, 1
  store i32 %254, ptr %28, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %31) #6
  br label %255

255:                                              ; preds = %251, %247
  call void @llvm.lifetime.end.p0(i64 56, ptr %31) #6
  br label %257

256:                                              ; preds = %242, %211
  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 %258

257:                                              ; preds = %255, %243
  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 %259

258:                                              ; preds = %256, %186
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  br label %303

259:                                              ; preds = %257, %187
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %307

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

261:                                              ; preds = %299, %260
  %262 = load i32, ptr %32, align 4, !tbaa !11
  %263 = load ptr, ptr %19, align 8, !tbaa !5
  %264 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %263, i32 0, i32 5
  %265 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %264)
  %266 = icmp slt i32 %262, %265
  br i1 %266, label %268, label %267

267:                                              ; preds = %261
  store i32 5, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #6
  br label %302

268:                                              ; preds = %261
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #6
  %269 = load ptr, ptr %19, align 8, !tbaa !5
  %270 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %269, i32 0, i32 5
  %271 = load i32, ptr %32, align 4, !tbaa !11
  %272 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %270, i32 noundef %271)
  %273 = load ptr, ptr %272, align 8, !tbaa !5
  store ptr %273, ptr %33, align 8, !tbaa !5
  %274 = load ptr, ptr %33, align 8, !tbaa !5
  %275 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %274, i32 0, i32 3
  %276 = load i32, ptr %275, align 4, !tbaa !13
  %277 = getelementptr inbounds %class.R3MeshSearchTree, ptr %34, i32 0, i32 3
  %278 = load i32, ptr %277, align 4, !tbaa !15
  %279 = icmp eq i32 %276, %278
  br i1 %279, label %280, label %281

280:                                              ; preds = %268
  store i32 7, ptr %22, align 4
  br label %296

281:                                              ; preds = %268
  %282 = getelementptr inbounds %class.R3MeshSearchTree, ptr %34, i32 0, i32 3
  %283 = load i32, ptr %282, align 4, !tbaa !15
  %284 = load ptr, ptr %33, align 8, !tbaa !5
  %285 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %284, i32 0, i32 3
  store i32 %283, ptr %285, align 4, !tbaa !13
  %286 = load ptr, ptr %12, align 8, !tbaa !5
  %287 = load ptr, ptr %13, align 8, !tbaa !5
  %288 = load ptr, ptr %14, align 8, !tbaa !5
  %289 = load double, ptr %15, align 8, !tbaa !9
  %290 = load ptr, ptr %16, align 8, !tbaa !5
  %291 = load ptr, ptr %17, align 8, !tbaa !5
  %292 = load ptr, ptr %18, align 8, !tbaa !5
  %293 = load ptr, ptr %33, align 8, !tbaa !5
  %294 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %293, i32 0, i32 0
  %295 = load ptr, ptr %294, align 8, !tbaa !17
  call void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_SC_(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %286, ptr noundef nonnull align 8 dereferenceable(24) %287, ptr noundef nonnull align 8 dereferenceable(64) %288, double noundef %289, ptr noundef nonnull align 8 dereferenceable(8) %290, ptr noundef %291, ptr noundef %292, ptr noundef %295)
  store i32 0, ptr %22, align 4
  br label %296

296:                                              ; preds = %281, %280
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #6
  %297 = load i32, ptr %22, align 4
  switch i32 %297, label %312 [
    i32 0, label %298
    i32 7, label %299
  ]

298:                                              ; preds = %296
  br label %299

299:                                              ; preds = %298, %296
  %300 = load i32, ptr %32, align 4, !tbaa !11
  %301 = add nsw i32 %300, 1
  store i32 %301, ptr %32, align 4, !tbaa !11
  br label %261, !llvm.loop !25

302:                                              ; preds = %267
  br label %303

303:                                              ; preds = %302, %258
  store i32 0, ptr %22, align 4
  br label %304

304:                                              ; preds = %303, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  %305 = load i32, ptr %22, align 4
  switch i32 %305, label %312 [
    i32 0, label %306
    i32 1, label %306
  ]

306:                                              ; preds = %304, %304
  ret void

307:                                              ; preds = %259
  %308 = load ptr, ptr %27, align 8
  %309 = load i32, ptr %28, align 4
  %310 = insertvalue { ptr, i32 } poison, ptr %308, 0
  %311 = insertvalue { ptr, i32 } %310, i32 %309, 1
  resume { ptr, i32 } %311

312:                                              ; preds = %304, %296, %81
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8RNVArray7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 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

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: mustprogress uwtable
declare dso_local void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_SC_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), 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: mustprogress uwtable
declare dso_local noundef double @_ZNK16R3MeshSearchTree15DistanceSquaredERK7R3PointRK5R3Boxd(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(56), double noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(64) %3, double noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef nonnull align 8 dereferenceable(56) %9) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %11 = alloca %class.R3Box, align 8
  %12 = alloca %class.R3Box, align 8
  %13 = alloca %class.R3Box, align 8
  %14 = alloca %class.R3Box, align 8
  %15 = load double, ptr %5, align 8, !tbaa !5
  %16 = tail call noundef double @_ZNK16R3MeshSearchTree15DistanceSquaredERK7R3PointRK5R3Boxd(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(56) %9, double noundef %15)
  %17 = load double, ptr %5, align 8, !tbaa !5
  %18 = fcmp ult double %16, %17
  br i1 %18, label %.preheader113, label %.loopexit

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

.lr.ph:                                           ; preds = %.preheader113
  %22 = getelementptr inbounds i8, ptr %0, i64 20
  br label %29

._crit_edge:                                      ; preds = %38, %.preheader113
  %23 = getelementptr inbounds i8, ptr %8, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %.not = icmp eq ptr %24, null
  br i1 %.not, label %.preheader, label %42

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

.lr.ph116:                                        ; preds = %.preheader
  %28 = getelementptr inbounds i8, ptr %0, i64 20
  br label %117

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

36:                                               ; preds = %29
  store i32 %34, ptr %32, align 4, !tbaa !11
  %37 = load ptr, ptr %31, align 8, !tbaa !16
  tail call void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_SC_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(64) %3, double noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %6, ptr noundef %7, ptr noundef %37)
  br label %38

38:                                               ; preds = %29, %36
  %39 = add nuw nsw i32 %.0100114, 1
  %40 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %19)
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %29, label %._crit_edge, !llvm.loop !17

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

45:                                               ; preds = %42
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, i32 noundef 510, ptr noundef nonnull @.str.2)
  br label %46

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

49:                                               ; preds = %46
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.8, i32 noundef 511, ptr noundef nonnull @.str.2)
  br label %50

50:                                               ; preds = %49, %46
  %51 = getelementptr inbounds i8, ptr %8, i64 32
  %52 = load i32, ptr %51, align 8, !tbaa !19
  %53 = tail call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %52)
  %54 = getelementptr inbounds i8, ptr %8, i64 24
  %55 = load double, ptr %54, align 8, !tbaa !23
  %56 = fsub double %53, %55
  %57 = fcmp ugt double %56, 0.000000e+00
  br i1 %57, label %87, label %58

58:                                               ; preds = %50
  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) %9)
  %59 = load double, ptr %54, align 8, !tbaa !23
  %60 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %11, i32 noundef 1)
  %61 = load i32, ptr %51, align 8, !tbaa !19
  %62 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %60, i32 noundef %61)
          to label %63 unwind label %78

63:                                               ; preds = %58
  store double %59, ptr %62, align 8, !tbaa !5
  %64 = load ptr, ptr %23, align 8, !tbaa !9
  invoke void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(64) %3, double noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %6, ptr noundef %7, ptr noundef %64, ptr noundef nonnull align 8 dereferenceable(56) %11)
          to label %65 unwind label %78

65:                                               ; preds = %63
  %66 = fmul double %56, %56
  %67 = load double, ptr %5, align 8, !tbaa !5
  %68 = fcmp olt double %66, %67
  br i1 %68, label %69, label %85

69:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %12) #6
  invoke void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %12, ptr noundef nonnull align 8 dereferenceable(56) %9)
          to label %70 unwind label %80

70:                                               ; preds = %69
  %71 = load double, ptr %54, align 8, !tbaa !23
  %72 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %12, i32 noundef 0)
  %73 = load i32, ptr %51, align 8, !tbaa !19
  %74 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %72, i32 noundef %73)
          to label %75 unwind label %82

75:                                               ; preds = %70
  store double %71, ptr %74, align 8, !tbaa !5
  %76 = load ptr, ptr %43, align 8, !tbaa !9
  invoke void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(64) %3, double noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %6, ptr noundef %7, ptr noundef %76, ptr noundef nonnull align 8 dereferenceable(56) %12)
          to label %77 unwind label %82

77:                                               ; preds = %75
  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 %85

78:                                               ; preds = %63, %58
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %86

80:                                               ; preds = %69
  %81 = landingpad { ptr, i32 }
          cleanup
  br label %84

82:                                               ; preds = %75, %70
  %83 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %12) #6
  br label %84

84:                                               ; preds = %82, %80
  %.pn109 = phi { ptr, i32 } [ %83, %82 ], [ %81, %80 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #6
  br label %86

85:                                               ; preds = %77, %65
  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 %.loopexit

86:                                               ; preds = %84, %78
  %.pn109.pn = phi { ptr, i32 } [ %.pn109, %84 ], [ %79, %78 ]
  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 %116

87:                                               ; preds = %50
  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) %9)
  %88 = load double, ptr %54, align 8, !tbaa !23
  %89 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %13, i32 noundef 0)
  %90 = load i32, ptr %51, align 8, !tbaa !19
  %91 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %89, i32 noundef %90)
          to label %92 unwind label %107

92:                                               ; preds = %87
  store double %88, ptr %91, align 8, !tbaa !5
  %93 = load ptr, ptr %43, align 8, !tbaa !9
  invoke void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(64) %3, double noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %6, ptr noundef %7, ptr noundef %93, ptr noundef nonnull align 8 dereferenceable(56) %13)
          to label %94 unwind label %107

94:                                               ; preds = %92
  %95 = fmul double %56, %56
  %96 = load double, ptr %5, align 8, !tbaa !5
  %97 = fcmp olt double %95, %96
  br i1 %97, label %98, label %114

98:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %14) #6
  invoke void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %14, ptr noundef nonnull align 8 dereferenceable(56) %9)
          to label %99 unwind label %109

99:                                               ; preds = %98
  %100 = load double, ptr %54, align 8, !tbaa !23
  %101 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %14, i32 noundef 1)
  %102 = load i32, ptr %51, align 8, !tbaa !19
  %103 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %101, i32 noundef %102)
          to label %104 unwind label %111

104:                                              ; preds = %99
  store double %100, ptr %103, align 8, !tbaa !5
  %105 = load ptr, ptr %23, align 8, !tbaa !9
  invoke void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_P20R3MeshSearchTreeNodeRK5R3Box(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(64) %3, double noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %6, ptr noundef %7, ptr noundef %105, ptr noundef nonnull align 8 dereferenceable(56) %14)
          to label %106 unwind label %111

106:                                              ; preds = %104
  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 %114

107:                                              ; preds = %92, %87
  %108 = landingpad { ptr, i32 }
          cleanup
  br label %115

109:                                              ; preds = %98
  %110 = landingpad { ptr, i32 }
          cleanup
  br label %113

111:                                              ; preds = %104, %99
  %112 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %14) #6
  br label %113

113:                                              ; preds = %111, %109
  %.pn = phi { ptr, i32 } [ %112, %111 ], [ %110, %109 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %14) #6
  br label %115

114:                                              ; preds = %106, %94
  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 %.loopexit

115:                                              ; preds = %113, %107
  %.pn.pn = phi { ptr, i32 } [ %.pn, %113 ], [ %108, %107 ]
  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 %116

116:                                              ; preds = %115, %86
  %.pn109.pn.pn = phi { ptr, i32 } [ %.pn109.pn, %86 ], [ %.pn.pn, %115 ]
  resume { ptr, i32 } %.pn109.pn.pn

117:                                              ; preds = %.lr.ph116, %126
  %.0115 = phi i32 [ 0, %.lr.ph116 ], [ %127, %126 ]
  %118 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %25, i32 noundef %.0115)
  %119 = load ptr, ptr %118, align 8, !tbaa !9
  %120 = getelementptr inbounds i8, ptr %119, i64 20
  %121 = load i32, ptr %120, align 4, !tbaa !11
  %122 = load i32, ptr %28, align 4, !tbaa !14
  %123 = icmp eq i32 %121, %122
  br i1 %123, label %126, label %124

124:                                              ; preds = %117
  store i32 %122, ptr %120, align 4, !tbaa !11
  %125 = load ptr, ptr %119, align 8, !tbaa !16
  tail call void @_ZNK16R3MeshSearchTree11FindClosestERK7R3PointRK8R3VectorR18R3MeshIntersectiondRdPFiS2_S5_P6R3MeshP10R3MeshFacePvESD_SC_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(64) %3, double noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %6, ptr noundef %7, ptr noundef %125)
  br label %126

126:                                              ; preds = %117, %124
  %127 = add nuw nsw i32 %.0115, 1
  %128 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %25)
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %117, label %.loopexit, !llvm.loop !24

.loopexit:                                        ; preds = %126, %.preheader, %114, %85, %10
  ret void
}

; 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

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,TailCallElimPass