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

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

13:                                               ; preds = %24, %5
  %14 = load i32, ptr %11, align 4, !tbaa !5
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %17, label %27

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

24:                                               ; preds = %17
  %25 = load i32, ptr %11, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %11, align 4, !tbaa !5
  br label %13, !llvm.loop !11

27:                                               ; preds = %13
  %28 = load ptr, ptr %9, align 8, !tbaa !9
  %29 = load i32, ptr %8, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr %28, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  store i32 %32, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %44, %27
  %34 = load i32, ptr %11, align 4, !tbaa !5
  %35 = load i32, ptr %12, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %37, label %47

37:                                               ; preds = %33
  %38 = load ptr, ptr %10, align 8, !tbaa !9
  %39 = load i32, ptr %11, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr %38, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %41, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %37
  %45 = load i32, ptr %11, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %11, align 4, !tbaa !5
  br label %33, !llvm.loop !13

47:                                               ; preds = %33
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %59, %47
  %49 = load i32, ptr %11, align 4, !tbaa !5
  %50 = load i32, ptr %8, align 4, !tbaa !5
  %51 = icmp sle i32 %49, %50
  br i1 %51, label %52, label %62

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

59:                                               ; preds = %52
  %60 = load i32, ptr %11, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %11, align 4, !tbaa !5
  br label %48, !llvm.loop !14

62:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #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 @__ChangeMesh2FNumbering(i32 noundef %0, ptr nocapture noundef %1, i32 noundef %2, ptr nocapture noundef %3, ptr nocapture noundef %4) local_unnamed_addr #0 {
  %6 = icmp sgt i32 %0, 0
  br i1 %6, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %5
  %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.preheader64, 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 ]
  %7 = getelementptr inbounds i32, ptr %1, i64 %index
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  %wide.load = load <4 x i32>, ptr %7, align 4, !tbaa !5
  %wide.load35 = load <4 x i32>, ptr %8, align 4, !tbaa !5
  %9 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %10 = add nsw <4 x i32> %wide.load35, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %9, ptr %7, align 4, !tbaa !5
  store <4 x i32> %10, ptr %8, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %11 = icmp eq i64 %index.next, %n.vec
  br i1 %11, 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.preheader64

.lr.ph.preheader64:                               ; 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.preheader64, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader64 ]
  %12 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %12, 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, %5
  %15 = sext i32 %2 to i64
  %16 = getelementptr inbounds i32, ptr %3, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph19.preheader, label %.preheader

.lr.ph19.preheader:                               ; preds = %._crit_edge
  %wide.trip.count28 = zext nneg i32 %17 to i64
  %min.iters.check38 = icmp ult i32 %17, 8
  br i1 %min.iters.check38, label %.lr.ph19.preheader63, label %vector.ph39

.lr.ph19.preheader63:                             ; preds = %middle.block36, %.lr.ph19.preheader
  %indvars.iv25.ph = phi i64 [ 0, %.lr.ph19.preheader ], [ %n.vec41, %middle.block36 ]
  br label %.lr.ph19

vector.ph39:                                      ; preds = %.lr.ph19.preheader
  %n.vec41 = and i64 %wide.trip.count28, 2147483640
  br label %vector.body43

vector.body43:                                    ; preds = %vector.body43, %vector.ph39
  %index44 = phi i64 [ 0, %vector.ph39 ], [ %index.next47, %vector.body43 ]
  %19 = getelementptr inbounds i32, ptr %4, i64 %index44
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %wide.load45 = load <4 x i32>, ptr %19, align 4, !tbaa !5
  %wide.load46 = load <4 x i32>, ptr %20, align 4, !tbaa !5
  %21 = add nsw <4 x i32> %wide.load45, <i32 1, i32 1, i32 1, i32 1>
  %22 = add nsw <4 x i32> %wide.load46, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %21, ptr %19, align 4, !tbaa !5
  store <4 x i32> %22, ptr %20, align 4, !tbaa !5
  %index.next47 = add nuw i64 %index44, 8
  %23 = icmp eq i64 %index.next47, %n.vec41
  br i1 %23, label %middle.block36, label %vector.body43, !llvm.loop !14

middle.block36:                                   ; preds = %vector.body43
  %cmp.n48 = icmp eq i64 %n.vec41, %wide.trip.count28
  br i1 %cmp.n48, label %.preheader, label %.lr.ph19.preheader63

.preheader:                                       ; preds = %.lr.ph19, %middle.block36, %._crit_edge
  %.not20 = icmp slt i32 %2, 0
  br i1 %.not20, label %._crit_edge23, label %.lr.ph22.preheader

.lr.ph22.preheader:                               ; preds = %.preheader
  %24 = add nuw i32 %2, 1
  %wide.trip.count33 = zext i32 %24 to i64
  %min.iters.check51 = icmp ult i32 %2, 7
  br i1 %min.iters.check51, label %.lr.ph22.preheader62, label %vector.ph52

.lr.ph22.preheader62:                             ; preds = %middle.block49, %.lr.ph22.preheader
  %indvars.iv30.ph = phi i64 [ 0, %.lr.ph22.preheader ], [ %n.vec54, %middle.block49 ]
  br label %.lr.ph22

vector.ph52:                                      ; preds = %.lr.ph22.preheader
  %n.vec54 = and i64 %wide.trip.count33, 4294967288
  br label %vector.body56

vector.body56:                                    ; preds = %vector.body56, %vector.ph52
  %index57 = phi i64 [ 0, %vector.ph52 ], [ %index.next60, %vector.body56 ]
  %25 = getelementptr inbounds i32, ptr %3, i64 %index57
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  %wide.load58 = load <4 x i32>, ptr %25, align 4, !tbaa !5
  %wide.load59 = load <4 x i32>, ptr %26, align 4, !tbaa !5
  %27 = add nsw <4 x i32> %wide.load58, <i32 1, i32 1, i32 1, i32 1>
  %28 = add nsw <4 x i32> %wide.load59, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %27, ptr %25, align 4, !tbaa !5
  store <4 x i32> %28, ptr %26, align 4, !tbaa !5
  %index.next60 = add nuw i64 %index57, 8
  %29 = icmp eq i64 %index.next60, %n.vec54
  br i1 %29, label %middle.block49, label %vector.body56, !llvm.loop !15

middle.block49:                                   ; preds = %vector.body56
  %cmp.n61 = icmp eq i64 %n.vec54, %wide.trip.count33
  br i1 %cmp.n61, label %._crit_edge23, label %.lr.ph22.preheader62

.lr.ph19:                                         ; preds = %.lr.ph19.preheader63, %.lr.ph19
  %indvars.iv25 = phi i64 [ %indvars.iv.next26, %.lr.ph19 ], [ %indvars.iv25.ph, %.lr.ph19.preheader63 ]
  %30 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv25
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %30, align 4, !tbaa !5
  %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
  %exitcond29.not = icmp eq i64 %indvars.iv.next26, %wide.trip.count28
  br i1 %exitcond29.not, label %.preheader, label %.lr.ph19, !llvm.loop !16

.lr.ph22:                                         ; preds = %.lr.ph22.preheader62, %.lr.ph22
  %indvars.iv30 = phi i64 [ %indvars.iv.next31, %.lr.ph22 ], [ %indvars.iv30.ph, %.lr.ph22.preheader62 ]
  %33 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv30
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %33, align 4, !tbaa !5
  %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
  %exitcond34.not = icmp eq i64 %indvars.iv.next31, %wide.trip.count33
  br i1 %exitcond34.not, label %._crit_edge23, label %.lr.ph22, !llvm.loop !17

._crit_edge23:                                    ; preds = %.lr.ph22, %middle.block49, %.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