; LLVM IR from zig-gamedev/zphysics :: libs/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, %"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", [8 x i8], %"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 }
%"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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297), i8 noundef zeroext) #1 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) #2

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1140), ptr noundef) #5 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH13PhysicsSystem17JobFindCollisionsEPNS_20PhysicsUpdateContext4StepEi(ptr noundef nonnull align 16 dereferenceable(1140) %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %class.MyBodyPairCallback, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %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 %112

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 13
  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 %116

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 %120

37:                                               ; preds = %31
  %38 = urem i32 %33, %36
  store i32 %38, ptr %12, align 4, !tbaa !9
  br label %39

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

45:                                               ; preds = %39
  store i32 %44, ptr %14, align 4, !tbaa !9
  %46 = load i32, ptr %13, align 4, !tbaa !9
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = icmp ult i32 %46, %47
  br i1 %48, label %49, label %154

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %50 = load i32, ptr %13, align 4, !tbaa !9
  %51 = add i32 %50, 16
  store i32 %51, ptr %16, align 4, !tbaa !9
  %52 = invoke 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) %16)
          to label %53 unwind label %128

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

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

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

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

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

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

109:                                              ; preds = %99
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1140) %28, ptr noundef %110)
          to label %111 unwind label %144

111:                                              ; preds = %109
  br label %148

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

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

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

124:                                              ; preds = %39
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %9, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %10, align 4
  br label %251

128:                                              ; preds = %49
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %9, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %153

132:                                              ; preds = %59
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %9, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %10, align 4
  br label %151

136:                                              ; preds = %73, %62
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %9, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %10, align 4
  br label %150

140:                                              ; preds = %94
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %9, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %10, align 4
  br label %149

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

148:                                              ; preds = %111, %99
  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 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @_ZN3JPH18CollisionCollectorINS_8BodyPairENS_36CollisionCollectorTraitsCollideShapeEED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %17) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %17) #7
  br label %152

149:                                              ; preds = %144, %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %150

150:                                              ; preds = %149, %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @_ZN3JPH18CollisionCollectorINS_8BodyPairENS_36CollisionCollectorTraitsCollideShapeEED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %17) #7
  br label %151

151:                                              ; preds = %150, %132
  call void @llvm.lifetime.end.p0(i64 48, ptr %17) #7
  br label %153

152:                                              ; preds = %148, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %247

153:                                              ; preds = %151, %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %251

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

159:                                              ; preds = %240, %238, %154
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %160, i32 0, i32 17
  %162 = load i32, ptr %12, align 4, !tbaa !9
  %163 = invoke noundef nonnull align 4 dereferenceable(128) ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEixEj(ptr noundef nonnull align 4 dereferenceable(4100) %161, i32 noundef %162)
          to label %164 unwind label %199

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

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

179:                                              ; preds = %173
  %180 = urem i32 %175, %178
  store i32 %180, ptr %12, align 4, !tbaa !9
  %181 = load i32, ptr %12, align 4, !tbaa !9
  %182 = load i32, ptr %23, align 4, !tbaa !9
  %183 = icmp eq i32 %181, %182
  br i1 %183, label %184, label %207

184:                                              ; preds = %179
  %185 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPHL25sFinalizeContactAllocatorERNS_20PhysicsUpdateContext4StepERKNS_24ContactConstraintManager16ContactAllocatorE(ptr noundef nonnull align 8 dereferenceable(7344) %185, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %186 unwind label %203

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

195:                                              ; preds = %186
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = getelementptr inbounds %"struct.JPH::PhysicsUpdateContext::Step", ptr %196, i32 0, i32 39
  invoke void @_ZNK3JPH9JobSystem9JobHandle16RemoveDependencyEi(ptr noundef nonnull align 8 dereferenceable(8) %197, i32 noundef 1)
          to label %198 unwind label %203

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

199:                                              ; preds = %159
  %200 = landingpad { ptr, i32 }
          cleanup
  %201 = extractvalue { ptr, i32 } %200, 0
  store ptr %201, ptr %9, align 8
  %202 = extractvalue { ptr, i32 } %200, 1
  store i32 %202, ptr %10, align 4
  br label %242

203:                                              ; preds = %195, %186, %184, %173
  %204 = landingpad { ptr, i32 }
          cleanup
  %205 = extractvalue { ptr, i32 } %204, 0
  store ptr %205, ptr %9, align 8
  %206 = extractvalue { ptr, i32 } %204, 1
  store i32 %206, ptr %10, align 4
  br label %241

207:                                              ; preds = %179
  store i32 5, ptr %26, align 4
  br label %238, !llvm.loop !52

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

230:                                              ; preds = %208
  invoke void @_ZN3JPH13PhysicsSystem15ProcessBodyPairERNS_24ContactConstraintManager16ContactAllocatorERKNS_8BodyPairE(ptr noundef nonnull align 16 dereferenceable(1140) %28, ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(8) %27)
          to label %231 unwind label %232

231:                                              ; preds = %230
  store i32 4, ptr %26, align 4
  br label %237

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

236:                                              ; preds = %208
  store i32 0, ptr %26, align 4
  br label %237

237:                                              ; preds = %236, %231
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %238

238:                                              ; preds = %237, %207, %198
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  %239 = load i32, ptr %26, align 4
  switch i32 %239, label %244 [
    i32 0, label %240
    i32 5, label %159
    i32 4, label %243
  ]

240:                                              ; preds = %238
  br label %159, !llvm.loop !52

241:                                              ; preds = %232, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %242

242:                                              ; preds = %241, %199
  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 %251

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

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

246:                                              ; preds = %244
  br label %247

247:                                              ; preds = %246, %152
  store i32 0, ptr %26, align 4
  br label %248

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

250:                                              ; preds = %248
  br label %39, !llvm.loop !60

251:                                              ; preds = %242, %153, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %253

252:                                              ; preds = %248
  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

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

254:                                              ; preds = %253, %116
  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 %255

255:                                              ; preds = %254, %112
  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 %256

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

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

; 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(1140), 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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, !29, i64 448, !31, i64 536, !34, i64 784, !36, i64 864, !37, i64 976, !16, i64 1040, !38, i64 1088, !39, i64 1120, !30, i64 1136}
!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 = !{!"_ZTSN3JPH15PhysicsSettingsE", !10, i64 0, !10, i64 4, !10, i64 8, !30, i64 12, !30, i64 16, !30, i64 20, !30, i64 24, !30, i64 28, !30, i64 32, !30, i64 36, !30, i64 40, !30, i64 44, !30, i64 48, !30, i64 52, !10, i64 56, !10, i64 60, !30, i64 64, !30, i64 68, !30, i64 72, !23, i64 76, !23, i64 77, !23, i64 78, !23, i64 79, !23, i64 80, !23, i64 81, !23, i64 82}
!30 = !{!"float", !7, i64 0}
!31 = !{!"_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, !32, i64 236, !6, i64 240}
!32 = !{!"_ZTSSt6atomicIjE", !33, i64 0}
!33 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!34 = !{!"_ZTSN3JPH17ConstraintManagerE", !6, i64 0, !35, i64 8, !16, i64 32}
!35 = !{!"_ZTSN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEE", !15, i64 0, !15, i64 8, !6, i64 16}
!36 = !{!"_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}
!37 = !{!"_ZTSN3JPH19LargeIslandSplitterE", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !32, i64 36, !10, i64 40, !6, i64 48, !32, i64 56}
!38 = !{!"_ZTSN3JPH5ArrayIPNS_19PhysicsStepListenerENS_12STLAllocatorIS2_EEEE", !15, i64 0, !15, i64 8, !6, i64 16}
!39 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!40 = !{!12, !30, i64 464}
!41 = !{!12, !6, i64 0}
!42 = !{!12, !6, i64 8}
!43 = !{!44, !44, i64 0}
!44 = !{!"vtable pointer", !8, i64 0}
!45 = !{!46, !6, i64 0}
!46 = !{!"_ZTSN3JPH20PhysicsUpdateContext4StepE", !6, i64 0, !23, i64 8, !23, i64 9, !47, i64 16, !10, i64 48, !32, i64 52, !7, i64 56, !32, i64 116, !7, i64 120, !32, i64 180, !7, i64 184, !32, i64 244, !7, i64 248, !32, i64 308, !7, i64 312, !32, i64 372, !7, i64 376, !48, i64 436, !10, i64 4536, !32, i64 4540, !32, i64 4544, !32, i64 4548, !32, i64 4552, !32, i64 4556, !32, i64 4560, !6, i64 4568, !10, i64 4576, !32, i64 4580, !32, i64 4584, !6, i64 4592, !10, i64 4600, !49, i64 4608, !51, i64 4616, !51, i64 4880, !51, i64 5144, !51, i64 5408, !49, i64 5672, !51, i64 5680, !49, i64 5944, !49, i64 5952, !49, i64 5960, !51, i64 5968, !49, i64 6232, !51, i64 6240, !49, i64 6504, !49, i64 6512, !51, i64 6520, !49, i64 6784, !49, i64 6792, !51, i64 6800, !51, i64 7064, !49, i64 7328, !49, i64 7336}
!47 = !{!"_ZTSN3JPH10BroadPhase11UpdateStateE", !7, i64 0}
!48 = !{!"_ZTSN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEE", !10, i64 0, !7, i64 4}
!49 = !{!"_ZTSN3JPH9JobSystem9JobHandleE", !50, i64 0}
!50 = !{!"_ZTSN3JPH3RefINS_9JobSystem3JobEEE", !6, i64 0}
!51 = !{!"_ZTSN3JPH11StaticArrayINS_9JobSystem9JobHandleELj32EEE", !10, i64 0, !7, i64 8}
!52 = distinct !{!52, !53}
!53 = !{!"llvm.loop.mustprogress"}
!54 = !{!55, !6, i64 56}
!55 = !{!"_ZTSN3JPH20PhysicsUpdateContextE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !30, i64 32, !30, i64 36, !32, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !56, i64 72, !10, i64 104, !6, i64 112, !32, i64 120}
!56 = !{!"_ZTSN3JPH5ArrayINS_20PhysicsUpdateContext4StepENS_16STLTempAllocatorIS2_EEEE", !57, i64 0, !15, i64 8, !15, i64 16, !6, i64 24}
!57 = !{!"_ZTSN3JPH16STLTempAllocatorINS_20PhysicsUpdateContext4StepEEE", !6, i64 0}
!58 = !{!46, !10, i64 4536}
!59 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}
!60 = distinct !{!60, !53}


; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH11BodyManager18GetNumActiveBodiesENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297), i8 noundef zeroext) local_unnamed_addr #1 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) #2

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

; 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 #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 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 #1 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 #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH13PhysicsSystem25TrySpawnJobFindCollisionsEPNS_20PhysicsUpdateContext4StepE(ptr noundef nonnull align 16 dereferenceable(1140), 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 #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH13PhysicsSystem17JobFindCollisionsEPNS_20PhysicsUpdateContext4StepEi(ptr noundef nonnull align 16 dereferenceable(1140) %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 536
  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 = getelementptr inbounds i8, ptr %1, i64 372
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  %22 = getelementptr inbounds i8, ptr %0, i64 432
  %23 = getelementptr inbounds i8, ptr %0, i64 464
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  %25 = getelementptr inbounds i8, ptr %1, i64 4536
  br label %.outer

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

.lr.ph:                                           ; preds = %.outer, %.backedge79
  %30 = phi i32 [ %117, %.backedge79 ], [ %28, %.outer ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %31 = add i32 %30, 16
  store i32 %31, ptr %9, align 4, !tbaa !5
  %32 = 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)
  %33 = load i32, ptr %32, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  %34 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE23compare_exchange_strongERjjSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %33, i32 noundef 5) #7
  br i1 %34, label %35, label %114

35:                                               ; 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)
  %36 = load i32, ptr %7, align 4, !tbaa !5
  %37 = sub i32 %33, %36
  %38 = zext i32 %37 to i64
  %39 = shl nuw nsw i64 %38, 2
  %40 = alloca i8, i64 %39, align 16
  %41 = call noundef ptr @_ZNK3JPH11BodyManager21GetActiveBodiesUnsafeENS_9EBodyTypeE(ptr noundef nonnull align 8 dereferenceable(297) %21, i8 noundef zeroext 0)
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds %"class.JPH::BodyID", ptr %41, i64 %43
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %40, ptr align 4 %44, i64 %39, i1 false)
  %45 = load ptr, ptr %22, align 16, !tbaa !9
  %46 = load float, ptr %23, align 16, !tbaa !39
  %47 = load ptr, ptr %0, align 16, !tbaa !40
  %48 = load ptr, ptr %24, align 8, !tbaa !41
  %49 = load ptr, ptr %45, align 8, !tbaa !42
  %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 %40, i32 noundef %37, 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 = %35
  %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(1140) %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 = %35
  %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 %.backedge79

72:                                               ; preds = %67, %69, %65
  %.pn65.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 = %.backedge79, %.outer
  %73 = load ptr, ptr %1, align 8, !tbaa !44
  %74 = getelementptr inbounds i8, ptr %73, i64 56
  br label %.backedge.outer

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

.backedge:                                        ; preds = %.backedge.outer, %.thread90
  %75 = invoke noundef nonnull align 4 dereferenceable(128) ptr @_ZN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEixEj(ptr noundef nonnull align 4 dereferenceable(4100) %17, i32 noundef %.157.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 %.157.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, %.056.ph
  br i1 %84, label %85, label %.thread, !llvm.loop !51

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

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 5) #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 %.loopexit78 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 !53
  %99 = load i32, ptr %25, align 8, !tbaa !57
  %100 = mul i32 %99, %.157.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 %.thread90

.thread90:                                        ; 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 !51

109:                                              ; preds = %97
  invoke void @_ZN3JPH13PhysicsSystem15ProcessBodyPairERNS_24ContactConstraintManager16ContactAllocatorERKNS_8BodyPairE(ptr noundef nonnull align 16 dereferenceable(1140) %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 !58

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 %.backedge79

.backedge79:                                      ; 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) %20) #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) %21, 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 !58

119:                                              ; preds = %93, %112, %72
  %.pn65.pn.pn = phi { ptr, i32 } [ %.pn65.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

.loopexit78:                                      ; 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
  %.pn65.pn.pn.pn = phi { ptr, i32 } [ %.pn65.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
  %.pn65.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn65.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 } %.pn65.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 #1 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 #1 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 #1

; 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(1140), 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 = { 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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, !28, i64 448, !30, i64 536, !33, i64 784, !35, i64 864, !36, i64 976, !15, i64 1040, !37, i64 1088, !38, i64 1120, !29, i64 1136}
!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 = !{!"_ZTSN3JPH15PhysicsSettingsE", !6, i64 0, !6, i64 4, !6, i64 8, !29, i64 12, !29, i64 16, !29, i64 20, !29, i64 24, !29, i64 28, !29, i64 32, !29, i64 36, !29, i64 40, !29, i64 44, !29, i64 48, !29, i64 52, !6, i64 56, !6, i64 60, !29, i64 64, !29, i64 68, !29, i64 72, !22, i64 76, !22, i64 77, !22, i64 78, !22, i64 79, !22, i64 80, !22, i64 81, !22, i64 82}
!29 = !{!"float", !7, i64 0}
!30 = !{!"_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, !31, i64 236, !11, i64 240}
!31 = !{!"_ZTSSt6atomicIjE", !32, i64 0}
!32 = !{!"_ZTSSt13__atomic_baseIjE", !6, i64 0}
!33 = !{!"_ZTSN3JPH17ConstraintManagerE", !11, i64 0, !34, i64 8, !15, i64 32}
!34 = !{!"_ZTSN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!35 = !{!"_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}
!36 = !{!"_ZTSN3JPH19LargeIslandSplitterE", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !6, i64 32, !31, i64 36, !6, i64 40, !11, i64 48, !31, i64 56}
!37 = !{!"_ZTSN3JPH5ArrayIPNS_19PhysicsStepListenerENS_12STLAllocatorIS2_EEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!38 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!39 = !{!10, !29, i64 464}
!40 = !{!10, !11, i64 0}
!41 = !{!10, !11, i64 8}
!42 = !{!43, !43, i64 0}
!43 = !{!"vtable pointer", !8, i64 0}
!44 = !{!45, !11, i64 0}
!45 = !{!"_ZTSN3JPH20PhysicsUpdateContext4StepE", !11, i64 0, !22, i64 8, !22, i64 9, !46, i64 16, !6, i64 48, !31, i64 52, !7, i64 56, !31, i64 116, !7, i64 120, !31, i64 180, !7, i64 184, !31, i64 244, !7, i64 248, !31, i64 308, !7, i64 312, !31, i64 372, !7, i64 376, !47, i64 436, !6, i64 4536, !31, i64 4540, !31, i64 4544, !31, i64 4548, !31, i64 4552, !31, i64 4556, !31, i64 4560, !11, i64 4568, !6, i64 4576, !31, i64 4580, !31, i64 4584, !11, i64 4592, !6, i64 4600, !48, i64 4608, !50, i64 4616, !50, i64 4880, !50, i64 5144, !50, i64 5408, !48, i64 5672, !50, i64 5680, !48, i64 5944, !48, i64 5952, !48, i64 5960, !50, i64 5968, !48, i64 6232, !50, i64 6240, !48, i64 6504, !48, i64 6512, !50, i64 6520, !48, i64 6784, !48, i64 6792, !50, i64 6800, !50, i64 7064, !48, i64 7328, !48, i64 7336}
!46 = !{!"_ZTSN3JPH10BroadPhase11UpdateStateE", !7, i64 0}
!47 = !{!"_ZTSN3JPH11StaticArrayINS_20PhysicsUpdateContext13BodyPairQueueELj32EEE", !6, i64 0, !7, i64 4}
!48 = !{!"_ZTSN3JPH9JobSystem9JobHandleE", !49, i64 0}
!49 = !{!"_ZTSN3JPH3RefINS_9JobSystem3JobEEE", !11, i64 0}
!50 = !{!"_ZTSN3JPH11StaticArrayINS_9JobSystem9JobHandleELj32EEE", !6, i64 0, !7, i64 8}
!51 = distinct !{!51, !52}
!52 = !{!"llvm.loop.mustprogress"}
!53 = !{!54, !11, i64 56}
!54 = !{!"_ZTSN3JPH20PhysicsUpdateContextE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !29, i64 32, !29, i64 36, !31, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !55, i64 72, !6, i64 104, !11, i64 112, !31, i64 120}
!55 = !{!"_ZTSN3JPH5ArrayINS_20PhysicsUpdateContext4StepENS_16STLTempAllocatorIS2_EEEE", !56, i64 0, !14, i64 8, !14, i64 16, !11, i64 24}
!56 = !{!"_ZTSN3JPH16STLTempAllocatorINS_20PhysicsUpdateContext4StepEEE", !11, i64 0}
!57 = !{!45, !6, i64 4536}
!58 = distinct !{!58, !52}


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