; LLVM IR from GGiecold-zz/Cluster_Ensembles :: src/Cluster_Ensembles/Hypergraph_Partitioning/metis-5.1.0/libmetis (fortran)

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

14:                                               ; preds = %29, %6
  %15 = load i32, ptr %13, align 4, !tbaa !5
  %16 = load ptr, ptr %9, align 8, !tbaa !9
  %17 = load i32, ptr %7, 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 = icmp slt i32 %15, %20
  br i1 %21, label %22, label %32

22:                                               ; preds = %14
  %23 = load ptr, ptr %10, align 8, !tbaa !9
  %24 = load i32, ptr %13, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr %23, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %26, align 4, !tbaa !5
  br label %29

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

32:                                               ; preds = %14
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %44, %32
  %34 = load i32, ptr %13, align 4, !tbaa !5
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %37, label %47

37:                                               ; preds = %33
  %38 = load ptr, ptr %9, align 8, !tbaa !9
  %39 = load i32, ptr %13, 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 %13, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %13, align 4, !tbaa !5
  br label %33, !llvm.loop !13

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

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

52:                                               ; preds = %48
  %53 = load ptr, ptr %11, align 8, !tbaa !9
  %54 = load i32, ptr %13, 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 %13, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %13, align 4, !tbaa !5
  br label %48, !llvm.loop !14

62:                                               ; preds = %48
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %74, %62
  %64 = load i32, ptr %13, align 4, !tbaa !5
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %67, label %77

67:                                               ; preds = %63
  %68 = load ptr, ptr %12, align 8, !tbaa !9
  %69 = load i32, ptr %13, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr %68, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %71, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %67
  %75 = load i32, ptr %13, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %13, align 4, !tbaa !5
  br label %63, !llvm.loop !15

77:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #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}
!15 = distinct !{!15, !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 @libmetis__ChangeMesh2FNumbering2(i32 noundef %0, i32 noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3, ptr nocapture noundef %4, ptr nocapture noundef %5) local_unnamed_addr #0 {
  %7 = sext i32 %0 to i64
  %8 = getelementptr inbounds i32, ptr %2, i64 %7
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.preheader22

.preheader22:                                     ; preds = %.lr.ph, %6
  %.not24 = icmp slt i32 %0, 0
  br i1 %.not24, label %.preheader, label %.lr.ph26.preheader

.lr.ph26.preheader:                               ; preds = %.preheader22
  %11 = add nuw i32 %0, 1
  %wide.trip.count = zext i32 %11 to i64
  %min.iters.check = icmp ult i32 %0, 7
  br i1 %min.iters.check, label %.lr.ph26.preheader74, label %vector.ph

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

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

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %12 = getelementptr inbounds i32, ptr %2, i64 %index
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
  %wide.load45 = load <4 x i32>, ptr %13, align 4, !tbaa !5
  %14 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %15 = add nsw <4 x i32> %wide.load45, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %14, ptr %12, align 4, !tbaa !5
  store <4 x i32> %15, ptr %13, align 4, !tbaa !5
  %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 !9

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

.lr.ph:                                           ; preds = %6, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %6 ]
  %17 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %17, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr %8, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %.preheader22, !llvm.loop !13

.preheader21:                                     ; preds = %.lr.ph26, %middle.block
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %.preheader, label %.lr.ph28.preheader

.lr.ph28.preheader:                               ; preds = %.preheader21
  %wide.trip.count38 = zext nneg i32 %0 to i64
  %min.iters.check48 = icmp ult i32 %0, 8
  br i1 %min.iters.check48, label %.lr.ph28.preheader73, label %vector.ph49

.lr.ph28.preheader73:                             ; preds = %middle.block46, %.lr.ph28.preheader
  %indvars.iv35.ph = phi i64 [ 0, %.lr.ph28.preheader ], [ %n.vec51, %middle.block46 ]
  br label %.lr.ph28

vector.ph49:                                      ; preds = %.lr.ph28.preheader
  %n.vec51 = and i64 %wide.trip.count38, 2147483640
  br label %vector.body53

vector.body53:                                    ; preds = %vector.body53, %vector.ph49
  %index54 = phi i64 [ 0, %vector.ph49 ], [ %index.next57, %vector.body53 ]
  %23 = getelementptr inbounds i32, ptr %4, i64 %index54
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %wide.load55 = load <4 x i32>, ptr %23, align 4, !tbaa !5
  %wide.load56 = load <4 x i32>, ptr %24, align 4, !tbaa !5
  %25 = add nsw <4 x i32> %wide.load55, <i32 1, i32 1, i32 1, i32 1>
  %26 = add nsw <4 x i32> %wide.load56, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %25, ptr %23, align 4, !tbaa !5
  store <4 x i32> %26, ptr %24, align 4, !tbaa !5
  %index.next57 = add nuw i64 %index54, 8
  %27 = icmp eq i64 %index.next57, %n.vec51
  br i1 %27, label %middle.block46, label %vector.body53, !llvm.loop !14

middle.block46:                                   ; preds = %vector.body53
  %cmp.n58 = icmp eq i64 %n.vec51, %wide.trip.count38
  br i1 %cmp.n58, label %.preheader, label %.lr.ph28.preheader73

.lr.ph26:                                         ; preds = %.lr.ph26.preheader74, %.lr.ph26
  %indvars.iv32 = phi i64 [ %indvars.iv.next33, %.lr.ph26 ], [ %indvars.iv32.ph, %.lr.ph26.preheader74 ]
  %28 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv32
  %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.next33 = add nuw nsw i64 %indvars.iv32, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next33, %wide.trip.count
  br i1 %exitcond.not, label %.preheader21, label %.lr.ph26, !llvm.loop !15

.preheader:                                       ; preds = %.lr.ph28, %middle.block46, %.preheader22, %.preheader21
  %31 = icmp sgt i32 %1, 0
  br i1 %31, label %.lr.ph30.preheader, label %._crit_edge

.lr.ph30.preheader:                               ; preds = %.preheader
  %wide.trip.count43 = zext nneg i32 %1 to i64
  %min.iters.check61 = icmp ult i32 %1, 8
  br i1 %min.iters.check61, label %.lr.ph30.preheader72, label %vector.ph62

.lr.ph30.preheader72:                             ; preds = %middle.block59, %.lr.ph30.preheader
  %indvars.iv40.ph = phi i64 [ 0, %.lr.ph30.preheader ], [ %n.vec64, %middle.block59 ]
  br label %.lr.ph30

vector.ph62:                                      ; preds = %.lr.ph30.preheader
  %n.vec64 = and i64 %wide.trip.count43, 2147483640
  br label %vector.body66

vector.body66:                                    ; preds = %vector.body66, %vector.ph62
  %index67 = phi i64 [ 0, %vector.ph62 ], [ %index.next70, %vector.body66 ]
  %32 = getelementptr inbounds i32, ptr %5, i64 %index67
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  %wide.load68 = load <4 x i32>, ptr %32, align 4, !tbaa !5
  %wide.load69 = load <4 x i32>, ptr %33, align 4, !tbaa !5
  %34 = add nsw <4 x i32> %wide.load68, <i32 1, i32 1, i32 1, i32 1>
  %35 = add nsw <4 x i32> %wide.load69, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %34, ptr %32, align 4, !tbaa !5
  store <4 x i32> %35, ptr %33, align 4, !tbaa !5
  %index.next70 = add nuw i64 %index67, 8
  %36 = icmp eq i64 %index.next70, %n.vec64
  br i1 %36, label %middle.block59, label %vector.body66, !llvm.loop !16

middle.block59:                                   ; preds = %vector.body66
  %cmp.n71 = icmp eq i64 %n.vec64, %wide.trip.count43
  br i1 %cmp.n71, label %._crit_edge, label %.lr.ph30.preheader72

.lr.ph28:                                         ; preds = %.lr.ph28.preheader73, %.lr.ph28
  %indvars.iv35 = phi i64 [ %indvars.iv.next36, %.lr.ph28 ], [ %indvars.iv35.ph, %.lr.ph28.preheader73 ]
  %37 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv35
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %37, align 4, !tbaa !5
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %exitcond39.not = icmp eq i64 %indvars.iv.next36, %wide.trip.count38
  br i1 %exitcond39.not, label %.preheader, label %.lr.ph28, !llvm.loop !17

.lr.ph30:                                         ; preds = %.lr.ph30.preheader72, %.lr.ph30
  %indvars.iv40 = phi i64 [ %indvars.iv.next41, %.lr.ph30 ], [ %indvars.iv40.ph, %.lr.ph30.preheader72 ]
  %40 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv40
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !5
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %exitcond44.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count43
  br i1 %exitcond44.not, label %._crit_edge, label %.lr.ph30, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph30, %middle.block59, %.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}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10, !12, !11}


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