; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Collision/BroadPhase (BroadPhaseBruteForce)

; 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::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.std::shared_lock" = type <{ ptr, i8, [7 x i8] }>
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::BroadPhaseBruteForce" = type { %"class.JPH::BroadPhase", %"class.JPH::Array", %"class.JPH::SharedMutex" }
%"class.JPH::BroadPhase" = type { %"class.JPH::BroadPhaseQuery", ptr }
%"class.JPH::BroadPhaseQuery" = type { ptr }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::SharedMutex" = type { %"class.std::shared_mutex", %"class.std::thread::id" }
%"class.std::shared_mutex" = type { %"class.std::__shared_mutex_pthread" }
%"class.std::__shared_mutex_pthread" = type { %union.pthread_rwlock_t }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%"class.std::thread::id" = type { i64 }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt11shared_lockIN3JPH11SharedMutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #2 align 2

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH20BroadPhaseBruteForce12CollidePointENS_4Vec3ERNS_18CollisionCollectorINS_6BodyIDENS_36CollisionCollectorTraitsCollideShapeEEERKNS_21BroadPhaseLayerFilterERKNS_17ObjectLayerFilterE(ptr noundef nonnull align 8 dereferenceable(104) %0, double %1, double %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.JPH::Vec3", align 16
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %"class.std::shared_lock", align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca %"class.JPH::BodyID", align 4
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca %"class.JPH::Vec3", align 16
  %23 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 0
  store double %1, ptr %23, align 16
  %24 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 1
  store double %2, ptr %24, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  store ptr %5, ptr %11, align 8, !tbaa !5
  %25 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #5
  %26 = getelementptr inbounds %"class.JPH::BroadPhaseBruteForce", ptr %25, i32 0, i32 2
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9) %12, ptr noundef nonnull align 8 dereferenceable(64) %26)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %27 = getelementptr inbounds %"class.JPH::BroadPhaseBruteForce", ptr %25, i32 0, i32 1
  store ptr %27, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %28 = load ptr, ptr %13, align 8, !tbaa !5
  %29 = invoke noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %28)
          to label %30 unwind label %39

30:                                               ; preds = %6
  store ptr %29, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %31 = load ptr, ptr %13, align 8, !tbaa !5
  %32 = invoke noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %31)
          to label %33 unwind label %43

33:                                               ; preds = %30
  store ptr %32, ptr %17, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %103, %33
  %35 = load ptr, ptr %14, align 8, !tbaa !5
  %36 = load ptr, ptr %17, align 8, !tbaa !5
  %37 = icmp ne ptr %35, %36
  br i1 %37, label %47, label %38

38:                                               ; preds = %34
  store i32 2, ptr %18, align 4
  br label %107

39:                                               ; preds = %6
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %15, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %16, align 4
  br label %109

43:                                               ; preds = %30
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %15, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %16, align 4
  br label %108

47:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %48 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %48, i64 4, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %49 = getelementptr inbounds %"class.JPH::BroadPhase", ptr %25, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !12
  %51 = invoke noundef nonnull align 16 dereferenceable(122) ptr @_ZN3JPH11BodyManager7GetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %50, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %52 unwind label %83

52:                                               ; preds = %47
  store ptr %51, ptr %20, align 8, !tbaa !5
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = load ptr, ptr %20, align 8, !tbaa !5
  %55 = invoke noundef zeroext i16 @_ZNK3JPH4Body14GetObjectLayerEv(ptr noundef nonnull align 16 dereferenceable(122) %54)
          to label %56 unwind label %83

56:                                               ; preds = %52
  %57 = load ptr, ptr %53, align 8, !tbaa !15
  %58 = getelementptr inbounds ptr, ptr %57, i64 2
  %59 = load ptr, ptr %58, align 8
  %60 = invoke noundef zeroext i1 %59(ptr noundef nonnull align 8 dereferenceable(8) %53, i16 noundef zeroext %55)
          to label %61 unwind label %83

61:                                               ; preds = %56
  br i1 %60, label %62, label %96

62:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %63 = load ptr, ptr %20, align 8, !tbaa !5
  %64 = invoke noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %63)
          to label %65 unwind label %87

65:                                               ; preds = %62
  store ptr %64, ptr %21, align 8, !tbaa !5
  %66 = load ptr, ptr %21, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %22, ptr align 16 %7, i64 16, i1 false), !tbaa.struct !17
  %67 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %68 = load double, ptr %67, align 16
  %69 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %70 = load double, ptr %69, align 8
  %71 = invoke noundef zeroext i1 @_ZNK3JPH5AABox8ContainsENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32) %66, double %68, double %70)
          to label %72 unwind label %87

72:                                               ; preds = %65
  br i1 %71, label %73, label %92

73:                                               ; preds = %72
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load ptr, ptr %74, align 8, !tbaa !15
  %76 = getelementptr inbounds ptr, ptr %75, i64 6
  %77 = load ptr, ptr %76, align 8
  invoke void %77(ptr noundef nonnull align 8 dereferenceable(24) %74, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %78 unwind label %87

78:                                               ; preds = %73
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = invoke noundef zeroext i1 @_ZNK3JPH18CollisionCollectorINS_6BodyIDENS_36CollisionCollectorTraitsCollideShapeEE14ShouldEarlyOutEv(ptr noundef nonnull align 8 dereferenceable(24) %79)
          to label %81 unwind label %87

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

82:                                               ; preds = %81
  store i32 2, ptr %18, align 4
  br label %93

83:                                               ; preds = %56, %52, %47
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %15, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %16, align 4
  br label %106

87:                                               ; preds = %78, %73, %65, %62
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %15, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %106

91:                                               ; preds = %81
  br label %92

92:                                               ; preds = %91, %72
  store i32 0, ptr %18, align 4
  br label %93

93:                                               ; preds = %92, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  %94 = load i32, ptr %18, align 4
  switch i32 %94, label %97 [
    i32 0, label %95
  ]

95:                                               ; preds = %93
  br label %96

96:                                               ; preds = %95, %61
  store i32 0, ptr %18, align 4
  br label %97

97:                                               ; preds = %96, %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  %98 = load i32, ptr %18, align 4
  switch i32 %98, label %100 [
    i32 0, label %99
  ]

99:                                               ; preds = %97
  store i32 0, ptr %18, align 4
  br label %100

100:                                              ; preds = %99, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  %101 = load i32, ptr %18, align 4
  switch i32 %101, label %107 [
    i32 0, label %102
  ]

102:                                              ; preds = %100
  br label %103

103:                                              ; preds = %102
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  %105 = getelementptr inbounds %"class.JPH::BodyID", ptr %104, i32 1
  store ptr %105, ptr %14, align 8, !tbaa !5
  br label %34

106:                                              ; preds = %87, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %108

107:                                              ; preds = %100, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %110

108:                                              ; preds = %106, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %109

109:                                              ; preds = %108, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  br label %111

110:                                              ; preds = %107
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  ret void

111:                                              ; preds = %109
  %112 = load ptr, ptr %15, align 8
  %113 = load i32, ptr %16, align 4
  %114 = insertvalue { ptr, i32 } poison, ptr %112, 0
  %115 = insertvalue { ptr, i32 } %114, i32 %113, 1
  resume { ptr, i32 } %115
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH5AABox8ContainsENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32), double, double) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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 = !{i64 0, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 8}
!13 = !{!"_ZTSN3JPH10BroadPhaseE", !14, i64 0, !6, i64 8}
!14 = !{!"_ZTSN3JPH15BroadPhaseQueryE"}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{i64 0, i64 16, !18}
!18 = !{!7, !7, i64 0}


; 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.std::shared_lock" = type <{ ptr, i8, [7 x i8] }>
%"class.JPH::BodyID" = type { i32 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH5ArrayINS_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 @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(122) ptr @_ZN3JPH11BodyManager7GetBodyERKNS_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 zeroext i16 @_ZNK3JPH4Body14GetObjectLayerEv(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 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH20BroadPhaseBruteForce12CollidePointENS_4Vec3ERNS_18CollisionCollectorINS_6BodyIDENS_36CollisionCollectorTraitsCollideShapeEEERKNS_21BroadPhaseLayerFilterERKNS_17ObjectLayerFilterE(ptr noundef nonnull align 8 dereferenceable(104) %0, double %1, double %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.std::shared_lock", align 8
  %8 = alloca %"class.JPH::BodyID", align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9) %7, ptr noundef nonnull align 8 dereferenceable(64) %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = call noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %12 = call noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %.not30 = icmp eq ptr %11, %12
  br i1 %.not30, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %6
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  br label %14

14:                                               ; preds = %.lr.ph, %.thread
  %.031 = phi ptr [ %11, %.lr.ph ], [ %40, %.thread ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %15 = load i32, ptr %.031, align 4, !tbaa !5
  store i32 %15, ptr %8, align 4, !tbaa !5
  %16 = load ptr, ptr %13, align 8, !tbaa !9
  %17 = invoke noundef nonnull align 16 dereferenceable(122) ptr @_ZN3JPH11BodyManager7GetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %16, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %18 unwind label %35

18:                                               ; preds = %14
  %19 = call noundef zeroext i16 @_ZNK3JPH4Body14GetObjectLayerEv(ptr noundef nonnull align 16 dereferenceable(122) %17)
  %20 = load ptr, ptr %5, align 8, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  %22 = load ptr, ptr %21, align 8
  %23 = invoke noundef zeroext i1 %22(ptr noundef nonnull align 8 dereferenceable(8) %5, i16 noundef zeroext %19)
          to label %24 unwind label %35

24:                                               ; preds = %18
  br i1 %23, label %25, label %.thread

25:                                               ; preds = %24
  %26 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %17)
  %27 = invoke noundef zeroext i1 @_ZNK3JPH5AABox8ContainsENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32) %26, double %1, double %2)
          to label %28 unwind label %37

28:                                               ; preds = %25
  br i1 %27, label %29, label %.thread

29:                                               ; preds = %28
  %30 = load ptr, ptr %3, align 8, !tbaa !13
  %31 = getelementptr inbounds i8, ptr %30, i64 48
  %32 = load ptr, ptr %31, align 8
  invoke void %32(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %33 unwind label %37

33:                                               ; preds = %29
  %34 = call noundef zeroext i1 @_ZNK3JPH18CollisionCollectorINS_6BodyIDENS_36CollisionCollectorTraitsCollideShapeEE14ShouldEarlyOutEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  br i1 %34, label %39, label %.thread

35:                                               ; preds = %18, %14
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %41

37:                                               ; preds = %29, %25
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %41

39:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %.loopexit

.thread:                                          ; preds = %33, %28, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  %40 = getelementptr inbounds i8, ptr %.031, i64 4
  %.not = icmp eq ptr %40, %12
  br i1 %.not, label %.loopexit, label %14

41:                                               ; preds = %37, %35
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %36, %35 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  resume { ptr, i32 } %.pn

.loopexit:                                        ; preds = %.thread, %6, %39
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH5AABox8ContainsENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32), double, double) local_unnamed_addr #1 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 8}
!10 = !{!"_ZTSN3JPH10BroadPhaseE", !11, i64 0, !12, i64 8}
!11 = !{!"_ZTSN3JPH15BroadPhaseQueryE"}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}


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