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

; 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 @__Change2FNumberingOrder(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %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 ptr %2, ptr %8, align 8, !tbaa !9
  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 = %30, %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 %33

17:                                               ; preds = %13
  %18 = load ptr, ptr %9, 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
  %24 = load ptr, ptr %10, align 8, !tbaa !9
  %25 = load i32, ptr %11, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr %24, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %27, align 4, !tbaa !5
  br label %30

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

33:                                               ; preds = %13
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i32, ptr %34, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  store i32 %38, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %50, %33
  %40 = load i32, ptr %11, align 4, !tbaa !5
  %41 = load i32, ptr %12, align 4, !tbaa !5
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %43, label %53

43:                                               ; preds = %39
  %44 = load ptr, ptr %8, align 8, !tbaa !9
  %45 = load i32, ptr %11, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %44, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %47, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %43
  %51 = load i32, ptr %11, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %11, align 4, !tbaa !5
  br label %39, !llvm.loop !13

53:                                               ; preds = %39
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %65, %53
  %55 = load i32, ptr %11, align 4, !tbaa !5
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %58, label %68

58:                                               ; preds = %54
  %59 = load ptr, ptr %7, align 8, !tbaa !9
  %60 = load i32, ptr %11, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i32, ptr %59, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %62, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %58
  %66 = load i32, ptr %11, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %11, align 4, !tbaa !5
  br label %54, !llvm.loop !14

68:                                               ; preds = %54
  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 @__Change2FNumberingOrder(i32 noundef %0, ptr nocapture noundef %1, ptr nocapture 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.preheader70, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %7 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep = getelementptr i8, ptr %3, i64 %7
  %scevgep38 = getelementptr i8, ptr %4, i64 %7
  %bound0 = icmp ugt ptr %scevgep38, %3
  %bound1 = icmp ugt ptr %scevgep, %4
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph.preheader70, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %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 ]
  %8 = getelementptr inbounds i32, ptr %3, i64 %index
  %9 = getelementptr inbounds i8, ptr %8, i64 16
  %wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5, !alias.scope !9, !noalias !12
  %wide.load39 = load <4 x i32>, ptr %9, align 4, !tbaa !5, !alias.scope !9, !noalias !12
  %10 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %11 = add nsw <4 x i32> %wide.load39, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %10, ptr %8, align 4, !tbaa !5, !alias.scope !9, !noalias !12
  store <4 x i32> %11, ptr %9, align 4, !tbaa !5, !alias.scope !9, !noalias !12
  %12 = getelementptr inbounds i32, ptr %4, i64 %index
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %wide.load40 = load <4 x i32>, ptr %12, align 4, !tbaa !5, !alias.scope !12
  %wide.load41 = load <4 x i32>, ptr %13, align 4, !tbaa !5, !alias.scope !12
  %14 = add nsw <4 x i32> %wide.load40, <i32 1, i32 1, i32 1, i32 1>
  %15 = add nsw <4 x i32> %wide.load41, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %14, ptr %12, align 4, !tbaa !5, !alias.scope !12
  store <4 x i32> %15, ptr %13, align 4, !tbaa !5, !alias.scope !12
  %index.next = add nuw i64 %index, 8
  %16 = icmp eq i64 %index.next, %n.vec
  br i1 %16, label %middle.block, label %vector.body, !llvm.loop !14

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.preheader70

.lr.ph.preheader70:                               ; preds = %middle.block, %vector.memcheck, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader70
  %17 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv.ph
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %17, align 4, !tbaa !5
  %20 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv.ph
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %20, align 4, !tbaa !5
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader70
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %.lr.ph.preheader70 ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %23 = add nsw i64 %wide.trip.count, -1
  %24 = icmp eq i64 %indvars.iv.ph, %23
  br i1 %24, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph ], [ %indvars.iv.unr, %.lr.ph.prol.loopexit ]
  %25 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %25, align 4, !tbaa !5
  %28 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %28, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv.next
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %31, align 4, !tbaa !5
  %34 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv.next
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
  br i1 %exitcond.not.1, label %._crit_edge, label %.lr.ph, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %5
  %37 = sext i32 %0 to i64
  %38 = getelementptr inbounds i32, ptr %1, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.lr.ph22.preheader, label %.preheader

.lr.ph22.preheader:                               ; preds = %._crit_edge
  %wide.trip.count31 = zext nneg i32 %39 to i64
  %min.iters.check44 = icmp ult i32 %39, 8
  br i1 %min.iters.check44, label %.lr.ph22.preheader69, label %vector.ph45

.lr.ph22.preheader69:                             ; preds = %middle.block42, %.lr.ph22.preheader
  %indvars.iv28.ph = phi i64 [ 0, %.lr.ph22.preheader ], [ %n.vec47, %middle.block42 ]
  br label %.lr.ph22

vector.ph45:                                      ; preds = %.lr.ph22.preheader
  %n.vec47 = and i64 %wide.trip.count31, 2147483640
  br label %vector.body49

vector.body49:                                    ; preds = %vector.body49, %vector.ph45
  %index50 = phi i64 [ 0, %vector.ph45 ], [ %index.next53, %vector.body49 ]
  %41 = getelementptr inbounds i32, ptr %2, i64 %index50
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %wide.load51 = load <4 x i32>, ptr %41, align 4, !tbaa !5
  %wide.load52 = load <4 x i32>, ptr %42, align 4, !tbaa !5
  %43 = add nsw <4 x i32> %wide.load51, <i32 1, i32 1, i32 1, i32 1>
  %44 = add nsw <4 x i32> %wide.load52, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %43, ptr %41, align 4, !tbaa !5
  store <4 x i32> %44, ptr %42, align 4, !tbaa !5
  %index.next53 = add nuw i64 %index50, 8
  %45 = icmp eq i64 %index.next53, %n.vec47
  br i1 %45, label %middle.block42, label %vector.body49, !llvm.loop !19

middle.block42:                                   ; preds = %vector.body49
  %cmp.n54 = icmp eq i64 %n.vec47, %wide.trip.count31
  br i1 %cmp.n54, label %.preheader, label %.lr.ph22.preheader69

.preheader:                                       ; preds = %.lr.ph22, %middle.block42, %._crit_edge
  %.not23 = icmp slt i32 %0, 0
  br i1 %.not23, label %._crit_edge26, label %.lr.ph25.preheader

.lr.ph25.preheader:                               ; preds = %.preheader
  %46 = add nuw i32 %0, 1
  %wide.trip.count36 = zext i32 %46 to i64
  %min.iters.check57 = icmp ult i32 %0, 7
  br i1 %min.iters.check57, label %.lr.ph25.preheader68, label %vector.ph58

.lr.ph25.preheader68:                             ; preds = %middle.block55, %.lr.ph25.preheader
  %indvars.iv33.ph = phi i64 [ 0, %.lr.ph25.preheader ], [ %n.vec60, %middle.block55 ]
  br label %.lr.ph25

vector.ph58:                                      ; preds = %.lr.ph25.preheader
  %n.vec60 = and i64 %wide.trip.count36, 4294967288
  br label %vector.body62

vector.body62:                                    ; preds = %vector.body62, %vector.ph58
  %index63 = phi i64 [ 0, %vector.ph58 ], [ %index.next66, %vector.body62 ]
  %47 = getelementptr inbounds i32, ptr %1, i64 %index63
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  %wide.load64 = load <4 x i32>, ptr %47, align 4, !tbaa !5
  %wide.load65 = load <4 x i32>, ptr %48, align 4, !tbaa !5
  %49 = add nsw <4 x i32> %wide.load64, <i32 1, i32 1, i32 1, i32 1>
  %50 = add nsw <4 x i32> %wide.load65, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %49, ptr %47, align 4, !tbaa !5
  store <4 x i32> %50, ptr %48, align 4, !tbaa !5
  %index.next66 = add nuw i64 %index63, 8
  %51 = icmp eq i64 %index.next66, %n.vec60
  br i1 %51, label %middle.block55, label %vector.body62, !llvm.loop !20

middle.block55:                                   ; preds = %vector.body62
  %cmp.n67 = icmp eq i64 %n.vec60, %wide.trip.count36
  br i1 %cmp.n67, label %._crit_edge26, label %.lr.ph25.preheader68

.lr.ph22:                                         ; preds = %.lr.ph22.preheader69, %.lr.ph22
  %indvars.iv28 = phi i64 [ %indvars.iv.next29, %.lr.ph22 ], [ %indvars.iv28.ph, %.lr.ph22.preheader69 ]
  %52 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv28
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %52, align 4, !tbaa !5
  %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
  %exitcond32.not = icmp eq i64 %indvars.iv.next29, %wide.trip.count31
  br i1 %exitcond32.not, label %.preheader, label %.lr.ph22, !llvm.loop !21

.lr.ph25:                                         ; preds = %.lr.ph25.preheader68, %.lr.ph25
  %indvars.iv33 = phi i64 [ %indvars.iv.next34, %.lr.ph25 ], [ %indvars.iv33.ph, %.lr.ph25.preheader68 ]
  %55 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv33
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %55, align 4, !tbaa !5
  %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
  %exitcond37.not = icmp eq i64 %indvars.iv.next34, %wide.trip.count36
  br i1 %exitcond37.not, label %._crit_edge26, label %.lr.ph25, !llvm.loop !22

._crit_edge26:                                    ; preds = %.lr.ph25, %middle.block55, %.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 = !{!10}
!10 = distinct !{!10, !11}
!11 = distinct !{!11, !"LVerDomain"}
!12 = !{!13}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !15, !16, !17}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !15, !16}
!19 = distinct !{!19, !15, !16, !17}
!20 = distinct !{!20, !15, !16, !17}
!21 = distinct !{!21, !15, !17, !16}
!22 = distinct !{!22, !15, !17, !16}


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