; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Collision/BroadPhase (QuadTree)

; 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.JPH::Vec3" = type { %union.anon.1 }
%union.anon.1 = type { <4 x float> }
%"struct.JPH::AssertLastParam" = type { i8 }
%"class.JPH::QuadTree::NodeID" = type { i32 }

@.str.1 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1

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

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

; 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) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Vec310sReplicateEf(float noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH8QuadTree10sPartitionEPNS0_6NodeIDEPNS_4Vec3EiRi(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #4 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %"class.JPH::Vec3", align 16
  %10 = alloca %"class.JPH::Vec3", align 16
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.JPH::Vec3", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca %"class.JPH::Vec3", align 16
  %16 = alloca %"class.JPH::Vec3", align 16
  %17 = alloca %"class.JPH::Vec3", align 16
  %18 = alloca %"class.JPH::Vec3", align 16
  %19 = alloca %"class.JPH::Vec3", align 16
  %20 = alloca i32, align 4
  %21 = alloca %"class.JPH::Vec3", align 16
  %22 = alloca %"class.JPH::Vec3", align 16
  %23 = alloca float, align 4
  %24 = alloca %"class.JPH::Vec3", align 16
  %25 = alloca %"class.JPH::Vec3", align 16
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca %"struct.JPH::AssertLastParam", align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = icmp sle i32 %29, 4
  br i1 %30, label %31, label %35

31:                                               ; preds = %4
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = sdiv i32 %32, 2
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %33, ptr %34, align 4, !tbaa !9
  br label %219

35:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #7
  %36 = call { double, double } @_ZN3JPH4Vec310sReplicateEf(float noundef 0x430C6BF520000000)
  %37 = getelementptr inbounds %"class.JPH::Vec3", ptr %9, i32 0, i32 0
  %38 = getelementptr inbounds %union.anon.1, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds { double, double }, ptr %38, i32 0, i32 0
  %40 = extractvalue { double, double } %36, 0
  store double %40, ptr %39, align 16
  %41 = getelementptr inbounds { double, double }, ptr %38, i32 0, i32 1
  %42 = extractvalue { double, double } %36, 1
  store double %42, ptr %41, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  %43 = call { double, double } @_ZN3JPH4Vec310sReplicateEf(float noundef 0xC30C6BF520000000)
  %44 = getelementptr inbounds %"class.JPH::Vec3", ptr %10, i32 0, i32 0
  %45 = getelementptr inbounds %union.anon.1, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds { double, double }, ptr %45, i32 0, i32 0
  %47 = extractvalue { double, double } %43, 0
  store double %47, ptr %46, align 16
  %48 = getelementptr inbounds { double, double }, ptr %45, i32 0, i32 1
  %49 = extractvalue { double, double } %43, 1
  store double %49, ptr %48, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %50, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %"class.JPH::Vec3", ptr %51, i64 %53
  store ptr %54, ptr %12, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %92, %35
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = icmp ult ptr %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %95

60:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #7
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %13, ptr align 16 %61, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %15, ptr align 16 %9, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 %13, i64 16, i1 false), !tbaa.struct !11
  %62 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 0
  %63 = load double, ptr %62, align 16
  %64 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 1
  %65 = load double, ptr %64, align 8
  %66 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 0
  %67 = load double, ptr %66, align 16
  %68 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 1
  %69 = load double, ptr %68, align 8
  %70 = call { double, double } @_ZN3JPH4Vec34sMinES0_S0_(double %63, double %65, double %67, double %69)
  %71 = getelementptr inbounds %"class.JPH::Vec3", ptr %14, i32 0, i32 0
  %72 = getelementptr inbounds %union.anon.1, ptr %71, i32 0, i32 0
  %73 = getelementptr inbounds { double, double }, ptr %72, i32 0, i32 0
  %74 = extractvalue { double, double } %70, 0
  store double %74, ptr %73, align 16
  %75 = getelementptr inbounds { double, double }, ptr %72, i32 0, i32 1
  %76 = extractvalue { double, double } %70, 1
  store double %76, ptr %75, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 %14, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %18, ptr align 16 %10, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %19, ptr align 16 %13, i64 16, i1 false), !tbaa.struct !11
  %77 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %78 = load double, ptr %77, align 16
  %79 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %80 = load double, ptr %79, align 8
  %81 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 0
  %82 = load double, ptr %81, align 16
  %83 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 1
  %84 = load double, ptr %83, align 8
  %85 = call { double, double } @_ZN3JPH4Vec34sMaxES0_S0_(double %78, double %80, double %82, double %84)
  %86 = getelementptr inbounds %"class.JPH::Vec3", ptr %17, i32 0, i32 0
  %87 = getelementptr inbounds %union.anon.1, ptr %86, i32 0, i32 0
  %88 = getelementptr inbounds { double, double }, ptr %87, i32 0, i32 0
  %89 = extractvalue { double, double } %85, 0
  store double %89, ptr %88, align 16
  %90 = getelementptr inbounds { double, double }, ptr %87, i32 0, i32 1
  %91 = extractvalue { double, double } %85, 1
  store double %91, ptr %90, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %10, ptr align 16 %17, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  br label %92

92:                                               ; preds = %60
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = getelementptr inbounds %"class.JPH::Vec3", ptr %93, i32 1
  store ptr %94, ptr %11, align 8, !tbaa !5
  br label %55, !llvm.loop !13

95:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %22, ptr align 16 %9, i64 16, i1 false), !tbaa.struct !11
  %96 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %97 = load double, ptr %96, align 16
  %98 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %99 = load double, ptr %98, align 8
  %100 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %10, double %97, double %99)
  %101 = getelementptr inbounds %"class.JPH::Vec3", ptr %21, i32 0, i32 0
  %102 = getelementptr inbounds %union.anon.1, ptr %101, i32 0, i32 0
  %103 = getelementptr inbounds { double, double }, ptr %102, i32 0, i32 0
  %104 = extractvalue { double, double } %100, 0
  store double %104, ptr %103, align 16
  %105 = getelementptr inbounds { double, double }, ptr %102, i32 0, i32 1
  %106 = extractvalue { double, double } %100, 1
  store double %106, ptr %105, align 8
  %107 = call noundef i32 @_ZNK3JPH4Vec324GetHighestComponentIndexEv(ptr noundef nonnull align 16 dereferenceable(16) %21)
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #7
  store i32 %107, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %25, ptr align 16 %10, i64 16, i1 false), !tbaa.struct !11
  %108 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 0
  %109 = load double, ptr %108, align 16
  %110 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 1
  %111 = load double, ptr %110, align 8
  %112 = call { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16) %9, double %109, double %111)
  %113 = getelementptr inbounds %"class.JPH::Vec3", ptr %24, i32 0, i32 0
  %114 = getelementptr inbounds %union.anon.1, ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds { double, double }, ptr %114, i32 0, i32 0
  %116 = extractvalue { double, double } %112, 0
  store double %116, ptr %115, align 16
  %117 = getelementptr inbounds { double, double }, ptr %114, i32 0, i32 1
  %118 = extractvalue { double, double } %112, 1
  store double %118, ptr %117, align 8
  %119 = load i32, ptr %20, align 4, !tbaa !9
  %120 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %24, i32 noundef %119)
  %121 = fmul float 5.000000e-01, %120
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #7
  store float %121, ptr %23, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  store i32 0, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %122 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %122, ptr %27, align 4, !tbaa !9
  br label %123

123:                                              ; preds = %193, %95
  %124 = load i32, ptr %26, align 4, !tbaa !9
  %125 = load i32, ptr %27, align 4, !tbaa !9
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %127, label %194

127:                                              ; preds = %123
  br label %128

128:                                              ; preds = %143, %127
  %129 = load i32, ptr %26, align 4, !tbaa !9
  %130 = load i32, ptr %27, align 4, !tbaa !9
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %132, label %141

132:                                              ; preds = %128
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = load i32, ptr %26, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds %"class.JPH::Vec3", ptr %133, i64 %135
  %137 = load i32, ptr %20, align 4, !tbaa !9
  %138 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %136, i32 noundef %137)
  %139 = load float, ptr %23, align 4, !tbaa !15
  %140 = fcmp olt float %138, %139
  br label %141

141:                                              ; preds = %132, %128
  %142 = phi i1 [ false, %128 ], [ %140, %132 ]
  br i1 %142, label %143, label %146

143:                                              ; preds = %141
  %144 = load i32, ptr %26, align 4, !tbaa !9
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %26, align 4, !tbaa !9
  br label %128, !llvm.loop !17

146:                                              ; preds = %141
  br label %147

147:                                              ; preds = %163, %146
  %148 = load i32, ptr %26, align 4, !tbaa !9
  %149 = load i32, ptr %27, align 4, !tbaa !9
  %150 = icmp slt i32 %148, %149
  br i1 %150, label %151, label %161

151:                                              ; preds = %147
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = load i32, ptr %27, align 4, !tbaa !9
  %154 = sub nsw i32 %153, 1
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds %"class.JPH::Vec3", ptr %152, i64 %155
  %157 = load i32, ptr %20, align 4, !tbaa !9
  %158 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %156, i32 noundef %157)
  %159 = load float, ptr %23, align 4, !tbaa !15
  %160 = fcmp oge float %158, %159
  br label %161

161:                                              ; preds = %151, %147
  %162 = phi i1 [ false, %147 ], [ %160, %151 ]
  br i1 %162, label %163, label %166

163:                                              ; preds = %161
  %164 = load i32, ptr %27, align 4, !tbaa !9
  %165 = add nsw i32 %164, -1
  store i32 %165, ptr %27, align 4, !tbaa !9
  br label %147, !llvm.loop !18

166:                                              ; preds = %161
  %167 = load i32, ptr %26, align 4, !tbaa !9
  %168 = load i32, ptr %27, align 4, !tbaa !9
  %169 = icmp slt i32 %167, %168
  br i1 %169, label %170, label %193

170:                                              ; preds = %166
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = load i32, ptr %26, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds %"class.JPH::QuadTree::NodeID", ptr %171, i64 %173
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = load i32, ptr %27, align 4, !tbaa !9
  %177 = sub nsw i32 %176, 1
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds %"class.JPH::QuadTree::NodeID", ptr %175, i64 %178
  call void @_ZSt4swapIN3JPH8QuadTree6NodeIDEENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SF_(ptr noundef nonnull align 4 dereferenceable(4) %174, ptr noundef nonnull align 4 dereferenceable(4) %179) #7
  %180 = load ptr, ptr %6, align 8, !tbaa !5
  %181 = load i32, ptr %26, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds %"class.JPH::Vec3", ptr %180, i64 %182
  %184 = load ptr, ptr %6, align 8, !tbaa !5
  %185 = load i32, ptr %27, align 4, !tbaa !9
  %186 = sub nsw i32 %185, 1
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds %"class.JPH::Vec3", ptr %184, i64 %187
  call void @_ZSt4swapIN3JPH4Vec3EENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 16 dereferenceable(16) %183, ptr noundef nonnull align 16 dereferenceable(16) %188) #7
  %189 = load i32, ptr %26, align 4, !tbaa !9
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %26, align 4, !tbaa !9
  %191 = load i32, ptr %27, align 4, !tbaa !9
  %192 = add nsw i32 %191, -1
  store i32 %192, ptr %27, align 4, !tbaa !9
  br label %193

193:                                              ; preds = %170, %166
  br label %123, !llvm.loop !19

194:                                              ; preds = %123
  br label %195

195:                                              ; preds = %194
  %196 = load i32, ptr %26, align 4, !tbaa !9
  %197 = load i32, ptr %27, align 4, !tbaa !9
  %198 = icmp eq i32 %196, %197
  br i1 %198, label %202, label %199

199:                                              ; preds = %195
  %200 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.21, ptr noundef @.str.1, i32 noundef 471)
  br i1 %200, label %201, label %202

201:                                              ; preds = %199
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !20
  br label %202

202:                                              ; preds = %201, %199, %195
  br label %203

203:                                              ; preds = %202
  br label %204

204:                                              ; preds = %203
  %205 = load i32, ptr %26, align 4, !tbaa !9
  %206 = icmp sgt i32 %205, 0
  br i1 %206, label %207, label %214

207:                                              ; preds = %204
  %208 = load i32, ptr %26, align 4, !tbaa !9
  %209 = load i32, ptr %7, align 4, !tbaa !9
  %210 = icmp slt i32 %208, %209
  br i1 %210, label %211, label %214

211:                                              ; preds = %207
  %212 = load i32, ptr %26, align 4, !tbaa !9
  %213 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %212, ptr %213, align 4, !tbaa !9
  br label %218

214:                                              ; preds = %207, %204
  %215 = load i32, ptr %7, align 4, !tbaa !9
  %216 = sdiv i32 %215, 2
  %217 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %216, ptr %217, align 4, !tbaa !9
  br label %218

218:                                              ; preds = %214, %211
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #7
  br label %219

219:                                              ; preds = %218, %31
  ret void
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Vec34sMinES0_S0_(double, double, double, double) #3 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Vec34sMaxES0_S0_(double, double, double, double) #3 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #3 align 2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN3JPH8QuadTree6NodeIDEENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SF_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN3JPH4Vec3EENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 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 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { 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 = !{i64 0, i64 16, !12}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = !{i64 2158742189}


; 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.JPH::Vec3" = type { %union.anon.1 }
%union.anon.1 = type { <4 x float> }
%"class.JPH::QuadTree::NodeID" = type { i32 }

@.str.1 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Vec310sReplicateEf(float noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH8QuadTree10sPartitionEPNS0_6NodeIDEPNS_4Vec3EiRi(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %3) local_unnamed_addr #3 align 2 {
  %5 = alloca %"class.JPH::Vec3", align 16
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = alloca %"class.JPH::Vec3", align 16
  %8 = alloca %"class.JPH::Vec3", align 16
  %9 = icmp slt i32 %2, 5
  br i1 %9, label %10, label %.lr.ph.preheader

10:                                               ; preds = %4
  %11 = sdiv i32 %2, 2
  store i32 %11, ptr %3, align 4, !tbaa !5
  br label %77

.lr.ph.preheader:                                 ; preds = %4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %12 = tail call { double, double } @_ZN3JPH4Vec310sReplicateEf(float noundef 0x430C6BF520000000)
  %13 = extractvalue { double, double } %12, 0
  %14 = getelementptr inbounds i8, ptr %5, i64 8
  %15 = extractvalue { double, double } %12, 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %16 = tail call { double, double } @_ZN3JPH4Vec310sReplicateEf(float noundef 0xC30C6BF520000000)
  %17 = extractvalue { double, double } %16, 0
  %18 = getelementptr inbounds i8, ptr %6, i64 8
  %19 = extractvalue { double, double } %16, 1
  %20 = zext nneg i32 %2 to i64
  %21 = getelementptr inbounds %"class.JPH::Vec3", ptr %1, i64 %20
  br label %.lr.ph

.preheader.lr.ph:                                 ; preds = %.lr.ph
  store double %36, ptr %5, align 16
  store double %37, ptr %14, align 8, !tbaa !9
  store double %39, ptr %6, align 16
  store double %40, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  %22 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %6, double %36, double %37)
  %23 = extractvalue { double, double } %22, 0
  store double %23, ptr %7, align 16
  %24 = getelementptr inbounds i8, ptr %7, i64 8
  %25 = extractvalue { double, double } %22, 1
  store double %25, ptr %24, align 8
  %26 = call noundef i32 @_ZNK3JPH4Vec324GetHighestComponentIndexEv(ptr noundef nonnull align 16 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #7
  %.sroa.0.0.copyload = load double, ptr %6, align 16
  %.sroa.2.0.copyload = load double, ptr %18, align 8, !tbaa !9
  %27 = call { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  %28 = extractvalue { double, double } %27, 0
  store double %28, ptr %8, align 16
  %29 = getelementptr inbounds i8, ptr %8, i64 8
  %30 = extractvalue { double, double } %27, 1
  store double %30, ptr %29, align 8
  %31 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %8, i32 noundef %26)
  %32 = fmul float %31, 5.000000e-01
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  %invariant.gep = getelementptr i8, ptr %1, i64 -16
  br label %.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.06780 = phi ptr [ %41, %.lr.ph ], [ %1, %.lr.ph.preheader ]
  %33 = phi double [ %36, %.lr.ph ], [ %13, %.lr.ph.preheader ]
  %.sroa.239.0.copyload7379 = phi double [ %37, %.lr.ph ], [ %15, %.lr.ph.preheader ]
  %34 = phi double [ %39, %.lr.ph ], [ %17, %.lr.ph.preheader ]
  %.sroa.234.0.copyload7778 = phi double [ %40, %.lr.ph ], [ %19, %.lr.ph.preheader ]
  %.sroa.042.0.copyload = load double, ptr %.06780, align 16
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %.06780, i64 8
  %.sroa.5.0.copyload = load double, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !9
  %35 = tail call { double, double } @_ZN3JPH4Vec34sMinES0_S0_(double %33, double %.sroa.239.0.copyload7379, double %.sroa.042.0.copyload, double %.sroa.5.0.copyload)
  %36 = extractvalue { double, double } %35, 0
  %37 = extractvalue { double, double } %35, 1
  %38 = tail call { double, double } @_ZN3JPH4Vec34sMaxES0_S0_(double %34, double %.sroa.234.0.copyload7778, double %.sroa.042.0.copyload, double %.sroa.5.0.copyload)
  %39 = extractvalue { double, double } %38, 0
  %40 = extractvalue { double, double } %38, 1
  %41 = getelementptr inbounds i8, ptr %.06780, i64 16
  %42 = icmp ult ptr %41, %21
  br i1 %42, label %.lr.ph, label %.preheader.lr.ph, !llvm.loop !10

.preheader:                                       ; preds = %.preheader.lr.ph, %.critedge70
  %.089 = phi i32 [ %2, %.preheader.lr.ph ], [ %.2, %.critedge70 ]
  %.06488 = phi i32 [ 0, %.preheader.lr.ph ], [ %.266, %.critedge70 ]
  %43 = sext i32 %.06488 to i64
  %44 = sext i32 %.089 to i64
  br label %45

45:                                               ; preds = %.preheader, %49
  %indvars.iv = phi i64 [ %43, %.preheader ], [ %indvars.iv.next, %49 ]
  %46 = getelementptr inbounds %"class.JPH::Vec3", ptr %1, i64 %indvars.iv
  %47 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %46, i32 noundef %26)
  %48 = fcmp olt float %47, %32
  br i1 %48, label %49, label %.critedge

49:                                               ; preds = %45
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %50 = icmp slt i64 %indvars.iv.next, %44
  br i1 %50, label %45, label %._crit_edge90.loopexit, !llvm.loop !12

.critedge:                                        ; preds = %45
  %51 = trunc nsw i64 %indvars.iv to i32
  %52 = icmp sgt i32 %.089, %51
  br i1 %52, label %.lr.ph86.preheader, label %.critedge70

.lr.ph86.preheader:                               ; preds = %.critedge
  %sext = shl i64 %indvars.iv, 32
  %53 = ashr exact i64 %sext, 32
  br label %.lr.ph86

.lr.ph86:                                         ; preds = %.lr.ph86.preheader, %56
  %indvars.iv100 = phi i64 [ %44, %.lr.ph86.preheader ], [ %indvars.iv.next101, %56 ]
  %gep = getelementptr %"class.JPH::Vec3", ptr %invariant.gep, i64 %indvars.iv100
  %54 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %gep, i32 noundef %26)
  %55 = fcmp ult float %54, %32
  br i1 %55, label %.critedge2, label %56

56:                                               ; preds = %.lr.ph86
  %indvars.iv.next101 = add nsw i64 %indvars.iv100, -1
  %57 = icmp sgt i64 %indvars.iv.next101, %53
  br i1 %57, label %.lr.ph86, label %.critedge70.loopexit, !llvm.loop !13

.critedge2:                                       ; preds = %.lr.ph86
  %58 = trunc nsw i64 %indvars.iv100 to i32
  %59 = getelementptr inbounds %"class.JPH::QuadTree::NodeID", ptr %0, i64 %53
  %60 = add nsw i32 %58, -1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds %"class.JPH::QuadTree::NodeID", ptr %0, i64 %61
  call void @_ZSt4swapIN3JPH8QuadTree6NodeIDEENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SF_(ptr noundef nonnull align 4 dereferenceable(4) %59, ptr noundef nonnull align 4 dereferenceable(4) %62) #7
  %63 = getelementptr inbounds %"class.JPH::Vec3", ptr %1, i64 %53
  %64 = getelementptr inbounds %"class.JPH::Vec3", ptr %1, i64 %61
  call void @_ZSt4swapIN3JPH4Vec3EENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 16 dereferenceable(16) %63, ptr noundef nonnull align 16 dereferenceable(16) %64) #7
  %65 = add nsw i32 %51, 1
  br label %.critedge70

.critedge70.loopexit:                             ; preds = %56
  %66 = trunc nsw i64 %indvars.iv.next101 to i32
  br label %.critedge70

.critedge70:                                      ; preds = %.critedge70.loopexit, %.critedge, %.critedge2
  %.266 = phi i32 [ %65, %.critedge2 ], [ %51, %.critedge ], [ %51, %.critedge70.loopexit ]
  %.2 = phi i32 [ %60, %.critedge2 ], [ %.089, %.critedge ], [ %66, %.critedge70.loopexit ]
  %67 = icmp slt i32 %.266, %.2
  br i1 %67, label %.preheader, label %._crit_edge90, !llvm.loop !14

._crit_edge90.loopexit:                           ; preds = %49
  %68 = add nsw i32 %.06488, 1
  %smax.le = call i32 @llvm.smax.i32(i32 %.089, i32 %68)
  br label %._crit_edge90

._crit_edge90:                                    ; preds = %.critedge70, %._crit_edge90.loopexit
  %.2107 = phi i32 [ %.089, %._crit_edge90.loopexit ], [ %.2, %.critedge70 ]
  %.266106 = phi i32 [ %smax.le, %._crit_edge90.loopexit ], [ %.266, %.critedge70 ]
  %69 = icmp eq i32 %.266106, %.2107
  br i1 %69, label %73, label %70

70:                                               ; preds = %._crit_edge90
  %71 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.1, i32 noundef 471)
  br i1 %71, label %72, label %73

72:                                               ; preds = %70
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !15
  br label %73

73:                                               ; preds = %72, %70, %._crit_edge90
  %74 = icmp sgt i32 %.266106, 0
  %75 = icmp slt i32 %.266106, %2
  %or.cond = and i1 %74, %75
  %76 = lshr i32 %2, 1
  %storemerge = select i1 %or.cond, i32 %.266106, i32 %76
  store i32 %storemerge, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %77

77:                                               ; preds = %73, %10
  ret void
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Vec34sMinES0_S0_(double, double, double, double) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Vec34sMaxES0_S0_(double, double, double, double) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef i32 @_ZNK3JPH4Vec324GetHighestComponentIndexEv(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16), i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN3JPH8QuadTree6NodeIDEENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SF_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN3JPH4Vec3EENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 = { 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 #4 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = !{i64 2158742189}


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