; LLVM IR from siconos/siconos :: externals/lbl/metis4/util.ll_ (saxpy)

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @__saxpy(i32 noundef %0, float noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5) #2 {
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 %0, ptr %7, align 4, !tbaa !5
  store float %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !11
  store i32 %3, ptr %10, align 4, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !11
  store i32 %5, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %25, %6
  %15 = load i32, ptr %13, align 4, !tbaa !5
  %16 = load i32, ptr %7, align 4, !tbaa !5
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %18, label %36

18:                                               ; preds = %14
  %19 = load float, ptr %8, align 4, !tbaa !9
  %20 = load ptr, ptr %9, align 8, !tbaa !11
  %21 = load float, ptr %20, align 4, !tbaa !9
  %22 = load ptr, ptr %11, align 8, !tbaa !11
  %23 = load float, ptr %22, align 4, !tbaa !9
  %24 = call float @llvm.fmuladd.f32(float %19, float %21, float %23)
  store float %24, ptr %22, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %18
  %26 = load i32, ptr %13, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %13, align 4, !tbaa !5
  %28 = load i32, ptr %10, align 4, !tbaa !5
  %29 = load ptr, ptr %9, align 8, !tbaa !11
  %30 = sext i32 %28 to i64
  %31 = getelementptr inbounds float, ptr %29, i64 %30
  store ptr %31, ptr %9, align 8, !tbaa !11
  %32 = load i32, ptr %12, align 4, !tbaa !5
  %33 = load ptr, ptr %11, align 8, !tbaa !11
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds float, ptr %33, i64 %34
  store ptr %35, ptr %11, align 8, !tbaa !11
  br label %14, !llvm.loop !13

36:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @__saxpy(i32 noundef %0, float noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, ptr nocapture noundef %4, i32 noundef %5) local_unnamed_addr #1 {
  %7 = icmp sgt i32 %0, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %6
  %8 = sext i32 %3 to i64
  %9 = sext i32 %5 to i64
  %xtraiter = and i32 %0, 3
  %10 = icmp ult i32 %0, 4
  br i1 %10, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i32 %0, 2147483644
  br label %11

11:                                               ; preds = %11, %.lr.ph.new
  %.0912 = phi ptr [ %2, %.lr.ph.new ], [ %30, %11 ]
  %.01011 = phi ptr [ %4, %.lr.ph.new ], [ %31, %11 ]
  %niter = phi i32 [ 0, %.lr.ph.new ], [ %niter.next.3, %11 ]
  %12 = load float, ptr %.0912, align 4, !tbaa !5
  %13 = load float, ptr %.01011, align 4, !tbaa !5
  %14 = tail call float @llvm.fmuladd.f32(float %1, float %12, float %13)
  store float %14, ptr %.01011, align 4, !tbaa !5
  %15 = getelementptr inbounds float, ptr %.0912, i64 %8
  %16 = getelementptr inbounds float, ptr %.01011, i64 %9
  %17 = load float, ptr %15, align 4, !tbaa !5
  %18 = load float, ptr %16, align 4, !tbaa !5
  %19 = tail call float @llvm.fmuladd.f32(float %1, float %17, float %18)
  store float %19, ptr %16, align 4, !tbaa !5
  %20 = getelementptr inbounds float, ptr %15, i64 %8
  %21 = getelementptr inbounds float, ptr %16, i64 %9
  %22 = load float, ptr %20, align 4, !tbaa !5
  %23 = load float, ptr %21, align 4, !tbaa !5
  %24 = tail call float @llvm.fmuladd.f32(float %1, float %22, float %23)
  store float %24, ptr %21, align 4, !tbaa !5
  %25 = getelementptr inbounds float, ptr %20, i64 %8
  %26 = getelementptr inbounds float, ptr %21, i64 %9
  %27 = load float, ptr %25, align 4, !tbaa !5
  %28 = load float, ptr %26, align 4, !tbaa !5
  %29 = tail call float @llvm.fmuladd.f32(float %1, float %27, float %28)
  store float %29, ptr %26, align 4, !tbaa !5
  %30 = getelementptr inbounds float, ptr %25, i64 %8
  %31 = getelementptr inbounds float, ptr %26, i64 %9
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %11, !llvm.loop !9

._crit_edge.loopexit.unr-lcssa:                   ; preds = %11, %.lr.ph
  %.0912.unr = phi ptr [ %2, %.lr.ph ], [ %30, %11 ]
  %.01011.unr = phi ptr [ %4, %.lr.ph ], [ %31, %11 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %.0912.epil = phi ptr [ %35, %.epil.preheader ], [ %.0912.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.01011.epil = phi ptr [ %36, %.epil.preheader ], [ %.01011.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %32 = load float, ptr %.0912.epil, align 4, !tbaa !5
  %33 = load float, ptr %.01011.epil, align 4, !tbaa !5
  %34 = tail call float @llvm.fmuladd.f32(float %1, float %32, float %33)
  store float %34, ptr %.01011.epil, align 4, !tbaa !5
  %35 = getelementptr inbounds float, ptr %.0912.epil, i64 %8
  %36 = getelementptr inbounds float, ptr %.01011.epil, i64 %9
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %6
  ret void
}

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

!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, !12}
!12 = !{!"llvm.loop.unroll.disable"}


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