; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Collision/Shape (TriangleShape)

; 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.3 }
%union.anon.3 = type { <4 x float> }
%"class.JPH::RayCastResult" = type { %"class.JPH::BroadPhaseCastResult", %"class.JPH::SubShapeID" }
%"class.JPH::BroadPhaseCastResult" = type { %"class.JPH::BodyID", float }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::SubShapeID" = type { i32 }
%"class.JPH::RayCastSettings" = type { i8, i8, i8 }
%"class.JPH::TriangleShape" = type <{ %"class.JPH::ConvexShape.base", [4 x i8], %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", float, [12 x i8] }>
%"class.JPH::ConvexShape.base" = type <{ %"class.JPH::Shape.base", [6 x i8], %"class.JPH::RefConst", float }>
%"class.JPH::Shape.base" = type <{ ptr, %"class.JPH::RefTarget.4", [4 x i8], i64, i8, i8 }>
%"class.JPH::RefTarget.4" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::RefConst" = type { ptr }
%"struct.JPH::RayCastT" = 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

; 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: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZN3JPH11RayTriangleENS_4Vec3ES0_S0_S0_S0_(double, double, double, double, double, double, double, double, ptr noundef byval(%"class.JPH::Vec3") align 16) #3

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH13TriangleShape7CastRayERKNS_7RayCastERKNS_15RayCastSettingsERKNS_17SubShapeIDCreatorERNS_18CollisionCollectorINS_13RayCastResultENS_31CollisionCollectorTraitsCastRayEEERKNS_11ShapeFilterE(ptr noundef nonnull align 16 dereferenceable(112) %0, ptr noundef nonnull align 16 dereferenceable(32) %1, ptr noundef nonnull align 1 dereferenceable(3) %2, ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(12) %5) unnamed_addr #5 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.JPH::Vec3", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca %"class.JPH::Vec3", align 16
  %16 = alloca %"class.JPH::Vec3", align 16
  %17 = alloca %"class.JPH::Vec3", align 16
  %18 = alloca %"class.JPH::Vec3", align 16
  %19 = alloca float, align 4
  %20 = alloca %"class.JPH::Vec3", align 16
  %21 = alloca %"class.JPH::Vec3", align 16
  %22 = alloca %"class.JPH::Vec3", align 16
  %23 = alloca %"class.JPH::Vec3", align 16
  %24 = alloca %"class.JPH::Vec3", align 16
  %25 = alloca %"class.JPH::RayCastResult", align 4
  %26 = alloca %"class.JPH::BodyID", align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %27 = load ptr, ptr %7, align 8
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH17SubShapeIDCreator5GetIDEv(ptr noundef nonnull align 4 dereferenceable(8) %29)
  %31 = load ptr, ptr %28, align 8, !tbaa !9
  %32 = getelementptr inbounds ptr, ptr %31, i64 2
  %33 = load ptr, ptr %32, align 8
  %34 = call noundef zeroext i1 %33(ptr noundef nonnull align 8 dereferenceable(12) %28, ptr noundef %27, ptr noundef nonnull align 4 dereferenceable(4) %30)
  br i1 %34, label %36, label %35

35:                                               ; preds = %6
  br label %135

36:                                               ; preds = %6
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.JPH::RayCastSettings", ptr %37, i32 0, i32 0
  %39 = load i8, ptr %38, align 1, !tbaa !11
  %40 = icmp eq i8 %39, 0
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #9
  br i1 %40, label %41, label %87

41:                                               ; preds = %36
  %42 = getelementptr inbounds %"class.JPH::TriangleShape", ptr %27, i32 0, i32 3
  %43 = getelementptr inbounds %"class.JPH::TriangleShape", ptr %27, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %15, ptr align 16 %43, i64 16, i1 false), !tbaa.struct !15
  %44 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 0
  %45 = load double, ptr %44, align 16
  %46 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 1
  %47 = load double, ptr %46, align 8
  %48 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %42, double %45, double %47)
  %49 = getelementptr inbounds %"class.JPH::Vec3", ptr %14, i32 0, i32 0
  %50 = getelementptr inbounds %union.anon.3, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds { double, double }, ptr %50, i32 0, i32 0
  %52 = extractvalue { double, double } %48, 0
  store double %52, ptr %51, align 16
  %53 = getelementptr inbounds { double, double }, ptr %50, i32 0, i32 1
  %54 = extractvalue { double, double } %48, 1
  store double %54, ptr %53, align 8
  %55 = getelementptr inbounds %"class.JPH::TriangleShape", ptr %27, i32 0, i32 4
  %56 = getelementptr inbounds %"class.JPH::TriangleShape", ptr %27, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %17, ptr align 16 %56, i64 16, i1 false), !tbaa.struct !15
  %57 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 0
  %58 = load double, ptr %57, align 16
  %59 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 1
  %60 = load double, ptr %59, align 8
  %61 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %55, double %58, double %60)
  %62 = getelementptr inbounds %"class.JPH::Vec3", ptr %16, i32 0, i32 0
  %63 = getelementptr inbounds %union.anon.3, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds { double, double }, ptr %63, i32 0, i32 0
  %65 = extractvalue { double, double } %61, 0
  store double %65, ptr %64, align 16
  %66 = getelementptr inbounds { double, double }, ptr %63, i32 0, i32 1
  %67 = extractvalue { double, double } %61, 1
  store double %67, ptr %66, align 8
  %68 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 0
  %69 = load double, ptr %68, align 16
  %70 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 1
  %71 = load double, ptr %70, align 8
  %72 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %14, double %69, double %71)
  %73 = getelementptr inbounds %"class.JPH::Vec3", ptr %13, i32 0, i32 0
  %74 = getelementptr inbounds %union.anon.3, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds { double, double }, ptr %74, i32 0, i32 0
  %76 = extractvalue { double, double } %72, 0
  store double %76, ptr %75, align 16
  %77 = getelementptr inbounds { double, double }, ptr %74, i32 0, i32 1
  %78 = extractvalue { double, double } %72, 1
  store double %78, ptr %77, align 8
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.JPH::RayCastT", ptr %79, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %18, ptr align 16 %80, i64 16, i1 false), !tbaa.struct !15
  %81 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %82 = load double, ptr %81, align 16
  %83 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %84 = load double, ptr %83, align 8
  %85 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %13, double %82, double %84)
  %86 = fcmp ogt float %85, 0.000000e+00
  br label %87

87:                                               ; preds = %41, %36
  %88 = phi i1 [ false, %36 ], [ %86, %41 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #9
  br i1 %88, label %89, label %90

89:                                               ; preds = %87
  br label %135

90:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = getelementptr inbounds %"struct.JPH::RayCastT", ptr %91, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 %92, i64 16, i1 false), !tbaa.struct !15
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = getelementptr inbounds %"struct.JPH::RayCastT", ptr %93, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %21, ptr align 16 %94, i64 16, i1 false), !tbaa.struct !15
  %95 = getelementptr inbounds %"class.JPH::TriangleShape", ptr %27, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %22, ptr align 16 %95, i64 16, i1 false), !tbaa.struct !15
  %96 = getelementptr inbounds %"class.JPH::TriangleShape", ptr %27, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %23, ptr align 16 %96, i64 16, i1 false), !tbaa.struct !15
  %97 = getelementptr inbounds %"class.JPH::TriangleShape", ptr %27, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %24, ptr align 16 %97, i64 16, i1 false), !tbaa.struct !15
  %98 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %99 = load double, ptr %98, align 16
  %100 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %101 = load double, ptr %100, align 8
  %102 = getelementptr inbounds { double, double }, ptr %21, i32 0, i32 0
  %103 = load double, ptr %102, align 16
  %104 = getelementptr inbounds { double, double }, ptr %21, i32 0, i32 1
  %105 = load double, ptr %104, align 8
  %106 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %107 = load double, ptr %106, align 16
  %108 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %109 = load double, ptr %108, align 8
  %110 = getelementptr inbounds { double, double }, ptr %23, i32 0, i32 0
  %111 = load double, ptr %110, align 16
  %112 = getelementptr inbounds { double, double }, ptr %23, i32 0, i32 1
  %113 = load double, ptr %112, align 8
  %114 = call noundef float @_ZN3JPH11RayTriangleENS_4Vec3ES0_S0_S0_S0_(double %99, double %101, double %103, double %105, double %107, double %109, double %111, double %113, ptr noundef byval(%"class.JPH::Vec3") align 16 %24)
  store float %114, ptr %19, align 4, !tbaa !17
  %115 = load float, ptr %19, align 4, !tbaa !17
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  %117 = call noundef float @_ZNK3JPH18CollisionCollectorINS_13RayCastResultENS_31CollisionCollectorTraitsCastRayEE19GetEarlyOutFractionEv(ptr noundef nonnull align 8 dereferenceable(24) %116)
  %118 = fcmp olt float %115, %117
  br i1 %118, label %119, label %134

119:                                              ; preds = %90
  call void @llvm.lifetime.start.p0(i64 12, ptr %25) #9
  call void @_ZN3JPH13RayCastResultC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %25)
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #9
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = call noundef ptr @_ZNK3JPH18CollisionCollectorINS_13RayCastResultENS_31CollisionCollectorTraitsCastRayEE10GetContextEv(ptr noundef nonnull align 8 dereferenceable(24) %120)
  %122 = call i32 @_ZN3JPH16TransformedShape10sGetBodyIDEPKS0_(ptr noundef %121)
  %123 = getelementptr inbounds %"class.JPH::BodyID", ptr %26, i32 0, i32 0
  store i32 %122, ptr %123, align 4
  %124 = getelementptr inbounds %"class.JPH::BroadPhaseCastResult", ptr %25, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %124, ptr align 4 %26, i64 4, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #9
  %125 = load float, ptr %19, align 4, !tbaa !17
  %126 = getelementptr inbounds %"class.JPH::BroadPhaseCastResult", ptr %25, i32 0, i32 1
  store float %125, ptr %126, align 4, !tbaa !22
  %127 = load ptr, ptr %10, align 8, !tbaa !5
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH17SubShapeIDCreator5GetIDEv(ptr noundef nonnull align 4 dereferenceable(8) %127)
  %129 = getelementptr inbounds %"class.JPH::RayCastResult", ptr %25, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %129, ptr align 4 %128, i64 4, i1 false), !tbaa.struct !19
  %130 = load ptr, ptr %11, align 8, !tbaa !5
  %131 = load ptr, ptr %130, align 8, !tbaa !9
  %132 = getelementptr inbounds ptr, ptr %131, i64 6
  %133 = load ptr, ptr %132, align 8
  call void %133(ptr noundef nonnull align 8 dereferenceable(24) %130, ptr noundef nonnull align 4 dereferenceable(12) %25)
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #9
  br label %134

134:                                              ; preds = %119, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %135

135:                                              ; preds = %134, %89, %35
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #6 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZN3JPH16TransformedShape10sGetBodyIDEPKS0_(ptr noundef) #8 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 = { 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 #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 = { 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 = { 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 #7 = { 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 #8 = { 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 #9 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3JPH15RayCastSettingsE", !13, i64 0, !13, i64 1, !14, i64 2}
!13 = !{!"_ZTSN3JPH13EBackFaceModeE", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i64 0, i64 16, !16}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{i64 0, i64 4, !20}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{!23, !18, i64 4}
!23 = !{!"_ZTSN3JPH20BroadPhaseCastResultE", !24, i64 0, !18, i64 4}
!24 = !{!"_ZTSN3JPH6BodyIDE", !21, 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.JPH::Vec3" = type { %union.anon.3 }
%union.anon.3 = type { <4 x float> }
%"class.JPH::RayCastResult" = type { %"class.JPH::BroadPhaseCastResult", %"class.JPH::SubShapeID" }
%"class.JPH::BroadPhaseCastResult" = type { %"class.JPH::BodyID", float }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::SubShapeID" = type { i32 }

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZN3JPH11RayTriangleENS_4Vec3ES0_S0_S0_S0_(double, double, double, double, double, double, double, double, ptr noundef byval(%"class.JPH::Vec3") align 16) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH17SubShapeIDCreator5GetIDEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH13TriangleShape7CastRayERKNS_7RayCastERKNS_15RayCastSettingsERKNS_17SubShapeIDCreatorERNS_18CollisionCollectorINS_13RayCastResultENS_31CollisionCollectorTraitsCastRayEEERKNS_11ShapeFilterE(ptr noundef nonnull align 16 dereferenceable(112) %0, ptr nocapture noundef nonnull readonly align 16 dereferenceable(32) %1, ptr nocapture noundef nonnull readonly align 1 dereferenceable(3) %2, ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(12) %5) unnamed_addr #4 align 2 {
  %7 = alloca %"class.JPH::Vec3", align 16
  %8 = alloca %"class.JPH::Vec3", align 16
  %9 = alloca %"class.JPH::RayCastResult", align 4
  %10 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH17SubShapeIDCreator5GetIDEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  %13 = load ptr, ptr %12, align 8
  %14 = tail call noundef zeroext i1 %13(ptr noundef nonnull align 8 dereferenceable(12) %5, ptr noundef nonnull %0, ptr noundef nonnull align 4 dereferenceable(4) %10)
  br i1 %14, label %15, label %54

15:                                               ; preds = %6
  %16 = load i8, ptr %2, align 1, !tbaa !8
  %17 = icmp eq i8 %16, 0
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #8
  br i1 %17, label %18, label %.critedge

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 64
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  %.sroa.015.0.copyload = load double, ptr %20, align 16
  %.sroa.216.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 56
  %.sroa.216.0.copyload = load double, ptr %.sroa.216.0..sroa_idx, align 8, !tbaa !13
  %21 = tail call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %19, double %.sroa.015.0.copyload, double %.sroa.216.0.copyload)
  %22 = extractvalue { double, double } %21, 0
  store double %22, ptr %8, align 16
  %23 = getelementptr inbounds i8, ptr %8, i64 8
  %24 = extractvalue { double, double } %21, 1
  store double %24, ptr %23, align 8
  %25 = getelementptr inbounds i8, ptr %0, i64 80
  %.sroa.011.0.copyload = load double, ptr %20, align 16
  %.sroa.212.0.copyload = load double, ptr %.sroa.216.0..sroa_idx, align 8, !tbaa !13
  %26 = tail call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %25, double %.sroa.011.0.copyload, double %.sroa.212.0.copyload)
  %27 = extractvalue { double, double } %26, 0
  %28 = extractvalue { double, double } %26, 1
  %29 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %8, double %27, double %28)
  %30 = extractvalue { double, double } %29, 0
  store double %30, ptr %7, align 16
  %31 = getelementptr inbounds i8, ptr %7, i64 8
  %32 = extractvalue { double, double } %29, 1
  store double %32, ptr %31, align 8
  %33 = getelementptr inbounds i8, ptr %1, i64 16
  %.sroa.09.0.copyload = load double, ptr %33, align 16
  %.sroa.210.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 24
  %.sroa.210.0.copyload = load double, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !13
  %34 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %7, double %.sroa.09.0.copyload, double %.sroa.210.0.copyload)
  %35 = fcmp ogt float %34, 0.000000e+00
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #8
  br i1 %35, label %54, label %36

.critedge:                                        ; preds = %15
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #8
  br label %36

36:                                               ; preds = %.critedge, %18
  %.sroa.06.0.copyload = load double, ptr %1, align 16
  %.sroa.27.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.27.0.copyload = load double, ptr %.sroa.27.0..sroa_idx, align 8, !tbaa !13
  %37 = getelementptr inbounds i8, ptr %1, i64 16
  %.sroa.04.0.copyload = load double, ptr %37, align 16
  %.sroa.25.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 24
  %.sroa.25.0.copyload = load double, ptr %.sroa.25.0..sroa_idx, align 8, !tbaa !13
  %38 = getelementptr inbounds i8, ptr %0, i64 48
  %.sroa.02.0.copyload = load double, ptr %38, align 16
  %.sroa.23.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 56
  %.sroa.23.0.copyload = load double, ptr %.sroa.23.0..sroa_idx, align 8, !tbaa !13
  %39 = getelementptr inbounds i8, ptr %0, i64 64
  %.sroa.01.0.copyload = load double, ptr %39, align 16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 72
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !13
  %40 = getelementptr inbounds i8, ptr %0, i64 80
  %41 = call noundef float @_ZN3JPH11RayTriangleENS_4Vec3ES0_S0_S0_S0_(double %.sroa.06.0.copyload, double %.sroa.27.0.copyload, double %.sroa.04.0.copyload, double %.sroa.25.0.copyload, double %.sroa.02.0.copyload, double %.sroa.23.0.copyload, double %.sroa.01.0.copyload, double %.sroa.2.0.copyload, ptr noundef nonnull byval(%"class.JPH::Vec3") align 16 %40)
  %42 = call noundef float @_ZNK3JPH18CollisionCollectorINS_13RayCastResultENS_31CollisionCollectorTraitsCastRayEE19GetEarlyOutFractionEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %43 = fcmp olt float %41, %42
  br i1 %43, label %44, label %54

44:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #8
  call void @_ZN3JPH13RayCastResultC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %9)
  %45 = call noundef ptr @_ZNK3JPH18CollisionCollectorINS_13RayCastResultENS_31CollisionCollectorTraitsCastRayEE10GetContextEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %46 = call i32 @_ZN3JPH16TransformedShape10sGetBodyIDEPKS0_(ptr noundef %45)
  store i32 %46, ptr %9, align 4, !tbaa !14
  %47 = getelementptr inbounds i8, ptr %9, i64 4
  store float %41, ptr %47, align 4, !tbaa !16
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH17SubShapeIDCreator5GetIDEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %49 = getelementptr inbounds i8, ptr %9, i64 8
  %50 = load i32, ptr %48, align 4, !tbaa !14
  store i32 %50, ptr %49, align 4, !tbaa !14
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 48
  %53 = load ptr, ptr %52, align 8
  call void %53(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 4 dereferenceable(12) %9)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #8
  br label %54

54:                                               ; preds = %36, %44, %18, %6
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #5 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH13RayCastResultC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZN3JPH16TransformedShape10sGetBodyIDEPKS0_(ptr noundef) local_unnamed_addr #7 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 = { 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 #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 = { 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 = { 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 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 = { 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 #8 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 0}
!9 = !{!"_ZTSN3JPH15RayCastSettingsE", !10, i64 0, !10, i64 1, !12, i64 2}
!10 = !{!"_ZTSN3JPH13EBackFaceModeE", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"bool", !11, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !11, i64 0}
!16 = !{!17, !19, i64 4}
!17 = !{!"_ZTSN3JPH20BroadPhaseCastResultE", !18, i64 0, !19, i64 4}
!18 = !{!"_ZTSN3JPH6BodyIDE", !15, i64 0}
!19 = !{!"float", !11, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass