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

; 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::Array.3" = type { i64, i64, ptr }
%"struct.JPH::AssertLastParam" = type { i8 }
%"class.JPH::BodyID" = type { 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 }

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [38 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 ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayIPNS_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 @_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 nounwind uwtable
declare dso_local void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH11BodyManager21AddBodyToActiveBodiesERNS_4BodyE(ptr noundef nonnull align 8 dereferenceable(297), ptr noundef nonnull align 16 dereferenceable(122)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH11BodyManager26RemoveBodyFromActiveBodiesERNS_4BodyE(ptr noundef nonnull align 8 dereferenceable(297), ptr noundef nonnull align 16 dereferenceable(122)) #5 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)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH11BodyManager13LockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3JPH11BodyManager12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(297) %0, ptr noundef nonnull align 8 dereferenceable(18) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.JPH::Array.3", align 8
  %7 = alloca %"class.JPH::Array.3", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.JPH::AssertLastParam", align 1
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca %"class.JPH::BodyID", align 4
  %23 = alloca %"struct.JPH::AssertLastParam", align 1
  %24 = alloca i8, align 1
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca %"class.JPH::BodyID", align 4
  %28 = alloca ptr, align 8
  %29 = alloca %"struct.JPH::AssertLastParam", align 1
  %30 = alloca i8, align 1
  %31 = alloca %"class.JPH::UniqueLock", align 8
  %32 = alloca ptr, align 8
  %33 = alloca ptr, align 8
  %34 = alloca ptr, align 8
  %35 = alloca %"class.JPH::BodyID", align 4
  %36 = alloca ptr, align 8
  %37 = alloca ptr, align 8
  %38 = alloca ptr, align 8
  %39 = alloca ptr, align 8
  %40 = alloca %"class.JPH::BodyID", align 4
  %41 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %42 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #7
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #7
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  invoke void @_ZNK3JPH11BodyManager13LockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %42)
          to label %43 unwind label %60

43:                                               ; preds = %2
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = invoke noundef zeroext i1 @_ZNK3JPH13StateRecorder12IsValidatingEv(ptr noundef nonnull align 8 dereferenceable(18) %44)
          to label %46 unwind label %60

46:                                               ; preds = %43
  br i1 %45, label %47, label %227

47:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %48 = getelementptr inbounds %"class.JPH::BodyManager", ptr %42, i32 0, i32 0
  store ptr %48, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = invoke noundef ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %49)
          to label %51 unwind label %64

51:                                               ; preds = %47
  store ptr %50, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = invoke noundef ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %52)
          to label %54 unwind label %68

54:                                               ; preds = %51
  store ptr %53, ptr %13, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %90, %54
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = icmp ne ptr %56, %57
  br i1 %58, label %72, label %59

59:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %95

60:                                               ; preds = %306, %43, %2
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %8, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %9, align 4
  br label %388

64:                                               ; preds = %47
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %8, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %9, align 4
  br label %94

68:                                               ; preds = %51
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %8, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %9, align 4
  br label %93

72:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  store ptr %74, ptr %14, align 8, !tbaa !5
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = invoke noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef %75)
          to label %77 unwind label %85

77:                                               ; preds = %72
  br i1 %76, label %78, label %89

78:                                               ; preds = %77
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = invoke noundef zeroext i1 @_ZNK3JPH4Body14IsInBroadPhaseEv(ptr noundef nonnull align 16 dereferenceable(122) %79)
          to label %81 unwind label %85

81:                                               ; preds = %78
  br i1 %80, label %82, label %89

82:                                               ; preds = %81
  %83 = load i32, ptr %10, align 4, !tbaa !9
  %84 = add i32 %83, 1
  store i32 %84, ptr %10, align 4, !tbaa !9
  br label %89

85:                                               ; preds = %78, %72
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %8, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %93

89:                                               ; preds = %82, %81, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %90

90:                                               ; preds = %89
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = getelementptr inbounds ptr, ptr %91, i32 1
  store ptr %92, ptr %12, align 8, !tbaa !5
  br label %55

93:                                               ; preds = %85, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %94

94:                                               ; preds = %93, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %226

95:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %96 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %96, ptr %15, align 4, !tbaa !9
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadIjTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %97, ptr noundef nonnull align 4 dereferenceable(4) %15)
          to label %98 unwind label %107

98:                                               ; preds = %95
  %99 = load i32, ptr %15, align 4, !tbaa !9
  %100 = load i32, ptr %10, align 4, !tbaa !9
  %101 = icmp ne i32 %99, %100
  br i1 %101, label %102, label %115

102:                                              ; preds = %98
  br label %103

103:                                              ; preds = %102
  %104 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef @.str.19, ptr noundef @.str.1, i32 noundef 798, ptr noundef @.str.20)
          to label %105 unwind label %107

105:                                              ; preds = %103
  br i1 %104, label %106, label %111

106:                                              ; preds = %105
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !11
  br label %111

107:                                              ; preds = %113, %103, %95
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %8, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %9, align 4
  br label %225

111:                                              ; preds = %106, %105
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  invoke void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %42)
          to label %114 unwind label %107

114:                                              ; preds = %113
  store i1 false, ptr %3, align 1
  store i32 1, ptr %17, align 4
  br label %222

115:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %116 = getelementptr inbounds %"class.JPH::BodyManager", ptr %42, i32 0, i32 0
  store ptr %116, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %117 = load ptr, ptr %18, align 8, !tbaa !5
  %118 = invoke noundef ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %117)
          to label %119 unwind label %128

119:                                              ; preds = %115
  store ptr %118, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %120 = load ptr, ptr %18, align 8, !tbaa !5
  %121 = invoke noundef ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %120)
          to label %122 unwind label %132

122:                                              ; preds = %119
  store ptr %121, ptr %20, align 8, !tbaa !5
  br label %123

123:                                              ; preds = %213, %122
  %124 = load ptr, ptr %19, align 8, !tbaa !5
  %125 = load ptr, ptr %20, align 8, !tbaa !5
  %126 = icmp ne ptr %124, %125
  br i1 %126, label %136, label %127

127:                                              ; preds = %123
  store i32 6, ptr %17, align 4
  br label %217

128:                                              ; preds = %115
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %8, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %9, align 4
  br label %220

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

136:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %137 = load ptr, ptr %19, align 8, !tbaa !5
  %138 = load ptr, ptr %137, align 8, !tbaa !5
  store ptr %138, ptr %21, align 8, !tbaa !5
  %139 = load ptr, ptr %21, align 8, !tbaa !5
  %140 = invoke noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef %139)
          to label %141 unwind label %162

141:                                              ; preds = %136
  br i1 %140, label %142, label %209

142:                                              ; preds = %141
  %143 = load ptr, ptr %21, align 8, !tbaa !5
  %144 = invoke noundef zeroext i1 @_ZNK3JPH4Body14IsInBroadPhaseEv(ptr noundef nonnull align 16 dereferenceable(122) %143)
          to label %145 unwind label %162

145:                                              ; preds = %142
  br i1 %144, label %146, label %209

146:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %147 = load ptr, ptr %21, align 8, !tbaa !5
  %148 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %147)
          to label %149 unwind label %166

149:                                              ; preds = %146
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %148, i64 4, i1 false), !tbaa.struct !12
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadINS_6BodyIDETnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS4_(ptr noundef nonnull align 8 dereferenceable(8) %150, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %151 unwind label %166

151:                                              ; preds = %149
  %152 = load ptr, ptr %21, align 8, !tbaa !5
  %153 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %152)
          to label %154 unwind label %166

154:                                              ; preds = %151
  %155 = invoke noundef zeroext i1 @_ZNK3JPH6BodyIDneERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(4) %153)
          to label %156 unwind label %166

156:                                              ; preds = %154
  br i1 %155, label %157, label %174

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  %159 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef @.str.19, ptr noundef @.str.1, i32 noundef 810, ptr noundef @.str.20)
          to label %160 unwind label %166

160:                                              ; preds = %158
  br i1 %159, label %161, label %170

161:                                              ; preds = %160
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !13
  br label %170

162:                                              ; preds = %142, %136
  %163 = landingpad { ptr, i32 }
          cleanup
  %164 = extractvalue { ptr, i32 } %163, 0
  store ptr %164, ptr %8, align 8
  %165 = extractvalue { ptr, i32 } %163, 1
  store i32 %165, ptr %9, align 4
  br label %216

166:                                              ; preds = %172, %158, %154, %151, %149, %146
  %167 = landingpad { ptr, i32 }
          cleanup
  %168 = extractvalue { ptr, i32 } %167, 0
  store ptr %168, ptr %8, align 8
  %169 = extractvalue { ptr, i32 } %167, 1
  store i32 %169, ptr %9, align 4
  br label %208

170:                                              ; preds = %161, %160
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171
  invoke void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %42)
          to label %173 unwind label %166

173:                                              ; preds = %172
  store i1 false, ptr %3, align 1
  store i32 1, ptr %17, align 4
  br label %205

174:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #7
  %175 = load ptr, ptr %21, align 8, !tbaa !5
  %176 = invoke noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %175)
          to label %177 unwind label %194

177:                                              ; preds = %174
  %178 = zext i1 %176 to i8
  store i8 %178, ptr %24, align 1, !tbaa !14
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %179, ptr noundef nonnull align 1 dereferenceable(1) %24)
          to label %180 unwind label %194

180:                                              ; preds = %177
  %181 = load i8, ptr %24, align 1, !tbaa !14, !range !16, !noundef !17
  %182 = trunc i8 %181 to i1
  %183 = zext i1 %182 to i32
  %184 = load ptr, ptr %21, align 8, !tbaa !5
  %185 = invoke noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %184)
          to label %186 unwind label %194

186:                                              ; preds = %180
  %187 = zext i1 %185 to i32
  %188 = icmp ne i32 %183, %187
  br i1 %188, label %189, label %201

189:                                              ; preds = %186
  %190 = load i8, ptr %24, align 1, !tbaa !14, !range !16, !noundef !17
  %191 = trunc i8 %190 to i1
  br i1 %191, label %192, label %198

192:                                              ; preds = %189
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %193 unwind label %194

193:                                              ; preds = %192
  br label %200

194:                                              ; preds = %201, %198, %192, %180, %177, %174
  %195 = landingpad { ptr, i32 }
          cleanup
  %196 = extractvalue { ptr, i32 } %195, 0
  store ptr %196, ptr %8, align 8
  %197 = extractvalue { ptr, i32 } %195, 1
  store i32 %197, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #7
  br label %208

198:                                              ; preds = %189
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %199 unwind label %194

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199, %193
  br label %201

201:                                              ; preds = %200, %186
  %202 = load ptr, ptr %21, align 8, !tbaa !5
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPH4Body12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 16 dereferenceable(122) %202, ptr noundef nonnull align 8 dereferenceable(18) %203)
          to label %204 unwind label %194

204:                                              ; preds = %201
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #7
  store i32 0, ptr %17, align 4
  br label %205

205:                                              ; preds = %204, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  %206 = load i32, ptr %17, align 4
  switch i32 %206, label %210 [
    i32 0, label %207
  ]

207:                                              ; preds = %205
  br label %209

208:                                              ; preds = %194, %166
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %216

209:                                              ; preds = %207, %145, %141
  store i32 0, ptr %17, align 4
  br label %210

210:                                              ; preds = %209, %205
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  %211 = load i32, ptr %17, align 4
  switch i32 %211, label %217 [
    i32 0, label %212
  ]

212:                                              ; preds = %210
  br label %213

213:                                              ; preds = %212
  %214 = load ptr, ptr %19, align 8, !tbaa !5
  %215 = getelementptr inbounds ptr, ptr %214, i32 1
  store ptr %215, ptr %19, align 8, !tbaa !5
  br label %123

216:                                              ; preds = %208, %162
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %219

217:                                              ; preds = %210, %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %218 = load i32, ptr %17, align 4
  switch i32 %218, label %222 [
    i32 6, label %221
  ]

219:                                              ; preds = %216, %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %220

220:                                              ; preds = %219, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %225

221:                                              ; preds = %217
  store i32 0, ptr %17, align 4
  br label %222

222:                                              ; preds = %221, %217, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %223 = load i32, ptr %17, align 4
  switch i32 %223, label %386 [
    i32 0, label %224
  ]

224:                                              ; preds = %222
  br label %306

225:                                              ; preds = %220, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %226

226:                                              ; preds = %225, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %388

227:                                              ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  store i32 0, ptr %25, align 4, !tbaa !9
  %228 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadIjTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %228, ptr noundef nonnull align 4 dereferenceable(4) %25)
          to label %229 unwind label %235

229:                                              ; preds = %227
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  store i32 0, ptr %26, align 4, !tbaa !9
  br label %230

230:                                              ; preds = %294, %229
  %231 = load i32, ptr %26, align 4, !tbaa !9
  %232 = load i32, ptr %25, align 4, !tbaa !9
  %233 = icmp ult i32 %231, %232
  br i1 %233, label %239, label %234

234:                                              ; preds = %230
  store i32 10, ptr %17, align 4
  br label %299

235:                                              ; preds = %227
  %236 = landingpad { ptr, i32 }
          cleanup
  %237 = extractvalue { ptr, i32 } %236, 0
  store ptr %237, ptr %8, align 8
  %238 = extractvalue { ptr, i32 } %236, 1
  store i32 %238, ptr %9, align 4
  br label %305

239:                                              ; preds = %230
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  invoke void @_ZN3JPH6BodyIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %27)
          to label %240 unwind label %252

240:                                              ; preds = %239
  %241 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadINS_6BodyIDETnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS4_(ptr noundef nonnull align 8 dereferenceable(8) %241, ptr noundef nonnull align 4 dereferenceable(4) %27)
          to label %242 unwind label %252

242:                                              ; preds = %240
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %243 = invoke noundef ptr @_ZN3JPH11BodyManager10TryGetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %42, ptr noundef nonnull align 4 dereferenceable(4) %27)
          to label %244 unwind label %256

244:                                              ; preds = %242
  store ptr %243, ptr %28, align 8, !tbaa !5
  %245 = load ptr, ptr %28, align 8, !tbaa !5
  %246 = icmp eq ptr %245, null
  br i1 %246, label %247, label %264

247:                                              ; preds = %244
  br label %248

248:                                              ; preds = %247
  %249 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef @.str.19, ptr noundef @.str.1, i32 noundef 840, ptr noundef @.str.21)
          to label %250 unwind label %256

250:                                              ; preds = %248
  br i1 %249, label %251, label %260

251:                                              ; preds = %250
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !18
  br label %260

252:                                              ; preds = %240, %239
  %253 = landingpad { ptr, i32 }
          cleanup
  %254 = extractvalue { ptr, i32 } %253, 0
  store ptr %254, ptr %8, align 8
  %255 = extractvalue { ptr, i32 } %253, 1
  store i32 %255, ptr %9, align 4
  br label %298

256:                                              ; preds = %262, %248, %242
  %257 = landingpad { ptr, i32 }
          cleanup
  %258 = extractvalue { ptr, i32 } %257, 0
  store ptr %258, ptr %8, align 8
  %259 = extractvalue { ptr, i32 } %257, 1
  store i32 %259, ptr %9, align 4
  br label %297

260:                                              ; preds = %251, %250
  br label %261

261:                                              ; preds = %260
  br label %262

262:                                              ; preds = %261
  invoke void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %42)
          to label %263 unwind label %256

263:                                              ; preds = %262
  store i1 false, ptr %3, align 1
  store i32 1, ptr %17, align 4
  br label %291

264:                                              ; preds = %244
  call void @llvm.lifetime.start.p0(i64 1, ptr %30) #7
  %265 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %265, ptr noundef nonnull align 1 dereferenceable(1) %30)
          to label %266 unwind label %280

266:                                              ; preds = %264
  %267 = load i8, ptr %30, align 1, !tbaa !14, !range !16, !noundef !17
  %268 = trunc i8 %267 to i1
  %269 = zext i1 %268 to i32
  %270 = load ptr, ptr %28, align 8, !tbaa !5
  %271 = invoke noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %270)
          to label %272 unwind label %280

272:                                              ; preds = %266
  %273 = zext i1 %271 to i32
  %274 = icmp ne i32 %269, %273
  br i1 %274, label %275, label %287

275:                                              ; preds = %272
  %276 = load i8, ptr %30, align 1, !tbaa !14, !range !16, !noundef !17
  %277 = trunc i8 %276 to i1
  br i1 %277, label %278, label %284

278:                                              ; preds = %275
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 4 dereferenceable(4) %27)
          to label %279 unwind label %280

279:                                              ; preds = %278
  br label %286

280:                                              ; preds = %287, %284, %278, %266, %264
  %281 = landingpad { ptr, i32 }
          cleanup
  %282 = extractvalue { ptr, i32 } %281, 0
  store ptr %282, ptr %8, align 8
  %283 = extractvalue { ptr, i32 } %281, 1
  store i32 %283, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %30) #7
  br label %297

284:                                              ; preds = %275
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 4 dereferenceable(4) %27)
          to label %285 unwind label %280

285:                                              ; preds = %284
  br label %286

286:                                              ; preds = %285, %279
  br label %287

287:                                              ; preds = %286, %272
  %288 = load ptr, ptr %28, align 8, !tbaa !5
  %289 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN3JPH4Body12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 16 dereferenceable(122) %288, ptr noundef nonnull align 8 dereferenceable(18) %289)
          to label %290 unwind label %280

290:                                              ; preds = %287
  call void @llvm.lifetime.end.p0(i64 1, ptr %30) #7
  store i32 0, ptr %17, align 4
  br label %291

291:                                              ; preds = %290, %263
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  %292 = load i32, ptr %17, align 4
  switch i32 %292, label %299 [
    i32 0, label %293
  ]

293:                                              ; preds = %291
  br label %294

294:                                              ; preds = %293
  %295 = load i32, ptr %26, align 4, !tbaa !9
  %296 = add i32 %295, 1
  store i32 %296, ptr %26, align 4, !tbaa !9
  br label %230, !llvm.loop !19

297:                                              ; preds = %280, %256
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  br label %298

298:                                              ; preds = %297, %252
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %305

299:                                              ; preds = %291, %234
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  %300 = load i32, ptr %17, align 4
  switch i32 %300, label %302 [
    i32 10, label %301
  ]

301:                                              ; preds = %299
  store i32 0, ptr %17, align 4
  br label %302

302:                                              ; preds = %301, %299
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  %303 = load i32, ptr %17, align 4
  switch i32 %303, label %386 [
    i32 0, label %304
  ]

304:                                              ; preds = %302
  br label %306

305:                                              ; preds = %298, %235
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %388

306:                                              ; preds = %304, %224
  invoke void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %42)
          to label %307 unwind label %60

307:                                              ; preds = %306
  call void @llvm.lifetime.start.p0(i64 24, ptr %31) #7
  %308 = getelementptr inbounds %"class.JPH::BodyManager", ptr %42, i32 0, i32 7
  invoke void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20) %31, ptr noundef nonnull align 8 dereferenceable(48) %308, ptr noundef %42, i32 noundef 32)
          to label %309 unwind label %321

309:                                              ; preds = %307
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #7
  store ptr %6, ptr %32, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #7
  %310 = load ptr, ptr %32, align 8, !tbaa !5
  %311 = invoke noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %310)
          to label %312 unwind label %325

312:                                              ; preds = %309
  store ptr %311, ptr %33, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #7
  %313 = load ptr, ptr %32, align 8, !tbaa !5
  %314 = invoke noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %313)
          to label %315 unwind label %329

315:                                              ; preds = %312
  store ptr %314, ptr %34, align 8, !tbaa !5
  br label %316

316:                                              ; preds = %339, %315
  %317 = load ptr, ptr %33, align 8, !tbaa !5
  %318 = load ptr, ptr %34, align 8, !tbaa !5
  %319 = icmp ne ptr %317, %318
  br i1 %319, label %333, label %320

320:                                              ; preds = %316
  store i32 15, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #7
  br label %348

321:                                              ; preds = %307
  %322 = landingpad { ptr, i32 }
          cleanup
  %323 = extractvalue { ptr, i32 } %322, 0
  store ptr %323, ptr %8, align 8
  %324 = extractvalue { ptr, i32 } %322, 1
  store i32 %324, ptr %9, align 4
  br label %385

325:                                              ; preds = %309
  %326 = landingpad { ptr, i32 }
          cleanup
  %327 = extractvalue { ptr, i32 } %326, 0
  store ptr %327, ptr %8, align 8
  %328 = extractvalue { ptr, i32 } %326, 1
  store i32 %328, ptr %9, align 4
  br label %347

329:                                              ; preds = %312
  %330 = landingpad { ptr, i32 }
          cleanup
  %331 = extractvalue { ptr, i32 } %330, 0
  store ptr %331, ptr %8, align 8
  %332 = extractvalue { ptr, i32 } %330, 1
  store i32 %332, ptr %9, align 4
  br label %346

333:                                              ; preds = %316
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #7
  %334 = load ptr, ptr %33, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %334, i64 4, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #7
  %335 = invoke noundef ptr @_ZN3JPH11BodyManager10TryGetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %42, ptr noundef nonnull align 4 dereferenceable(4) %35)
          to label %336 unwind label %342

336:                                              ; preds = %333
  store ptr %335, ptr %36, align 8, !tbaa !5
  %337 = load ptr, ptr %36, align 8, !tbaa !5
  invoke void @_ZN3JPH11BodyManager21AddBodyToActiveBodiesERNS_4BodyE(ptr noundef nonnull align 8 dereferenceable(297) %42, ptr noundef nonnull align 16 dereferenceable(122) %337)
          to label %338 unwind label %342

338:                                              ; preds = %336
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  br label %339

339:                                              ; preds = %338
  %340 = load ptr, ptr %33, align 8, !tbaa !5
  %341 = getelementptr inbounds %"class.JPH::BodyID", ptr %340, i32 1
  store ptr %341, ptr %33, align 8, !tbaa !5
  br label %316

342:                                              ; preds = %336, %333
  %343 = landingpad { ptr, i32 }
          cleanup
  %344 = extractvalue { ptr, i32 } %343, 0
  store ptr %344, ptr %8, align 8
  %345 = extractvalue { ptr, i32 } %343, 1
  store i32 %345, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  br label %346

346:                                              ; preds = %342, %329
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  br label %347

347:                                              ; preds = %346, %325
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #7
  br label %384

348:                                              ; preds = %320
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #7
  store ptr %7, ptr %37, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #7
  %349 = load ptr, ptr %37, align 8, !tbaa !5
  %350 = invoke noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %349)
          to label %351 unwind label %360

351:                                              ; preds = %348
  store ptr %350, ptr %38, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %39) #7
  %352 = load ptr, ptr %37, align 8, !tbaa !5
  %353 = invoke noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %352)
          to label %354 unwind label %364

354:                                              ; preds = %351
  store ptr %353, ptr %39, align 8, !tbaa !5
  br label %355

355:                                              ; preds = %374, %354
  %356 = load ptr, ptr %38, align 8, !tbaa !5
  %357 = load ptr, ptr %39, align 8, !tbaa !5
  %358 = icmp ne ptr %356, %357
  br i1 %358, label %368, label %359

359:                                              ; preds = %355
  store i32 17, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #7
  br label %383

360:                                              ; preds = %348
  %361 = landingpad { ptr, i32 }
          cleanup
  %362 = extractvalue { ptr, i32 } %361, 0
  store ptr %362, ptr %8, align 8
  %363 = extractvalue { ptr, i32 } %361, 1
  store i32 %363, ptr %9, align 4
  br label %382

364:                                              ; preds = %351
  %365 = landingpad { ptr, i32 }
          cleanup
  %366 = extractvalue { ptr, i32 } %365, 0
  store ptr %366, ptr %8, align 8
  %367 = extractvalue { ptr, i32 } %365, 1
  store i32 %367, ptr %9, align 4
  br label %381

368:                                              ; preds = %355
  call void @llvm.lifetime.start.p0(i64 4, ptr %40) #7
  %369 = load ptr, ptr %38, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 4 %369, i64 4, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %41) #7
  %370 = invoke noundef ptr @_ZN3JPH11BodyManager10TryGetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %42, ptr noundef nonnull align 4 dereferenceable(4) %40)
          to label %371 unwind label %377

371:                                              ; preds = %368
  store ptr %370, ptr %41, align 8, !tbaa !5
  %372 = load ptr, ptr %41, align 8, !tbaa !5
  invoke void @_ZN3JPH11BodyManager26RemoveBodyFromActiveBodiesERNS_4BodyE(ptr noundef nonnull align 8 dereferenceable(297) %42, ptr noundef nonnull align 16 dereferenceable(122) %372)
          to label %373 unwind label %377

373:                                              ; preds = %371
  call void @llvm.lifetime.end.p0(i64 8, ptr %41) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #7
  br label %374

374:                                              ; preds = %373
  %375 = load ptr, ptr %38, align 8, !tbaa !5
  %376 = getelementptr inbounds %"class.JPH::BodyID", ptr %375, i32 1
  store ptr %376, ptr %38, align 8, !tbaa !5
  br label %355

377:                                              ; preds = %371, %368
  %378 = landingpad { ptr, i32 }
          cleanup
  %379 = extractvalue { ptr, i32 } %378, 0
  store ptr %379, ptr %8, align 8
  %380 = extractvalue { ptr, i32 } %378, 1
  store i32 %380, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %41) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #7
  br label %381

381:                                              ; preds = %377, %364
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #7
  br label %382

382:                                              ; preds = %381, %360
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #7
  br label %384

383:                                              ; preds = %359
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %31) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %31) #7
  store i1 true, ptr %3, align 1
  store i32 1, ptr %17, align 4
  br label %386

384:                                              ; preds = %382, %347
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %31) #7
  br label %385

385:                                              ; preds = %384, %321
  call void @llvm.lifetime.end.p0(i64 24, ptr %31) #7
  br label %388

386:                                              ; preds = %383, %302, %222
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #7
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #7
  %387 = load i1, ptr %3, align 1
  ret i1 %387

388:                                              ; preds = %385, %305, %226, %60
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #7
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #7
  br label %389

389:                                              ; preds = %388
  %390 = load ptr, ptr %8, align 8
  %391 = load i32, ptr %9, align 4
  %392 = insertvalue { ptr, i32 } poison, ptr %390, 0
  %393 = insertvalue { ptr, i32 } %392, i32 %391, 1
  resume { ptr, i32 } %393
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH13StateRecorder12IsValidatingEv(ptr noundef nonnull align 8 dereferenceable(18)) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH6BodyIDneERKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

declare void @_ZN3JPH4Body12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 16 dereferenceable(122), ptr noundef nonnull align 8 dereferenceable(18)) #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN3JPH11BodyManager10TryGetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = { 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 = !{i64 2158740013}
!12 = !{i64 0, i64 4, !9}
!13 = !{i64 2158740356}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{i64 2158740700}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; 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::Array.3" = type { i64, i64, ptr }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::UniqueLock" = type <{ ptr, ptr, i32, [4 x i8] }>

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [38 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 ptr @_ZN3JPH5ArrayIPNS_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 @_ZN3JPH5ArrayIPNS_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 @_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 nounwind uwtable
declare dso_local void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH6BodyIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #3 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 nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH11BodyManager26RemoveBodyFromActiveBodiesERNS_4BodyE(ptr noundef nonnull align 8 dereferenceable(297), ptr noundef nonnull align 16 dereferenceable(122)) 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: mustprogress uwtable
declare dso_local void @_ZNK3JPH11BodyManager13LockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3JPH11BodyManager12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(297) %0, ptr noundef nonnull align 8 dereferenceable(18) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.JPH::Array.3", align 8
  %4 = alloca %"class.JPH::Array.3", align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.JPH::BodyID", align 4
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca %"class.JPH::BodyID", align 4
  %10 = alloca i8, align 1
  %11 = alloca %"class.JPH::UniqueLock", align 8
  %12 = alloca %"class.JPH::BodyID", align 4
  %13 = alloca %"class.JPH::BodyID", align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  invoke void @_ZNK3JPH11BodyManager13LockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %0)
          to label %14 unwind label %19

14:                                               ; preds = %2
  %15 = call noundef zeroext i1 @_ZNK3JPH13StateRecorder12IsValidatingEv(ptr noundef nonnull align 8 dereferenceable(18) %1)
  br i1 %15, label %16, label %73

16:                                               ; preds = %14
  %17 = call noundef ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %18 = call noundef ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %.not104132 = icmp eq ptr %17, %18
  br i1 %.not104132, label %._crit_edge, label %.lr.ph135

._crit_edge:                                      ; preds = %26, %16
  %.086.lcssa = phi i32 [ 0, %16 ], [ %.187, %26 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 %.086.lcssa, ptr %5, align 4, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadIjTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %28 unwind label %34

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

.lr.ph135:                                        ; preds = %16, %26
  %.086134 = phi i32 [ %.187, %26 ], [ 0, %16 ]
  %.088133 = phi ptr [ %27, %26 ], [ %17, %16 ]
  %21 = load ptr, ptr %.088133, align 8, !tbaa !9
  %22 = call noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef %21)
  br i1 %22, label %23, label %26

23:                                               ; preds = %.lr.ph135
  %24 = call noundef zeroext i1 @_ZNK3JPH4Body14IsInBroadPhaseEv(ptr noundef nonnull align 16 dereferenceable(122) %21)
  %25 = zext i1 %24 to i32
  %spec.select = add i32 %.086134, %25
  br label %26

26:                                               ; preds = %23, %.lr.ph135
  %.187 = phi i32 [ %.086134, %.lr.ph135 ], [ %spec.select, %23 ]
  %27 = getelementptr inbounds i8, ptr %.088133, i64 8
  %.not104 = icmp eq ptr %27, %18
  br i1 %.not104, label %._crit_edge, label %.lr.ph135

28:                                               ; preds = %._crit_edge
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %.not105 = icmp eq i32 %29, %.086.lcssa
  br i1 %.not105, label %37, label %30

30:                                               ; preds = %28
  %31 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.1, i32 noundef 798, ptr noundef nonnull @.str.20)
          to label %32 unwind label %34

32:                                               ; preds = %30
  br i1 %31, label %33, label %36

33:                                               ; preds = %32
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #6, !srcloc !11
  br label %36

34:                                               ; preds = %36, %30, %._crit_edge
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %72

36:                                               ; preds = %33, %32
  invoke void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %0)
          to label %.critedge119 unwind label %34

37:                                               ; preds = %28
  %38 = call noundef ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %39 = call noundef ptr @_ZN3JPH5ArrayIPNS_4BodyENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %.not106136 = icmp eq ptr %38, %39
  br i1 %.not106136, label %.critedge121, label %.lr.ph139

.lr.ph139:                                        ; preds = %37, %.critedge
  %.096137 = phi ptr [ %70, %.critedge ], [ %38, %37 ]
  %40 = load ptr, ptr %.096137, align 8, !tbaa !9
  %41 = call noundef zeroext i1 @_ZN3JPH11BodyManager19sIsValidBodyPointerEPKNS_4BodyE(ptr noundef %40)
  br i1 %41, label %42, label %.critedge

42:                                               ; preds = %.lr.ph139
  %43 = call noundef zeroext i1 @_ZNK3JPH4Body14IsInBroadPhaseEv(ptr noundef nonnull align 16 dereferenceable(122) %40)
  br i1 %43, label %44, label %.critedge

44:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %40)
  %46 = load i32, ptr %45, align 4, !tbaa !5
  store i32 %46, ptr %6, align 4, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadINS_6BodyIDETnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS4_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %47 unwind label %.loopexit

47:                                               ; preds = %44
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %40)
  %49 = call noundef zeroext i1 @_ZNK3JPH6BodyIDneERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %48)
  br i1 %49, label %50, label %55

50:                                               ; preds = %47
  %51 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.1, i32 noundef 810, ptr noundef nonnull @.str.20)
          to label %52 unwind label %.loopexit.split-lp

52:                                               ; preds = %50
  br i1 %51, label %53, label %54

53:                                               ; preds = %52
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #6, !srcloc !12
  br label %54

.loopexit:                                        ; preds = %44
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %69

.loopexit.split-lp:                               ; preds = %50, %54
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %69

54:                                               ; preds = %53, %52
  invoke void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %0)
          to label %71 unwind label %.loopexit.split-lp

55:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #6
  %56 = call noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %40)
  %57 = zext i1 %56 to i8
  store i8 %57, ptr %7, align 1, !tbaa !13
  invoke void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %58 unwind label %65

58:                                               ; preds = %55
  %59 = load i8, ptr %7, align 1, !tbaa !13, !range !15, !noundef !16
  %60 = call noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %40)
  %61 = zext i1 %60 to i8
  %.not107 = icmp eq i8 %59, %61
  br i1 %.not107, label %67, label %.invoke

.invoke:                                          ; preds = %58
  %62 = load i8, ptr %7, align 1, !tbaa !13, !range !15, !noundef !16
  %63 = trunc nuw i8 %62 to i1
  %64 = select i1 %63, ptr %3, ptr %4
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %64, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %67 unwind label %65

65:                                               ; preds = %.invoke, %67, %55
  %66 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  br label %69

67:                                               ; preds = %.invoke, %58
  invoke void @_ZN3JPH4Body12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 16 dereferenceable(122) %40, ptr noundef nonnull align 8 dereferenceable(18) %1)
          to label %68 unwind label %65

68:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %.critedge

69:                                               ; preds = %.loopexit, %.loopexit.split-lp, %65
  %.pn108 = phi { ptr, i32 } [ %66, %65 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %72

.critedge:                                        ; preds = %68, %42, %.lr.ph139
  %70 = getelementptr inbounds i8, ptr %.096137, i64 8
  %.not106 = icmp eq ptr %70, %39
  br i1 %.not106, label %.critedge121, label %.lr.ph139

71:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %130

72:                                               ; preds = %69, %34
  %.pn110 = phi { ptr, i32 } [ %35, %34 ], [ %.pn108, %69 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %131

73:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  invoke void @_ZN3JPH8StreamIn4ReadIjTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %.preheader unwind label %75

.preheader:                                       ; preds = %73
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %.not103130.not = icmp eq i32 %74, 0
  br i1 %.not103130.not, label %.critedge123, label %.lr.ph

75:                                               ; preds = %73
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %103

.lr.ph:                                           ; preds = %.preheader, %98
  %.097131 = phi i32 [ %99, %98 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  call void @_ZN3JPH6BodyIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %9)
  invoke void @_ZN3JPH8StreamIn4ReadINS_6BodyIDETnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS4_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %77 unwind label %84

77:                                               ; preds = %.lr.ph
  %78 = invoke noundef ptr @_ZN3JPH11BodyManager10TryGetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %0, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %79 unwind label %.loopexit125

79:                                               ; preds = %77
  %.not102 = icmp eq ptr %78, null
  br i1 %.not102, label %80, label %87

80:                                               ; preds = %79
  %81 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.1, i32 noundef 840, ptr noundef nonnull @.str.21)
          to label %82 unwind label %.loopexit.split-lp126

82:                                               ; preds = %80
  br i1 %81, label %83, label %86

83:                                               ; preds = %82
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #6, !srcloc !17
  br label %86

84:                                               ; preds = %.lr.ph
  %85 = landingpad { ptr, i32 }
          cleanup
  br label %101

.loopexit125:                                     ; preds = %77
  %lpad.loopexit127 = landingpad { ptr, i32 }
          cleanup
  br label %101

.loopexit.split-lp126:                            ; preds = %80, %86
  %lpad.loopexit.split-lp128 = landingpad { ptr, i32 }
          cleanup
  br label %101

86:                                               ; preds = %83, %82
  invoke void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %0)
          to label %102 unwind label %.loopexit.split-lp126

87:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #6
  invoke void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %88 unwind label %95

88:                                               ; preds = %87
  %89 = load i8, ptr %10, align 1, !tbaa !13, !range !15, !noundef !16
  %90 = call noundef zeroext i1 @_ZNK3JPH4Body8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(122) %78)
  %91 = zext i1 %90 to i8
  %.not = icmp eq i8 %89, %91
  br i1 %.not, label %97, label %.invoke150

.invoke150:                                       ; preds = %88
  %92 = load i8, ptr %10, align 1, !tbaa !13, !range !15, !noundef !16
  %93 = trunc nuw i8 %92 to i1
  %94 = select i1 %93, ptr %3, ptr %4
  invoke void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %94, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %97 unwind label %95

95:                                               ; preds = %.invoke150, %97, %87
  %96 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #6
  br label %101

97:                                               ; preds = %.invoke150, %88
  invoke void @_ZN3JPH4Body12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 16 dereferenceable(122) %78, ptr noundef nonnull align 8 dereferenceable(18) %1)
          to label %98 unwind label %95

98:                                               ; preds = %97
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  %99 = add nuw i32 %.097131, 1
  %100 = load i32, ptr %8, align 4, !tbaa !5
  %.not103 = icmp ult i32 %99, %100
  br i1 %.not103, label %.lr.ph, label %.critedge123, !llvm.loop !18

101:                                              ; preds = %.loopexit125, %.loopexit.split-lp126, %95, %84
  %.pn.pn = phi { ptr, i32 } [ %85, %84 ], [ %96, %95 ], [ %lpad.loopexit127, %.loopexit125 ], [ %lpad.loopexit.split-lp128, %.loopexit.split-lp126 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %103

102:                                              ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %130

103:                                              ; preds = %101, %75
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %101 ], [ %76, %75 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %131

.critedge121:                                     ; preds = %.critedge, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %104

.critedge123:                                     ; preds = %98, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %104

104:                                              ; preds = %.critedge123, %.critedge121
  invoke void @_ZNK3JPH11BodyManager15UnlockAllBodiesEv(ptr noundef nonnull align 8 dereferenceable(297) %0)
          to label %105 unwind label %19

105:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #6
  %106 = getelementptr inbounds i8, ptr %0, i64 128
  invoke void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20) %11, ptr noundef nonnull align 8 dereferenceable(48) %106, ptr noundef nonnull %0, i32 noundef 32)
          to label %107 unwind label %112

107:                                              ; preds = %105
  %108 = call noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %109 = call noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %.not112140 = icmp eq ptr %108, %109
  br i1 %.not112140, label %._crit_edge144, label %.lr.ph143

._crit_edge144:                                   ; preds = %117, %107
  %110 = call noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %111 = call noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %.not113145 = icmp eq ptr %110, %111
  br i1 %.not113145, label %._crit_edge149, label %.lr.ph148

112:                                              ; preds = %105
  %113 = landingpad { ptr, i32 }
          cleanup
  br label %129

.lr.ph143:                                        ; preds = %107, %117
  %.089141 = phi ptr [ %118, %117 ], [ %108, %107 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  %114 = load i32, ptr %.089141, align 4, !tbaa !5
  store i32 %114, ptr %12, align 4, !tbaa !5
  %115 = invoke noundef ptr @_ZN3JPH11BodyManager10TryGetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %0, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %116 unwind label %119

116:                                              ; preds = %.lr.ph143
  invoke void @_ZN3JPH11BodyManager21AddBodyToActiveBodiesERNS_4BodyE(ptr noundef nonnull align 8 dereferenceable(297) %0, ptr noundef nonnull align 16 dereferenceable(122) %115)
          to label %117 unwind label %119

117:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  %118 = getelementptr inbounds i8, ptr %.089141, i64 4
  %.not112 = icmp eq ptr %118, %109
  br i1 %.not112, label %._crit_edge144, label %.lr.ph143

119:                                              ; preds = %116, %.lr.ph143
  %120 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  br label %128

._crit_edge149:                                   ; preds = %124, %._crit_edge144
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  br label %130

.lr.ph148:                                        ; preds = %._crit_edge144, %124
  %.077146 = phi ptr [ %125, %124 ], [ %110, %._crit_edge144 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #6
  %121 = load i32, ptr %.077146, align 4, !tbaa !5
  store i32 %121, ptr %13, align 4, !tbaa !5
  %122 = invoke noundef ptr @_ZN3JPH11BodyManager10TryGetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %0, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %123 unwind label %126

123:                                              ; preds = %.lr.ph148
  invoke void @_ZN3JPH11BodyManager26RemoveBodyFromActiveBodiesERNS_4BodyE(ptr noundef nonnull align 8 dereferenceable(297) %0, ptr noundef nonnull align 16 dereferenceable(122) %122)
          to label %124 unwind label %126

124:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #6
  %125 = getelementptr inbounds i8, ptr %.077146, i64 4
  %.not113 = icmp eq ptr %125, %111
  br i1 %.not113, label %._crit_edge149, label %.lr.ph148

126:                                              ; preds = %123, %.lr.ph148
  %127 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #6
  br label %128

128:                                              ; preds = %126, %119
  %.pn114 = phi { ptr, i32 } [ %120, %119 ], [ %127, %126 ]
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %11) #6
  br label %129

129:                                              ; preds = %128, %112
  %.pn114.pn = phi { ptr, i32 } [ %.pn114, %128 ], [ %113, %112 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  br label %131

.critedge119:                                     ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %130

130:                                              ; preds = %102, %71, %.critedge119, %._crit_edge149
  %.9 = phi i1 [ true, %._crit_edge149 ], [ false, %71 ], [ false, %102 ], [ false, %.critedge119 ]
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  ret i1 %.9

131:                                              ; preds = %129, %103, %72, %19
  %.pn114.pn.pn = phi { ptr, i32 } [ %.pn114.pn, %129 ], [ %20, %19 ], [ %.pn110, %72 ], [ %.pn.pn.pn, %103 ]
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  resume { ptr, i32 } %.pn114.pn.pn
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH13StateRecorder12IsValidatingEv(ptr noundef nonnull align 8 dereferenceable(18)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH6BodyIDneERKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1 align 2

declare void @_ZN3JPH4Body12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 16 dereferenceable(122), ptr noundef nonnull align 8 dereferenceable(18)) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN3JPH11BodyManager10TryGetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_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 @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(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 = { "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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{i64 2158740013}
!12 = !{i64 2158740356}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{i64 2158740700}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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