; LLVM IR from acrlw/Physics2D :: Physics2D/source/math (physics2d_matrix3x3)

; 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.Physics2D::Vector3" = type { float, float, float }
%"struct.Physics2D::Matrix3x3" = type { %"struct.Physics2D::Vector3", %"struct.Physics2D::Vector3", %"struct.Physics2D::Vector3" }

declare void @_ZN9Physics2D7Vector3C1ERKfS2_S2_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #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: mustprogress uwtable
define dso_local void @_ZN9Physics2D9Matrix3x38multiplyERKS0_RKNS_7Vector3E(ptr dead_on_unwind noalias writable sret(%"struct.Physics2D::Vector3") align 4 %0, ptr noundef nonnull align 4 dereferenceable(36) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  store ptr %0, ptr %4, align 8
  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 4, ptr %7) #4
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %10, i32 0, i32 0
  %12 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %11, i32 0, i32 0
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %14, i32 0, i32 0
  %16 = load float, ptr %15, align 4, !tbaa !13
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %17, i32 0, i32 1
  %19 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %18, i32 0, i32 0
  %20 = load float, ptr %19, align 4, !tbaa !14
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %21, i32 0, i32 1
  %23 = load float, ptr %22, align 4, !tbaa !15
  %24 = fmul float %20, %23
  %25 = call float @llvm.fmuladd.f32(float %13, float %16, float %24)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %26, i32 0, i32 2
  %28 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %27, i32 0, i32 0
  %29 = load float, ptr %28, align 4, !tbaa !16
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %30, i32 0, i32 2
  %32 = load float, ptr %31, align 4, !tbaa !17
  %33 = call float @llvm.fmuladd.f32(float %29, float %32, float %25)
  store float %33, ptr %7, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %34, i32 0, i32 0
  %36 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %35, i32 0, i32 1
  %37 = load float, ptr %36, align 4, !tbaa !19
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %38, i32 0, i32 0
  %40 = load float, ptr %39, align 4, !tbaa !13
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %42, i32 0, i32 1
  %44 = load float, ptr %43, align 4, !tbaa !20
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %45, i32 0, i32 1
  %47 = load float, ptr %46, align 4, !tbaa !15
  %48 = fmul float %44, %47
  %49 = call float @llvm.fmuladd.f32(float %37, float %40, float %48)
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %50, i32 0, i32 2
  %52 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %51, i32 0, i32 1
  %53 = load float, ptr %52, align 4, !tbaa !21
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %54, i32 0, i32 2
  %56 = load float, ptr %55, align 4, !tbaa !17
  %57 = call float @llvm.fmuladd.f32(float %53, float %56, float %49)
  store float %57, ptr %8, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %59, i32 0, i32 2
  %61 = load float, ptr %60, align 4, !tbaa !22
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %62, i32 0, i32 0
  %64 = load float, ptr %63, align 4, !tbaa !13
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %65, i32 0, i32 1
  %67 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %66, i32 0, i32 2
  %68 = load float, ptr %67, align 4, !tbaa !23
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %69, i32 0, i32 1
  %71 = load float, ptr %70, align 4, !tbaa !15
  %72 = fmul float %68, %71
  %73 = call float @llvm.fmuladd.f32(float %61, float %64, float %72)
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.Physics2D::Matrix3x3", ptr %74, i32 0, i32 2
  %76 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %75, i32 0, i32 2
  %77 = load float, ptr %76, align 4, !tbaa !24
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %"struct.Physics2D::Vector3", ptr %78, i32 0, i32 2
  %80 = load float, ptr %79, align 4, !tbaa !17
  %81 = call float @llvm.fmuladd.f32(float %77, float %80, float %73)
  store float %81, ptr %9, align 4, !tbaa !18
  call void @_ZN9Physics2D7Vector3C1ERKfS2_S2_(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

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

attributes #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 = { 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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 0}
!10 = !{!"_ZTSN9Physics2D9Matrix3x3E", !11, i64 0, !11, i64 12, !11, i64 24}
!11 = !{!"_ZTSN9Physics2D7Vector3E", !12, i64 0, !12, i64 4, !12, i64 8}
!12 = !{!"float", !7, i64 0}
!13 = !{!11, !12, i64 0}
!14 = !{!10, !12, i64 12}
!15 = !{!11, !12, i64 4}
!16 = !{!10, !12, i64 24}
!17 = !{!11, !12, i64 8}
!18 = !{!12, !12, i64 0}
!19 = !{!10, !12, i64 4}
!20 = !{!10, !12, i64 16}
!21 = !{!10, !12, i64 28}
!22 = !{!10, !12, i64 8}
!23 = !{!10, !12, i64 20}
!24 = !{!10, !12, i64 32}


; 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.Physics2D::Vector3" = type { float, float, float }

declare void @_ZN9Physics2D7Vector3C1ERKfS2_S2_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) 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 uwtable
define dso_local void @_ZN9Physics2D9Matrix3x38multiplyERKS0_RKNS_7Vector3E(ptr dead_on_unwind noalias nonnull writable sret(%"struct.Physics2D::Vector3") align 4 %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(36) %1, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %2) local_unnamed_addr #2 align 2 {
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %7 = load float, ptr %1, align 4, !tbaa !5
  %8 = load float, ptr %2, align 4, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %1, i64 12
  %10 = load float, ptr %9, align 4, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %2, i64 4
  %12 = load float, ptr %11, align 4, !tbaa !13
  %13 = fmul float %10, %12
  %14 = tail call float @llvm.fmuladd.f32(float %7, float %8, float %13)
  %15 = getelementptr inbounds i8, ptr %1, i64 24
  %16 = load float, ptr %15, align 4, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %2, i64 8
  %18 = load float, ptr %17, align 4, !tbaa !15
  %19 = tail call float @llvm.fmuladd.f32(float %16, float %18, float %14)
  store float %19, ptr %4, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %20 = getelementptr inbounds i8, ptr %1, i64 4
  %21 = load float, ptr %20, align 4, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %1, i64 16
  %23 = load float, ptr %22, align 4, !tbaa !18
  %24 = fmul float %12, %23
  %25 = tail call float @llvm.fmuladd.f32(float %21, float %8, float %24)
  %26 = getelementptr inbounds i8, ptr %1, i64 28
  %27 = load float, ptr %26, align 4, !tbaa !19
  %28 = tail call float @llvm.fmuladd.f32(float %27, float %18, float %25)
  store float %28, ptr %5, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  %29 = getelementptr inbounds i8, ptr %1, i64 8
  %30 = load float, ptr %29, align 4, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %1, i64 20
  %32 = load float, ptr %31, align 4, !tbaa !21
  %33 = fmul float %12, %32
  %34 = tail call float @llvm.fmuladd.f32(float %30, float %8, float %33)
  %35 = getelementptr inbounds i8, ptr %1, i64 32
  %36 = load float, ptr %35, align 4, !tbaa !22
  %37 = tail call float @llvm.fmuladd.f32(float %36, float %18, float %34)
  store float %37, ptr %6, align 4, !tbaa !16
  call void @_ZN9Physics2D7Vector3C1ERKfS2_S2_(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  ret void
}

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

attributes #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 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 = { mustprogress 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, !8, i64 0}
!6 = !{!"_ZTSN9Physics2D9Matrix3x3E", !7, i64 0, !7, i64 12, !7, i64 24}
!7 = !{!"_ZTSN9Physics2D7Vector3E", !8, i64 0, !8, i64 4, !8, i64 8}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!7, !8, i64 0}
!12 = !{!6, !8, i64 12}
!13 = !{!7, !8, i64 4}
!14 = !{!6, !8, i64 24}
!15 = !{!7, !8, i64 8}
!16 = !{!8, !8, i64 0}
!17 = !{!6, !8, i64 4}
!18 = !{!6, !8, i64 16}
!19 = !{!6, !8, i64 28}
!20 = !{!6, !8, i64 8}
!21 = !{!6, !8, i64 20}
!22 = !{!6, !8, i64 32}


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