; LLVM IR from ThePhysicsGuys/Physics3D :: Physics3D (inertia)

; 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"

%"struct.P3D::Vector" = type { %union.anon }
%union.anon = type { [3 x double] }
%"class.P3D::MatrixRotationTemplate" = type { %"class.P3D::Matrix" }
%"class.P3D::Matrix" = type { [9 x double] }
%"struct.P3D::FullTaylorExpansion" = type { %"struct.P3D::Derivatives" }
%"struct.P3D::Derivatives" = type { [3 x %"class.P3D::SymmetricMatrix"] }
%"class.P3D::SymmetricMatrix" = type { [6 x double] }
%"struct.P3D::Motion" = type { %"struct.P3D::TranslationalMotion", %"struct.P3D::RotationalMotion" }
%"struct.P3D::TranslationalMotion" = type { %"struct.P3D::TaylorExpansion" }
%"struct.P3D::TaylorExpansion" = type { %"struct.P3D::Derivatives.2" }
%"struct.P3D::Derivatives.2" = type { [2 x %"struct.P3D::Vector"] }
%"struct.P3D::RotationalMotion" = type { %"struct.P3D::TaylorExpansion" }
%"struct.P3D::CFrameTemplate" = type { %"struct.P3D::Vector", %"class.P3D::MatrixRotationTemplate" }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3P3DplIddLm3EEENS_6VectorIDTplixfp_Li0Eixfp0_Li0EEXT1_EEERKNS1_IT_XT1_EEERKNS1_IT0_XT1_EEE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3P3D14CFrameTemplateIdE11getRotationEv(ptr dead_on_unwind noalias writable sret(%"class.P3D::MatrixRotationTemplate") align 8, ptr noundef nonnull align 8 dereferenceable(96)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3P3D14CFrameTemplateIdE11getPositionEv(ptr dead_on_unwind noalias writable sret(%"struct.P3D::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(96)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3P3D14CFrameTemplateIdEC2ERKNS_6VectorIdLm3EEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D50getTransformedInertiaDerivativesAroundCenterOfMassERKNS_15SymmetricMatrixIdLm3EEEdRKNS_6VectorIdLm3EEERKNS_14CFrameTemplateIdEERKNS_6MotionE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::FullTaylorExpansion") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, double noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(96) %4, ptr noundef nonnull align 8 dereferenceable(96) %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %"struct.P3D::Vector", align 8
  %13 = alloca %"struct.P3D::Vector", align 8
  %14 = alloca %"struct.P3D::Vector", align 8
  %15 = alloca %"struct.P3D::Motion", align 8
  %16 = alloca %"struct.P3D::Vector", align 8
  %17 = alloca %"struct.P3D::CFrameTemplate", align 8
  %18 = alloca %"class.P3D::MatrixRotationTemplate", align 8
  store ptr %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  store ptr %5, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #5
  %19 = load ptr, ptr %10, align 8, !tbaa !5
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZNK3P3D14CFrameTemplateIdE15localToRelativeERKNS_6VectorIdLm3EEE(ptr dead_on_unwind writable sret(%"struct.P3D::Vector") align 8 %12, ptr noundef nonnull align 8 dereferenceable(96) %19, ptr noundef nonnull align 8 dereferenceable(24) %20)
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #5
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZNK3P3D14CFrameTemplateIdE11getPositionEv(ptr dead_on_unwind writable sret(%"struct.P3D::Vector") align 8 %14, ptr noundef nonnull align 8 dereferenceable(96) %21)
  call void @_ZN3P3DplIddLm3EEENS_6VectorIDTplixfp_Li0Eixfp0_Li0EEXT1_EEERKNS1_IT_XT1_EEERKNS1_IT0_XT1_EEE(ptr dead_on_unwind writable sret(%"struct.P3D::Vector") align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr %15) #5
  %22 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %12, i64 24, i1 false), !tbaa.struct !11
  call void @_ZNK3P3D6Motion16getMotionOfPointENS_6VectorIdLm3EEE(ptr dead_on_unwind writable sret(%"struct.P3D::Motion") align 8 %15, ptr noundef nonnull align 8 dereferenceable(96) %22, ptr noundef byval(%"struct.P3D::Vector") align 8 %16)
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load double, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 96, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 72, ptr %18) #5
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZNK3P3D14CFrameTemplateIdE11getRotationEv(ptr dead_on_unwind writable sret(%"class.P3D::MatrixRotationTemplate") align 8 %18, ptr noundef nonnull align 8 dereferenceable(96) %25)
  call void @_ZN3P3D14CFrameTemplateIdEC2ERKNS_6VectorIdLm3EEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(96) %17, ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(72) %18)
  call void @_ZN3P3D50getTransformedInertiaDerivativesAroundCenterOfMassERKNS_15SymmetricMatrixIdLm3EEEdRKNS_14CFrameTemplateIdEERKNS_6MotionE(ptr dead_on_unwind writable sret(%"struct.P3D::FullTaylorExpansion") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %23, double noundef %24, ptr noundef nonnull align 8 dereferenceable(96) %17, ptr noundef nonnull align 8 dereferenceable(96) %15)
  call void @llvm.lifetime.end.p0(i64 72, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #5
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3P3D14CFrameTemplateIdE15localToRelativeERKNS_6VectorIdLm3EEE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3P3D6Motion16getMotionOfPointENS_6VectorIdLm3EEE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::Motion") align 8, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef byval(%"struct.P3D::Vector") align 8) #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3P3D50getTransformedInertiaDerivativesAroundCenterOfMassERKNS_15SymmetricMatrixIdLm3EEEdRKNS_14CFrameTemplateIdEERKNS_6MotionE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::FullTaylorExpansion") align 8, ptr noundef nonnull align 8 dereferenceable(48), double noundef, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(96)) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { mustprogress 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 = { inlinehint mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{i64 0, i64 24, !12}
!12 = !{!7, !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"

%"struct.P3D::Vector" = type { %union.anon }
%union.anon = type { [3 x double] }
%"class.P3D::MatrixRotationTemplate" = type { %"class.P3D::Matrix" }
%"class.P3D::Matrix" = type { [9 x double] }
%"struct.P3D::FullTaylorExpansion" = type { %"struct.P3D::Derivatives" }
%"struct.P3D::Derivatives" = type { [3 x %"class.P3D::SymmetricMatrix"] }
%"class.P3D::SymmetricMatrix" = type { [6 x double] }
%"struct.P3D::Motion" = type { %"struct.P3D::TranslationalMotion", %"struct.P3D::RotationalMotion" }
%"struct.P3D::TranslationalMotion" = type { %"struct.P3D::TaylorExpansion" }
%"struct.P3D::TaylorExpansion" = type { %"struct.P3D::Derivatives.2" }
%"struct.P3D::Derivatives.2" = type { [2 x %"struct.P3D::Vector"] }
%"struct.P3D::RotationalMotion" = type { %"struct.P3D::TaylorExpansion" }
%"struct.P3D::CFrameTemplate" = type { %"struct.P3D::Vector", %"class.P3D::MatrixRotationTemplate" }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3P3DplIddLm3EEENS_6VectorIDTplixfp_Li0Eixfp0_Li0EEXT1_EEERKNS1_IT_XT1_EEERKNS1_IT0_XT1_EEE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3P3D14CFrameTemplateIdE11getRotationEv(ptr dead_on_unwind noalias writable sret(%"class.P3D::MatrixRotationTemplate") align 8, ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3P3D14CFrameTemplateIdE11getPositionEv(ptr dead_on_unwind noalias writable sret(%"struct.P3D::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3P3D14CFrameTemplateIdEC2ERKNS_6VectorIdLm3EEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D50getTransformedInertiaDerivativesAroundCenterOfMassERKNS_15SymmetricMatrixIdLm3EEEdRKNS_6VectorIdLm3EEERKNS_14CFrameTemplateIdEERKNS_6MotionE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::FullTaylorExpansion") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, double noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(96) %4, ptr noundef nonnull align 8 dereferenceable(96) %5) local_unnamed_addr #2 {
  %7 = alloca %"struct.P3D::Vector", align 8
  %8 = alloca %"struct.P3D::Vector", align 8
  %9 = alloca %"struct.P3D::Vector", align 8
  %10 = alloca %"struct.P3D::Motion", align 8
  %11 = alloca %"struct.P3D::CFrameTemplate", align 8
  %12 = alloca %"class.P3D::MatrixRotationTemplate", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #4
  call void @_ZNK3P3D14CFrameTemplateIdE15localToRelativeERKNS_6VectorIdLm3EEE(ptr dead_on_unwind nonnull writable sret(%"struct.P3D::Vector") align 8 %7, ptr noundef nonnull align 8 dereferenceable(96) %4, ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #4
  call void @_ZNK3P3D14CFrameTemplateIdE11getPositionEv(ptr dead_on_unwind nonnull writable sret(%"struct.P3D::Vector") align 8 %9, ptr noundef nonnull align 8 dereferenceable(96) %4)
  call void @_ZN3P3DplIddLm3EEENS_6VectorIDTplixfp_Li0Eixfp0_Li0EEXT1_EEERKNS1_IT_XT1_EEERKNS1_IT0_XT1_EEE(ptr dead_on_unwind nonnull writable sret(%"struct.P3D::Vector") align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %10) #4
  call void @_ZNK3P3D6Motion16getMotionOfPointENS_6VectorIdLm3EEE(ptr dead_on_unwind nonnull writable sret(%"struct.P3D::Motion") align 8 %10, ptr noundef nonnull align 8 dereferenceable(96) %5, ptr noundef nonnull byval(%"struct.P3D::Vector") align 8 %7)
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %11) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %12) #4
  call void @_ZNK3P3D14CFrameTemplateIdE11getRotationEv(ptr dead_on_unwind nonnull writable sret(%"class.P3D::MatrixRotationTemplate") align 8 %12, ptr noundef nonnull align 8 dereferenceable(96) %4)
  call void @_ZN3P3D14CFrameTemplateIdEC2ERKNS_6VectorIdLm3EEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(96) %11, ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(72) %12)
  call void @_ZN3P3D50getTransformedInertiaDerivativesAroundCenterOfMassERKNS_15SymmetricMatrixIdLm3EEEdRKNS_14CFrameTemplateIdEERKNS_6MotionE(ptr dead_on_unwind writable sret(%"struct.P3D::FullTaylorExpansion") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, double noundef %2, ptr noundef nonnull align 8 dereferenceable(96) %11, ptr noundef nonnull align 8 dereferenceable(96) %10)
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3P3D14CFrameTemplateIdE15localToRelativeERKNS_6VectorIdLm3EEE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3P3D6Motion16getMotionOfPointENS_6VectorIdLm3EEE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::Motion") align 8, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef byval(%"struct.P3D::Vector") align 8) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3P3D50getTransformedInertiaDerivativesAroundCenterOfMassERKNS_15SymmetricMatrixIdLm3EEEdRKNS_14CFrameTemplateIdEERKNS_6MotionE(ptr dead_on_unwind noalias writable sret(%"struct.P3D::FullTaylorExpansion") align 8, ptr noundef nonnull align 8 dereferenceable(48), double noundef, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { mustprogress 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 = { inlinehint mustprogress 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)"}


; Effective O3 passes: DSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass