; 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::Vec3" = type { %union.anon.13 }
%union.anon.13 = type { <4 x float> }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.42 }
%union.anon.42 = type { <4 x float> }
%"class.JPH::BodyID" = type { i32 }
%"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 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::SoftBodyUpdateContext" = type <{ ptr, ptr, ptr, ptr, %"class.JPH::Mat44", %"class.JPH::Vec3", %"class.JPH::Vec3", float, float, %"struct.std::atomic.74", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", [8 x i8], %"class.JPH::Vec3", i32, [12 x i8] }>
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"struct.std::atomic.74" = 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 }
%"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 }

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122)) #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH13PhysicsSystem19JobSoftBodyFinalizeEPNS_20PhysicsUpdateContextE(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.JPH::BodyAccess::Grant", align 1
  %6 = alloca %"class.JPH::BodyManager::GrantActiveBodiesAccess", align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.JPH::Vec3", align 16
  %16 = alloca %"class.JPH::Vec3", align 16
  %17 = alloca %"class.JPH::Vec3", align 16
  %18 = alloca %"class.JPH::Quat", align 16
  %19 = alloca %"class.JPH::BodyID", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #8
  call void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1) %5, i8 noundef zeroext 3, i8 noundef zeroext 3)
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #8
  invoke void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessC2Ebb(ptr noundef nonnull align 1 dereferenceable(1) %6, i1 noundef zeroext true, i1 noundef zeroext true)
          to label %21 unwind label %40

21:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %22 = alloca i8, i64 256, align 16
  store ptr %22, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %23 = alloca i8, i64 256, align 16
  store ptr %23, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %24, i32 0, i32 14
  %26 = load ptr, ptr %25, align 8, !tbaa !11
  store ptr %26, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %27, i32 0, i32 14
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %30, i32 0, i32 12
  %32 = load i32, ptr %31, align 8, !tbaa !19
  %33 = zext i32 %32 to i64
  %34 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %29, i64 %33
  store ptr %34, ptr %14, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %154, %21
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = load ptr, ptr %14, align 8, !tbaa !5
  %38 = icmp ult ptr %36, %37
  br i1 %38, label %44, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %158

40:                                               ; preds = %2
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %7, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %8, align 4
  br label %200

44:                                               ; preds = %35
  %45 = load ptr, ptr %13, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !20
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3JPH13PhysicsSystem22GetBodyInterfaceNoLockEv(ptr noundef nonnull align 16 dereferenceable(1172) %20)
          to label %50 unwind label %122

50:                                               ; preds = %44
  invoke void @_ZN3JPH24SoftBodyMotionProperties25UpdateRigidBodyVelocitiesERKNS_21SoftBodyUpdateContextERNS_13BodyInterfaceE(ptr noundef nonnull align 16 dereferenceable(372) %47, ptr noundef nonnull align 16 dereferenceable(196) %48, ptr noundef nonnull align 8 dereferenceable(24) %49)
          to label %51 unwind label %122

51:                                               ; preds = %50
  %52 = load ptr, ptr %13, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 16, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #8
  %55 = load ptr, ptr %13, align 8, !tbaa !5
  %56 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 16, !tbaa !27
  %58 = invoke { double, double } @_ZNK3JPH4Body11GetPositionEv(ptr noundef nonnull align 16 dereferenceable(122) %57)
          to label %59 unwind label %126

59:                                               ; preds = %51
  %60 = getelementptr inbounds %"class.JPH::Vec3", ptr %16, i32 0, i32 0
  %61 = getelementptr inbounds %union.anon.13, ptr %60, i32 0, i32 0
  %62 = getelementptr inbounds { double, double }, ptr %61, i32 0, i32 0
  %63 = extractvalue { double, double } %58, 0
  store double %63, ptr %62, align 16
  %64 = getelementptr inbounds { double, double }, ptr %61, i32 0, i32 1
  %65 = extractvalue { double, double } %58, 1
  store double %65, ptr %64, align 8
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %66, i32 0, i32 18
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %17, ptr align 16 %67, i64 16, i1 false), !tbaa.struct !28
  %68 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 0
  %69 = load double, ptr %68, align 16
  %70 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 1
  %71 = load double, ptr %70, align 8
  %72 = invoke { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16) %16, double %69, double %71)
          to label %73 unwind label %126

73:                                               ; preds = %59
  %74 = getelementptr inbounds %"class.JPH::Vec3", ptr %15, i32 0, i32 0
  %75 = getelementptr inbounds %union.anon.13, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds { double, double }, ptr %75, i32 0, i32 0
  %77 = extractvalue { double, double } %72, 0
  store double %77, ptr %76, align 16
  %78 = getelementptr inbounds { double, double }, ptr %75, i32 0, i32 1
  %79 = extractvalue { double, double } %72, 1
  store double %79, ptr %78, align 8
  %80 = load ptr, ptr %13, align 8, !tbaa !5
  %81 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 16, !tbaa !27
  %83 = invoke { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122) %82)
          to label %84 unwind label %126

84:                                               ; preds = %73
  %85 = getelementptr inbounds %"class.JPH::Quat", ptr %18, i32 0, i32 0
  %86 = getelementptr inbounds %"class.JPH::Vec4", ptr %85, i32 0, i32 0
  %87 = getelementptr inbounds %union.anon.42, ptr %86, i32 0, i32 0
  %88 = getelementptr inbounds { double, double }, ptr %87, i32 0, i32 0
  %89 = extractvalue { double, double } %83, 0
  store double %89, ptr %88, align 16
  %90 = getelementptr inbounds { double, double }, ptr %87, i32 0, i32 1
  %91 = extractvalue { double, double } %83, 1
  store double %91, ptr %90, align 8
  %92 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 0
  %93 = load double, ptr %92, align 16
  %94 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 1
  %95 = load double, ptr %94, align 8
  %96 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %97 = load double, ptr %96, align 16
  %98 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %99 = load double, ptr %98, align 8
  invoke void @_ZN3JPH4Body30SetPositionAndRotationInternalENS_4Vec3ENS_4QuatEb(ptr noundef nonnull align 16 dereferenceable(122) %54, double %93, double %95, double %97, double %99, i1 noundef zeroext false)
          to label %100 unwind label %126

100:                                              ; preds = %84
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %101 = load ptr, ptr %13, align 8, !tbaa !5
  %102 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 16, !tbaa !27
  %104 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %103)
          to label %105 unwind label %130

105:                                              ; preds = %100
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %104, i64 4, i1 false), !tbaa.struct !30
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = load i32, ptr %10, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %10, align 4, !tbaa !9
  %109 = sext i32 %107 to i64
  %110 = getelementptr inbounds %"class.JPH::BodyID", ptr %106, i64 %109
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %110, ptr align 4 %19, i64 4, i1 false), !tbaa.struct !30
  %111 = load i32, ptr %10, align 4, !tbaa !9
  %112 = icmp eq i32 %111, 64
  br i1 %112, label %113, label %134

113:                                              ; preds = %105
  %114 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %20, i32 0, i32 9
  %115 = load ptr, ptr %114, align 16, !tbaa !31
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  %117 = load i32, ptr %10, align 4, !tbaa !9
  %118 = load ptr, ptr %115, align 8, !tbaa !57
  %119 = getelementptr inbounds ptr, ptr %118, i64 19
  %120 = load ptr, ptr %119, align 8
  invoke void %120(ptr noundef nonnull align 8 dereferenceable(16) %115, ptr noundef %116, i32 noundef %117, i1 noundef zeroext false)
          to label %121 unwind label %130

121:                                              ; preds = %113
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %134

122:                                              ; preds = %50, %44
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %7, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %8, align 4
  br label %157

126:                                              ; preds = %84, %73, %59, %51
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %7, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #8
  br label %157

130:                                              ; preds = %147, %113, %100
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %7, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %157

134:                                              ; preds = %121, %105
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %135, i32 0, i32 19
  %137 = load i32, ptr %136, align 16, !tbaa !59
  %138 = icmp eq i32 %137, 1
  br i1 %138, label %139, label %153

139:                                              ; preds = %134
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  %141 = load i32, ptr %12, align 4, !tbaa !9
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %12, align 4, !tbaa !9
  %143 = sext i32 %141 to i64
  %144 = getelementptr inbounds %"class.JPH::BodyID", ptr %140, i64 %143
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %144, ptr align 4 %19, i64 4, i1 false), !tbaa.struct !30
  %145 = load i32, ptr %12, align 4, !tbaa !9
  %146 = icmp eq i32 %145, 64
  br i1 %146, label %147, label %152

147:                                              ; preds = %139
  %148 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %20, i32 0, i32 2
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = load i32, ptr %12, align 4, !tbaa !9
  invoke void @_ZN3JPH11BodyManager16DeactivateBodiesEPKNS_6BodyIDEi(ptr noundef nonnull align 8 dereferenceable(297) %148, ptr noundef %149, i32 noundef %150)
          to label %151 unwind label %130

151:                                              ; preds = %147
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %152

152:                                              ; preds = %151, %139
  br label %153

153:                                              ; preds = %152, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %154

154:                                              ; preds = %153
  %155 = load ptr, ptr %13, align 8, !tbaa !5
  %156 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %155, i32 1
  store ptr %156, ptr %13, align 8, !tbaa !5
  br label %35, !llvm.loop !60

157:                                              ; preds = %130, %126, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %199

158:                                              ; preds = %39
  %159 = load i32, ptr %10, align 4, !tbaa !9
  %160 = icmp sgt i32 %159, 0
  br i1 %160, label %161, label %174

161:                                              ; preds = %158
  %162 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %20, i32 0, i32 9
  %163 = load ptr, ptr %162, align 16, !tbaa !31
  %164 = load ptr, ptr %9, align 8, !tbaa !5
  %165 = load i32, ptr %10, align 4, !tbaa !9
  %166 = load ptr, ptr %163, align 8, !tbaa !57
  %167 = getelementptr inbounds ptr, ptr %166, i64 19
  %168 = load ptr, ptr %167, align 8
  invoke void %168(ptr noundef nonnull align 8 dereferenceable(16) %163, ptr noundef %164, i32 noundef %165, i1 noundef zeroext false)
          to label %169 unwind label %170

169:                                              ; preds = %161
  br label %174

170:                                              ; preds = %182, %177, %161
  %171 = landingpad { ptr, i32 }
          cleanup
  %172 = extractvalue { ptr, i32 } %171, 0
  store ptr %172, ptr %7, align 8
  %173 = extractvalue { ptr, i32 } %171, 1
  store i32 %173, ptr %8, align 4
  br label %199

174:                                              ; preds = %169, %158
  %175 = load i32, ptr %12, align 4, !tbaa !9
  %176 = icmp sgt i32 %175, 0
  br i1 %176, label %177, label %182

177:                                              ; preds = %174
  %178 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %20, i32 0, i32 2
  %179 = load ptr, ptr %11, align 8, !tbaa !5
  %180 = load i32, ptr %12, align 4, !tbaa !9
  invoke void @_ZN3JPH11BodyManager16DeactivateBodiesEPKNS_6BodyIDEi(ptr noundef nonnull align 8 dereferenceable(297) %178, ptr noundef %179, i32 noundef %180)
          to label %181 unwind label %170

181:                                              ; preds = %177
  br label %182

182:                                              ; preds = %181, %174
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %183, i32 0, i32 1
  %185 = load ptr, ptr %184, align 8, !tbaa !62
  %186 = load ptr, ptr %4, align 8, !tbaa !5
  %187 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %186, i32 0, i32 14
  %188 = load ptr, ptr %187, align 8, !tbaa !11
  %189 = load ptr, ptr %4, align 8, !tbaa !5
  %190 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %189, i32 0, i32 12
  %191 = load i32, ptr %190, align 8, !tbaa !19
  %192 = zext i32 %191 to i64
  %193 = mul i64 %192, 208
  %194 = trunc i64 %193 to i32
  %195 = load ptr, ptr %185, align 8, !tbaa !57
  %196 = getelementptr inbounds ptr, ptr %195, i64 3
  %197 = load ptr, ptr %196, align 8
  invoke void %197(ptr noundef nonnull align 8 dereferenceable(8) %185, ptr noundef %188, i32 noundef %194)
          to label %198 unwind label %170

198:                                              ; preds = %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #8
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #8
  ret void

199:                                              ; preds = %170, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  br label %200

200:                                              ; preds = %199, %40
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #8
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #8
  br label %201

201:                                              ; preds = %200
  %202 = load ptr, ptr %7, align 8
  %203 = load i32, ptr %8, align 4
  %204 = insertvalue { ptr, i32 } poison, ptr %202, 0
  %205 = insertvalue { ptr, i32 } %204, i32 %203, 1
  resume { ptr, i32 } %205
}

declare void @_ZN3JPH24SoftBodyMotionProperties25UpdateRigidBodyVelocitiesERKNS_21SoftBodyUpdateContextERNS_13BodyInterfaceE(ptr noundef nonnull align 16 dereferenceable(372), ptr noundef nonnull align 16 dereferenceable(196), ptr noundef nonnull align 8 dereferenceable(24)) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3JPH13PhysicsSystem22GetBodyInterfaceNoLockEv(ptr noundef nonnull align 16 dereferenceable(1172)) #7 align 2

declare void @_ZN3JPH4Body30SetPositionAndRotationInternalENS_4Vec3ENS_4QuatEb(ptr noundef nonnull align 16 dereferenceable(122), double, double, double, double, i1 noundef zeroext) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Body11GetPositionEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

declare void @_ZN3JPH11BodyManager16DeactivateBodiesEPKNS_6BodyIDEi(ptr noundef nonnull align 8 dereferenceable(297), ptr noundef, i32 noundef) #6

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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 112}
!12 = !{!"_ZTSN3JPH20PhysicsUpdateContextE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !14, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !16, i64 72, !10, i64 104, !6, i64 112, !14, i64 120}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_ZTSSt6atomicIjE", !15, i64 0}
!15 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!16 = !{!"_ZTSN3JPH5ArrayINS_20PhysicsUpdateContext4StepENS_16STLTempAllocatorIS2_EEEE", !17, i64 0, !18, i64 8, !18, i64 16, !6, i64 24}
!17 = !{!"_ZTSN3JPH16STLTempAllocatorINS_20PhysicsUpdateContext4StepEEE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!12, !10, i64 104}
!20 = !{!21, !6, i64 8}
!21 = !{!"_ZTSN3JPH21SoftBodyUpdateContextE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !22, i64 32, !23, i64 96, !23, i64 112, !13, i64 128, !13, i64 132, !24, i64 136, !14, i64 140, !14, i64 144, !14, i64 148, !14, i64 152, !14, i64 156, !14, i64 160, !14, i64 164, !23, i64 176, !26, i64 192}
!22 = !{!"_ZTSN3JPH5Mat44E", !7, i64 0}
!23 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!24 = !{!"_ZTSSt6atomicIN3JPH21SoftBodyUpdateContext6EStateEE", !25, i64 0}
!25 = !{!"_ZTSN3JPH21SoftBodyUpdateContext6EStateE", !7, i64 0}
!26 = !{!"_ZTSN3JPH9ECanSleepE", !7, i64 0}
!27 = !{!21, !6, i64 0}
!28 = !{i64 0, i64 16, !29}
!29 = !{!7, !7, i64 0}
!30 = !{i64 0, i64 4, !9}
!31 = !{!32, !6, i64 432}
!32 = !{!"_ZTSN3JPH13PhysicsSystemE", !6, i64 0, !6, i64 8, !33, i64 16, !43, i64 320, !45, i64 336, !46, i64 352, !46, i64 376, !47, i64 400, !47, i64 416, !6, i64 432, !6, i64 440, !6, i64 448, !48, i64 456, !50, i64 488, !51, i64 576, !52, i64 824, !54, i64 904, !55, i64 1016, !35, i64 1080, !56, i64 1128, !23, i64 1152, !13, i64 1168}
!33 = !{!"_ZTSN3JPH11BodyManagerE", !34, i64 0, !10, i64 24, !18, i64 32, !35, i64 40, !39, i64 88, !40, i64 104, !35, i64 128, !7, i64 176, !7, i64 192, !10, i64 200, !35, i64 208, !41, i64 256, !6, i64 280, !6, i64 288, !42, i64 296}
!34 = !{!"_ZTSN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEEE", !18, i64 0, !18, i64 8, !6, i64 16}
!35 = !{!"_ZTSN3JPH5MutexE", !36, i64 0, !38, i64 40}
!36 = !{!"_ZTSSt5mutex", !37, i64 0}
!37 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!38 = !{!"_ZTSNSt6thread2idE", !18, i64 0}
!39 = !{!"_ZTSN3JPH10MutexArrayINS_11SharedMutexEEE", !6, i64 0, !10, i64 8}
!40 = !{!"_ZTSN3JPH5ArrayIhNS_12STLAllocatorIhEEEE", !18, i64 0, !18, i64 8, !6, i64 16}
!41 = !{!"_ZTSN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEE", !18, i64 0, !18, i64 8, !6, i64 16}
!42 = !{!"bool", !7, i64 0}
!43 = !{!"_ZTSN3JPH23BodyLockInterfaceNoLockE", !44, i64 0}
!44 = !{!"_ZTSN3JPH17BodyLockInterfaceE", !6, i64 8}
!45 = !{!"_ZTSN3JPH24BodyLockInterfaceLockingE", !44, i64 0}
!46 = !{!"_ZTSN3JPH13BodyInterfaceE", !6, i64 0, !6, i64 8, !6, i64 16}
!47 = !{!"_ZTSN3JPH16NarrowPhaseQueryE", !6, i64 0, !6, i64 8}
!48 = !{!"_ZTSSt8functionIFvRKN3JPH4BodyES3_RKNS0_5Mat44ES6_RNS0_20CollideShapeSettingsERNS0_18CollisionCollectorINS0_18CollideShapeResultENS0_36CollisionCollectorTraitsCollideShapeEEERKNS0_11ShapeFilterEEE", !49, i64 0, !6, i64 24}
!49 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!50 = !{!"_ZTSN3JPH15PhysicsSettingsE", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !10, i64 56, !10, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !42, i64 76, !42, i64 77, !42, i64 78, !42, i64 79, !42, i64 80, !42, i64 81, !42, i64 82}
!51 = !{!"_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, !14, i64 236, !6, i64 240}
!52 = !{!"_ZTSN3JPH17ConstraintManagerE", !6, i64 0, !53, i64 8, !35, i64 32}
!53 = !{!"_ZTSN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEE", !18, i64 0, !18, i64 8, !6, i64 16}
!54 = !{!"_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}
!55 = !{!"_ZTSN3JPH19LargeIslandSplitterE", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !14, i64 36, !10, i64 40, !6, i64 48, !14, i64 56}
!56 = !{!"_ZTSN3JPH5ArrayIPNS_19PhysicsStepListenerENS_12STLAllocatorIS2_EEEE", !18, i64 0, !18, i64 8, !6, i64 16}
!57 = !{!58, !58, i64 0}
!58 = !{!"vtable pointer", !8, i64 0}
!59 = !{!21, !26, i64 192}
!60 = distinct !{!60, !61}
!61 = !{!"llvm.loop.mustprogress"}
!62 = !{!12, !6, i64 8}


; 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::Vec3" = type { %union.anon.13 }
%union.anon.13 = type { <4 x float> }
%"class.JPH::SoftBodyUpdateContext" = type <{ ptr, ptr, ptr, ptr, %"class.JPH::Mat44", %"class.JPH::Vec3", %"class.JPH::Vec3", float, float, %"struct.std::atomic.74", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", [8 x i8], %"class.JPH::Vec3", i32, [12 x i8] }>
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::Vec4" = type { %union.anon.42 }
%union.anon.42 = type { <4 x float> }
%"struct.std::atomic.74" = type { i32 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"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 uwtable
declare dso_local void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1), i8 noundef zeroext, i8 noundef zeroext) unnamed_addr #1 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 #1 align 2

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH13PhysicsSystem19JobSoftBodyFinalizeEPNS_20PhysicsUpdateContextE(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.JPH::BodyAccess::Grant", align 1
  %4 = alloca %"class.JPH::BodyManager::GrantActiveBodiesAccess", align 1
  %5 = alloca %"class.JPH::Vec3", align 16
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #7
  call void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1) %3, i8 noundef zeroext 3, i8 noundef zeroext 3)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #7
  invoke void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessC2Ebb(ptr noundef nonnull align 1 dereferenceable(1) %4, i1 noundef zeroext true, i1 noundef zeroext true)
          to label %6 unwind label %19

6:                                                ; preds = %2
  %7 = alloca [256 x i8], align 16
  %8 = alloca [256 x i8], align 16
  %9 = getelementptr inbounds i8, ptr %1, i64 112
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %1, i64 104
  %12 = load i32, ptr %11, align 8, !tbaa !17
  %13 = zext i32 %12 to i64
  %14 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %10, i64 %13
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %6
  %15 = getelementptr inbounds i8, ptr %5, i64 8
  %16 = getelementptr inbounds i8, ptr %0, i64 432
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  br label %21

._crit_edge:                                      ; preds = %69
  %18 = icmp sgt i32 %.146, 0
  br i1 %18, label %72, label %80

19:                                               ; preds = %2
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %94

21:                                               ; preds = %.lr.ph, %69
  %.04565 = phi i32 [ 0, %.lr.ph ], [ %.146, %69 ]
  %.04764 = phi i32 [ 0, %.lr.ph ], [ %.148, %69 ]
  %.04963 = phi ptr [ %10, %.lr.ph ], [ %70, %69 ]
  %22 = getelementptr inbounds i8, ptr %.04963, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN3JPH13PhysicsSystem22GetBodyInterfaceNoLockEv(ptr noundef nonnull align 16 dereferenceable(1172) %0)
  invoke void @_ZN3JPH24SoftBodyMotionProperties25UpdateRigidBodyVelocitiesERKNS_21SoftBodyUpdateContextERNS_13BodyInterfaceE(ptr noundef nonnull align 16 dereferenceable(372) %23, ptr noundef nonnull align 16 dereferenceable(196) %.04963, ptr noundef nonnull align 8 dereferenceable(24) %24)
          to label %25 unwind label %53

25:                                               ; preds = %21
  %26 = load ptr, ptr %.04963, align 16, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %27 = invoke { double, double } @_ZNK3JPH4Body11GetPositionEv(ptr noundef nonnull align 16 dereferenceable(122) %26)
          to label %28 unwind label %55

28:                                               ; preds = %25
  %29 = extractvalue { double, double } %27, 0
  store double %29, ptr %5, align 16
  %30 = extractvalue { double, double } %27, 1
  store double %30, ptr %15, align 8
  %31 = getelementptr inbounds i8, ptr %.04963, i64 176
  %.sroa.04.0.copyload = load double, ptr %31, align 16
  %.sroa.25.0..sroa_idx = getelementptr inbounds i8, ptr %.04963, i64 184
  %.sroa.25.0.copyload = load double, ptr %.sroa.25.0..sroa_idx, align 8, !tbaa !26
  %32 = invoke { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %.sroa.04.0.copyload, double %.sroa.25.0.copyload)
          to label %33 unwind label %55

33:                                               ; preds = %28
  %34 = load ptr, ptr %.04963, align 16, !tbaa !25
  %35 = invoke { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122) %34)
          to label %36 unwind label %55

36:                                               ; preds = %33
  %37 = extractvalue { double, double } %32, 1
  %38 = extractvalue { double, double } %32, 0
  %39 = extractvalue { double, double } %35, 0
  %40 = extractvalue { double, double } %35, 1
  invoke void @_ZN3JPH4Body30SetPositionAndRotationInternalENS_4Vec3ENS_4QuatEb(ptr noundef nonnull align 16 dereferenceable(122) %26, double %38, double %37, double %39, double %40, i1 noundef zeroext false)
          to label %41 unwind label %55

41:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  %42 = load ptr, ptr %.04963, align 16, !tbaa !25
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %42)
  %.sroa.0.0.copyload = load i32, ptr %43, align 4, !tbaa !27
  %44 = add nsw i32 %.04565, 1
  %45 = sext i32 %.04565 to i64
  %46 = getelementptr inbounds %"class.JPH::BodyID", ptr %7, i64 %45
  store i32 %.sroa.0.0.copyload, ptr %46, align 4, !tbaa !27
  %47 = icmp eq i32 %44, 64
  br i1 %47, label %48, label %59

48:                                               ; preds = %41
  %49 = load ptr, ptr %16, align 16, !tbaa !28
  %50 = load ptr, ptr %49, align 8, !tbaa !54
  %51 = getelementptr inbounds i8, ptr %50, i64 152
  %52 = load ptr, ptr %51, align 8
  invoke void %52(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull %7, i32 noundef 64, i1 noundef zeroext false)
          to label %59 unwind label %57

53:                                               ; preds = %21
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %93

55:                                               ; preds = %36, %33, %28, %25
  %56 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %93

57:                                               ; preds = %68, %48
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %93

59:                                               ; preds = %48, %41
  %.146 = phi i32 [ %44, %41 ], [ 0, %48 ]
  %60 = getelementptr inbounds i8, ptr %.04963, i64 192
  %61 = load i32, ptr %60, align 16, !tbaa !56
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %63, label %69

63:                                               ; preds = %59
  %64 = add nsw i32 %.04764, 1
  %65 = sext i32 %.04764 to i64
  %66 = getelementptr inbounds %"class.JPH::BodyID", ptr %8, i64 %65
  store i32 %.sroa.0.0.copyload, ptr %66, align 4, !tbaa !27
  %67 = icmp eq i32 %64, 64
  br i1 %67, label %68, label %69

68:                                               ; preds = %63
  invoke void @_ZN3JPH11BodyManager16DeactivateBodiesEPKNS_6BodyIDEi(ptr noundef nonnull align 8 dereferenceable(297) %17, ptr noundef nonnull %8, i32 noundef 64)
          to label %69 unwind label %57

69:                                               ; preds = %68, %63, %59
  %.148 = phi i32 [ %64, %63 ], [ %.04764, %59 ], [ 0, %68 ]
  %70 = getelementptr inbounds i8, ptr %.04963, i64 208
  %71 = icmp ult ptr %70, %14
  br i1 %71, label %21, label %._crit_edge, !llvm.loop !57

72:                                               ; preds = %._crit_edge
  %73 = getelementptr inbounds i8, ptr %0, i64 432
  %74 = load ptr, ptr %73, align 16, !tbaa !28
  %75 = load ptr, ptr %74, align 8, !tbaa !54
  %76 = getelementptr inbounds i8, ptr %75, i64 152
  %77 = load ptr, ptr %76, align 8
  invoke void %77(ptr noundef nonnull align 8 dereferenceable(16) %74, ptr noundef nonnull %7, i32 noundef %.146, i1 noundef zeroext false)
          to label %80 unwind label %78

78:                                               ; preds = %.thread, %82, %72
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %93

80:                                               ; preds = %72, %._crit_edge
  %81 = icmp sgt i32 %.148, 0
  br i1 %81, label %82, label %.thread

82:                                               ; preds = %80
  %83 = getelementptr inbounds i8, ptr %0, i64 16
  invoke void @_ZN3JPH11BodyManager16DeactivateBodiesEPKNS_6BodyIDEi(ptr noundef nonnull align 8 dereferenceable(297) %83, ptr noundef nonnull %8, i32 noundef %.148)
          to label %.thread unwind label %78

.thread:                                          ; preds = %6, %82, %80
  %84 = getelementptr inbounds i8, ptr %1, i64 8
  %85 = load ptr, ptr %84, align 8, !tbaa !59
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = load i32, ptr %11, align 8, !tbaa !17
  %88 = mul i32 %87, 208
  %89 = load ptr, ptr %85, align 8, !tbaa !54
  %90 = getelementptr inbounds i8, ptr %89, i64 24
  %91 = load ptr, ptr %90, align 8
  invoke void %91(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef %86, i32 noundef %88)
          to label %92 unwind label %78

92:                                               ; preds = %.thread
  call void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #7
  ret void

93:                                               ; preds = %53, %55, %57, %78
  %.pn.pn = phi { ptr, i32 } [ %79, %78 ], [ %58, %57 ], [ %56, %55 ], [ %54, %53 ]
  call void @_ZN3JPH11BodyManager23GrantActiveBodiesAccessD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  br label %94

94:                                               ; preds = %93, %19
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %93 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn.pn.pn
}

declare void @_ZN3JPH24SoftBodyMotionProperties25UpdateRigidBodyVelocitiesERKNS_21SoftBodyUpdateContextERNS_13BodyInterfaceE(ptr noundef nonnull align 16 dereferenceable(372), ptr noundef nonnull align 16 dereferenceable(196), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3JPH13PhysicsSystem22GetBodyInterfaceNoLockEv(ptr noundef nonnull align 16 dereferenceable(1172)) local_unnamed_addr #6 align 2

declare void @_ZN3JPH4Body30SetPositionAndRotationInternalENS_4Vec3ENS_4QuatEb(ptr noundef nonnull align 16 dereferenceable(122), double, double, double, double, i1 noundef zeroext) local_unnamed_addr #5

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

declare void @_ZN3JPH11BodyManager16DeactivateBodiesEPKNS_6BodyIDEi(ptr noundef nonnull align 8 dereferenceable(297), ptr noundef, i32 noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "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 = { 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, !7, i64 112}
!6 = !{!"_ZTSN3JPH20PhysicsUpdateContextE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 36, !11, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !14, i64 72, !13, i64 104, !7, i64 112, !11, i64 120}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"_ZTSSt6atomicIjE", !12, i64 0}
!12 = !{!"_ZTSSt13__atomic_baseIjE", !13, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"_ZTSN3JPH5ArrayINS_20PhysicsUpdateContext4StepENS_16STLTempAllocatorIS2_EEEE", !15, i64 0, !16, i64 8, !16, i64 16, !7, i64 24}
!15 = !{!"_ZTSN3JPH16STLTempAllocatorINS_20PhysicsUpdateContext4StepEEE", !7, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!6, !13, i64 104}
!18 = !{!19, !7, i64 8}
!19 = !{!"_ZTSN3JPH21SoftBodyUpdateContextE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !20, i64 32, !21, i64 96, !21, i64 112, !10, i64 128, !10, i64 132, !22, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !21, i64 176, !24, i64 192}
!20 = !{!"_ZTSN3JPH5Mat44E", !8, i64 0}
!21 = !{!"_ZTSN3JPH4Vec3E", !8, i64 0}
!22 = !{!"_ZTSSt6atomicIN3JPH21SoftBodyUpdateContext6EStateEE", !23, i64 0}
!23 = !{!"_ZTSN3JPH21SoftBodyUpdateContext6EStateE", !8, i64 0}
!24 = !{!"_ZTSN3JPH9ECanSleepE", !8, i64 0}
!25 = !{!19, !7, i64 0}
!26 = !{!8, !8, i64 0}
!27 = !{!13, !13, i64 0}
!28 = !{!29, !7, i64 432}
!29 = !{!"_ZTSN3JPH13PhysicsSystemE", !7, i64 0, !7, i64 8, !30, i64 16, !40, i64 320, !42, i64 336, !43, i64 352, !43, i64 376, !44, i64 400, !44, i64 416, !7, i64 432, !7, i64 440, !7, i64 448, !45, i64 456, !47, i64 488, !48, i64 576, !49, i64 824, !51, i64 904, !52, i64 1016, !32, i64 1080, !53, i64 1128, !21, i64 1152, !10, i64 1168}
!30 = !{!"_ZTSN3JPH11BodyManagerE", !31, i64 0, !13, i64 24, !16, i64 32, !32, i64 40, !36, i64 88, !37, i64 104, !32, i64 128, !8, i64 176, !8, i64 192, !13, i64 200, !32, i64 208, !38, i64 256, !7, i64 280, !7, i64 288, !39, i64 296}
!31 = !{!"_ZTSN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEEE", !16, i64 0, !16, i64 8, !7, i64 16}
!32 = !{!"_ZTSN3JPH5MutexE", !33, i64 0, !35, i64 40}
!33 = !{!"_ZTSSt5mutex", !34, i64 0}
!34 = !{!"_ZTSSt12__mutex_base", !8, i64 0}
!35 = !{!"_ZTSNSt6thread2idE", !16, i64 0}
!36 = !{!"_ZTSN3JPH10MutexArrayINS_11SharedMutexEEE", !7, i64 0, !13, i64 8}
!37 = !{!"_ZTSN3JPH5ArrayIhNS_12STLAllocatorIhEEEE", !16, i64 0, !16, i64 8, !7, i64 16}
!38 = !{!"_ZTSN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEE", !16, i64 0, !16, i64 8, !7, i64 16}
!39 = !{!"bool", !8, i64 0}
!40 = !{!"_ZTSN3JPH23BodyLockInterfaceNoLockE", !41, i64 0}
!41 = !{!"_ZTSN3JPH17BodyLockInterfaceE", !7, i64 8}
!42 = !{!"_ZTSN3JPH24BodyLockInterfaceLockingE", !41, i64 0}
!43 = !{!"_ZTSN3JPH13BodyInterfaceE", !7, i64 0, !7, i64 8, !7, i64 16}
!44 = !{!"_ZTSN3JPH16NarrowPhaseQueryE", !7, i64 0, !7, i64 8}
!45 = !{!"_ZTSSt8functionIFvRKN3JPH4BodyES3_RKNS0_5Mat44ES6_RNS0_20CollideShapeSettingsERNS0_18CollisionCollectorINS0_18CollideShapeResultENS0_36CollisionCollectorTraitsCollideShapeEEERKNS0_11ShapeFilterEEE", !46, i64 0, !7, i64 24}
!46 = !{!"_ZTSSt14_Function_base", !8, i64 0, !7, i64 16}
!47 = !{!"_ZTSN3JPH15PhysicsSettingsE", !13, i64 0, !13, i64 4, !13, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !13, i64 56, !13, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !39, i64 76, !39, i64 77, !39, i64 78, !39, i64 79, !39, i64 80, !39, i64 81, !39, i64 82}
!48 = !{!"_ZTSN3JPH24ContactConstraintManagerE", !8, i64 8, !13, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !13, i64 232, !11, i64 236, !7, i64 240}
!49 = !{!"_ZTSN3JPH17ConstraintManagerE", !7, i64 0, !50, i64 8, !32, i64 32}
!50 = !{!"_ZTSN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEE", !16, i64 0, !16, i64 8, !7, i64 16}
!51 = !{!"_ZTSN3JPH13IslandBuilderE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !13, i64 88, !13, i64 92, !13, i64 96, !13, i64 100, !13, i64 104, !13, i64 108}
!52 = !{!"_ZTSN3JPH19LargeIslandSplitterE", !13, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !13, i64 32, !11, i64 36, !13, i64 40, !7, i64 48, !11, i64 56}
!53 = !{!"_ZTSN3JPH5ArrayIPNS_19PhysicsStepListenerENS_12STLAllocatorIS2_EEEE", !16, i64 0, !16, i64 8, !7, i64 16}
!54 = !{!55, !55, i64 0}
!55 = !{!"vtable pointer", !9, i64 0}
!56 = !{!19, !24, i64 192}
!57 = distinct !{!57, !58}
!58 = !{!"llvm.loop.mustprogress"}
!59 = !{!6, !7, i64 8}


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