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

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

@.str.9 = external hidden unnamed_addr constant [97 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @libmetis__FreeWorkSpace(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.ctrl_t, ptr %3, i32 0, i32 39
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.ctrl_t, ptr %5, i32 0, i32 2
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = and i32 %7, 1
  call void @gk_mcoreDestroy(ptr noundef %4, i32 noundef %8)
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.ctrl_t, ptr %9, i32 0, i32 2
  %11 = load i32, ptr %10, align 8, !tbaa !9
  %12 = and i32 %11, 1
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %25

14:                                               ; preds = %1
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.ctrl_t, ptr %15, i32 0, i32 40
  %17 = load i64, ptr %16, align 8, !tbaa !15
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ctrl_t, ptr %18, i32 0, i32 41
  %20 = load i64, ptr %19, align 8, !tbaa !16
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.ctrl_t, ptr %21, i32 0, i32 42
  %23 = load i64, ptr %22, align 8, !tbaa !17
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i64 noundef %17, i64 noundef %20, i64 noundef %23)
  br label %25

25:                                               ; preds = %14, %1
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ctrl_t, ptr %26, i32 0, i32 43
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ctrl_t, ptr %28, i32 0, i32 44
  call void (ptr, ...) @gk_free(ptr noundef %27, ptr noundef %29, ptr noundef null)
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ctrl_t, ptr %30, i32 0, i32 40
  store i64 0, ptr %31, align 8, !tbaa !15
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ctrl_t, ptr %32, i32 0, i32 41
  store i64 0, ptr %33, align 8, !tbaa !16
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ctrl_t, ptr %34, i32 0, i32 9
  %36 = load i32, ptr %35, align 4, !tbaa !18
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %59

38:                                               ; preds = %25
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ctrl_t, ptr %39, i32 0, i32 47
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ctrl_t, ptr %41, i32 0, i32 21
  %43 = load i32, ptr %42, align 4, !tbaa !19
  %44 = sext i32 %43 to i64
  call void @libmetis__iFreeMatrix(ptr noundef %40, i64 noundef %44, i64 noundef 200)
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ctrl_t, ptr %45, i32 0, i32 48
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ctrl_t, ptr %47, i32 0, i32 21
  %49 = load i32, ptr %48, align 4, !tbaa !19
  %50 = sext i32 %49 to i64
  call void @libmetis__iFreeMatrix(ptr noundef %46, i64 noundef %50, i64 noundef 200)
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ctrl_t, ptr %51, i32 0, i32 49
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.ctrl_t, ptr %53, i32 0, i32 50
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ctrl_t, ptr %55, i32 0, i32 45
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ctrl_t, ptr %57, i32 0, i32 46
  call void (ptr, ...) @gk_free(ptr noundef %52, ptr noundef %54, ptr noundef %56, ptr noundef %58, ptr noundef null)
  br label %59

59:                                               ; preds = %38, %25
  ret void
}

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

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

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

declare void @libmetis__iFreeMatrix(ptr noundef, i64 noundef, i64 noundef) #1

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 = { "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, !11, i64 8}
!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 = !{!10, !14, i64 240}
!16 = !{!10, !14, i64 248}
!17 = !{!10, !14, i64 256}
!18 = !{!10, !11, i64 36}
!19 = !{!10, !11, i64 92}


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

@.str.9 = external hidden unnamed_addr constant [97 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @libmetis__FreeWorkSpace(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 232
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = and i32 %4, 1
  tail call void @gk_mcoreDestroy(ptr noundef nonnull %2, i32 noundef %5) #4
  %6 = load i32, ptr %3, align 8, !tbaa !5
  %7 = and i32 %6, 1
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %16, label %8

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 240
  %10 = load i64, ptr %9, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 248
  %12 = load i64, ptr %11, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 256
  %14 = load i64, ptr %13, align 8, !tbaa !16
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i64 noundef %10, i64 noundef %12, i64 noundef %14)
  br label %16

16:                                               ; preds = %8, %1
  %17 = getelementptr inbounds i8, ptr %0, i64 264
  %18 = getelementptr inbounds i8, ptr %0, i64 272
  tail call void (ptr, ...) @gk_free(ptr noundef nonnull %17, ptr noundef nonnull %18, ptr noundef null) #4
  %19 = getelementptr inbounds i8, ptr %0, i64 240
  %20 = getelementptr inbounds i8, ptr %0, i64 36
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %19, i8 0, i64 16, i1 false)
  %21 = load i32, ptr %20, align 4, !tbaa !17
  %.not19 = icmp eq i32 %21, 0
  br i1 %.not19, label %34, label %22

22:                                               ; preds = %16
  %23 = getelementptr inbounds i8, ptr %0, i64 296
  %24 = getelementptr inbounds i8, ptr %0, i64 92
  %25 = load i32, ptr %24, align 4, !tbaa !18
  %26 = sext i32 %25 to i64
  tail call void @libmetis__iFreeMatrix(ptr noundef nonnull %23, i64 noundef %26, i64 noundef 200) #4
  %27 = getelementptr inbounds i8, ptr %0, i64 304
  %28 = load i32, ptr %24, align 4, !tbaa !18
  %29 = sext i32 %28 to i64
  tail call void @libmetis__iFreeMatrix(ptr noundef nonnull %27, i64 noundef %29, i64 noundef 200) #4
  %30 = getelementptr inbounds i8, ptr %0, i64 312
  %31 = getelementptr inbounds i8, ptr %0, i64 320
  %32 = getelementptr inbounds i8, ptr %0, i64 280
  %33 = getelementptr inbounds i8, ptr %0, i64 288
  tail call void (ptr, ...) @gk_free(ptr noundef nonnull %30, ptr noundef nonnull %31, ptr noundef nonnull %32, ptr noundef nonnull %33, ptr noundef null) #4
  br label %34

34:                                               ; preds = %22, %16
  ret void
}

declare void @gk_mcoreDestroy(ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

declare void @libmetis__iFreeMatrix(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { "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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !7, i64 8}
!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 = !{!6, !13, i64 240}
!15 = !{!6, !13, i64 248}
!16 = !{!6, !13, i64 256}
!17 = !{!6, !7, i64 36}
!18 = !{!6, !7, i64 92}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass