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

; 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 void @_ZN7Riemann15AxisAlignedBox310GetSupportERKN5Maths8TVector3IfEES5_S5_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") 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(12) %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, 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
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds %"class.Maths::TVector3", ptr %9, i32 0, i32 0
  %11 = load float, ptr %10, align 4, !tbaa !9
  %12 = fcmp ogt float %11, 0.000000e+00
  br i1 %12, label %13, label %17

13:                                               ; preds = %4
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.Maths::TVector3", ptr %14, i32 0, i32 0
  %16 = load float, ptr %15, align 4, !tbaa !9
  br label %21

17:                                               ; preds = %4
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.Maths::TVector3", ptr %18, i32 0, i32 0
  %20 = load float, ptr %19, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %17, %13
  %22 = phi float [ %16, %13 ], [ %20, %17 ]
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.Maths::TVector3", ptr %23, i32 0, i32 1
  %25 = load float, ptr %24, align 4, !tbaa !12
  %26 = fcmp ogt float %25, 0.000000e+00
  br i1 %26, label %27, label %31

27:                                               ; preds = %21
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.Maths::TVector3", ptr %28, i32 0, i32 1
  %30 = load float, ptr %29, align 4, !tbaa !12
  br label %35

31:                                               ; preds = %21
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.Maths::TVector3", ptr %32, i32 0, i32 1
  %34 = load float, ptr %33, align 4, !tbaa !12
  br label %35

35:                                               ; preds = %31, %27
  %36 = phi float [ %30, %27 ], [ %34, %31 ]
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.Maths::TVector3", ptr %37, i32 0, i32 2
  %39 = load float, ptr %38, align 4, !tbaa !13
  %40 = fcmp ogt float %39, 0.000000e+00
  br i1 %40, label %41, label %45

41:                                               ; preds = %35
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %"class.Maths::TVector3", ptr %42, i32 0, i32 2
  %44 = load float, ptr %43, align 4, !tbaa !13
  br label %49

45:                                               ; preds = %35
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %"class.Maths::TVector3", ptr %46, i32 0, i32 2
  %48 = load float, ptr %47, align 4, !tbaa !13
  br label %49

49:                                               ; preds = %45, %41
  %50 = phi float [ %44, %41 ], [ %48, %45 ]
  call void @_ZN5Maths8TVector3IfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %0, float noundef %22, float noundef %36, float noundef %50)
  ret void
}

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

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

!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, !11, i64 0}
!10 = !{!"_ZTSN5Maths8TVector3IfEE", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!10, !11, i64 8}


; 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 nounwind uwtable
define dso_local void @_ZN7Riemann15AxisAlignedBox310GetSupportERKN5Maths8TVector3IfEES5_S5_(ptr dead_on_unwind noalias nonnull writable sret(%"class.Maths::TVector3") align 4 %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %1, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %2, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %3) local_unnamed_addr #0 align 2 {
  %5 = load float, ptr %3, align 4, !tbaa !5
  %6 = fcmp ogt float %5, 0.000000e+00
  %.val = load float, ptr %2, align 4
  %.val12 = load float, ptr %1, align 4
  %7 = select i1 %6, float %.val, float %.val12
  %8 = getelementptr inbounds i8, ptr %3, i64 4
  %9 = load float, ptr %8, align 4, !tbaa !10
  %10 = fcmp ogt float %9, 0.000000e+00
  %.pn = select i1 %10, ptr %2, ptr %1
  %.in9 = getelementptr inbounds i8, ptr %.pn, i64 4
  %11 = load float, ptr %.in9, align 4, !tbaa !10
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  %13 = load float, ptr %12, align 4, !tbaa !11
  %14 = fcmp ogt float %13, 0.000000e+00
  %.pn11 = select i1 %14, ptr %2, ptr %1
  %.in10 = getelementptr inbounds i8, ptr %.pn11, i64 8
  %15 = load float, ptr %.in10, align 4, !tbaa !11
  tail call void @_ZN5Maths8TVector3IfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %0, float noundef %7, float noundef %11, float noundef %15)
  ret void
}

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

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

!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 = !{!"_ZTSN5Maths8TVector3IfEE", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}


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