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

; 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.ckrinfo_t = type { i32, i32, i32, i32 }
%struct.cnbr_t = type { i32, i32 }

@.str.4 = external hidden unnamed_addr constant [138 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.libmetis__CheckRInfo = external hidden unnamed_addr constant [50 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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @libmetis__CheckRInfo(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.ctrl_t, ptr %8, i32 0, i32 43
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ckrinfo_t, ptr %11, i32 0, i32 3
  %13 = load i32, ptr %12, align 4, !tbaa !15
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds %struct.cnbr_t, ptr %10, i64 %14
  store ptr %15, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !17
  br label %16

16:                                               ; preds = %84, %2
  %17 = load i32, ptr %5, align 4, !tbaa !17
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ckrinfo_t, ptr %18, i32 0, i32 2
  %20 = load i32, ptr %19, align 4, !tbaa !18
  %21 = icmp slt i32 %17, %20
  br i1 %21, label %22, label %87

22:                                               ; preds = %16
  %23 = load i32, ptr %5, align 4, !tbaa !17
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %6, align 4, !tbaa !17
  br label %25

25:                                               ; preds = %80, %22
  %26 = load i32, ptr %6, align 4, !tbaa !17
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ckrinfo_t, ptr %27, i32 0, i32 2
  %29 = load i32, ptr %28, align 4, !tbaa !18
  %30 = icmp slt i32 %26, %29
  br i1 %30, label %31, label %83

31:                                               ; preds = %25
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !17
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds %struct.cnbr_t, ptr %32, i64 %34
  %36 = getelementptr inbounds %struct.cnbr_t, ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 4, !tbaa !19
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = load i32, ptr %6, align 4, !tbaa !17
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds %struct.cnbr_t, ptr %38, i64 %40
  %42 = getelementptr inbounds %struct.cnbr_t, ptr %41, i32 0, i32 0
  %43 = load i32, ptr %42, align 4, !tbaa !19
  %44 = icmp ne i32 %37, %43
  br i1 %44, label %79, label %45

45:                                               ; preds = %31
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, i32 noundef 243, ptr noundef @.str.4)
  %47 = load i32, ptr %5, align 4, !tbaa !17
  %48 = load i32, ptr %6, align 4, !tbaa !17
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = load i32, ptr %5, align 4, !tbaa !17
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds %struct.cnbr_t, ptr %49, i64 %51
  %53 = getelementptr inbounds %struct.cnbr_t, ptr %52, i32 0, i32 0
  %54 = load i32, ptr %53, align 4, !tbaa !19
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load i32, ptr %6, align 4, !tbaa !17
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds %struct.cnbr_t, ptr %55, i64 %57
  %59 = getelementptr inbounds %struct.cnbr_t, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 4, !tbaa !19
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, i32 noundef %47, i32 noundef %48, i32 noundef %54, i32 noundef %60)
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = load i32, ptr %5, align 4, !tbaa !17
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds %struct.cnbr_t, ptr %63, i64 %65
  %67 = getelementptr inbounds %struct.cnbr_t, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 4, !tbaa !19
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load i32, ptr %6, align 4, !tbaa !17
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %struct.cnbr_t, ptr %69, i64 %71
  %73 = getelementptr inbounds %struct.cnbr_t, ptr %72, i32 0, i32 0
  %74 = load i32, ptr %73, align 4, !tbaa !19
  %75 = icmp ne i32 %68, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %45
  br label %78

77:                                               ; preds = %45
  call void @__assert_fail(ptr noundef @.str.19, ptr noundef @.str.4, i32 noundef 243, ptr noundef @__PRETTY_FUNCTION__.libmetis__CheckRInfo) #5
  unreachable

78:                                               ; preds = %76
  br label %79

79:                                               ; preds = %78, %31
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %6, align 4, !tbaa !17
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %6, align 4, !tbaa !17
  br label %25, !llvm.loop !21

83:                                               ; preds = %25
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %5, align 4, !tbaa !17
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %5, align 4, !tbaa !17
  br label %16, !llvm.loop !23

87:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret i32 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 = { 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 = { 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 #4 = { nounwind }
attributes #5 = { 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, !6, i64 264}
!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 = !{!16, !11, i64 12}
!16 = !{!"ckrinfo_t", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!17 = !{!11, !11, i64 0}
!18 = !{!16, !11, i64 8}
!19 = !{!20, !11, i64 0}
!20 = !{!"cnbr_t", !11, i64 0, !11, i64 4}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; 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.cnbr_t = type { i32, i32 }

@.str.4 = external hidden unnamed_addr constant [138 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.libmetis__CheckRInfo = external hidden unnamed_addr constant [50 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @libmetis__CheckRInfo(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 264
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 12
  %6 = load i32, ptr %5, align 4, !tbaa !14
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds %struct.cnbr_t, ptr %4, i64 %7
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load i32, ptr %9, align 4, !tbaa !16
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph26, label %._crit_edge

.loopexit.loopexit:                               ; preds = %35
  %.pre35 = sext i32 %36 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph26
  %.pre-phi = phi i64 [ %.pre35, %.loopexit.loopexit ], [ %15, %.lr.ph26 ]
  %12 = phi i32 [ %36, %.loopexit.loopexit ], [ %14, %.lr.ph26 ]
  %13 = icmp slt i64 %indvars.iv.next31, %.pre-phi
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br i1 %13, label %.lr.ph26, label %._crit_edge, !llvm.loop !17

.lr.ph26:                                         ; preds = %2, %.loopexit
  %14 = phi i32 [ %12, %.loopexit ], [ %10, %2 ]
  %indvars.iv30 = phi i64 [ %indvars.iv.next31, %.loopexit ], [ 0, %2 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.loopexit ], [ 1, %2 ]
  %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next31, %15
  br i1 %16, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph26
  %17 = getelementptr inbounds %struct.cnbr_t, ptr %8, i64 %indvars.iv30
  %.pre = load i32, ptr %17, align 4, !tbaa !19
  %18 = trunc nuw nsw i64 %indvars.iv30 to i32
  br label %19

19:                                               ; preds = %.lr.ph, %35
  %20 = phi i32 [ %14, %.lr.ph ], [ %36, %35 ]
  %21 = phi i32 [ %14, %.lr.ph ], [ %37, %35 ]
  %22 = phi i32 [ %.pre, %.lr.ph ], [ %38, %35 ]
  %indvars.iv27 = phi i64 [ %indvars.iv, %.lr.ph ], [ %indvars.iv.next28, %35 ]
  %23 = getelementptr inbounds %struct.cnbr_t, ptr %8, i64 %indvars.iv27
  %24 = load i32, ptr %23, align 4, !tbaa !19
  %.not = icmp eq i32 %22, %24
  br i1 %.not, label %25, label %35

25:                                               ; preds = %19
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, i32 noundef 243, ptr noundef nonnull @.str.4)
  %27 = load i32, ptr %17, align 4, !tbaa !19
  %28 = load i32, ptr %23, align 4, !tbaa !19
  %29 = trunc nuw nsw i64 %indvars.iv27 to i32
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef %18, i32 noundef %29, i32 noundef %27, i32 noundef %28)
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %32 = load i32, ptr %17, align 4, !tbaa !19
  %33 = load i32, ptr %23, align 4, !tbaa !19
  %.not23 = icmp eq i32 %32, %33
  br i1 %.not23, label %34, label %._crit_edge33

._crit_edge33:                                    ; preds = %25
  %.pre34 = load i32, ptr %9, align 4, !tbaa !16
  br label %35

34:                                               ; preds = %25
  tail call void @__assert_fail(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.4, i32 noundef 243, ptr noundef nonnull @__PRETTY_FUNCTION__.libmetis__CheckRInfo) #3
  unreachable

35:                                               ; preds = %._crit_edge33, %19
  %36 = phi i32 [ %20, %19 ], [ %.pre34, %._crit_edge33 ]
  %37 = phi i32 [ %21, %19 ], [ %.pre34, %._crit_edge33 ]
  %38 = phi i32 [ %22, %19 ], [ %32, %._crit_edge33 ]
  %indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
  %39 = trunc nuw i64 %indvars.iv.next28 to i32
  %40 = icmp sgt i32 %37, %39
  br i1 %40, label %19, label %.loopexit.loopexit, !llvm.loop !21

._crit_edge:                                      ; preds = %.loopexit, %2
  ret i32 1
}

attributes #0 = { 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 #1 = { 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 #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 = { 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 264}
!6 = !{!"ctrl_t", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !7, i64 68, !7, i64 72, !10, i64 80, !7, i64 88, !7, i64 92, !11, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !11, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !10, i64 232, !13, i64 240, !13, i64 248, !13, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!15, !7, i64 12}
!15 = !{!"ckrinfo_t", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!16 = !{!15, !7, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !7, i64 0}
!20 = !{!"cnbr_t", !7, i64 0, !7, i64 4}
!21 = distinct !{!21, !18}


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