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

; 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 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: nounwind
declare double @sin(double noundef) #1

; Function Attrs: nounwind
declare double @cos(double noundef) #1

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "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) }
attributes #3 = { 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 = { 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 nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local void @Mat3d_fromEulerAngles(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = load double, ptr %1, align 8, !tbaa !5
  %4 = tail call double @sin(double noundef %3) #3
  %5 = load double, ptr %1, align 8, !tbaa !5
  %6 = tail call double @cos(double noundef %5) #3
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = tail call double @sin(double noundef %8) #3
  %10 = load double, ptr %7, align 8, !tbaa !5
  %11 = tail call double @cos(double noundef %10) #3
  %12 = getelementptr inbounds i8, ptr %1, i64 16
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = tail call double @sin(double noundef %13) #3
  %15 = load double, ptr %12, align 8, !tbaa !5
  %16 = tail call double @cos(double noundef %15) #3
  %17 = fmul double %11, %16
  store double %17, ptr %0, align 8, !tbaa !5
  %18 = fmul double %4, %9
  %19 = getelementptr inbounds i8, ptr %0, i64 8
  %20 = fmul double %6, %9
  %21 = fneg double %20
  %22 = insertelement <2 x double> poison, double %18, i64 0
  %23 = insertelement <2 x double> %22, double %21, i64 1
  %24 = insertelement <2 x double> poison, double %16, i64 0
  %25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
  %26 = fmul <2 x double> %23, %25
  %27 = insertelement <2 x double> poison, double %6, i64 0
  %28 = insertelement <2 x double> %27, double %4, i64 1
  %29 = insertelement <2 x double> poison, double %14, i64 0
  %30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
  %31 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %30, <2 x double> %26)
  store <2 x double> %31, ptr %19, align 8, !tbaa !5
  %32 = fneg double %11
  %33 = fmul double %14, %32
  %34 = getelementptr inbounds i8, ptr %0, i64 24
  store double %33, ptr %34, align 8, !tbaa !5
  %35 = fneg double %18
  %36 = getelementptr inbounds i8, ptr %0, i64 32
  %37 = insertelement <2 x double> poison, double %35, i64 0
  %38 = insertelement <2 x double> %37, double %20, i64 1
  %39 = fmul <2 x double> %30, %38
  %40 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %25, <2 x double> %39)
  store <2 x double> %40, ptr %36, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %0, i64 48
  store double %9, ptr %41, align 8, !tbaa !5
  %42 = fneg double %4
  %43 = getelementptr inbounds i8, ptr %0, i64 56
  %44 = insertelement <2 x double> poison, double %11, i64 0
  %45 = shufflevector <2 x double> %44, <2 x double> poison, <2 x i32> zeroinitializer
  %46 = insertelement <2 x double> poison, double %42, i64 0
  %47 = insertelement <2 x double> %46, double %6, i64 1
  %48 = fmul <2 x double> %45, %47
  store <2 x double> %48, ptr %43, 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 nofree nounwind willreturn memory(write) "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 nofree nounwind willreturn memory(write, 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) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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