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

; 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.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@gk_jbufs = external thread_local global [0 x [1 x %struct.__jmp_buf_tag]], align 8
@gk_cur_jbufs = external thread_local global i32, align 4

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

declare i32 @gk_malloc_init(...) #1

declare i32 @gk_sigtrap(...) #1

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #3

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

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

declare i32 @gk_siguntrap(...) #1

declare void @gk_malloc_cleanup(i32 noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

declare i32 @libmetis__metis_rcode(i32 noundef) #1

; 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 i32 @METIS_MeshToNodal(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #5 {
  %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 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) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !9
  %19 = call i32 (...) @gk_malloc_init()
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %22, label %21

21:                                               ; preds = %7
  store i32 -3, ptr %8, align 4
  store i32 1, ptr %18, align 4
  br label %91

22:                                               ; preds = %7
  %23 = call i32 (...) @gk_sigtrap()
  %24 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @gk_jbufs)
  %25 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @gk_cur_jbufs)
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [0 x [1 x %struct.__jmp_buf_tag]], ptr %24, i64 0, i64 %27
  %29 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %28, i64 0, i64 0
  %30 = call i32 @_setjmp(ptr noundef %29) #7
  store i32 %30, ptr %16, align 4, !tbaa !9
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %22
  br label %53

33:                                               ; preds = %22
  %34 = load ptr, ptr %13, align 8, !tbaa !5
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 1
  br i1 %36, label %37, label %42

37:                                               ; preds = %33
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  call void @libmetis__ChangeMesh2CNumbering(i32 noundef %39, ptr noundef %40, ptr noundef %41)
  store i32 1, ptr %17, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %37, %33
  %43 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr null, ptr %43, align 8, !tbaa !5
  %44 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr null, ptr %44, align 8, !tbaa !5
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  %52 = load ptr, ptr %15, align 8, !tbaa !5
  call void @libmetis__CreateGraphNodal(i32 noundef %46, i32 noundef %48, ptr noundef %49, ptr noundef %50, ptr noundef %51, ptr noundef %52)
  br label %53

53:                                               ; preds = %42, %32
  %54 = load i32, ptr %17, align 4, !tbaa !9
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %67

56:                                               ; preds = %53
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = load ptr, ptr %15, align 8, !tbaa !5
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  call void @libmetis__ChangeMesh2FNumbering(i32 noundef %58, ptr noundef %59, ptr noundef %60, i32 noundef %62, ptr noundef %64, ptr noundef %66)
  br label %67

67:                                               ; preds = %56, %53
  %68 = call i32 (...) @gk_siguntrap()
  call void @gk_malloc_cleanup(i32 noundef 0)
  %69 = load i32, ptr %16, align 4, !tbaa !9
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %88

71:                                               ; preds = %67
  %72 = load ptr, ptr %14, align 8, !tbaa !5
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %78

75:                                               ; preds = %71
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  call void @free(ptr noundef %77) #6
  br label %78

78:                                               ; preds = %75, %71
  %79 = load ptr, ptr %15, align 8, !tbaa !5
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %85

82:                                               ; preds = %78
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = load ptr, ptr %83, align 8, !tbaa !5
  call void @free(ptr noundef %84) #6
  br label %85

85:                                               ; preds = %82, %78
  %86 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr null, ptr %86, align 8, !tbaa !5
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr null, ptr %87, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %85, %67
  %89 = load i32, ptr %16, align 4, !tbaa !9
  %90 = call i32 @libmetis__metis_rcode(i32 noundef %89)
  store i32 %90, ptr %8, align 4
  store i32 1, ptr %18, align 4
  br label %91

91:                                               ; preds = %88, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  %92 = load i32, ptr %8, align 4
  ret i32 %92
}

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__CreateGraphNodal(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

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 returns_twice "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind returns_twice }

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


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

%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@gk_jbufs = external thread_local global [0 x [1 x %struct.__jmp_buf_tag]], align 8
@gk_cur_jbufs = external thread_local local_unnamed_addr global i32, align 4

declare i32 @gk_malloc_init(...) local_unnamed_addr #0

declare i32 @gk_sigtrap(...) local_unnamed_addr #0

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #2

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

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

declare i32 @gk_siguntrap(...) local_unnamed_addr #0

declare void @gk_malloc_cleanup(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

declare i32 @libmetis__metis_rcode(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @METIS_MeshToNodal(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr noundef %2, ptr noundef %3, ptr nocapture noundef readonly %4, ptr noundef %5, ptr noundef %6) local_unnamed_addr #4 {
  %8 = call i32 (...) @gk_malloc_init() #5
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %40, label %9

9:                                                ; preds = %7
  %10 = call i32 (...) @gk_sigtrap() #5
  %11 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @gk_jbufs)
  %12 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @gk_cur_jbufs)
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [0 x [1 x %struct.__jmp_buf_tag]], ptr %11, i64 0, i64 %14
  %16 = call i32 @_setjmp(ptr noundef nonnull %15) #6
  %.not30 = icmp eq i32 %16, 0
  br i1 %.not30, label %17, label %30

17:                                               ; preds = %9
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %.not36 = icmp eq i32 %18, 1
  br i1 %.not36, label %19, label %.critedge.critedge

19:                                               ; preds = %17
  %20 = load i32, ptr %0, align 4, !tbaa !5
  call void @libmetis__ChangeMesh2CNumbering(i32 noundef %20, ptr noundef %2, ptr noundef %3) #5
  store ptr null, ptr %6, align 8, !tbaa !9
  store ptr null, ptr %5, align 8, !tbaa !9
  %21 = load i32, ptr %0, align 4, !tbaa !5
  %22 = load i32, ptr %1, align 4, !tbaa !5
  call void @libmetis__CreateGraphNodal(i32 noundef %21, i32 noundef %22, ptr noundef %2, ptr noundef %3, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %23 = load i32, ptr %0, align 4, !tbaa !5
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  call void @libmetis__ChangeMesh2FNumbering(i32 noundef %23, ptr noundef %2, ptr noundef %3, i32 noundef %24, ptr noundef %25, ptr noundef %26) #5
  br label %.critedge

.critedge.critedge:                               ; preds = %17
  store ptr null, ptr %6, align 8, !tbaa !9
  store ptr null, ptr %5, align 8, !tbaa !9
  %27 = load i32, ptr %0, align 4, !tbaa !5
  %28 = load i32, ptr %1, align 4, !tbaa !5
  call void @libmetis__CreateGraphNodal(i32 noundef %27, i32 noundef %28, ptr noundef %2, ptr noundef %3, ptr noundef nonnull %5, ptr noundef nonnull %6)
  br label %.critedge

.critedge:                                        ; preds = %.critedge.critedge, %19
  %29 = call i32 (...) @gk_siguntrap() #5
  call void @gk_malloc_cleanup(i32 noundef 0) #5
  br label %38

30:                                               ; preds = %9
  %31 = call i32 (...) @gk_siguntrap() #5
  call void @gk_malloc_cleanup(i32 noundef 0) #5
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %.not32 = icmp eq ptr %32, null
  br i1 %.not32, label %34, label %33

33:                                               ; preds = %30
  call void @free(ptr noundef nonnull %32) #5
  br label %34

34:                                               ; preds = %33, %30
  %35 = load ptr, ptr %6, align 8, !tbaa !9
  %.not33 = icmp eq ptr %35, null
  br i1 %.not33, label %37, label %36

36:                                               ; preds = %34
  call void @free(ptr noundef nonnull %35) #5
  br label %37

37:                                               ; preds = %36, %34
  store ptr null, ptr %6, align 8, !tbaa !9
  store ptr null, ptr %5, align 8, !tbaa !9
  br label %38

38:                                               ; preds = %.critedge, %37
  %39 = call i32 @libmetis__metis_rcode(i32 noundef %16) #5
  br label %40

40:                                               ; preds = %7, %38
  %.027 = phi i32 [ %39, %38 ], [ -3, %7 ]
  ret i32 %.027
}

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__CreateGraphNodal(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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 returns_twice "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #4 = { 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 #5 = { nounwind }
attributes #6 = { nounwind returns_twice }

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass