; 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: nounwind uwtable
declare dso_local void @Mat3d_setIdentity(ptr noundef) #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
declare double @sin(double noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @Mat3d_fromAxisAngle(ptr noundef %0, ptr noundef %1, double noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca [3 x double], align 16
  %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 i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store double %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %16 = getelementptr inbounds [3 x double], ptr %7, i64 0, i64 0
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call double @Vec3d_normalize(ptr noundef %16, ptr noundef %17)
  store double %18, ptr %14, align 8, !tbaa !9
  %19 = load double, ptr %14, align 8, !tbaa !9
  %20 = fcmp oeq double %19, 0.000000e+00
  br i1 %20, label %21, label %23

21:                                               ; preds = %3
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  call void @Mat3d_setIdentity(ptr noundef %22)
  store i32 1, ptr %15, align 4
  br label %132

23:                                               ; preds = %3
  %24 = getelementptr inbounds [3 x double], ptr %7, i64 0, i64 0
  %25 = load double, ptr %24, align 16, !tbaa !9
  store double %25, ptr %11, align 8, !tbaa !9
  %26 = getelementptr inbounds [3 x double], ptr %7, i64 0, i64 1
  %27 = load double, ptr %26, align 8, !tbaa !9
  store double %27, ptr %12, align 8, !tbaa !9
  %28 = getelementptr inbounds [3 x double], ptr %7, i64 0, i64 2
  %29 = load double, ptr %28, align 16, !tbaa !9
  store double %29, ptr %13, align 8, !tbaa !9
  %30 = load double, ptr %6, align 8, !tbaa !9
  %31 = call double @sin(double noundef %30) #5
  store double %31, ptr %8, align 8, !tbaa !9
  %32 = load double, ptr %6, align 8, !tbaa !9
  %33 = call double @cos(double noundef %32) #5
  store double %33, ptr %9, align 8, !tbaa !9
  %34 = load double, ptr %9, align 8, !tbaa !9
  %35 = fsub double 1.000000e+00, %34
  store double %35, ptr %10, align 8, !tbaa !9
  %36 = load double, ptr %11, align 8, !tbaa !9
  %37 = load double, ptr %11, align 8, !tbaa !9
  %38 = fmul double %36, %37
  %39 = load double, ptr %10, align 8, !tbaa !9
  %40 = load double, ptr %9, align 8, !tbaa !9
  %41 = call double @llvm.fmuladd.f64(double %38, double %39, double %40)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds [3 x double], ptr %42, i64 0
  %44 = getelementptr inbounds [3 x double], ptr %43, i64 0, i64 0
  store double %41, ptr %44, align 8, !tbaa !9
  %45 = load double, ptr %12, align 8, !tbaa !9
  %46 = load double, ptr %11, align 8, !tbaa !9
  %47 = fmul double %45, %46
  %48 = load double, ptr %10, align 8, !tbaa !9
  %49 = load double, ptr %13, align 8, !tbaa !9
  %50 = load double, ptr %8, align 8, !tbaa !9
  %51 = fmul double %49, %50
  %52 = fneg double %51
  %53 = call double @llvm.fmuladd.f64(double %47, double %48, double %52)
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds [3 x double], ptr %54, i64 1
  %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 %13, align 8, !tbaa !9
  %58 = load double, ptr %11, align 8, !tbaa !9
  %59 = fmul double %57, %58
  %60 = load double, ptr %10, align 8, !tbaa !9
  %61 = load double, ptr %12, align 8, !tbaa !9
  %62 = load double, ptr %8, align 8, !tbaa !9
  %63 = fmul double %61, %62
  %64 = call double @llvm.fmuladd.f64(double %59, double %60, double %63)
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds [3 x double], ptr %65, i64 2
  %67 = getelementptr inbounds [3 x double], ptr %66, i64 0, i64 0
  store double %64, ptr %67, align 8, !tbaa !9
  %68 = load double, ptr %11, align 8, !tbaa !9
  %69 = load double, ptr %12, align 8, !tbaa !9
  %70 = fmul double %68, %69
  %71 = load double, ptr %10, align 8, !tbaa !9
  %72 = load double, ptr %13, align 8, !tbaa !9
  %73 = load double, ptr %8, align 8, !tbaa !9
  %74 = fmul double %72, %73
  %75 = call double @llvm.fmuladd.f64(double %70, double %71, double %74)
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds [3 x double], ptr %76, i64 0
  %78 = getelementptr inbounds [3 x double], ptr %77, i64 0, i64 1
  store double %75, ptr %78, align 8, !tbaa !9
  %79 = load double, ptr %12, align 8, !tbaa !9
  %80 = load double, ptr %12, align 8, !tbaa !9
  %81 = fmul double %79, %80
  %82 = load double, ptr %10, align 8, !tbaa !9
  %83 = load double, ptr %9, align 8, !tbaa !9
  %84 = call double @llvm.fmuladd.f64(double %81, double %82, double %83)
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds [3 x double], ptr %85, i64 1
  %87 = getelementptr inbounds [3 x double], ptr %86, i64 0, i64 1
  store double %84, ptr %87, align 8, !tbaa !9
  %88 = load double, ptr %13, align 8, !tbaa !9
  %89 = load double, ptr %12, align 8, !tbaa !9
  %90 = fmul double %88, %89
  %91 = load double, ptr %10, align 8, !tbaa !9
  %92 = load double, ptr %11, align 8, !tbaa !9
  %93 = load double, ptr %8, align 8, !tbaa !9
  %94 = fmul double %92, %93
  %95 = fneg double %94
  %96 = call double @llvm.fmuladd.f64(double %90, double %91, double %95)
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds [3 x double], ptr %97, i64 2
  %99 = getelementptr inbounds [3 x double], ptr %98, i64 0, i64 1
  store double %96, ptr %99, align 8, !tbaa !9
  %100 = load double, ptr %11, align 8, !tbaa !9
  %101 = load double, ptr %13, align 8, !tbaa !9
  %102 = fmul double %100, %101
  %103 = load double, ptr %10, align 8, !tbaa !9
  %104 = load double, ptr %12, align 8, !tbaa !9
  %105 = load double, ptr %8, align 8, !tbaa !9
  %106 = fmul double %104, %105
  %107 = fneg double %106
  %108 = call double @llvm.fmuladd.f64(double %102, double %103, double %107)
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds [3 x double], ptr %109, i64 0
  %111 = getelementptr inbounds [3 x double], ptr %110, i64 0, i64 2
  store double %108, ptr %111, align 8, !tbaa !9
  %112 = load double, ptr %12, align 8, !tbaa !9
  %113 = load double, ptr %13, align 8, !tbaa !9
  %114 = fmul double %112, %113
  %115 = load double, ptr %10, align 8, !tbaa !9
  %116 = load double, ptr %11, align 8, !tbaa !9
  %117 = load double, ptr %8, align 8, !tbaa !9
  %118 = fmul double %116, %117
  %119 = call double @llvm.fmuladd.f64(double %114, double %115, double %118)
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds [3 x double], ptr %120, i64 1
  %122 = getelementptr inbounds [3 x double], ptr %121, i64 0, i64 2
  store double %119, ptr %122, align 8, !tbaa !9
  %123 = load double, ptr %13, align 8, !tbaa !9
  %124 = load double, ptr %13, align 8, !tbaa !9
  %125 = fmul double %123, %124
  %126 = load double, ptr %10, align 8, !tbaa !9
  %127 = load double, ptr %9, align 8, !tbaa !9
  %128 = call double @llvm.fmuladd.f64(double %125, double %126, double %127)
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = getelementptr inbounds [3 x double], ptr %129, i64 2
  %131 = getelementptr inbounds [3 x double], ptr %130, i64 0, i64 2
  store double %128, ptr %131, align 8, !tbaa !9
  store i32 0, ptr %15, align 4
  br label %132

132:                                              ; preds = %23, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  %133 = load i32, ptr %15, align 4
  switch i32 %133, label %135 [
    i32 0, label %134
    i32 1, label %134
  ]

134:                                              ; preds = %132, %132
  ret void

135:                                              ; preds = %132
  unreachable
}

declare double @Vec3d_normalize(ptr noundef, ptr noundef) #4

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { "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 #5 = { 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: nounwind uwtable
declare dso_local void @Mat3d_setIdentity(ptr noundef) local_unnamed_addr #0

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @Mat3d_fromAxisAngle(ptr noundef %0, ptr noundef %1, double noundef %2) local_unnamed_addr #0 {
  %4 = alloca [3 x double], align 16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  %5 = call double @Vec3d_normalize(ptr noundef nonnull %4, ptr noundef %1) #6
  %6 = fcmp oeq double %5, 0.000000e+00
  br i1 %6, label %7, label %8

7:                                                ; preds = %3
  call void @Mat3d_setIdentity(ptr noundef %0)
  br label %46

8:                                                ; preds = %3
  %9 = getelementptr inbounds i8, ptr %4, i64 16
  %10 = load double, ptr %9, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = load <2 x double>, ptr %4, align 16, !tbaa !5
  %13 = call double @sin(double noundef %2) #6
  %14 = call double @cos(double noundef %2) #6
  %15 = fsub double 1.000000e+00, %14
  %16 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
  %17 = fmul <2 x double> %16, %12
  %18 = extractelement <2 x double> %12, i64 0
  %19 = fmul double %18, %10
  %20 = insertelement <2 x double> poison, double %15, i64 0
  %21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
  %22 = insertelement <2 x double> poison, double %14, i64 0
  %23 = getelementptr inbounds i8, ptr %0, i64 32
  %24 = fmul double %18, %13
  %25 = fneg double %24
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> <i32 1, i32 1>
  %28 = insertelement <2 x double> %27, double %10, i64 1
  %29 = insertelement <2 x double> poison, double %13, i64 0
  %30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
  %31 = fmul <2 x double> %28, %30
  %32 = insertelement <2 x double> %31, double %14, i64 0
  %33 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %17, <2 x double> %21, <2 x double> %32)
  store <2 x double> %33, ptr %0, align 8, !tbaa !5
  %34 = fneg <2 x double> %31
  %35 = insertelement <2 x double> %17, double %19, i64 0
  %36 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %35, <2 x double> %21, <2 x double> %34)
  store <2 x double> %36, ptr %26, align 8, !tbaa !5
  %37 = fmul <2 x double> %27, %28
  %38 = insertelement <2 x double> %37, double %19, i64 0
  %39 = insertelement <2 x double> %31, double %25, i64 1
  %40 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %38, <2 x double> %21, <2 x double> %39)
  store <2 x double> %40, ptr %11, align 8, !tbaa !5
  %41 = insertelement <2 x double> %22, double %24, i64 1
  %42 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %37, <2 x double> %21, <2 x double> %41)
  store <2 x double> %42, ptr %23, align 8, !tbaa !5
  %43 = fmul double %10, %10
  %44 = call double @llvm.fmuladd.f64(double %43, double %15, double %14)
  %45 = getelementptr inbounds i8, ptr %0, i64 64
  store double %44, ptr %45, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %8, %7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  ret void
}

declare double @Vec3d_normalize(ptr noundef, ptr noundef) local_unnamed_addr #4

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

attributes #0 = { 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 willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { "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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass