; LLVM IR from sh1l0h/ZINC :: src (mat2)

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !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"

; Function Attrs: inlinehint mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @zinc_mat2_mul(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = load float, ptr %0, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load float, ptr %5, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load float, ptr %7, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load float, ptr %10, align 4, !tbaa !5
  %12 = load <2 x float>, ptr %1, align 4, !tbaa !5
  %13 = shufflevector <2 x float> %12, <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
  %14 = load <2 x float>, ptr %9, align 4, !tbaa !5
  %15 = shufflevector <2 x float> %14, <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
  %16 = insertelement <4 x float> poison, float %6, i64 0
  %17 = insertelement <4 x float> %16, float %11, i64 1
  %18 = shufflevector <4 x float> %17, <4 x float> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
  %19 = fmul <4 x float> %18, %15
  %20 = insertelement <4 x float> poison, float %4, i64 0
  %21 = insertelement <4 x float> %20, float %8, i64 1
  %22 = shufflevector <4 x float> %21, <4 x float> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
  %23 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %22, <4 x float> %13, <4 x float> %19)
  store <4 x float> %23, ptr %2, align 4, !tbaa !5
  ret void
}

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

attributes #0 = { inlinehint mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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