; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Body/BodyManager.ll (ZNK3JPH11BodyManager12GetBodyStatsEv)

; 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"

%"struct.JPH::BodyManager::BodyStats" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%"class.JPH::UniqueLock" = type <{ ptr, ptr, i32, [4 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::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.3" = 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 void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH11BodyManager12GetBodyStatsEv(ptr dead_on_unwind noalias writable sret(%"struct.JPH::BodyManager::BodyStats") align 4 %0, ptr noundef nonnull align 8 dereferenceable(297) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca %"class.JPH::UniqueLock", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #4
  %12 = getelementptr inbounds %"class.JPH::BodyManager", ptr %11, i32 0, i32 4
  call void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20) %4, ptr noundef nonnull align 8 dereferenceable(48) %12, ptr noundef %11, i32 noundef 4)
  call void @_ZN3JPH11BodyManager9BodyStatsC2Ev(ptr noundef nonnull align 4 dereferenceable(36) %0) #4
  %13 = getelementptr inbounds %"class.JPH::BodyManager", ptr %11, i32 0, i32 1
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 0
  store i32 %14, ptr %15, align 4, !tbaa !22
  %16 = getelementptr inbounds %"class.JPH::BodyManager", ptr %11, i32 0, i32 0
  %17 = invoke noundef i64 @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE8capacityEv(ptr noundef nonnull align 8 dereferenceable(24) %16)
          to label %18 unwind label %33

18:                                               ; preds = %2
  %19 = trunc i64 %17 to i32
  %20 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 1
  store i32 %19, ptr %20, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %21 = getelementptr inbounds %"class.JPH::BodyManager", ptr %11, i32 0, i32 0
  store ptr %21, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = invoke noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
          to label %24 unwind label %37

24:                                               ; preds = %18
  store ptr %23, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = invoke noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %25)
          to label %27 unwind label %41

27:                                               ; preds = %24
  store ptr %26, ptr %9, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %106, %27
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = icmp ne ptr %29, %30
  br i1 %31, label %45, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %111

33:                                               ; preds = %2
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %5, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %6, align 4
  br label %112

37:                                               ; preds = %18
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %5, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %6, align 4
  br label %110

41:                                               ; preds = %24
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %5, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %6, align 4
  br label %109

45:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  store ptr %47, ptr %10, align 8, !tbaa !5
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = invoke noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef %48)
          to label %50 unwind label %66

50:                                               ; preds = %45
  br i1 %49, label %51, label %105

51:                                               ; preds = %50
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = invoke noundef zeroext i1 @_ZNK3JPH4Body10IsSoftBodyEv(ptr noundef nonnull align 16 dereferenceable(122) %52)
          to label %54 unwind label %66

54:                                               ; preds = %51
  br i1 %53, label %55, label %71

55:                                               ; preds = %54
  %56 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 7
  %57 = load i32, ptr %56, align 4, !tbaa !25
  %58 = add i32 %57, 1
  store i32 %58, ptr %56, align 4, !tbaa !25
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = invoke noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %59)
          to label %61 unwind label %66

61:                                               ; preds = %55
  br i1 %60, label %62, label %70

62:                                               ; preds = %61
  %63 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 8
  %64 = load i32, ptr %63, align 4, !tbaa !26
  %65 = add i32 %64, 1
  store i32 %65, ptr %63, align 4, !tbaa !26
  br label %70

66:                                               ; preds = %91, %79, %71, %55, %51, %45
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %5, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %109

70:                                               ; preds = %62, %61
  br label %104

71:                                               ; preds = %54
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = invoke noundef zeroext i8 @_ZNK3JPH4Body13GetMotionTypeEv(ptr noundef nonnull align 16 dereferenceable(122) %72)
          to label %74 unwind label %66

74:                                               ; preds = %71
  switch i8 %73, label %103 [
    i8 0, label %75
    i8 2, label %79
    i8 1, label %91
  ]

75:                                               ; preds = %74
  %76 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 2
  %77 = load i32, ptr %76, align 4, !tbaa !27
  %78 = add i32 %77, 1
  store i32 %78, ptr %76, align 4, !tbaa !27
  br label %103

79:                                               ; preds = %74
  %80 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 3
  %81 = load i32, ptr %80, align 4, !tbaa !28
  %82 = add i32 %81, 1
  store i32 %82, ptr %80, align 4, !tbaa !28
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = invoke noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %83)
          to label %85 unwind label %66

85:                                               ; preds = %79
  br i1 %84, label %86, label %90

86:                                               ; preds = %85
  %87 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 4
  %88 = load i32, ptr %87, align 4, !tbaa !29
  %89 = add i32 %88, 1
  store i32 %89, ptr %87, align 4, !tbaa !29
  br label %90

90:                                               ; preds = %86, %85
  br label %103

91:                                               ; preds = %74
  %92 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 5
  %93 = load i32, ptr %92, align 4, !tbaa !30
  %94 = add i32 %93, 1
  store i32 %94, ptr %92, align 4, !tbaa !30
  %95 = load ptr, ptr %10, align 8, !tbaa !5
  %96 = invoke noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %95)
          to label %97 unwind label %66

97:                                               ; preds = %91
  br i1 %96, label %98, label %102

98:                                               ; preds = %97
  %99 = getelementptr inbounds %"struct.JPH::BodyManager::BodyStats", ptr %0, i32 0, i32 6
  %100 = load i32, ptr %99, align 4, !tbaa !31
  %101 = add i32 %100, 1
  store i32 %101, ptr %99, align 4, !tbaa !31
  br label %102

102:                                              ; preds = %98, %97
  br label %103

103:                                              ; preds = %102, %90, %75, %74
  br label %104

104:                                              ; preds = %103, %70
  br label %105

105:                                              ; preds = %104, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %106

106:                                              ; preds = %105
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = getelementptr inbounds ptr, ptr %107, i32 1
  store ptr %108, ptr %8, align 8, !tbaa !5
  br label %28

109:                                              ; preds = %66, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %110

110:                                              ; preds = %109, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %112

111:                                              ; preds = %32
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #4
  ret void

112:                                              ; preds = %110, %33
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #4
  br label %113

113:                                              ; preds = %112
  %114 = load ptr, ptr %5, align 8
  %115 = load i32, ptr %6, align 4
  %116 = insertvalue { ptr, i32 } poison, ptr %114, 0
  %117 = insertvalue { ptr, i32 } %116, i32 %115, 1
  resume { ptr, i32 } %117
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE8capacityEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH4Body10IsSoftBodyEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZNK3JPH4Body13GetMotionTypeEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { 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, !13, i64 24}
!10 = !{!"_ZTSN3JPH11BodyManagerE", !11, i64 0, !13, i64 24, !12, i64 32, !14, i64 40, !18, i64 88, !19, i64 104, !14, i64 128, !7, i64 176, !7, i64 192, !13, i64 200, !14, i64 208, !20, i64 256, !6, i64 280, !6, i64 288, !21, i64 296}
!11 = !{!"_ZTSN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEEE", !12, i64 0, !12, i64 8, !6, i64 16}
!12 = !{!"long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN3JPH5MutexE", !15, i64 0, !17, i64 40}
!15 = !{!"_ZTSSt5mutex", !16, i64 0}
!16 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!17 = !{!"_ZTSNSt6thread2idE", !12, i64 0}
!18 = !{!"_ZTSN3JPH10MutexArrayINS_11SharedMutexEEE", !6, i64 0, !13, i64 8}
!19 = !{!"_ZTSN3JPH5ArrayIhNS_12STLAllocatorIhEEEE", !12, i64 0, !12, i64 8, !6, i64 16}
!20 = !{!"_ZTSN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEE", !12, i64 0, !12, i64 8, !6, i64 16}
!21 = !{!"bool", !7, i64 0}
!22 = !{!23, !13, i64 0}
!23 = !{!"_ZTSN3JPH11BodyManager9BodyStatsE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32}
!24 = !{!23, !13, i64 4}
!25 = !{!23, !13, i64 28}
!26 = !{!23, !13, i64 32}
!27 = !{!23, !13, i64 8}
!28 = !{!23, !13, i64 12}
!29 = !{!23, !13, i64 16}
!30 = !{!23, !13, i64 20}
!31 = !{!23, !13, i64 24}


; 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"

%"struct.JPH::BodyManager::BodyStats" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%"class.JPH::UniqueLock" = type <{ ptr, ptr, i32, [4 x i8] }>

; 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 void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH11BodyManager12GetBodyStatsEv(ptr dead_on_unwind noalias writable sret(%"struct.JPH::BodyManager::BodyStats") align 4 %0, ptr noundef nonnull align 8 dereferenceable(297) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.JPH::UniqueLock", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #4
  %4 = getelementptr inbounds i8, ptr %1, i64 40
  call void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20) %3, ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull %1, i32 noundef 4)
  call void @_ZN3JPH11BodyManager9BodyStatsC2Ev(ptr noundef nonnull align 4 dereferenceable(36) %0) #4
  %5 = getelementptr inbounds i8, ptr %1, i64 24
  %6 = load i32, ptr %5, align 8, !tbaa !5
  store i32 %6, ptr %0, align 4, !tbaa !21
  %7 = call noundef i64 @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE8capacityEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %8 = trunc i64 %7 to i32
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %8, ptr %9, align 4, !tbaa !23
  %10 = call noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %11 = call noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not13 = icmp eq ptr %10, %11
  br i1 %.not13, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %12 = getelementptr inbounds i8, ptr %0, i64 20
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = getelementptr inbounds i8, ptr %0, i64 12
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = getelementptr inbounds i8, ptr %0, i64 28
  %18 = getelementptr inbounds i8, ptr %0, i64 32
  br label %19

._crit_edge:                                      ; preds = %40, %2
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  ret void

19:                                               ; preds = %.lr.ph, %40
  %.014 = phi ptr [ %10, %.lr.ph ], [ %41, %40 ]
  %20 = load ptr, ptr %.014, align 8, !tbaa !24
  %21 = call noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef %20)
  br i1 %21, label %22, label %40

22:                                               ; preds = %19
  %23 = call noundef zeroext i1 @_ZNK3JPH4Body10IsSoftBodyEv(ptr noundef nonnull align 16 dereferenceable(122) %20)
  br i1 %23, label %24, label %28

24:                                               ; preds = %22
  %25 = load i32, ptr %17, align 4, !tbaa !25
  %26 = add i32 %25, 1
  store i32 %26, ptr %17, align 4, !tbaa !25
  %27 = call noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %20)
  br i1 %27, label %.sink.split, label %40

28:                                               ; preds = %22
  %29 = call noundef zeroext i8 @_ZNK3JPH4Body13GetMotionTypeEv(ptr noundef nonnull align 16 dereferenceable(122) %20)
  switch i8 %29, label %40 [
    i8 0, label %.sink.split
    i8 2, label %30
    i8 1, label %34
  ]

30:                                               ; preds = %28
  %31 = load i32, ptr %14, align 4, !tbaa !26
  %32 = add i32 %31, 1
  store i32 %32, ptr %14, align 4, !tbaa !26
  %33 = call noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %20)
  br i1 %33, label %.sink.split, label %40

34:                                               ; preds = %28
  %35 = load i32, ptr %12, align 4, !tbaa !27
  %36 = add i32 %35, 1
  store i32 %36, ptr %12, align 4, !tbaa !27
  %37 = call noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %20)
  br i1 %37, label %.sink.split, label %40

.sink.split:                                      ; preds = %34, %30, %28, %24
  %.sink = phi ptr [ %18, %24 ], [ %16, %28 ], [ %15, %30 ], [ %13, %34 ]
  %38 = load i32, ptr %.sink, align 4, !tbaa !28
  %39 = add i32 %38, 1
  store i32 %39, ptr %.sink, align 4, !tbaa !28
  br label %40

40:                                               ; preds = %.sink.split, %24, %34, %30, %28, %19
  %41 = getelementptr inbounds i8, ptr %.014, i64 8
  %.not = icmp eq ptr %41, %11
  br i1 %.not, label %._crit_edge, label %19
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE8capacityEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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

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

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { 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, !12, i64 24}
!6 = !{!"_ZTSN3JPH11BodyManagerE", !7, i64 0, !12, i64 24, !8, i64 32, !13, i64 40, !17, i64 88, !18, i64 104, !13, i64 128, !9, i64 176, !9, i64 192, !12, i64 200, !13, i64 208, !19, i64 256, !11, i64 280, !11, i64 288, !20, i64 296}
!7 = !{!"_ZTSN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEEE", !8, i64 0, !8, i64 8, !11, i64 16}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!"_ZTSN3JPH5MutexE", !14, i64 0, !16, i64 40}
!14 = !{!"_ZTSSt5mutex", !15, i64 0}
!15 = !{!"_ZTSSt12__mutex_base", !9, i64 0}
!16 = !{!"_ZTSNSt6thread2idE", !8, i64 0}
!17 = !{!"_ZTSN3JPH10MutexArrayINS_11SharedMutexEEE", !11, i64 0, !12, i64 8}
!18 = !{!"_ZTSN3JPH5ArrayIhNS_12STLAllocatorIhEEEE", !8, i64 0, !8, i64 8, !11, i64 16}
!19 = !{!"_ZTSN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEE", !8, i64 0, !8, i64 8, !11, i64 16}
!20 = !{!"bool", !9, i64 0}
!21 = !{!22, !12, i64 0}
!22 = !{!"_ZTSN3JPH11BodyManager9BodyStatsE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32}
!23 = !{!22, !12, i64 4}
!24 = !{!11, !11, i64 0}
!25 = !{!22, !12, i64 28}
!26 = !{!22, !12, i64 12}
!27 = !{!22, !12, i64 20}
!28 = !{!12, !12, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass