; LLVM IR from goldest-star/seawave-animation :: src/vcl/math/mat/mat3/mat3.ll (ZN3vcl3detERKNS_3matILm3ELm3EEE)

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZN3vcl3detERKNS_3matILm3ELm3EEE(ptr noundef nonnull align 4 dereferenceable(36) %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %"struct.vcl::mat", ptr %3, i32 0, i32 0
  %5 = load float, ptr %4, align 4, !tbaa !9
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %"struct.vcl::mat", ptr %6, i32 0, i32 4
  %8 = load float, ptr %7, align 4, !tbaa !12
  %9 = fmul float %5, %8
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.vcl::mat", ptr %10, i32 0, i32 8
  %12 = load float, ptr %11, align 4, !tbaa !13
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.vcl::mat", ptr %13, i32 0, i32 1
  %15 = load float, ptr %14, align 4, !tbaa !14
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.vcl::mat", ptr %16, i32 0, i32 5
  %18 = load float, ptr %17, align 4, !tbaa !15
  %19 = fmul float %15, %18
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.vcl::mat", ptr %20, i32 0, i32 6
  %22 = load float, ptr %21, align 4, !tbaa !16
  %23 = fmul float %19, %22
  %24 = call float @llvm.fmuladd.f32(float %9, float %12, float %23)
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.vcl::mat", ptr %25, i32 0, i32 3
  %27 = load float, ptr %26, align 4, !tbaa !17
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.vcl::mat", ptr %28, i32 0, i32 7
  %30 = load float, ptr %29, align 4, !tbaa !18
  %31 = fmul float %27, %30
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.vcl::mat", ptr %32, i32 0, i32 2
  %34 = load float, ptr %33, align 4, !tbaa !19
  %35 = call float @llvm.fmuladd.f32(float %31, float %34, float %24)
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.vcl::mat", ptr %36, i32 0, i32 6
  %38 = load float, ptr %37, align 4, !tbaa !16
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.vcl::mat", ptr %39, i32 0, i32 4
  %41 = load float, ptr %40, align 4, !tbaa !12
  %42 = fmul float %38, %41
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.vcl::mat", ptr %43, i32 0, i32 2
  %45 = load float, ptr %44, align 4, !tbaa !19
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.vcl::mat", ptr %46, i32 0, i32 7
  %48 = load float, ptr %47, align 4, !tbaa !18
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.vcl::mat", ptr %49, i32 0, i32 5
  %51 = load float, ptr %50, align 4, !tbaa !15
  %52 = fmul float %48, %51
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.vcl::mat", ptr %53, i32 0, i32 0
  %55 = load float, ptr %54, align 4, !tbaa !9
  %56 = fmul float %52, %55
  %57 = call float @llvm.fmuladd.f32(float %42, float %45, float %56)
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.vcl::mat", ptr %58, i32 0, i32 3
  %60 = load float, ptr %59, align 4, !tbaa !17
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.vcl::mat", ptr %61, i32 0, i32 1
  %63 = load float, ptr %62, align 4, !tbaa !14
  %64 = fmul float %60, %63
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.vcl::mat", ptr %65, i32 0, i32 8
  %67 = load float, ptr %66, align 4, !tbaa !13
  %68 = call float @llvm.fmuladd.f32(float %64, float %67, float %57)
  %69 = fsub float %35, %68
  ret float %69
}

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

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef float @_ZN3vcl3detERKNS_3matILm3ELm3EEE(ptr nocapture noundef nonnull readonly align 4 dereferenceable(36) %0) local_unnamed_addr #0 {
  %2 = load float, ptr %0, align 4, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load <4 x float>, ptr %3, align 4
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = load float, ptr %5, align 4, !tbaa !10
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load float, ptr %7, align 4, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %0, i64 20
  %10 = load float, ptr %9, align 4, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = load float, ptr %11, align 4, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = load float, ptr %13, align 4, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %0, i64 28
  %16 = load float, ptr %15, align 4, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load float, ptr %17, align 4, !tbaa !16
  %19 = shufflevector <4 x float> %4, <4 x float> poison, <2 x i32> zeroinitializer
  %20 = insertelement <2 x float> poison, float %12, i64 0
  %21 = insertelement <2 x float> %20, float %2, i64 1
  %22 = fmul <2 x float> %19, %21
  %23 = insertelement <2 x float> poison, float %10, i64 0
  %24 = insertelement <2 x float> %23, float %8, i64 1
  %25 = insertelement <2 x float> poison, float %16, i64 0
  %26 = insertelement <2 x float> %25, float %10, i64 1
  %27 = fmul <2 x float> %24, %26
  %28 = insertelement <2 x float> poison, float %2, i64 0
  %29 = insertelement <2 x float> %28, float %12, i64 1
  %30 = fmul <2 x float> %27, %29
  %31 = insertelement <2 x float> poison, float %18, i64 0
  %32 = insertelement <2 x float> %31, float %6, i64 1
  %33 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %22, <2 x float> %32, <2 x float> %30)
  %34 = insertelement <2 x float> poison, float %8, i64 0
  %35 = insertelement <2 x float> %34, float %14, i64 1
  %36 = insertelement <2 x float> poison, float %14, i64 0
  %37 = insertelement <2 x float> %36, float %16, i64 1
  %38 = fmul <2 x float> %35, %37
  %39 = insertelement <2 x float> poison, float %6, i64 0
  %40 = insertelement <2 x float> %39, float %18, i64 1
  %41 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %38, <2 x float> %40, <2 x float> %33)
  %shift = shufflevector <2 x float> %41, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %42 = fsub <2 x float> %shift, %41
  %43 = extractelement <2 x float> %42, i64 0
  ret float %43
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 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, !7, i64 0}
!6 = !{!"_ZTSN3vcl3matILm3ELm3EEE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 32}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 20}
!13 = !{!6, !7, i64 24}
!14 = !{!6, !7, i64 12}
!15 = !{!6, !7, i64 28}
!16 = !{!6, !7, i64 8}


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