; 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 @_ZNK3JPH20BroadPhaseBruteForce13CollideSphereENS_4Vec3EfRNS_18CollisionCollectorINS_6BodyIDENS_36CollisionCollectorTraitsCollideShapeEEERKNS_21BroadPhaseLayerFilterERKNS_17ObjectLayerFilterE(ptr noundef nonnull align 8 dereferenceable(104) %0, double %1, double %2, float noundef %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca %"class.JPH::Vec3", align 16
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %"class.std::shared_lock", align 8
  %15 = alloca float, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca %"class.JPH::BodyID", align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca %"class.JPH::Vec3", align 16
  %26 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 0
  store double %1, ptr %26, align 16
  %27 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 1
  store double %2, ptr %27, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store float %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  store ptr %6, ptr %13, align 8, !tbaa !5
  %28 = load ptr, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #7
  %29 = getelementptr inbounds %"class.JPH::BroadPhaseBruteForce", ptr %28, i32 0, i32 2
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9) %14, ptr noundef nonnull align 8 dereferenceable(64) %29)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %30 = load float, ptr %10, align 4, !tbaa !9
  %31 = invoke noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %30)
          to label %32 unwind label %45

32:                                               ; preds = %7
  store float %31, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %33 = getelementptr inbounds %"class.JPH::BroadPhaseBruteForce", ptr %28, i32 0, i32 1
  store ptr %33, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %34 = load ptr, ptr %18, align 8, !tbaa !5
  %35 = invoke noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %34)
          to label %36 unwind label %49

36:                                               ; preds = %32
  store ptr %35, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %37 = load ptr, ptr %18, align 8, !tbaa !5
  %38 = invoke noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %37)
          to label %39 unwind label %53

39:                                               ; preds = %36
  store ptr %38, ptr %20, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %115, %39
  %41 = load ptr, ptr %19, align 8, !tbaa !5
  %42 = load ptr, ptr %20, align 8, !tbaa !5
  %43 = icmp ne ptr %41, %42
  br i1 %43, label %57, label %44

44:                                               ; preds = %40
  store i32 2, ptr %21, align 4
  br label %119

45:                                               ; preds = %7
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %16, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %17, align 4
  br label %123

49:                                               ; preds = %32
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %16, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %17, align 4
  br label %121

53:                                               ; preds = %36
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %16, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %17, align 4
  br label %120

57:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %58 = load ptr, ptr %19, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %58, i64 4, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %59 = getelementptr inbounds %"class.JPH::BroadPhase", ptr %28, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = invoke noundef nonnull align 16 dereferenceable(122) ptr @_ZN3JPH11BodyManager7GetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %60, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %62 unwind label %95

62:                                               ; preds = %57
  store ptr %61, ptr %23, align 8, !tbaa !5
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = load ptr, ptr %23, align 8, !tbaa !5
  %65 = invoke noundef zeroext i16 @_ZNK3JPH4Body14GetObjectLayerEv(ptr noundef nonnull align 16 dereferenceable(122) %64)
          to label %66 unwind label %95

66:                                               ; preds = %62
  %67 = load ptr, ptr %63, align 8, !tbaa !17
  %68 = getelementptr inbounds ptr, ptr %67, i64 2
  %69 = load ptr, ptr %68, align 8
  %70 = invoke noundef zeroext i1 %69(ptr noundef nonnull align 8 dereferenceable(8) %63, i16 noundef zeroext %65)
          to label %71 unwind label %95

71:                                               ; preds = %66
  br i1 %70, label %72, label %108

72:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %73 = load ptr, ptr %23, align 8, !tbaa !5
  %74 = invoke noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %73)
          to label %75 unwind label %99

75:                                               ; preds = %72
  store ptr %74, ptr %24, align 8, !tbaa !5
  %76 = load ptr, ptr %24, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %25, ptr align 16 %8, i64 16, i1 false), !tbaa.struct !19
  %77 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 0
  %78 = load double, ptr %77, align 16
  %79 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 1
  %80 = load double, ptr %79, align 8
  %81 = invoke noundef float @_ZNK3JPH5AABox15GetSqDistanceToENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32) %76, double %78, double %80)
          to label %82 unwind label %99

82:                                               ; preds = %75
  %83 = load float, ptr %15, align 4, !tbaa !9
  %84 = fcmp ole float %81, %83
  br i1 %84, label %85, label %104

85:                                               ; preds = %82
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = load ptr, ptr %86, align 8, !tbaa !17
  %88 = getelementptr inbounds ptr, ptr %87, i64 6
  %89 = load ptr, ptr %88, align 8
  invoke void %89(ptr noundef nonnull align 8 dereferenceable(24) %86, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %90 unwind label %99

90:                                               ; preds = %85
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  %92 = invoke noundef zeroext i1 @_ZNK3JPH18CollisionCollectorINS_6BodyIDENS_36CollisionCollectorTraitsCollideShapeEE14ShouldEarlyOutEv(ptr noundef nonnull align 8 dereferenceable(24) %91)
          to label %93 unwind label %99

93:                                               ; preds = %90
  br i1 %92, label %94, label %103

94:                                               ; preds = %93
  store i32 2, ptr %21, align 4
  br label %105

95:                                               ; preds = %66, %62, %57
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %16, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %17, align 4
  br label %118

99:                                               ; preds = %90, %85, %75, %72
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %16, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %118

103:                                              ; preds = %93
  br label %104

104:                                              ; preds = %103, %82
  store i32 0, ptr %21, align 4
  br label %105

105:                                              ; preds = %104, %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  %106 = load i32, ptr %21, align 4
  switch i32 %106, label %109 [
    i32 0, label %107
  ]

107:                                              ; preds = %105
  br label %108

108:                                              ; preds = %107, %71
  store i32 0, ptr %21, align 4
  br label %109

109:                                              ; preds = %108, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  %110 = load i32, ptr %21, align 4
  switch i32 %110, label %112 [
    i32 0, label %111
  ]

111:                                              ; preds = %109
  store i32 0, ptr %21, align 4
  br label %112

112:                                              ; preds = %111, %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  %113 = load i32, ptr %21, align 4
  switch i32 %113, label %119 [
    i32 0, label %114
  ]

114:                                              ; preds = %112
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr %19, align 8, !tbaa !5
  %117 = getelementptr inbounds %"class.JPH::BodyID", ptr %116, i32 1
  store ptr %117, ptr %19, align 8, !tbaa !5
  br label %40

118:                                              ; preds = %99, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %120

119:                                              ; preds = %112, %44
  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
  br label %122

120:                                              ; preds = %118, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %121

121:                                              ; preds = %120, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %123

122:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %14) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #7
  ret void

123:                                              ; preds = %121, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %14) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #7
  br label %124

124:                                              ; preds = %123
  %125 = load ptr, ptr %16, align 8
  %126 = load i32, ptr %17, align 4
  %127 = insertvalue { ptr, i32 } poison, ptr %125, 0
  %128 = insertvalue { ptr, i32 } %127, i32 %126, 1
  resume { ptr, i32 } %128
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH5AABox15GetSqDistanceToENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32), double, double) #6 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 = { alwaysinline 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 #6 = { 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 #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 = !{!"float", !7, i64 0}
!11 = !{i64 0, i64 4, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 8}
!15 = !{!"_ZTSN3JPH10BroadPhaseE", !16, i64 0, !6, i64 8}
!16 = !{!"_ZTSN3JPH15BroadPhaseQueryE"}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !8, i64 0}
!19 = !{i64 0, i64 16, !20}
!20 = !{!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 @_ZNK3JPH20BroadPhaseBruteForce13CollideSphereENS_4Vec3EfRNS_18CollisionCollectorINS_6BodyIDENS_36CollisionCollectorTraitsCollideShapeEEERKNS_21BroadPhaseLayerFilterERKNS_17ObjectLayerFilterE(ptr noundef nonnull align 8 dereferenceable(104) %0, double %1, double %2, float noundef %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca %"class.std::shared_lock", align 8
  %9 = alloca %"class.JPH::BodyID", align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9) %8, ptr noundef nonnull align 8 dereferenceable(64) %10)
  %11 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %3)
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = call noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %14 = call noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %.not32 = icmp eq ptr %13, %14
  br i1 %.not32, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %7
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  br label %16

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

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

26:                                               ; preds = %20
  br i1 %25, label %27, label %.thread

27:                                               ; preds = %26
  %28 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %19)
  %29 = invoke noundef float @_ZNK3JPH5AABox15GetSqDistanceToENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32) %28, double %1, double %2)
          to label %30 unwind label %40

30:                                               ; preds = %27
  %31 = fcmp ugt float %29, %11
  br i1 %31, label %.thread, label %32

32:                                               ; preds = %30
  %33 = load ptr, ptr %4, align 8, !tbaa !13
  %34 = getelementptr inbounds i8, ptr %33, i64 48
  %35 = load ptr, ptr %34, align 8
  invoke void %35(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %36 unwind label %40

36:                                               ; preds = %32
  %37 = call noundef zeroext i1 @_ZNK3JPH18CollisionCollectorINS_6BodyIDENS_36CollisionCollectorTraitsCollideShapeEE14ShouldEarlyOutEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  br i1 %37, label %42, label %.thread

38:                                               ; preds = %20, %16
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %44

40:                                               ; preds = %32, %27
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %44

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

.thread:                                          ; preds = %36, %30, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  %43 = getelementptr inbounds i8, ptr %.02433, i64 4
  %.not = icmp eq ptr %43, %14
  br i1 %.not, label %.loopexit, label %16

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

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH5AABox15GetSqDistanceToENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32), double, double) local_unnamed_addr #5 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 = { alwaysinline 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 = { 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 = { 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