; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics (PhysicsSystem)

; 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::Color" = type { %union.anon }
%union.anon = type { i32 }
%"class.JPH::JobSystem::JobHandle" = type { %"class.JPH::Ref" }
%"class.JPH::Ref" = type { ptr }
%"class.std::function.21" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.46 = type <{ ptr, i32, [4 x i8] }>
%"struct.JPH::PhysicsUpdateContext::Step" = type { ptr, i8, i8, %"struct.JPH::BroadPhase::UpdateState", i32, %"struct.std::atomic", [60 x i8], %"struct.std::atomic", [60 x i8], %"struct.std::atomic", [60 x i8], %"struct.std::atomic", [60 x i8], %"struct.std::atomic", [60 x i8], %"struct.std::atomic", [60 x i8], %"class.JPH::StaticArray", i32, %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", ptr, i32, %"struct.std::atomic", %"struct.std::atomic", ptr, i32, %"class.JPH::JobSystem::JobHandle", %"class.JPH::StaticArray.20", %"class.JPH::StaticArray.20", %"class.JPH::StaticArray.20", %"class.JPH::StaticArray.20", %"class.JPH::JobSystem::JobHandle", %"class.JPH::StaticArray.20", %"class.JPH::JobSystem::JobHandle", %"class.JPH::JobSystem::JobHandle", %"class.JPH::JobSystem::JobHandle", %"class.JPH::StaticArray.20", %"class.JPH::JobSystem::JobHandle", %"class.JPH::StaticArray.20", %"class.JPH::JobSystem::JobHandle", %"class.JPH::JobSystem::JobHandle", %"class.JPH::StaticArray.20", %"class.JPH::JobSystem::JobHandle", %"class.JPH::JobSystem::JobHandle", %"class.JPH::StaticArray.20", %"class.JPH::StaticArray.20", %"class.JPH::JobSystem::JobHandle", %"class.JPH::JobSystem::JobHandle" }
%"struct.JPH::BroadPhase::UpdateState" = type { [4 x ptr] }
%"class.JPH::StaticArray" = type { i32, [32 x %"struct.JPH::StaticArray<JPH::PhysicsUpdateContext::BodyPairQueue, 32>::Storage"] }
%"struct.JPH::StaticArray<JPH::PhysicsUpdateContext::BodyPairQueue, 32>::Storage" = type { [128 x i8] }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::StaticArray.20" = type { i32, [4 x i8], [32 x %"struct.JPH::StaticArray<JPH::JobSystem::JobHandle, 32>::Storage"] }
%"struct.JPH::StaticArray<JPH::JobSystem::JobHandle, 32>::Storage" = type { [8 x i8] }
%"struct.JPH::PhysicsUpdateContext::BodyPairQueue" = type { %"struct.std::atomic", [60 x i8], %"struct.std::atomic", [60 x i8] }
%"class.JPH::PhysicsSystem" = type <{ ptr, ptr, %"class.JPH::BodyManager", %"class.JPH::BodyLockInterfaceNoLock", %"class.JPH::BodyLockInterfaceLocking", %"class.JPH::BodyInterface", %"class.JPH::BodyInterface", %"class.JPH::NarrowPhaseQuery", %"class.JPH::NarrowPhaseQuery", ptr, ptr, ptr, %"class.std::function", %"struct.JPH::PhysicsSettings", [4 x i8], %"class.JPH::ContactConstraintManager", %"class.JPH::ConstraintManager", %"class.JPH::IslandBuilder", %"class.JPH::LargeIslandSplitter", %"class.JPH::Mutex", %"class.JPH::Array.10", %"class.JPH::Vec3", float, [12 x i8] }>
%"class.JPH::BodyManager" = type <{ %"class.JPH::Array", i32, [4 x i8], i64, %"class.JPH::Mutex", %"class.JPH::MutexArray", %"class.JPH::Array.0", %"class.JPH::Mutex", [2 x ptr], [2 x %"struct.std::atomic"], i32, [4 x i8], %"class.JPH::Mutex", %"class.JPH::Array.3", ptr, ptr, i8, [7 x i8] }>
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::MutexArray" = type <{ ptr, i32, [4 x i8] }>
%"class.JPH::Array.0" = type { i64, i64, ptr }
%"class.JPH::Array.3" = type { i64, i64, ptr }
%"class.JPH::BodyLockInterfaceNoLock" = type { %"class.JPH::BodyLockInterface" }
%"class.JPH::BodyLockInterface" = type { ptr, ptr }
%"class.JPH::BodyLockInterfaceLocking" = type { %"class.JPH::BodyLockInterface" }
%"class.JPH::BodyInterface" = type { ptr, ptr, ptr }
%"class.JPH::NarrowPhaseQuery" = type { ptr, ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"struct.JPH::PhysicsSettings" = type <{ i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, i32, i32, float, float, float, i8, i8, i8, i8, i8, i8, i8, i8 }>
%"class.JPH::ContactConstraintManager" = type { [8 x i8], [2 x %"class.JPH::ContactConstraintManager::ManifoldCache"], i32, ptr, ptr, ptr, ptr, ptr, i32, %"struct.std::atomic", ptr }
%"class.JPH::ContactConstraintManager::ManifoldCache" = type <{ %"class.JPH::LFHMAllocator", %"class.JPH::LockFreeHashMap", %"class.JPH::LockFreeHashMap.6", i8, [7 x i8] }>
%"class.JPH::LFHMAllocator" = type { ptr, i32, %"struct.std::atomic" }
%"class.JPH::LockFreeHashMap" = type { ptr, %"struct.std::atomic", ptr, i32, i32 }
%"class.JPH::LockFreeHashMap.6" = type { ptr, %"struct.std::atomic", ptr, i32, i32 }
%"class.JPH::ConstraintManager" = type { ptr, %"class.JPH::Array.7", %"class.JPH::Mutex" }
%"class.JPH::Array.7" = type { i64, i64, ptr }
%"class.JPH::IslandBuilder" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32 }
%"class.JPH::LargeIslandSplitter" = type <{ i32, [4 x i8], ptr, ptr, ptr, i32, %"struct.std::atomic", i32, [4 x i8], ptr, %"struct.std::atomic", [4 x i8] }>
%"class.JPH::Mutex" = type { %"class.std::mutex", %"class.std::thread::id" }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::thread::id" = type { i64 }
%"class.JPH::Array.10" = type { i64, i64, ptr }
%"class.JPH::Vec3" = type { %union.anon.13 }
%union.anon.13 = type { <4 x float> }
%"class.JPH::PhysicsUpdateContext" = type <{ ptr, ptr, ptr, ptr, float, float, %"struct.std::atomic", [4 x i8], ptr, ptr, ptr, %"class.JPH::Array.19", i32, [4 x i8], ptr, %"struct.std::atomic", [4 x i8] }>
%"class.JPH::Array.19" = type { %"class.JPH::STLTempAllocator", i64, i64, ptr }
%"class.JPH::STLTempAllocator" = type { ptr }

@_ZN3JPHL20cColorFindCollisionsE = external hidden global %"class.JPH::Color", align 4
@.str.33 = external hidden unnamed_addr constant [15 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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297), i8 noundef zeroext) #2 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH3RefINS_9JobSystem3JobEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"class.JPH::JobSystem::JobHandle", align 8
  %20 = alloca %"class.JPH::Color", align 4
  %21 = alloca %"class.std::function.21", align 8
  %22 = alloca %class.anon.46, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %26, i32 0, i32 17
  %28 = call noundef i32 @_ZNK3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(4100) %27)
  store i32 %28, ptr %5, align 4, !tbaa !9
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %29, i32 0, i32 19
  %31 = call noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %30, i32 noundef 0) #7
  %32 = call noundef i32 @_ZN3JPH9CountBitsEj(i32 noundef %31)
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = icmp uge i32 %32, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %2
  store i32 1, ptr %6, align 4
  br label %148

36:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %37, i32 0, i32 17
  store ptr %38, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = call noundef ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE5beginEv(ptr noundef nonnull align 4 dereferenceable(4100) %39)
  store ptr %40, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = call noundef ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE3endEv(ptr noundef nonnull align 4 dereferenceable(4100) %41)
  store ptr %42, ptr %10, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %59, %36
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = icmp ne ptr %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %62

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %49, ptr %11, align 8, !tbaa !5
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::BodyPairQueue", ptr %50, i32 0, i32 0
  %52 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %51) #7
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::BodyPairQueue", ptr %53, i32 0, i32 2
  %55 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %54) #7
  %56 = sub i32 %52, %55
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = add i32 %57, %56
  store i32 %58, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %59

59:                                               ; preds = %48
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::BodyPairQueue", ptr %60, i32 1
  store ptr %61, ptr %9, align 8, !tbaa !5
  br label %43

62:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %63 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %25, i32 0, i32 2
  %64 = call noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297) %63, i8 noundef zeroext 0)
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %65, i32 0, i32 15
  %67 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %66) #7
  %68 = sub i32 %64, %67
  store i32 %68, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %69 = load i32, ptr %7, align 4, !tbaa !9
  %70 = add i32 %69, 16
  %71 = sub i32 %70, 1
  %72 = udiv i32 %71, 16
  %73 = load i32, ptr %12, align 4, !tbaa !9
  %74 = add i32 %73, 16
  %75 = sub i32 %74, 1
  %76 = udiv i32 %75, 16
  %77 = add i32 %72, %76
  store i32 %77, ptr %14, align 4, !tbaa !9
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %79 = load i32, ptr %78, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  store i32 %79, ptr %13, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %145, %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %81, i32 0, i32 19
  %83 = call noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %82, i32 noundef 0) #7
  store i32 %83, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %84 = load i32, ptr %15, align 4, !tbaa !9
  %85 = xor i32 %84, -1
  %86 = call noundef i32 @_ZN3JPH18CountTrailingZerosEj(i32 noundef %85)
  store i32 %86, ptr %16, align 4, !tbaa !9
  %87 = load i32, ptr %16, align 4, !tbaa !9
  %88 = load i32, ptr %13, align 4, !tbaa !9
  %89 = icmp uge i32 %87, %88
  br i1 %89, label %90, label %91

90:                                               ; preds = %80
  store i32 4, ptr %6, align 4
  br label %143

91:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %92 = load i32, ptr %16, align 4, !tbaa !9
  %93 = shl i32 1, %92
  store i32 %93, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %94, i32 0, i32 19
  %96 = load i32, ptr %17, align 4, !tbaa !9
  %97 = call noundef i32 @_ZNSt13__atomic_baseIjE8fetch_orEjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %95, i32 noundef %96, i32 noundef 2) #7
  store i32 %97, ptr %18, align 4, !tbaa !9
  %98 = load i32, ptr %18, align 4, !tbaa !9
  %99 = load i32, ptr %17, align 4, !tbaa !9
  %100 = and i32 %98, %99
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %102, label %141

102:                                              ; preds = %91
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %103, i32 0, i32 36
  call void @_ZNK3JPH9JobSystem9JobHandle13AddDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %104, i32 noundef 1)
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %105, i32 0, i32 39
  call void @_ZNK3JPH9JobSystem9JobHandle13AddDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %106, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !11
  %110 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %109, i32 0, i32 2
  %111 = load ptr, ptr %110, align 8, !tbaa !21
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 @_ZN3JPHL20cColorFindCollisionsE, i64 4, i1 false), !tbaa.struct !27
  call void @llvm.lifetime.start.p0(i64 32, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #7
  %112 = getelementptr inbounds %class.anon.46, ptr %22, i32 0, i32 0
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %113, ptr %112, align 8, !tbaa !29
  %114 = getelementptr inbounds %class.anon.46, ptr %22, i32 0, i32 1
  %115 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %115, ptr %114, align 8, !tbaa !31
  call void @"_ZNSt8functionIFvvEEC2IZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS3_20PhysicsUpdateContext4StepEE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef nonnull align 8 dereferenceable(12) %22) #7
  %116 = getelementptr inbounds %"class.JPH::Color", ptr %20, i32 0, i32 0
  %117 = getelementptr inbounds %union.anon, ptr %116, i32 0, i32 0
  %118 = load i32, ptr %117, align 4
  %119 = load ptr, ptr %111, align 8, !tbaa !32
  %120 = getelementptr inbounds ptr, ptr %119, i64 3
  %121 = load ptr, ptr %120, align 8
  invoke void %121(ptr dead_on_unwind writable sret(%"class.JPH::JobSystem::JobHandle") align 8 %19, ptr noundef nonnull align 8 dereferenceable(8) %111, ptr noundef @.str.33, i32 %118, ptr noundef nonnull align 8 dereferenceable(32) %21, i32 noundef 0)
          to label %122 unwind label %132

122:                                              ; preds = %102
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #7
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %123, i32 0, i32 0
  %125 = load ptr, ptr %124, align 8, !tbaa !11
  %126 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %125, i32 0, i32 3
  %127 = load ptr, ptr %126, align 8, !tbaa !34
  %128 = load ptr, ptr %127, align 8, !tbaa !32
  %129 = getelementptr inbounds ptr, ptr %128, i64 0
  %130 = load ptr, ptr %129, align 8
  invoke void %130(ptr noundef nonnull align 8 dereferenceable(8) %127, ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %131 unwind label %136

131:                                              ; preds = %122
  store i32 1, ptr %6, align 4
  call void @_ZN3JPH3RefINS_9JobSystem3JobEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %142

132:                                              ; preds = %102
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %23, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %24, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #7
  br label %140

136:                                              ; preds = %122
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %23, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %24, align 4
  call void @_ZN3JPH3RefINS_9JobSystem3JobEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  br label %140

140:                                              ; preds = %136, %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %151

141:                                              ; preds = %91
  store i32 0, ptr %6, align 4
  br label %142

142:                                              ; preds = %141, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %143

143:                                              ; preds = %142, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %144 = load i32, ptr %6, align 4
  switch i32 %144, label %147 [
    i32 0, label %145
    i32 4, label %146
  ]

145:                                              ; preds = %143
  br label %80, !llvm.loop !35

146:                                              ; preds = %143
  store i32 0, ptr %6, align 4
  br label %147

147:                                              ; preds = %146, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %148

148:                                              ; preds = %147, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  %149 = load i32, ptr %6, align 4
  switch i32 %149, label %156 [
    i32 0, label %150
    i32 1, label %150
  ]

150:                                              ; preds = %148, %148
  ret void

151:                                              ; preds = %140
  %152 = load ptr, ptr %23, align 8
  %153 = load i32, ptr %24, align 4
  %154 = insertvalue { ptr, i32 } poison, ptr %152, 0
  %155 = insertvalue { ptr, i32 } %154, i32 %153, 1
  resume { ptr, i32 } %155

156:                                              ; preds = %148
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(4100)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH9CountBitsEj(i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE5beginEv(ptr noundef nonnull align 4 dereferenceable(4100)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE3endEv(ptr noundef nonnull align 4 dereferenceable(4100)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH18CountTrailingZerosEj(i32 noundef) #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNSt13__atomic_baseIjE8fetch_orEjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef) #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvvEEC2IZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS3_20PhysicsUpdateContext4StepEE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { alwaysinline 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 #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN3JPH20PhysicsUpdateContext4StepE", !6, i64 0, !13, i64 8, !13, i64 9, !14, i64 16, !10, i64 48, !15, i64 52, !7, i64 56, !15, i64 116, !7, i64 120, !15, i64 180, !7, i64 184, !15, i64 244, !7, i64 248, !15, i64 308, !7, i64 312, !15, i64 372, !7, i64 376, !17, i64 436, !10, i64 4536, !15, i64 4540, !15, i64 4544, !15, i64 4548, !15, i64 4552, !15, i64 4556, !15, i64 4560, !6, i64 4568, !10, i64 4576, !15, i64 4580, !15, i64 4584, !6, i64 4592, !10, i64 4600, !18, i64 4608, !20, i64 4616, !20, i64 4880, !20, i64 5144, !20, i64 5408, !18, i64 5672, !20, i64 5680, !18, i64 5944, !18, i64 5952, !18, i64 5960, !20, i64 5968, !18, i64 6232, !20, i64 6240, !18, i64 6504, !18, i64 6512, !20, i64 6520, !18, i64 6784, !18, i64 6792, !20, i64 6800, !20, i64 7064, !18, i64 7328, !18, i64 7336}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN3JPH10BroadPhase11UpdateStateE", !7, i64 0}
!15 = !{!"_ZTSSt6atomicIjE", !16, i64 0}
!16 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!17 = !{!"_ZTSN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEE", !10, i64 0, !7, i64 4}
!18 = !{!"_ZTSN3JPH9JobSystem9JobHandleE", !19, i64 0}
!19 = !{!"_ZTSN3JPH3RefINS_9JobSystem3JobEEE", !6, i64 0}
!20 = !{!"_ZTSN3JPH11StaticArrayINS_9JobSystem9JobHandleELj32EEE", !10, i64 0, !7, i64 8}
!21 = !{!22, !6, i64 16}
!22 = !{!"_ZTSN3JPH20PhysicsUpdateContextE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !23, i64 32, !23, i64 36, !15, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !24, i64 72, !10, i64 104, !6, i64 112, !15, i64 120}
!23 = !{!"float", !7, i64 0}
!24 = !{!"_ZTSN3JPH5ArrayINS_20PhysicsUpdateContext4StepENS_16STLTempAllocatorIS2_EEEE", !25, i64 0, !26, i64 8, !26, i64 16, !6, i64 24}
!25 = !{!"_ZTSN3JPH16STLTempAllocatorINS_20PhysicsUpdateContext4StepEEE", !6, i64 0}
!26 = !{!"long", !7, i64 0}
!27 = !{i64 0, i64 4, !28}
!28 = !{!7, !7, i64 0}
!29 = !{!30, !6, i64 0}
!30 = !{!"_ZTSZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepEE3$_0", !6, i64 0, !10, i64 8}
!31 = !{!30, !10, i64 8}
!32 = !{!33, !33, i64 0}
!33 = !{!"vtable pointer", !8, i64 0}
!34 = !{!22, !6, i64 24}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


; 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::Color" = type { %union.anon }
%union.anon = type { i32 }
%"class.JPH::JobSystem::JobHandle" = type { %"class.JPH::Ref" }
%"class.JPH::Ref" = type { ptr }
%"class.std::function.21" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.46 = type <{ ptr, i32, [4 x i8] }>

@_ZN3JPHL20cColorFindCollisionsE = external hidden local_unnamed_addr global %"class.JPH::Color", align 4
@.str.33 = external hidden unnamed_addr constant [15 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

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297), i8 noundef zeroext) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH3RefINS_9JobSystem3JobEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.JPH::JobSystem::JobHandle", align 8
  %6 = alloca %"class.std::function.21", align 8
  %7 = alloca %class.anon.46, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %8 = getelementptr inbounds i8, ptr %1, i64 436
  %9 = tail call noundef i32 @_ZNK3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(4100) %8)
  store i32 %9, ptr %3, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 4540
  %11 = tail call noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %10, i32 noundef 0) #6
  %12 = tail call noundef i32 @_ZN3JPH9CountBitsEj(i32 noundef %11)
  %.not = icmp ult i32 %12, %9
  br i1 %.not, label %13, label %.thread

13:                                               ; preds = %2
  %14 = tail call noundef ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE5beginEv(ptr noundef nonnull align 4 dereferenceable(4100) %8)
  %15 = tail call noundef ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE3endEv(ptr noundef nonnull align 4 dereferenceable(4100) %8)
  %.not3845 = icmp eq ptr %14, %15
  br i1 %.not3845, label %._crit_edge, label %.lr.ph

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %16 = add i32 %32, 15
  %17 = lshr i32 %16, 4
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %13
  %.035.lcssa = phi i32 [ 0, %13 ], [ %17, %._crit_edge.loopexit ]
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = tail call noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297) %18, i8 noundef zeroext 0)
  %20 = getelementptr inbounds i8, ptr %1, i64 372
  %21 = tail call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %20) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %22 = add i32 %19, 15
  %23 = sub i32 %22, %21
  %24 = lshr i32 %23, 4
  %25 = add nuw nsw i32 %24, %.035.lcssa
  store i32 %25, ptr %4, align 4, !tbaa !5
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %27 = load i32, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %34

.lr.ph:                                           ; preds = %13, %.lr.ph
  %.03547 = phi i32 [ %32, %.lr.ph ], [ 0, %13 ]
  %.03646 = phi ptr [ %33, %.lr.ph ], [ %14, %13 ]
  %28 = tail call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %.03646) #6
  %29 = getelementptr inbounds i8, ptr %.03646, i64 64
  %30 = tail call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %29) #6
  %31 = add i32 %28, %.03547
  %32 = sub i32 %31, %30
  %33 = getelementptr inbounds i8, ptr %.03646, i64 128
  %.not38 = icmp eq ptr %33, %15
  br i1 %.not38, label %._crit_edge.loopexit, label %.lr.ph

34:                                               ; preds = %38, %._crit_edge
  %35 = call noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %10, i32 noundef 0) #6
  %36 = xor i32 %35, -1
  %37 = call noundef i32 @_ZN3JPH18CountTrailingZerosEj(i32 noundef %36)
  %.not39 = icmp ult i32 %37, %27
  br i1 %.not39, label %38, label %.thread

38:                                               ; preds = %34
  %39 = shl nuw i32 1, %37
  %40 = call noundef i32 @_ZNSt13__atomic_baseIjE8fetch_orEjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %10, i32 noundef %39, i32 noundef 2) #6
  %41 = and i32 %40, %39
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %34

43:                                               ; preds = %38
  %44 = getelementptr inbounds i8, ptr %1, i64 5672
  call void @_ZNK3JPH9JobSystem9JobHandle13AddDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %44, i32 noundef 1)
  %45 = getelementptr inbounds i8, ptr %1, i64 5952
  call void @_ZNK3JPH9JobSystem9JobHandle13AddDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %45, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %46 = load ptr, ptr %1, align 8, !tbaa !9
  %47 = getelementptr inbounds i8, ptr %46, i64 16
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %.sroa.0.0.copyload = load i32, ptr @_ZN3JPHL20cColorFindCollisionsE, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  store ptr %1, ptr %7, align 8, !tbaa !27
  %49 = getelementptr inbounds i8, ptr %7, i64 8
  store i32 %37, ptr %49, align 8, !tbaa !29
  call void @"_ZNSt8functionIFvvEEC2IZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS3_20PhysicsUpdateContext4StepEE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(12) %7) #6
  %50 = load ptr, ptr %48, align 8, !tbaa !30
  %51 = getelementptr inbounds i8, ptr %50, i64 24
  %52 = load ptr, ptr %51, align 8
  invoke void %52(ptr dead_on_unwind nonnull writable sret(%"class.JPH::JobSystem::JobHandle") align 8 %5, ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef nonnull @.str.33, i32 %.sroa.0.0.copyload, ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 0)
          to label %53 unwind label %60

53:                                               ; preds = %43
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  %54 = load ptr, ptr %1, align 8, !tbaa !9
  %55 = getelementptr inbounds i8, ptr %54, i64 24
  %56 = load ptr, ptr %55, align 8, !tbaa !32
  %57 = load ptr, ptr %56, align 8, !tbaa !30
  %58 = load ptr, ptr %57, align 8
  invoke void %58(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %59 unwind label %62

59:                                               ; preds = %53
  call void @_ZN3JPH3RefINS_9JobSystem3JobEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %.thread

60:                                               ; preds = %43
  %61 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  br label %64

62:                                               ; preds = %53
  %63 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefINS_9JobSystem3JobEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br label %64

64:                                               ; preds = %62, %60
  %.pn = phi { ptr, i32 } [ %63, %62 ], [ %61, %60 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  resume { ptr, i32 } %.pn

.thread:                                          ; preds = %34, %59, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(4100)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH9CountBitsEj(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE5beginEv(ptr noundef nonnull align 4 dereferenceable(4100)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE3endEv(ptr noundef nonnull align 4 dereferenceable(4100)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH18CountTrailingZerosEj(i32 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNSt13__atomic_baseIjE8fetch_orEjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvvEEC2IZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS3_20PhysicsUpdateContext4StepEE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN3JPH20PhysicsUpdateContext4StepE", !11, i64 0, !12, i64 8, !12, i64 9, !13, i64 16, !6, i64 48, !14, i64 52, !7, i64 56, !14, i64 116, !7, i64 120, !14, i64 180, !7, i64 184, !14, i64 244, !7, i64 248, !14, i64 308, !7, i64 312, !14, i64 372, !7, i64 376, !16, i64 436, !6, i64 4536, !14, i64 4540, !14, i64 4544, !14, i64 4548, !14, i64 4552, !14, i64 4556, !14, i64 4560, !11, i64 4568, !6, i64 4576, !14, i64 4580, !14, i64 4584, !11, i64 4592, !6, i64 4600, !17, i64 4608, !19, i64 4616, !19, i64 4880, !19, i64 5144, !19, i64 5408, !17, i64 5672, !19, i64 5680, !17, i64 5944, !17, i64 5952, !17, i64 5960, !19, i64 5968, !17, i64 6232, !19, i64 6240, !17, i64 6504, !17, i64 6512, !19, i64 6520, !17, i64 6784, !17, i64 6792, !19, i64 6800, !19, i64 7064, !17, i64 7328, !17, i64 7336}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSN3JPH10BroadPhase11UpdateStateE", !7, i64 0}
!14 = !{!"_ZTSSt6atomicIjE", !15, i64 0}
!15 = !{!"_ZTSSt13__atomic_baseIjE", !6, i64 0}
!16 = !{!"_ZTSN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEE", !6, i64 0, !7, i64 4}
!17 = !{!"_ZTSN3JPH9JobSystem9JobHandleE", !18, i64 0}
!18 = !{!"_ZTSN3JPH3RefINS_9JobSystem3JobEEE", !11, i64 0}
!19 = !{!"_ZTSN3JPH11StaticArrayINS_9JobSystem9JobHandleELj32EEE", !6, i64 0, !7, i64 8}
!20 = !{!21, !11, i64 16}
!21 = !{!"_ZTSN3JPH20PhysicsUpdateContextE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !22, i64 32, !22, i64 36, !14, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !23, i64 72, !6, i64 104, !11, i64 112, !14, i64 120}
!22 = !{!"float", !7, i64 0}
!23 = !{!"_ZTSN3JPH5ArrayINS_20PhysicsUpdateContext4StepENS_16STLTempAllocatorIS2_EEEE", !24, i64 0, !25, i64 8, !25, i64 16, !11, i64 24}
!24 = !{!"_ZTSN3JPH16STLTempAllocatorINS_20PhysicsUpdateContext4StepEEE", !11, i64 0}
!25 = !{!"long", !7, i64 0}
!26 = !{!7, !7, i64 0}
!27 = !{!28, !11, i64 0}
!28 = !{!"_ZTSZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepEE3$_0", !11, i64 0, !6, i64 8}
!29 = !{!28, !6, i64 8}
!30 = !{!31, !31, i64 0}
!31 = !{!"vtable pointer", !8, i64 0}
!32 = !{!21, !11, i64 24}


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