; 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::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"] }
%"class.JPH::Vec4" = type { %union.anon.42 }
%union.anon.42 = type { <4 x float> }
%"struct.std::atomic.74" = type { i32 }
%"class.JPH::Vec3" = type { %union.anon.13 }
%union.anon.13 = type { <4 x float> }
%"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: mustprogress uwtable
declare dso_local noundef i32 @_ZNK3JPH20PhysicsUpdateContext17GetMaxConcurrencyEv(ptr noundef nonnull align 8 dereferenceable(124)) #1 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 #2 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 nounwind uwtable
declare dso_local void @_ZNSt11this_thread5yieldEv() #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH13PhysicsSystem19JobSoftBodySimulateEPNS_20PhysicsUpdateContextEj(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef %1, i32 noundef %2) #1 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 i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  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
  %16 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  call void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1) %7, i8 noundef zeroext 3, i8 noundef zeroext 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %17, i32 0, i32 12
  %19 = load i32, ptr %18, align 8, !tbaa !11
  store i32 %19, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = load i32, ptr %8, align 4, !tbaa !9
  %22 = mul i32 %20, %21
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = invoke noundef i32 @_ZNK3JPH20PhysicsUpdateContext17GetMaxConcurrencyEv(ptr noundef nonnull align 8 dereferenceable(124) %23)
          to label %25 unwind label %33

25:                                               ; preds = %3
  %26 = udiv i32 %22, %24
  store i32 %26, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  br label %27

27:                                               ; preds = %76, %25
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %63, %27
  %29 = load i32, ptr %13, align 4, !tbaa !9
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = icmp ult i32 %29, %30
  br i1 %31, label %37, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %70

33:                                               ; preds = %3
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %10, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %11, align 4
  br label %80

37:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.JPH::PhysicsUpdateContext", ptr %38, i32 0, i32 14
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = load i32, ptr %13, align 4, !tbaa !9
  %43 = add i32 %41, %42
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = urem i32 %43, %44
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %40, i64 %46
  store ptr %47, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  br label %48

48:                                               ; preds = %59, %37
  %49 = load ptr, ptr %14, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %49, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !20
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.JPH::PhysicsSystem", ptr %16, i32 0, i32 13
  %54 = invoke noundef i32 @_ZN3JPH24SoftBodyMotionProperties14ParallelUpdateERNS_21SoftBodyUpdateContextERKNS_15PhysicsSettingsE(ptr noundef nonnull align 16 dereferenceable(372) %51, ptr noundef nonnull align 16 dereferenceable(196) %52, ptr noundef nonnull align 4 dereferenceable(83) %53)
          to label %55 unwind label %66

55:                                               ; preds = %48
  store i32 %54, ptr %15, align 4, !tbaa !9
  %56 = load i32, ptr %15, align 4, !tbaa !9
  %57 = load i32, ptr %12, align 4, !tbaa !9
  %58 = or i32 %57, %56
  store i32 %58, ptr %12, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %55
  %60 = load i32, ptr %15, align 4, !tbaa !9
  %61 = icmp eq i32 %60, 2
  br i1 %61, label %48, label %62, !llvm.loop !27

62:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %13, align 4, !tbaa !9
  %65 = add i32 %64, 1
  store i32 %65, ptr %13, align 4, !tbaa !9
  br label %28, !llvm.loop !29

66:                                               ; preds = %48
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %10, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %80

70:                                               ; preds = %32
  %71 = load i32, ptr %12, align 4, !tbaa !9
  %72 = and i32 %71, 2
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  call void @_ZNSt11this_thread5yieldEv() #5
  br label %75

75:                                               ; preds = %74, %70
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %12, align 4, !tbaa !9
  %78 = icmp ne i32 %77, 4
  br i1 %78, label %27, label %79, !llvm.loop !30

79:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  ret void

80:                                               ; preds = %66, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %10, align 8
  %83 = load i32, ptr %11, align 4
  %84 = insertvalue { ptr, i32 } poison, ptr %82, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %83, 1
  resume { ptr, i32 } %85
}

declare noundef i32 @_ZN3JPH24SoftBodyMotionProperties14ParallelUpdateERNS_21SoftBodyUpdateContextERKNS_15PhysicsSettingsE(ptr noundef nonnull align 16 dereferenceable(372), ptr noundef nonnull align 16 dereferenceable(196), ptr noundef nonnull align 4 dereferenceable(83)) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 = { "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 = { 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, !10, i64 104}
!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, !6, i64 112}
!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 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = distinct !{!30, !28}


; 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::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::Vec3" = type { %union.anon.13 }
%union.anon.13 = type { <4 x float> }

; 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 uwtable
declare dso_local noundef i32 @_ZNK3JPH20PhysicsUpdateContext17GetMaxConcurrencyEv(ptr noundef nonnull align 8 dereferenceable(124)) local_unnamed_addr #1 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 #2 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 nounwind uwtable
declare dso_local void @_ZNSt11this_thread5yieldEv() local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH13PhysicsSystem19JobSoftBodySimulateEPNS_20PhysicsUpdateContextEj(ptr noundef nonnull align 16 dereferenceable(1172) %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.JPH::BodyAccess::Grant", align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  call void @_ZN3JPH10BodyAccess5GrantC2ENS0_7EAccessES2_(ptr noundef nonnull align 1 dereferenceable(1) %4, i8 noundef zeroext 3, i8 noundef zeroext 1)
  %5 = getelementptr inbounds i8, ptr %1, i64 104
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = invoke noundef i32 @_ZNK3JPH20PhysicsUpdateContext17GetMaxConcurrencyEv(ptr noundef nonnull align 8 dereferenceable(124) %1)
          to label %8 unwind label %31

8:                                                ; preds = %3
  %9 = mul i32 %6, %2
  %10 = udiv i32 %9, %7
  %.not = icmp eq i32 %6, 0
  %11 = getelementptr inbounds i8, ptr %1, i64 112
  %12 = getelementptr inbounds i8, ptr %0, i64 488
  br i1 %.not, label %.split.split, label %.lr.ph.us

13:                                               ; preds = %._crit_edge.us
  call void @_ZNSt11this_thread5yieldEv() #5
  br label %14

14:                                               ; preds = %13, %._crit_edge.us
  %.not24.us = icmp eq i32 %25, 4
  br i1 %.not24.us, label %.split30.us, label %.lr.ph.us.backedge

.lr.ph.us:                                        ; preds = %8, %.lr.ph.us.backedge
  %.02128.us = phi i32 [ %.02128.us.be, %.lr.ph.us.backedge ], [ 0, %8 ]
  %.02227.us = phi i32 [ %.02227.us.be, %.lr.ph.us.backedge ], [ 0, %8 ]
  %15 = load ptr, ptr %11, align 8, !tbaa !17
  %16 = add i32 %.02128.us, %10
  %17 = urem i32 %16, %6
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds %"class.JPH::SoftBodyUpdateContext", ptr %15, i64 %18
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  br label %21

21:                                               ; preds = %24, %.lr.ph.us
  %.1.us = phi i32 [ %.02227.us, %.lr.ph.us ], [ %25, %24 ]
  %22 = load ptr, ptr %20, align 8, !tbaa !18
  %23 = invoke noundef i32 @_ZN3JPH24SoftBodyMotionProperties14ParallelUpdateERNS_21SoftBodyUpdateContextERKNS_15PhysicsSettingsE(ptr noundef nonnull align 16 dereferenceable(372) %22, ptr noundef nonnull align 16 dereferenceable(196) %19, ptr noundef nonnull align 4 dereferenceable(83) %12)
          to label %24 unwind label %.split32.us

24:                                               ; preds = %21
  %25 = or i32 %23, %.1.us
  %26 = icmp eq i32 %23, 2
  br i1 %26, label %21, label %27, !llvm.loop !25

27:                                               ; preds = %24
  %28 = add nuw i32 %.02128.us, 1
  %exitcond.not = icmp eq i32 %28, %6
  br i1 %exitcond.not, label %._crit_edge.us, label %.lr.ph.us.backedge

.lr.ph.us.backedge:                               ; preds = %27, %14
  %.02128.us.be = phi i32 [ %28, %27 ], [ 0, %14 ]
  %.02227.us.be = phi i32 [ %25, %27 ], [ 0, %14 ]
  br label %.lr.ph.us, !llvm.loop !27

._crit_edge.us:                                   ; preds = %27
  %29 = and i32 %25, 2
  %.not.us = icmp eq i32 %29, 0
  br i1 %.not.us, label %13, label %14

.split32.us:                                      ; preds = %21
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %33

.split.split:                                     ; preds = %8, %.split.split
  call void @_ZNSt11this_thread5yieldEv() #5
  br label %.split.split

31:                                               ; preds = %3
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %33

.split30.us:                                      ; preds = %14
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  ret void

33:                                               ; preds = %.split32.us, %31
  %.pn = phi { ptr, i32 } [ %30, %.split32.us ], [ %32, %31 ]
  call void @_ZN3JPH10BodyAccess5GrantD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn
}

declare noundef i32 @_ZN3JPH24SoftBodyMotionProperties14ParallelUpdateERNS_21SoftBodyUpdateContextERKNS_15PhysicsSettingsE(ptr noundef nonnull align 16 dereferenceable(372), ptr noundef nonnull align 16 dereferenceable(196), ptr noundef nonnull align 4 dereferenceable(83)) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 = { "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 = { 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, !13, i64 104}
!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, !7, i64 112}
!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 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass