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

; 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 @sqrt(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 @Vec3d_getPolarVelocityMatrix(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
  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
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds double, ptr %10, i64 0
  %12 = load double, ptr %11, align 8, !tbaa !9
  store double %12, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds double, ptr %13, i64 1
  %15 = load double, ptr %14, align 8, !tbaa !9
  store double %15, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds double, ptr %16, i64 2
  %18 = load double, ptr %17, align 8, !tbaa !9
  store double %18, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %19 = load double, ptr %5, align 8, !tbaa !9
  %20 = load double, ptr %5, align 8, !tbaa !9
  %21 = load double, ptr %6, align 8, !tbaa !9
  %22 = load double, ptr %6, align 8, !tbaa !9
  %23 = fmul double %21, %22
  %24 = call double @llvm.fmuladd.f64(double %19, double %20, double %23)
  %25 = call double @sqrt(double noundef %24) #4
  store double %25, ptr %8, align 8, !tbaa !9
  %26 = load double, ptr %8, align 8, !tbaa !9
  %27 = fcmp olt double %26, 1.000000e-08
  br i1 %27, label %28, label %29

28:                                               ; preds = %2
  store double 1.000000e-08, ptr %8, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %28, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %30 = load double, ptr %8, align 8, !tbaa !9
  %31 = load double, ptr %8, align 8, !tbaa !9
  %32 = fmul double %30, %31
  store double %32, ptr %9, align 8, !tbaa !9
  %33 = load double, ptr %6, align 8, !tbaa !9
  %34 = fneg double %33
  %35 = load double, ptr %8, align 8, !tbaa !9
  %36 = fdiv double %34, %35
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds [3 x double], ptr %37, i64 0
  %39 = getelementptr inbounds [3 x double], ptr %38, i64 0, i64 0
  store double %36, ptr %39, align 8, !tbaa !9
  %40 = load double, ptr %5, align 8, !tbaa !9
  %41 = load double, ptr %8, align 8, !tbaa !9
  %42 = fdiv double %40, %41
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds [3 x double], ptr %43, i64 0
  %45 = getelementptr inbounds [3 x double], ptr %44, i64 0, i64 1
  store double %42, ptr %45, align 8, !tbaa !9
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds [3 x double], ptr %46, i64 0
  %48 = getelementptr inbounds [3 x double], ptr %47, i64 0, i64 2
  store double 0.000000e+00, ptr %48, align 8, !tbaa !9
  %49 = load double, ptr %5, align 8, !tbaa !9
  %50 = load double, ptr %7, align 8, !tbaa !9
  %51 = fmul double %49, %50
  %52 = fneg double %51
  %53 = load double, ptr %9, align 8, !tbaa !9
  %54 = fdiv double %52, %53
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds [3 x double], ptr %55, i64 1
  %57 = getelementptr inbounds [3 x double], ptr %56, i64 0, i64 0
  store double %54, ptr %57, align 8, !tbaa !9
  %58 = load double, ptr %6, align 8, !tbaa !9
  %59 = load double, ptr %7, align 8, !tbaa !9
  %60 = fmul double %58, %59
  %61 = fneg double %60
  %62 = load double, ptr %9, align 8, !tbaa !9
  %63 = fdiv double %61, %62
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds [3 x double], ptr %64, i64 1
  %66 = getelementptr inbounds [3 x double], ptr %65, i64 0, i64 1
  store double %63, ptr %66, align 8, !tbaa !9
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds [3 x double], ptr %67, i64 1
  %69 = getelementptr inbounds [3 x double], ptr %68, i64 0, i64 2
  store double 1.000000e+00, ptr %69, align 8, !tbaa !9
  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 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 @Vec3d_getPolarVelocityMatrix(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %1, i64 16
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load <2 x double>, ptr %1, align 8, !tbaa !5
  %8 = fmul <2 x double> %7, %7
  %9 = extractelement <2 x double> %8, i64 1
  %10 = extractelement <2 x double> %7, i64 0
  %11 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %9)
  %sqrt = tail call double @llvm.sqrt.f64(double %11)
  %12 = fcmp olt double %sqrt, 1.000000e-08
  %.0 = select i1 %12, double 1.000000e-08, double %sqrt
  %13 = fmul double %.0, %.0
  %14 = fneg <2 x double> %7
  %15 = shufflevector <2 x double> %14, <2 x double> %7, <2 x i32> <i32 1, i32 2>
  %16 = insertelement <2 x double> poison, double %.0, i64 0
  %17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
  %18 = fdiv <2 x double> %15, %17
  store <2 x double> %18, ptr %0, align 8, !tbaa !5
  store double 0.000000e+00, ptr %5, align 8, !tbaa !5
  %19 = insertelement <2 x double> poison, double %4, i64 0
  %20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
  %21 = fmul <2 x double> %20, %14
  %22 = insertelement <2 x double> poison, double %13, i64 0
  %23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
  %24 = fdiv <2 x double> %21, %23
  store <2 x double> %24, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 40
  store double 1.000000e+00, ptr %25, align 8, !tbaa !5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(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: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass