; LLVM IR from siconos/siconos :: externals/lbl/metis4/fortran.ll_ (Change2FNumbering)

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

11:                                               ; preds = %22, %4
  %12 = load i32, ptr %9, align 4, !tbaa !5
  %13 = load i32, ptr %5, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %15, label %25

15:                                               ; preds = %11
  %16 = load ptr, ptr %8, align 8, !tbaa !9
  %17 = load i32, ptr %9, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i32, ptr %16, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %19, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %15
  %23 = load i32, ptr %9, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %9, align 4, !tbaa !5
  br label %11, !llvm.loop !11

25:                                               ; preds = %11
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %26, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  store i32 %30, ptr %10, align 4, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %42, %25
  %32 = load i32, ptr %9, align 4, !tbaa !5
  %33 = load i32, ptr %10, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %35, label %45

35:                                               ; preds = %31
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  %37 = load i32, ptr %9, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr %36, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %39, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %35
  %43 = load i32, ptr %9, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %9, align 4, !tbaa !5
  br label %31, !llvm.loop !13

45:                                               ; preds = %31
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %57, %45
  %47 = load i32, ptr %9, align 4, !tbaa !5
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %50, label %60

50:                                               ; preds = %46
  %51 = load ptr, ptr %6, align 8, !tbaa !9
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds i32, ptr %51, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %54, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %50
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %9, align 4, !tbaa !5
  br label %46, !llvm.loop !14

60:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  ret void
}

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


; 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(argmem: readwrite) uwtable
define dso_local void @__Change2FNumbering(i32 noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3) local_unnamed_addr #0 {
  %5 = icmp sgt i32 %0, 0
  br i1 %5, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %4
  %wide.trip.count = zext nneg i32 %0 to i64
  %min.iters.check = icmp ult i32 %0, 8
  br i1 %min.iters.check, label %.lr.ph.preheader65, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %6 = getelementptr inbounds i32, ptr %3, i64 %index
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  %wide.load = load <4 x i32>, ptr %6, align 4, !tbaa !5
  %wide.load36 = load <4 x i32>, ptr %7, align 4, !tbaa !5
  %8 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %9 = add nsw <4 x i32> %wide.load36, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %8, ptr %6, align 4, !tbaa !5
  store <4 x i32> %9, ptr %7, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %10 = icmp eq i64 %index.next, %n.vec
  br i1 %10, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader65

.lr.ph.preheader65:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader65, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader65 ]
  %11 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = add nsw i32 %12, 1
  store i32 %13, ptr %11, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %4
  %14 = sext i32 %0 to i64
  %15 = getelementptr inbounds i32, ptr %1, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph20.preheader, label %.preheader

.lr.ph20.preheader:                               ; preds = %._crit_edge
  %wide.trip.count29 = zext nneg i32 %16 to i64
  %min.iters.check39 = icmp ult i32 %16, 8
  br i1 %min.iters.check39, label %.lr.ph20.preheader64, label %vector.ph40

.lr.ph20.preheader64:                             ; preds = %middle.block37, %.lr.ph20.preheader
  %indvars.iv26.ph = phi i64 [ 0, %.lr.ph20.preheader ], [ %n.vec42, %middle.block37 ]
  br label %.lr.ph20

vector.ph40:                                      ; preds = %.lr.ph20.preheader
  %n.vec42 = and i64 %wide.trip.count29, 2147483640
  br label %vector.body44

vector.body44:                                    ; preds = %vector.body44, %vector.ph40
  %index45 = phi i64 [ 0, %vector.ph40 ], [ %index.next48, %vector.body44 ]
  %18 = getelementptr inbounds i32, ptr %2, i64 %index45
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %wide.load46 = load <4 x i32>, ptr %18, align 4, !tbaa !5
  %wide.load47 = load <4 x i32>, ptr %19, align 4, !tbaa !5
  %20 = add nsw <4 x i32> %wide.load46, <i32 1, i32 1, i32 1, i32 1>
  %21 = add nsw <4 x i32> %wide.load47, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %20, ptr %18, align 4, !tbaa !5
  store <4 x i32> %21, ptr %19, align 4, !tbaa !5
  %index.next48 = add nuw i64 %index45, 8
  %22 = icmp eq i64 %index.next48, %n.vec42
  br i1 %22, label %middle.block37, label %vector.body44, !llvm.loop !14

middle.block37:                                   ; preds = %vector.body44
  %cmp.n49 = icmp eq i64 %n.vec42, %wide.trip.count29
  br i1 %cmp.n49, label %.preheader, label %.lr.ph20.preheader64

.preheader:                                       ; preds = %.lr.ph20, %middle.block37, %._crit_edge
  %.not21 = icmp slt i32 %0, 0
  br i1 %.not21, label %._crit_edge24, label %.lr.ph23.preheader

.lr.ph23.preheader:                               ; preds = %.preheader
  %23 = add nuw i32 %0, 1
  %wide.trip.count34 = zext i32 %23 to i64
  %min.iters.check52 = icmp ult i32 %0, 7
  br i1 %min.iters.check52, label %.lr.ph23.preheader63, label %vector.ph53

.lr.ph23.preheader63:                             ; preds = %middle.block50, %.lr.ph23.preheader
  %indvars.iv31.ph = phi i64 [ 0, %.lr.ph23.preheader ], [ %n.vec55, %middle.block50 ]
  br label %.lr.ph23

vector.ph53:                                      ; preds = %.lr.ph23.preheader
  %n.vec55 = and i64 %wide.trip.count34, 4294967288
  br label %vector.body57

vector.body57:                                    ; preds = %vector.body57, %vector.ph53
  %index58 = phi i64 [ 0, %vector.ph53 ], [ %index.next61, %vector.body57 ]
  %24 = getelementptr inbounds i32, ptr %1, i64 %index58
  %25 = getelementptr inbounds i8, ptr %24, i64 16
  %wide.load59 = load <4 x i32>, ptr %24, align 4, !tbaa !5
  %wide.load60 = load <4 x i32>, ptr %25, align 4, !tbaa !5
  %26 = add nsw <4 x i32> %wide.load59, <i32 1, i32 1, i32 1, i32 1>
  %27 = add nsw <4 x i32> %wide.load60, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %26, ptr %24, align 4, !tbaa !5
  store <4 x i32> %27, ptr %25, align 4, !tbaa !5
  %index.next61 = add nuw i64 %index58, 8
  %28 = icmp eq i64 %index.next61, %n.vec55
  br i1 %28, label %middle.block50, label %vector.body57, !llvm.loop !15

middle.block50:                                   ; preds = %vector.body57
  %cmp.n62 = icmp eq i64 %n.vec55, %wide.trip.count34
  br i1 %cmp.n62, label %._crit_edge24, label %.lr.ph23.preheader63

.lr.ph20:                                         ; preds = %.lr.ph20.preheader64, %.lr.ph20
  %indvars.iv26 = phi i64 [ %indvars.iv.next27, %.lr.ph20 ], [ %indvars.iv26.ph, %.lr.ph20.preheader64 ]
  %29 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv26
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %29, align 4, !tbaa !5
  %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
  %exitcond30.not = icmp eq i64 %indvars.iv.next27, %wide.trip.count29
  br i1 %exitcond30.not, label %.preheader, label %.lr.ph20, !llvm.loop !16

.lr.ph23:                                         ; preds = %.lr.ph23.preheader63, %.lr.ph23
  %indvars.iv31 = phi i64 [ %indvars.iv.next32, %.lr.ph23 ], [ %indvars.iv31.ph, %.lr.ph23.preheader63 ]
  %32 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %32, align 4, !tbaa !5
  %indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
  %exitcond35.not = icmp eq i64 %indvars.iv.next32, %wide.trip.count34
  br i1 %exitcond35.not, label %._crit_edge24, label %.lr.ph23, !llvm.loop !17

._crit_edge24:                                    ; preds = %.lr.ph23, %middle.block50, %.preheader
  ret void
}

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) 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 = !{!"int", !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, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10, !12, !11}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass