; LLVM IR from maliput/maliput :: src/maliput/math (bounding_box)

; 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.maliput::math::Vector3" = type { %"class.maliput::math::VectorBase" }
%"class.maliput::math::VectorBase" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x double] }
%"class.maliput::math::Matrix" = type { %"struct.std::array.1" }
%"struct.std::array.1" = type { [3 x %"class.maliput::math::Vector"] }
%"class.maliput::math::Vector" = type { %"class.maliput::math::VectorBase.2" }
%"class.maliput::math::VectorBase.2" = type { %"struct.std::array" }
%"class.maliput::math::BoundingBox" = type { %"class.maliput::math::BoundingRegion", %"class.maliput::math::Vector3", %"class.maliput::math::Vector3", %"class.maliput::math::RollPitchYaw", double, %"class.maliput::math::Vector3" }
%"class.maliput::math::BoundingRegion" = type { ptr }
%"class.maliput::math::RollPitchYaw" = type { %"class.maliput::math::Vector3" }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

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

declare void @_ZN7maliput4mathmlILm3ENS0_7Vector3EEET0_RKNS0_6MatrixIXT_EEENS0_10VectorBaseIXT_ES3_EE(ptr dead_on_unwind writable sret(%"class.maliput::math::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(72), ptr noundef byval(%"class.maliput::math::VectorBase") align 8) #3

declare void @_ZNK7maliput4math12RollPitchYaw8ToMatrixEv(ptr dead_on_unwind writable sret(%"class.maliput::math::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7maliput4math11BoundingBox10DoContainsERKNS0_7Vector3E(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) unnamed_addr #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.maliput::math::Vector3", align 8
  %6 = alloca %"class.maliput::math::Matrix", align 8
  %7 = alloca %"class.maliput::math::VectorBase", align 8
  %8 = alloca %"class.maliput::math::Vector3", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 72, ptr %6) #5
  %10 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 3
  call void @_ZNK7maliput4math12RollPitchYaw8ToMatrixEv(ptr dead_on_unwind writable sret(%"class.maliput::math::Matrix") align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 1
  call void @_ZNK7maliput4math10VectorBaseILm3ENS0_7Vector3EEmiERKS3_(ptr dead_on_unwind writable sret(%"class.maliput::math::Vector3") align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %12)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %8, i64 24, i1 false), !tbaa.struct !9
  call void @_ZN7maliput4mathmlILm3ENS0_7Vector3EEET0_RKNS0_6MatrixIXT_EEENS0_10VectorBaseIXT_ES3_EE(ptr dead_on_unwind writable sret(%"class.maliput::math::Vector3") align 8 %5, ptr noundef nonnull align 8 dereferenceable(72) %6, ptr noundef byval(%"class.maliput::math::VectorBase") align 8 %7)
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %6) #5
  %13 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %14 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 5
  %15 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %16 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 4
  %17 = load double, ptr %16, align 8, !tbaa !11
  %18 = fadd double %15, %17
  %19 = fcmp ole double %13, %18
  br i1 %19, label %20, label %63

20:                                               ; preds = %2
  %21 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %22 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 5
  %23 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %24 = fneg double %23
  %25 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 4
  %26 = load double, ptr %25, align 8, !tbaa !11
  %27 = fsub double %24, %26
  %28 = fcmp oge double %21, %27
  br i1 %28, label %29, label %63

29:                                               ; preds = %20
  %30 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %31 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 5
  %32 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %31)
  %33 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 4
  %34 = load double, ptr %33, align 8, !tbaa !11
  %35 = fadd double %32, %34
  %36 = fcmp ole double %30, %35
  br i1 %36, label %37, label %63

37:                                               ; preds = %29
  %38 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %39 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 5
  %40 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %39)
  %41 = fneg double %40
  %42 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 4
  %43 = load double, ptr %42, align 8, !tbaa !11
  %44 = fsub double %41, %43
  %45 = fcmp oge double %38, %44
  br i1 %45, label %46, label %63

46:                                               ; preds = %37
  %47 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %48 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 5
  %49 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %48)
  %50 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 4
  %51 = load double, ptr %50, align 8, !tbaa !11
  %52 = fadd double %49, %51
  %53 = fcmp ole double %47, %52
  br i1 %53, label %54, label %63

54:                                               ; preds = %46
  %55 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %56 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 5
  %57 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %56)
  %58 = fneg double %57
  %59 = getelementptr inbounds %"class.maliput::math::BoundingBox", ptr %9, i32 0, i32 4
  %60 = load double, ptr %59, align 8, !tbaa !11
  %61 = fsub double %58, %60
  %62 = fcmp oge double %55, %61
  br label %63

63:                                               ; preds = %54, %46, %37, %29, %20, %2
  %64 = phi i1 [ false, %46 ], [ false, %37 ], [ false, %29 ], [ false, %20 ], [ false, %2 ], [ %62, %54 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #5
  ret i1 %64
}

declare void @_ZNK7maliput4math10VectorBaseILm3ENS0_7Vector3EEmiERKS3_(ptr dead_on_unwind writable sret(%"class.maliput::math::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #3

attributes #0 = { nocallback nofree 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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"="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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i64 0, i64 24, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !18, i64 80}
!12 = !{!"_ZTSN7maliput4math11BoundingBoxE", !13, i64 0, !14, i64 8, !14, i64 32, !17, i64 56, !18, i64 80, !14, i64 88}
!13 = !{!"_ZTSN7maliput4math14BoundingRegionINS0_7Vector3EEE"}
!14 = !{!"_ZTSN7maliput4math7Vector3E", !15, i64 0}
!15 = !{!"_ZTSN7maliput4math10VectorBaseILm3ENS0_7Vector3EEE", !16, i64 0}
!16 = !{!"_ZTSSt5arrayIdLm3EE", !7, i64 0}
!17 = !{!"_ZTSN7maliput4math12RollPitchYawE", !14, i64 0}
!18 = !{!"double", !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.maliput::math::Vector3" = type { %"class.maliput::math::VectorBase" }
%"class.maliput::math::VectorBase" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x double] }
%"class.maliput::math::Matrix" = type { %"struct.std::array.1" }
%"struct.std::array.1" = type { [3 x %"class.maliput::math::Vector"] }
%"class.maliput::math::Vector" = type { %"class.maliput::math::VectorBase.2" }
%"class.maliput::math::VectorBase.2" = type { %"struct.std::array" }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

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

declare void @_ZN7maliput4mathmlILm3ENS0_7Vector3EEET0_RKNS0_6MatrixIXT_EEENS0_10VectorBaseIXT_ES3_EE(ptr dead_on_unwind writable sret(%"class.maliput::math::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(72), ptr noundef byval(%"class.maliput::math::VectorBase") align 8) local_unnamed_addr #2

declare void @_ZNK7maliput4math12RollPitchYaw8ToMatrixEv(ptr dead_on_unwind writable sret(%"class.maliput::math::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7maliput4math11BoundingBox10DoContainsERKNS0_7Vector3E(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) unnamed_addr #3 align 2 {
  %3 = alloca %"class.maliput::math::Vector3", align 8
  %4 = alloca %"class.maliput::math::Matrix", align 8
  %5 = alloca %"class.maliput::math::Vector3", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %4) #4
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  call void @_ZNK7maliput4math12RollPitchYaw8ToMatrixEv(ptr dead_on_unwind nonnull writable sret(%"class.maliput::math::Matrix") align 8 %4, ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZNK7maliput4math10VectorBaseILm3ENS0_7Vector3EEmiERKS3_(ptr dead_on_unwind nonnull writable sret(%"class.maliput::math::Vector3") align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @_ZN7maliput4mathmlILm3ENS0_7Vector3EEET0_RKNS0_6MatrixIXT_EEENS0_10VectorBaseIXT_ES3_EE(ptr dead_on_unwind nonnull writable sret(%"class.maliput::math::Vector3") align 8 %3, ptr noundef nonnull align 8 dereferenceable(72) %4, ptr noundef nonnull byval(%"class.maliput::math::VectorBase") align 8 %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %4) #4
  %8 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  %10 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = fadd double %10, %12
  %14 = fcmp ugt double %8, %13
  br i1 %14, label %48, label %15

15:                                               ; preds = %2
  %16 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %17 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %18 = fneg double %17
  %19 = load double, ptr %11, align 8, !tbaa !5
  %20 = fsub double %18, %19
  %21 = fcmp ult double %16, %20
  br i1 %21, label %48, label %22

22:                                               ; preds = %15
  %23 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %24 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %25 = load double, ptr %11, align 8, !tbaa !5
  %26 = fadd double %24, %25
  %27 = fcmp ugt double %23, %26
  br i1 %27, label %48, label %28

28:                                               ; preds = %22
  %29 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %30 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %31 = fneg double %30
  %32 = load double, ptr %11, align 8, !tbaa !5
  %33 = fsub double %31, %32
  %34 = fcmp ult double %29, %33
  br i1 %34, label %48, label %35

35:                                               ; preds = %28
  %36 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %37 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %38 = load double, ptr %11, align 8, !tbaa !5
  %39 = fadd double %37, %38
  %40 = fcmp ugt double %36, %39
  br i1 %40, label %48, label %41

41:                                               ; preds = %35
  %42 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %43 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %44 = fneg double %43
  %45 = load double, ptr %11, align 8, !tbaa !5
  %46 = fsub double %44, %45
  %47 = fcmp oge double %42, %46
  br label %48

48:                                               ; preds = %41, %35, %28, %22, %15, %2
  %49 = phi i1 [ false, %35 ], [ false, %28 ], [ false, %22 ], [ false, %15 ], [ false, %2 ], [ %47, %41 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  ret i1 %49
}

declare void @_ZNK7maliput4math10VectorBaseILm3ENS0_7Vector3EEmiERKS3_(ptr dead_on_unwind writable sret(%"class.maliput::math::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 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, !14, i64 80}
!6 = !{!"_ZTSN7maliput4math11BoundingBoxE", !7, i64 0, !8, i64 8, !8, i64 32, !13, i64 56, !14, i64 80, !8, i64 88}
!7 = !{!"_ZTSN7maliput4math14BoundingRegionINS0_7Vector3EEE"}
!8 = !{!"_ZTSN7maliput4math7Vector3E", !9, i64 0}
!9 = !{!"_ZTSN7maliput4math10VectorBaseILm3ENS0_7Vector3EEE", !10, i64 0}
!10 = !{!"_ZTSSt5arrayIdLm3EE", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSN7maliput4math12RollPitchYawE", !8, i64 0}
!14 = !{!"double", !11, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass