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

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

; 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)) #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
define dso_local void @_ZNK7Riemann9Triangle315ProjectOntoAxisERKN5Maths8TVector3IfEERfS6_(ptr noundef nonnull align 4 dereferenceable(36) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  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
  %12 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %"class.Riemann::Triangle3", ptr %12, i32 0, i32 0
  %15 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(12) %14)
  store float %15, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.Riemann::Triangle3", ptr %12, i32 0, i32 1
  %18 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %16, ptr noundef nonnull align 4 dereferenceable(12) %17)
  store float %18, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.Riemann::Triangle3", ptr %12, i32 0, i32 2
  %21 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(12) %20)
  store float %21, ptr %11, align 4, !tbaa !9
  %22 = load float, ptr %9, align 4, !tbaa !9
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  store float %22, ptr %23, align 4, !tbaa !9
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  store float %25, ptr %26, align 4, !tbaa !9
  %27 = load float, ptr %10, align 4, !tbaa !9
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = fcmp olt float %27, %29
  br i1 %30, label %31, label %34

31:                                               ; preds = %4
  %32 = load float, ptr %10, align 4, !tbaa !9
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  store float %32, ptr %33, align 4, !tbaa !9
  br label %43

34:                                               ; preds = %4
  %35 = load float, ptr %10, align 4, !tbaa !9
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = load float, ptr %36, align 4, !tbaa !9
  %38 = fcmp ogt float %35, %37
  br i1 %38, label %39, label %42

39:                                               ; preds = %34
  %40 = load float, ptr %10, align 4, !tbaa !9
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  store float %40, ptr %41, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %39, %34
  br label %43

43:                                               ; preds = %42, %31
  %44 = load float, ptr %11, align 4, !tbaa !9
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = fcmp olt float %44, %46
  br i1 %47, label %48, label %51

48:                                               ; preds = %43
  %49 = load float, ptr %11, align 4, !tbaa !9
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  store float %49, ptr %50, align 4, !tbaa !9
  br label %60

51:                                               ; preds = %43
  %52 = load float, ptr %11, align 4, !tbaa !9
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = load float, ptr %53, align 4, !tbaa !9
  %55 = fcmp ogt float %52, %54
  br i1 %55, label %56, label %59

56:                                               ; preds = %51
  %57 = load float, ptr %11, align 4, !tbaa !9
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  store float %57, ptr %58, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %56, %51
  br label %60

60:                                               ; preds = %59, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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"

; 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 #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK7Riemann9Triangle315ProjectOntoAxisERKN5Maths8TVector3IfEERfS6_(ptr noundef nonnull align 4 dereferenceable(36) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr nocapture noundef nonnull align 4 dereferenceable(4) %2, ptr nocapture noundef nonnull align 4 dereferenceable(4) %3) local_unnamed_addr #1 align 2 {
  %5 = tail call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %0)
  %6 = getelementptr inbounds i8, ptr %0, i64 12
  %7 = tail call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %6)
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = tail call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %8)
  store float %5, ptr %2, align 4, !tbaa !5
  store float %5, ptr %3, align 4, !tbaa !5
  %10 = load float, ptr %2, align 4, !tbaa !5
  %11 = fcmp olt float %7, %10
  br i1 %11, label %12, label %13

12:                                               ; preds = %4
  store float %7, ptr %2, align 4, !tbaa !5
  br label %16

13:                                               ; preds = %4
  %14 = fcmp ogt float %7, %5
  br i1 %14, label %15, label %16

15:                                               ; preds = %13
  store float %7, ptr %3, align 4, !tbaa !5
  %.pre = load float, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %13, %15, %12
  %17 = phi float [ %10, %13 ], [ %.pre, %15 ], [ %7, %12 ]
  %18 = fcmp olt float %9, %17
  br i1 %18, label %.sink.split, label %19

19:                                               ; preds = %16
  %20 = load float, ptr %3, align 4, !tbaa !5
  %21 = fcmp ogt float %9, %20
  br i1 %21, label %.sink.split, label %22

.sink.split:                                      ; preds = %19, %16
  %.sink = phi ptr [ %2, %16 ], [ %3, %19 ]
  store float %9, ptr %.sink, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %.sink.split, %19
  ret void
}

attributes #0 = { 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 #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" }

!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: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass