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

; 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.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: nounwind uwtable
define dso_local i32 @libmetis__Match_2Hop(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i64 noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i64 %5, ptr %12, align 8, !tbaa !11
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = load ptr, ptr %9, align 8, !tbaa !5
  %16 = load ptr, ptr %10, align 8, !tbaa !5
  %17 = load i32, ptr %11, align 4, !tbaa !9
  %18 = call i32 @libmetis__Match_2HopAny(ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %16, i32 noundef %17, ptr noundef %12, i64 noundef 2)
  store i32 %18, ptr %11, align 4, !tbaa !9
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = load i32, ptr %11, align 4, !tbaa !9
  %24 = call i32 @libmetis__Match_2HopAll(ptr noundef %19, ptr noundef %20, ptr noundef %21, ptr noundef %22, i32 noundef %23, ptr noundef %12, i64 noundef 64)
  store i32 %24, ptr %11, align 4, !tbaa !9
  %25 = load i64, ptr %12, align 8, !tbaa !11
  %26 = uitofp i64 %25 to double
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.graph_t, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !13
  %30 = sitofp i32 %29 to double
  %31 = fmul double 0x3FC3333333333334, %30
  %32 = fcmp ogt double %26, %31
  br i1 %32, label %33, label %40

33:                                               ; preds = %6
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = call i32 @libmetis__Match_2HopAny(ptr noundef %34, ptr noundef %35, ptr noundef %36, ptr noundef %37, i32 noundef %38, ptr noundef %12, i64 noundef 3)
  store i32 %39, ptr %11, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %33, %6
  %41 = load i64, ptr %12, align 8, !tbaa !11
  %42 = uitofp i64 %41 to double
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.graph_t, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !13
  %46 = sitofp i32 %45 to double
  %47 = fmul double 2.000000e-01, %46
  %48 = fcmp ogt double %42, %47
  br i1 %48, label %49, label %60

49:                                               ; preds = %40
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = load i32, ptr %11, align 4, !tbaa !9
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.graph_t, ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 8, !tbaa !13
  %58 = sext i32 %57 to i64
  %59 = call i32 @libmetis__Match_2HopAny(ptr noundef %50, ptr noundef %51, ptr noundef %52, ptr noundef %53, i32 noundef %54, ptr noundef %12, i64 noundef %58)
  store i32 %59, ptr %11, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %49, %40
  %61 = load i32, ptr %11, align 4, !tbaa !9
  ret i32 %61
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @libmetis__Match_2HopAny(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @libmetis__Match_2HopAll(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, i64 noundef) #0

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

!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 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"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}


; 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: nounwind uwtable
define dso_local i32 @libmetis__Match_2Hop(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i64 noundef %5) local_unnamed_addr #0 {
  %7 = alloca i64, align 8
  store i64 %5, ptr %7, align 8, !tbaa !5
  %8 = call i32 @libmetis__Match_2HopAny(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef nonnull %7, i64 noundef 2)
  %9 = call i32 @libmetis__Match_2HopAll(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %8, ptr noundef nonnull %7, i64 noundef 64)
  %10 = load i64, ptr %7, align 8, !tbaa !5
  %11 = uitofp i64 %10 to double
  %12 = load i32, ptr %1, align 8, !tbaa !9
  %13 = sitofp i32 %12 to double
  %14 = fmul double %13, 0x3FC3333333333334
  %15 = fcmp olt double %14, %11
  br i1 %15, label %16, label %18

16:                                               ; preds = %6
  %17 = call i32 @libmetis__Match_2HopAny(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef %3, i32 noundef %9, ptr noundef nonnull %7, i64 noundef 3)
  %.pre = load i64, ptr %7, align 8, !tbaa !5
  %.pre23 = load i32, ptr %1, align 8, !tbaa !9
  %.pre24 = uitofp i64 %.pre to double
  %.pre25 = sitofp i32 %.pre23 to double
  br label %18

18:                                               ; preds = %16, %6
  %.pre-phi26 = phi double [ %.pre25, %16 ], [ %13, %6 ]
  %.pre-phi = phi double [ %.pre24, %16 ], [ %11, %6 ]
  %19 = phi i32 [ %.pre23, %16 ], [ %12, %6 ]
  %.0 = phi i32 [ %17, %16 ], [ %9, %6 ]
  %20 = fmul double %.pre-phi26, 2.000000e-01
  %21 = fcmp olt double %20, %.pre-phi
  br i1 %21, label %22, label %25

22:                                               ; preds = %18
  %23 = sext i32 %19 to i64
  %24 = call i32 @libmetis__Match_2HopAny(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef %3, i32 noundef %.0, ptr noundef nonnull %7, i64 noundef %23)
  br label %25

25:                                               ; preds = %22, %18
  %.1 = phi i32 [ %24, %22 ], [ %.0, %18 ]
  ret i32 %.1
}

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

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

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

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"graph_t", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !12, i64 96, !12, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !12, i64 128, !11, 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}
!11 = !{!"int", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,SROAPass