; LLVM IR from Slingshot-Physics/slingshot-community :: common/geometry/src (raycast)

; 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.Vector3 = type { [3 x float] }
%class.Matrix33 = type { [9 x float] }
%"struct.geometry::types::raycastResult_t" = type { i8, i32, [2 x %class.Vector3], [2 x float] }
%"struct.edbdmath::quadraticResult_t" = type { i32, [2 x float] }
%"struct.geometry::types::isometricTransform_t" = type { %class.Matrix33, %class.Vector3 }
%"struct.geometry::types::shapeSphere_t" = type { float }

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3miERKS_(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8Matrix339transposeEv(ptr dead_on_unwind noalias writable sret(%class.Matrix33) align 4, ptr noundef nonnull align 4 dereferenceable(36)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8Matrix33mlERK7Vector3(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(36), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK7Vector33dotERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

declare { i64, float } @_ZN8edbdmath14quadraticRootsEfff(float noundef, float noundef, float noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

; 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) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8geometry5types15raycastResult_tC2Ev(ptr noundef nonnull align 4 dereferenceable(40)) unnamed_addr #6 align 2

declare void @_ZmlRKfRK7Vector3(ptr dead_on_unwind writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(12)) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3plERKS_(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8geometry7raycastERK7Vector3S2_RKNS_5types20isometricTransform_tERKNS3_13shapeSphere_tE(ptr dead_on_unwind noalias writable sret(%"struct.geometry::types::raycastResult_t") align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(48) %3, ptr noundef nonnull align 4 dereferenceable(4) %4) #1 {
  %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.Vector3, align 4
  %12 = alloca %class.Matrix33, align 4
  %13 = alloca %class.Vector3, align 4
  %14 = alloca %class.Vector3, align 4
  %15 = alloca %class.Vector3, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca %"struct.edbdmath::quadraticResult_t", align 4
  %20 = alloca { i64, float }, align 8
  %21 = alloca %class.Vector3, align 4
  %22 = alloca %class.Vector3, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca %class.Vector3, align 4
  %26 = alloca %class.Vector3, align 4
  store ptr %0, ptr %6, align 8
  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
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #7
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZNK7Vector3miERKS_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %11, ptr noundef nonnull align 4 dereferenceable(12) %27, ptr noundef nonnull align 4 dereferenceable(12) %28)
  call void @llvm.lifetime.start.p0(i64 36, ptr %12) #7
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.geometry::types::isometricTransform_t", ptr %29, i32 0, i32 0
  call void @_ZNK8Matrix339transposeEv(ptr dead_on_unwind writable sret(%class.Matrix33) align 4 %12, ptr noundef nonnull align 4 dereferenceable(36) %30)
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %14) #7
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.geometry::types::isometricTransform_t", ptr %32, i32 0, i32 1
  call void @_ZNK7Vector3miERKS_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %14, ptr noundef nonnull align 4 dereferenceable(12) %31, ptr noundef nonnull align 4 dereferenceable(12) %33)
  call void @_ZNK8Matrix33mlERK7Vector3(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %13, ptr noundef nonnull align 4 dereferenceable(36) %12, ptr noundef nonnull align 4 dereferenceable(12) %14)
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #7
  call void @_ZNK8Matrix33mlERK7Vector3(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %15, ptr noundef nonnull align 4 dereferenceable(36) %12, ptr noundef nonnull align 4 dereferenceable(12) %11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %34 = call noundef float @_ZNK7Vector316magnitudeSquaredEv(ptr noundef nonnull align 4 dereferenceable(12) %13)
  store float %34, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %35 = call noundef float @_ZNK7Vector33dotERKS_(ptr noundef nonnull align 4 dereferenceable(12) %15, ptr noundef nonnull align 4 dereferenceable(12) %13)
  store float %35, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %36 = call noundef float @_ZNK7Vector316magnitudeSquaredEv(ptr noundef nonnull align 4 dereferenceable(12) %15)
  store float %36, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #7
  %37 = load float, ptr %18, align 4, !tbaa !9
  %38 = load float, ptr %17, align 4, !tbaa !9
  %39 = fmul float 2.000000e+00, %38
  %40 = load float, ptr %16, align 4, !tbaa !9
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.geometry::types::shapeSphere_t", ptr %41, i32 0, i32 0
  %43 = load float, ptr %42, align 4, !tbaa !11
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.geometry::types::shapeSphere_t", ptr %44, i32 0, i32 0
  %46 = load float, ptr %45, align 4, !tbaa !11
  %47 = fneg float %43
  %48 = call float @llvm.fmuladd.f32(float %47, float %46, float %40)
  %49 = call { i64, float } @_ZN8edbdmath14quadraticRootsEfff(float noundef %37, float noundef %39, float noundef %48)
  store { i64, float } %49, ptr %20, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 8 %20, i64 12, i1 false)
  call void @_ZN8geometry5types15raycastResult_tC2Ev(ptr noundef nonnull align 4 dereferenceable(40) %0)
  %50 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 0
  %51 = load i32, ptr %50, align 4, !tbaa !13
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %56

53:                                               ; preds = %5
  %54 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 1
  store i32 0, ptr %54, align 4, !tbaa !16
  %55 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 0
  store i8 0, ptr %55, align 4, !tbaa !19
  br label %137

56:                                               ; preds = %5
  %57 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 0
  %58 = load i32, ptr %57, align 4, !tbaa !13
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %60, label %85

60:                                               ; preds = %56
  %61 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 1
  %62 = getelementptr inbounds [2 x float], ptr %61, i64 0, i64 0
  %63 = load float, ptr %62, align 4, !tbaa !9
  %64 = fcmp oge float %63, 0.000000e+00
  br i1 %64, label %65, label %81

65:                                               ; preds = %60
  %66 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 0
  store i8 1, ptr %66, align 4, !tbaa !19
  %67 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 0
  %68 = load i32, ptr %67, align 4, !tbaa !13
  %69 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 1
  store i32 %68, ptr %69, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %22) #7
  %70 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 1
  %71 = getelementptr inbounds [2 x float], ptr %70, i64 0, i64 0
  call void @_ZmlRKfRK7Vector3(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %22, ptr noundef nonnull align 4 dereferenceable(4) %71, ptr noundef nonnull align 4 dereferenceable(12) %11)
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZNK7Vector3plERKS_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %21, ptr noundef nonnull align 4 dereferenceable(12) %22, ptr noundef nonnull align 4 dereferenceable(12) %72)
  %73 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 2
  %74 = getelementptr inbounds [2 x %class.Vector3], ptr %73, i64 0, i64 0
  %75 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %74, ptr noundef nonnull align 4 dereferenceable(12) %21)
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #7
  %76 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 1
  %77 = getelementptr inbounds [2 x float], ptr %76, i64 0, i64 0
  %78 = load float, ptr %77, align 4, !tbaa !9
  %79 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 3
  %80 = getelementptr inbounds [2 x float], ptr %79, i64 0, i64 0
  store float %78, ptr %80, align 4, !tbaa !9
  br label %84

81:                                               ; preds = %60
  %82 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 1
  store i32 0, ptr %82, align 4, !tbaa !16
  %83 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 0
  store i8 0, ptr %83, align 4, !tbaa !19
  br label %84

84:                                               ; preds = %81, %65
  br label %136

85:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %86 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 1
  store ptr %86, ptr %23, align 8, !tbaa !5
  %87 = load ptr, ptr %23, align 8, !tbaa !5
  store i32 0, ptr %87, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 0, ptr %24, align 4, !tbaa !20
  br label %88

88:                                               ; preds = %127, %85
  %89 = load i32, ptr %24, align 4, !tbaa !20
  %90 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 0
  %91 = load i32, ptr %90, align 4, !tbaa !13
  %92 = icmp ult i32 %89, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %130

94:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 12, ptr %25) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %26) #7
  %95 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 1
  %96 = load i32, ptr %24, align 4, !tbaa !20
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds [2 x float], ptr %95, i64 0, i64 %97
  call void @_ZmlRKfRK7Vector3(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %26, ptr noundef nonnull align 4 dereferenceable(4) %98, ptr noundef nonnull align 4 dereferenceable(12) %11)
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZNK7Vector3plERKS_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %25, ptr noundef nonnull align 4 dereferenceable(12) %26, ptr noundef nonnull align 4 dereferenceable(12) %99)
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #7
  %100 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 1
  %101 = load i32, ptr %24, align 4, !tbaa !20
  %102 = zext i32 %101 to i64
  %103 = getelementptr inbounds [2 x float], ptr %100, i64 0, i64 %102
  %104 = load float, ptr %103, align 4, !tbaa !9
  %105 = fcmp oge float %104, 0.000000e+00
  br i1 %105, label %106, label %126

106:                                              ; preds = %94
  %107 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 2
  %108 = load ptr, ptr %23, align 8, !tbaa !5
  %109 = load i32, ptr %108, align 4, !tbaa !20
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds [2 x %class.Vector3], ptr %107, i64 0, i64 %110
  %112 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %111, ptr noundef nonnull align 4 dereferenceable(12) %25)
  %113 = getelementptr inbounds %"struct.edbdmath::quadraticResult_t", ptr %19, i32 0, i32 1
  %114 = load i32, ptr %24, align 4, !tbaa !20
  %115 = zext i32 %114 to i64
  %116 = getelementptr inbounds [2 x float], ptr %113, i64 0, i64 %115
  %117 = load float, ptr %116, align 4, !tbaa !9
  %118 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 3
  %119 = load ptr, ptr %23, align 8, !tbaa !5
  %120 = load i32, ptr %119, align 4, !tbaa !20
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds [2 x float], ptr %118, i64 0, i64 %121
  store float %117, ptr %122, align 4, !tbaa !9
  %123 = load ptr, ptr %23, align 8, !tbaa !5
  %124 = load i32, ptr %123, align 4, !tbaa !20
  %125 = add i32 %124, 1
  store i32 %125, ptr %123, align 4, !tbaa !20
  br label %126

126:                                              ; preds = %106, %94
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #7
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %24, align 4, !tbaa !20
  %129 = add i32 %128, 1
  store i32 %129, ptr %24, align 4, !tbaa !20
  br label %88, !llvm.loop !21

130:                                              ; preds = %93
  %131 = load ptr, ptr %23, align 8, !tbaa !5
  %132 = load i32, ptr %131, align 4, !tbaa !20
  %133 = icmp ugt i32 %132, 0
  %134 = getelementptr inbounds %"struct.geometry::types::raycastResult_t", ptr %0, i32 0, i32 0
  %135 = zext i1 %133 to i8
  store i8 %135, ptr %134, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %136

136:                                              ; preds = %130, %84
  br label %137

137:                                              ; preds = %136, %53
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 36, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #7
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN8geometry5types13shapeSphere_tE", !10, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTSN8edbdmath17quadraticResult_tE", !15, i64 0, !7, i64 4}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !15, i64 4}
!17 = !{!"_ZTSN8geometry5types15raycastResult_tE", !18, i64 0, !15, i64 4, !7, i64 8, !7, i64 32}
!18 = !{!"bool", !7, i64 0}
!19 = !{!17, !18, i64 0}
!20 = !{!15, !15, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%class.Vector3 = type { [3 x float] }
%class.Matrix33 = type { [9 x float] }
%"struct.geometry::types::raycastResult_t" = type { i8, i32, [2 x %class.Vector3], [2 x float] }
%"struct.edbdmath::quadraticResult_t" = type { i32, [2 x float] }

; 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 uwtable
declare dso_local void @_ZNK7Vector3miERKS_(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8Matrix339transposeEv(ptr dead_on_unwind noalias writable sret(%class.Matrix33) align 4, ptr noundef nonnull align 4 dereferenceable(36)) local_unnamed_addr #1 align 2

; 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 @_ZNK8Matrix33mlERK7Vector3(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(36), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7Vector316magnitudeSquaredEv(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK7Vector33dotERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

declare { i64, float } @_ZN8edbdmath14quadraticRootsEfff(float noundef, float noundef, float noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8geometry5types15raycastResult_tC2Ev(ptr noundef nonnull align 4 dereferenceable(40)) unnamed_addr #5 align 2

declare void @_ZmlRKfRK7Vector3(ptr dead_on_unwind writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3plERKS_(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8geometry7raycastERK7Vector3S2_RKNS_5types20isometricTransform_tERKNS3_13shapeSphere_tE(ptr dead_on_unwind noalias writable sret(%"struct.geometry::types::raycastResult_t") align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(48) %3, ptr nocapture noundef nonnull readonly align 4 dereferenceable(4) %4) local_unnamed_addr #1 {
  %6 = alloca %class.Vector3, align 4
  %7 = alloca %class.Matrix33, align 4
  %8 = alloca %class.Vector3, align 4
  %9 = alloca %class.Vector3, align 4
  %10 = alloca %class.Vector3, align 4
  %11 = alloca %"struct.edbdmath::quadraticResult_t", align 8
  %12 = alloca %class.Vector3, align 4
  %13 = alloca %class.Vector3, align 4
  %14 = alloca %class.Vector3, align 4
  %15 = alloca %class.Vector3, align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #6
  call void @_ZNK7Vector3miERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %6, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %1)
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %7) #6
  call void @_ZNK8Matrix339transposeEv(ptr dead_on_unwind nonnull writable sret(%class.Matrix33) align 4 %7, ptr noundef nonnull align 4 dereferenceable(36) %3)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #6
  %16 = getelementptr inbounds i8, ptr %3, i64 36
  call void @_ZNK7Vector3miERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %9, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %16)
  call void @_ZNK8Matrix33mlERK7Vector3(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %8, ptr noundef nonnull align 4 dereferenceable(36) %7, ptr noundef nonnull align 4 dereferenceable(12) %9)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #6
  call void @_ZNK8Matrix33mlERK7Vector3(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %10, ptr noundef nonnull align 4 dereferenceable(36) %7, ptr noundef nonnull align 4 dereferenceable(12) %6)
  %17 = call noundef float @_ZNK7Vector316magnitudeSquaredEv(ptr noundef nonnull align 4 dereferenceable(12) %8)
  %18 = call noundef float @_ZNK7Vector33dotERKS_(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %8)
  %19 = call noundef float @_ZNK7Vector316magnitudeSquaredEv(ptr noundef nonnull align 4 dereferenceable(12) %10)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #6
  %20 = fmul float %18, 2.000000e+00
  %21 = load float, ptr %4, align 4, !tbaa !5
  %22 = fneg float %21
  %23 = call float @llvm.fmuladd.f32(float %22, float %21, float %17)
  %24 = call { i64, float } @_ZN8edbdmath14quadraticRootsEfff(float noundef %19, float noundef %20, float noundef %23)
  %.fca.0.extract = extractvalue { i64, float } %24, 0
  %.fca.1.extract = extractvalue { i64, float } %24, 1
  store i64 %.fca.0.extract, ptr %11, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %11, i64 8
  store float %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  call void @_ZN8geometry5types15raycastResult_tC2Ev(ptr noundef nonnull align 4 dereferenceable(40) %0)
  %25 = trunc i64 %.fca.0.extract to i32
  switch i32 %25, label %.lr.ph [
    i32 0, label %26
    i32 1, label %28
  ]

26:                                               ; preds = %5
  %27 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 0, ptr %27, align 4, !tbaa !10
  store i8 0, ptr %0, align 4, !tbaa !14
  br label %66

28:                                               ; preds = %5
  %29 = lshr i64 %.fca.0.extract, 32
  %30 = trunc nuw i64 %29 to i32
  %31 = bitcast i32 %30 to float
  %32 = fcmp ult float %31, 0.000000e+00
  br i1 %32, label %40, label %33

33:                                               ; preds = %28
  %34 = getelementptr inbounds i8, ptr %11, i64 4
  store i8 1, ptr %0, align 4, !tbaa !14
  %35 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 1, ptr %35, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %12) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #6
  call void @_ZmlRKfRK7Vector3(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %13, ptr noundef nonnull align 4 dereferenceable(4) %34, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @_ZNK7Vector3plERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %12, ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(12) %1)
  %36 = getelementptr inbounds i8, ptr %0, i64 8
  %37 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %36, ptr noundef nonnull align 4 dereferenceable(12) %12)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %12) #6
  %38 = load float, ptr %34, align 4, !tbaa !15
  %39 = getelementptr inbounds i8, ptr %0, i64 32
  store float %38, ptr %39, align 4, !tbaa !15
  br label %66

40:                                               ; preds = %28
  %41 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 0, ptr %41, align 4, !tbaa !10
  store i8 0, ptr %0, align 4, !tbaa !14
  br label %66

.lr.ph:                                           ; preds = %5
  %42 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 0, ptr %42, align 4, !tbaa !16
  %43 = getelementptr inbounds i8, ptr %11, i64 4
  %44 = getelementptr inbounds i8, ptr %0, i64 8
  %45 = getelementptr inbounds i8, ptr %0, i64 32
  br label %48

._crit_edge:                                      ; preds = %62
  %.pre = load i32, ptr %42, align 4, !tbaa !16
  %46 = icmp ne i32 %.pre, 0
  %47 = zext i1 %46 to i8
  store i8 %47, ptr %0, align 4, !tbaa !14
  br label %66

48:                                               ; preds = %.lr.ph, %62
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %62 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %14) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %15) #6
  %49 = getelementptr inbounds [2 x float], ptr %43, i64 0, i64 %indvars.iv
  call void @_ZmlRKfRK7Vector3(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %15, ptr noundef nonnull align 4 dereferenceable(4) %49, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @_ZNK7Vector3plERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %14, ptr noundef nonnull align 4 dereferenceable(12) %15, ptr noundef nonnull align 4 dereferenceable(12) %1)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %15) #6
  %50 = load float, ptr %49, align 4, !tbaa !15
  %51 = fcmp ult float %50, 0.000000e+00
  br i1 %51, label %62, label %52

52:                                               ; preds = %48
  %53 = load i32, ptr %42, align 4, !tbaa !16
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds [2 x %class.Vector3], ptr %44, i64 0, i64 %54
  %56 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN7Vector3aSERKS_(ptr noundef nonnull align 4 dereferenceable(12) %55, ptr noundef nonnull align 4 dereferenceable(12) %14)
  %57 = load float, ptr %49, align 4, !tbaa !15
  %58 = load i32, ptr %42, align 4, !tbaa !16
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds [2 x float], ptr %45, i64 0, i64 %59
  store float %57, ptr %60, align 4, !tbaa !15
  %61 = add i32 %58, 1
  store i32 %61, ptr %42, align 4, !tbaa !16
  br label %62

62:                                               ; preds = %52, %48
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %14) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %63 = load i32, ptr %11, align 8, !tbaa !17
  %64 = zext i32 %63 to i64
  %65 = icmp ult i64 %indvars.iv.next, %64
  br i1 %65, label %48, label %._crit_edge, !llvm.loop !19

66:                                               ; preds = %._crit_edge, %40, %33, %26
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #6
  ret void
}

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 = { 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 = { "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 0}
!6 = !{!"_ZTSN8geometry5types13shapeSphere_tE", !7, i64 0}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !13, i64 4}
!11 = !{!"_ZTSN8geometry5types15raycastResult_tE", !12, i64 0, !13, i64 4, !8, i64 8, !8, i64 32}
!12 = !{!"bool", !8, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!11, !12, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!13, !13, i64 0}
!17 = !{!18, !13, i64 0}
!18 = !{!"_ZTSN8edbdmath17quadraticResult_tE", !13, i64 0, !8, i64 4}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass