; LLVM IR from stonne-simulator/stonne :: pytorch-frontend/third_party/NNPACK/src/scalar/blas/sdotxf.ll_nnp_sdotxf5 (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_sdotxf5__scalar(ptr noalias noundef align 4 dereferenceable(4) %0, ptr noalias noundef align 4 dereferenceable(20) %1, i64 noundef %2, ptr noalias noundef align 4 dereferenceable(20) %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 float, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store float 0.000000e+00, ptr %15, align 4, !tbaa !11
  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 %16) #3
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %22, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %23 = load ptr, ptr %16, align 8, !tbaa !5
  %24 = load i64, ptr %8, align 8, !tbaa !9
  %25 = getelementptr inbounds float, ptr %23, i64 %24
  store ptr %25, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %26 = load ptr, ptr %17, align 8, !tbaa !5
  %27 = load i64, ptr %8, align 8, !tbaa !9
  %28 = getelementptr inbounds float, ptr %26, i64 %27
  store ptr %28, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %29 = load ptr, ptr %18, align 8, !tbaa !5
  %30 = load i64, ptr %8, align 8, !tbaa !9
  %31 = getelementptr inbounds float, ptr %29, i64 %30
  store ptr %31, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %32 = load ptr, ptr %19, align 8, !tbaa !5
  %33 = load i64, ptr %8, align 8, !tbaa !9
  %34 = getelementptr inbounds float, ptr %32, i64 %33
  store ptr %34, ptr %20, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %39, %5
  %36 = load i64, ptr %10, align 8, !tbaa !9
  %37 = add i64 %36, -1
  store i64 %37, ptr %10, align 8, !tbaa !9
  %38 = icmp ne i64 %36, 0
  br i1 %38, label %39, label %73

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

73:                                               ; preds = %35
  %74 = load float, ptr %11, align 4, !tbaa !11
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds float, ptr %75, i64 0
  store float %74, ptr %76, align 4, !tbaa !11
  %77 = load float, ptr %12, align 4, !tbaa !11
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds float, ptr %78, i64 1
  store float %77, ptr %79, align 4, !tbaa !11
  %80 = load float, ptr %13, align 4, !tbaa !11
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds float, ptr %81, i64 2
  store float %80, ptr %82, align 4, !tbaa !11
  %83 = load float, ptr %14, align 4, !tbaa !11
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = getelementptr inbounds float, ptr %84, i64 3
  store float %83, ptr %85, align 4, !tbaa !11
  %86 = load float, ptr %15, align 4, !tbaa !11
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = getelementptr inbounds float, ptr %87, i64 4
  store float %86, ptr %88, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  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 4, 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @nnp_sdotxf5__scalar(ptr noalias nocapture noundef readonly align 4 dereferenceable(4) %0, ptr noalias nocapture noundef readonly align 4 dereferenceable(20) %1, i64 noundef %2, ptr noalias nocapture noundef writeonly align 4 dereferenceable(20) %3, i64 noundef %4) local_unnamed_addr #1 {
  %.not46 = icmp eq i64 %4, 0
  br i1 %.not46, 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
  %9 = getelementptr inbounds float, ptr %8, i64 %2
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.058 = phi ptr [ %12, %.lr.ph ], [ %0, %.lr.ph.preheader ]
  %.03557 = phi ptr [ %29, %.lr.ph ], [ %9, %.lr.ph.preheader ]
  %.03656 = phi ptr [ %20, %.lr.ph ], [ %8, %.lr.ph.preheader ]
  %.03755 = phi ptr [ %18, %.lr.ph ], [ %7, %.lr.ph.preheader ]
  %.03854 = phi ptr [ %16, %.lr.ph ], [ %6, %.lr.ph.preheader ]
  %.03953 = phi ptr [ %14, %.lr.ph ], [ %1, %.lr.ph.preheader ]
  %.04052 = phi float [ %31, %.lr.ph ], [ 0.000000e+00, %.lr.ph.preheader ]
  %.04547 = phi i64 [ %11, %.lr.ph ], [ %4, %.lr.ph.preheader ]
  %10 = phi <4 x float> [ %28, %.lr.ph ], [ zeroinitializer, %.lr.ph.preheader ]
  %11 = add i64 %.04547, -1
  %12 = getelementptr inbounds i8, ptr %.058, i64 4
  %13 = load float, ptr %.058, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %.03953, i64 4
  %15 = load float, ptr %.03953, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %.03854, i64 4
  %17 = load float, ptr %.03854, align 4, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %.03755, i64 4
  %19 = load float, ptr %.03755, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %.03656, i64 4
  %21 = load float, ptr %.03656, align 4, !tbaa !5
  %22 = insertelement <4 x float> poison, float %13, i64 0
  %23 = shufflevector <4 x float> %22, <4 x float> poison, <4 x i32> zeroinitializer
  %24 = insertelement <4 x float> poison, float %15, i64 0
  %25 = insertelement <4 x float> %24, float %17, i64 1
  %26 = insertelement <4 x float> %25, float %19, i64 2
  %27 = insertelement <4 x float> %26, float %21, i64 3
  %28 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %23, <4 x float> %27, <4 x float> %10)
  %29 = getelementptr inbounds i8, ptr %.03557, i64 4
  %30 = load float, ptr %.03557, align 4, !tbaa !5
  %31 = tail call float @llvm.fmuladd.f32(float %13, float %30, float %.04052)
  %.not = icmp eq i64 %11, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %5
  %.040.lcssa = phi float [ 0.000000e+00, %5 ], [ %31, %.lr.ph ]
  %32 = phi <4 x float> [ zeroinitializer, %5 ], [ %28, %.lr.ph ]
  store <4 x float> %32, ptr %3, align 4, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %3, i64 16
  store float %.040.lcssa, ptr %33, 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>) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { 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,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass