; LLVM IR from FedericaPaoli1/stm32-speech-recognition-and-traduction :: Drivers/CMSIS/DSP/Source/SVMFunctions (arm_svm_polynomial_predict_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"

%struct.arm_svm_polynomial_instance_f32 = type { i32, i32, float, ptr, ptr, ptr, i32, float, float }

; Function Attrs: nounwind uwtable
define dso_local void @arm_svm_polynomial_predict_f32(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %12, i32 0, i32 2
  %14 = load float, ptr %13, align 8, !tbaa !9
  store float %14, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store float 0.000000e+00, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %15, i32 0, i32 4
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  store ptr %17, ptr %11, align 8, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !15
  br label %18

18:                                               ; preds = %67, %3
  %19 = load i32, ptr %9, align 4, !tbaa !15
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %21, align 8, !tbaa !16
  %23 = icmp ult i32 %19, %22
  br i1 %23, label %24, label %70

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

25:                                               ; preds = %42, %24
  %26 = load i32, ptr %10, align 4, !tbaa !15
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %27, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !17
  %30 = icmp ult i32 %26, %29
  br i1 %30, label %31, label %45

31:                                               ; preds = %25
  %32 = load float, ptr %8, align 4, !tbaa !13
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i32, ptr %10, align 4, !tbaa !15
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds float, ptr %33, i64 %35
  %37 = load float, ptr %36, align 4, !tbaa !13
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = getelementptr inbounds float, ptr %38, i32 1
  store ptr %39, ptr %11, align 8, !tbaa !5
  %40 = load float, ptr %38, align 4, !tbaa !13
  %41 = call float @llvm.fmuladd.f32(float %37, float %40, float %32)
  store float %41, ptr %8, align 4, !tbaa !13
  br label %42

42:                                               ; preds = %31
  %43 = load i32, ptr %10, align 4, !tbaa !15
  %44 = add i32 %43, 1
  store i32 %44, ptr %10, align 4, !tbaa !15
  br label %25, !llvm.loop !18

45:                                               ; preds = %25
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %46, i32 0, i32 3
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = load i32, ptr %9, align 4, !tbaa !15
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds float, ptr %48, i64 %50
  %52 = load float, ptr %51, align 4, !tbaa !13
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %53, i32 0, i32 8
  %55 = load float, ptr %54, align 8, !tbaa !21
  %56 = load float, ptr %8, align 4, !tbaa !13
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %57, i32 0, i32 7
  %59 = load float, ptr %58, align 4, !tbaa !22
  %60 = call float @llvm.fmuladd.f32(float %55, float %56, float %59)
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %61, i32 0, i32 6
  %63 = load i32, ptr %62, align 8, !tbaa !23
  %64 = call float @arm_exponent_f32(float noundef %60, i32 noundef %63)
  %65 = load float, ptr %7, align 4, !tbaa !13
  %66 = call float @llvm.fmuladd.f32(float %52, float %64, float %65)
  store float %66, ptr %7, align 4, !tbaa !13
  br label %67

67:                                               ; preds = %45
  %68 = load i32, ptr %9, align 4, !tbaa !15
  %69 = add i32 %68, 1
  store i32 %69, ptr %9, align 4, !tbaa !15
  br label %18, !llvm.loop !24

70:                                               ; preds = %18
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.arm_svm_polynomial_instance_f32, ptr %71, i32 0, i32 5
  %73 = load ptr, ptr %72, align 8, !tbaa !25
  %74 = load float, ptr %7, align 4, !tbaa !13
  %75 = fcmp ole float %74, 0.000000e+00
  %76 = zext i1 %75 to i64
  %77 = select i1 %75, i32 0, i32 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %73, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !15
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 %80, ptr %81, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  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: inlinehint nounwind uwtable
declare hidden float @arm_exponent_f32(float noundef, i32 noundef) #3

; 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 = { inlinehint 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 #4 = { 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, !12, i64 8}
!10 = !{!"", !11, i64 0, !11, i64 4, !12, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !12, i64 44, !12, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 0}
!17 = !{!10, !11, i64 4}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!10, !6, i64 16}
!21 = !{!10, !12, i64 48}
!22 = !{!10, !12, i64 44}
!23 = !{!10, !11, i64 40}
!24 = distinct !{!24, !19}
!25 = !{!10, !6, i64 32}


; 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: nounwind uwtable
define dso_local void @arm_svm_polynomial_predict_f32(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load float, ptr %4, align 8, !tbaa !5
  %6 = load i32, ptr %0, align 8, !tbaa !12
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %._crit_edge32, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = getelementptr inbounds i8, ptr %0, i64 44
  %13 = getelementptr inbounds i8, ptr %0, i64 40
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %indvars.iv38 = phi i64 [ 0, %.preheader.lr.ph ], [ %indvars.iv.next39, %._crit_edge ]
  %.031 = phi ptr [ %8, %.preheader.lr.ph ], [ %.1.lcssa, %._crit_edge ]
  %.02429 = phi float [ %5, %.preheader.lr.ph ], [ %49, %._crit_edge ]
  %14 = load i32, ptr %9, align 4, !tbaa !14
  %.not34 = icmp eq i32 %14, 0
  br i1 %.not34, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = zext i32 %14 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %15 = icmp ult i32 %14, 4
  br i1 %15, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 4294967292
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %.127 = phi ptr [ %.031, %.lr.ph.preheader.new ], [ %33, %.lr.ph ]
  %.02325 = phi float [ 0.000000e+00, %.lr.ph.preheader.new ], [ %35, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %16 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
  %17 = load float, ptr %16, align 4, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %.127, i64 4
  %19 = load float, ptr %.127, align 4, !tbaa !15
  %20 = tail call float @llvm.fmuladd.f32(float %17, float %19, float %.02325)
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %21 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.next
  %22 = load float, ptr %21, align 4, !tbaa !15
  %23 = getelementptr inbounds i8, ptr %.127, i64 8
  %24 = load float, ptr %18, align 4, !tbaa !15
  %25 = tail call float @llvm.fmuladd.f32(float %22, float %24, float %20)
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %26 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.next.1
  %27 = load float, ptr %26, align 4, !tbaa !15
  %28 = getelementptr inbounds i8, ptr %.127, i64 12
  %29 = load float, ptr %23, align 4, !tbaa !15
  %30 = tail call float @llvm.fmuladd.f32(float %27, float %29, float %25)
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %31 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.next.2
  %32 = load float, ptr %31, align 4, !tbaa !15
  %33 = getelementptr inbounds i8, ptr %.127, i64 16
  %34 = load float, ptr %28, align 4, !tbaa !15
  %35 = tail call float @llvm.fmuladd.f32(float %32, float %34, float %30)
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !16

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa45.ph = phi ptr [ poison, %.lr.ph.preheader ], [ %33, %.lr.ph ]
  %.lcssa.ph = phi float [ poison, %.lr.ph.preheader ], [ %35, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %.127.unr = phi ptr [ %.031, %.lr.ph.preheader ], [ %33, %.lr.ph ]
  %.02325.unr = phi float [ 0.000000e+00, %.lr.ph.preheader ], [ %35, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.127.epil = phi ptr [ %38, %.lr.ph.epil ], [ %.127.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.02325.epil = phi float [ %40, %.lr.ph.epil ], [ %.02325.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %36 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.epil
  %37 = load float, ptr %36, align 4, !tbaa !15
  %38 = getelementptr inbounds i8, ptr %.127.epil, i64 4
  %39 = load float, ptr %.127.epil, align 4, !tbaa !15
  %40 = tail call float @llvm.fmuladd.f32(float %37, float %39, float %.02325.epil)
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !18

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil, %.preheader
  %.023.lcssa = phi float [ 0.000000e+00, %.preheader ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %40, %.lr.ph.epil ]
  %.1.lcssa = phi ptr [ %.031, %.preheader ], [ %.lcssa45.ph, %._crit_edge.loopexit.unr-lcssa ], [ %38, %.lr.ph.epil ]
  %41 = load ptr, ptr %10, align 8, !tbaa !20
  %42 = getelementptr inbounds float, ptr %41, i64 %indvars.iv38
  %43 = load float, ptr %42, align 4, !tbaa !15
  %44 = load float, ptr %11, align 8, !tbaa !21
  %45 = load float, ptr %12, align 4, !tbaa !22
  %46 = tail call float @llvm.fmuladd.f32(float %44, float %.023.lcssa, float %45)
  %47 = load i32, ptr %13, align 8, !tbaa !23
  %48 = tail call float @arm_exponent_f32(float noundef %46, i32 noundef %47)
  %49 = tail call float @llvm.fmuladd.f32(float %43, float %48, float %.02429)
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %50 = load i32, ptr %0, align 8, !tbaa !12
  %51 = zext i32 %50 to i64
  %52 = icmp ult i64 %indvars.iv.next39, %51
  br i1 %52, label %.preheader, label %._crit_edge32, !llvm.loop !24

._crit_edge32:                                    ; preds = %._crit_edge, %3
  %.024.lcssa = phi float [ %5, %3 ], [ %49, %._crit_edge ]
  %53 = getelementptr inbounds i8, ptr %0, i64 32
  %54 = load ptr, ptr %53, align 8, !tbaa !25
  %55 = fcmp ugt float %.024.lcssa, 0.000000e+00
  %56 = zext i1 %55 to i64
  %57 = getelementptr inbounds i32, ptr %54, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !26
  store i32 %58, ptr %2, align 4, !tbaa !26
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @arm_exponent_f32(float noundef, i32 noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { inlinehint 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" }

!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, !10, i64 8}
!6 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !7, i64 40, !10, i64 44, !10, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !11, i64 24}
!14 = !{!6, !7, i64 4}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = !{!6, !11, i64 16}
!21 = !{!6, !10, i64 48}
!22 = !{!6, !10, i64 44}
!23 = !{!6, !7, i64 40}
!24 = distinct !{!24, !17}
!25 = !{!6, !11, i64 32}
!26 = !{!7, !7, i64 0}


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