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

; 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"

%struct.graph_t = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, i32, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind uwtable
define dso_local float @libmetis__ComputeLoadImbalanceDiffVec(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %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
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.graph_t, ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !11
  store i32 %19, ptr %13, align 4, !tbaa !9
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.graph_t, ptr %20, i32 0, i32 20
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  store ptr %22, ptr %14, align 8, !tbaa !5
  store float -1.000000e+00, ptr %16, align 4, !tbaa !14
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %113, %5
  %24 = load i32, ptr %11, align 4, !tbaa !9
  %25 = load i32, ptr %13, align 4, !tbaa !9
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %27, label %116

27:                                               ; preds = %23
  %28 = load ptr, ptr %14, align 8, !tbaa !5
  %29 = load i32, ptr %11, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr %28, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = sitofp i32 %32 to float
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds float, ptr %34, i64 %36
  %38 = load float, ptr %37, align 4, !tbaa !14
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = load i32, ptr %11, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds float, ptr %39, i64 %41
  %43 = load float, ptr %42, align 4, !tbaa !14
  %44 = fneg float %43
  %45 = call float @llvm.fmuladd.f32(float %33, float %38, float %44)
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = load i32, ptr %11, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds float, ptr %46, i64 %48
  store float %45, ptr %49, align 4, !tbaa !14
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %95, %27
  %51 = load i32, ptr %12, align 4, !tbaa !9
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %54, label %98

54:                                               ; preds = %50
  %55 = load ptr, ptr %14, align 8, !tbaa !5
  %56 = load i32, ptr %12, align 4, !tbaa !9
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = mul nsw i32 %56, %57
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = add nsw i32 %58, %59
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i32, ptr %55, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = sitofp i32 %63 to float
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = load i32, ptr %12, align 4, !tbaa !9
  %67 = load i32, ptr %13, align 4, !tbaa !9
  %68 = mul nsw i32 %66, %67
  %69 = load i32, ptr %11, align 4, !tbaa !9
  %70 = add nsw i32 %68, %69
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds float, ptr %65, i64 %71
  %73 = load float, ptr %72, align 4, !tbaa !14
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds float, ptr %74, i64 %76
  %78 = load float, ptr %77, align 4, !tbaa !14
  %79 = fneg float %78
  %80 = call float @llvm.fmuladd.f32(float %64, float %73, float %79)
  store float %80, ptr %15, align 4, !tbaa !14
  %81 = load float, ptr %15, align 4, !tbaa !14
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = load i32, ptr %11, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds float, ptr %82, i64 %84
  %86 = load float, ptr %85, align 4, !tbaa !14
  %87 = fcmp ogt float %81, %86
  br i1 %87, label %88, label %94

88:                                               ; preds = %54
  %89 = load float, ptr %15, align 4, !tbaa !14
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds float, ptr %90, i64 %92
  store float %89, ptr %93, align 4, !tbaa !14
  br label %94

94:                                               ; preds = %88, %54
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %12, align 4, !tbaa !9
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %12, align 4, !tbaa !9
  br label %50, !llvm.loop !16

98:                                               ; preds = %50
  %99 = load float, ptr %16, align 4, !tbaa !14
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds float, ptr %100, i64 %102
  %104 = load float, ptr %103, align 4, !tbaa !14
  %105 = fcmp olt float %99, %104
  br i1 %105, label %106, label %112

106:                                              ; preds = %98
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds float, ptr %107, i64 %109
  %111 = load float, ptr %110, align 4, !tbaa !14
  store float %111, ptr %16, align 4, !tbaa !14
  br label %112

112:                                              ; preds = %106, %98
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %11, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %11, align 4, !tbaa !9
  br label %23, !llvm.loop !18

116:                                              ; preds = %23
  %117 = load float, ptr %16, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  ret float %117
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"graph_t", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !6, i64 96, !6, i64 104, !10, i64 112, !10, i64 116, !6, i64 120, !6, i64 128, !10, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208}
!13 = !{!12, !6, i64 128}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local float @libmetis__ComputeLoadImbalanceDiffVec(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 128
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = icmp sgt i32 %7, 0
  br i1 %10, label %.lr.ph46, label %._crit_edge47

.lr.ph46:                                         ; preds = %5
  %11 = icmp sgt i32 %1, 1
  %12 = zext nneg i32 %7 to i64
  br i1 %11, label %.lr.ph.us.preheader, label %.lr.ph46.split

.lr.ph.us.preheader:                              ; preds = %.lr.ph46
  %wide.trip.count53 = zext nneg i32 %1 to i64
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %indvars.iv55 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next56, %._crit_edge.us ]
  %.044.us = phi float [ -1.000000e+00, %.lr.ph.us.preheader ], [ %.1.us, %._crit_edge.us ]
  %13 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv55
  %14 = load i32, ptr %13, align 4, !tbaa !12
  %15 = sitofp i32 %14 to float
  %16 = getelementptr inbounds float, ptr %2, i64 %indvars.iv55
  %17 = load float, ptr %16, align 4, !tbaa !13
  %18 = getelementptr inbounds float, ptr %3, i64 %indvars.iv55
  %19 = load float, ptr %18, align 4, !tbaa !13
  %20 = fneg float %19
  %21 = tail call float @llvm.fmuladd.f32(float %15, float %17, float %20)
  %22 = getelementptr inbounds float, ptr %4, i64 %indvars.iv55
  store float %21, ptr %22, align 4, !tbaa !13
  br label %23

23:                                               ; preds = %.lr.ph.us, %37
  %24 = phi float [ %21, %.lr.ph.us ], [ %38, %37 ]
  %indvars.iv50 = phi i64 [ 1, %.lr.ph.us ], [ %indvars.iv.next51, %37 ]
  %25 = mul nuw nsw i64 %indvars.iv50, %12
  %26 = add nuw nsw i64 %25, %indvars.iv55
  %27 = getelementptr inbounds i32, ptr %9, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !12
  %29 = sitofp i32 %28 to float
  %30 = getelementptr inbounds float, ptr %2, i64 %26
  %31 = load float, ptr %30, align 4, !tbaa !13
  %32 = load float, ptr %18, align 4, !tbaa !13
  %33 = fneg float %32
  %34 = tail call float @llvm.fmuladd.f32(float %29, float %31, float %33)
  %35 = fcmp ogt float %34, %24
  br i1 %35, label %36, label %37

36:                                               ; preds = %23
  store float %34, ptr %22, align 4, !tbaa !13
  br label %37

37:                                               ; preds = %36, %23
  %38 = phi float [ %34, %36 ], [ %24, %23 ]
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %exitcond54.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count53
  br i1 %exitcond54.not, label %._crit_edge.us, label %23, !llvm.loop !15

._crit_edge.us:                                   ; preds = %37
  %39 = fcmp olt float %.044.us, %38
  %.1.us = select i1 %39, float %38, float %.044.us
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond59.not = icmp eq i64 %indvars.iv.next56, %12
  br i1 %exitcond59.not, label %._crit_edge47, label %.lr.ph.us, !llvm.loop !17

.lr.ph46.split:                                   ; preds = %.lr.ph46, %.lr.ph46.split
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph46.split ], [ 0, %.lr.ph46 ]
  %.044 = phi float [ %.1, %.lr.ph46.split ], [ -1.000000e+00, %.lr.ph46 ]
  %40 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv
  %41 = load i32, ptr %40, align 4, !tbaa !12
  %42 = sitofp i32 %41 to float
  %43 = getelementptr inbounds float, ptr %2, i64 %indvars.iv
  %44 = load float, ptr %43, align 4, !tbaa !13
  %45 = getelementptr inbounds float, ptr %3, i64 %indvars.iv
  %46 = load float, ptr %45, align 4, !tbaa !13
  %47 = fneg float %46
  %48 = tail call float @llvm.fmuladd.f32(float %42, float %44, float %47)
  %49 = getelementptr inbounds float, ptr %4, i64 %indvars.iv
  store float %48, ptr %49, align 4, !tbaa !13
  %50 = fcmp olt float %.044, %48
  %.1 = select i1 %50, float %48, float %.044
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %12
  br i1 %exitcond.not, label %._crit_edge47, label %.lr.ph46.split, !llvm.loop !17

._crit_edge47:                                    ; preds = %.lr.ph46.split, %._crit_edge.us, %5
  %.0.lcssa = phi float [ -1.000000e+00, %5 ], [ %.1.us, %._crit_edge.us ], [ %.1, %.lr.ph46.split ]
  ret float %.0.lcssa
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) 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, !7, i64 8}
!6 = !{!"graph_t", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !7, i64 88, !10, i64 96, !10, i64 104, !7, i64 112, !7, i64 116, !10, i64 120, !10, i64 128, !7, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 128}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass