; LLVM IR from maliput/maliput :: src/maliput/math/quaternion.ll (ZNK7maliput4math10QuaternionmlERKS1_)

; 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::Quaternion" = type { double, double, double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7maliput4math10QuaternionC2Edddd(ptr noundef nonnull align 8 dereferenceable(32), double noundef, double noundef, double noundef, double noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7maliput4math10QuaternionmlERKS1_(ptr dead_on_unwind noalias writable sret(%"class.maliput::math::Quaternion") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  store ptr %2, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8
  %7 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 0
  %8 = load double, ptr %7, align 8, !tbaa !9
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %9, i32 0, i32 0
  %11 = load double, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 1
  %13 = load double, ptr %12, align 8, !tbaa !12
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %14, i32 0, i32 1
  %16 = load double, ptr %15, align 8, !tbaa !12
  %17 = fmul double %13, %16
  %18 = fneg double %17
  %19 = call double @llvm.fmuladd.f64(double %8, double %11, double %18)
  %20 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 2
  %21 = load double, ptr %20, align 8, !tbaa !13
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %22, i32 0, i32 2
  %24 = load double, ptr %23, align 8, !tbaa !13
  %25 = fneg double %21
  %26 = call double @llvm.fmuladd.f64(double %25, double %24, double %19)
  %27 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 3
  %28 = load double, ptr %27, align 8, !tbaa !14
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %29, i32 0, i32 3
  %31 = load double, ptr %30, align 8, !tbaa !14
  %32 = fneg double %28
  %33 = call double @llvm.fmuladd.f64(double %32, double %31, double %26)
  %34 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 0
  %35 = load double, ptr %34, align 8, !tbaa !9
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %36, i32 0, i32 1
  %38 = load double, ptr %37, align 8, !tbaa !12
  %39 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 1
  %40 = load double, ptr %39, align 8, !tbaa !12
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %41, i32 0, i32 0
  %43 = load double, ptr %42, align 8, !tbaa !9
  %44 = fmul double %40, %43
  %45 = call double @llvm.fmuladd.f64(double %35, double %38, double %44)
  %46 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 2
  %47 = load double, ptr %46, align 8, !tbaa !13
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %48, i32 0, i32 3
  %50 = load double, ptr %49, align 8, !tbaa !14
  %51 = call double @llvm.fmuladd.f64(double %47, double %50, double %45)
  %52 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 3
  %53 = load double, ptr %52, align 8, !tbaa !14
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %54, i32 0, i32 2
  %56 = load double, ptr %55, align 8, !tbaa !13
  %57 = fneg double %53
  %58 = call double @llvm.fmuladd.f64(double %57, double %56, double %51)
  %59 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 0
  %60 = load double, ptr %59, align 8, !tbaa !9
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %61, i32 0, i32 2
  %63 = load double, ptr %62, align 8, !tbaa !13
  %64 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 2
  %65 = load double, ptr %64, align 8, !tbaa !13
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %66, i32 0, i32 0
  %68 = load double, ptr %67, align 8, !tbaa !9
  %69 = fmul double %65, %68
  %70 = call double @llvm.fmuladd.f64(double %60, double %63, double %69)
  %71 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 3
  %72 = load double, ptr %71, align 8, !tbaa !14
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %73, i32 0, i32 1
  %75 = load double, ptr %74, align 8, !tbaa !12
  %76 = call double @llvm.fmuladd.f64(double %72, double %75, double %70)
  %77 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 1
  %78 = load double, ptr %77, align 8, !tbaa !12
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %79, i32 0, i32 3
  %81 = load double, ptr %80, align 8, !tbaa !14
  %82 = fneg double %78
  %83 = call double @llvm.fmuladd.f64(double %82, double %81, double %76)
  %84 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 0
  %85 = load double, ptr %84, align 8, !tbaa !9
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %86, i32 0, i32 3
  %88 = load double, ptr %87, align 8, !tbaa !14
  %89 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 3
  %90 = load double, ptr %89, align 8, !tbaa !14
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %91, i32 0, i32 0
  %93 = load double, ptr %92, align 8, !tbaa !9
  %94 = fmul double %90, %93
  %95 = call double @llvm.fmuladd.f64(double %85, double %88, double %94)
  %96 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 1
  %97 = load double, ptr %96, align 8, !tbaa !12
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %98, i32 0, i32 2
  %100 = load double, ptr %99, align 8, !tbaa !13
  %101 = call double @llvm.fmuladd.f64(double %97, double %100, double %95)
  %102 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %6, i32 0, i32 2
  %103 = load double, ptr %102, align 8, !tbaa !13
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %"class.maliput::math::Quaternion", ptr %104, i32 0, i32 1
  %106 = load double, ptr %105, align 8, !tbaa !12
  %107 = fneg double %103
  %108 = call double @llvm.fmuladd.f64(double %107, double %106, double %101)
  call void @_ZN7maliput4math10QuaternionC2Edddd(ptr noundef nonnull align 8 dereferenceable(32) %0, double noundef %33, double noundef %58, double noundef %83, double noundef %108)
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 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 speculatable willreturn memory(none) }

!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 = !{!"_ZTSN7maliput4math10QuaternionE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!10, !11, i64 16}
!14 = !{!10, !11, i64 24}


; 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::Quaternion" = type { double, double, double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7maliput4math10QuaternionC2Edddd(ptr noundef nonnull align 8 dereferenceable(32), double noundef, double noundef, double noundef, double noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK7maliput4math10QuaternionmlERKS1_(ptr dead_on_unwind noalias nonnull writable sret(%"class.maliput::math::Quaternion") align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %2) local_unnamed_addr #0 align 2 {
  %4 = load double, ptr %1, align 8, !tbaa !5
  %5 = load double, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !10
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = load double, ptr %8, align 8, !tbaa !10
  %10 = fneg double %7
  %11 = fmul double %9, %10
  %12 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %11)
  %13 = getelementptr inbounds i8, ptr %1, i64 16
  %14 = load double, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds i8, ptr %2, i64 16
  %16 = load double, ptr %15, align 8, !tbaa !11
  %17 = fneg double %14
  %18 = tail call double @llvm.fmuladd.f64(double %17, double %16, double %12)
  %19 = getelementptr inbounds i8, ptr %1, i64 24
  %20 = load double, ptr %19, align 8, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %2, i64 24
  %22 = load double, ptr %21, align 8, !tbaa !12
  %23 = fneg double %20
  %24 = tail call double @llvm.fmuladd.f64(double %23, double %22, double %18)
  %25 = fmul double %5, %7
  %26 = tail call double @llvm.fmuladd.f64(double %4, double %9, double %25)
  %27 = tail call double @llvm.fmuladd.f64(double %14, double %22, double %26)
  %28 = tail call double @llvm.fmuladd.f64(double %23, double %16, double %27)
  %29 = fmul double %5, %14
  %30 = tail call double @llvm.fmuladd.f64(double %4, double %16, double %29)
  %31 = tail call double @llvm.fmuladd.f64(double %20, double %9, double %30)
  %32 = tail call double @llvm.fmuladd.f64(double %10, double %22, double %31)
  %33 = fmul double %5, %20
  %34 = tail call double @llvm.fmuladd.f64(double %4, double %22, double %33)
  %35 = tail call double @llvm.fmuladd.f64(double %7, double %16, double %34)
  %36 = tail call double @llvm.fmuladd.f64(double %17, double %9, double %35)
  tail call void @_ZN7maliput4math10QuaternionC2Edddd(ptr noundef nonnull align 8 dereferenceable(32) %0, double noundef %24, double noundef %28, double noundef %32, double noundef %36)
  ret void
}

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

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 speculatable willreturn memory(none) }

!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 = !{!"_ZTSN7maliput4math10QuaternionE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}


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