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

; 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.ipq_t = type { i64, i64, ptr, ptr }
%struct.ikv_t = type { i32, i32 }

@.str.4 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [138 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__.libmetis__ipqInsert = external hidden unnamed_addr constant [47 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 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

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @libmetis__ipqInsert(ptr noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ipq_t, ptr %11, i32 0, i32 3
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  store ptr %13, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ipq_t, ptr %14, i32 0, i32 2
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  store ptr %16, ptr %10, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = call i32 @libmetis__ipqCheckHeap(ptr noundef %17)
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %28, label %20

20:                                               ; preds = %3
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef 33, ptr noundef @.str.5)
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call i32 @libmetis__ipqCheckHeap(ptr noundef %22)
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %20
  br label %27

26:                                               ; preds = %20
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.5, i32 noundef 33, ptr noundef @__PRETTY_FUNCTION__.libmetis__ipqInsert) #6
  unreachable

27:                                               ; preds = %25
  br label %28

28:                                               ; preds = %27, %3
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = load i32, ptr %5, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i64, ptr %29, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !15
  %34 = icmp eq i64 %33, -1
  br i1 %34, label %46, label %35

35:                                               ; preds = %28
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef 33, ptr noundef @.str.5)
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i64, ptr %37, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !15
  %42 = icmp eq i64 %41, -1
  br i1 %42, label %43, label %44

43:                                               ; preds = %35
  br label %45

44:                                               ; preds = %35
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.5, i32 noundef 33, ptr noundef @__PRETTY_FUNCTION__.libmetis__ipqInsert) #6
  unreachable

45:                                               ; preds = %43
  br label %46

46:                                               ; preds = %45, %28
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ipq_t, ptr %47, i32 0, i32 0
  %49 = load i64, ptr %48, align 8, !tbaa !16
  %50 = add nsw i64 %49, 1
  store i64 %50, ptr %48, align 8, !tbaa !16
  store i64 %49, ptr %7, align 8, !tbaa !15
  br label %51

51:                                               ; preds = %83, %46
  %52 = load i64, ptr %7, align 8, !tbaa !15
  %53 = icmp sgt i64 %52, 0
  br i1 %53, label %54, label %84

54:                                               ; preds = %51
  %55 = load i64, ptr %7, align 8, !tbaa !15
  %56 = sub nsw i64 %55, 1
  %57 = ashr i64 %56, 1
  store i64 %57, ptr %8, align 8, !tbaa !15
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = load i64, ptr %8, align 8, !tbaa !15
  %61 = getelementptr inbounds %struct.ikv_t, ptr %59, i64 %60
  %62 = getelementptr inbounds %struct.ikv_t, ptr %61, i32 0, i32 0
  %63 = load i32, ptr %62, align 4, !tbaa !17
  %64 = icmp sgt i32 %58, %63
  br i1 %64, label %65, label %82

65:                                               ; preds = %54
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = load i64, ptr %7, align 8, !tbaa !15
  %68 = getelementptr inbounds %struct.ikv_t, ptr %66, i64 %67
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = load i64, ptr %8, align 8, !tbaa !15
  %71 = getelementptr inbounds %struct.ikv_t, ptr %69, i64 %70
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %68, ptr align 4 %71, i64 8, i1 false), !tbaa.struct !19
  %72 = load i64, ptr %7, align 8, !tbaa !15
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = load i64, ptr %7, align 8, !tbaa !15
  %76 = getelementptr inbounds %struct.ikv_t, ptr %74, i64 %75
  %77 = getelementptr inbounds %struct.ikv_t, ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 4, !tbaa !20
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i64, ptr %73, i64 %79
  store i64 %72, ptr %80, align 8, !tbaa !15
  %81 = load i64, ptr %8, align 8, !tbaa !15
  store i64 %81, ptr %7, align 8, !tbaa !15
  br label %83

82:                                               ; preds = %54
  br label %84

83:                                               ; preds = %65
  br label %51, !llvm.loop !21

84:                                               ; preds = %82, %51
  %85 = load i64, ptr %7, align 8, !tbaa !15
  %86 = icmp sge i64 %85, 0
  br i1 %86, label %94, label %87

87:                                               ; preds = %84
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef 33, ptr noundef @.str.5)
  %89 = load i64, ptr %7, align 8, !tbaa !15
  %90 = icmp sge i64 %89, 0
  br i1 %90, label %91, label %92

91:                                               ; preds = %87
  br label %93

92:                                               ; preds = %87
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.5, i32 noundef 33, ptr noundef @__PRETTY_FUNCTION__.libmetis__ipqInsert) #6
  unreachable

93:                                               ; preds = %91
  br label %94

94:                                               ; preds = %93, %84
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = load i64, ptr %7, align 8, !tbaa !15
  %98 = getelementptr inbounds %struct.ikv_t, ptr %96, i64 %97
  %99 = getelementptr inbounds %struct.ikv_t, ptr %98, i32 0, i32 0
  store i32 %95, ptr %99, align 4, !tbaa !17
  %100 = load i32, ptr %5, align 4, !tbaa !9
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = load i64, ptr %7, align 8, !tbaa !15
  %103 = getelementptr inbounds %struct.ikv_t, ptr %101, i64 %102
  %104 = getelementptr inbounds %struct.ikv_t, ptr %103, i32 0, i32 1
  store i32 %100, ptr %104, align 4, !tbaa !20
  %105 = load i64, ptr %7, align 8, !tbaa !15
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = load i32, ptr %5, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i64, ptr %106, i64 %108
  store i64 %105, ptr %109, align 8, !tbaa !15
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = call i32 @libmetis__ipqCheckHeap(ptr noundef %110)
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %121, label %113

113:                                              ; preds = %94
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef 33, ptr noundef @.str.5)
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = call i32 @libmetis__ipqCheckHeap(ptr noundef %115)
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %119

118:                                              ; preds = %113
  br label %120

119:                                              ; preds = %113
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.5, i32 noundef 33, ptr noundef @__PRETTY_FUNCTION__.libmetis__ipqInsert) #6
  unreachable

120:                                              ; preds = %118
  br label %121

121:                                              ; preds = %120, %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @libmetis__ipqCheckHeap(ptr noundef) #2

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { noreturn 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 }
attributes #6 = { noreturn 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, !6, i64 24}
!12 = !{!"", !13, i64 0, !13, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 16}
!15 = !{!13, !13, i64 0}
!16 = !{!12, !13, i64 0}
!17 = !{!18, !10, i64 0}
!18 = !{!"", !10, i64 0, !10, i64 4}
!19 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}
!20 = !{!18, !10, i64 4}
!21 = distinct !{!21, !22}
!22 = !{!"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"

%struct.ikv_t = type { i32, i32 }

@.str.4 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [138 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__.libmetis__ipqInsert = external hidden unnamed_addr constant [47 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @libmetis__ipqInsert(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !11
  %8 = tail call i32 @libmetis__ipqCheckHeap(ptr noundef %0)
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %9, label %13

9:                                                ; preds = %3
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 33, ptr noundef nonnull @.str.5)
  %11 = tail call i32 @libmetis__ipqCheckHeap(ptr noundef nonnull %0)
  %.not35 = icmp eq i32 %11, 0
  br i1 %.not35, label %12, label %13

12:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.5, i32 noundef 33, ptr noundef nonnull @__PRETTY_FUNCTION__.libmetis__ipqInsert) #3
  unreachable

13:                                               ; preds = %9, %3
  %14 = sext i32 %1 to i64
  %15 = getelementptr inbounds i64, ptr %5, i64 %14
  %16 = load i64, ptr %15, align 8, !tbaa !12
  %17 = icmp eq i64 %16, -1
  br i1 %17, label %23, label %18

18:                                               ; preds = %13
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef 33, ptr noundef nonnull @.str.5)
  %20 = load i64, ptr %15, align 8, !tbaa !12
  %21 = icmp eq i64 %20, -1
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.5, i32 noundef 33, ptr noundef nonnull @__PRETTY_FUNCTION__.libmetis__ipqInsert) #3
  unreachable

23:                                               ; preds = %18, %13
  %24 = load i64, ptr %0, align 8, !tbaa !13
  %25 = add nsw i64 %24, 1
  store i64 %25, ptr %0, align 8, !tbaa !13
  %26 = icmp sgt i64 %24, 0
  br i1 %26, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %23, %32
  %.040 = phi i64 [ %28, %32 ], [ %24, %23 ]
  %27 = add nsw i64 %.040, -1
  %28 = lshr i64 %27, 1
  %29 = getelementptr inbounds %struct.ikv_t, ptr %7, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !14
  %31 = icmp slt i32 %30, %2
  br i1 %31, label %32, label %.thread

32:                                               ; preds = %.lr.ph
  %33 = getelementptr inbounds %struct.ikv_t, ptr %7, i64 %.040
  %34 = load i64, ptr %29, align 4
  store i64 %34, ptr %33, align 4
  %35 = ashr i64 %34, 32
  %36 = getelementptr inbounds i64, ptr %5, i64 %35
  store i64 %.040, ptr %36, align 8, !tbaa !12
  %.not41 = icmp ult i64 %27, 2
  br i1 %.not41, label %.thread, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %23
  %37 = icmp sgt i64 %24, -1
  br i1 %37, label %.thread, label %38

38:                                               ; preds = %._crit_edge
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef 33, ptr noundef nonnull @.str.5)
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.5, i32 noundef 33, ptr noundef nonnull @__PRETTY_FUNCTION__.libmetis__ipqInsert) #3
  unreachable

.thread:                                          ; preds = %32, %.lr.ph, %._crit_edge
  %.039 = phi i64 [ 0, %._crit_edge ], [ %28, %32 ], [ %.040, %.lr.ph ]
  %40 = getelementptr inbounds %struct.ikv_t, ptr %7, i64 %.039
  store i32 %2, ptr %40, align 4, !tbaa !14
  %41 = getelementptr inbounds i8, ptr %40, i64 4
  store i32 %1, ptr %41, align 4, !tbaa !19
  store i64 %.039, ptr %15, align 8, !tbaa !12
  %42 = tail call i32 @libmetis__ipqCheckHeap(ptr noundef nonnull %0)
  %.not36 = icmp eq i32 %42, 0
  br i1 %.not36, label %43, label %47

43:                                               ; preds = %.thread
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 33, ptr noundef nonnull @.str.5)
  %45 = tail call i32 @libmetis__ipqCheckHeap(ptr noundef nonnull %0)
  %.not37 = icmp eq i32 %45, 0
  br i1 %.not37, label %46, label %47

46:                                               ; preds = %43
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.5, i32 noundef 33, ptr noundef nonnull @__PRETTY_FUNCTION__.libmetis__ipqInsert) #3
  unreachable

47:                                               ; preds = %43, %.thread
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @libmetis__ipqCheckHeap(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #2 = { noreturn 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 = { noreturn 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, !10, i64 24}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"", !16, i64 0, !16, i64 4}
!16 = !{!"int", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!15, !16, i64 4}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass