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

; Function Attrs: nounwind uwtable
define dso_local void @Mat3d_dDiffAngleDEuler(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
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  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 0
  %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 0
  %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 1
  %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 1
  %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
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds double, ptr %35, i64 2
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = call double @sin(double noundef %37) #4
  store double %38, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds double, ptr %39, i64 2
  %41 = load double, ptr %40, align 8, !tbaa !9
  %42 = call double @cos(double noundef %41) #4
  store double %42, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %43 = load double, ptr %10, align 8, !tbaa !9
  %44 = load double, ptr %12, align 8, !tbaa !9
  %45 = fmul double %43, %44
  store double %45, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %46 = load double, ptr %8, align 8, !tbaa !9
  %47 = load double, ptr %12, align 8, !tbaa !9
  %48 = load double, ptr %7, align 8, !tbaa !9
  %49 = load double, ptr %9, align 8, !tbaa !9
  %50 = fmul double %48, %49
  %51 = load double, ptr %11, align 8, !tbaa !9
  %52 = fmul double %50, %51
  %53 = fneg double %52
  %54 = call double @llvm.fmuladd.f64(double %46, double %47, double %53)
  store double %54, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %55 = load double, ptr %8, align 8, !tbaa !9
  %56 = load double, ptr %10, align 8, !tbaa !9
  %57 = fmul double %55, %56
  store double %57, ptr %15, align 8, !tbaa !9
  %58 = load double, ptr %13, align 8, !tbaa !9
  %59 = load double, ptr %14, align 8, !tbaa !9
  %60 = fadd double %58, %59
  %61 = load double, ptr %15, align 8, !tbaa !9
  %62 = fadd double %60, %61
  %63 = fsub double %62, 1.000000e+00
  %64 = fmul double 5.000000e-01, %63
  store double %64, ptr %5, align 8, !tbaa !9
  %65 = load double, ptr %5, align 8, !tbaa !9
  %66 = fcmp oeq double %65, 1.000000e+00
  br i1 %66, label %67, label %68

67:                                               ; preds = %2
  store double 0.000000e+00, ptr %6, align 8, !tbaa !9
  br label %76

68:                                               ; preds = %2
  %69 = load double, ptr %5, align 8, !tbaa !9
  %70 = load double, ptr %5, align 8, !tbaa !9
  %71 = fneg double %69
  %72 = call double @llvm.fmuladd.f64(double %71, double %70, double 1.000000e+00)
  %73 = call double @sqrt(double noundef %72) #4
  %74 = fmul double 2.000000e+00, %73
  %75 = fdiv double -1.000000e+00, %74
  store double %75, ptr %6, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %68, %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %77 = load double, ptr %7, align 8, !tbaa !9
  %78 = fneg double %77
  %79 = load double, ptr %12, align 8, !tbaa !9
  %80 = load double, ptr %8, align 8, !tbaa !9
  %81 = load double, ptr %9, align 8, !tbaa !9
  %82 = fmul double %80, %81
  %83 = load double, ptr %11, align 8, !tbaa !9
  %84 = fmul double %82, %83
  %85 = fneg double %84
  %86 = call double @llvm.fmuladd.f64(double %78, double %79, double %85)
  %87 = load double, ptr %7, align 8, !tbaa !9
  %88 = load double, ptr %10, align 8, !tbaa !9
  %89 = fneg double %87
  %90 = call double @llvm.fmuladd.f64(double %89, double %88, double %86)
  store double %90, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %91 = load double, ptr %9, align 8, !tbaa !9
  %92 = fneg double %91
  %93 = load double, ptr %12, align 8, !tbaa !9
  %94 = load double, ptr %7, align 8, !tbaa !9
  %95 = load double, ptr %10, align 8, !tbaa !9
  %96 = fmul double %94, %95
  %97 = load double, ptr %11, align 8, !tbaa !9
  %98 = fmul double %96, %97
  %99 = fneg double %98
  %100 = call double @llvm.fmuladd.f64(double %92, double %93, double %99)
  %101 = load double, ptr %8, align 8, !tbaa !9
  %102 = load double, ptr %9, align 8, !tbaa !9
  %103 = fneg double %101
  %104 = call double @llvm.fmuladd.f64(double %103, double %102, double %100)
  store double %104, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %105 = load double, ptr %10, align 8, !tbaa !9
  %106 = fneg double %105
  %107 = load double, ptr %11, align 8, !tbaa !9
  %108 = load double, ptr %8, align 8, !tbaa !9
  %109 = load double, ptr %11, align 8, !tbaa !9
  %110 = fmul double %108, %109
  %111 = fneg double %110
  %112 = call double @llvm.fmuladd.f64(double %106, double %107, double %111)
  %113 = load double, ptr %7, align 8, !tbaa !9
  %114 = load double, ptr %9, align 8, !tbaa !9
  %115 = fmul double %113, %114
  %116 = load double, ptr %12, align 8, !tbaa !9
  %117 = fneg double %115
  %118 = call double @llvm.fmuladd.f64(double %117, double %116, double %112)
  store double %118, ptr %18, align 8, !tbaa !9
  %119 = load double, ptr %16, align 8, !tbaa !9
  %120 = load double, ptr %6, align 8, !tbaa !9
  %121 = fmul double %119, %120
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = getelementptr inbounds double, ptr %122, i64 0
  store double %121, ptr %123, align 8, !tbaa !9
  %124 = load double, ptr %17, align 8, !tbaa !9
  %125 = load double, ptr %6, align 8, !tbaa !9
  %126 = fmul double %124, %125
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds double, ptr %127, i64 1
  store double %126, ptr %128, align 8, !tbaa !9
  %129 = load double, ptr %18, align 8, !tbaa !9
  %130 = load double, ptr %6, align 8, !tbaa !9
  %131 = fmul double %129, %130
  %132 = load ptr, ptr %3, align 8, !tbaa !5
  %133 = getelementptr inbounds double, ptr %132, i64 2
  store double %131, ptr %133, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local void @Mat3d_dDiffAngleDEuler(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = load double, ptr %1, align 8, !tbaa !5
  %4 = tail call double @sin(double noundef %3) #4
  %5 = load double, ptr %1, align 8, !tbaa !5
  %6 = tail call double @cos(double noundef %5) #4
  %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) #4
  %10 = load double, ptr %7, align 8, !tbaa !5
  %11 = tail call double @cos(double noundef %10) #4
  %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) #4
  %15 = load double, ptr %12, align 8, !tbaa !5
  %16 = tail call double @cos(double noundef %15) #4
  %17 = fmul double %11, %16
  %18 = fneg double %4
  %19 = fmul double %9, %18
  %20 = fmul double %19, %14
  %21 = tail call double @llvm.fmuladd.f64(double %6, double %16, double %20)
  %22 = fmul double %6, %11
  %23 = fadd double %17, %21
  %24 = fadd double %22, %23
  %25 = fadd double %24, -1.000000e+00
  %26 = fmul double %25, 5.000000e-01
  %27 = fcmp oeq double %26, 1.000000e+00
  br i1 %27, label %34, label %28

28:                                               ; preds = %2
  %29 = fneg double %26
  %30 = tail call double @llvm.fmuladd.f64(double %29, double %26, double 1.000000e+00)
  %31 = tail call double @sqrt(double noundef %30) #4
  %32 = fmul double %31, 2.000000e+00
  %33 = fdiv double -1.000000e+00, %32
  br label %34

34:                                               ; preds = %2, %28
  %.0 = phi double [ %33, %28 ], [ 0.000000e+00, %2 ]
  %35 = fneg double %6
  %36 = fneg double %9
  %37 = fneg double %11
  %38 = fmul double %14, %35
  %39 = tail call double @llvm.fmuladd.f64(double %37, double %14, double %38)
  %40 = tail call double @llvm.fmuladd.f64(double %19, double %16, double %39)
  %41 = insertelement <2 x double> poison, double %11, i64 0
  %42 = insertelement <2 x double> %41, double %9, i64 1
  %43 = insertelement <2 x double> poison, double %18, i64 0
  %44 = insertelement <2 x double> %43, double %35, i64 1
  %45 = fmul <2 x double> %42, %44
  %46 = insertelement <2 x double> poison, double %14, i64 0
  %47 = shufflevector <2 x double> %46, <2 x double> poison, <2 x i32> zeroinitializer
  %48 = fmul <2 x double> %45, %47
  %49 = insertelement <2 x double> poison, double %36, i64 0
  %50 = insertelement <2 x double> %49, double %18, i64 1
  %51 = insertelement <2 x double> poison, double %16, i64 0
  %52 = shufflevector <2 x double> %51, <2 x double> poison, <2 x i32> zeroinitializer
  %53 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %50, <2 x double> %52, <2 x double> %48)
  %54 = shufflevector <2 x double> %53, <2 x double> poison, <2 x i32> <i32 1, i32 0>
  %55 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %44, <2 x double> %42, <2 x double> %54)
  %56 = insertelement <2 x double> poison, double %.0, i64 0
  %57 = shufflevector <2 x double> %56, <2 x double> poison, <2 x i32> zeroinitializer
  %58 = fmul <2 x double> %55, %57
  store <2 x double> %58, ptr %0, align 8, !tbaa !5
  %59 = fmul double %40, %.0
  %60 = getelementptr inbounds i8, ptr %0, i64 16
  store double %59, ptr %60, 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>) #3

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


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