; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_quaternion)

; 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"

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @Quat_toRotationMatrix(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds double, ptr %9, i64 0
  %11 = load double, ptr %10, align 8, !tbaa !9
  store double %11, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds double, ptr %12, i64 1
  %14 = load double, ptr %13, align 8, !tbaa !9
  store double %14, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds double, ptr %15, i64 2
  %17 = load double, ptr %16, align 8, !tbaa !9
  store double %17, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds double, ptr %18, i64 3
  %20 = load double, ptr %19, align 8, !tbaa !9
  store double %20, ptr %8, align 8, !tbaa !9
  %21 = load double, ptr %7, align 8, !tbaa !9
  %22 = fmul double 2.000000e+00, %21
  %23 = load double, ptr %7, align 8, !tbaa !9
  %24 = fneg double %22
  %25 = call double @llvm.fmuladd.f64(double %24, double %23, double 1.000000e+00)
  %26 = load double, ptr %8, align 8, !tbaa !9
  %27 = fmul double 2.000000e+00, %26
  %28 = load double, ptr %8, align 8, !tbaa !9
  %29 = fneg double %27
  %30 = call double @llvm.fmuladd.f64(double %29, double %28, double %25)
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds [3 x double], ptr %31, i64 0
  %33 = getelementptr inbounds [3 x double], ptr %32, i64 0, i64 0
  store double %30, ptr %33, align 8, !tbaa !9
  %34 = load double, ptr %6, align 8, !tbaa !9
  %35 = fmul double 2.000000e+00, %34
  %36 = load double, ptr %7, align 8, !tbaa !9
  %37 = load double, ptr %8, align 8, !tbaa !9
  %38 = fmul double 2.000000e+00, %37
  %39 = load double, ptr %5, align 8, !tbaa !9
  %40 = fmul double %38, %39
  %41 = fneg double %40
  %42 = call double @llvm.fmuladd.f64(double %35, double %36, double %41)
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds [3 x double], ptr %43, i64 1
  %45 = getelementptr inbounds [3 x double], ptr %44, i64 0, i64 0
  store double %42, ptr %45, align 8, !tbaa !9
  %46 = load double, ptr %6, align 8, !tbaa !9
  %47 = fmul double 2.000000e+00, %46
  %48 = load double, ptr %8, align 8, !tbaa !9
  %49 = load double, ptr %7, align 8, !tbaa !9
  %50 = fmul double 2.000000e+00, %49
  %51 = load double, ptr %5, align 8, !tbaa !9
  %52 = fmul double %50, %51
  %53 = call double @llvm.fmuladd.f64(double %47, double %48, double %52)
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds [3 x double], ptr %54, i64 2
  %56 = getelementptr inbounds [3 x double], ptr %55, i64 0, i64 0
  store double %53, ptr %56, align 8, !tbaa !9
  %57 = load double, ptr %6, align 8, !tbaa !9
  %58 = fmul double 2.000000e+00, %57
  %59 = load double, ptr %7, align 8, !tbaa !9
  %60 = load double, ptr %8, align 8, !tbaa !9
  %61 = fmul double 2.000000e+00, %60
  %62 = load double, ptr %5, align 8, !tbaa !9
  %63 = fmul double %61, %62
  %64 = call double @llvm.fmuladd.f64(double %58, double %59, double %63)
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds [3 x double], ptr %65, i64 0
  %67 = getelementptr inbounds [3 x double], ptr %66, i64 0, i64 1
  store double %64, ptr %67, align 8, !tbaa !9
  %68 = load double, ptr %6, align 8, !tbaa !9
  %69 = fmul double 2.000000e+00, %68
  %70 = load double, ptr %6, align 8, !tbaa !9
  %71 = fneg double %69
  %72 = call double @llvm.fmuladd.f64(double %71, double %70, double 1.000000e+00)
  %73 = load double, ptr %8, align 8, !tbaa !9
  %74 = fmul double 2.000000e+00, %73
  %75 = load double, ptr %8, align 8, !tbaa !9
  %76 = fneg double %74
  %77 = call double @llvm.fmuladd.f64(double %76, double %75, double %72)
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds [3 x double], ptr %78, i64 1
  %80 = getelementptr inbounds [3 x double], ptr %79, i64 0, i64 1
  store double %77, ptr %80, align 8, !tbaa !9
  %81 = load double, ptr %7, align 8, !tbaa !9
  %82 = fmul double 2.000000e+00, %81
  %83 = load double, ptr %8, align 8, !tbaa !9
  %84 = load double, ptr %6, align 8, !tbaa !9
  %85 = fmul double 2.000000e+00, %84
  %86 = load double, ptr %5, align 8, !tbaa !9
  %87 = fmul double %85, %86
  %88 = fneg double %87
  %89 = call double @llvm.fmuladd.f64(double %82, double %83, double %88)
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds [3 x double], ptr %90, i64 2
  %92 = getelementptr inbounds [3 x double], ptr %91, i64 0, i64 1
  store double %89, ptr %92, align 8, !tbaa !9
  %93 = load double, ptr %6, align 8, !tbaa !9
  %94 = fmul double 2.000000e+00, %93
  %95 = load double, ptr %8, align 8, !tbaa !9
  %96 = load double, ptr %7, align 8, !tbaa !9
  %97 = fmul double 2.000000e+00, %96
  %98 = load double, ptr %5, align 8, !tbaa !9
  %99 = fmul double %97, %98
  %100 = fneg double %99
  %101 = call double @llvm.fmuladd.f64(double %94, double %95, double %100)
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds [3 x double], ptr %102, i64 0
  %104 = getelementptr inbounds [3 x double], ptr %103, i64 0, i64 2
  store double %101, ptr %104, align 8, !tbaa !9
  %105 = load double, ptr %7, align 8, !tbaa !9
  %106 = fmul double 2.000000e+00, %105
  %107 = load double, ptr %8, align 8, !tbaa !9
  %108 = load double, ptr %6, align 8, !tbaa !9
  %109 = fmul double 2.000000e+00, %108
  %110 = load double, ptr %5, align 8, !tbaa !9
  %111 = fmul double %109, %110
  %112 = call double @llvm.fmuladd.f64(double %106, double %107, double %111)
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds [3 x double], ptr %113, i64 1
  %115 = getelementptr inbounds [3 x double], ptr %114, i64 0, i64 2
  store double %112, ptr %115, align 8, !tbaa !9
  %116 = load double, ptr %6, align 8, !tbaa !9
  %117 = fmul double 2.000000e+00, %116
  %118 = load double, ptr %6, align 8, !tbaa !9
  %119 = fneg double %117
  %120 = call double @llvm.fmuladd.f64(double %119, double %118, double 1.000000e+00)
  %121 = load double, ptr %7, align 8, !tbaa !9
  %122 = fmul double 2.000000e+00, %121
  %123 = load double, ptr %7, align 8, !tbaa !9
  %124 = fneg double %122
  %125 = call double @llvm.fmuladd.f64(double %124, double %123, double %120)
  %126 = load ptr, ptr %3, align 8, !tbaa !5
  %127 = getelementptr inbounds [3 x double], ptr %126, i64 2
  %128 = getelementptr inbounds [3 x double], ptr %127, i64 0, i64 2
  store double %125, ptr %128, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"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"

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @Quat_toRotationMatrix(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = load double, ptr %1, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  %5 = load double, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = fmul double %5, 2.000000e+00
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = load <2 x double>, ptr %6, align 8, !tbaa !5
  %10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 0>
  %11 = insertelement <2 x double> poison, double %7, i64 0
  %12 = fneg double %7
  %13 = tail call double @llvm.fmuladd.f64(double %12, double %5, double 1.000000e+00)
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %15 = fmul double %3, %7
  %16 = fneg double %15
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = fmul <2 x double> %9, <double 2.000000e+00, double 2.000000e+00>
  %19 = extractelement <2 x double> %18, i64 0
  %20 = fneg double %19
  %21 = extractelement <2 x double> %9, i64 0
  %22 = tail call double @llvm.fmuladd.f64(double %20, double %21, double 1.000000e+00)
  %23 = extractelement <2 x double> %18, i64 1
  %24 = fneg double %23
  %25 = insertelement <2 x double> poison, double %3, i64 0
  %26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
  %27 = fmul <2 x double> %26, %18
  %28 = insertelement <2 x double> %11, double %24, i64 1
  %29 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %30 = insertelement <2 x double> %29, double %22, i64 1
  %31 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %9, <2 x double> %30)
  %32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> <i32 1, i32 0>
  store <2 x double> %32, ptr %0, align 8, !tbaa !5
  %33 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
  %34 = insertelement <2 x double> %33, double %7, i64 0
  %35 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 1>
  %36 = insertelement <2 x double> %27, double %16, i64 1
  %37 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %34, <2 x double> %35, <2 x double> %36)
  store <2 x double> %37, ptr %8, align 8, !tbaa !5
  %38 = fneg <2 x double> %27
  %39 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
  %40 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %10, <2 x double> %38)
  store <2 x double> %40, ptr %17, align 8, !tbaa !5
  %41 = insertelement <2 x double> %33, double %24, i64 0
  %42 = insertelement <2 x double> poison, double %13, i64 0
  %43 = insertelement <2 x double> %42, double %15, i64 1
  %44 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %41, <2 x double> %35, <2 x double> %43)
  store <2 x double> %44, ptr %14, align 8, !tbaa !5
  %45 = tail call double @llvm.fmuladd.f64(double %20, double %21, double %13)
  %46 = getelementptr inbounds i8, ptr %0, i64 64
  store double %45, ptr %46, align 8, !tbaa !5
  ret void
}

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

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


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