; 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.std::shared_lock" = type <{ ptr, i8, [7 x i8] }>
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::RayInvDirection" = type { %"class.JPH::Vec3", %"class.JPH::UVec4" }
%"class.JPH::UVec4" = type { %union.anon.10 }
%union.anon.10 = type { <2 x i64> }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::BroadPhaseCastResult" = type { %"class.JPH::BodyID", float }
%"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 }
%"struct.JPH::RayCastT" = type { %"class.JPH::Vec3", %"class.JPH::Vec3" }
%"class.JPH::AABox" = type { %"class.JPH::Vec3", %"class.JPH::Vec3" }

; 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
define dso_local void @_ZNK3JPH20BroadPhaseBruteForce7CastRayERKNS_7RayCastERNS_18CollisionCollectorINS_20BroadPhaseCastResultENS_31CollisionCollectorTraitsCastRayEEERKNS_21BroadPhaseLayerFilterERKNS_17ObjectLayerFilterE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef nonnull align 16 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %"class.std::shared_lock", align 8
  %12 = alloca %"class.JPH::Vec3", align 16
  %13 = alloca %"class.JPH::RayInvDirection", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca float, 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 float, align 4
  %26 = alloca %"class.JPH::Vec3", align 16
  %27 = alloca %"class.JPH::Vec3", align 16
  %28 = alloca %"class.JPH::Vec3", align 16
  %29 = alloca %"class.JPH::BroadPhaseCastResult", align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %30 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  %31 = getelementptr inbounds %"class.JPH::BroadPhaseBruteForce", ptr %30, i32 0, i32 2
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9) %11, ptr noundef nonnull align 8 dereferenceable(64) %31)
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.JPH::RayCastT", ptr %32, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 %33, i64 16, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #7
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.JPH::RayCastT", ptr %34, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 %35, i64 16, i1 false), !tbaa.struct !9
  %36 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %37 = load double, ptr %36, align 16
  %38 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %39 = load double, ptr %38, align 8
  invoke void @_ZN3JPH15RayInvDirectionC2ENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32) %13, double %37, double %39)
          to label %40 unwind label %56

40:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = invoke noundef float @_ZNK3JPH18CollisionCollectorINS_20BroadPhaseCastResultENS_31CollisionCollectorTraitsCastRayEE19GetEarlyOutFractionEv(ptr noundef nonnull align 8 dereferenceable(24) %41)
          to label %43 unwind label %60

43:                                               ; preds = %40
  store float %42, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %44 = getelementptr inbounds %"class.JPH::BroadPhaseBruteForce", ptr %30, i32 0, i32 1
  store ptr %44, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %45 = load ptr, ptr %18, align 8, !tbaa !5
  %46 = invoke noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %45)
          to label %47 unwind label %64

47:                                               ; preds = %43
  store ptr %46, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %48 = load ptr, ptr %18, align 8, !tbaa !5
  %49 = invoke noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %48)
          to label %50 unwind label %68

50:                                               ; preds = %47
  store ptr %49, ptr %20, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %161, %50
  %52 = load ptr, ptr %19, align 8, !tbaa !5
  %53 = load ptr, ptr %20, align 8, !tbaa !5
  %54 = icmp ne ptr %52, %53
  br i1 %54, label %72, label %55

55:                                               ; preds = %51
  store i32 2, ptr %21, align 4
  br label %165

56:                                               ; preds = %5
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %15, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %16, align 4
  br label %170

60:                                               ; preds = %40
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %15, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %16, align 4
  br label %169

64:                                               ; preds = %43
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %15, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %16, align 4
  br label %167

68:                                               ; preds = %47
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %15, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %16, align 4
  br label %166

72:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %73 = load ptr, ptr %19, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %73, i64 4, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %74 = getelementptr inbounds %"class.JPH::BroadPhase", ptr %30, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !16
  %76 = invoke noundef nonnull align 16 dereferenceable(122) ptr @_ZN3JPH11BodyManager7GetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %75, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %77 unwind label %125

77:                                               ; preds = %72
  store ptr %76, ptr %23, align 8, !tbaa !5
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = load ptr, ptr %23, align 8, !tbaa !5
  %80 = invoke noundef zeroext i16 @_ZNK3JPH4Body14GetObjectLayerEv(ptr noundef nonnull align 16 dereferenceable(122) %79)
          to label %81 unwind label %125

81:                                               ; preds = %77
  %82 = load ptr, ptr %78, align 8, !tbaa !19
  %83 = getelementptr inbounds ptr, ptr %82, i64 2
  %84 = load ptr, ptr %83, align 8
  %85 = invoke noundef zeroext i1 %84(ptr noundef nonnull align 8 dereferenceable(8) %78, i16 noundef zeroext %80)
          to label %86 unwind label %125

86:                                               ; preds = %81
  br i1 %85, label %87, label %154

87:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %88 = load ptr, ptr %23, align 8, !tbaa !5
  %89 = invoke noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %88)
          to label %90 unwind label %129

90:                                               ; preds = %87
  store ptr %89, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %26, ptr align 16 %12, i64 16, i1 false), !tbaa.struct !9
  %91 = load ptr, ptr %24, align 8, !tbaa !5
  %92 = getelementptr inbounds %"class.JPH::AABox", ptr %91, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %27, ptr align 16 %92, i64 16, i1 false), !tbaa.struct !9
  %93 = load ptr, ptr %24, align 8, !tbaa !5
  %94 = getelementptr inbounds %"class.JPH::AABox", ptr %93, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %28, ptr align 16 %94, i64 16, i1 false), !tbaa.struct !9
  %95 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 0
  %96 = load double, ptr %95, align 16
  %97 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 1
  %98 = load double, ptr %97, align 8
  %99 = getelementptr inbounds { double, double }, ptr %27, i32 0, i32 0
  %100 = load double, ptr %99, align 16
  %101 = getelementptr inbounds { double, double }, ptr %27, i32 0, i32 1
  %102 = load double, ptr %101, align 8
  %103 = getelementptr inbounds { double, double }, ptr %28, i32 0, i32 0
  %104 = load double, ptr %103, align 16
  %105 = getelementptr inbounds { double, double }, ptr %28, i32 0, i32 1
  %106 = load double, ptr %105, align 8
  %107 = invoke noundef float @_ZN3JPH8RayAABoxENS_4Vec3ERKNS_15RayInvDirectionES0_S0_(double %96, double %98, ptr noundef nonnull align 16 dereferenceable(32) %13, double %100, double %102, double %104, double %106)
          to label %108 unwind label %133

108:                                              ; preds = %90
  store float %107, ptr %25, align 4, !tbaa !11
  %109 = load float, ptr %25, align 4, !tbaa !11
  %110 = load float, ptr %17, align 4, !tbaa !11
  %111 = fcmp olt float %109, %110
  br i1 %111, label %112, label %148

112:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  %113 = getelementptr inbounds %"class.JPH::BroadPhaseCastResult", ptr %29, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %113, ptr align 4 %22, i64 4, i1 false), !tbaa.struct !13
  %114 = getelementptr inbounds %"class.JPH::BroadPhaseCastResult", ptr %29, i32 0, i32 1
  %115 = load float, ptr %25, align 4, !tbaa !11
  store float %115, ptr %114, align 4, !tbaa !21
  %116 = load ptr, ptr %8, align 8, !tbaa !5
  %117 = load ptr, ptr %116, align 8, !tbaa !19
  %118 = getelementptr inbounds ptr, ptr %117, i64 6
  %119 = load ptr, ptr %118, align 8
  invoke void %119(ptr noundef nonnull align 8 dereferenceable(24) %116, ptr noundef nonnull align 4 dereferenceable(8) %29)
          to label %120 unwind label %137

120:                                              ; preds = %112
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = invoke noundef zeroext i1 @_ZNK3JPH18CollisionCollectorINS_20BroadPhaseCastResultENS_31CollisionCollectorTraitsCastRayEE14ShouldEarlyOutEv(ptr noundef nonnull align 8 dereferenceable(24) %121)
          to label %123 unwind label %137

123:                                              ; preds = %120
  br i1 %122, label %124, label %141

124:                                              ; preds = %123
  store i32 2, ptr %21, align 4
  br label %145

125:                                              ; preds = %81, %77, %72
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %15, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %16, align 4
  br label %164

129:                                              ; preds = %87
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %15, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %16, align 4
  br label %153

133:                                              ; preds = %90
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %15, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %16, align 4
  br label %152

137:                                              ; preds = %141, %120, %112
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %15, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  br label %152

141:                                              ; preds = %123
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = invoke noundef float @_ZNK3JPH18CollisionCollectorINS_20BroadPhaseCastResultENS_31CollisionCollectorTraitsCastRayEE19GetEarlyOutFractionEv(ptr noundef nonnull align 8 dereferenceable(24) %142)
          to label %144 unwind label %137

144:                                              ; preds = %141
  store float %143, ptr %17, align 4, !tbaa !11
  store i32 0, ptr %21, align 4
  br label %145

145:                                              ; preds = %144, %124
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  %146 = load i32, ptr %21, align 4
  switch i32 %146, label %149 [
    i32 0, label %147
  ]

147:                                              ; preds = %145
  br label %148

148:                                              ; preds = %147, %108
  store i32 0, ptr %21, align 4
  br label %149

149:                                              ; preds = %148, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  %150 = load i32, ptr %21, align 4
  switch i32 %150, label %155 [
    i32 0, label %151
  ]

151:                                              ; preds = %149
  br label %154

152:                                              ; preds = %137, %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %153

153:                                              ; preds = %152, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %164

154:                                              ; preds = %151, %86
  store i32 0, ptr %21, align 4
  br label %155

155:                                              ; preds = %154, %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  %156 = load i32, ptr %21, align 4
  switch i32 %156, label %158 [
    i32 0, label %157
  ]

157:                                              ; preds = %155
  store i32 0, ptr %21, align 4
  br label %158

158:                                              ; preds = %157, %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  %159 = load i32, ptr %21, align 4
  switch i32 %159, label %165 [
    i32 0, label %160
  ]

160:                                              ; preds = %158
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr %19, align 8, !tbaa !5
  %163 = getelementptr inbounds %"class.JPH::BodyID", ptr %162, i32 1
  store ptr %163, ptr %19, align 8, !tbaa !5
  br label %51

164:                                              ; preds = %153, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %166

165:                                              ; preds = %158, %55
  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 %168

166:                                              ; preds = %164, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %167

167:                                              ; preds = %166, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %169

168:                                              ; preds = %165
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  ret void

169:                                              ; preds = %167, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %170

170:                                              ; preds = %169, %56
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  br label %171

171:                                              ; preds = %170
  %172 = load ptr, ptr %15, align 8
  %173 = load i32, ptr %16, align 4
  %174 = insertvalue { ptr, i32 } poison, ptr %172, 0
  %175 = insertvalue { ptr, i32 } %174, i32 %173, 1
  resume { ptr, i32 } %175
}

; 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 uwtable
declare dso_local void @_ZN3JPH15RayInvDirectionC2ENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32), double, double) unnamed_addr #3 align 2

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

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZN3JPH8RayAABoxENS_4Vec3ERKNS_15RayInvDirectionES0_S0_(double, double, ptr noundef nonnull align 16 dereferenceable(32), double, double, double, double) #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #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 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 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 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 = { 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 #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 = !{i64 0, i64 16, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{i64 0, i64 4, !14}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !6, i64 8}
!17 = !{!"_ZTSN3JPH10BroadPhaseE", !18, i64 0, !6, i64 8}
!18 = !{!"_ZTSN3JPH15BroadPhaseQueryE"}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !8, i64 0}
!21 = !{!22, !12, i64 4}
!22 = !{!"_ZTSN3JPH20BroadPhaseCastResultE", !23, i64 0, !12, i64 4}
!23 = !{!"_ZTSN3JPH6BodyIDE", !15, 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::RayInvDirection" = type { %"class.JPH::Vec3", %"class.JPH::UVec4" }
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::UVec4" = type { %union.anon.10 }
%union.anon.10 = type { <2 x i64> }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::BroadPhaseCastResult" = type { %"class.JPH::BodyID", float }

; 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
define dso_local void @_ZNK3JPH20BroadPhaseBruteForce7CastRayERKNS_7RayCastERNS_18CollisionCollectorINS_20BroadPhaseCastResultENS_31CollisionCollectorTraitsCastRayEEERKNS_21BroadPhaseLayerFilterERKNS_17ObjectLayerFilterE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr nocapture noundef nonnull readonly align 16 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.std::shared_lock", align 8
  %7 = alloca %"class.JPH::RayInvDirection", align 16
  %8 = alloca %"class.JPH::BodyID", align 4
  %9 = alloca %"class.JPH::BroadPhaseCastResult", align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9) %6, ptr noundef nonnull align 8 dereferenceable(64) %10)
  %.sroa.027.0.copyload = load double, ptr %1, align 16
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.5.0.copyload = load double, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #6
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  %.sroa.025.0.copyload = load double, ptr %11, align 16
  %.sroa.226.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 24
  %.sroa.226.0.copyload = load double, ptr %.sroa.226.0..sroa_idx, align 8, !tbaa !5
  invoke void @_ZN3JPH15RayInvDirectionC2ENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32) %7, double %.sroa.025.0.copyload, double %.sroa.226.0.copyload)
          to label %12 unwind label %19

12:                                               ; preds = %5
  %13 = call noundef float @_ZNK3JPH18CollisionCollectorINS_20BroadPhaseCastResultENS_31CollisionCollectorTraitsCastRayEE19GetEarlyOutFractionEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = call noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %16 = call noundef ptr @_ZNK3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %.not67 = icmp eq ptr %15, %16
  br i1 %.not67, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %12
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = getelementptr inbounds i8, ptr %9, i64 4
  br label %21

19:                                               ; preds = %5
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %56

21:                                               ; preds = %.lr.ph, %53
  %.03969 = phi float [ %13, %.lr.ph ], [ %.553, %53 ]
  %.04268 = phi ptr [ %15, %.lr.ph ], [ %54, %53 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  %22 = load i32, ptr %.04268, align 4, !tbaa !8
  store i32 %22, ptr %8, align 4, !tbaa !8
  %23 = load ptr, ptr %17, align 8, !tbaa !10
  %24 = invoke noundef nonnull align 16 dereferenceable(122) ptr @_ZN3JPH11BodyManager7GetBodyERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(297) %23, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %25 unwind label %45

25:                                               ; preds = %21
  %26 = call noundef zeroext i16 @_ZNK3JPH4Body14GetObjectLayerEv(ptr noundef nonnull align 16 dereferenceable(122) %24)
  %27 = load ptr, ptr %4, align 8, !tbaa !14
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %29 = load ptr, ptr %28, align 8
  %30 = invoke noundef zeroext i1 %29(ptr noundef nonnull align 8 dereferenceable(8) %4, i16 noundef zeroext %26)
          to label %31 unwind label %45

31:                                               ; preds = %25
  br i1 %30, label %32, label %.thread

.thread:                                          ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %53

32:                                               ; preds = %31
  %33 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %24)
  %.sroa.04.0.copyload = load double, ptr %33, align 16
  %.sroa.25.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 8
  %.sroa.25.0.copyload = load double, ptr %.sroa.25.0..sroa_idx, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %.sroa.0.0.copyload = load double, ptr %34, align 16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 24
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !5
  %35 = invoke noundef float @_ZN3JPH8RayAABoxENS_4Vec3ERKNS_15RayInvDirectionES0_S0_(double %.sroa.027.0.copyload, double %.sroa.5.0.copyload, ptr noundef nonnull align 16 dereferenceable(32) %7, double %.sroa.04.0.copyload, double %.sroa.25.0.copyload, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
          to label %36 unwind label %47

36:                                               ; preds = %32
  %37 = fcmp olt float %35, %.03969
  br i1 %37, label %38, label %.thread54

38:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %39 = load i32, ptr %8, align 4, !tbaa !8
  store i32 %39, ptr %9, align 4, !tbaa !8
  store float %35, ptr %18, align 4, !tbaa !16
  %40 = load ptr, ptr %2, align 8, !tbaa !14
  %41 = getelementptr inbounds i8, ptr %40, i64 48
  %42 = load ptr, ptr %41, align 8
  invoke void %42(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %43 unwind label %49

43:                                               ; preds = %38
  %44 = call noundef zeroext i1 @_ZNK3JPH18CollisionCollectorINS_20BroadPhaseCastResultENS_31CollisionCollectorTraitsCastRayEE14ShouldEarlyOutEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  br i1 %44, label %.thread63, label %51

45:                                               ; preds = %25, %21
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %55

47:                                               ; preds = %32
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %55

49:                                               ; preds = %38
  %50 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %55

51:                                               ; preds = %43
  %52 = call noundef float @_ZNK3JPH18CollisionCollectorINS_20BroadPhaseCastResultENS_31CollisionCollectorTraitsCastRayEE19GetEarlyOutFractionEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %.thread54

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

.thread54:                                        ; preds = %36, %51
  %.3.ph = phi float [ %52, %51 ], [ %.03969, %36 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %53

53:                                               ; preds = %.thread54, %.thread
  %.553 = phi float [ %.03969, %.thread ], [ %.3.ph, %.thread54 ]
  %54 = getelementptr inbounds i8, ptr %.04268, i64 4
  %.not = icmp eq ptr %54, %16
  br i1 %.not, label %.loopexit, label %21

55:                                               ; preds = %47, %49, %45
  %.pn.pn = phi { ptr, i32 } [ %46, %45 ], [ %50, %49 ], [ %48, %47 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %56

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

56:                                               ; preds = %55, %19
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %55 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #6
  call void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  resume { ptr, i32 } %.pn.pn.pn
}

; 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 uwtable
declare dso_local void @_ZN3JPH15RayInvDirectionC2ENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(32), double, double) unnamed_addr #2 align 2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZN3JPH8RayAABoxENS_4Vec3ERKNS_15RayInvDirectionES0_S0_(double, double, ptr noundef nonnull align 16 dereferenceable(32), double, double, double, double) local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt11shared_lockIN3JPH11SharedMutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) 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 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 = { alwaysinline 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 = { 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !13, i64 8}
!11 = !{!"_ZTSN3JPH10BroadPhaseE", !12, i64 0, !13, i64 8}
!12 = !{!"_ZTSN3JPH15BroadPhaseQueryE"}
!13 = !{!"any pointer", !6, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"vtable pointer", !7, i64 0}
!16 = !{!17, !19, i64 4}
!17 = !{!"_ZTSN3JPH20BroadPhaseCastResultE", !18, i64 0, !19, i64 4}
!18 = !{!"_ZTSN3JPH6BodyIDE", !9, i64 0}
!19 = !{!"float", !6, i64 0}


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