; LLVM IR from FedericaPaoli1/stm32-speech-recognition-and-traduction :: Drivers/CMSIS/DSP/Source/FilteringFunctions (arm_conv_f32)

; 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 @arm_conv_f32(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %16, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %17, ptr %12, align 8, !tbaa !5
  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 i32 0, ptr %14, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %65, %5
  %19 = load i32, ptr %14, align 4, !tbaa !9
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = add i32 %20, %21
  %23 = sub i32 %22, 1
  %24 = icmp ult i32 %19, %23
  br i1 %24, label %25, label %68

25:                                               ; preds = %18
  store float 0.000000e+00, ptr %13, align 4, !tbaa !11
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %56, %25
  %27 = load i32, ptr %15, align 4, !tbaa !9
  %28 = load i32, ptr %14, align 4, !tbaa !9
  %29 = icmp ule i32 %27, %28
  br i1 %29, label %30, label %59

30:                                               ; preds = %26
  %31 = load i32, ptr %14, align 4, !tbaa !9
  %32 = load i32, ptr %15, align 4, !tbaa !9
  %33 = sub i32 %31, %32
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = icmp ult i32 %33, %34
  br i1 %35, label %36, label %55

36:                                               ; preds = %30
  %37 = load i32, ptr %15, align 4, !tbaa !9
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = icmp ult i32 %37, %38
  br i1 %39, label %40, label %55

40:                                               ; preds = %36
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = load i32, ptr %15, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds float, ptr %41, i64 %43
  %45 = load float, ptr %44, align 4, !tbaa !11
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = load i32, ptr %15, align 4, !tbaa !9
  %49 = sub i32 %47, %48
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds float, ptr %46, i64 %50
  %52 = load float, ptr %51, align 4, !tbaa !11
  %53 = load float, ptr %13, align 4, !tbaa !11
  %54 = call float @llvm.fmuladd.f32(float %45, float %52, float %53)
  store float %54, ptr %13, align 4, !tbaa !11
  br label %55

55:                                               ; preds = %40, %36, %30
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %15, align 4, !tbaa !9
  %58 = add i32 %57, 1
  store i32 %58, ptr %15, align 4, !tbaa !9
  br label %26, !llvm.loop !13

59:                                               ; preds = %26
  %60 = load float, ptr %13, align 4, !tbaa !11
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = load i32, ptr %14, align 4, !tbaa !9
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds float, ptr %61, i64 %63
  store float %60, ptr %64, align 4, !tbaa !11
  br label %65

65:                                               ; preds = %59
  %66 = load i32, ptr %14, align 4, !tbaa !9
  %67 = add i32 %66, 1
  store i32 %67, ptr %14, align 4, !tbaa !9
  br label %18, !llvm.loop !15

68:                                               ; preds = %18
  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 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"int", !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}


; 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(argmem: readwrite) uwtable
define dso_local void @arm_conv_f32(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %6 = add i32 %1, -1
  %7 = add i32 %6, %3
  %.not28 = icmp eq i32 %7, 0
  br i1 %.not28, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %5
  %8 = zext i32 %1 to i64
  %wide.trip.count39 = zext i32 %7 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.epilog-lcssa
  %indvars.iv34 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next35, %.epilog-lcssa ]
  %indvars.iv32 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next33, %.epilog-lcssa ]
  %9 = trunc nuw i64 %indvars.iv34 to i32
  %xtraiter = and i64 %indvars.iv32, 1
  %10 = icmp eq i64 %indvars.iv34, 0
  br i1 %10, label %.unr-lcssa, label %.preheader.new

.preheader.new:                                   ; preds = %.preheader
  %unroll_iter = and i64 %indvars.iv32, 9223372036854775806
  br label %11

11:                                               ; preds = %35, %.preheader.new
  %indvars.iv = phi i64 [ 0, %.preheader.new ], [ %indvars.iv.next.1, %35 ]
  %.02325 = phi float [ 0.000000e+00, %.preheader.new ], [ %.1.1, %35 ]
  %niter = phi i64 [ 0, %.preheader.new ], [ %niter.next.1, %35 ]
  %12 = trunc nuw i64 %indvars.iv to i32
  %13 = sub i32 %9, %12
  %14 = icmp ult i32 %13, %3
  %15 = icmp ult i64 %indvars.iv, %8
  %or.cond = and i1 %15, %14
  br i1 %or.cond, label %16, label %23

16:                                               ; preds = %11
  %17 = getelementptr inbounds float, ptr %0, i64 %indvars.iv
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = zext i32 %13 to i64
  %20 = getelementptr inbounds float, ptr %2, i64 %19
  %21 = load float, ptr %20, align 4, !tbaa !5
  %22 = tail call float @llvm.fmuladd.f32(float %18, float %21, float %.02325)
  br label %23

23:                                               ; preds = %11, %16
  %.1 = phi float [ %22, %16 ], [ %.02325, %11 ]
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %24 = trunc nuw i64 %indvars.iv.next to i32
  %25 = sub i32 %9, %24
  %26 = icmp ult i32 %25, %3
  %27 = icmp ult i64 %indvars.iv.next, %8
  %or.cond.1 = and i1 %27, %26
  br i1 %or.cond.1, label %28, label %35

28:                                               ; preds = %23
  %29 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = zext i32 %25 to i64
  %32 = getelementptr inbounds float, ptr %2, i64 %31
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = tail call float @llvm.fmuladd.f32(float %30, float %33, float %.1)
  br label %35

35:                                               ; preds = %28, %23
  %.1.1 = phi float [ %34, %28 ], [ %.1, %23 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.unr-lcssa, label %11, !llvm.loop !9

.unr-lcssa:                                       ; preds = %35, %.preheader
  %.1.lcssa.ph = phi float [ poison, %.preheader ], [ %.1.1, %35 ]
  %indvars.iv.unr = phi i64 [ 0, %.preheader ], [ %indvars.iv.next.1, %35 ]
  %.02325.unr = phi float [ 0.000000e+00, %.preheader ], [ %.1.1, %35 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.epil.preheader

.epil.preheader:                                  ; preds = %.unr-lcssa
  %36 = trunc nuw i64 %indvars.iv.unr to i32
  %37 = sub i32 %9, %36
  %38 = icmp ult i32 %37, %3
  %39 = icmp ult i64 %indvars.iv.unr, %8
  %or.cond.epil = and i1 %39, %38
  br i1 %or.cond.epil, label %40, label %.epilog-lcssa

40:                                               ; preds = %.epil.preheader
  %41 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.unr
  %42 = load float, ptr %41, align 4, !tbaa !5
  %43 = zext i32 %37 to i64
  %44 = getelementptr inbounds float, ptr %2, i64 %43
  %45 = load float, ptr %44, align 4, !tbaa !5
  %46 = tail call float @llvm.fmuladd.f32(float %42, float %45, float %.02325.unr)
  br label %.epilog-lcssa

.epilog-lcssa:                                    ; preds = %.epil.preheader, %40, %.unr-lcssa
  %.1.lcssa = phi float [ %.1.lcssa.ph, %.unr-lcssa ], [ %46, %40 ], [ %.02325.unr, %.epil.preheader ]
  %47 = getelementptr inbounds float, ptr %4, i64 %indvars.iv34
  store float %.1.lcssa, ptr %47, align 4, !tbaa !5
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
  %exitcond40.not = icmp eq i64 %indvars.iv.next35, %wide.trip.count39
  br i1 %exitcond40.not, label %._crit_edge, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %.epilog-lcssa, %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(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 = { 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.mustprogress"}
!11 = distinct !{!11, !10}


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