; LLVM IR from thuhcsi/Crystal.TTVS :: Xface/XFace/src/XMath/Matrix4.ll (ZNK5XMath7Matrix4mlERKNS_7Vector3E)

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

%"class.XMath::Vector3" = type { float, float, float }
%"class.XMath::Matrix4" = type { [16 x float] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK5XMath7Matrix4mlERKNS_7Vector3E(ptr dead_on_unwind noalias writable sret(%"class.XMath::Vector3") align 4 %0, ptr noundef nonnull align 4 dereferenceable(64) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) #0 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
  %10 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %11 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %12 = getelementptr inbounds [16 x float], ptr %11, i64 0, i64 0
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.XMath::Vector3", ptr %14, i32 0, i32 0
  %16 = load float, ptr %15, align 4, !tbaa !11
  %17 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %18 = getelementptr inbounds [16 x float], ptr %17, i64 0, i64 4
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.XMath::Vector3", ptr %20, i32 0, i32 1
  %22 = load float, ptr %21, align 4, !tbaa !13
  %23 = fmul float %19, %22
  %24 = call float @llvm.fmuladd.f32(float %13, float %16, float %23)
  %25 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %26 = getelementptr inbounds [16 x float], ptr %25, i64 0, i64 8
  %27 = load float, ptr %26, align 4, !tbaa !9
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.XMath::Vector3", ptr %28, i32 0, i32 2
  %30 = load float, ptr %29, align 4, !tbaa !14
  %31 = call float @llvm.fmuladd.f32(float %27, float %30, float %24)
  %32 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %33 = getelementptr inbounds [16 x float], ptr %32, i64 0, i64 12
  %34 = load float, ptr %33, align 4, !tbaa !9
  %35 = fadd float %31, %34
  store float %35, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %36 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %37 = getelementptr inbounds [16 x float], ptr %36, i64 0, i64 1
  %38 = load float, ptr %37, align 4, !tbaa !9
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %"class.XMath::Vector3", ptr %39, i32 0, i32 0
  %41 = load float, ptr %40, align 4, !tbaa !11
  %42 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %43 = getelementptr inbounds [16 x float], ptr %42, i64 0, i64 5
  %44 = load float, ptr %43, align 4, !tbaa !9
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.XMath::Vector3", ptr %45, i32 0, i32 1
  %47 = load float, ptr %46, align 4, !tbaa !13
  %48 = fmul float %44, %47
  %49 = call float @llvm.fmuladd.f32(float %38, float %41, float %48)
  %50 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %51 = getelementptr inbounds [16 x float], ptr %50, i64 0, i64 9
  %52 = load float, ptr %51, align 4, !tbaa !9
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.XMath::Vector3", ptr %53, i32 0, i32 2
  %55 = load float, ptr %54, align 4, !tbaa !14
  %56 = call float @llvm.fmuladd.f32(float %52, float %55, float %49)
  %57 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %58 = getelementptr inbounds [16 x float], ptr %57, i64 0, i64 13
  %59 = load float, ptr %58, align 4, !tbaa !9
  %60 = fadd float %56, %59
  store float %60, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %61 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %62 = getelementptr inbounds [16 x float], ptr %61, i64 0, i64 2
  %63 = load float, ptr %62, align 4, !tbaa !9
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %"class.XMath::Vector3", ptr %64, i32 0, i32 0
  %66 = load float, ptr %65, align 4, !tbaa !11
  %67 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %68 = getelementptr inbounds [16 x float], ptr %67, i64 0, i64 6
  %69 = load float, ptr %68, align 4, !tbaa !9
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %"class.XMath::Vector3", ptr %70, i32 0, i32 1
  %72 = load float, ptr %71, align 4, !tbaa !13
  %73 = fmul float %69, %72
  %74 = call float @llvm.fmuladd.f32(float %63, float %66, float %73)
  %75 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %76 = getelementptr inbounds [16 x float], ptr %75, i64 0, i64 10
  %77 = load float, ptr %76, align 4, !tbaa !9
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %"class.XMath::Vector3", ptr %78, i32 0, i32 2
  %80 = load float, ptr %79, align 4, !tbaa !14
  %81 = call float @llvm.fmuladd.f32(float %77, float %80, float %74)
  %82 = getelementptr inbounds %"class.XMath::Matrix4", ptr %10, i32 0, i32 0
  %83 = getelementptr inbounds [16 x float], ptr %82, i64 0, i64 14
  %84 = load float, ptr %83, align 4, !tbaa !9
  %85 = fadd float %81, %84
  store float %85, ptr %9, align 4, !tbaa !9
  %86 = load float, ptr %7, align 4, !tbaa !9
  %87 = load float, ptr %8, align 4, !tbaa !9
  %88 = load float, ptr %9, align 4, !tbaa !9
  call void @_ZN5XMath7Vector3C2Efff(ptr noundef nonnull align 4 dereferenceable(12) %0, float noundef %86, float noundef %87, float noundef %88)
  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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5XMath7Vector3C2Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #3 align 2

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

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


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

%"class.XMath::Vector3" = type { float, float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK5XMath7Matrix4mlERKNS_7Vector3E(ptr dead_on_unwind noalias nonnull writable sret(%"class.XMath::Vector3") align 4 %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(64) %1, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %2) local_unnamed_addr #0 align 2 {
  %4 = load float, ptr %1, align 4, !tbaa !5
  %5 = load float, ptr %2, align 4, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = load float, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %2, i64 4
  %9 = load float, ptr %8, align 4, !tbaa !11
  %10 = fmul float %7, %9
  %11 = tail call float @llvm.fmuladd.f32(float %4, float %5, float %10)
  %12 = getelementptr inbounds i8, ptr %1, i64 32
  %13 = load float, ptr %12, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %2, i64 8
  %15 = load float, ptr %14, align 4, !tbaa !12
  %16 = tail call float @llvm.fmuladd.f32(float %13, float %15, float %11)
  %17 = getelementptr inbounds i8, ptr %1, i64 48
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = fadd float %16, %18
  %20 = getelementptr inbounds i8, ptr %1, i64 4
  %21 = load float, ptr %20, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %1, i64 20
  %23 = load float, ptr %22, align 4, !tbaa !5
  %24 = fmul float %9, %23
  %25 = tail call float @llvm.fmuladd.f32(float %21, float %5, float %24)
  %26 = getelementptr inbounds i8, ptr %1, i64 36
  %27 = load float, ptr %26, align 4, !tbaa !5
  %28 = tail call float @llvm.fmuladd.f32(float %27, float %15, float %25)
  %29 = getelementptr inbounds i8, ptr %1, i64 52
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = fadd float %30, %28
  %32 = getelementptr inbounds i8, ptr %1, i64 8
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %1, i64 24
  %35 = load float, ptr %34, align 4, !tbaa !5
  %36 = fmul float %9, %35
  %37 = tail call float @llvm.fmuladd.f32(float %33, float %5, float %36)
  %38 = getelementptr inbounds i8, ptr %1, i64 40
  %39 = load float, ptr %38, align 4, !tbaa !5
  %40 = tail call float @llvm.fmuladd.f32(float %39, float %15, float %37)
  %41 = getelementptr inbounds i8, ptr %1, i64 56
  %42 = load float, ptr %41, align 4, !tbaa !5
  %43 = fadd float %42, %40
  tail call void @_ZN5XMath7Vector3C2Efff(ptr noundef nonnull align 4 dereferenceable(12) %0, float noundef %19, float noundef %31, float noundef %43)
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5XMath7Vector3C2Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #2 align 2

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

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSN5XMath7Vector3E", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 4}
!12 = !{!10, !6, i64 8}


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