; LLVM IR from erincatto/box2d :: src (dynamic_tree)

; 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"

%struct.b2TreeStats = type { i32, i32 }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2Vec2 = type { float, float }
%struct.b2ShapeCastInput = type { %struct.b2ShapeProxy, %struct.b2Vec2, float, i8 }
%struct.b2ShapeProxy = type { [8 x %struct.b2Vec2], i32, float }
%struct.b2DynamicTree = type { ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32 }
%struct.b2TreeNode = type { %struct.b2AABB, i64, %union.anon, %union.anon.0, i16, i16 }
%union.anon = type { i64 }
%union.anon.0 = type { i32 }
%struct.anon = type { i32, i32 }

@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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

declare i32 @b2InternalAssertFcn(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @b2IsLeaf(ptr noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @b2AABB_Overlaps(<2 x float>, <2 x float>, <2 x float>, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2CrossSV(float noundef, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Abs(<2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Min(<2 x float>, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Max(<2 x float>, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2AABB_Center(<2 x float>, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2AABB_Extents(<2 x float>, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @b2AbsFloat(float noundef) #7

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @b2Dot(<2 x float>, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Sub(<2 x float>, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @b2DistanceSquared(<2 x float>, <2 x float>) #6

; Function Attrs: nounwind uwtable
define dso_local i64 @b2DynamicTree_ShapeCast(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) #8 {
  %6 = alloca %struct.b2TreeStats, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct.b2AABB, align 4
  %13 = alloca i32, align 4
  %14 = alloca %struct.b2Vec2, align 4
  %15 = alloca %struct.b2Vec2, align 4
  %16 = alloca %struct.b2Vec2, align 4
  %17 = alloca %struct.b2Vec2, align 4
  %18 = alloca %struct.b2Vec2, align 4
  %19 = alloca %struct.b2Vec2, align 4
  %20 = alloca %struct.b2Vec2, align 4
  %21 = alloca %struct.b2Vec2, align 4
  %22 = alloca %struct.b2Vec2, align 4
  %23 = alloca %struct.b2Vec2, align 4
  %24 = alloca float, align 4
  %25 = alloca %struct.b2Vec2, align 4
  %26 = alloca %struct.b2AABB, align 4
  %27 = alloca %struct.b2Vec2, align 4
  %28 = alloca %struct.b2Vec2, align 4
  %29 = alloca %struct.b2ShapeCastInput, align 4
  %30 = alloca ptr, align 8
  %31 = alloca [1024 x i32], align 16
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca ptr, align 8
  %36 = alloca %struct.b2Vec2, align 4
  %37 = alloca %struct.b2Vec2, align 4
  %38 = alloca %struct.b2Vec2, align 4
  %39 = alloca float, align 4
  %40 = alloca %struct.b2Vec2, align 4
  %41 = alloca float, align 4
  %42 = alloca float, align 4
  %43 = alloca %struct.b2Vec2, align 4
  %44 = alloca %struct.b2Vec2, align 4
  %45 = alloca %struct.b2Vec2, align 4
  %46 = alloca %struct.b2Vec2, align 4
  %47 = alloca %struct.b2Vec2, align 4
  %48 = alloca %struct.b2Vec2, align 4
  %49 = alloca %struct.b2Vec2, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %6, i8 0, i64 8, i1 false)
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.b2DynamicTree, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 4, !tbaa !11
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %60, label %54

54:                                               ; preds = %5
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %struct.b2ShapeProxy, ptr %56, i32 0, i32 1
  %58 = load i32, ptr %57, align 4, !tbaa !14
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %54, %5
  br label %407

61:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #9
  %62 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds %struct.b2ShapeProxy, ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %65, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %62, ptr align 4 %66, i64 8, i1 false), !tbaa.struct !20
  %67 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds %struct.b2ShapeProxy, ptr %69, i32 0, i32 0
  %71 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %70, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %67, ptr align 4 %71, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 1, ptr %13, align 4, !tbaa !22
  br label %72

72:                                               ; preds = %103, %61
  %73 = load i32, ptr %13, align 4, !tbaa !22
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct.b2ShapeProxy, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !14
  %78 = icmp slt i32 %73, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %106

80:                                               ; preds = %72
  %81 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %82 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds %struct.b2ShapeProxy, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %13, align 4, !tbaa !22
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %85, i64 0, i64 %87
  %89 = load <2 x float>, ptr %82, align 4
  %90 = load <2 x float>, ptr %88, align 4
  %91 = call <2 x float> @b2Min(<2 x float> %89, <2 x float> %90)
  store <2 x float> %91, ptr %14, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %81, ptr align 4 %14, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  %92 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %93 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %94, i32 0, i32 0
  %96 = getelementptr inbounds %struct.b2ShapeProxy, ptr %95, i32 0, i32 0
  %97 = load i32, ptr %13, align 4, !tbaa !22
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %96, i64 0, i64 %98
  %100 = load <2 x float>, ptr %93, align 4
  %101 = load <2 x float>, ptr %99, align 4
  %102 = call <2 x float> @b2Max(<2 x float> %100, <2 x float> %101)
  store <2 x float> %102, ptr %15, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %92, ptr align 4 %15, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  br label %103

103:                                              ; preds = %80
  %104 = load i32, ptr %13, align 4, !tbaa !22
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %13, align 4, !tbaa !22
  br label %72, !llvm.loop !23

106:                                              ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %107 = getelementptr inbounds %struct.b2Vec2, ptr %16, i32 0, i32 0
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %108, i32 0, i32 0
  %110 = getelementptr inbounds %struct.b2ShapeProxy, ptr %109, i32 0, i32 2
  %111 = load float, ptr %110, align 4, !tbaa !25
  store float %111, ptr %107, align 4, !tbaa !26
  %112 = getelementptr inbounds %struct.b2Vec2, ptr %16, i32 0, i32 1
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds %struct.b2ShapeProxy, ptr %114, i32 0, i32 2
  %116 = load float, ptr %115, align 4, !tbaa !25
  store float %116, ptr %112, align 4, !tbaa !27
  %117 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %118 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  %119 = load <2 x float>, ptr %118, align 4
  %120 = load <2 x float>, ptr %16, align 4
  %121 = call <2 x float> @b2Sub(<2 x float> %119, <2 x float> %120)
  store <2 x float> %121, ptr %17, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %117, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  %122 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %123 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  %124 = load <2 x float>, ptr %123, align 4
  %125 = load <2 x float>, ptr %16, align 4
  %126 = call <2 x float> @b2Add(<2 x float> %124, <2 x float> %125)
  store <2 x float> %126, ptr %18, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %122, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  %127 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 0
  %128 = load <2 x float>, ptr %127, align 4
  %129 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 1
  %130 = load <2 x float>, ptr %129, align 4
  %131 = call <2 x float> @b2AABB_Center(<2 x float> %128, <2 x float> %130)
  store <2 x float> %131, ptr %19, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  %132 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 0
  %133 = load <2 x float>, ptr %132, align 4
  %134 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 1
  %135 = load <2 x float>, ptr %134, align 4
  %136 = call <2 x float> @b2AABB_Extents(<2 x float> %133, <2 x float> %135)
  store <2 x float> %136, ptr %20, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #9
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %137, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %138, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #9
  %139 = load <2 x float>, ptr %21, align 4
  %140 = call <2 x float> @b2CrossSV(float noundef 1.000000e+00, <2 x float> %139)
  store <2 x float> %140, ptr %22, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #9
  %141 = load <2 x float>, ptr %22, align 4
  %142 = call <2 x float> @b2Abs(<2 x float> %141)
  store <2 x float> %142, ptr %23, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  %143 = load ptr, ptr %8, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %143, i32 0, i32 2
  %145 = load float, ptr %144, align 4, !tbaa !28
  store float %145, ptr %24, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #9
  %146 = load float, ptr %24, align 4, !tbaa !21
  %147 = load ptr, ptr %8, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %147, i32 0, i32 1
  %149 = load <2 x float>, ptr %148, align 4
  %150 = call <2 x float> @b2MulSV(float noundef %146, <2 x float> %149)
  store <2 x float> %150, ptr %25, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %26) #9
  %151 = getelementptr inbounds %struct.b2AABB, ptr %26, i32 0, i32 0
  %152 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  %153 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  %154 = load <2 x float>, ptr %153, align 4
  %155 = load <2 x float>, ptr %25, align 4
  %156 = call <2 x float> @b2Add(<2 x float> %154, <2 x float> %155)
  store <2 x float> %156, ptr %27, align 4
  %157 = load <2 x float>, ptr %152, align 4
  %158 = load <2 x float>, ptr %27, align 4
  %159 = call <2 x float> @b2Min(<2 x float> %157, <2 x float> %158)
  store <2 x float> %159, ptr %151, align 4
  %160 = getelementptr inbounds %struct.b2AABB, ptr %26, i32 0, i32 1
  %161 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  %162 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  %163 = load <2 x float>, ptr %162, align 4
  %164 = load <2 x float>, ptr %25, align 4
  %165 = call <2 x float> @b2Add(<2 x float> %163, <2 x float> %164)
  store <2 x float> %165, ptr %28, align 4
  %166 = load <2 x float>, ptr %161, align 4
  %167 = load <2 x float>, ptr %28, align 4
  %168 = call <2 x float> @b2Max(<2 x float> %166, <2 x float> %167)
  store <2 x float> %168, ptr %160, align 4
  call void @llvm.lifetime.start.p0(i64 88, ptr %29) #9
  %169 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %169, i64 88, i1 false), !tbaa.struct !29
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #9
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.b2DynamicTree, ptr %170, i32 0, i32 0
  %172 = load ptr, ptr %171, align 8, !tbaa !32
  store ptr %172, ptr %30, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4096, ptr %31) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #9
  store i32 0, ptr %32, align 4, !tbaa !22
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.b2DynamicTree, ptr %173, i32 0, i32 1
  %175 = load i32, ptr %174, align 8, !tbaa !33
  %176 = load i32, ptr %32, align 4, !tbaa !22
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %32, align 4, !tbaa !22
  %178 = sext i32 %176 to i64
  %179 = getelementptr inbounds [1024 x i32], ptr %31, i64 0, i64 %178
  store i32 %175, ptr %179, align 4, !tbaa !22
  br label %180

180:                                              ; preds = %404, %402, %106
  %181 = load i32, ptr %32, align 4, !tbaa !22
  %182 = icmp sgt i32 %181, 0
  br i1 %182, label %183, label %405

183:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #9
  %184 = load i32, ptr %32, align 4, !tbaa !22
  %185 = add nsw i32 %184, -1
  store i32 %185, ptr %32, align 4, !tbaa !22
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [1024 x i32], ptr %31, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !22
  store i32 %188, ptr %33, align 4, !tbaa !22
  %189 = load i32, ptr %33, align 4, !tbaa !22
  %190 = icmp eq i32 %189, -1
  br i1 %190, label %191, label %199

191:                                              ; preds = %183
  br label %192

192:                                              ; preds = %191
  %193 = call i32 @b2InternalAssertFcn(ptr noundef @.str.17, ptr noundef @.str.1, i32 noundef 1347)
  %194 = icmp ne i32 %193, 0
  br i1 %194, label %195, label %196

195:                                              ; preds = %192
  call void @llvm.trap()
  br label %196

196:                                              ; preds = %195, %192
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197
  store i32 5, ptr %34, align 4
  br label %402, !llvm.loop !34

199:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #9
  %200 = load ptr, ptr %30, align 8, !tbaa !5
  %201 = load i32, ptr %33, align 4, !tbaa !22
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds %struct.b2TreeNode, ptr %200, i64 %202
  store ptr %203, ptr %35, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.b2TreeStats, ptr %6, i32 0, i32 0
  %205 = load i32, ptr %204, align 4, !tbaa !35
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %204, align 4, !tbaa !35
  %207 = load ptr, ptr %35, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.b2TreeNode, ptr %207, i32 0, i32 1
  %209 = load i64, ptr %208, align 8, !tbaa !37
  %210 = load i64, ptr %9, align 8, !tbaa !9
  %211 = and i64 %209, %210
  %212 = icmp eq i64 %211, 0
  br i1 %212, label %227, label %213

213:                                              ; preds = %199
  %214 = load ptr, ptr %35, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.b2TreeNode, ptr %214, i32 0, i32 0
  %216 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %215, i32 0, i32 0
  %217 = load <2 x float>, ptr %216, align 8
  %218 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %215, i32 0, i32 1
  %219 = load <2 x float>, ptr %218, align 8
  %220 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %26, i32 0, i32 0
  %221 = load <2 x float>, ptr %220, align 4
  %222 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %26, i32 0, i32 1
  %223 = load <2 x float>, ptr %222, align 4
  %224 = call zeroext i1 @b2AABB_Overlaps(<2 x float> %217, <2 x float> %219, <2 x float> %221, <2 x float> %223)
  %225 = zext i1 %224 to i32
  %226 = icmp eq i32 %225, 0
  br i1 %226, label %227, label %228

227:                                              ; preds = %213, %199
  store i32 5, ptr %34, align 4
  br label %401, !llvm.loop !34

228:                                              ; preds = %213
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #9
  %229 = load ptr, ptr %35, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.b2TreeNode, ptr %229, i32 0, i32 0
  %231 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %230, i32 0, i32 0
  %232 = load <2 x float>, ptr %231, align 8
  %233 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %230, i32 0, i32 1
  %234 = load <2 x float>, ptr %233, align 8
  %235 = call <2 x float> @b2AABB_Center(<2 x float> %232, <2 x float> %234)
  store <2 x float> %235, ptr %36, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #9
  %236 = load ptr, ptr %35, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.b2TreeNode, ptr %236, i32 0, i32 0
  %238 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %237, i32 0, i32 0
  %239 = load <2 x float>, ptr %238, align 8
  %240 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %237, i32 0, i32 1
  %241 = load <2 x float>, ptr %240, align 8
  %242 = call <2 x float> @b2AABB_Extents(<2 x float> %239, <2 x float> %241)
  store <2 x float> %242, ptr %38, align 4
  %243 = load <2 x float>, ptr %38, align 4
  %244 = load <2 x float>, ptr %20, align 4
  %245 = call <2 x float> @b2Add(<2 x float> %243, <2 x float> %244)
  store <2 x float> %245, ptr %37, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #9
  %246 = load <2 x float>, ptr %19, align 4
  %247 = load <2 x float>, ptr %36, align 4
  %248 = call <2 x float> @b2Sub(<2 x float> %246, <2 x float> %247)
  store <2 x float> %248, ptr %40, align 4
  %249 = load <2 x float>, ptr %22, align 4
  %250 = load <2 x float>, ptr %40, align 4
  %251 = call float @b2Dot(<2 x float> %249, <2 x float> %250)
  %252 = call float @b2AbsFloat(float noundef %251)
  store float %252, ptr %39, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #9
  %253 = load <2 x float>, ptr %23, align 4
  %254 = load <2 x float>, ptr %37, align 4
  %255 = call float @b2Dot(<2 x float> %253, <2 x float> %254)
  store float %255, ptr %41, align 4, !tbaa !21
  %256 = load float, ptr %41, align 4, !tbaa !21
  %257 = load float, ptr %39, align 4, !tbaa !21
  %258 = fcmp olt float %256, %257
  br i1 %258, label %259, label %260

259:                                              ; preds = %228
  store i32 5, ptr %34, align 4
  br label %400, !llvm.loop !34

260:                                              ; preds = %228
  %261 = load ptr, ptr %35, align 8, !tbaa !5
  %262 = call zeroext i1 @b2IsLeaf(ptr noundef %261)
  br i1 %262, label %263, label %315

263:                                              ; preds = %260
  %264 = load float, ptr %24, align 4, !tbaa !21
  %265 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %29, i32 0, i32 2
  store float %264, ptr %265, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %42) #9
  %266 = load ptr, ptr %10, align 8, !tbaa !5
  %267 = load i32, ptr %33, align 4, !tbaa !22
  %268 = load ptr, ptr %35, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.b2TreeNode, ptr %268, i32 0, i32 2
  %270 = load i64, ptr %269, align 8, !tbaa !30
  %271 = load ptr, ptr %11, align 8, !tbaa !5
  %272 = call float %266(ptr noundef %29, i32 noundef %267, i64 noundef %270, ptr noundef %271)
  store float %272, ptr %42, align 4, !tbaa !21
  %273 = getelementptr inbounds %struct.b2TreeStats, ptr %6, i32 0, i32 1
  %274 = load i32, ptr %273, align 4, !tbaa !41
  %275 = add nsw i32 %274, 1
  store i32 %275, ptr %273, align 4, !tbaa !41
  %276 = load float, ptr %42, align 4, !tbaa !21
  %277 = fcmp oeq float %276, 0.000000e+00
  br i1 %277, label %278, label %279

278:                                              ; preds = %263
  store i32 1, ptr %34, align 4
  br label %312

279:                                              ; preds = %263
  %280 = load float, ptr %42, align 4, !tbaa !21
  %281 = fcmp olt float 0.000000e+00, %280
  br i1 %281, label %282, label %311

282:                                              ; preds = %279
  %283 = load float, ptr %42, align 4, !tbaa !21
  %284 = load float, ptr %24, align 4, !tbaa !21
  %285 = fcmp olt float %283, %284
  br i1 %285, label %286, label %311

286:                                              ; preds = %282
  %287 = load float, ptr %42, align 4, !tbaa !21
  store float %287, ptr %24, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %43) #9
  %288 = load float, ptr %24, align 4, !tbaa !21
  %289 = load ptr, ptr %8, align 8, !tbaa !5
  %290 = getelementptr inbounds %struct.b2ShapeCastInput, ptr %289, i32 0, i32 1
  %291 = load <2 x float>, ptr %290, align 4
  %292 = call <2 x float> @b2MulSV(float noundef %288, <2 x float> %291)
  store <2 x float> %292, ptr %43, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %43, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %43) #9
  %293 = getelementptr inbounds %struct.b2AABB, ptr %26, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %44) #9
  %294 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  %295 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 0
  %296 = load <2 x float>, ptr %295, align 4
  %297 = load <2 x float>, ptr %25, align 4
  %298 = call <2 x float> @b2Add(<2 x float> %296, <2 x float> %297)
  store <2 x float> %298, ptr %45, align 4
  %299 = load <2 x float>, ptr %294, align 4
  %300 = load <2 x float>, ptr %45, align 4
  %301 = call <2 x float> @b2Min(<2 x float> %299, <2 x float> %300)
  store <2 x float> %301, ptr %44, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %293, ptr align 4 %44, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #9
  %302 = getelementptr inbounds %struct.b2AABB, ptr %26, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %46) #9
  %303 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  %304 = getelementptr inbounds %struct.b2AABB, ptr %12, i32 0, i32 1
  %305 = load <2 x float>, ptr %304, align 4
  %306 = load <2 x float>, ptr %25, align 4
  %307 = call <2 x float> @b2Add(<2 x float> %305, <2 x float> %306)
  store <2 x float> %307, ptr %47, align 4
  %308 = load <2 x float>, ptr %303, align 4
  %309 = load <2 x float>, ptr %47, align 4
  %310 = call <2 x float> @b2Max(<2 x float> %308, <2 x float> %309)
  store <2 x float> %310, ptr %46, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %302, ptr align 4 %46, i64 8, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %46) #9
  br label %311

311:                                              ; preds = %286, %282, %279
  store i32 0, ptr %34, align 4
  br label %312

312:                                              ; preds = %311, %278
  call void @llvm.lifetime.end.p0(i64 4, ptr %42) #9
  %313 = load i32, ptr %34, align 4
  switch i32 %313, label %400 [
    i32 0, label %314
  ]

314:                                              ; preds = %312
  br label %399

315:                                              ; preds = %260
  %316 = load i32, ptr %32, align 4, !tbaa !22
  %317 = icmp slt i32 %316, 1023
  br i1 %317, label %318, label %387

318:                                              ; preds = %315
  call void @llvm.lifetime.start.p0(i64 8, ptr %48) #9
  %319 = load ptr, ptr %30, align 8, !tbaa !5
  %320 = load ptr, ptr %35, align 8, !tbaa !5
  %321 = getelementptr inbounds %struct.b2TreeNode, ptr %320, i32 0, i32 2
  %322 = getelementptr inbounds %struct.anon, ptr %321, i32 0, i32 0
  %323 = load i32, ptr %322, align 8, !tbaa !30
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds %struct.b2TreeNode, ptr %319, i64 %324
  %326 = getelementptr inbounds %struct.b2TreeNode, ptr %325, i32 0, i32 0
  %327 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %326, i32 0, i32 0
  %328 = load <2 x float>, ptr %327, align 8
  %329 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %326, i32 0, i32 1
  %330 = load <2 x float>, ptr %329, align 8
  %331 = call <2 x float> @b2AABB_Center(<2 x float> %328, <2 x float> %330)
  store <2 x float> %331, ptr %48, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %49) #9
  %332 = load ptr, ptr %30, align 8, !tbaa !5
  %333 = load ptr, ptr %35, align 8, !tbaa !5
  %334 = getelementptr inbounds %struct.b2TreeNode, ptr %333, i32 0, i32 2
  %335 = getelementptr inbounds %struct.anon, ptr %334, i32 0, i32 1
  %336 = load i32, ptr %335, align 4, !tbaa !30
  %337 = sext i32 %336 to i64
  %338 = getelementptr inbounds %struct.b2TreeNode, ptr %332, i64 %337
  %339 = getelementptr inbounds %struct.b2TreeNode, ptr %338, i32 0, i32 0
  %340 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %339, i32 0, i32 0
  %341 = load <2 x float>, ptr %340, align 8
  %342 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %339, i32 0, i32 1
  %343 = load <2 x float>, ptr %342, align 8
  %344 = call <2 x float> @b2AABB_Center(<2 x float> %341, <2 x float> %343)
  store <2 x float> %344, ptr %49, align 4
  %345 = load <2 x float>, ptr %48, align 4
  %346 = load <2 x float>, ptr %19, align 4
  %347 = call float @b2DistanceSquared(<2 x float> %345, <2 x float> %346)
  %348 = load <2 x float>, ptr %49, align 4
  %349 = load <2 x float>, ptr %19, align 4
  %350 = call float @b2DistanceSquared(<2 x float> %348, <2 x float> %349)
  %351 = fcmp olt float %347, %350
  br i1 %351, label %352, label %369

352:                                              ; preds = %318
  %353 = load ptr, ptr %35, align 8, !tbaa !5
  %354 = getelementptr inbounds %struct.b2TreeNode, ptr %353, i32 0, i32 2
  %355 = getelementptr inbounds %struct.anon, ptr %354, i32 0, i32 1
  %356 = load i32, ptr %355, align 4, !tbaa !30
  %357 = load i32, ptr %32, align 4, !tbaa !22
  %358 = add nsw i32 %357, 1
  store i32 %358, ptr %32, align 4, !tbaa !22
  %359 = sext i32 %357 to i64
  %360 = getelementptr inbounds [1024 x i32], ptr %31, i64 0, i64 %359
  store i32 %356, ptr %360, align 4, !tbaa !22
  %361 = load ptr, ptr %35, align 8, !tbaa !5
  %362 = getelementptr inbounds %struct.b2TreeNode, ptr %361, i32 0, i32 2
  %363 = getelementptr inbounds %struct.anon, ptr %362, i32 0, i32 0
  %364 = load i32, ptr %363, align 8, !tbaa !30
  %365 = load i32, ptr %32, align 4, !tbaa !22
  %366 = add nsw i32 %365, 1
  store i32 %366, ptr %32, align 4, !tbaa !22
  %367 = sext i32 %365 to i64
  %368 = getelementptr inbounds [1024 x i32], ptr %31, i64 0, i64 %367
  store i32 %364, ptr %368, align 4, !tbaa !22
  br label %386

369:                                              ; preds = %318
  %370 = load ptr, ptr %35, align 8, !tbaa !5
  %371 = getelementptr inbounds %struct.b2TreeNode, ptr %370, i32 0, i32 2
  %372 = getelementptr inbounds %struct.anon, ptr %371, i32 0, i32 0
  %373 = load i32, ptr %372, align 8, !tbaa !30
  %374 = load i32, ptr %32, align 4, !tbaa !22
  %375 = add nsw i32 %374, 1
  store i32 %375, ptr %32, align 4, !tbaa !22
  %376 = sext i32 %374 to i64
  %377 = getelementptr inbounds [1024 x i32], ptr %31, i64 0, i64 %376
  store i32 %373, ptr %377, align 4, !tbaa !22
  %378 = load ptr, ptr %35, align 8, !tbaa !5
  %379 = getelementptr inbounds %struct.b2TreeNode, ptr %378, i32 0, i32 2
  %380 = getelementptr inbounds %struct.anon, ptr %379, i32 0, i32 1
  %381 = load i32, ptr %380, align 4, !tbaa !30
  %382 = load i32, ptr %32, align 4, !tbaa !22
  %383 = add nsw i32 %382, 1
  store i32 %383, ptr %32, align 4, !tbaa !22
  %384 = sext i32 %382 to i64
  %385 = getelementptr inbounds [1024 x i32], ptr %31, i64 0, i64 %384
  store i32 %381, ptr %385, align 4, !tbaa !22
  br label %386

386:                                              ; preds = %369, %352
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %48) #9
  br label %398

387:                                              ; preds = %315
  br label %388

388:                                              ; preds = %387
  %389 = load i32, ptr %32, align 4, !tbaa !22
  %390 = icmp slt i32 %389, 1023
  br i1 %390, label %395, label %391

391:                                              ; preds = %388
  %392 = call i32 @b2InternalAssertFcn(ptr noundef @.str.18, ptr noundef @.str.1, i32 noundef 1412)
  %393 = icmp ne i32 %392, 0
  br i1 %393, label %394, label %395

394:                                              ; preds = %391
  call void @llvm.trap()
  br label %395

395:                                              ; preds = %394, %391, %388
  br label %396

396:                                              ; preds = %395
  br label %397

397:                                              ; preds = %396
  br label %398

398:                                              ; preds = %397, %386
  br label %399

399:                                              ; preds = %398, %314
  store i32 0, ptr %34, align 4
  br label %400

400:                                              ; preds = %399, %312, %259
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #9
  br label %401

401:                                              ; preds = %400, %227
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #9
  br label %402

402:                                              ; preds = %401, %198
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #9
  %403 = load i32, ptr %34, align 4
  switch i32 %403, label %406 [
    i32 0, label %404
    i32 5, label %180
  ]

404:                                              ; preds = %402
  br label %180, !llvm.loop !34

405:                                              ; preds = %180
  store i32 1, ptr %34, align 4
  br label %406

406:                                              ; preds = %405, %402
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #9
  call void @llvm.lifetime.end.p0(i64 4096, ptr %31) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr %29) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #9
  br label %407

407:                                              ; preds = %406, %60
  %408 = load i64, ptr %6, align 4
  ret i64 %408
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Add(<2 x float>, <2 x float>) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2MulSV(float noundef, <2 x float>) #6

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 nounwind uwtable "min-legal-vector-width"="64" "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 = { inlinehint 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 #8 = { nounwind uwtable "min-legal-vector-width"="64" "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 #9 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 12}
!12 = !{!"b2DynamicTree", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !13, i64 64}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 64}
!15 = !{!"b2ShapeCastInput", !16, i64 0, !18, i64 72, !17, i64 80, !19, i64 84}
!16 = !{!"b2ShapeProxy", !7, i64 0, !13, i64 64, !17, i64 68}
!17 = !{!"float", !7, i64 0}
!18 = !{!"b2Vec2", !17, i64 0, !17, i64 4}
!19 = !{!"_Bool", !7, i64 0}
!20 = !{i64 0, i64 4, !21, i64 4, i64 4, !21}
!21 = !{!17, !17, i64 0}
!22 = !{!13, !13, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!15, !17, i64 68}
!26 = !{!18, !17, i64 0}
!27 = !{!18, !17, i64 4}
!28 = !{!15, !17, i64 80}
!29 = !{i64 0, i64 64, !30, i64 64, i64 4, !22, i64 68, i64 4, !21, i64 72, i64 4, !21, i64 76, i64 4, !21, i64 80, i64 4, !21, i64 84, i64 1, !31}
!30 = !{!7, !7, i64 0}
!31 = !{!19, !19, i64 0}
!32 = !{!12, !6, i64 0}
!33 = !{!12, !13, i64 8}
!34 = distinct !{!34, !24}
!35 = !{!36, !13, i64 0}
!36 = !{!"b2TreeStats", !13, i64 0, !13, i64 4}
!37 = !{!38, !10, i64 16}
!38 = !{!"b2TreeNode", !39, i64 0, !10, i64 16, !7, i64 24, !7, i64 32, !40, i64 36, !40, i64 38}
!39 = !{!"b2AABB", !18, i64 0, !18, i64 8}
!40 = !{!"short", !7, i64 0}
!41 = !{!36, !13, i64 4}


; 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"

%struct.b2ShapeCastInput = type { %struct.b2ShapeProxy, %struct.b2Vec2, float, i8 }
%struct.b2ShapeProxy = type { [8 x %struct.b2Vec2], i32, float }
%struct.b2Vec2 = type { float, float }
%struct.b2TreeNode = type { %struct.b2AABB, i64, %union.anon, %union.anon.0, i16, i16 }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%union.anon = type { i64 }
%union.anon.0 = type { i32 }

@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [36 x i8], align 1

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

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

declare i32 @b2InternalAssertFcn(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @b2IsLeaf(ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @b2AABB_Overlaps(<2 x float>, <2 x float>, <2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2CrossSV(float noundef, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Abs(<2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Min(<2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Max(<2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2AABB_Center(<2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2AABB_Extents(<2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @b2AbsFloat(float noundef) local_unnamed_addr #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @b2Dot(<2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Sub(<2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @b2DistanceSquared(<2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
define dso_local i64 @b2DynamicTree_ShapeCast(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i64 noundef %2, ptr nocapture noundef readonly %3, ptr noundef %4) local_unnamed_addr #7 {
  %6 = alloca %struct.b2ShapeCastInput, align 4
  %7 = alloca [1024 x i32], align 16
  %8 = getelementptr inbounds i8, ptr %0, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %131, label %11

11:                                               ; preds = %5
  %12 = getelementptr inbounds i8, ptr %1, i64 64
  %13 = load i32, ptr %12, align 4, !tbaa !11
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %131, label %15

15:                                               ; preds = %11
  %.sroa.074.0.copyload = load <2 x float>, ptr %1, align 4
  %16 = icmp sgt i32 %13, 1
  br i1 %16, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %15
  %.sroa.074.0.lcssa = phi <2 x float> [ %.sroa.074.0.copyload, %15 ], [ %40, %.lr.ph ]
  %.sroa.13.0.lcssa = phi <2 x float> [ %.sroa.074.0.copyload, %15 ], [ %42, %.lr.ph ]
  %17 = getelementptr inbounds i8, ptr %1, i64 68
  %18 = load float, ptr %17, align 4, !tbaa !17
  %.sroa.065.0.vec.insert = insertelement <2 x float> poison, float %18, i64 0
  %.sroa.065.4.vec.insert = shufflevector <2 x float> %.sroa.065.0.vec.insert, <2 x float> poison, <2 x i32> zeroinitializer
  %19 = tail call <2 x float> @b2Sub(<2 x float> %.sroa.074.0.lcssa, <2 x float> %.sroa.065.4.vec.insert)
  %20 = tail call <2 x float> @b2Add(<2 x float> %.sroa.13.0.lcssa, <2 x float> %.sroa.065.4.vec.insert)
  %21 = tail call <2 x float> @b2AABB_Center(<2 x float> %19, <2 x float> %20)
  %22 = tail call <2 x float> @b2AABB_Extents(<2 x float> %19, <2 x float> %20)
  %23 = getelementptr inbounds i8, ptr %1, i64 72
  %.sroa.058.0.copyload = load <2 x float>, ptr %23, align 4
  %24 = tail call <2 x float> @b2CrossSV(float noundef 1.000000e+00, <2 x float> %.sroa.058.0.copyload)
  %25 = tail call <2 x float> @b2Abs(<2 x float> %24)
  %26 = getelementptr inbounds i8, ptr %1, i64 80
  %27 = load float, ptr %26, align 4, !tbaa !18
  %28 = load <2 x float>, ptr %23, align 4
  %29 = tail call <2 x float> @b2MulSV(float noundef %27, <2 x float> %28)
  %30 = tail call <2 x float> @b2Add(<2 x float> %19, <2 x float> %29)
  %31 = tail call <2 x float> @b2Min(<2 x float> %19, <2 x float> %30)
  %32 = tail call <2 x float> @b2Add(<2 x float> %20, <2 x float> %29)
  %33 = tail call <2 x float> @b2Max(<2 x float> %20, <2 x float> %32)
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %6) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(88) %6, ptr noundef nonnull align 4 dereferenceable(88) %1, i64 88, i1 false), !tbaa.struct !19
  %34 = load ptr, ptr %0, align 8, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %7) #8
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  %36 = load i32, ptr %35, align 8, !tbaa !25
  store i32 %36, ptr %7, align 16, !tbaa !21
  %37 = getelementptr inbounds i8, ptr %6, i64 80
  br label %46

.lr.ph:                                           ; preds = %15, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %15 ]
  %.sroa.13.0143 = phi <2 x float> [ %42, %.lr.ph ], [ %.sroa.074.0.copyload, %15 ]
  %.sroa.074.0142 = phi <2 x float> [ %40, %.lr.ph ], [ %.sroa.074.0.copyload, %15 ]
  %38 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %1, i64 0, i64 %indvars.iv
  %39 = load <2 x float>, ptr %38, align 4
  %40 = tail call <2 x float> @b2Min(<2 x float> %.sroa.074.0142, <2 x float> %39)
  %41 = load <2 x float>, ptr %38, align 4
  %42 = tail call <2 x float> @b2Max(<2 x float> %.sroa.13.0143, <2 x float> %41)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = load i32, ptr %12, align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next, %44
  br i1 %45, label %.lr.ph, label %._crit_edge, !llvm.loop !26

46:                                               ; preds = %._crit_edge, %126
  %.sroa.0108.0150 = phi i32 [ 0, %._crit_edge ], [ %.sroa.0108.1, %126 ]
  %.sroa.4.0149 = phi i32 [ 0, %._crit_edge ], [ %.sroa.4.4, %126 ]
  %.0112148 = phi float [ %27, %._crit_edge ], [ %.6, %126 ]
  %.sroa.5.0147 = phi <2 x float> [ %33, %._crit_edge ], [ %.sroa.5.6, %126 ]
  %.sroa.046.0146 = phi <2 x float> [ %31, %._crit_edge ], [ %.sroa.046.6, %126 ]
  %.0113145 = phi i32 [ 1, %._crit_edge ], [ %.5118, %126 ]
  %47 = add nsw i32 %.0113145, -1
  %48 = zext nneg i32 %47 to i64
  %49 = getelementptr inbounds [1024 x i32], ptr %7, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !21
  %51 = icmp eq i32 %50, -1
  br i1 %51, label %52, label %55

52:                                               ; preds = %46
  %53 = call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.1, i32 noundef 1347) #8
  %.not126 = icmp eq i32 %53, 0
  br i1 %.not126, label %126, label %54, !llvm.loop !28

54:                                               ; preds = %52
  call void @llvm.trap()
  unreachable

55:                                               ; preds = %46
  %56 = sext i32 %50 to i64
  %57 = getelementptr inbounds %struct.b2TreeNode, ptr %34, i64 %56
  %58 = add nsw i32 %.sroa.0108.0150, 1
  %59 = getelementptr inbounds i8, ptr %57, i64 16
  %60 = load i64, ptr %59, align 8, !tbaa !29
  %61 = and i64 %60, %2
  %62 = icmp eq i64 %61, 0
  br i1 %62, label %126, label %63, !llvm.loop !28

63:                                               ; preds = %55
  %64 = load <2 x float>, ptr %57, align 8
  %65 = getelementptr inbounds i8, ptr %57, i64 8
  %66 = load <2 x float>, ptr %65, align 8
  %67 = call zeroext i1 @b2AABB_Overlaps(<2 x float> %64, <2 x float> %66, <2 x float> %.sroa.046.0146, <2 x float> %.sroa.5.0147)
  br i1 %67, label %68, label %126, !llvm.loop !28

68:                                               ; preds = %63
  %69 = load <2 x float>, ptr %57, align 8
  %70 = load <2 x float>, ptr %65, align 8
  %71 = call <2 x float> @b2AABB_Center(<2 x float> %69, <2 x float> %70)
  %72 = load <2 x float>, ptr %57, align 8
  %73 = load <2 x float>, ptr %65, align 8
  %74 = call <2 x float> @b2AABB_Extents(<2 x float> %72, <2 x float> %73)
  %75 = call <2 x float> @b2Add(<2 x float> %74, <2 x float> %22)
  %76 = call <2 x float> @b2Sub(<2 x float> %21, <2 x float> %71)
  %77 = call float @b2Dot(<2 x float> %24, <2 x float> %76)
  %78 = call float @b2AbsFloat(float noundef %77)
  %79 = call float @b2Dot(<2 x float> %25, <2 x float> %75)
  %80 = fcmp olt float %79, %78
  br i1 %80, label %126, label %81, !llvm.loop !28

81:                                               ; preds = %68
  %82 = call zeroext i1 @b2IsLeaf(ptr noundef nonnull %57)
  br i1 %82, label %83, label %99

83:                                               ; preds = %81
  store float %.0112148, ptr %37, align 4, !tbaa !18
  %84 = getelementptr inbounds i8, ptr %57, i64 24
  %85 = load i64, ptr %84, align 8, !tbaa !20
  %86 = call float %3(ptr noundef nonnull %6, i32 noundef %50, i64 noundef %85, ptr noundef %4) #8
  %87 = add nsw i32 %.sroa.4.0149, 1
  %88 = fcmp une float %86, 0.000000e+00
  br i1 %88, label %89, label %.thread133

89:                                               ; preds = %83
  %90 = fcmp ogt float %86, 0.000000e+00
  %91 = fcmp olt float %86, %.0112148
  %or.cond = select i1 %90, i1 %91, i1 false
  br i1 %or.cond, label %92, label %126

92:                                               ; preds = %89
  %93 = load <2 x float>, ptr %23, align 4
  %94 = call <2 x float> @b2MulSV(float noundef %86, <2 x float> %93)
  %95 = call <2 x float> @b2Add(<2 x float> %19, <2 x float> %94)
  %96 = call <2 x float> @b2Min(<2 x float> %19, <2 x float> %95)
  %97 = call <2 x float> @b2Add(<2 x float> %20, <2 x float> %94)
  %98 = call <2 x float> @b2Max(<2 x float> %20, <2 x float> %97)
  br label %126

99:                                               ; preds = %81
  %100 = icmp ult i32 %.0113145, 1024
  br i1 %100, label %101, label %123

101:                                              ; preds = %99
  %102 = getelementptr inbounds i8, ptr %57, i64 24
  %103 = load i32, ptr %102, align 8, !tbaa !20
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %struct.b2TreeNode, ptr %34, i64 %104
  %106 = load <2 x float>, ptr %105, align 8
  %107 = getelementptr inbounds i8, ptr %105, i64 8
  %108 = load <2 x float>, ptr %107, align 8
  %109 = call <2 x float> @b2AABB_Center(<2 x float> %106, <2 x float> %108)
  %110 = getelementptr inbounds i8, ptr %57, i64 28
  %111 = load i32, ptr %110, align 4, !tbaa !20
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %struct.b2TreeNode, ptr %34, i64 %112
  %114 = load <2 x float>, ptr %113, align 8
  %115 = getelementptr inbounds i8, ptr %113, i64 8
  %116 = load <2 x float>, ptr %115, align 8
  %117 = call <2 x float> @b2AABB_Center(<2 x float> %114, <2 x float> %116)
  %118 = call float @b2DistanceSquared(<2 x float> %109, <2 x float> %21)
  %119 = call float @b2DistanceSquared(<2 x float> %117, <2 x float> %21)
  %120 = fcmp olt float %118, %119
  %121 = zext nneg i32 %.0113145 to i64
  %122 = getelementptr inbounds [1024 x i32], ptr %7, i64 0, i64 %121
  %. = select i1 %120, ptr %110, ptr %102
  %.155 = select i1 %120, ptr %102, ptr %110
  %storemerge = load i32, ptr %., align 4, !tbaa !20
  store i32 %storemerge, ptr %49, align 4, !tbaa !21
  %.sink = load i32, ptr %.155, align 4, !tbaa !20
  store i32 %.sink, ptr %122, align 4, !tbaa !21
  %.1114 = add nuw nsw i32 %.0113145, 1
  br label %126

123:                                              ; preds = %99
  %124 = call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.1, i32 noundef 1412) #8
  %.not = icmp eq i32 %124, 0
  br i1 %.not, label %126, label %125

125:                                              ; preds = %123
  call void @llvm.trap()
  unreachable

126:                                              ; preds = %92, %89, %63, %55, %123, %101, %68, %52
  %.5118 = phi i32 [ %47, %52 ], [ %47, %63 ], [ %47, %55 ], [ %47, %68 ], [ %.1114, %101 ], [ %47, %123 ], [ %47, %89 ], [ %47, %92 ]
  %.sroa.046.6 = phi <2 x float> [ %.sroa.046.0146, %52 ], [ %.sroa.046.0146, %63 ], [ %.sroa.046.0146, %55 ], [ %.sroa.046.0146, %68 ], [ %.sroa.046.0146, %101 ], [ %.sroa.046.0146, %123 ], [ %.sroa.046.0146, %89 ], [ %96, %92 ]
  %.sroa.5.6 = phi <2 x float> [ %.sroa.5.0147, %52 ], [ %.sroa.5.0147, %63 ], [ %.sroa.5.0147, %55 ], [ %.sroa.5.0147, %68 ], [ %.sroa.5.0147, %101 ], [ %.sroa.5.0147, %123 ], [ %.sroa.5.0147, %89 ], [ %98, %92 ]
  %.6 = phi float [ %.0112148, %52 ], [ %.0112148, %63 ], [ %.0112148, %55 ], [ %.0112148, %68 ], [ %.0112148, %101 ], [ %.0112148, %123 ], [ %.0112148, %89 ], [ %86, %92 ]
  %.sroa.4.4 = phi i32 [ %.sroa.4.0149, %52 ], [ %.sroa.4.0149, %63 ], [ %.sroa.4.0149, %55 ], [ %.sroa.4.0149, %68 ], [ %.sroa.4.0149, %101 ], [ %.sroa.4.0149, %123 ], [ %87, %89 ], [ %87, %92 ]
  %.sroa.0108.1 = phi i32 [ %.sroa.0108.0150, %52 ], [ %58, %63 ], [ %58, %55 ], [ %58, %68 ], [ %58, %101 ], [ %58, %123 ], [ %58, %89 ], [ %58, %92 ]
  %127 = icmp sgt i32 %.5118, 0
  br i1 %127, label %46, label %.thread133

.thread133:                                       ; preds = %83, %126
  %.sroa.4.5 = phi i32 [ %.sroa.4.4, %126 ], [ %87, %83 ]
  %.sroa.0108.2 = phi i32 [ %.sroa.0108.1, %126 ], [ %58, %83 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %6) #8
  %128 = zext i32 %.sroa.4.5 to i64
  %129 = shl nuw i64 %128, 32
  %130 = zext i32 %.sroa.0108.2 to i64
  br label %131

131:                                              ; preds = %5, %11, %.thread133
  %.sroa.4.6 = phi i64 [ 0, %5 ], [ 0, %11 ], [ %129, %.thread133 ]
  %.sroa.0108.3 = phi i64 [ 0, %5 ], [ 0, %11 ], [ %130, %.thread133 ]
  %.sroa.0108.0.insert.insert = or disjoint i64 %.sroa.0108.3, %.sroa.4.6
  ret i64 %.sroa.0108.0.insert.insert
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2Add(<2 x float>, <2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2MulSV(float noundef, <2 x float>) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { inlinehint nounwind uwtable "min-legal-vector-width"="64" "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 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 #7 = { nounwind uwtable "min-legal-vector-width"="64" "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 }

!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, !10, i64 12}
!6 = !{!"b2DynamicTree", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !10, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !10, i64 64}
!12 = !{!"b2ShapeCastInput", !13, i64 0, !15, i64 72, !14, i64 80, !16, i64 84}
!13 = !{!"b2ShapeProxy", !8, i64 0, !10, i64 64, !14, i64 68}
!14 = !{!"float", !8, i64 0}
!15 = !{!"b2Vec2", !14, i64 0, !14, i64 4}
!16 = !{!"_Bool", !8, i64 0}
!17 = !{!12, !14, i64 68}
!18 = !{!12, !14, i64 80}
!19 = !{i64 0, i64 64, !20, i64 64, i64 4, !21, i64 68, i64 4, !22, i64 72, i64 4, !22, i64 76, i64 4, !22, i64 80, i64 4, !22, i64 84, i64 1, !23}
!20 = !{!8, !8, i64 0}
!21 = !{!10, !10, i64 0}
!22 = !{!14, !14, i64 0}
!23 = !{!16, !16, i64 0}
!24 = !{!6, !7, i64 0}
!25 = !{!6, !10, i64 8}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = distinct !{!28, !27}
!29 = !{!30, !32, i64 16}
!30 = !{!"b2TreeNode", !31, i64 0, !32, i64 16, !8, i64 24, !8, i64 32, !33, i64 36, !33, i64 38}
!31 = !{!"b2AABB", !15, i64 0, !15, i64 8}
!32 = !{!"long", !8, i64 0}
!33 = !{!"short", !8, i64 0}


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