; 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::BodyAccess::Grant" = type { i8 }
%"class.JPH::BodyManager::GrantActiveBodiesAccess" = type { i8 }
%"class.JPH::ContactConstraintManager::ContactAllocator" = type { %"class.JPH::LFHMAllocatorContext.base", i32, i32, i32 }
%"class.JPH::LFHMAllocatorContext.base" = type <{ ptr, i32, i32, i32 }>
%class.MyBodyPairCallback = type <{ %"class.JPH::CollisionCollector", ptr, ptr, i32, [4 x i8] }>
%"class.JPH::CollisionCollector" = type { ptr, float, ptr }
%"struct.JPH::BodyPair" = type { %"class.JPH::BodyID", %"class.JPH::BodyID" }
%"class.JPH::BodyID" = type { i32 }
%"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 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"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 }
%"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 } }
%"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> }
%"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] }
%"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] }
%"class.JPH::JobSystem::JobHandle" = type { %"class.JPH::Ref" }
%"class.JPH::Ref" = type { ptr }
%"struct.JPH::PhysicsUpdateContext::BodyPairQueue" = type { %"struct.std::atomic", [60 x i8], %"struct.std::atomic", [60 x i8] }
%"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 }

; 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 uwtable
declare dso_local void @_ZNK3JPH9JobSystem9JobHandle16RemoveDependencyEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1), i8 noundef zeroext, i8 noundef zeroext) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessC2Ebb(ptr noundef nonnull align 1 dereferenceable(1), i1 noundef zeroext, i1 noundef zeroext) unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH11BodyManager21GetActiveBodiesUnsafeENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297), i8 noundef zeroext) #2 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
declare dso_local void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1172), ptr noundef) #5 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH13PhysicsSystem17JobFindCollisionsEPNS_20PhysicsUpdateContext4StepEi(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef %1, i32 noundef %2) #5 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.JPH::BodyAccess::Grant", align 1
  %8 = alloca %"class.JPH::BodyManager::GrantActiveBodiesAccess", align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.JPH::ContactConstraintManager::ContactAllocator", align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %class.MyBodyPairCallback, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca %"struct.JPH::BodyPair", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %28 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #7
  call void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1) %7, i8 noundef zeroext 1, i8 noundef zeroext 1)
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  invoke void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessC2Ebb(ptr noundef nonnull align 1 dereferenceable(1) %8, i1 noundef zeroext true, i1 noundef zeroext false)
          to label %29 unwind label %109

29:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #7
  %30 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %28, i32 0, i32 15
  invoke void @_ZN3JPH24ContactConstraintManager19GetContactAllocatorEv(ptr dead_on_unwind writable sret(%"class.JPH::ContactConstraintManager::ContactAllocator") align 8 %11, ptr noundef nonnull align 8 dereferenceable(248) %30)
          to label %31 unwind label %113

31:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %34, i32 0, i32 17
  %36 = invoke noundef i32 @_ZNK3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(4100) %35)
          to label %37 unwind label %117

37:                                               ; preds = %31
  %38 = urem i32 %33, %36
  store i32 %38, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %39 = alloca i8, i64 64, align 16
  store ptr %39, ptr %13, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %247, %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %41, i32 0, i32 15
  %43 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %42) #7
  store i32 %43, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %44 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %28, i32 0, i32 2
  %45 = invoke noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297) %44, i8 noundef zeroext 0)
          to label %46 unwind label %121

46:                                               ; preds = %40
  store i32 %45, ptr %15, align 4, !tbaa !9
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = load i32, ptr %15, align 4, !tbaa !9
  %49 = icmp ult i32 %47, %48
  br i1 %49, label %50, label %151

50:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %51 = load i32, ptr %14, align 4, !tbaa !9
  %52 = add i32 %51, 16
  store i32 %52, ptr %17, align 4, !tbaa !9
  %53 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %54 unwind label %125

54:                                               ; preds = %50
  %55 = load i32, ptr %53, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  store i32 %55, ptr %16, align 4, !tbaa !9
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %56, i32 0, i32 15
  %58 = load i32, ptr %16, align 4, !tbaa !9
  %59 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE23compare_exchange_strongERjjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %57, ptr noundef nonnull align 4 dereferenceable(4) %14, i32 noundef %58, i32 noundef 5) #7
  br i1 %59, label %60, label %149

60:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 48, ptr %18) #7
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = load i32, ptr %6, align 4, !tbaa !9
  invoke void @_ZZN3JPH13PhysicsSystem17JobFindCollisionsEPNS_20PhysicsUpdateContext4StepEiEN18MyBodyPairCallbackC2ES3_RNS_24ContactConstraintManager16ContactAllocatorEi(ptr noundef nonnull align 8 dereferenceable(44) %18, ptr noundef %61, ptr noundef nonnull align 8 dereferenceable(32) %11, i32 noundef %62)
          to label %63 unwind label %129

63:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %64 = load i32, ptr %16, align 4, !tbaa !9
  %65 = load i32, ptr %14, align 4, !tbaa !9
  %66 = sub i32 %64, %65
  store i32 %66, ptr %19, align 4, !tbaa !9
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  %68 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %28, i32 0, i32 2
  %69 = invoke noundef ptr @_ZNK3JPH11BodyManager21GetActiveBodiesUnsafeENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297) %68, i8 noundef zeroext 0)
          to label %70 unwind label %133

70:                                               ; preds = %63
  %71 = load i32, ptr %14, align 4, !tbaa !9
  %72 = zext i32 %71 to i64
  %73 = getelementptr inbounds %"class.JPH::BodyID", ptr %69, i64 %72
  %74 = load i32, ptr %19, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = mul i64 %75, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %67, ptr align 4 %73, i64 %76, i1 false)
  %77 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %28, i32 0, i32 9
  %78 = load ptr, ptr %77, align 16, !tbaa !11
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  %80 = load i32, ptr %19, align 4, !tbaa !9
  %81 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %28, i32 0, i32 13
  %82 = getelementptr inbounds %"struct.JPH::PhysicsSettings", ptr %81, i32 0, i32 4
  %83 = load float, ptr %82, align 8, !tbaa !42
  %84 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %28, i32 0, i32 0
  %85 = load ptr, ptr %84, align 16, !tbaa !43
  %86 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %28, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !44
  %88 = load ptr, ptr %78, align 8, !tbaa !45
  %89 = getelementptr inbounds ptr, ptr %88, i64 21
  %90 = load ptr, ptr %89, align 8
  invoke void %90(ptr noundef nonnull align 8 dereferenceable(16) %78, ptr noundef %79, i32 noundef %80, float noundef %83, ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef nonnull align 8 dereferenceable(8) %87, ptr noundef nonnull align 8 dereferenceable(24) %18)
          to label %91 unwind label %133

91:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %92, i32 0, i32 17
  %94 = load i32, ptr %6, align 4, !tbaa !9
  %95 = invoke noundef nonnull align 4 dereferenceable(128) ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEixEj(ptr noundef nonnull align 4 dereferenceable(4100) %93, i32 noundef %94)
          to label %96 unwind label %137

96:                                               ; preds = %91
  store ptr %95, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %97 = load ptr, ptr %20, align 8, !tbaa !5
  %98 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::BodyPairQueue", ptr %97, i32 0, i32 0
  %99 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %98) #7
  %100 = load ptr, ptr %20, align 8, !tbaa !5
  %101 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::BodyPairQueue", ptr %100, i32 0, i32 2
  %102 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %101) #7
  %103 = sub i32 %99, %102
  store i32 %103, ptr %21, align 4, !tbaa !9
  %104 = load i32, ptr %21, align 4, !tbaa !9
  %105 = icmp uge i32 %104, 16
  br i1 %105, label %106, label %145

106:                                              ; preds = %96
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1172) %28, ptr noundef %107)
          to label %108 unwind label %141

108:                                              ; preds = %106
  br label %145

109:                                              ; preds = %3
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %9, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %10, align 4
  br label %252

113:                                              ; preds = %29
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %9, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %10, align 4
  br label %251

117:                                              ; preds = %31
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %9, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %10, align 4
  br label %250

121:                                              ; preds = %40
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %9, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %10, align 4
  br label %248

125:                                              ; preds = %50
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %9, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %150

129:                                              ; preds = %60
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %9, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %10, align 4
  br label %148

133:                                              ; preds = %70, %63
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %9, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %10, align 4
  br label %147

137:                                              ; preds = %91
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %9, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %10, align 4
  br label %146

141:                                              ; preds = %106
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %9, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %146

145:                                              ; preds = %108, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @_ZN3JPH18CollisionCollectorINS_8BodyPairENS_36CollisionCollectorTraitsCollideShapeEED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %18) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #7
  br label %149

146:                                              ; preds = %141, %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %147

147:                                              ; preds = %146, %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @_ZN3JPH18CollisionCollectorINS_8BodyPairENS_36CollisionCollectorTraitsCollideShapeEED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %18) #7
  br label %148

148:                                              ; preds = %147, %129
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #7
  br label %150

149:                                              ; preds = %145, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %244

150:                                              ; preds = %148, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %248

151:                                              ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !47
  store ptr %154, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %155 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %155, ptr %23, align 4, !tbaa !9
  br label %156

156:                                              ; preds = %237, %235, %151
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %157, i32 0, i32 17
  %159 = load i32, ptr %12, align 4, !tbaa !9
  %160 = invoke noundef nonnull align 4 dereferenceable(128) ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEixEj(ptr noundef nonnull align 4 dereferenceable(4100) %158, i32 noundef %159)
          to label %161 unwind label %196

161:                                              ; preds = %156
  store ptr %160, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  %162 = load ptr, ptr %24, align 8, !tbaa !5
  %163 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::BodyPairQueue", ptr %162, i32 0, i32 2
  %164 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %163) #7
  store i32 %164, ptr %25, align 4, !tbaa !9
  %165 = load i32, ptr %25, align 4, !tbaa !9
  %166 = load ptr, ptr %24, align 8, !tbaa !5
  %167 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::BodyPairQueue", ptr %166, i32 0, i32 0
  %168 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %167) #7
  %169 = icmp uge i32 %165, %168
  br i1 %169, label %170, label %205

170:                                              ; preds = %161
  %171 = load i32, ptr %12, align 4, !tbaa !9
  %172 = add nsw i32 %171, 1
  %173 = load ptr, ptr %5, align 8, !tbaa !5
  %174 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %173, i32 0, i32 17
  %175 = invoke noundef i32 @_ZNK3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(4100) %174)
          to label %176 unwind label %200

176:                                              ; preds = %170
  %177 = urem i32 %172, %175
  store i32 %177, ptr %12, align 4, !tbaa !9
  %178 = load i32, ptr %12, align 4, !tbaa !9
  %179 = load i32, ptr %23, align 4, !tbaa !9
  %180 = icmp eq i32 %178, %179
  br i1 %180, label %181, label %204

181:                                              ; preds = %176
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPHL25sFinalizeContactAllocatorERNS_20PhysicsUpdateContext4StepERKNS_24ContactConstraintManager16ContactAllocatorE(ptr noundef nonnull align 8 dereferenceable(7344) %182, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %183 unwind label %200

183:                                              ; preds = %181
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  %185 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %184, i32 0, i32 19
  %186 = load i32, ptr %6, align 4, !tbaa !9
  %187 = shl i32 1, %186
  %188 = xor i32 %187, -1
  %189 = call noundef i32 @_ZNSt13__atomic_baseIjE9fetch_andEjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %185, i32 noundef %188, i32 noundef 3) #7
  %190 = load ptr, ptr %5, align 8, !tbaa !5
  %191 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %190, i32 0, i32 36
  invoke void @_ZNK3JPH9JobSystem9JobHandle16RemoveDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %191, i32 noundef 1)
          to label %192 unwind label %200

192:                                              ; preds = %183
  %193 = load ptr, ptr %5, align 8, !tbaa !5
  %194 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %193, i32 0, i32 39
  invoke void @_ZNK3JPH9JobSystem9JobHandle16RemoveDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %194, i32 noundef 1)
          to label %195 unwind label %200

195:                                              ; preds = %192
  store i32 1, ptr %26, align 4
  br label %235

196:                                              ; preds = %156
  %197 = landingpad { ptr, i32 }
          cleanup
  %198 = extractvalue { ptr, i32 } %197, 0
  store ptr %198, ptr %9, align 8
  %199 = extractvalue { ptr, i32 } %197, 1
  store i32 %199, ptr %10, align 4
  br label %239

200:                                              ; preds = %192, %183, %181, %170
  %201 = landingpad { ptr, i32 }
          cleanup
  %202 = extractvalue { ptr, i32 } %201, 0
  store ptr %202, ptr %9, align 8
  %203 = extractvalue { ptr, i32 } %201, 1
  store i32 %203, ptr %10, align 4
  br label %238

204:                                              ; preds = %176
  store i32 5, ptr %26, align 4
  br label %235, !llvm.loop !54

205:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %206 = load ptr, ptr %22, align 8, !tbaa !5
  %207 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %206, i32 0, i32 9
  %208 = load ptr, ptr %207, align 8, !tbaa !56
  %209 = load i32, ptr %12, align 4, !tbaa !9
  %210 = load ptr, ptr %5, align 8, !tbaa !5
  %211 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %210, i32 0, i32 18
  %212 = load i32, ptr %211, align 8, !tbaa !60
  %213 = mul i32 %209, %212
  %214 = load i32, ptr %25, align 4, !tbaa !9
  %215 = load ptr, ptr %5, align 8, !tbaa !5
  %216 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %215, i32 0, i32 18
  %217 = load i32, ptr %216, align 8, !tbaa !60
  %218 = urem i32 %214, %217
  %219 = add i32 %213, %218
  %220 = zext i32 %219 to i64
  %221 = getelementptr inbounds %"struct.JPH::BodyPair", ptr %208, i64 %220
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %27, ptr align 8 %221, i64 8, i1 false), !tbaa.struct !61
  %222 = load ptr, ptr %24, align 8, !tbaa !5
  %223 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::BodyPairQueue", ptr %222, i32 0, i32 2
  %224 = load i32, ptr %25, align 4, !tbaa !9
  %225 = add i32 %224, 1
  %226 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE23compare_exchange_strongERjjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %223, ptr noundef nonnull align 4 dereferenceable(4) %25, i32 noundef %225, i32 noundef 5) #7
  br i1 %226, label %227, label %233

227:                                              ; preds = %205
  invoke void @_ZN3JPH13PhysicsSystem15ProcessBodyPairERNS_24ContactConstraintManager16ContactAllocatorERKNS_8BodyPairE(ptr noundef nonnull align 16 dereferenceable(1172) %28, ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(8) %27)
          to label %228 unwind label %229

228:                                              ; preds = %227
  store i32 4, ptr %26, align 4
  br label %234

229:                                              ; preds = %227
  %230 = landingpad { ptr, i32 }
          cleanup
  %231 = extractvalue { ptr, i32 } %230, 0
  store ptr %231, ptr %9, align 8
  %232 = extractvalue { ptr, i32 } %230, 1
  store i32 %232, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %238

233:                                              ; preds = %205
  store i32 0, ptr %26, align 4
  br label %234

234:                                              ; preds = %233, %228
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %235

235:                                              ; preds = %234, %204, %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  %236 = load i32, ptr %26, align 4
  switch i32 %236, label %241 [
    i32 0, label %237
    i32 5, label %156
    i32 4, label %240
  ]

237:                                              ; preds = %235
  br label %156, !llvm.loop !54

238:                                              ; preds = %229, %200
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %239

239:                                              ; preds = %238, %196
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %248

240:                                              ; preds = %235
  store i32 0, ptr %26, align 4
  br label %241

241:                                              ; preds = %240, %235
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  %242 = load i32, ptr %26, align 4
  switch i32 %242, label %245 [
    i32 0, label %243
  ]

243:                                              ; preds = %241
  br label %244

244:                                              ; preds = %243, %149
  store i32 0, ptr %26, align 4
  br label %245

245:                                              ; preds = %244, %241
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  %246 = load i32, ptr %26, align 4
  switch i32 %246, label %249 [
    i32 0, label %247
  ]

247:                                              ; preds = %245
  br label %40, !llvm.loop !62

248:                                              ; preds = %239, %150, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %250

249:                                              ; preds = %245
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #7
  call void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #7
  ret void

250:                                              ; preds = %248, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %251

251:                                              ; preds = %250, %113
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #7
  call void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  br label %252

252:                                              ; preds = %251, %109
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #7
  br label %253

253:                                              ; preds = %252
  %254 = load ptr, ptr %9, align 8
  %255 = load i32, ptr %10, align 4
  %256 = insertvalue { ptr, i32 } poison, ptr %254, 0
  %257 = insertvalue { ptr, i32 } %256, i32 %255, 1
  resume { ptr, i32 } %257
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH24ContactConstraintManager19GetContactAllocatorEv(ptr dead_on_unwind noalias writable sret(%"class.JPH::ContactConstraintManager::ContactAllocator") align 8, ptr noundef nonnull align 8 dereferenceable(248)) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZZN3JPH13PhysicsSystem17JobFindCollisionsEPNS_20PhysicsUpdateContext4StepEiEN18MyBodyPairCallbackC2ES3_RNS_24ContactConstraintManager16ContactAllocatorEi(ptr noundef nonnull align 8 dereferenceable(44), ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(128) ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEixEj(ptr noundef nonnull align 4 dereferenceable(4100), i32 noundef) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN3JPHL25sFinalizeContactAllocatorERNS_20PhysicsUpdateContext4StepERKNS_24ContactConstraintManager16ContactAllocatorE(ptr noundef nonnull align 8 dereferenceable(7344), ptr noundef nonnull align 8 dereferenceable(32)) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH13PhysicsSystem15ProcessBodyPairERNS_24ContactConstraintManager16ContactAllocatorERKNS_8BodyPairE(ptr noundef nonnull align 16 dereferenceable(1172), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) #5 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 = { 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 #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 = { 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 #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 432}
!12 = !{!"_ZTSN3JPH13PhysicsSystemE", !6, i64 0, !6, i64 8, !13, i64 16, !24, i64 320, !26, i64 336, !27, i64 352, !27, i64 376, !28, i64 400, !28, i64 416, !6, i64 432, !6, i64 440, !6, i64 448, !29, i64 456, !31, i64 488, !33, i64 576, !36, i64 824, !38, i64 904, !39, i64 1016, !16, i64 1080, !40, i64 1128, !41, i64 1152, !32, i64 1168}
!13 = !{!"_ZTSN3JPH11BodyManagerE", !14, i64 0, !10, i64 24, !15, i64 32, !16, i64 40, !20, i64 88, !21, i64 104, !16, i64 128, !7, i64 176, !7, i64 192, !10, i64 200, !16, i64 208, !22, i64 256, !6, i64 280, !6, i64 288, !23, i64 296}
!14 = !{!"_ZTSN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEEE", !15, i64 0, !15, i64 8, !6, i64 16}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSN3JPH5MutexE", !17, i64 0, !19, i64 40}
!17 = !{!"_ZTSSt5mutex", !18, i64 0}
!18 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!19 = !{!"_ZTSNSt6thread2idE", !15, i64 0}
!20 = !{!"_ZTSN3JPH10MutexArrayINS_11SharedMutexEEE", !6, i64 0, !10, i64 8}
!21 = !{!"_ZTSN3JPH5ArrayIhNS_12STLAllocatorIhEEEE", !15, i64 0, !15, i64 8, !6, i64 16}
!22 = !{!"_ZTSN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEE", !15, i64 0, !15, i64 8, !6, i64 16}
!23 = !{!"bool", !7, i64 0}
!24 = !{!"_ZTSN3JPH23BodyLockInterfaceNoLockE", !25, i64 0}
!25 = !{!"_ZTSN3JPH17BodyLockInterfaceE", !6, i64 8}
!26 = !{!"_ZTSN3JPH24BodyLockInterfaceLockingE", !25, i64 0}
!27 = !{!"_ZTSN3JPH13BodyInterfaceE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"_ZTSN3JPH16NarrowPhaseQueryE", !6, i64 0, !6, i64 8}
!29 = !{!"_ZTSSt8functionIFvRKN3JPH4BodyES3_RKNS0_5Mat44ES6_RNS0_20CollideShapeSettingsERNS0_18CollisionCollectorINS0_18CollideShapeResultENS0_36CollisionCollectorTraitsCollideShapeEEERKNS0_11ShapeFilterEEE", !30, i64 0, !6, i64 24}
!30 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!31 = !{!"_ZTSN3JPH15PhysicsSettingsE", !10, i64 0, !10, i64 4, !10, i64 8, !32, i64 12, !32, i64 16, !32, i64 20, !32, i64 24, !32, i64 28, !32, i64 32, !32, i64 36, !32, i64 40, !32, i64 44, !32, i64 48, !32, i64 52, !10, i64 56, !10, i64 60, !32, i64 64, !32, i64 68, !32, i64 72, !23, i64 76, !23, i64 77, !23, i64 78, !23, i64 79, !23, i64 80, !23, i64 81, !23, i64 82}
!32 = !{!"float", !7, i64 0}
!33 = !{!"_ZTSN3JPH24ContactConstraintManagerE", !7, i64 8, !10, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !10, i64 232, !34, i64 236, !6, i64 240}
!34 = !{!"_ZTSSt6atomicIjE", !35, i64 0}
!35 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!36 = !{!"_ZTSN3JPH17ConstraintManagerE", !6, i64 0, !37, i64 8, !16, i64 32}
!37 = !{!"_ZTSN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEE", !15, i64 0, !15, i64 8, !6, i64 16}
!38 = !{!"_ZTSN3JPH13IslandBuilderE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108}
!39 = !{!"_ZTSN3JPH19LargeIslandSplitterE", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !34, i64 36, !10, i64 40, !6, i64 48, !34, i64 56}
!40 = !{!"_ZTSN3JPH5ArrayIPNS_19PhysicsStepListenerENS_12STLAllocatorIS2_EEEE", !15, i64 0, !15, i64 8, !6, i64 16}
!41 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!42 = !{!12, !32, i64 504}
!43 = !{!12, !6, i64 0}
!44 = !{!12, !6, i64 8}
!45 = !{!46, !46, i64 0}
!46 = !{!"vtable pointer", !8, i64 0}
!47 = !{!48, !6, i64 0}
!48 = !{!"_ZTSN3JPH20PhysicsUpdateContext4StepE", !6, i64 0, !23, i64 8, !23, i64 9, !49, i64 16, !10, i64 48, !34, i64 52, !7, i64 56, !34, i64 116, !7, i64 120, !34, i64 180, !7, i64 184, !34, i64 244, !7, i64 248, !34, i64 308, !7, i64 312, !34, i64 372, !7, i64 376, !50, i64 436, !10, i64 4536, !34, i64 4540, !34, i64 4544, !34, i64 4548, !34, i64 4552, !34, i64 4556, !34, i64 4560, !6, i64 4568, !10, i64 4576, !34, i64 4580, !34, i64 4584, !6, i64 4592, !10, i64 4600, !51, i64 4608, !53, i64 4616, !53, i64 4880, !53, i64 5144, !53, i64 5408, !51, i64 5672, !53, i64 5680, !51, i64 5944, !51, i64 5952, !51, i64 5960, !53, i64 5968, !51, i64 6232, !53, i64 6240, !51, i64 6504, !51, i64 6512, !53, i64 6520, !51, i64 6784, !51, i64 6792, !53, i64 6800, !53, i64 7064, !51, i64 7328, !51, i64 7336}
!49 = !{!"_ZTSN3JPH10BroadPhase11UpdateStateE", !7, i64 0}
!50 = !{!"_ZTSN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEE", !10, i64 0, !7, i64 4}
!51 = !{!"_ZTSN3JPH9JobSystem9JobHandleE", !52, i64 0}
!52 = !{!"_ZTSN3JPH3RefINS_9JobSystem3JobEEE", !6, i64 0}
!53 = !{!"_ZTSN3JPH11StaticArrayINS_9JobSystem9JobHandleELj32EEE", !10, i64 0, !7, i64 8}
!54 = distinct !{!54, !55}
!55 = !{!"llvm.loop.mustprogress"}
!56 = !{!57, !6, i64 56}
!57 = !{!"_ZTSN3JPH20PhysicsUpdateContextE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !32, i64 32, !32, i64 36, !34, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !58, i64 72, !10, i64 104, !6, i64 112, !34, i64 120}
!58 = !{!"_ZTSN3JPH5ArrayINS_20PhysicsUpdateContext4StepENS_16STLTempAllocatorIS2_EEEE", !59, i64 0, !15, i64 8, !15, i64 16, !6, i64 24}
!59 = !{!"_ZTSN3JPH16STLTempAllocatorINS_20PhysicsUpdateContext4StepEEE", !6, i64 0}
!60 = !{!48, !10, i64 4536}
!61 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}
!62 = distinct !{!62, !55}


; 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::BodyAccess::Grant" = type { i8 }
%"class.JPH::BodyManager::GrantActiveBodiesAccess" = type { i8 }
%"class.JPH::ContactConstraintManager::ContactAllocator" = type { %"class.JPH::LFHMAllocatorContext.base", i32, i32, i32 }
%"class.JPH::LFHMAllocatorContext.base" = type <{ ptr, i32, i32, i32 }>
%class.MyBodyPairCallback = type <{ %"class.JPH::CollisionCollector", ptr, ptr, i32, [4 x i8] }>
%"class.JPH::CollisionCollector" = type { ptr, float, ptr }
%"struct.JPH::BodyPair" = type { %"class.JPH::BodyID", %"class.JPH::BodyID" }
%"class.JPH::BodyID" = type { i32 }

; 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: 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: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3JPH9JobSystem9JobHandle16RemoveDependencyEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1), i8 noundef zeroext, i8 noundef zeroext) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessC2Ebb(ptr noundef nonnull align 1 dereferenceable(1), i1 noundef zeroext, i1 noundef zeroext) unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH11BodyManager21GetActiveBodiesUnsafeENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297), i8 noundef zeroext) local_unnamed_addr #2 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
declare dso_local void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1172), ptr noundef) local_unnamed_addr #5 align 2

; 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: mustprogress uwtable
define dso_local void @_ZN3JPH13PhysicsSystem17JobFindCollisionsEPNS_20PhysicsUpdateContext4StepEi(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.JPH::BodyAccess::Grant", align 1
  %5 = alloca %"class.JPH::BodyManager::GrantActiveBodiesAccess", align 1
  %6 = alloca %"class.JPH::ContactConstraintManager::ContactAllocator", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %class.MyBodyPairCallback, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.JPH::BodyPair", align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #7
  call void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1) %4, i8 noundef zeroext 1, i8 noundef zeroext 1)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #7
  invoke void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessC2Ebb(ptr noundef nonnull align 1 dereferenceable(1) %5, i1 noundef zeroext true, i1 noundef zeroext false)
          to label %13 unwind label %61

13:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  %14 = getelementptr inbounds i8, ptr %0, i64 576
  invoke void @_ZN3JPH24ContactConstraintManager19GetContactAllocatorEv(ptr dead_on_unwind nonnull writable sret(%"class.JPH::ContactConstraintManager::ContactAllocator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(248) %14)
          to label %15 unwind label %63

15:                                               ; preds = %13
  %16 = add nsw i32 %2, 1
  %17 = getelementptr inbounds i8, ptr %1, i64 436
  %18 = call noundef i32 @_ZNK3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(4100) %17)
  %19 = urem i32 %16, %18
  %20 = alloca [64 x i8], align 16
  %21 = getelementptr inbounds i8, ptr %1, i64 372
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  %23 = getelementptr inbounds i8, ptr %0, i64 432
  %24 = getelementptr inbounds i8, ptr %0, i64 504
  %25 = getelementptr inbounds i8, ptr %0, i64 8
  %26 = getelementptr inbounds i8, ptr %1, i64 4536
  br label %.outer

.outer:                                           ; preds = %113, %15
  %.055.ph = phi i32 [ %.156.ph, %113 ], [ %19, %15 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %27 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %21) #7
  store i32 %27, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  %28 = call noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297) %22, i8 noundef zeroext 0)
  store i32 %28, ptr %8, align 4, !tbaa !5
  %29 = load i32, ptr %7, align 4, !tbaa !5
  %30 = icmp ult i32 %29, %28
  br i1 %30, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.outer, %.backedge78
  %31 = phi i32 [ %117, %.backedge78 ], [ %29, %.outer ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %32 = add i32 %31, 16
  store i32 %32, ptr %9, align 4, !tbaa !5
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %34 = load i32, ptr %33, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  %35 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE23compare_exchange_strongERjjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %34, i32 noundef 5) #7
  br i1 %35, label %36, label %114

36:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %10) #7
  call void @_ZZN3JPH13PhysicsSystem17JobFindCollisionsEPNS_20PhysicsUpdateContext4StepEiEN18MyBodyPairCallbackC2ES3_RNS_24ContactConstraintManager16ContactAllocatorEi(ptr noundef nonnull align 8 dereferenceable(44) %10, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef %2)
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = sub i32 %34, %37
  %39 = call noundef ptr @_ZNK3JPH11BodyManager21GetActiveBodiesUnsafeENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297) %22, i8 noundef zeroext 0)
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds %"class.JPH::BodyID", ptr %39, i64 %41
  %43 = zext i32 %38 to i64
  %44 = shl nuw nsw i64 %43, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %20, ptr align 4 %42, i64 %44, i1 false)
  %45 = load ptr, ptr %23, align 16, !tbaa !9
  %46 = load float, ptr %24, align 8, !tbaa !41
  %47 = load ptr, ptr %0, align 16, !tbaa !42
  %48 = load ptr, ptr %25, align 8, !tbaa !43
  %49 = load ptr, ptr %45, align 8, !tbaa !44
  %50 = getelementptr inbounds i8, ptr %49, i64 168
  %51 = load ptr, ptr %50, align 8
  invoke void %51(ptr noundef nonnull align 8 dereferenceable(16) %45, ptr noundef nonnull %20, i32 noundef %38, float noundef %46, ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %52 unwind label %65

52:                                               ; preds = %36
  %53 = invoke noundef nonnull align 4 dereferenceable(128) ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEixEj(ptr noundef nonnull align 4 dereferenceable(4100) %17, i32 noundef %2)
          to label %54 unwind label %67

54:                                               ; preds = %52
  %55 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %53) #7
  %56 = getelementptr inbounds i8, ptr %53, i64 64
  %57 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %56) #7
  %58 = sub i32 %55, %57
  %59 = icmp ugt i32 %58, 15
  br i1 %59, label %60, label %71

60:                                               ; preds = %54
  invoke void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef %1)
          to label %71 unwind label %69

61:                                               ; preds = %3
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %121

63:                                               ; preds = %13
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %120

65:                                               ; preds = %36
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %72

67:                                               ; preds = %52
  %68 = landingpad { ptr, i32 }
          cleanup
  br label %72

69:                                               ; preds = %60
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %72

71:                                               ; preds = %60, %54
  call void @_ZN3JPH18CollisionCollectorINS_8BodyPairENS_36CollisionCollectorTraitsCollideShapeEED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %10) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  br label %.backedge78

72:                                               ; preds = %67, %69, %65
  %.pn64.pn = phi { ptr, i32 } [ %66, %65 ], [ %70, %69 ], [ %68, %67 ]
  call void @_ZN3JPH18CollisionCollectorINS_8BodyPairENS_36CollisionCollectorTraitsCollideShapeEED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %10) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %10) #7
  br label %119

._crit_edge:                                      ; preds = %.backedge78, %.outer
  %73 = load ptr, ptr %1, align 8, !tbaa !46
  %74 = getelementptr inbounds i8, ptr %73, i64 56
  br label %.backedge.outer

.backedge.outer:                                  ; preds = %.thread, %._crit_edge
  %.156.ph = phi i32 [ %83, %.thread ], [ %.055.ph, %._crit_edge ]
  br label %.backedge

.backedge:                                        ; preds = %.backedge.outer, %.thread89
  %75 = invoke noundef nonnull align 4 dereferenceable(128) ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEixEj(ptr noundef nonnull align 4 dereferenceable(4100) %17, i32 noundef %.156.ph)
          to label %76 unwind label %93

76:                                               ; preds = %.backedge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  %77 = getelementptr inbounds i8, ptr %75, i64 64
  %78 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %77) #7
  store i32 %78, ptr %11, align 4, !tbaa !5
  %79 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %75) #7
  %.not = icmp ult i32 %78, %79
  br i1 %.not, label %97, label %80

80:                                               ; preds = %76
  %81 = add nuw nsw i32 %.156.ph, 1
  %82 = call noundef i32 @_ZNK3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(4100) %17)
  %83 = urem i32 %81, %82
  %84 = icmp eq i32 %83, %.055.ph
  br i1 %84, label %85, label %.thread, !llvm.loop !53

.thread:                                          ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  br label %.backedge.outer, !llvm.loop !53

85:                                               ; preds = %80
  call void @_ZN3JPHL25sFinalizeContactAllocatorERNS_20PhysicsUpdateContext4StepERKNS_24ContactConstraintManager16ContactAllocatorE(ptr noundef nonnull align 8 dereferenceable(7344) %1, ptr noundef nonnull align 8 dereferenceable(32) %6)
  %86 = getelementptr inbounds i8, ptr %1, i64 4540
  %87 = shl nuw i32 1, %2
  %88 = xor i32 %87, -1
  %89 = call noundef i32 @_ZNSt13__atomic_baseIjE9fetch_andEjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %86, i32 noundef %88, i32 noundef 3) #7
  %90 = getelementptr inbounds i8, ptr %1, i64 5672
  invoke void @_ZNK3JPH9JobSystem9JobHandle16RemoveDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %90, i32 noundef 1)
          to label %91 unwind label %95

91:                                               ; preds = %85
  %92 = getelementptr inbounds i8, ptr %1, i64 5952
  invoke void @_ZNK3JPH9JobSystem9JobHandle16RemoveDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %92, i32 noundef 1)
          to label %.loopexit77 unwind label %95

93:                                               ; preds = %.backedge
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %119

95:                                               ; preds = %91, %85
  %96 = landingpad { ptr, i32 }
          cleanup
  br label %112

97:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %98 = load ptr, ptr %74, align 8, !tbaa !55
  %99 = load i32, ptr %26, align 8, !tbaa !59
  %100 = mul i32 %99, %.156.ph
  %101 = load i32, ptr %11, align 4, !tbaa !5
  %102 = urem i32 %101, %99
  %103 = add i32 %102, %100
  %104 = zext i32 %103 to i64
  %105 = getelementptr inbounds %"struct.JPH::BodyPair", ptr %98, i64 %104
  %106 = load i64, ptr %105, align 8
  store i64 %106, ptr %12, align 8
  %107 = add i32 %101, 1
  %108 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE23compare_exchange_strongERjjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %77, ptr noundef nonnull align 4 dereferenceable(4) %11, i32 noundef %107, i32 noundef 5) #7
  br i1 %108, label %109, label %.thread89

.thread89:                                        ; preds = %97
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  br label %.backedge, !llvm.loop !53

109:                                              ; preds = %97
  invoke void @_ZN3JPH13PhysicsSystem15ProcessBodyPairERNS_24ContactConstraintManager16ContactAllocatorERKNS_8BodyPairE(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %113 unwind label %110

110:                                              ; preds = %109
  %111 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  br label %112

112:                                              ; preds = %110, %95
  %.pn = phi { ptr, i32 } [ %96, %95 ], [ %111, %110 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  br label %119

113:                                              ; preds = %109
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  br label %.outer, !llvm.loop !60

114:                                              ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  br label %.backedge78

.backedge78:                                      ; preds = %114, %71
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %115 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %21) #7
  store i32 %115, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  %116 = call noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297) %22, i8 noundef zeroext 0)
  store i32 %116, ptr %8, align 4, !tbaa !5
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = icmp ult i32 %117, %116
  br i1 %118, label %.lr.ph, label %._crit_edge, !llvm.loop !60

119:                                              ; preds = %93, %112, %72
  %.pn64.pn.pn = phi { ptr, i32 } [ %.pn64.pn, %72 ], [ %.pn, %112 ], [ %94, %93 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  br label %120

.loopexit77:                                      ; preds = %91
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  call void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  ret void

120:                                              ; preds = %119, %63
  %.pn64.pn.pn.pn = phi { ptr, i32 } [ %.pn64.pn.pn, %119 ], [ %64, %63 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  call void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  br label %121

121:                                              ; preds = %120, %61
  %.pn64.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn64.pn.pn.pn, %120 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn64.pn.pn.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH24ContactConstraintManager19GetContactAllocatorEv(ptr dead_on_unwind noalias writable sret(%"class.JPH::ContactConstraintManager::ContactAllocator") align 8, ptr noundef nonnull align 8 dereferenceable(248)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZZN3JPH13PhysicsSystem17JobFindCollisionsEPNS_20PhysicsUpdateContext4StepEiEN18MyBodyPairCallbackC2ES3_RNS_24ContactConstraintManager16ContactAllocatorEi(ptr noundef nonnull align 8 dereferenceable(44), ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(128) ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEixEj(ptr noundef nonnull align 4 dereferenceable(4100), i32 noundef) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN3JPHL25sFinalizeContactAllocatorERNS_20PhysicsUpdateContext4StepERKNS_24ContactConstraintManager16ContactAllocatorE(ptr noundef nonnull align 8 dereferenceable(7344), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH13PhysicsSystem15ProcessBodyPairERNS_24ContactConstraintManager16ContactAllocatorERKNS_8BodyPairE(ptr noundef nonnull align 16 dereferenceable(1172), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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 #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 = !{!10, !11, i64 432}
!10 = !{!"_ZTSN3JPH13PhysicsSystemE", !11, i64 0, !11, i64 8, !12, i64 16, !23, i64 320, !25, i64 336, !26, i64 352, !26, i64 376, !27, i64 400, !27, i64 416, !11, i64 432, !11, i64 440, !11, i64 448, !28, i64 456, !30, i64 488, !32, i64 576, !35, i64 824, !37, i64 904, !38, i64 1016, !15, i64 1080, !39, i64 1128, !40, i64 1152, !31, i64 1168}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"_ZTSN3JPH11BodyManagerE", !13, i64 0, !6, i64 24, !14, i64 32, !15, i64 40, !19, i64 88, !20, i64 104, !15, i64 128, !7, i64 176, !7, i64 192, !6, i64 200, !15, i64 208, !21, i64 256, !11, i64 280, !11, i64 288, !22, i64 296}
!13 = !{!"_ZTSN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN3JPH5MutexE", !16, i64 0, !18, i64 40}
!16 = !{!"_ZTSSt5mutex", !17, i64 0}
!17 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!18 = !{!"_ZTSNSt6thread2idE", !14, i64 0}
!19 = !{!"_ZTSN3JPH10MutexArrayINS_11SharedMutexEEE", !11, i64 0, !6, i64 8}
!20 = !{!"_ZTSN3JPH5ArrayIhNS_12STLAllocatorIhEEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!21 = !{!"_ZTSN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTSN3JPH23BodyLockInterfaceNoLockE", !24, i64 0}
!24 = !{!"_ZTSN3JPH17BodyLockInterfaceE", !11, i64 8}
!25 = !{!"_ZTSN3JPH24BodyLockInterfaceLockingE", !24, i64 0}
!26 = !{!"_ZTSN3JPH13BodyInterfaceE", !11, i64 0, !11, i64 8, !11, i64 16}
!27 = !{!"_ZTSN3JPH16NarrowPhaseQueryE", !11, i64 0, !11, i64 8}
!28 = !{!"_ZTSSt8functionIFvRKN3JPH4BodyES3_RKNS0_5Mat44ES6_RNS0_20CollideShapeSettingsERNS0_18CollisionCollectorINS0_18CollideShapeResultENS0_36CollisionCollectorTraitsCollideShapeEEERKNS0_11ShapeFilterEEE", !29, i64 0, !11, i64 24}
!29 = !{!"_ZTSSt14_Function_base", !7, i64 0, !11, i64 16}
!30 = !{!"_ZTSN3JPH15PhysicsSettingsE", !6, i64 0, !6, i64 4, !6, i64 8, !31, i64 12, !31, i64 16, !31, i64 20, !31, i64 24, !31, i64 28, !31, i64 32, !31, i64 36, !31, i64 40, !31, i64 44, !31, i64 48, !31, i64 52, !6, i64 56, !6, i64 60, !31, i64 64, !31, i64 68, !31, i64 72, !22, i64 76, !22, i64 77, !22, i64 78, !22, i64 79, !22, i64 80, !22, i64 81, !22, i64 82}
!31 = !{!"float", !7, i64 0}
!32 = !{!"_ZTSN3JPH24ContactConstraintManagerE", !7, i64 8, !6, i64 184, !11, i64 192, !11, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !6, i64 232, !33, i64 236, !11, i64 240}
!33 = !{!"_ZTSSt6atomicIjE", !34, i64 0}
!34 = !{!"_ZTSSt13__atomic_baseIjE", !6, i64 0}
!35 = !{!"_ZTSN3JPH17ConstraintManagerE", !11, i64 0, !36, i64 8, !15, i64 32}
!36 = !{!"_ZTSN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!37 = !{!"_ZTSN3JPH13IslandBuilderE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !6, i64 88, !6, i64 92, !6, i64 96, !6, i64 100, !6, i64 104, !6, i64 108}
!38 = !{!"_ZTSN3JPH19LargeIslandSplitterE", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !6, i64 32, !33, i64 36, !6, i64 40, !11, i64 48, !33, i64 56}
!39 = !{!"_ZTSN3JPH5ArrayIPNS_19PhysicsStepListenerENS_12STLAllocatorIS2_EEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!40 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!41 = !{!10, !31, i64 504}
!42 = !{!10, !11, i64 0}
!43 = !{!10, !11, i64 8}
!44 = !{!45, !45, i64 0}
!45 = !{!"vtable pointer", !8, i64 0}
!46 = !{!47, !11, i64 0}
!47 = !{!"_ZTSN3JPH20PhysicsUpdateContext4StepE", !11, i64 0, !22, i64 8, !22, i64 9, !48, i64 16, !6, i64 48, !33, i64 52, !7, i64 56, !33, i64 116, !7, i64 120, !33, i64 180, !7, i64 184, !33, i64 244, !7, i64 248, !33, i64 308, !7, i64 312, !33, i64 372, !7, i64 376, !49, i64 436, !6, i64 4536, !33, i64 4540, !33, i64 4544, !33, i64 4548, !33, i64 4552, !33, i64 4556, !33, i64 4560, !11, i64 4568, !6, i64 4576, !33, i64 4580, !33, i64 4584, !11, i64 4592, !6, i64 4600, !50, i64 4608, !52, i64 4616, !52, i64 4880, !52, i64 5144, !52, i64 5408, !50, i64 5672, !52, i64 5680, !50, i64 5944, !50, i64 5952, !50, i64 5960, !52, i64 5968, !50, i64 6232, !52, i64 6240, !50, i64 6504, !50, i64 6512, !52, i64 6520, !50, i64 6784, !50, i64 6792, !52, i64 6800, !52, i64 7064, !50, i64 7328, !50, i64 7336}
!48 = !{!"_ZTSN3JPH10BroadPhase11UpdateStateE", !7, i64 0}
!49 = !{!"_ZTSN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEE", !6, i64 0, !7, i64 4}
!50 = !{!"_ZTSN3JPH9JobSystem9JobHandleE", !51, i64 0}
!51 = !{!"_ZTSN3JPH3RefINS_9JobSystem3JobEEE", !11, i64 0}
!52 = !{!"_ZTSN3JPH11StaticArrayINS_9JobSystem9JobHandleELj32EEE", !6, i64 0, !7, i64 8}
!53 = distinct !{!53, !54}
!54 = !{!"llvm.loop.mustprogress"}
!55 = !{!56, !11, i64 56}
!56 = !{!"_ZTSN3JPH20PhysicsUpdateContextE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !31, i64 32, !31, i64 36, !33, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !57, i64 72, !6, i64 104, !11, i64 112, !33, i64 120}
!57 = !{!"_ZTSN3JPH5ArrayINS_20PhysicsUpdateContext4StepENS_16STLTempAllocatorIS2_EEEE", !58, i64 0, !14, i64 8, !14, i64 16, !11, i64 24}
!58 = !{!"_ZTSN3JPH16STLTempAllocatorINS_20PhysicsUpdateContext4StepEEE", !11, i64 0}
!59 = !{!47, !6, i64 4536}
!60 = distinct !{!60, !54}


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