; 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.R3MeshSearchTree = type { ptr, ptr, i32, i32 }
%class.R3MeshSearchTreeFace = type { ptr, double, i32, i32 }
%class.R3MeshSearchTreeNode = type { ptr, [2 x ptr], double, i32, %class.RNArray, %class.RNArray }
%class.RNArray = type { %class.RNVArray }
%class.RNVArray = type { 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.5 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN20R3MeshSearchTreeNodeC2EPS_(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

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

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL12R3IntersectsP6R3MeshP10R3MeshFaceRK5R3Box(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(56)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %4) #1 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca %class.R3Box, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %class.R3Box, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  %22 = load ptr, ptr %6, align 8
  %23 = getelementptr inbounds %class.R3MeshSearchTree, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !13
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = call noundef i32 @_ZL12R3IntersectsP6R3MeshP10R3MeshFaceRK5R3Box(ptr noundef %24, ptr noundef %27, ptr noundef nonnull align 8 dereferenceable(56) %28)
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %32, label %31

31:                                               ; preds = %5
  br label %271

32:                                               ; preds = %5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %33, i32 0, i32 1
  %35 = getelementptr inbounds [2 x ptr], ptr %34, i64 0, i64 0
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %123

38:                                               ; preds = %32
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %39, i32 0, i32 1
  %41 = getelementptr inbounds [2 x ptr], ptr %40, i64 0, i64 1
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %45, label %44

44:                                               ; preds = %38
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.4, i32 noundef 194, ptr noundef @.str.2)
  br label %45

45:                                               ; preds = %44, %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %46 = getelementptr inbounds %class.R3MeshSearchTree, ptr %22, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !13
  %51 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK6R3Mesh8FaceBBoxEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %47, ptr noundef %50)
  store ptr %51, ptr %11, align 8, !tbaa !5
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %52, i32 noundef 0)
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %54, i32 0, i32 3
  %56 = load i32, ptr %55, align 8, !tbaa !16
  %57 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %53, i32 noundef %56)
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %58, i32 0, i32 2
  %60 = load double, ptr %59, align 8, !tbaa !20
  %61 = fcmp ole double %57, %60
  br i1 %61, label %62, label %86

62:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 56, ptr %12) #8
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %12, ptr noundef nonnull align 8 dereferenceable(56) %63)
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %64, i32 0, i32 2
  %66 = load double, ptr %65, align 8, !tbaa !20
  %67 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %12, i32 noundef 1)
          to label %68 unwind label %82

68:                                               ; preds = %62
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %69, i32 0, i32 3
  %71 = load i32, ptr %70, align 8, !tbaa !16
  %72 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %67, i32 noundef %71)
          to label %73 unwind label %82

73:                                               ; preds = %68
  store double %66, ptr %72, align 8, !tbaa !21
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  %76 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %75, i32 0, i32 1
  %77 = getelementptr inbounds [2 x ptr], ptr %76, i64 0, i64 0
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  invoke void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef %74, ptr noundef %78, ptr noundef nonnull align 8 dereferenceable(56) %12, i32 noundef %80)
          to label %81 unwind label %82

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

82:                                               ; preds = %73, %68, %62
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %13, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %14, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %12) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr %12) #8
  br label %122

86:                                               ; preds = %81, %45
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %87, i32 noundef 1)
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %89, i32 0, i32 3
  %91 = load i32, ptr %90, align 8, !tbaa !16
  %92 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %88, i32 noundef %91)
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %93, i32 0, i32 2
  %95 = load double, ptr %94, align 8, !tbaa !20
  %96 = fcmp oge double %92, %95
  br i1 %96, label %97, label %121

97:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 56, ptr %15) #8
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %15, ptr noundef nonnull align 8 dereferenceable(56) %98)
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %99, i32 0, i32 2
  %101 = load double, ptr %100, align 8, !tbaa !20
  %102 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %15, i32 noundef 0)
          to label %103 unwind label %117

103:                                              ; preds = %97
  %104 = load ptr, ptr %8, align 8, !tbaa !5
  %105 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %104, i32 0, i32 3
  %106 = load i32, ptr %105, align 8, !tbaa !16
  %107 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %102, i32 noundef %106)
          to label %108 unwind label %117

108:                                              ; preds = %103
  store double %101, ptr %107, align 8, !tbaa !21
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %110, i32 0, i32 1
  %112 = getelementptr inbounds [2 x ptr], ptr %111, i64 0, i64 1
  %113 = load ptr, ptr %112, align 8, !tbaa !5
  %114 = load i32, ptr %10, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  invoke void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef %109, ptr noundef %113, ptr noundef nonnull align 8 dereferenceable(56) %15, i32 noundef %115)
          to label %116 unwind label %117

116:                                              ; preds = %108
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %15) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr %15) #8
  br label %121

117:                                              ; preds = %108, %103, %97
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %13, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %14, align 4
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %15) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr %15) #8
  br label %122

121:                                              ; preds = %116, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %271

122:                                              ; preds = %117, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %272

123:                                              ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = call noundef double @_ZNK5R3Box14DiagonalLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %124)
  store double %125, ptr %16, align 8, !tbaa !21
  %126 = load double, ptr %16, align 8, !tbaa !21
  %127 = fcmp oeq double %126, 0.000000e+00
  br i1 %127, label %128, label %129

128:                                              ; preds = %123
  store i32 1, ptr %17, align 4
  br label %267

129:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %130 = load double, ptr %16, align 8, !tbaa !21
  %131 = load double, ptr %16, align 8, !tbaa !21
  %132 = fmul double %130, %131
  store double %132, ptr %18, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %133, i32 0, i32 1
  %135 = load double, ptr %134, align 8, !tbaa !22
  %136 = load double, ptr %18, align 8, !tbaa !21
  %137 = fdiv double %135, %136
  store double %137, ptr %19, align 8, !tbaa !21
  %138 = load double, ptr %19, align 8, !tbaa !21
  %139 = fcmp oge double %138, 1.000000e-01
  br i1 %139, label %143, label %140

140:                                              ; preds = %129
  %141 = load i32, ptr %10, align 4, !tbaa !9
  %142 = icmp sge i32 %141, 64
  br i1 %142, label %143, label %158

143:                                              ; preds = %140, %129
  %144 = load ptr, ptr %8, align 8, !tbaa !5
  %145 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %144, i32 0, i32 4
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = call noundef ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceE6InsertES1_(ptr noundef nonnull align 8 dereferenceable(16) %145, ptr noundef %146)
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %148, i32 0, i32 2
  %150 = load i32, ptr %149, align 8, !tbaa !23
  %151 = icmp sge i32 %150, 0
  br i1 %151, label %153, label %152

152:                                              ; preds = %143
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.5, i32 noundef 217, ptr noundef @.str.2)
  br label %153

153:                                              ; preds = %152, %143
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %154, i32 0, i32 2
  %156 = load i32, ptr %155, align 8, !tbaa !23
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %155, align 8, !tbaa !23
  br label %266

158:                                              ; preds = %140
  %159 = load ptr, ptr %8, align 8, !tbaa !5
  %160 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %159, i32 0, i32 5
  %161 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %160)
  %162 = icmp slt i32 %161, 128
  br i1 %162, label %163, label %172

163:                                              ; preds = %158
  %164 = load ptr, ptr %8, align 8, !tbaa !5
  %165 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %164, i32 0, i32 5
  %166 = load ptr, ptr %7, align 8, !tbaa !5
  %167 = call noundef ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceE6InsertES1_(ptr noundef nonnull align 8 dereferenceable(16) %165, ptr noundef %166)
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %168, i32 0, i32 2
  %170 = load i32, ptr %169, align 8, !tbaa !23
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %169, align 8, !tbaa !23
  br label %265

172:                                              ; preds = %158
  %173 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 72) #9
  %174 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN20R3MeshSearchTreeNodeC2EPS_(ptr noundef nonnull align 8 dereferenceable(72) %173, ptr noundef %174)
          to label %175 unwind label %211

175:                                              ; preds = %172
  %176 = load ptr, ptr %8, align 8, !tbaa !5
  %177 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %176, i32 0, i32 1
  %178 = getelementptr inbounds [2 x ptr], ptr %177, i64 0, i64 0
  store ptr %173, ptr %178, align 8, !tbaa !5
  %179 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 72) #9
  %180 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN20R3MeshSearchTreeNodeC2EPS_(ptr noundef nonnull align 8 dereferenceable(72) %179, ptr noundef %180)
          to label %181 unwind label %215

181:                                              ; preds = %175
  %182 = load ptr, ptr %8, align 8, !tbaa !5
  %183 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %182, i32 0, i32 1
  %184 = getelementptr inbounds [2 x ptr], ptr %183, i64 0, i64 1
  store ptr %179, ptr %184, align 8, !tbaa !5
  %185 = load ptr, ptr %9, align 8, !tbaa !5
  %186 = call noundef i32 @_ZNK5R3Box11LongestAxisEv(ptr noundef nonnull align 8 dereferenceable(56) %185)
  %187 = load ptr, ptr %8, align 8, !tbaa !5
  %188 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %187, i32 0, i32 3
  store i32 %186, ptr %188, align 8, !tbaa !16
  %189 = load ptr, ptr %9, align 8, !tbaa !5
  %190 = load ptr, ptr %8, align 8, !tbaa !5
  %191 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %190, i32 0, i32 3
  %192 = load i32, ptr %191, align 8, !tbaa !16
  %193 = call noundef double @_ZNK5R3Box10AxisCenterEi(ptr noundef nonnull align 8 dereferenceable(56) %189, i32 noundef %192)
  %194 = load ptr, ptr %8, align 8, !tbaa !5
  %195 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %194, i32 0, i32 2
  store double %193, ptr %195, align 8, !tbaa !20
  %196 = getelementptr inbounds %class.R3MeshSearchTree, ptr %22, i32 0, i32 2
  %197 = load i32, ptr %196, align 8, !tbaa !24
  %198 = add nsw i32 %197, 2
  store i32 %198, ptr %196, align 8, !tbaa !24
  %199 = load ptr, ptr %7, align 8, !tbaa !5
  %200 = load ptr, ptr %8, align 8, !tbaa !5
  %201 = load ptr, ptr %9, align 8, !tbaa !5
  %202 = load i32, ptr %10, align 4, !tbaa !9
  %203 = add nsw i32 %202, 1
  call void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef %199, ptr noundef %200, ptr noundef nonnull align 8 dereferenceable(56) %201, i32 noundef %203)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %204

204:                                              ; preds = %229, %181
  %205 = load i32, ptr %20, align 4, !tbaa !9
  %206 = load ptr, ptr %8, align 8, !tbaa !5
  %207 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %206, i32 0, i32 5
  %208 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %207)
  %209 = icmp slt i32 %205, %208
  br i1 %209, label %219, label %210

210:                                              ; preds = %204
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %232

211:                                              ; preds = %172
  %212 = landingpad { ptr, i32 }
          cleanup
  %213 = extractvalue { ptr, i32 } %212, 0
  store ptr %213, ptr %13, align 8
  %214 = extractvalue { ptr, i32 } %212, 1
  store i32 %214, ptr %14, align 4
  call void @_ZdlPvm(ptr noundef %173, i64 noundef 72) #10
  br label %270

215:                                              ; preds = %175
  %216 = landingpad { ptr, i32 }
          cleanup
  %217 = extractvalue { ptr, i32 } %216, 0
  store ptr %217, ptr %13, align 8
  %218 = extractvalue { ptr, i32 } %216, 1
  store i32 %218, ptr %14, align 4
  call void @_ZdlPvm(ptr noundef %179, i64 noundef 72) #10
  br label %270

219:                                              ; preds = %204
  %220 = load ptr, ptr %8, align 8, !tbaa !5
  %221 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %220, i32 0, i32 5
  %222 = load i32, ptr %20, align 4, !tbaa !9
  %223 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %221, i32 noundef %222)
  %224 = load ptr, ptr %223, align 8, !tbaa !5
  %225 = load ptr, ptr %8, align 8, !tbaa !5
  %226 = load ptr, ptr %9, align 8, !tbaa !5
  %227 = load i32, ptr %10, align 4, !tbaa !9
  %228 = add nsw i32 %227, 1
  call void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef %224, ptr noundef %225, ptr noundef nonnull align 8 dereferenceable(56) %226, i32 noundef %228)
  br label %229

229:                                              ; preds = %219
  %230 = load i32, ptr %20, align 4, !tbaa !9
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr %20, align 4, !tbaa !9
  br label %204, !llvm.loop !25

232:                                              ; preds = %210
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %233

233:                                              ; preds = %259, %232
  %234 = load i32, ptr %21, align 4, !tbaa !9
  %235 = load ptr, ptr %8, align 8, !tbaa !5
  %236 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %235, i32 0, i32 5
  %237 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %236)
  %238 = icmp slt i32 %234, %237
  br i1 %238, label %240, label %239

239:                                              ; preds = %233
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %262

240:                                              ; preds = %233
  %241 = load ptr, ptr %8, align 8, !tbaa !5
  %242 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %241, i32 0, i32 5
  %243 = load i32, ptr %21, align 4, !tbaa !9
  %244 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %242, i32 noundef %243)
  %245 = load ptr, ptr %244, align 8, !tbaa !5
  %246 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %245, i32 0, i32 2
  %247 = load i32, ptr %246, align 8, !tbaa !23
  %248 = icmp sgt i32 %247, 0
  br i1 %248, label %250, label %249

249:                                              ; preds = %240
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.6, i32 noundef 243, ptr noundef @.str.2)
  br label %250

250:                                              ; preds = %249, %240
  %251 = load ptr, ptr %8, align 8, !tbaa !5
  %252 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %251, i32 0, i32 5
  %253 = load i32, ptr %21, align 4, !tbaa !9
  %254 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %252, i32 noundef %253)
  %255 = load ptr, ptr %254, align 8, !tbaa !5
  %256 = getelementptr inbounds %class.R3MeshSearchTreeFace, ptr %255, i32 0, i32 2
  %257 = load i32, ptr %256, align 8, !tbaa !23
  %258 = add nsw i32 %257, -1
  store i32 %258, ptr %256, align 8, !tbaa !23
  br label %259

259:                                              ; preds = %250
  %260 = load i32, ptr %21, align 4, !tbaa !9
  %261 = add nsw i32 %260, 1
  store i32 %261, ptr %21, align 4, !tbaa !9
  br label %233, !llvm.loop !27

262:                                              ; preds = %239
  %263 = load ptr, ptr %8, align 8, !tbaa !5
  %264 = getelementptr inbounds %class.R3MeshSearchTreeNode, ptr %263, i32 0, i32 5
  call void @_ZN8RNVArray5EmptyEi(ptr noundef nonnull align 8 dereferenceable(16) %264, i32 noundef 0)
  br label %265

265:                                              ; preds = %262, %163
  br label %266

266:                                              ; preds = %265, %153
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  store i32 0, ptr %17, align 4
  br label %267

267:                                              ; preds = %266, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  %268 = load i32, ptr %17, align 4
  switch i32 %268, label %277 [
    i32 0, label %269
    i32 1, label %271
  ]

269:                                              ; preds = %267
  br label %271

270:                                              ; preds = %215, %211
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %272

271:                                              ; preds = %269, %267, %121, %31
  ret void

272:                                              ; preds = %270, %122
  %273 = load ptr, ptr %13, align 8
  %274 = load i32, ptr %14, align 4
  %275 = insertvalue { ptr, i32 } poison, ptr %273, 0
  %276 = insertvalue { ptr, i32 } %275, i32 %274, 1
  resume { ptr, i32 } %276

277:                                              ; preds = %267
  unreachable
}

declare noundef nonnull align 8 dereferenceable(56) ptr @_ZNK6R3Mesh8FaceBBoxEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #3

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

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

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

; 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) #5 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) #6 align 2

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

declare noundef double @_ZNK5R3Box14DiagonalLengthEv(ptr noundef nonnull align 8 dereferenceable(56)) #3

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

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

declare noundef i32 @_ZNK5R3Box11LongestAxisEv(ptr noundef nonnull align 8 dereferenceable(56)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5R3Box10AxisCenterEi(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) #6 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) #1 align 2

declare void @_ZN8RNVArray5EmptyEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3

attributes #0 = { nobuiltin allocsize(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 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 #2 = { nobuiltin 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 #3 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS16R3MeshSearchTree", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS20R3MeshSearchTreeFace", !6, i64 0, !15, i64 8, !10, i64 16, !10, i64 20}
!15 = !{!"double", !7, i64 0}
!16 = !{!17, !10, i64 32}
!17 = !{!"_ZTS20R3MeshSearchTreeNode", !6, i64 0, !7, i64 8, !15, i64 24, !10, i64 32, !18, i64 40, !18, i64 56}
!18 = !{!"_ZTS7RNArrayIP20R3MeshSearchTreeFaceE", !19, i64 0}
!19 = !{!"_ZTS8RNVArray", !6, i64 0, !10, i64 8, !10, i64 12}
!20 = !{!17, !15, i64 24}
!21 = !{!15, !15, i64 0}
!22 = !{!14, !15, i64 8}
!23 = !{!14, !10, i64 16}
!24 = !{!12, !10, i64 16}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}


; 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.5 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN20R3MeshSearchTreeNodeC2EPS_(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @_Z7RNAbortPKcz(ptr noundef, ...) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL12R3IntersectsP6R3MeshP10R3MeshFaceRK5R3Box(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %4) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %class.R3Box, align 8
  %7 = alloca %class.R3Box, align 8
  %8 = load ptr, ptr %0, align 8, !tbaa !5
  %9 = load ptr, ptr %1, align 8, !tbaa !11
  %10 = tail call noundef i32 @_ZL12R3IntersectsP6R3MeshP10R3MeshFaceRK5R3Box(ptr noundef %8, ptr noundef %9, ptr noundef nonnull align 8 dereferenceable(56) %3)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %128, label %11

11:                                               ; preds = %5
  %12 = getelementptr inbounds i8, ptr %2, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %.not78 = icmp eq ptr %13, null
  br i1 %.not78, label %57, label %14

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %2, i64 16
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %.not80 = icmp eq ptr %16, null
  br i1 %.not80, label %17, label %18

17:                                               ; preds = %14
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, i32 noundef 194, ptr noundef nonnull @.str.2)
  br label %18

18:                                               ; preds = %17, %14
  %19 = load ptr, ptr %0, align 8, !tbaa !5
  %20 = load ptr, ptr %1, align 8, !tbaa !11
  %21 = tail call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK6R3Mesh8FaceBBoxEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %19, ptr noundef %20)
  %22 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %21, i32 noundef 0)
  %23 = getelementptr inbounds i8, ptr %2, i64 32
  %24 = load i32, ptr %23, align 8, !tbaa !15
  %25 = tail call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %22, i32 noundef %24)
  %26 = getelementptr inbounds i8, ptr %2, i64 24
  %27 = load double, ptr %26, align 8, !tbaa !19
  %28 = fcmp ugt double %25, %27
  br i1 %28, label %40, label %29

29:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %6) #8
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %6, ptr noundef nonnull align 8 dereferenceable(56) %3)
  %30 = load double, ptr %26, align 8, !tbaa !19
  %31 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %6, i32 noundef 1)
  %32 = load i32, ptr %23, align 8, !tbaa !15
  %33 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %31, i32 noundef %32)
          to label %34 unwind label %38

34:                                               ; preds = %29
  store double %30, ptr %33, align 8, !tbaa !20
  %35 = load ptr, ptr %12, align 8, !tbaa !14
  %36 = add nsw i32 %4, 1
  invoke void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %1, ptr noundef %35, ptr noundef nonnull align 8 dereferenceable(56) %6, i32 noundef %36)
          to label %37 unwind label %38

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

38:                                               ; preds = %34, %29
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %6) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %6) #8
  br label %129

40:                                               ; preds = %37, %18
  %41 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %21, i32 noundef 1)
  %42 = load i32, ptr %23, align 8, !tbaa !15
  %43 = call noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %41, i32 noundef %42)
  %44 = load double, ptr %26, align 8, !tbaa !19
  %45 = fcmp ult double %43, %44
  br i1 %45, label %128, label %46

46:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %7) #8
  call void @_ZN5R3BoxC1ERKS_(ptr noundef nonnull align 8 dereferenceable(56) %7, ptr noundef nonnull align 8 dereferenceable(56) %3)
  %47 = load double, ptr %26, align 8, !tbaa !19
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %7, i32 noundef 0)
  %49 = load i32, ptr %23, align 8, !tbaa !15
  %50 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %48, i32 noundef %49)
          to label %51 unwind label %55

51:                                               ; preds = %46
  store double %47, ptr %50, align 8, !tbaa !20
  %52 = load ptr, ptr %15, align 8, !tbaa !14
  %53 = add nsw i32 %4, 1
  invoke void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %1, ptr noundef %52, ptr noundef nonnull align 8 dereferenceable(56) %7, i32 noundef %53)
          to label %54 unwind label %55

54:                                               ; preds = %51
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %7) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %7) #8
  br label %128

55:                                               ; preds = %51, %46
  %56 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %7) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %7) #8
  br label %129

57:                                               ; preds = %11
  %58 = tail call noundef double @_ZNK5R3Box14DiagonalLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %3)
  %59 = fcmp oeq double %58, 0.000000e+00
  br i1 %59, label %128, label %60

60:                                               ; preds = %57
  %61 = fmul double %58, %58
  %62 = getelementptr inbounds i8, ptr %1, i64 8
  %63 = load double, ptr %62, align 8, !tbaa !21
  %64 = fdiv double %63, %61
  %65 = fcmp oge double %64, 1.000000e-01
  %66 = icmp sgt i32 %4, 63
  %or.cond = or i1 %66, %65
  br i1 %or.cond, label %67, label %77

67:                                               ; preds = %60
  %68 = getelementptr inbounds i8, ptr %2, i64 40
  %69 = tail call noundef ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceE6InsertES1_(ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull %1)
  %70 = getelementptr inbounds i8, ptr %1, i64 16
  %71 = load i32, ptr %70, align 8, !tbaa !22
  %72 = icmp sgt i32 %71, -1
  br i1 %72, label %74, label %73

73:                                               ; preds = %67
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.5, i32 noundef 217, ptr noundef nonnull @.str.2)
  %.pre = load i32, ptr %70, align 8, !tbaa !22
  br label %74

74:                                               ; preds = %73, %67
  %75 = phi i32 [ %.pre, %73 ], [ %71, %67 ]
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %70, align 8, !tbaa !22
  br label %128

77:                                               ; preds = %60
  %78 = getelementptr inbounds i8, ptr %2, i64 56
  %79 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %78)
  %80 = icmp slt i32 %79, 128
  br i1 %80, label %81, label %86

81:                                               ; preds = %77
  %82 = tail call noundef ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceE6InsertES1_(ptr noundef nonnull align 8 dereferenceable(16) %78, ptr noundef nonnull %1)
  %83 = getelementptr inbounds i8, ptr %1, i64 16
  %84 = load i32, ptr %83, align 8, !tbaa !22
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %83, align 8, !tbaa !22
  br label %128

86:                                               ; preds = %77
  %87 = tail call noalias noundef nonnull dereferenceable(72) ptr @_Znwm(i64 noundef 72) #9
  invoke void @_ZN20R3MeshSearchTreeNodeC2EPS_(ptr noundef nonnull align 8 dereferenceable(72) %87, ptr noundef nonnull %2)
          to label %88 unwind label %104

88:                                               ; preds = %86
  store ptr %87, ptr %12, align 8, !tbaa !14
  %89 = tail call noalias noundef nonnull dereferenceable(72) ptr @_Znwm(i64 noundef 72) #9
  invoke void @_ZN20R3MeshSearchTreeNodeC2EPS_(ptr noundef nonnull align 8 dereferenceable(72) %89, ptr noundef nonnull %2)
          to label %90 unwind label %106

90:                                               ; preds = %88
  %91 = getelementptr inbounds i8, ptr %2, i64 16
  store ptr %89, ptr %91, align 8, !tbaa !14
  %92 = tail call noundef i32 @_ZNK5R3Box11LongestAxisEv(ptr noundef nonnull align 8 dereferenceable(56) %3)
  %93 = getelementptr inbounds i8, ptr %2, i64 32
  store i32 %92, ptr %93, align 8, !tbaa !15
  %94 = tail call noundef double @_ZNK5R3Box10AxisCenterEi(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %92)
  %95 = getelementptr inbounds i8, ptr %2, i64 24
  store double %94, ptr %95, align 8, !tbaa !19
  %96 = getelementptr inbounds i8, ptr %0, i64 16
  %97 = load i32, ptr %96, align 8, !tbaa !23
  %98 = add nsw i32 %97, 2
  store i32 %98, ptr %96, align 8, !tbaa !23
  %99 = add nsw i32 %4, 1
  tail call void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %99)
  %100 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %78)
  %101 = icmp sgt i32 %100, 0
  br i1 %101, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %90
  %102 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %78)
  %103 = icmp sgt i32 %102, 0
  br i1 %103, label %.lr.ph86, label %._crit_edge

104:                                              ; preds = %86
  %105 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %87, i64 noundef 72) #10
  br label %129

106:                                              ; preds = %88
  %107 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %89, i64 noundef 72) #10
  br label %129

.lr.ph:                                           ; preds = %90, %.lr.ph
  %.07184 = phi i32 [ %110, %.lr.ph ], [ 0, %90 ]
  %108 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %78, i32 noundef %.07184)
  %109 = load ptr, ptr %108, align 8, !tbaa !14
  tail call void @_ZN16R3MeshSearchTree10InsertFaceEP20R3MeshSearchTreeFaceP20R3MeshSearchTreeNodeRK5R3Boxi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %109, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %99)
  %110 = add nuw nsw i32 %.07184, 1
  %111 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %78)
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %.lr.ph, label %.preheader, !llvm.loop !24

._crit_edge:                                      ; preds = %119, %.preheader
  tail call void @_ZN8RNVArray5EmptyEi(ptr noundef nonnull align 8 dereferenceable(16) %78, i32 noundef 0)
  br label %128

.lr.ph86:                                         ; preds = %.preheader, %119
  %.085 = phi i32 [ %125, %119 ], [ 0, %.preheader ]
  %113 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %78, i32 noundef %.085)
  %114 = load ptr, ptr %113, align 8, !tbaa !14
  %115 = getelementptr inbounds i8, ptr %114, i64 16
  %116 = load i32, ptr %115, align 8, !tbaa !22
  %117 = icmp sgt i32 %116, 0
  br i1 %117, label %119, label %118

118:                                              ; preds = %.lr.ph86
  tail call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.6, i32 noundef 243, ptr noundef nonnull @.str.2)
  br label %119

119:                                              ; preds = %118, %.lr.ph86
  %120 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7RNArrayIP20R3MeshSearchTreeFaceEixEi(ptr noundef nonnull align 8 dereferenceable(16) %78, i32 noundef %.085)
  %121 = load ptr, ptr %120, align 8, !tbaa !14
  %122 = getelementptr inbounds i8, ptr %121, i64 16
  %123 = load i32, ptr %122, align 8, !tbaa !22
  %124 = add nsw i32 %123, -1
  store i32 %124, ptr %122, align 8, !tbaa !22
  %125 = add nuw nsw i32 %.085, 1
  %126 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %78)
  %127 = icmp slt i32 %125, %126
  br i1 %127, label %.lr.ph86, label %._crit_edge, !llvm.loop !26

128:                                              ; preds = %57, %81, %._crit_edge, %74, %40, %54, %5
  ret void

129:                                              ; preds = %104, %106, %38, %55
  %.pn81.pn = phi { ptr, i32 } [ %56, %55 ], [ %39, %38 ], [ %107, %106 ], [ %105, %104 ]
  resume { ptr, i32 } %.pn81.pn
}

declare noundef nonnull align 8 dereferenceable(56) ptr @_ZNK6R3Mesh8FaceBBoxEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #3

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

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

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

; 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 #5 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 #6 align 2

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

declare noundef double @_ZNK5R3Box14DiagonalLengthEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3

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

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

declare noundef i32 @_ZNK5R3Box11LongestAxisEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5R3Box10AxisCenterEi(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) local_unnamed_addr #6 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 #1 align 2

declare void @_ZN8RNVArray5EmptyEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3

attributes #0 = { nobuiltin allocsize(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 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 #2 = { nobuiltin 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 #3 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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, !7, i64 0}
!6 = !{!"_ZTS16R3MeshSearchTree", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"_ZTS20R3MeshSearchTreeFace", !7, i64 0, !13, i64 8, !10, i64 16, !10, i64 20}
!13 = !{!"double", !8, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !10, i64 32}
!16 = !{!"_ZTS20R3MeshSearchTreeNode", !7, i64 0, !8, i64 8, !13, i64 24, !10, i64 32, !17, i64 40, !17, i64 56}
!17 = !{!"_ZTS7RNArrayIP20R3MeshSearchTreeFaceE", !18, i64 0}
!18 = !{!"_ZTS8RNVArray", !7, i64 0, !10, i64 8, !10, i64 12}
!19 = !{!16, !13, i64 24}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !13, i64 8}
!22 = !{!12, !10, i64 16}
!23 = !{!6, !10, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass