; LLVM IR from Razakhel/RaZ :: src/RaZ/Utils/Shape.ll (ZNK3Raz5Plane10intersectsERKNS_4AABBE)

; 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.Raz::Vector" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }
%"class.Raz::Plane" = type { %"class.Raz::Shape", float, %"class.Raz::Vector" }
%"class.Raz::Shape" = type { ptr }

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3Raz6VectorIfLm3EE3dotIfEET_RKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1xEv(ptr noundef nonnull align 4 dereferenceable(12)) #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3Raz5Plane10intersectsERKNS_4AABBE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) unnamed_addr #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.Raz::Vector", align 4
  %6 = alloca { <2 x float>, float }, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca %"class.Raz::Vector", align 4
  %10 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #7
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = call { <2 x float>, float } @_ZNK3Raz4AABB18computeHalfExtentsEv(ptr noundef nonnull align 8 dereferenceable(32) %12)
  %14 = getelementptr inbounds %"class.Raz::Vector", ptr %5, i32 0, i32 0
  %15 = getelementptr inbounds %"struct.std::array", ptr %14, i32 0, i32 0
  store { <2 x float>, float } %13, ptr %6, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 8 %6, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1xEv(ptr noundef nonnull align 4 dereferenceable(12) %5) #7
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = getelementptr inbounds %"class.Raz::Plane", ptr %11, i32 0, i32 2
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1xEv(ptr noundef nonnull align 4 dereferenceable(12) %18) #7
  %20 = load float, ptr %19, align 4, !tbaa !9
  %21 = call noundef float @_ZSt3absf(float noundef %20)
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1yEv(ptr noundef nonnull align 4 dereferenceable(12) %5) #7
  %23 = load float, ptr %22, align 4, !tbaa !9
  %24 = getelementptr inbounds %"class.Raz::Plane", ptr %11, i32 0, i32 2
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1yEv(ptr noundef nonnull align 4 dereferenceable(12) %24) #7
  %26 = load float, ptr %25, align 4, !tbaa !9
  %27 = call noundef float @_ZSt3absf(float noundef %26)
  %28 = fmul float %23, %27
  %29 = call float @llvm.fmuladd.f32(float %17, float %21, float %28)
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1zEv(ptr noundef nonnull align 4 dereferenceable(12) %5) #7
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = getelementptr inbounds %"class.Raz::Plane", ptr %11, i32 0, i32 2
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1zEv(ptr noundef nonnull align 4 dereferenceable(12) %32) #7
  %34 = load float, ptr %33, align 4, !tbaa !9
  %35 = call noundef float @_ZSt3absf(float noundef %34)
  %36 = call float @llvm.fmuladd.f32(float %31, float %35, float %29)
  store float %36, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %37 = getelementptr inbounds %"class.Raz::Plane", ptr %11, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #7
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = call { <2 x float>, float } @_ZNK3Raz4AABB15computeCentroidEv(ptr noundef nonnull align 8 dereferenceable(32) %38)
  %40 = getelementptr inbounds %"class.Raz::Vector", ptr %9, i32 0, i32 0
  %41 = getelementptr inbounds %"struct.std::array", ptr %40, i32 0, i32 0
  store { <2 x float>, float } %39, ptr %10, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %41, ptr align 8 %10, i64 12, i1 false)
  %42 = call noundef float @_ZNK3Raz6VectorIfLm3EE3dotIfEET_RKS1_(ptr noundef nonnull align 4 dereferenceable(12) %37, ptr noundef nonnull align 4 dereferenceable(12) %9) #7
  %43 = getelementptr inbounds %"class.Raz::Plane", ptr %11, i32 0, i32 1
  %44 = load float, ptr %43, align 8, !tbaa !11
  %45 = fsub float %42, %44
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #7
  store float %45, ptr %8, align 4, !tbaa !9
  %46 = load float, ptr %8, align 4, !tbaa !9
  %47 = call noundef float @_ZSt3absf(float noundef %46)
  %48 = load float, ptr %7, align 4, !tbaa !9
  %49 = fcmp ole float %47, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #7
  ret i1 %49
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZNK3Raz4AABB18computeHalfExtentsEv(ptr noundef nonnull align 8 dereferenceable(32)) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZNK3Raz4AABB15computeCentroidEv(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 uwtable "min-legal-vector-width"="64" "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 #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 8}
!12 = !{!"_ZTSN3Raz5PlaneE", !13, i64 0, !10, i64 8, !14, i64 12}
!13 = !{!"_ZTSN3Raz5ShapeE"}
!14 = !{!"_ZTSN3Raz6VectorIfLm3EEE", !15, i64 0}
!15 = !{!"_ZTSSt5arrayIfLm3EE", !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.Raz::Vector" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 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 nounwind uwtable
declare dso_local noundef float @_ZNK3Raz6VectorIfLm3EE3dotIfEET_RKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1xEv(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK3Raz5Plane10intersectsERKNS_4AABBE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) unnamed_addr #3 align 2 {
  %3 = alloca %"class.Raz::Vector", align 8
  %4 = alloca %"class.Raz::Vector", align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #5
  %5 = tail call { <2 x float>, float } @_ZNK3Raz4AABB18computeHalfExtentsEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.fca.0.extract2 = extractvalue { <2 x float>, float } %5, 0
  %.fca.1.extract3 = extractvalue { <2 x float>, float } %5, 1
  store <2 x float> %.fca.0.extract2, ptr %3, align 8
  %.sroa.25.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store float %.fca.1.extract3, ptr %.sroa.25.0..sroa_idx, align 8
  %6 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1xEv(ptr noundef nonnull align 4 dereferenceable(12) %3) #5
  %7 = load float, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 12
  %9 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1xEv(ptr noundef nonnull align 4 dereferenceable(12) %8) #5
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = call noundef float @_ZSt3absf(float noundef %10)
  %12 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1yEv(ptr noundef nonnull align 4 dereferenceable(12) %3) #5
  %13 = load float, ptr %12, align 4, !tbaa !5
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1yEv(ptr noundef nonnull align 4 dereferenceable(12) %8) #5
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = call noundef float @_ZSt3absf(float noundef %15)
  %17 = fmul float %13, %16
  %18 = call float @llvm.fmuladd.f32(float %7, float %11, float %17)
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1zEv(ptr noundef nonnull align 4 dereferenceable(12) %3) #5
  %20 = load float, ptr %19, align 4, !tbaa !5
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3Raz6VectorIfLm3EE1zEv(ptr noundef nonnull align 4 dereferenceable(12) %8) #5
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = call noundef float @_ZSt3absf(float noundef %22)
  %24 = call float @llvm.fmuladd.f32(float %20, float %23, float %18)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #5
  %25 = call { <2 x float>, float } @_ZNK3Raz4AABB15computeCentroidEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.fca.0.extract = extractvalue { <2 x float>, float } %25, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %25, 1
  store <2 x float> %.fca.0.extract, ptr %4, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 8
  store float %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %26 = call noundef float @_ZNK3Raz6VectorIfLm3EE3dotIfEET_RKS1_(ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %4) #5
  %27 = getelementptr inbounds i8, ptr %0, i64 8
  %28 = load float, ptr %27, align 8, !tbaa !9
  %29 = fsub float %26, %28
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  %30 = call noundef float @_ZSt3absf(float noundef %29)
  %31 = fcmp ole float %30, %24
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #5
  ret i1 %31
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZNK3Raz4AABB18computeHalfExtentsEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZNK3Raz4AABB15computeCentroidEv(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 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 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 = { 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"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN3Raz5PlaneE", !11, i64 0, !6, i64 8, !12, i64 12}
!11 = !{!"_ZTSN3Raz5ShapeE"}
!12 = !{!"_ZTSN3Raz6VectorIfLm3EEE", !13, i64 0}
!13 = !{!"_ZTSSt5arrayIfLm3EE", !7, i64 0}


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