; LLVM IR from vectozavr/3dzavr :: engine/components/geometry/Triangle.ll (ZNK8Triangle9intersectERK5Vec3DS2_)

; 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.Vec4D = type { %"struct.std::array.4" }
%"struct.std::array.4" = type { [4 x double] }
%class.Vec3D = type { %"struct.std::array.6" }
%"struct.std::array.6" = type { [3 x double] }
%"struct.Triangle::IntersectionInformation" = type <{ %class.Vec3D, %class.Vec3D, double, i8, [7 x i8] }>
%class.Triangle = type { %"struct.std::array.3", %"struct.std::array.5", %class.Vec3D }
%"struct.std::array.3" = type { [3 x %class.Vec4D] }
%"struct.std::array.5" = type { [3 x %class.Vec3D] }

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZN5Vec3DC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec4DmiERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec4D) align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3D5crossERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3D10normalizedEv(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Vec3DC2Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK8Triangle9intersectERK5Vec3DS2_(ptr dead_on_unwind noalias writable sret(%"struct.Triangle::IntersectionInformation") align 8 %0, ptr noundef nonnull align 8 dereferenceable(192) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3) #5 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %class.Vec3D, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca i8, align 1
  %14 = alloca %class.Vec3D, align 8
  %15 = alloca %class.Vec4D, align 8
  %16 = alloca %class.Vec3D, align 8
  %17 = alloca %class.Vec4D, align 8
  %18 = alloca %class.Vec3D, align 8
  %19 = alloca %class.Vec3D, align 8
  %20 = alloca %class.Vec3D, align 8
  %21 = alloca %class.Vec3D, align 8
  %22 = alloca %class.Vec3D, align 8
  %23 = alloca %class.Vec3D, align 8
  %24 = alloca double, align 8
  %25 = alloca %class.Vec3D, align 8
  %26 = alloca %class.Vec3D, align 8
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %27 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #6
  call void @_ZN5Vec3DC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store double 0.000000e+00, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %28 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #6
  store double %28, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #6
  store i8 0, ptr %13, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #6
  %29 = getelementptr inbounds %class.Triangle, ptr %27, i32 0, i32 0
  %30 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %29, i64 noundef 1) #6
  %31 = getelementptr inbounds %class.Triangle, ptr %27, i32 0, i32 0
  %32 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %31, i64 noundef 0) #6
  call void @_ZNK5Vec4DmiERKS_(ptr dead_on_unwind writable sret(%class.Vec4D) align 8 %15, ptr noundef nonnull align 8 dereferenceable(32) %30, ptr noundef nonnull align 8 dereferenceable(32) %32)
  call void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(32) %15)
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #6
  %33 = getelementptr inbounds %class.Triangle, ptr %27, i32 0, i32 0
  %34 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %33, i64 noundef 2) #6
  %35 = getelementptr inbounds %class.Triangle, ptr %27, i32 0, i32 0
  %36 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %35, i64 noundef 0) #6
  call void @_ZNK5Vec4DmiERKS_(ptr dead_on_unwind writable sret(%class.Vec4D) align 8 %17, ptr noundef nonnull align 8 dereferenceable(32) %34, ptr noundef nonnull align 8 dereferenceable(32) %36)
  call void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(32) %17)
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #6
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #6
  %38 = getelementptr inbounds %class.Triangle, ptr %27, i32 0, i32 0
  %39 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %38, i64 noundef 0) #6
  call void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(32) %39)
  call void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %18, ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 8 dereferenceable(24) %19)
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #6
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %21, ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 8 dereferenceable(24) %41)
  call void @_ZNK5Vec3D10normalizedEv(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %20, ptr noundef nonnull align 8 dereferenceable(24) %21)
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #6
  call void @_ZNK5Vec3D5crossERKS_(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %22, ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 8 dereferenceable(24) %16)
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #6
  call void @_ZNK5Vec3D5crossERKS_(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %23, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(24) %14)
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %42 = call noundef double @_ZNK5Vec3D3dotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef nonnull align 8 dereferenceable(24) %14)
  store double %42, ptr %24, align 8, !tbaa !9
  %43 = load double, ptr %24, align 8, !tbaa !9
  %44 = call noundef double @_ZSt3absd(double noundef %43)
  %45 = fcmp ogt double %44, 0x3DA5FD7FE1796495
  br i1 %45, label %46, label %70

46:                                               ; preds = %4
  %47 = call noundef double @_ZNK5Vec3D3dotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef nonnull align 8 dereferenceable(24) %18)
  %48 = load double, ptr %24, align 8, !tbaa !9
  %49 = fdiv double %47, %48
  store double %49, ptr %10, align 8, !tbaa !9
  %50 = call noundef double @_ZNK5Vec3D3dotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(24) %20)
  %51 = load double, ptr %24, align 8, !tbaa !9
  %52 = fdiv double %50, %51
  store double %52, ptr %11, align 8, !tbaa !9
  %53 = load double, ptr %10, align 8, !tbaa !9
  %54 = fcmp oge double %53, 0.000000e+00
  br i1 %54, label %55, label %69

55:                                               ; preds = %46
  %56 = load double, ptr %11, align 8, !tbaa !9
  %57 = fcmp oge double %56, 0.000000e+00
  br i1 %57, label %58, label %69

58:                                               ; preds = %55
  %59 = load double, ptr %10, align 8, !tbaa !9
  %60 = load double, ptr %11, align 8, !tbaa !9
  %61 = fadd double %59, %60
  %62 = fcmp ole double %61, 1.000000e+00
  br i1 %62, label %63, label %69

63:                                               ; preds = %58
  store i8 1, ptr %13, align 1, !tbaa !11
  %64 = call noundef double @_ZNK5Vec3D3dotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(24) %16)
  %65 = load double, ptr %24, align 8, !tbaa !9
  %66 = fdiv double %64, %65
  store double %66, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %25) #6
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %26) #6
  %68 = load double, ptr %12, align 8, !tbaa !9
  call void @_ZNK5Vec3DmlEd(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %26, ptr noundef nonnull align 8 dereferenceable(24) %20, double noundef %68)
  call void @_ZNK5Vec3DplERKS_(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %25, ptr noundef nonnull align 8 dereferenceable(24) %67, ptr noundef nonnull align 8 dereferenceable(24) %26)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %25, i64 24, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 24, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #6
  br label %69

69:                                               ; preds = %63, %58, %55, %46
  br label %70

70:                                               ; preds = %69, %4
  %71 = getelementptr inbounds %"struct.Triangle::IntersectionInformation", ptr %0, i32 0, i32 0
  call void @_ZN5Vec3DC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %71, ptr noundef nonnull align 8 dereferenceable(24) %9)
  %72 = getelementptr inbounds %"struct.Triangle::IntersectionInformation", ptr %0, i32 0, i32 1
  %73 = load double, ptr %10, align 8, !tbaa !9
  %74 = load double, ptr %11, align 8, !tbaa !9
  %75 = load double, ptr %10, align 8, !tbaa !9
  %76 = fsub double 1.000000e+00, %75
  %77 = load double, ptr %11, align 8, !tbaa !9
  %78 = fsub double %76, %77
  call void @_ZN5Vec3DC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %72, double noundef %73, double noundef %74, double noundef %78)
  %79 = getelementptr inbounds %"struct.Triangle::IntersectionInformation", ptr %0, i32 0, i32 2
  %80 = load double, ptr %12, align 8, !tbaa !9
  store double %80, ptr %79, align 8, !tbaa !15
  %81 = getelementptr inbounds %"struct.Triangle::IntersectionInformation", ptr %0, i32 0, i32 3
  %82 = load i8, ptr %13, align 1, !tbaa !11, !range !19, !noundef !20
  %83 = trunc i8 %82 to i1
  %84 = zext i1 %83 to i8
  store i8 %84, ptr %81, align 8, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DplERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DmlEd(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5Vec3DC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i64 0, i64 24, !14}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !10, i64 48}
!16 = !{!"_ZTSN8Triangle23IntersectionInformationE", !17, i64 0, !17, i64 24, !10, i64 48, !12, i64 56}
!17 = !{!"_ZTS5Vec3D", !18, i64 0}
!18 = !{!"_ZTSSt5arrayIdLm3EE", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!16, !12, i64 56}


; 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.Vec4D = type { %"struct.std::array.4" }
%"struct.std::array.4" = type { [4 x double] }
%class.Vec3D = type { %"struct.std::array.6" }
%"struct.std::array.6" = type { [3 x double] }
%"struct.Triangle::IntersectionInformation" = type <{ %class.Vec3D, %class.Vec3D, double, i8, [7 x i8] }>

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZN5Vec3DC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec4DmiERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec4D) align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3D5crossERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3D10normalizedEv(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress 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) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Vec3DC2Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK8Triangle9intersectERK5Vec3DS2_(ptr dead_on_unwind noalias writable sret(%"struct.Triangle::IntersectionInformation") align 8 %0, ptr noundef nonnull align 8 dereferenceable(192) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3) local_unnamed_addr #5 align 2 {
  %5 = alloca %class.Vec3D, align 8
  %6 = alloca %class.Vec3D, align 8
  %7 = alloca %class.Vec4D, align 8
  %8 = alloca %class.Vec3D, align 8
  %9 = alloca %class.Vec4D, align 8
  %10 = alloca %class.Vec3D, align 8
  %11 = alloca %class.Vec3D, align 8
  %12 = alloca %class.Vec3D, align 8
  %13 = alloca %class.Vec3D, align 8
  %14 = alloca %class.Vec3D, align 8
  %15 = alloca %class.Vec3D, align 8
  %16 = alloca %class.Vec3D, align 8
  %17 = alloca %class.Vec3D, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @_ZN5Vec3DC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %18 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #6
  %19 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %1, i64 noundef 1) #6
  %20 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %1, i64 noundef 0) #6
  call void @_ZNK5Vec4DmiERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec4D) align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %19, ptr noundef nonnull align 8 dereferenceable(32) %20)
  call void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(32) %7)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  %21 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %1, i64 noundef 2) #6
  %22 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %1, i64 noundef 0) #6
  call void @_ZNK5Vec4DmiERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec4D) align 8 %9, ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef nonnull align 8 dereferenceable(32) %22)
  call void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(32) %9)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #6
  %23 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt5arrayI5Vec4DLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %1, i64 noundef 0) #6
  call void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(32) %23)
  call void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %10, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %11)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %13) #6
  call void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %2)
  call void @_ZNK5Vec3D10normalizedEv(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %13)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #6
  call void @_ZNK5Vec3D5crossERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %14, ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %8)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %15) #6
  call void @_ZNK5Vec3D5crossERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %15, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %24 = call noundef double @_ZNK5Vec3D3dotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %25 = call noundef double @_ZSt3absd(double noundef %24)
  %26 = fcmp ogt double %25, 0x3DA5FD7FE1796495
  br i1 %26, label %27, label %44

27:                                               ; preds = %4
  %28 = call noundef double @_ZNK5Vec3D3dotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(24) %10)
  %29 = call noundef double @_ZNK5Vec3D3dotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %12)
  %30 = insertelement <2 x double> poison, double %29, i64 0
  %31 = insertelement <2 x double> %30, double %28, i64 1
  %32 = insertelement <2 x double> poison, double %24, i64 0
  %33 = shufflevector <2 x double> %32, <2 x double> poison, <2 x i32> zeroinitializer
  %34 = fdiv <2 x double> %31, %33
  %35 = extractelement <2 x double> %34, i64 1
  %36 = fcmp ult double %35, 0.000000e+00
  %37 = extractelement <2 x double> %34, i64 0
  %38 = fcmp ult double %37, 0.000000e+00
  %or.cond.not28 = or i1 %36, %38
  %39 = fadd double %35, %37
  %40 = fcmp ugt double %39, 1.000000e+00
  %or.cond26 = or i1 %or.cond.not28, %40
  br i1 %or.cond26, label %44, label %41

41:                                               ; preds = %27
  %42 = call noundef double @_ZNK5Vec3D3dotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %8)
  %43 = fdiv double %42, %24
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %16) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #6
  call void @_ZNK5Vec3DmlEd(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %17, ptr noundef nonnull align 8 dereferenceable(24) %12, double noundef %43)
  call void @_ZNK5Vec3DplERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %16, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %17)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %16, i64 24, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #6
  br label %44

44:                                               ; preds = %27, %41, %4
  %.021 = phi double [ %43, %41 ], [ %18, %27 ], [ %18, %4 ]
  %.020 = phi i8 [ 1, %41 ], [ 0, %27 ], [ 0, %4 ]
  %45 = phi <2 x double> [ %34, %41 ], [ %34, %27 ], [ zeroinitializer, %4 ]
  call void @_ZN5Vec3DC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %5)
  %46 = getelementptr inbounds i8, ptr %0, i64 24
  %47 = extractelement <2 x double> %45, i64 1
  %48 = fsub double 1.000000e+00, %47
  %49 = extractelement <2 x double> %45, i64 0
  %50 = fsub double %48, %49
  call void @_ZN5Vec3DC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %46, double noundef %47, double noundef %49, double noundef %50)
  %51 = getelementptr inbounds i8, ptr %0, i64 48
  store double %.021, ptr %51, align 8, !tbaa !9
  %52 = getelementptr inbounds i8, ptr %0, i64 56
  store i8 %.020, ptr %52, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE8infinityEv() local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DplERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DmlEd(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5Vec3DC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{i64 0, i64 24, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 48}
!10 = !{!"_ZTSN8Triangle23IntersectionInformationE", !11, i64 0, !11, i64 24, !13, i64 48, !14, i64 56}
!11 = !{!"_ZTS5Vec3D", !12, i64 0}
!12 = !{!"_ZTSSt5arrayIdLm3EE", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!10, !14, i64 56}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass