; LLVM IR from maliput/maliput :: src/maliput/math/vector.ll (ZNK7maliput4math7Vector35crossERKS1_)

; 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.27" }
%"class.maliput::math::VectorBase.27" = type { %"struct.std::array.6" }
%"struct.std::array.6" = type { [3 x double] }
%"class.std::initializer_list" = type { ptr, i64 }

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7maliput4math7Vector3C2ESt16initializer_listIdE(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7maliput4math7Vector35crossERKS1_(ptr dead_on_unwind noalias writable sret(%"class.maliput::math::Vector3") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.std::initializer_list", align 8
  %7 = alloca [3 x double], align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  store ptr %2, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #4
  %9 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %12 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  %15 = fmul double %12, %14
  %16 = fneg double %15
  %17 = call double @llvm.fmuladd.f64(double %9, double %11, double %16)
  store double %17, ptr %7, align 8, !tbaa !9
  %18 = getelementptr inbounds double, ptr %7, i64 1
  %19 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
  %22 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %25 = fmul double %22, %24
  %26 = fneg double %25
  %27 = call double @llvm.fmuladd.f64(double %19, double %21, double %26)
  store double %27, ptr %18, align 8, !tbaa !9
  %28 = getelementptr inbounds double, ptr %7, i64 2
  %29 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %30)
  %32 = call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %33)
  %35 = fmul double %32, %34
  %36 = fneg double %35
  %37 = call double @llvm.fmuladd.f64(double %29, double %31, double %36)
  store double %37, ptr %28, align 8, !tbaa !9
  %38 = getelementptr inbounds %"class.std::initializer_list", ptr %6, i32 0, i32 0
  store ptr %7, ptr %38, align 8, !tbaa !11
  %39 = getelementptr inbounds %"class.std::initializer_list", ptr %6, i32 0, i32 1
  store i64 3, ptr %39, align 8, !tbaa !14
  %40 = getelementptr inbounds { ptr, i64 }, ptr %6, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8
  %42 = getelementptr inbounds { ptr, i64 }, ptr %6, i32 0, i32 1
  %43 = load i64, ptr %42, align 8
  call void @_ZN7maliput4math7Vector3C2ESt16initializer_listIdE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr %41, i64 %43)
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #4
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSSt16initializer_listIdE", !6, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, 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.maliput::math::Vector3" = type { %"class.maliput::math::VectorBase.27" }
%"class.maliput::math::VectorBase.27" = type { %"struct.std::array.6" }
%"struct.std::array.6" = type { [3 x double] }

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7maliput4math7Vector3C2ESt16initializer_listIdE(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7maliput4math7Vector35crossERKS1_(ptr dead_on_unwind noalias writable sret(%"class.maliput::math::Vector3") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #1 align 2 {
  %4 = alloca [3 x double], align 16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  %5 = tail call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %6 = tail call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %7 = tail call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %8 = tail call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %9 = tail call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %10 = tail call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %11 = tail call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %12 = tail call noundef double @_ZNK7maliput4math7Vector31zEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %13 = insertelement <2 x double> poison, double %7, i64 0
  %14 = insertelement <2 x double> %13, double %11, i64 1
  %15 = fneg <2 x double> %14
  %16 = insertelement <2 x double> poison, double %8, i64 0
  %17 = insertelement <2 x double> %16, double %12, i64 1
  %18 = fmul <2 x double> %17, %15
  %19 = insertelement <2 x double> poison, double %5, i64 0
  %20 = insertelement <2 x double> %19, double %9, i64 1
  %21 = insertelement <2 x double> poison, double %6, i64 0
  %22 = insertelement <2 x double> %21, double %10, i64 1
  %23 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %22, <2 x double> %18)
  store <2 x double> %23, ptr %4, align 16, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %4, i64 16
  %25 = tail call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %26 = tail call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %27 = tail call noundef double @_ZNK7maliput4math7Vector31yEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %28 = tail call noundef double @_ZNK7maliput4math7Vector31xEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %29 = fneg double %27
  %30 = fmul double %28, %29
  %31 = tail call double @llvm.fmuladd.f64(double %25, double %26, double %30)
  store double %31, ptr %24, align 16, !tbaa !5
  call void @_ZN7maliput4math7Vector3C2ESt16initializer_listIdE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr nonnull %4, i64 3)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  ret void
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #4

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


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass