; LLVM IR from stonne-simulator/stonne :: pytorch-frontend/third_party/NNPACK/src/scalar/blas/sdotxf.ll_nnp_sdotxf4 (scalar)

; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @nnp_sdotxf4__scalar(ptr noalias noundef align 4 dereferenceable(4) %0, ptr noalias noundef align 4 dereferenceable(16) %1, i64 noundef %2, ptr noalias noundef align 4 dereferenceable(16) %3, i64 noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca float, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i64 %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store float 0.000000e+00, ptr %14, align 4, !tbaa !11
  store float 0.000000e+00, ptr %13, align 4, !tbaa !11
  store float 0.000000e+00, ptr %12, align 4, !tbaa !11
  store float 0.000000e+00, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %20, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %21 = load ptr, ptr %15, align 8, !tbaa !5
  %22 = load i64, ptr %8, align 8, !tbaa !9
  %23 = getelementptr inbounds float, ptr %21, i64 %22
  store ptr %23, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %24 = load ptr, ptr %16, align 8, !tbaa !5
  %25 = load i64, ptr %8, align 8, !tbaa !9
  %26 = getelementptr inbounds float, ptr %24, i64 %25
  store ptr %26, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %27 = load ptr, ptr %17, align 8, !tbaa !5
  %28 = load i64, ptr %8, align 8, !tbaa !9
  %29 = getelementptr inbounds float, ptr %27, i64 %28
  store ptr %29, ptr %18, align 8, !tbaa !5
  br label %30

30:                                               ; preds = %34, %5
  %31 = load i64, ptr %10, align 8, !tbaa !9
  %32 = add i64 %31, -1
  store i64 %32, ptr %10, align 8, !tbaa !9
  %33 = icmp ne i64 %31, 0
  br i1 %33, label %34, label %62

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds float, ptr %35, i32 1
  store ptr %36, ptr %6, align 8, !tbaa !5
  %37 = load float, ptr %35, align 4, !tbaa !11
  store float %37, ptr %19, align 4, !tbaa !11
  %38 = load float, ptr %19, align 4, !tbaa !11
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  %40 = getelementptr inbounds float, ptr %39, i32 1
  store ptr %40, ptr %15, align 8, !tbaa !5
  %41 = load float, ptr %39, align 4, !tbaa !11
  %42 = load float, ptr %11, align 4, !tbaa !11
  %43 = call float @llvm.fmuladd.f32(float %38, float %41, float %42)
  store float %43, ptr %11, align 4, !tbaa !11
  %44 = load float, ptr %19, align 4, !tbaa !11
  %45 = load ptr, ptr %16, align 8, !tbaa !5
  %46 = getelementptr inbounds float, ptr %45, i32 1
  store ptr %46, ptr %16, align 8, !tbaa !5
  %47 = load float, ptr %45, align 4, !tbaa !11
  %48 = load float, ptr %12, align 4, !tbaa !11
  %49 = call float @llvm.fmuladd.f32(float %44, float %47, float %48)
  store float %49, ptr %12, align 4, !tbaa !11
  %50 = load float, ptr %19, align 4, !tbaa !11
  %51 = load ptr, ptr %17, align 8, !tbaa !5
  %52 = getelementptr inbounds float, ptr %51, i32 1
  store ptr %52, ptr %17, align 8, !tbaa !5
  %53 = load float, ptr %51, align 4, !tbaa !11
  %54 = load float, ptr %13, align 4, !tbaa !11
  %55 = call float @llvm.fmuladd.f32(float %50, float %53, float %54)
  store float %55, ptr %13, align 4, !tbaa !11
  %56 = load float, ptr %19, align 4, !tbaa !11
  %57 = load ptr, ptr %18, align 8, !tbaa !5
  %58 = getelementptr inbounds float, ptr %57, i32 1
  store ptr %58, ptr %18, align 8, !tbaa !5
  %59 = load float, ptr %57, align 4, !tbaa !11
  %60 = load float, ptr %14, align 4, !tbaa !11
  %61 = call float @llvm.fmuladd.f32(float %56, float %59, float %60)
  store float %61, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  br label %30, !llvm.loop !13

62:                                               ; preds = %30
  %63 = load float, ptr %11, align 4, !tbaa !11
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = getelementptr inbounds float, ptr %64, i64 0
  store float %63, ptr %65, align 4, !tbaa !11
  %66 = load float, ptr %12, align 4, !tbaa !11
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = getelementptr inbounds float, ptr %67, i64 1
  store float %66, ptr %68, align 4, !tbaa !11
  %69 = load float, ptr %13, align 4, !tbaa !11
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds float, ptr %70, i64 2
  store float %69, ptr %71, align 4, !tbaa !11
  %72 = load float, ptr %14, align 4, !tbaa !11
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = getelementptr inbounds float, ptr %73, i64 3
  store float %72, ptr %74, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  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
  ret void
}

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


; 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: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @nnp_sdotxf4__scalar(ptr noalias nocapture noundef readonly align 4 dereferenceable(4) %0, ptr noalias nocapture noundef readonly align 4 dereferenceable(16) %1, i64 noundef %2, ptr noalias nocapture noundef writeonly align 4 dereferenceable(16) %3, i64 noundef %4) local_unnamed_addr #0 {
  %.not37 = icmp eq i64 %4, 0
  br i1 %.not37, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %6 = getelementptr inbounds float, ptr %1, i64 %2
  %7 = getelementptr inbounds float, ptr %6, i64 %2
  %8 = getelementptr inbounds float, ptr %7, i64 %2
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.047 = phi ptr [ %11, %.lr.ph ], [ %0, %.lr.ph.preheader ]
  %.02846 = phi ptr [ %19, %.lr.ph ], [ %8, %.lr.ph.preheader ]
  %.02945 = phi ptr [ %17, %.lr.ph ], [ %7, %.lr.ph.preheader ]
  %.03044 = phi ptr [ %15, %.lr.ph ], [ %6, %.lr.ph.preheader ]
  %.03143 = phi ptr [ %13, %.lr.ph ], [ %1, %.lr.ph.preheader ]
  %.03638 = phi i64 [ %10, %.lr.ph ], [ %4, %.lr.ph.preheader ]
  %9 = phi <4 x float> [ %27, %.lr.ph ], [ zeroinitializer, %.lr.ph.preheader ]
  %10 = add i64 %.03638, -1
  %11 = getelementptr inbounds i8, ptr %.047, i64 4
  %12 = load float, ptr %.047, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %.03143, i64 4
  %14 = load float, ptr %.03143, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %.03044, i64 4
  %16 = load float, ptr %.03044, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %.02945, i64 4
  %18 = load float, ptr %.02945, align 4, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %.02846, i64 4
  %20 = load float, ptr %.02846, align 4, !tbaa !5
  %21 = insertelement <4 x float> poison, float %12, i64 0
  %22 = shufflevector <4 x float> %21, <4 x float> poison, <4 x i32> zeroinitializer
  %23 = insertelement <4 x float> poison, float %14, i64 0
  %24 = insertelement <4 x float> %23, float %16, i64 1
  %25 = insertelement <4 x float> %24, float %18, i64 2
  %26 = insertelement <4 x float> %25, float %20, i64 3
  %27 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %22, <4 x float> %26, <4 x float> %9)
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %5
  %28 = phi <4 x float> [ zeroinitializer, %5 ], [ %27, %.lr.ph ]
  store <4 x float> %28, ptr %3, 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 = { nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass