; LLVM IR from acrlw/Physics2D :: Physics2D/source/math/physics2d_matrix2x2.ll (ZN9Physics2D9Matrix2x28multiplyERKS0_S2_)

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

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

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

declare void @_ZN9Physics2D9Matrix2x2C1ERKfS2_S2_S2_(ptr, ptr, ptr, ptr, ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = !{!"_ZTSN9Physics2D9Matrix2x2E", !11, i64 0, !11, i64 8}
!11 = !{!"_ZTSN9Physics2D7Vector2E", !12, i64 0, !12, i64 4}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !12, i64 8}
!14 = !{!10, !12, i64 4}
!15 = !{!12, !12, i64 0}
!16 = !{!10, !12, i64 12}


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

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

declare void @_ZN9Physics2D9Matrix2x2C1ERKfS2_S2_S2_(ptr, ptr, ptr, ptr, ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = !{!"_ZTSN9Physics2D9Matrix2x2E", !7, i64 0, !7, i64 8}
!7 = !{!"_ZTSN9Physics2D7Vector2E", !8, i64 0, !8, i64 4}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!6, !8, i64 8}
!12 = !{!6, !8, i64 4}
!13 = !{!8, !8, i64 0}
!14 = !{!6, !8, i64 12}


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