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

; 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.ctrl_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, float, ptr, ptr, ptr, float, double, double, double, double, double, double, double, double, double, double, double, double, ptr, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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 }

@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare void @gk_errexit(i32 noundef, ptr noundef, ...) #1

declare void @libmetis__AllocateWorkSpace(ptr noundef, ptr noundef) #1

declare double @gk_CPUSeconds() #1

; Function Attrs: nounwind uwtable
define dso_local i32 @libmetis__MlevelKWayPartitioning(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store float 0.000000e+00, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store float 0.000000e+00, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %140, %3
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ctrl_t, ptr %18, i32 0, i32 16
  %20 = load i32, ptr %19, align 8, !tbaa !13
  %21 = icmp slt i32 %17, %20
  br i1 %21, label %22, label %143

22:                                               ; preds = %16
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call ptr @libmetis__CoarsenGraph(ptr noundef %23, ptr noundef %24)
  store ptr %25, ptr %14, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ctrl_t, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 8, !tbaa !17
  %29 = and i32 %28, 2
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %37

31:                                               ; preds = %22
  %32 = call double @gk_CPUSeconds()
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ctrl_t, ptr %33, i32 0, i32 28
  %35 = load double, ptr %34, align 8, !tbaa !18
  %36 = fsub double %35, %32
  store double %36, ptr %34, align 8, !tbaa !18
  br label %37

37:                                               ; preds = %31, %22
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  call void @libmetis__AllocateKWayPartitionMemory(ptr noundef %38, ptr noundef %39)
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  call void @libmetis__FreeWorkSpace(ptr noundef %40)
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  call void @libmetis__InitKWayPartitioning(ptr noundef %41, ptr noundef %42)
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  call void @libmetis__AllocateWorkSpace(ptr noundef %43, ptr noundef %44)
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.graph_t, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !19
  %49 = mul nsw i32 2, %48
  call void @libmetis__AllocateRefinementWorkSpace(ptr noundef %45, i32 noundef %49)
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ctrl_t, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 8, !tbaa !17
  %53 = and i32 %52, 2
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %61

55:                                               ; preds = %37
  %56 = call double @gk_CPUSeconds()
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ctrl_t, ptr %57, i32 0, i32 28
  %59 = load double, ptr %58, align 8, !tbaa !18
  %60 = fadd double %59, %56
  store double %60, ptr %58, align 8, !tbaa !18
  br label %61

61:                                               ; preds = %55, %37
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ctrl_t, ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 8, !tbaa !17
  %65 = and i32 %64, 16
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %73

67:                                               ; preds = %61
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.ctrl_t, ptr %68, i32 0, i32 21
  %70 = load i32, ptr %69, align 4, !tbaa !21
  %71 = load i32, ptr %9, align 4, !tbaa !9
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %70, i32 noundef %71)
  br label %73

73:                                               ; preds = %67, %61
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  call void @libmetis__RefineKWay(ptr noundef %74, ptr noundef %75, ptr noundef %76)
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ctrl_t, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 4, !tbaa !22
  switch i32 %79, label %88 [
    i32 0, label %80
    i32 1, label %84
  ]

80:                                               ; preds = %73
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.graph_t, ptr %81, i32 0, i32 17
  %83 = load i32, ptr %82, align 8, !tbaa !23
  store i32 %83, ptr %10, align 4, !tbaa !9
  br label %92

84:                                               ; preds = %73
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.graph_t, ptr %85, i32 0, i32 18
  %87 = load i32, ptr %86, align 4, !tbaa !24
  store i32 %87, ptr %10, align 4, !tbaa !9
  br label %92

88:                                               ; preds = %73
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.ctrl_t, ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 4, !tbaa !22
  call void (i32, ptr, ...) @gk_errexit(i32 noundef 15, ptr noundef @.str.2, i32 noundef %91)
  br label %92

92:                                               ; preds = %88, %84, %80
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.ctrl_t, ptr %94, i32 0, i32 21
  %96 = load i32, ptr %95, align 4, !tbaa !21
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.ctrl_t, ptr %97, i32 0, i32 25
  %99 = load ptr, ptr %98, align 8, !tbaa !25
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ctrl_t, ptr %100, i32 0, i32 23
  %102 = load ptr, ptr %101, align 8, !tbaa !26
  %103 = call float @libmetis__ComputeLoadImbalanceDiff(ptr noundef %93, i32 noundef %96, ptr noundef %99, ptr noundef %102)
  store float %103, ptr %12, align 4, !tbaa !11
  %104 = load i32, ptr %7, align 4, !tbaa !9
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %122, label %106

106:                                              ; preds = %92
  %107 = load float, ptr %12, align 4, !tbaa !11
  %108 = fpext float %107 to double
  %109 = fcmp ole double %108, 5.000000e-04
  br i1 %109, label %110, label %114

110:                                              ; preds = %106
  %111 = load i32, ptr %11, align 4, !tbaa !9
  %112 = load i32, ptr %10, align 4, !tbaa !9
  %113 = icmp sgt i32 %111, %112
  br i1 %113, label %122, label %114

114:                                              ; preds = %110, %106
  %115 = load float, ptr %13, align 4, !tbaa !11
  %116 = fpext float %115 to double
  %117 = fcmp ogt double %116, 5.000000e-04
  br i1 %117, label %118, label %134

118:                                              ; preds = %114
  %119 = load float, ptr %12, align 4, !tbaa !11
  %120 = load float, ptr %13, align 4, !tbaa !11
  %121 = fcmp olt float %119, %120
  br i1 %121, label %122, label %134

122:                                              ; preds = %118, %110, %92
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.graph_t, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 8, !tbaa !27
  %126 = sext i32 %125 to i64
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.graph_t, ptr %127, i32 0, i32 19
  %129 = load ptr, ptr %128, align 8, !tbaa !28
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = call ptr @libmetis__icopy(i64 noundef %126, ptr noundef %129, ptr noundef %130)
  %132 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %132, ptr %11, align 4, !tbaa !9
  %133 = load float, ptr %12, align 4, !tbaa !11
  store float %133, ptr %13, align 4, !tbaa !11
  br label %134

134:                                              ; preds = %122, %118, %114
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  call void @libmetis__FreeRData(ptr noundef %135)
  %136 = load i32, ptr %11, align 4, !tbaa !9
  %137 = icmp eq i32 %136, 0
  br i1 %137, label %138, label %139

138:                                              ; preds = %134
  br label %143

139:                                              ; preds = %134
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %7, align 4, !tbaa !9
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %7, align 4, !tbaa !9
  br label %16, !llvm.loop !29

143:                                              ; preds = %138, %16
  call void @libmetis__FreeGraph(ptr noundef %5)
  %144 = load i32, ptr %11, align 4, !tbaa !9
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 %144
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare ptr @libmetis__CoarsenGraph(ptr noundef, ptr noundef) #1

declare void @libmetis__AllocateKWayPartitionMemory(ptr noundef, ptr noundef) #1

declare void @libmetis__FreeWorkSpace(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__InitKWayPartitioning(ptr noundef, ptr noundef) #2

declare void @libmetis__AllocateRefinementWorkSpace(ptr noundef, i32 noundef) #1

declare i32 @printf(ptr noundef, ...) #1

declare void @libmetis__RefineKWay(ptr noundef, ptr noundef, ptr noundef) #1

declare float @libmetis__ComputeLoadImbalanceDiff(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare ptr @libmetis__icopy(i64 noundef, ptr noundef, ptr noundef) #1

declare void @libmetis__FreeRData(ptr noundef) #1

declare void @libmetis__FreeGraph(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 64}
!14 = !{!"ctrl_t", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !6, i64 80, !10, i64 88, !10, i64 92, !12, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !12, i64 128, !15, i64 136, !15, i64 144, !15, i64 152, !15, i64 160, !15, i64 168, !15, i64 176, !15, i64 184, !15, i64 192, !15, i64 200, !15, i64 208, !15, i64 216, !15, i64 224, !6, i64 232, !16, i64 240, !16, i64 248, !16, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320}
!15 = !{!"double", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!14, !10, i64 8}
!18 = !{!14, !15, i64 144}
!19 = !{!20, !10, i64 4}
!20 = !{!"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}
!21 = !{!14, !10, i64 92}
!22 = !{!14, !10, i64 4}
!23 = !{!20, !10, i64 112}
!24 = !{!20, !10, i64 116}
!25 = !{!14, !6, i64 120}
!26 = !{!14, !6, i64 104}
!27 = !{!20, !10, i64 0}
!28 = !{!20, !6, i64 120}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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

@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1

declare void @gk_errexit(i32 noundef, ptr noundef, ...) local_unnamed_addr #0

declare void @libmetis__AllocateWorkSpace(ptr noundef, ptr noundef) local_unnamed_addr #0

declare double @gk_CPUSeconds() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @libmetis__MlevelKWayPartitioning(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = alloca ptr, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = getelementptr inbounds i8, ptr %0, i64 144
  %10 = getelementptr inbounds i8, ptr %0, i64 92
  %11 = getelementptr inbounds i8, ptr %0, i64 4
  %12 = getelementptr inbounds i8, ptr %1, i64 116
  %13 = getelementptr inbounds i8, ptr %1, i64 112
  %14 = getelementptr inbounds i8, ptr %0, i64 120
  %15 = getelementptr inbounds i8, ptr %0, i64 104
  %16 = getelementptr inbounds i8, ptr %1, i64 120
  %17 = tail call ptr @libmetis__CoarsenGraph(ptr noundef nonnull %0, ptr noundef %1) #3
  %18 = load i32, ptr %8, align 8, !tbaa !15
  %19 = and i32 %18, 2
  %.not.peel = icmp eq i32 %19, 0
  br i1 %.not.peel, label %24, label %20

20:                                               ; preds = %.lr.ph
  %21 = tail call double @gk_CPUSeconds() #3
  %22 = load double, ptr %9, align 8, !tbaa !16
  %23 = fsub double %22, %21
  store double %23, ptr %9, align 8, !tbaa !16
  br label %24

24:                                               ; preds = %20, %.lr.ph
  tail call void @libmetis__AllocateKWayPartitionMemory(ptr noundef nonnull %0, ptr noundef %17) #3
  tail call void @libmetis__FreeWorkSpace(ptr noundef nonnull %0) #3
  tail call void @libmetis__InitKWayPartitioning(ptr noundef nonnull %0, ptr noundef %17)
  tail call void @libmetis__AllocateWorkSpace(ptr noundef nonnull %0, ptr noundef %1) #3
  %25 = getelementptr inbounds i8, ptr %17, i64 4
  %26 = load i32, ptr %25, align 4, !tbaa !17
  %27 = shl nsw i32 %26, 1
  tail call void @libmetis__AllocateRefinementWorkSpace(ptr noundef nonnull %0, i32 noundef %27) #3
  %28 = load i32, ptr %8, align 8, !tbaa !15
  %29 = and i32 %28, 2
  %.not42.peel = icmp eq i32 %29, 0
  br i1 %.not42.peel, label %34, label %30

30:                                               ; preds = %24
  %31 = tail call double @gk_CPUSeconds() #3
  %32 = load double, ptr %9, align 8, !tbaa !16
  %33 = fadd double %31, %32
  store double %33, ptr %9, align 8, !tbaa !16
  %.pre = load i32, ptr %8, align 8, !tbaa !15
  br label %34

34:                                               ; preds = %30, %24
  %35 = phi i32 [ %.pre, %30 ], [ %28, %24 ]
  %36 = and i32 %35, 16
  %.not43.peel = icmp eq i32 %36, 0
  br i1 %.not43.peel, label %40, label %37

37:                                               ; preds = %34
  %38 = load i32, ptr %10, align 4, !tbaa !19
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %38, i32 noundef 0)
  br label %40

40:                                               ; preds = %37, %34
  tail call void @libmetis__RefineKWay(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %17) #3
  %41 = load i32, ptr %11, align 4, !tbaa !20
  switch i32 %41, label %46 [
    i32 0, label %44
    i32 1, label %42
  ]

42:                                               ; preds = %40
  %43 = load i32, ptr %12, align 4, !tbaa !21
  br label %47

44:                                               ; preds = %40
  %45 = load i32, ptr %13, align 8, !tbaa !22
  br label %47

46:                                               ; preds = %40
  tail call void (i32, ptr, ...) @gk_errexit(i32 noundef 15, ptr noundef nonnull @.str.2, i32 noundef %41) #3
  br label %47

47:                                               ; preds = %46, %44, %42
  %.1.peel = phi i32 [ 0, %46 ], [ %43, %42 ], [ %45, %44 ]
  %48 = load i32, ptr %10, align 4, !tbaa !19
  %49 = load ptr, ptr %14, align 8, !tbaa !23
  %50 = load ptr, ptr %15, align 8, !tbaa !24
  %51 = tail call float @libmetis__ComputeLoadImbalanceDiff(ptr noundef %1, i32 noundef %48, ptr noundef %49, ptr noundef %50) #3
  %52 = load i32, ptr %1, align 8, !tbaa !25
  %53 = sext i32 %52 to i64
  %54 = load ptr, ptr %16, align 8, !tbaa !26
  %55 = tail call ptr @libmetis__icopy(i64 noundef %53, ptr noundef %54, ptr noundef %2) #3
  tail call void @libmetis__FreeRData(ptr noundef nonnull %1) #3
  %56 = icmp eq i32 %.1.peel, 0
  br i1 %56, label %._crit_edge, label %57

57:                                               ; preds = %47
  %58 = load i32, ptr %5, align 8, !tbaa !9
  %59 = icmp sgt i32 %58, 1
  br i1 %59, label %.peel.next, label %._crit_edge

60:                                               ; preds = %.thread, %106
  %.13960 = phi float [ %.03846, %.thread ], [ %98, %106 ]
  %.14159 = phi i32 [ %.04045, %.thread ], [ %.1, %106 ]
  %61 = add nuw nsw i32 %.048, 1
  %62 = load i32, ptr %5, align 8, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %.peel.next, label %._crit_edge, !llvm.loop !27

.peel.next:                                       ; preds = %57, %60
  %.048 = phi i32 [ %61, %60 ], [ 1, %57 ]
  %.03747 = phi i32 [ %.1, %60 ], [ %.1.peel, %57 ]
  %.03846 = phi float [ %.13960, %60 ], [ %51, %57 ]
  %.04045 = phi i32 [ %.14159, %60 ], [ %.1.peel, %57 ]
  %64 = tail call ptr @libmetis__CoarsenGraph(ptr noundef nonnull %0, ptr noundef nonnull %1) #3
  %65 = load i32, ptr %8, align 8, !tbaa !15
  %66 = and i32 %65, 2
  %.not = icmp eq i32 %66, 0
  br i1 %.not, label %71, label %67

67:                                               ; preds = %.peel.next
  %68 = tail call double @gk_CPUSeconds() #3
  %69 = load double, ptr %9, align 8, !tbaa !16
  %70 = fsub double %69, %68
  store double %70, ptr %9, align 8, !tbaa !16
  br label %71

71:                                               ; preds = %67, %.peel.next
  tail call void @libmetis__AllocateKWayPartitionMemory(ptr noundef nonnull %0, ptr noundef %64) #3
  tail call void @libmetis__FreeWorkSpace(ptr noundef nonnull %0) #3
  tail call void @libmetis__InitKWayPartitioning(ptr noundef nonnull %0, ptr noundef %64)
  tail call void @libmetis__AllocateWorkSpace(ptr noundef nonnull %0, ptr noundef nonnull %1) #3
  %72 = getelementptr inbounds i8, ptr %64, i64 4
  %73 = load i32, ptr %72, align 4, !tbaa !17
  %74 = shl nsw i32 %73, 1
  tail call void @libmetis__AllocateRefinementWorkSpace(ptr noundef nonnull %0, i32 noundef %74) #3
  %75 = load i32, ptr %8, align 8, !tbaa !15
  %76 = and i32 %75, 2
  %.not42 = icmp eq i32 %76, 0
  br i1 %.not42, label %81, label %77

77:                                               ; preds = %71
  %78 = tail call double @gk_CPUSeconds() #3
  %79 = load double, ptr %9, align 8, !tbaa !16
  %80 = fadd double %78, %79
  store double %80, ptr %9, align 8, !tbaa !16
  %.pre55 = load i32, ptr %8, align 8, !tbaa !15
  br label %81

81:                                               ; preds = %77, %71
  %82 = phi i32 [ %.pre55, %77 ], [ %75, %71 ]
  %83 = and i32 %82, 16
  %.not43 = icmp eq i32 %83, 0
  br i1 %.not43, label %87, label %84

84:                                               ; preds = %81
  %85 = load i32, ptr %10, align 4, !tbaa !19
  %86 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %85, i32 noundef 0)
  br label %87

87:                                               ; preds = %84, %81
  tail call void @libmetis__RefineKWay(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %64) #3
  %88 = load i32, ptr %11, align 4, !tbaa !20
  switch i32 %88, label %93 [
    i32 0, label %89
    i32 1, label %91
  ]

89:                                               ; preds = %87
  %90 = load i32, ptr %13, align 8, !tbaa !22
  br label %94

91:                                               ; preds = %87
  %92 = load i32, ptr %12, align 4, !tbaa !21
  br label %94

93:                                               ; preds = %87
  tail call void (i32, ptr, ...) @gk_errexit(i32 noundef 15, ptr noundef nonnull @.str.2, i32 noundef %88) #3
  br label %94

94:                                               ; preds = %89, %91, %93
  %.1 = phi i32 [ %.03747, %93 ], [ %92, %91 ], [ %90, %89 ]
  %95 = load i32, ptr %10, align 4, !tbaa !19
  %96 = load ptr, ptr %14, align 8, !tbaa !23
  %97 = load ptr, ptr %15, align 8, !tbaa !24
  %98 = tail call float @libmetis__ComputeLoadImbalanceDiff(ptr noundef nonnull %1, i32 noundef %95, ptr noundef %96, ptr noundef %97) #3
  %99 = fpext float %98 to double
  %100 = fcmp ole double %99, 5.000000e-04
  %101 = icmp sgt i32 %.04045, %.1
  %or.cond = select i1 %100, i1 %101, i1 false
  br i1 %or.cond, label %106, label %102

102:                                              ; preds = %94
  %103 = fpext float %.03846 to double
  %104 = fcmp ogt double %103, 5.000000e-04
  %105 = fcmp olt float %98, %.03846
  %or.cond44 = and i1 %104, %105
  br i1 %or.cond44, label %106, label %.thread

.thread:                                          ; preds = %102
  tail call void @libmetis__FreeRData(ptr noundef nonnull %1) #3
  br label %60

106:                                              ; preds = %94, %102
  %107 = load i32, ptr %1, align 8, !tbaa !25
  %108 = sext i32 %107 to i64
  %109 = load ptr, ptr %16, align 8, !tbaa !26
  %110 = tail call ptr @libmetis__icopy(i64 noundef %108, ptr noundef %109, ptr noundef %2) #3
  tail call void @libmetis__FreeRData(ptr noundef nonnull %1) #3
  %111 = icmp eq i32 %.1, 0
  br i1 %111, label %._crit_edge, label %60

._crit_edge:                                      ; preds = %60, %106, %47, %57, %3
  %.2 = phi i32 [ 0, %3 ], [ 0, %47 ], [ %.1.peel, %57 ], [ %.14159, %60 ], [ 0, %106 ]
  call void @libmetis__FreeGraph(ptr noundef nonnull %4) #3
  ret i32 %.2
}

declare ptr @libmetis__CoarsenGraph(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @libmetis__AllocateKWayPartitionMemory(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @libmetis__FreeWorkSpace(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__InitKWayPartitioning(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @libmetis__AllocateRefinementWorkSpace(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare void @libmetis__RefineKWay(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare float @libmetis__ComputeLoadImbalanceDiff(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @libmetis__icopy(i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @libmetis__FreeRData(ptr noundef) local_unnamed_addr #0

declare void @libmetis__FreeGraph(ptr noundef) local_unnamed_addr #0

attributes #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 #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 = { nofree nounwind "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, !11, i64 64}
!10 = !{!"ctrl_t", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !6, i64 80, !11, i64 88, !11, i64 92, !12, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !12, i64 128, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !13, i64 176, !13, i64 184, !13, i64 192, !13, i64 200, !13, i64 208, !13, i64 216, !13, i64 224, !6, i64 232, !14, i64 240, !14, i64 248, !14, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !13, i64 144}
!17 = !{!18, !11, i64 4}
!18 = !{!"graph_t", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !6, i64 120, !6, i64 128, !11, 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}
!19 = !{!10, !11, i64 92}
!20 = !{!10, !11, i64 4}
!21 = !{!18, !11, i64 116}
!22 = !{!18, !11, i64 112}
!23 = !{!10, !6, i64 120}
!24 = !{!10, !6, i64 104}
!25 = !{!18, !11, i64 0}
!26 = !{!18, !6, i64 120}
!27 = distinct !{!27, !28, !29}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass