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

15:                                               ; preds = %18, %4
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = icmp ugt i32 %16, 0
  br i1 %17, label %18, label %50

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

50:                                               ; preds = %15
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #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(readwrite, inaccessiblemem: none) uwtable
define dso_local void @arm_cmplx_mult_cmplx_f32(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef writeonly %2, i32 noundef %3) local_unnamed_addr #0 {
  %.not19 = icmp eq i32 %3, 0
  br i1 %.not19, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %4
  %5 = zext i32 %3 to i64
  %min.iters.check = icmp ult i32 %3, 8
  br i1 %min.iters.check, label %.lr.ph.preheader43, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %6 = add i32 %3, -1
  %7 = zext i32 %6 to i64
  %8 = shl nuw nsw i64 %7, 3
  %9 = add nuw nsw i64 %8, 8
  %scevgep = getelementptr i8, ptr %2, i64 %9
  %scevgep24 = getelementptr i8, ptr %0, i64 %9
  %scevgep25 = getelementptr i8, ptr %1, i64 %9
  %bound0 = icmp ugt ptr %scevgep24, %2
  %bound1 = icmp ugt ptr %scevgep, %0
  %found.conflict = and i1 %bound0, %bound1
  %bound026 = icmp ugt ptr %scevgep25, %2
  %bound127 = icmp ugt ptr %scevgep, %1
  %found.conflict28 = and i1 %bound026, %bound127
  %conflict.rdx = or i1 %found.conflict, %found.conflict28
  br i1 %conflict.rdx, label %.lr.ph.preheader43, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %5, 4294967292
  %10 = shl nuw nsw i64 %n.vec, 3
  %ind.end = getelementptr i8, ptr %0, i64 %10
  %11 = shl nuw nsw i64 %n.vec, 3
  %ind.end29 = getelementptr i8, ptr %1, i64 %11
  %12 = shl nuw nsw i64 %n.vec, 3
  %ind.end31 = getelementptr i8, ptr %2, i64 %12
  %.cast = trunc nuw i64 %n.vec to i32
  %ind.end33 = sub i32 %3, %.cast
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = shl i64 %index, 3
  %next.gep = getelementptr i8, ptr %0, i64 %offset.idx
  %offset.idx35 = shl i64 %index, 3
  %next.gep36 = getelementptr i8, ptr %1, i64 %offset.idx35
  %offset.idx37 = shl i64 %index, 3
  %next.gep38 = getelementptr i8, ptr %2, i64 %offset.idx37
  %wide.vec = load <8 x float>, ptr %next.gep, align 4, !tbaa !5
  %strided.vec = shufflevector <8 x float> %wide.vec, <8 x float> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec39 = shufflevector <8 x float> %wide.vec, <8 x float> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %wide.vec40 = load <8 x float>, ptr %next.gep36, align 4, !tbaa !5
  %strided.vec41 = shufflevector <8 x float> %wide.vec40, <8 x float> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec42 = shufflevector <8 x float> %wide.vec40, <8 x float> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %13 = fneg <4 x float> %strided.vec39
  %14 = fmul <4 x float> %strided.vec42, %13
  %15 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %strided.vec, <4 x float> %strided.vec41, <4 x float> %14)
  %16 = fmul <4 x float> %strided.vec39, %strided.vec41
  %17 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %strided.vec, <4 x float> %strided.vec42, <4 x float> %16)
  %interleaved.vec = shufflevector <4 x float> %15, <4 x float> %17, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
  store <8 x float> %interleaved.vec, ptr %next.gep38, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %5
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader43

.lr.ph.preheader43:                               ; preds = %middle.block, %vector.memcheck, %.lr.ph.preheader
  %.023.ph = phi ptr [ %0, %vector.memcheck ], [ %0, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.01622.ph = phi ptr [ %1, %vector.memcheck ], [ %1, %.lr.ph.preheader ], [ %ind.end29, %middle.block ]
  %.01721.ph = phi ptr [ %2, %vector.memcheck ], [ %2, %.lr.ph.preheader ], [ %ind.end31, %middle.block ]
  %.01820.ph = phi i32 [ %3, %vector.memcheck ], [ %3, %.lr.ph.preheader ], [ %ind.end33, %middle.block ]
  %xtraiter = and i32 %.01820.ph, 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.preheader43
  %19 = getelementptr inbounds i8, ptr %.023.ph, i64 4
  %20 = load float, ptr %.023.ph, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %.023.ph, i64 8
  %22 = load float, ptr %19, align 4, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %.01622.ph, i64 8
  %24 = fneg float %22
  %25 = getelementptr inbounds i8, ptr %.01721.ph, i64 8
  %26 = load <2 x float>, ptr %.01622.ph, align 4, !tbaa !5
  %27 = insertelement <2 x float> poison, float %22, i64 0
  %28 = insertelement <2 x float> %27, float %24, i64 1
  %29 = fmul <2 x float> %26, %28
  %30 = shufflevector <2 x float> %29, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %31 = insertelement <2 x float> poison, float %20, i64 0
  %32 = shufflevector <2 x float> %31, <2 x float> poison, <2 x i32> zeroinitializer
  %33 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %32, <2 x float> %26, <2 x float> %30)
  store <2 x float> %33, ptr %.01721.ph, align 4, !tbaa !5
  %34 = add nsw i32 %.01820.ph, -1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader43
  %.023.unr = phi ptr [ %.023.ph, %.lr.ph.preheader43 ], [ %21, %.lr.ph.prol ]
  %.01622.unr = phi ptr [ %.01622.ph, %.lr.ph.preheader43 ], [ %23, %.lr.ph.prol ]
  %.01721.unr = phi ptr [ %.01721.ph, %.lr.ph.preheader43 ], [ %25, %.lr.ph.prol ]
  %.01820.unr = phi i32 [ %.01820.ph, %.lr.ph.preheader43 ], [ %34, %.lr.ph.prol ]
  %35 = icmp eq i32 %.01820.ph, 1
  br i1 %35, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %.023 = phi ptr [ %53, %.lr.ph ], [ %.023.unr, %.lr.ph.prol.loopexit ]
  %.01622 = phi ptr [ %55, %.lr.ph ], [ %.01622.unr, %.lr.ph.prol.loopexit ]
  %.01721 = phi ptr [ %57, %.lr.ph ], [ %.01721.unr, %.lr.ph.prol.loopexit ]
  %.01820 = phi i32 [ %66, %.lr.ph ], [ %.01820.unr, %.lr.ph.prol.loopexit ]
  %36 = getelementptr inbounds i8, ptr %.023, i64 4
  %37 = load float, ptr %.023, align 4, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %.023, i64 8
  %39 = load float, ptr %36, align 4, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %.01622, i64 8
  %41 = fneg float %39
  %42 = getelementptr inbounds i8, ptr %.01721, i64 8
  %43 = load <2 x float>, ptr %.01622, align 4, !tbaa !5
  %44 = insertelement <2 x float> poison, float %39, i64 0
  %45 = insertelement <2 x float> %44, float %41, i64 1
  %46 = fmul <2 x float> %43, %45
  %47 = shufflevector <2 x float> %46, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %48 = insertelement <2 x float> poison, float %37, i64 0
  %49 = shufflevector <2 x float> %48, <2 x float> poison, <2 x i32> zeroinitializer
  %50 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %49, <2 x float> %43, <2 x float> %47)
  store <2 x float> %50, ptr %.01721, align 4, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %.023, i64 12
  %52 = load float, ptr %38, align 4, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %.023, i64 16
  %54 = load float, ptr %51, align 4, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %.01622, i64 16
  %56 = fneg float %54
  %57 = getelementptr inbounds i8, ptr %.01721, i64 16
  %58 = load <2 x float>, ptr %40, align 4, !tbaa !5
  %59 = insertelement <2 x float> poison, float %54, i64 0
  %60 = insertelement <2 x float> %59, float %56, i64 1
  %61 = fmul <2 x float> %58, %60
  %62 = shufflevector <2 x float> %61, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %63 = insertelement <2 x float> poison, float %52, i64 0
  %64 = shufflevector <2 x float> %63, <2 x float> poison, <2 x i32> zeroinitializer
  %65 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %64, <2 x float> %58, <2 x float> %62)
  store <2 x float> %65, ptr %42, align 4, !tbaa !5
  %66 = add i32 %.01820, -2
  %.not.1 = icmp eq i32 %66, 0
  br i1 %.not.1, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %4
  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

; 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(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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !11}


; Effective O3 passes: GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass