; LLVM IR from stonne-simulator/stonne :: pytorch-frontend/third_party/NNPACK/src/scalar/blas/sdotxf.ll_nnp_sdotxf1 (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: nounwind uwtable
define dso_local void @nnp_sdotxf1__scalar(ptr noalias noundef align 4 dereferenceable(4) %0, ptr noalias noundef align 4 dereferenceable(4) %1, i64 noundef %2, ptr noalias noundef align 4 dereferenceable(4) %3, i64 noundef %4) #0 {
  %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 ptr, align 8
  %13 = 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
  store float 0.000000e+00, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %14, ptr %12, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %19, %5
  %16 = load i64, ptr %10, align 8, !tbaa !9
  %17 = add i64 %16, -1
  store i64 %17, ptr %10, align 8, !tbaa !9
  %18 = icmp ne i64 %16, 0
  br i1 %18, label %19, label %29

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds float, ptr %20, i32 1
  store ptr %21, ptr %6, align 8, !tbaa !5
  %22 = load float, ptr %20, align 4, !tbaa !11
  store float %22, ptr %13, align 4, !tbaa !11
  %23 = load float, ptr %13, align 4, !tbaa !11
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = getelementptr inbounds float, ptr %24, i32 1
  store ptr %25, ptr %12, align 8, !tbaa !5
  %26 = load float, ptr %24, align 4, !tbaa !11
  %27 = load float, ptr %11, align 4, !tbaa !11
  %28 = call float @llvm.fmuladd.f32(float %23, float %26, float %27)
  store float %28, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %15, !llvm.loop !13

29:                                               ; preds = %15
  %30 = load float, ptr %11, align 4, !tbaa !11
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds float, ptr %31, i64 0
  store float %30, ptr %32, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  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"}


; 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_sdotxf1__scalar(ptr noalias nocapture noundef readonly align 4 dereferenceable(4) %0, ptr noalias nocapture noundef readonly align 4 dereferenceable(4) %1, i64 noundef %2, ptr noalias nocapture noundef writeonly align 4 dereferenceable(4) %3, i64 noundef %4) local_unnamed_addr #0 {
  %.not10 = icmp eq i64 %4, 0
  br i1 %.not10, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %xtraiter = and i64 %4, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader, %.lr.ph.prol
  %.014.prol = phi ptr [ %7, %.lr.ph.prol ], [ %0, %.lr.ph.preheader ]
  %.0713.prol = phi ptr [ %9, %.lr.ph.prol ], [ %1, %.lr.ph.preheader ]
  %.0812.prol = phi float [ %11, %.lr.ph.prol ], [ 0.000000e+00, %.lr.ph.preheader ]
  %.0911.prol = phi i64 [ %6, %.lr.ph.prol ], [ %4, %.lr.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph.prol ], [ 0, %.lr.ph.preheader ]
  %6 = add i64 %.0911.prol, -1
  %7 = getelementptr inbounds i8, ptr %.014.prol, i64 4
  %8 = load float, ptr %.014.prol, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %.0713.prol, i64 4
  %10 = load float, ptr %.0713.prol, align 4, !tbaa !5
  %11 = tail call float @llvm.fmuladd.f32(float %8, float %10, float %.0812.prol)
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol, !llvm.loop !9

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader
  %.lcssa.unr = phi float [ poison, %.lr.ph.preheader ], [ %11, %.lr.ph.prol ]
  %.014.unr = phi ptr [ %0, %.lr.ph.preheader ], [ %7, %.lr.ph.prol ]
  %.0713.unr = phi ptr [ %1, %.lr.ph.preheader ], [ %9, %.lr.ph.prol ]
  %.0812.unr = phi float [ 0.000000e+00, %.lr.ph.preheader ], [ %11, %.lr.ph.prol ]
  %.0911.unr = phi i64 [ %4, %.lr.ph.preheader ], [ %6, %.lr.ph.prol ]
  %12 = icmp ult i64 %4, 4
  br i1 %12, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %.014 = phi ptr [ %29, %.lr.ph ], [ %.014.unr, %.lr.ph.prol.loopexit ]
  %.0713 = phi ptr [ %31, %.lr.ph ], [ %.0713.unr, %.lr.ph.prol.loopexit ]
  %.0812 = phi float [ %33, %.lr.ph ], [ %.0812.unr, %.lr.ph.prol.loopexit ]
  %.0911 = phi i64 [ %28, %.lr.ph ], [ %.0911.unr, %.lr.ph.prol.loopexit ]
  %13 = getelementptr inbounds i8, ptr %.014, i64 4
  %14 = load float, ptr %.014, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %.0713, i64 4
  %16 = load float, ptr %.0713, align 4, !tbaa !5
  %17 = tail call float @llvm.fmuladd.f32(float %14, float %16, float %.0812)
  %18 = getelementptr inbounds i8, ptr %.014, i64 8
  %19 = load float, ptr %13, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %.0713, i64 8
  %21 = load float, ptr %15, align 4, !tbaa !5
  %22 = tail call float @llvm.fmuladd.f32(float %19, float %21, float %17)
  %23 = getelementptr inbounds i8, ptr %.014, i64 12
  %24 = load float, ptr %18, align 4, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %.0713, i64 12
  %26 = load float, ptr %20, align 4, !tbaa !5
  %27 = tail call float @llvm.fmuladd.f32(float %24, float %26, float %22)
  %28 = add i64 %.0911, -4
  %29 = getelementptr inbounds i8, ptr %.014, i64 16
  %30 = load float, ptr %23, align 4, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %.0713, i64 16
  %32 = load float, ptr %25, align 4, !tbaa !5
  %33 = tail call float @llvm.fmuladd.f32(float %30, float %32, float %27)
  %.not.3 = icmp eq i64 %28, 0
  br i1 %.not.3, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %5
  %.08.lcssa = phi float [ 0.000000e+00, %5 ], [ %.lcssa.unr, %.lr.ph.prol.loopexit ], [ %33, %.lr.ph ]
  store float %.08.lcssa, ptr %3, align 4, !tbaa !5
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, 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 = { mustprogress 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.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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