; LLVM IR from atlantis13579/Riemann :: Src/CollisionPrimitive (Triangle3)

; 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.Maths::TVector3" = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7Riemann9Triangle320RayIntersectTriangleERKN5Maths8TVector3IfEES5_S5_S5_S5_Pf(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef %5) #0 align 2 {
  %7 = alloca i1, align 1
  %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 ptr, align 8
  %14 = alloca float, align 4
  %15 = alloca %"class.Maths::TVector3", align 4
  %16 = alloca %"class.Maths::TVector3", align 4
  %17 = alloca %"class.Maths::TVector3", align 4
  %18 = alloca float, align 4
  %19 = alloca i32, align 4
  %20 = alloca float, align 4
  %21 = alloca %"class.Maths::TVector3", align 4
  %22 = alloca float, align 4
  %23 = alloca %"class.Maths::TVector3", align 4
  %24 = alloca float, align 4
  %25 = alloca float, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store float 0x3E7AD7F2A0000000, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #4
  %26 = load ptr, ptr %11, align 8, !tbaa !5
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %15, ptr noundef nonnull align 4 dereferenceable(12) %26, ptr noundef nonnull align 4 dereferenceable(12) %27)
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #4
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %16, ptr noundef nonnull align 4 dereferenceable(12) %28, ptr noundef nonnull align 4 dereferenceable(12) %29)
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #4
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZNK5Maths8TVector3IfE5CrossERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %17, ptr noundef nonnull align 4 dereferenceable(12) %30, ptr noundef nonnull align 4 dereferenceable(12) %16)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %31 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %15, ptr noundef nonnull align 4 dereferenceable(12) %17)
  store float %31, ptr %18, align 4, !tbaa !9
  %32 = load float, ptr %18, align 4, !tbaa !9
  %33 = fcmp ogt float %32, 0xBE7AD7F2A0000000
  br i1 %33, label %34, label %38

34:                                               ; preds = %6
  %35 = load float, ptr %18, align 4, !tbaa !9
  %36 = fcmp olt float %35, 0x3E7AD7F2A0000000
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  store i1 false, ptr %7, align 1
  store i32 1, ptr %19, align 4
  br label %78

38:                                               ; preds = %34, %6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %39 = load float, ptr %18, align 4, !tbaa !9
  %40 = fdiv float 1.000000e+00, %39
  store float %40, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #4
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %21, ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(12) %42)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %43 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %21, ptr noundef nonnull align 4 dereferenceable(12) %17)
  %44 = load float, ptr %20, align 4, !tbaa !9
  %45 = fmul float %43, %44
  store float %45, ptr %22, align 4, !tbaa !9
  %46 = load float, ptr %22, align 4, !tbaa !9
  %47 = fcmp olt float %46, 0.000000e+00
  br i1 %47, label %51, label %48

48:                                               ; preds = %38
  %49 = load float, ptr %22, align 4, !tbaa !9
  %50 = fcmp ogt float %49, 1.000000e+00
  br i1 %50, label %51, label %52

51:                                               ; preds = %48, %38
  store i1 false, ptr %7, align 1
  store i32 1, ptr %19, align 4
  br label %77

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #4
  call void @_ZNK5Maths8TVector3IfE5CrossERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %23, ptr noundef nonnull align 4 dereferenceable(12) %21, ptr noundef nonnull align 4 dereferenceable(12) %15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %53, ptr noundef nonnull align 4 dereferenceable(12) %23)
  %55 = load float, ptr %20, align 4, !tbaa !9
  %56 = fmul float %54, %55
  store float %56, ptr %24, align 4, !tbaa !9
  %57 = load float, ptr %24, align 4, !tbaa !9
  %58 = fcmp olt float %57, 0.000000e+00
  br i1 %58, label %64, label %59

59:                                               ; preds = %52
  %60 = load float, ptr %22, align 4, !tbaa !9
  %61 = load float, ptr %24, align 4, !tbaa !9
  %62 = fadd float %60, %61
  %63 = fcmp ogt float %62, 1.000000e+00
  br i1 %63, label %64, label %65

64:                                               ; preds = %59, %52
  store i1 false, ptr %7, align 1
  store i32 1, ptr %19, align 4
  br label %76

65:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  %66 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %16, ptr noundef nonnull align 4 dereferenceable(12) %23)
  %67 = load float, ptr %20, align 4, !tbaa !9
  %68 = fmul float %66, %67
  store float %68, ptr %25, align 4, !tbaa !9
  %69 = load float, ptr %25, align 4, !tbaa !9
  %70 = fcmp ogt float %69, 0x3E7AD7F2A0000000
  br i1 %70, label %71, label %74

71:                                               ; preds = %65
  %72 = load float, ptr %25, align 4, !tbaa !9
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  store float %72, ptr %73, align 4, !tbaa !9
  store i1 true, ptr %7, align 1
  store i32 1, ptr %19, align 4
  br label %75

74:                                               ; preds = %65
  store i1 false, ptr %7, align 1
  store i32 1, ptr %19, align 4
  br label %75

75:                                               ; preds = %74, %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  br label %76

76:                                               ; preds = %75, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #4
  br label %77

77:                                               ; preds = %76, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %78

78:                                               ; preds = %77, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %79 = load i1, ptr %7, align 1
  ret i1 %79
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfE5CrossERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2 align 2

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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}


; 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.Maths::TVector3" = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7Riemann9Triangle320RayIntersectTriangleERKN5Maths8TVector3IfEES5_S5_S5_S5_Pf(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %4, ptr nocapture noundef writeonly %5) local_unnamed_addr #0 align 2 {
  %7 = alloca %"class.Maths::TVector3", align 4
  %8 = alloca %"class.Maths::TVector3", align 4
  %9 = alloca %"class.Maths::TVector3", align 4
  %10 = alloca %"class.Maths::TVector3", align 4
  %11 = alloca %"class.Maths::TVector3", align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #5
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %7, ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #5
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %8, ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %2)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #5
  call void @_ZNK5Maths8TVector3IfE5CrossERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %9, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %8)
  %12 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %9)
  %13 = call float @llvm.fabs.f32(float %12)
  %or.cond = fcmp olt float %13, 0x3E7AD7F2A0000000
  br i1 %or.cond, label %33, label %14

14:                                               ; preds = %6
  %15 = fdiv float 1.000000e+00, %12
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #5
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %10, ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %2)
  %16 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %9)
  %17 = fmul float %15, %16
  %18 = fcmp olt float %17, 0.000000e+00
  %19 = fcmp ogt float %17, 1.000000e+00
  %or.cond3 = or i1 %18, %19
  br i1 %or.cond3, label %32, label %20

20:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #5
  call void @_ZNK5Maths8TVector3IfE5CrossERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %11, ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %7)
  %21 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %11)
  %22 = fmul float %15, %21
  %23 = fcmp olt float %22, 0.000000e+00
  %24 = fadd float %17, %22
  %25 = fcmp ogt float %24, 1.000000e+00
  %or.cond30 = or i1 %23, %25
  br i1 %or.cond30, label %31, label %26

26:                                               ; preds = %20
  %27 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %11)
  %28 = fmul float %15, %27
  %29 = fcmp ogt float %28, 0x3E7AD7F2A0000000
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  store float %28, ptr %5, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %30, %26, %20
  %.1 = phi i1 [ false, %20 ], [ false, %26 ], [ true, %30 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #5
  br label %32

32:                                               ; preds = %14, %31
  %.2 = phi i1 [ %.1, %31 ], [ false, %14 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #5
  br label %33

33:                                               ; preds = %6, %32
  %.3 = phi i1 [ %.2, %32 ], [ false, %6 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #5
  ret i1 %.3
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfE5CrossERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass