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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }
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,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass