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

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

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

declare ptr @libmetis__SetupCtrl(i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare ptr @libmetis__SetupGraph(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

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

declare void @libmetis__FreeCtrl(ptr noundef) #1

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

declare void @libmetis__FreeGraph(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @METIS_ComputeVertexSeparator(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #2 {
  %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 ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %21 = load ptr, ptr %13, align 8, !tbaa !5
  %22 = call ptr @libmetis__SetupCtrl(i32 noundef 2, ptr noundef %21, i32 noundef 1, i32 noundef 3, ptr noundef null, ptr noundef null)
  store ptr %22, ptr %19, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %7
  store i32 -2, ptr %8, align 4
  store i32 1, ptr %20, align 4
  br label %56

25:                                               ; preds = %7
  %26 = load ptr, ptr %19, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ctrl_t, ptr %26, i32 0, i32 15
  %28 = load i32, ptr %27, align 4, !tbaa !9
  call void @libmetis__InitRandom(i32 noundef %28)
  %29 = load ptr, ptr %19, align 8, !tbaa !5
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = load i32, ptr %30, align 4, !tbaa !15
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = call ptr @libmetis__SetupGraph(ptr noundef %29, i32 noundef %31, i32 noundef 1, ptr noundef %32, ptr noundef %33, ptr noundef %34, ptr noundef null, ptr noundef null)
  store ptr %35, ptr %18, align 8, !tbaa !5
  %36 = load ptr, ptr %19, align 8, !tbaa !5
  %37 = load ptr, ptr %18, align 8, !tbaa !5
  call void @libmetis__AllocateWorkSpace(ptr noundef %36, ptr noundef %37)
  %38 = load ptr, ptr %19, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ctrl_t, ptr %38, i32 0, i32 6
  store i32 100, ptr %39, align 8, !tbaa !16
  %40 = load ptr, ptr %19, align 8, !tbaa !5
  %41 = load ptr, ptr %18, align 8, !tbaa !5
  call void @libmetis__MlevelNodeBisectionMultiple(ptr noundef %40, ptr noundef %41)
  %42 = load ptr, ptr %18, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.graph_t, ptr %42, i32 0, i32 20
  %44 = load ptr, ptr %43, align 8, !tbaa !17
  %45 = getelementptr inbounds i32, ptr %44, i64 2
  %46 = load i32, ptr %45, align 4, !tbaa !15
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 %46, ptr %47, align 4, !tbaa !15
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = load i32, ptr %48, align 4, !tbaa !15
  %50 = sext i32 %49 to i64
  %51 = load ptr, ptr %18, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.graph_t, ptr %51, i32 0, i32 19
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = load ptr, ptr %15, align 8, !tbaa !5
  %55 = call ptr @libmetis__icopy(i64 noundef %50, ptr noundef %53, ptr noundef %54)
  call void @libmetis__FreeGraph(ptr noundef %18)
  call void @libmetis__FreeCtrl(ptr noundef %19)
  store i32 1, ptr %8, align 4
  store i32 1, ptr %20, align 4
  br label %56

56:                                               ; preds = %25, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  %57 = load i32, ptr %8, align 4
  ret i32 %57
}

declare void @libmetis__InitRandom(i32 noundef) #1

declare ptr @libmetis__icopy(i64 noundef, ptr noundef, 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, !11, i64 60}
!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 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 24}
!17 = !{!18, !6, i64 128}
!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 = !{!18, !6, i64 120}


; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare ptr @libmetis__SetupCtrl(i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @libmetis__SetupGraph(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @libmetis__FreeCtrl(ptr noundef) local_unnamed_addr #1

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

declare void @libmetis__FreeGraph(ptr noundef) local_unnamed_addr #1

declare void @libmetis__MlevelNodeBisectionMultiple(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -2, 2) i32 @METIS_ComputeVertexSeparator(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr nocapture noundef writeonly %5, ptr noundef %6) local_unnamed_addr #2 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  %10 = tail call ptr @libmetis__SetupCtrl(i32 noundef 2, ptr noundef %4, i32 noundef 1, i32 noundef 3, ptr noundef null, ptr noundef null) #3
  store ptr %10, ptr %9, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %27, label %12

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %10, i64 60
  %14 = load i32, ptr %13, align 4, !tbaa !9
  tail call void @libmetis__InitRandom(i32 noundef %14) #3
  %15 = load i32, ptr %0, align 4, !tbaa !15
  %16 = tail call ptr @libmetis__SetupGraph(ptr noundef nonnull %10, i32 noundef %15, i32 noundef 1, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef null, ptr noundef null) #3
  store ptr %16, ptr %8, align 8, !tbaa !5
  tail call void @libmetis__AllocateWorkSpace(ptr noundef nonnull %10, ptr noundef %16) #3
  %17 = getelementptr inbounds i8, ptr %10, i64 24
  store i32 100, ptr %17, align 8, !tbaa !16
  tail call void @libmetis__MlevelNodeBisectionMultiple(ptr noundef nonnull %10, ptr noundef %16) #3
  %18 = getelementptr inbounds i8, ptr %16, i64 128
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = load i32, ptr %20, align 4, !tbaa !15
  store i32 %21, ptr %5, align 4, !tbaa !15
  %22 = load i32, ptr %0, align 4, !tbaa !15
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i8, ptr %16, i64 120
  %25 = load ptr, ptr %24, align 8, !tbaa !19
  %26 = tail call ptr @libmetis__icopy(i64 noundef %23, ptr noundef %25, ptr noundef %6) #3
  call void @libmetis__FreeGraph(ptr noundef nonnull %8) #3
  call void @libmetis__FreeCtrl(ptr noundef nonnull %9) #3
  br label %27

27:                                               ; preds = %7, %12
  %.0 = phi i32 [ 1, %12 ], [ -2, %7 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  ret i32 %.0
}

declare void @libmetis__InitRandom(i32 noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress 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, !11, i64 60}
!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 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 24}
!17 = !{!18, !6, i64 128}
!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 = !{!18, !6, i64 120}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass