; LLVM IR from stonne-simulator/stonne :: pytorch-frontend/third_party/python-peachpy/examples/make (matmul-ref)

; 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: nounwind uwtable
define dso_local void @matmul_ref(ptr noalias noundef align 4 dereferenceable(64) %0, ptr noalias noundef align 4 dereferenceable(64) %1, ptr noalias noundef align 4 dereferenceable(64) %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca float, align 4
  %11 = alloca i64, align 8
  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 8, ptr %7) #3
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %12

12:                                               ; preds = %58, %3
  %13 = load i64, ptr %7, align 8, !tbaa !9
  %14 = icmp ult i64 %13, 4
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %61

16:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %54, %16
  %18 = load i64, ptr %9, align 8, !tbaa !9
  %19 = icmp ult i64 %18, 4
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %57

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store float 0.000000e+00, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %22

22:                                               ; preds = %43, %21
  %23 = load i64, ptr %11, align 8, !tbaa !9
  %24 = icmp ult i64 %23, 4
  br i1 %24, label %26, label %25

25:                                               ; preds = %22
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %46

26:                                               ; preds = %22
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load i64, ptr %7, align 8, !tbaa !9
  %29 = mul i64 %28, 4
  %30 = load i64, ptr %11, align 8, !tbaa !9
  %31 = add i64 %29, %30
  %32 = getelementptr inbounds float, ptr %27, i64 %31
  %33 = load float, ptr %32, align 4, !tbaa !11
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load i64, ptr %11, align 8, !tbaa !9
  %36 = mul i64 %35, 4
  %37 = load i64, ptr %9, align 8, !tbaa !9
  %38 = add i64 %36, %37
  %39 = getelementptr inbounds float, ptr %34, i64 %38
  %40 = load float, ptr %39, align 4, !tbaa !11
  %41 = load float, ptr %10, align 4, !tbaa !11
  %42 = call float @llvm.fmuladd.f32(float %33, float %40, float %41)
  store float %42, ptr %10, align 4, !tbaa !11
  br label %43

43:                                               ; preds = %26
  %44 = load i64, ptr %11, align 8, !tbaa !9
  %45 = add i64 %44, 1
  store i64 %45, ptr %11, align 8, !tbaa !9
  br label %22, !llvm.loop !13

46:                                               ; preds = %25
  %47 = load float, ptr %10, align 4, !tbaa !11
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load i64, ptr %7, align 8, !tbaa !9
  %50 = mul i64 %49, 4
  %51 = load i64, ptr %9, align 8, !tbaa !9
  %52 = add i64 %50, %51
  %53 = getelementptr inbounds float, ptr %48, i64 %52
  store float %47, ptr %53, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %54

54:                                               ; preds = %46
  %55 = load i64, ptr %9, align 8, !tbaa !9
  %56 = add i64 %55, 1
  store i64 %56, ptr %9, align 8, !tbaa !9
  br label %17, !llvm.loop !15

57:                                               ; preds = %20
  br label %58

58:                                               ; preds = %57
  %59 = load i64, ptr %7, align 8, !tbaa !9
  %60 = add i64 %59, 1
  store i64 %60, ptr %7, align 8, !tbaa !9
  br label %12, !llvm.loop !16

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

attributes #0 = { 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 willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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: readwrite) uwtable
define dso_local void @matmul_ref(ptr noalias nocapture noundef readonly align 4 dereferenceable(64) %0, ptr noalias nocapture noundef readonly align 4 dereferenceable(64) %1, ptr noalias nocapture noundef writeonly align 4 dereferenceable(64) %2) local_unnamed_addr #0 {
.preheader19:
  %3 = load <4 x float>, ptr %0, align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = load <4 x float>, ptr %4, align 4
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load <4 x float>, ptr %7, align 4
  %9 = getelementptr inbounds i8, ptr %1, i64 32
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load <4 x float>, ptr %10, align 4
  %12 = getelementptr inbounds i8, ptr %1, i64 48
  %13 = load <4 x float>, ptr %1, align 4, !tbaa !5
  %14 = shufflevector <4 x float> %3, <4 x float> poison, <4 x i32> zeroinitializer
  %15 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %14, <4 x float> %13, <4 x float> zeroinitializer)
  %16 = load <4 x float>, ptr %6, align 4, !tbaa !5
  %17 = shufflevector <4 x float> %5, <4 x float> poison, <4 x i32> zeroinitializer
  %18 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %17, <4 x float> %16, <4 x float> %15)
  %19 = load <4 x float>, ptr %9, align 4, !tbaa !5
  %20 = shufflevector <4 x float> %8, <4 x float> poison, <4 x i32> zeroinitializer
  %21 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %20, <4 x float> %19, <4 x float> %18)
  %22 = load <4 x float>, ptr %12, align 4, !tbaa !5
  %23 = shufflevector <4 x float> %11, <4 x float> poison, <4 x i32> zeroinitializer
  %24 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %23, <4 x float> %22, <4 x float> %21)
  store <4 x float> %24, ptr %2, align 4, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  %26 = load <4 x float>, ptr %25, align 4
  %27 = getelementptr inbounds i8, ptr %0, i64 20
  %28 = load <4 x float>, ptr %27, align 4
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  %30 = load <4 x float>, ptr %29, align 4
  %31 = getelementptr inbounds i8, ptr %0, i64 28
  %32 = load <4 x float>, ptr %31, align 4
  %33 = getelementptr inbounds i8, ptr %2, i64 16
  %34 = shufflevector <4 x float> %26, <4 x float> poison, <4 x i32> zeroinitializer
  %35 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %34, <4 x float> %13, <4 x float> zeroinitializer)
  %36 = shufflevector <4 x float> %28, <4 x float> poison, <4 x i32> zeroinitializer
  %37 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %36, <4 x float> %16, <4 x float> %35)
  %38 = shufflevector <4 x float> %30, <4 x float> poison, <4 x i32> zeroinitializer
  %39 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %38, <4 x float> %19, <4 x float> %37)
  %40 = shufflevector <4 x float> %32, <4 x float> poison, <4 x i32> zeroinitializer
  %41 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %40, <4 x float> %22, <4 x float> %39)
  store <4 x float> %41, ptr %33, align 4, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %0, i64 32
  %43 = load <4 x float>, ptr %42, align 4
  %44 = getelementptr inbounds i8, ptr %0, i64 36
  %45 = load <4 x float>, ptr %44, align 4
  %46 = getelementptr inbounds i8, ptr %0, i64 40
  %47 = load <4 x float>, ptr %46, align 4
  %48 = getelementptr inbounds i8, ptr %0, i64 44
  %49 = load <4 x float>, ptr %48, align 4
  %50 = getelementptr inbounds i8, ptr %2, i64 32
  %51 = shufflevector <4 x float> %43, <4 x float> poison, <4 x i32> zeroinitializer
  %52 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %51, <4 x float> %13, <4 x float> zeroinitializer)
  %53 = shufflevector <4 x float> %45, <4 x float> poison, <4 x i32> zeroinitializer
  %54 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %53, <4 x float> %16, <4 x float> %52)
  %55 = shufflevector <4 x float> %47, <4 x float> poison, <4 x i32> zeroinitializer
  %56 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %55, <4 x float> %19, <4 x float> %54)
  %57 = shufflevector <4 x float> %49, <4 x float> poison, <4 x i32> zeroinitializer
  %58 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %57, <4 x float> %22, <4 x float> %56)
  store <4 x float> %58, ptr %50, align 4, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %0, i64 48
  %60 = load <4 x float>, ptr %59, align 4
  %61 = getelementptr inbounds i8, ptr %0, i64 52
  %62 = load float, ptr %61, align 4, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %0, i64 56
  %64 = load float, ptr %63, align 4, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %0, i64 60
  %66 = load float, ptr %65, align 4, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %2, i64 48
  %68 = load <4 x float>, ptr %1, align 4, !tbaa !5
  %69 = shufflevector <4 x float> %60, <4 x float> poison, <4 x i32> zeroinitializer
  %70 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %69, <4 x float> %68, <4 x float> zeroinitializer)
  %71 = load <4 x float>, ptr %6, align 4, !tbaa !5
  %72 = insertelement <4 x float> poison, float %62, i64 0
  %73 = shufflevector <4 x float> %72, <4 x float> poison, <4 x i32> zeroinitializer
  %74 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %73, <4 x float> %71, <4 x float> %70)
  %75 = load <4 x float>, ptr %9, align 4, !tbaa !5
  %76 = insertelement <4 x float> poison, float %64, i64 0
  %77 = shufflevector <4 x float> %76, <4 x float> poison, <4 x i32> zeroinitializer
  %78 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %77, <4 x float> %75, <4 x float> %74)
  %79 = load <4 x float>, ptr %12, align 4, !tbaa !5
  %80 = insertelement <4 x float> poison, float %66, i64 0
  %81 = shufflevector <4 x float> %80, <4 x float> poison, <4 x i32> zeroinitializer
  %82 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %81, <4 x float> %79, <4 x float> %78)
  store <4 x float> %82, ptr %67, 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 = { 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: GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass