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

; 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: 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: nounwind uwtable
declare dso_local void @libmetis__FreeRData(ptr noundef) #1

declare void @gk_free(ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local void @libmetis__FreeGraph(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %5, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.graph_t, ptr %6, i32 0, i32 10
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %10, label %13

10:                                               ; preds = %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.graph_t, ptr %11, i32 0, i32 3
  call void (ptr, ...) @gk_free(ptr noundef %12, ptr noundef null)
  br label %13

13:                                               ; preds = %10, %1
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.graph_t, ptr %14, i32 0, i32 11
  %16 = load i32, ptr %15, align 4, !tbaa !12
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %21

18:                                               ; preds = %13
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.graph_t, ptr %19, i32 0, i32 4
  call void (ptr, ...) @gk_free(ptr noundef %20, ptr noundef null)
  br label %21

21:                                               ; preds = %18, %13
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.graph_t, ptr %22, i32 0, i32 12
  %24 = load i32, ptr %23, align 8, !tbaa !13
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %29

26:                                               ; preds = %21
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.graph_t, ptr %27, i32 0, i32 5
  call void (ptr, ...) @gk_free(ptr noundef %28, ptr noundef null)
  br label %29

29:                                               ; preds = %26, %21
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.graph_t, ptr %30, i32 0, i32 13
  %32 = load i32, ptr %31, align 4, !tbaa !14
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %37

34:                                               ; preds = %29
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.graph_t, ptr %35, i32 0, i32 6
  call void (ptr, ...) @gk_free(ptr noundef %36, ptr noundef null)
  br label %37

37:                                               ; preds = %34, %29
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.graph_t, ptr %38, i32 0, i32 14
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %45

42:                                               ; preds = %37
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.graph_t, ptr %43, i32 0, i32 7
  call void (ptr, ...) @gk_free(ptr noundef %44, ptr noundef null)
  br label %45

45:                                               ; preds = %42, %37
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libmetis__FreeRData(ptr noundef %46)
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.graph_t, ptr %47, i32 0, i32 8
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.graph_t, ptr %49, i32 0, i32 9
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.graph_t, ptr %51, i32 0, i32 15
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.graph_t, ptr %53, i32 0, i32 16
  call void (ptr, ...) @gk_free(ptr noundef %48, ptr noundef %50, ptr noundef %52, ptr noundef %54, ptr noundef %3, ptr noundef null)
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr null, ptr %55, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 72}
!10 = !{!"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}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 76}
!13 = !{!10, !11, i64 80}
!14 = !{!10, !11, i64 84}
!15 = !{!10, !11, i64 88}


; 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

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

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__FreeRData(ptr noundef) local_unnamed_addr #1

declare void @gk_free(ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @libmetis__FreeGraph(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  store ptr %3, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 72
  %5 = load i32, ptr %4, align 8, !tbaa !9
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %8, label %6

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %3, i64 16
  tail call void (ptr, ...) @gk_free(ptr noundef nonnull %7, ptr noundef null) #3
  br label %8

8:                                                ; preds = %6, %1
  %9 = getelementptr inbounds i8, ptr %3, i64 76
  %10 = load i32, ptr %9, align 4, !tbaa !12
  %.not2 = icmp eq i32 %10, 0
  br i1 %.not2, label %13, label %11

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %3, i64 24
  tail call void (ptr, ...) @gk_free(ptr noundef nonnull %12, ptr noundef null) #3
  br label %13

13:                                               ; preds = %11, %8
  %14 = getelementptr inbounds i8, ptr %3, i64 80
  %15 = load i32, ptr %14, align 8, !tbaa !13
  %.not3 = icmp eq i32 %15, 0
  br i1 %.not3, label %18, label %16

16:                                               ; preds = %13
  %17 = getelementptr inbounds i8, ptr %3, i64 32
  tail call void (ptr, ...) @gk_free(ptr noundef nonnull %17, ptr noundef null) #3
  br label %18

18:                                               ; preds = %16, %13
  %19 = getelementptr inbounds i8, ptr %3, i64 84
  %20 = load i32, ptr %19, align 4, !tbaa !14
  %.not4 = icmp eq i32 %20, 0
  br i1 %.not4, label %23, label %21

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %3, i64 40
  tail call void (ptr, ...) @gk_free(ptr noundef nonnull %22, ptr noundef null) #3
  br label %23

23:                                               ; preds = %21, %18
  %24 = getelementptr inbounds i8, ptr %3, i64 88
  %25 = load i32, ptr %24, align 8, !tbaa !15
  %.not5 = icmp eq i32 %25, 0
  br i1 %.not5, label %28, label %26

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %3, i64 48
  tail call void (ptr, ...) @gk_free(ptr noundef nonnull %27, ptr noundef null) #3
  br label %28

28:                                               ; preds = %26, %23
  tail call void @libmetis__FreeRData(ptr noundef nonnull %3)
  %29 = getelementptr inbounds i8, ptr %3, i64 56
  %30 = getelementptr inbounds i8, ptr %3, i64 64
  %31 = getelementptr inbounds i8, ptr %3, i64 96
  %32 = getelementptr inbounds i8, ptr %3, i64 104
  call void (ptr, ...) @gk_free(ptr noundef nonnull %29, ptr noundef nonnull %30, ptr noundef nonnull %31, ptr noundef nonnull %32, ptr noundef nonnull %2, ptr noundef null) #3
  store ptr null, ptr %0, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 72}
!10 = !{!"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}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 76}
!13 = !{!10, !11, i64 80}
!14 = !{!10, !11, i64 84}
!15 = !{!10, !11, i64 88}


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