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

; 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::UniqueLock" = type <{ ptr, ptr, i32, [4 x i8] }>
%"struct.JPH::AssertLastParam" = type { 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 }

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1

; 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: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #4

; 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 nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

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

16:                                               ; preds = %2
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.JPH::BodyManager", ptr %13, i32 0, i32 1
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = zext i32 %19 to i64
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %20)
          to label %21 unwind label %34

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %22 = getelementptr inbounds %"class.JPH::BodyManager", ptr %13, i32 0, i32 0
  store ptr %22, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = invoke noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
          to label %25 unwind label %38

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

28:                                               ; preds = %25
  store ptr %27, ptr %10, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %63, %28
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = icmp ne ptr %30, %31
  br i1 %32, label %46, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %68

34:                                               ; preds = %77, %69, %16, %2
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %6, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %7, align 4
  br label %84

38:                                               ; preds = %21
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %6, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %7, align 4
  br label %67

42:                                               ; preds = %25
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %6, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %7, align 4
  br label %66

46:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  store ptr %48, ptr %11, align 8, !tbaa !5
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = invoke noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef %49)
          to label %51 unwind label %58

51:                                               ; preds = %46
  br i1 %50, label %52, label %62

52:                                               ; preds = %51
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %54)
          to label %56 unwind label %58

56:                                               ; preds = %52
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %53, ptr noundef nonnull align 4 dereferenceable(4) %55)
          to label %57 unwind label %58

57:                                               ; preds = %56
  br label %62

58:                                               ; preds = %56, %52, %46
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %6, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %66

62:                                               ; preds = %57, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %63

63:                                               ; preds = %62
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = getelementptr inbounds ptr, ptr %64, i32 1
  store ptr %65, ptr %9, align 8, !tbaa !5
  br label %29

66:                                               ; preds = %58, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %67

67:                                               ; preds = %66, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %84

68:                                               ; preds = %33
  br label %69

69:                                               ; preds = %68
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = invoke noundef i64 @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %70)
          to label %72 unwind label %34

72:                                               ; preds = %69
  %73 = getelementptr inbounds %"class.JPH::BodyManager", ptr %13, i32 0, i32 1
  %74 = load i32, ptr %73, align 8, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = icmp eq i64 %71, %75
  br i1 %76, label %81, label %77

77:                                               ; preds = %72
  %78 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.16, ptr noundef @.str.1, i32 noundef 666)
          to label %79 unwind label %34

79:                                               ; preds = %77
  br i1 %78, label %80, label %81

80:                                               ; preds = %79
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !22
  br label %81

81:                                               ; preds = %80, %79, %72
  br label %82

82:                                               ; preds = %81
  br label %83

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

84:                                               ; preds = %67, %34
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #5
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %6, align 8
  %87 = load i32, ptr %7, align 4
  %88 = insertvalue { ptr, i32 } poison, ptr %86, 0
  %89 = insertvalue { ptr, i32 } %88, i32 %87, 1
  resume { ptr, i32 } %89
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{i64 2158738654}


; 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::UniqueLock" = type <{ ptr, ptr, i32, [4 x i8] }>

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1

; 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: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; 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 nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH11BodyManager10GetBodyIDsERNS_5ArrayINS_6BodyIDENS_12STLAllocatorIS2_EEEE(ptr noundef nonnull align 8 dereferenceable(297) %0, ptr noundef nonnull align 8 dereferenceable(24) %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) #5
  %4 = getelementptr inbounds i8, ptr %0, 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 %0, i32 noundef 4)
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %5 unwind label %16

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = zext i32 %7 to i64
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %8)
          to label %9 unwind label %16

9:                                                ; preds = %5
  %10 = call noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %11 = call noundef ptr @_ZNK3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %.not17 = icmp eq ptr %10, %11
  br i1 %.not17, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %24, %9
  %12 = call noundef i64 @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %13 = load i32, ptr %6, align 8, !tbaa !5
  %14 = zext i32 %13 to i64
  %15 = icmp eq i64 %12, %14
  br i1 %15, label %30, label %26

16:                                               ; preds = %26, %5, %2
  %17 = landingpad { ptr, i32 }
          cleanup
  br label %31

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

20:                                               ; preds = %.lr.ph
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %18)
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %24 unwind label %22

22:                                               ; preds = %20
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %31

24:                                               ; preds = %20, %.lr.ph
  %25 = getelementptr inbounds i8, ptr %.01518, i64 8
  %.not = icmp eq ptr %25, %11
  br i1 %.not, label %._crit_edge, label %.lr.ph

26:                                               ; preds = %._crit_edge
  %27 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.1, i32 noundef 666)
          to label %28 unwind label %16

28:                                               ; preds = %26
  br i1 %27, label %29, label %30

29:                                               ; preds = %28
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !22
  br label %30

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

31:                                               ; preds = %22, %16
  %.pn = phi { ptr, i32 } [ %23, %22 ], [ %17, %16 ]
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!11, !11, i64 0}
!22 = !{i64 2158738654}


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