; LLVM IR from FedericaPaoli1/stm32-speech-recognition-and-traduction :: Drivers/CMSIS/DSP/Source/ComplexMathFunctions (arm_cmplx_dot_prod_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_cmplx_dot_prod_f32(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store float 0.000000e+00, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store float 0.000000e+00, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %18 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %18, ptr %11, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %22, %5
  %20 = load i32, ptr %11, align 4, !tbaa !9
  %21 = icmp ugt i32 %20, 0
  br i1 %21, label %22, label %54

22:                                               ; preds = %19
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds float, ptr %23, i32 1
  store ptr %24, ptr %6, align 8, !tbaa !5
  %25 = load float, ptr %23, align 4, !tbaa !11
  store float %25, ptr %14, align 4, !tbaa !11
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds float, ptr %26, i32 1
  store ptr %27, ptr %6, align 8, !tbaa !5
  %28 = load float, ptr %26, align 4, !tbaa !11
  store float %28, ptr %15, align 4, !tbaa !11
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds float, ptr %29, i32 1
  store ptr %30, ptr %7, align 8, !tbaa !5
  %31 = load float, ptr %29, align 4, !tbaa !11
  store float %31, ptr %16, align 4, !tbaa !11
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds float, ptr %32, i32 1
  store ptr %33, ptr %7, align 8, !tbaa !5
  %34 = load float, ptr %32, align 4, !tbaa !11
  store float %34, ptr %17, align 4, !tbaa !11
  %35 = load float, ptr %14, align 4, !tbaa !11
  %36 = load float, ptr %16, align 4, !tbaa !11
  %37 = load float, ptr %12, align 4, !tbaa !11
  %38 = call float @llvm.fmuladd.f32(float %35, float %36, float %37)
  store float %38, ptr %12, align 4, !tbaa !11
  %39 = load float, ptr %14, align 4, !tbaa !11
  %40 = load float, ptr %17, align 4, !tbaa !11
  %41 = load float, ptr %13, align 4, !tbaa !11
  %42 = call float @llvm.fmuladd.f32(float %39, float %40, float %41)
  store float %42, ptr %13, align 4, !tbaa !11
  %43 = load float, ptr %15, align 4, !tbaa !11
  %44 = load float, ptr %17, align 4, !tbaa !11
  %45 = load float, ptr %12, align 4, !tbaa !11
  %46 = fneg float %43
  %47 = call float @llvm.fmuladd.f32(float %46, float %44, float %45)
  store float %47, ptr %12, align 4, !tbaa !11
  %48 = load float, ptr %15, align 4, !tbaa !11
  %49 = load float, ptr %16, align 4, !tbaa !11
  %50 = load float, ptr %13, align 4, !tbaa !11
  %51 = call float @llvm.fmuladd.f32(float %48, float %49, float %50)
  store float %51, ptr %13, align 4, !tbaa !11
  %52 = load i32, ptr %11, align 4, !tbaa !9
  %53 = add i32 %52, -1
  store i32 %53, ptr %11, align 4, !tbaa !9
  br label %19, !llvm.loop !13

54:                                               ; preds = %19
  %55 = load float, ptr %12, align 4, !tbaa !11
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  store float %55, ptr %56, align 4, !tbaa !11
  %57 = load float, ptr %13, align 4, !tbaa !11
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  store float %57, ptr %58, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
}

; 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"}


; 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 @arm_cmplx_dot_prod_f32(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %.not26 = icmp eq i32 %2, 0
  br i1 %.not26, label %._crit_edge, label %.lr.ph.preheader

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

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load float, ptr %0, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load float, ptr %6, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load <2 x float>, ptr %1, align 4, !tbaa !5
  %12 = insertelement <2 x float> poison, float %7, i64 0
  %13 = shufflevector <2 x float> %12, <2 x float> poison, <2 x i32> zeroinitializer
  %14 = shufflevector <2 x float> %11, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %15 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %13, <2 x float> %14, <2 x float> zeroinitializer)
  %16 = fneg float %9
  %17 = insertelement <2 x float> poison, float %9, i64 0
  %18 = insertelement <2 x float> %17, float %16, i64 1
  %19 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %18, <2 x float> %11, <2 x float> %15)
  %20 = add nsw i32 %2, -1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader
  %.lcssa.unr = phi <2 x float> [ poison, %.lr.ph.preheader ], [ %19, %.lr.ph.prol ]
  %.031.unr = phi ptr [ %0, %.lr.ph.preheader ], [ %8, %.lr.ph.prol ]
  %.02230.unr = phi ptr [ %1, %.lr.ph.preheader ], [ %10, %.lr.ph.prol ]
  %.02329.unr = phi i32 [ %2, %.lr.ph.preheader ], [ %20, %.lr.ph.prol ]
  %.unr = phi <2 x float> [ zeroinitializer, %.lr.ph.preheader ], [ %19, %.lr.ph.prol ]
  %21 = icmp eq i32 %2, 1
  br i1 %21, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %.031 = phi ptr [ %39, %.lr.ph ], [ %.031.unr, %.lr.ph.prol.loopexit ]
  %.02230 = phi ptr [ %41, %.lr.ph ], [ %.02230.unr, %.lr.ph.prol.loopexit ]
  %.02329 = phi i32 [ %51, %.lr.ph ], [ %.02329.unr, %.lr.ph.prol.loopexit ]
  %22 = phi <2 x float> [ %50, %.lr.ph ], [ %.unr, %.lr.ph.prol.loopexit ]
  %23 = getelementptr inbounds i8, ptr %.031, i64 4
  %24 = load float, ptr %.031, align 4, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %.031, i64 8
  %26 = load float, ptr %23, align 4, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %.02230, i64 8
  %28 = load <2 x float>, ptr %.02230, align 4, !tbaa !5
  %29 = insertelement <2 x float> poison, float %24, i64 0
  %30 = shufflevector <2 x float> %29, <2 x float> poison, <2 x i32> zeroinitializer
  %31 = shufflevector <2 x float> %28, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %32 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %30, <2 x float> %31, <2 x float> %22)
  %33 = fneg float %26
  %34 = insertelement <2 x float> poison, float %26, i64 0
  %35 = insertelement <2 x float> %34, float %33, i64 1
  %36 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %35, <2 x float> %28, <2 x float> %32)
  %37 = getelementptr inbounds i8, ptr %.031, i64 12
  %38 = load float, ptr %25, align 4, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %.031, i64 16
  %40 = load float, ptr %37, align 4, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %.02230, i64 16
  %42 = load <2 x float>, ptr %27, align 4, !tbaa !5
  %43 = insertelement <2 x float> poison, float %38, i64 0
  %44 = shufflevector <2 x float> %43, <2 x float> poison, <2 x i32> zeroinitializer
  %45 = shufflevector <2 x float> %42, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %46 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %44, <2 x float> %45, <2 x float> %36)
  %47 = fneg float %40
  %48 = insertelement <2 x float> poison, float %40, i64 0
  %49 = insertelement <2 x float> %48, float %47, i64 1
  %50 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %49, <2 x float> %42, <2 x float> %46)
  %51 = add i32 %.02329, -2
  %.not.1 = icmp eq i32 %51, 0
  br i1 %.not.1, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %5
  %52 = phi <2 x float> [ zeroinitializer, %5 ], [ %.lcssa.unr, %.lr.ph.prol.loopexit ], [ %50, %.lr.ph ]
  %53 = extractelement <2 x float> %52, i64 1
  store float %53, ptr %3, align 4, !tbaa !5
  %54 = extractelement <2 x float> %52, i64 0
  store float %54, ptr %4, align 4, !tbaa !5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 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: GVNPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass