; LLVM IR from siconos/siconos :: kernel/src/plugin/test (TestPlugin)

; 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: mustprogress nounwind uwtable
define dso_local void @computeA(double noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef %5) #1 {
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store double %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !11
  store i32 %4, ptr %11, align 4, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %44, %6
  %17 = load i32, ptr %13, align 4, !tbaa !9
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp ult i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #2
  br label %47

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #2
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %40, %21
  %23 = load i32, ptr %15, align 4, !tbaa !9
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = icmp ult i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #2
  br label %43

27:                                               ; preds = %22
  %28 = load i32, ptr %15, align 4, !tbaa !9
  %29 = add i32 %28, 1
  %30 = mul i32 4, %29
  %31 = uitofp i32 %30 to double
  %32 = load ptr, ptr %10, align 8, !tbaa !11
  %33 = load i32, ptr %15, align 4, !tbaa !9
  %34 = load i32, ptr %13, align 4, !tbaa !9
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = mul i32 %34, %35
  %37 = add i32 %33, %36
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds double, ptr %32, i64 %38
  store double %31, ptr %39, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %27
  %41 = load i32, ptr %15, align 4, !tbaa !9
  %42 = add i32 %41, 1
  store i32 %42, ptr %15, align 4, !tbaa !9
  br label %22, !llvm.loop !13

43:                                               ; preds = %26
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %13, align 4, !tbaa !9
  %46 = add i32 %45, 1
  store i32 %46, ptr %13, align 4, !tbaa !9
  br label %16, !llvm.loop !15

47:                                               ; preds = %20
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !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: mustprogress nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @computeA(double noundef %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef writeonly %3, i32 noundef %4, ptr nocapture noundef readnone %5) local_unnamed_addr #0 {
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %6
  %wide.trip.count = zext i32 %1 to i64
  %7 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %1, 6
  %8 = trunc i64 %7 to i32
  %9 = icmp ugt i64 %7, 4294967295
  %n.vec = and i64 %wide.trip.count, 4294967292
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.loopexit
  %.01013 = phi i32 [ %38, %.loopexit ], [ 0, %.preheader.preheader ]
  %10 = mul i32 %.01013, %1
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.scevcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.scevcheck, %.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %.preheader ], [ %n.vec, %middle.block ]
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %scalar.ph.prol ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %11 = trunc nuw i64 %indvars.iv.next.prol to i32
  %12 = shl i32 %11, 2
  %13 = uitofp i32 %12 to double
  %14 = trunc nuw i64 %indvars.iv.prol to i32
  %15 = add i32 %10, %14
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds double, ptr %3, i64 %16
  store double %13, ptr %17, align 8, !tbaa !5
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !9

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %18 = sub nsw i64 %indvars.iv.ph, %wide.trip.count
  %19 = icmp ugt i64 %18, -4
  br i1 %19, label %.loopexit, label %scalar.ph

vector.scevcheck:                                 ; preds = %.preheader
  %20 = mul i32 %.01013, %1
  %21 = xor i32 %20, -1
  %22 = icmp ult i32 %21, %8
  %23 = or i1 %22, %9
  br i1 %23, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %vector.scevcheck, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.scevcheck ]
  %vec.ind = phi <2 x i64> [ %vec.ind.next, %vector.body ], [ <i64 0, i64 1>, %vector.scevcheck ]
  %24 = trunc i64 %index to i32
  %25 = trunc <2 x i64> %vec.ind to <2 x i32>
  %26 = trunc <2 x i64> %vec.ind to <2 x i32>
  %27 = shl <2 x i32> %25, <i32 2, i32 2>
  %28 = add <2 x i32> %27, <i32 4, i32 4>
  %29 = shl <2 x i32> %26, <i32 2, i32 2>
  %30 = add <2 x i32> %29, <i32 12, i32 12>
  %31 = uitofp <2 x i32> %28 to <2 x double>
  %32 = uitofp <2 x i32> %30 to <2 x double>
  %33 = add i32 %10, %24
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds double, ptr %3, i64 %34
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  store <2 x double> %31, ptr %35, align 8, !tbaa !5
  store <2 x double> %32, ptr %36, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
  %37 = icmp eq i64 %index.next, %n.vec
  br i1 %37, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %.loopexit, %6
  ret void

.loopexit:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  %38 = add nuw i32 %.01013, 1
  %exitcond15.not = icmp eq i32 %38, %1
  br i1 %exitcond15.not, label %._crit_edge, label %.preheader, !llvm.loop !15

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = trunc nuw i64 %indvars.iv.next to i32
  %40 = shl i32 %39, 2
  %41 = uitofp i32 %40 to double
  %42 = trunc nuw i64 %indvars.iv to i32
  %43 = add i32 %10, %42
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds double, ptr %3, i64 %44
  store double %41, ptr %45, align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %46 = trunc nuw i64 %indvars.iv.next.1 to i32
  %47 = shl i32 %46, 2
  %48 = uitofp i32 %47 to double
  %49 = trunc nuw i64 %indvars.iv.next to i32
  %50 = add i32 %10, %49
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds double, ptr %3, i64 %51
  store double %48, ptr %52, align 8, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %53 = trunc nuw i64 %indvars.iv.next.2 to i32
  %54 = shl i32 %53, 2
  %55 = uitofp i32 %54 to double
  %56 = trunc nuw i64 %indvars.iv.next.1 to i32
  %57 = add i32 %10, %56
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds double, ptr %3, i64 %58
  store double %55, ptr %59, align 8, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %60 = trunc nuw i64 %indvars.iv.next.3 to i32
  %61 = shl i32 %60, 2
  %62 = uitofp i32 %61 to double
  %63 = trunc nuw i64 %indvars.iv.next.2 to i32
  %64 = add i32 %10, %63
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds double, ptr %3, i64 %65
  store double %62, ptr %66, align 8, !tbaa !5
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
  br i1 %exitcond.not.3, label %.loopexit, label %scalar.ph, !llvm.loop !16
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(argmem: write) 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !13}


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