; 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 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @libmetis__AllocateRefinementWorkSpace(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %5 = load i32, ptr %4, align 4, !tbaa !9
  %6 = sext i32 %5 to i64
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.ctrl_t, ptr %7, i32 0, i32 40
  store i64 %6, ptr %8, align 8, !tbaa !11
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.ctrl_t, ptr %9, i32 0, i32 41
  store i64 0, ptr %10, align 8, !tbaa !16
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ctrl_t, ptr %11, i32 0, i32 42
  store i64 0, ptr %12, align 8, !tbaa !17
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.ctrl_t, ptr %13, i32 0, i32 1
  %15 = load i32, ptr %14, align 4, !tbaa !18
  switch i32 %15, label %32 [
    i32 0, label %16
    i32 1, label %24
  ]

16:                                               ; preds = %2
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.ctrl_t, ptr %17, i32 0, i32 40
  %19 = load i64, ptr %18, align 8, !tbaa !11
  %20 = mul i64 %19, 8
  %21 = call ptr @gk_malloc(i64 noundef %20, ptr noundef @.str)
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ctrl_t, ptr %22, i32 0, i32 43
  store ptr %21, ptr %23, align 8, !tbaa !19
  br label %36

24:                                               ; preds = %2
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ctrl_t, ptr %25, i32 0, i32 40
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = mul i64 %27, 12
  %29 = call ptr @gk_malloc(i64 noundef %28, ptr noundef @.str.1)
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ctrl_t, ptr %30, i32 0, i32 44
  store ptr %29, ptr %31, align 8, !tbaa !20
  br label %36

32:                                               ; preds = %2
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ctrl_t, ptr %33, i32 0, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !18
  call void (i32, ptr, ...) @gk_errexit(i32 noundef 15, ptr noundef @.str.2, i32 noundef %35)
  br label %36

36:                                               ; preds = %32, %24, %16
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ctrl_t, ptr %37, i32 0, i32 9
  %39 = load i32, ptr %38, align 4, !tbaa !21
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %86

41:                                               ; preds = %36
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ctrl_t, ptr %42, i32 0, i32 21
  %44 = load i32, ptr %43, align 4, !tbaa !22
  %45 = add nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = call ptr @libmetis__imalloc(i64 noundef %46, ptr noundef @.str.3)
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ctrl_t, ptr %48, i32 0, i32 49
  store ptr %47, ptr %49, align 8, !tbaa !23
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ctrl_t, ptr %50, i32 0, i32 21
  %52 = load i32, ptr %51, align 4, !tbaa !22
  %53 = add nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = call ptr @libmetis__imalloc(i64 noundef %54, ptr noundef @.str.4)
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.ctrl_t, ptr %56, i32 0, i32 50
  store ptr %55, ptr %57, align 8, !tbaa !24
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ctrl_t, ptr %58, i32 0, i32 21
  %60 = load i32, ptr %59, align 4, !tbaa !22
  %61 = sext i32 %60 to i64
  %62 = call ptr @libmetis__ismalloc(i64 noundef %61, i32 noundef 200, ptr noundef @.str.5)
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.ctrl_t, ptr %63, i32 0, i32 45
  store ptr %62, ptr %64, align 8, !tbaa !25
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.ctrl_t, ptr %65, i32 0, i32 21
  %67 = load i32, ptr %66, align 4, !tbaa !22
  %68 = sext i32 %67 to i64
  %69 = call ptr @libmetis__imalloc(i64 noundef %68, ptr noundef @.str.6)
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ctrl_t, ptr %70, i32 0, i32 46
  store ptr %69, ptr %71, align 8, !tbaa !26
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.ctrl_t, ptr %72, i32 0, i32 21
  %74 = load i32, ptr %73, align 4, !tbaa !22
  %75 = sext i32 %74 to i64
  %76 = call ptr @libmetis__iAllocMatrix(i64 noundef %75, i64 noundef 200, i32 noundef 0, ptr noundef @.str.7)
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ctrl_t, ptr %77, i32 0, i32 47
  store ptr %76, ptr %78, align 8, !tbaa !27
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.ctrl_t, ptr %79, i32 0, i32 21
  %81 = load i32, ptr %80, align 4, !tbaa !22
  %82 = sext i32 %81 to i64
  %83 = call ptr @libmetis__iAllocMatrix(i64 noundef %82, i64 noundef 200, i32 noundef 0, ptr noundef @.str.8)
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ctrl_t, ptr %84, i32 0, i32 48
  store ptr %83, ptr %85, align 8, !tbaa !28
  br label %86

86:                                               ; preds = %41, %36
  ret void
}

declare ptr @gk_malloc(i64 noundef, ptr noundef) #1

declare void @gk_errexit(i32 noundef, ptr noundef, ...) #1

declare ptr @libmetis__imalloc(i64 noundef, ptr noundef) #1

declare ptr @libmetis__ismalloc(i64 noundef, i32 noundef, ptr noundef) #1

declare ptr @libmetis__iAllocMatrix(i64 noundef, i64 noundef, i32 noundef, ptr 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !15, i64 240}
!12 = !{!"ctrl_t", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !6, i64 80, !10, i64 88, !10, i64 92, !13, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !13, i64 128, !14, i64 136, !14, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !14, i64 176, !14, i64 184, !14, i64 192, !14, i64 200, !14, i64 208, !14, i64 216, !14, i64 224, !6, i64 232, !15, i64 240, !15, i64 248, !15, 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}
!13 = !{!"float", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!12, !15, i64 248}
!17 = !{!12, !15, i64 256}
!18 = !{!12, !10, i64 4}
!19 = !{!12, !6, i64 264}
!20 = !{!12, !6, i64 272}
!21 = !{!12, !10, i64 36}
!22 = !{!12, !10, i64 92}
!23 = !{!12, !6, i64 312}
!24 = !{!12, !6, i64 320}
!25 = !{!12, !6, i64 280}
!26 = !{!12, !6, i64 288}
!27 = !{!12, !6, i64 296}
!28 = !{!12, !6, i64 304}


; 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 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @libmetis__AllocateRefinementWorkSpace(ptr nocapture noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = sext i32 %1 to i64
  %4 = getelementptr inbounds i8, ptr %0, i64 240
  store i64 %3, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 248
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  %7 = load i32, ptr %6, align 4, !tbaa !14
  switch i32 %7, label %16 [
    i32 0, label %8
    i32 1, label %12
  ]

8:                                                ; preds = %2
  %9 = shl nsw i64 %3, 3
  %10 = tail call ptr @gk_malloc(i64 noundef %9, ptr noundef nonnull @.str) #3
  %11 = getelementptr inbounds i8, ptr %0, i64 264
  store ptr %10, ptr %11, align 8, !tbaa !15
  br label %17

12:                                               ; preds = %2
  %13 = mul nsw i64 %3, 12
  %14 = tail call ptr @gk_malloc(i64 noundef %13, ptr noundef nonnull @.str.1) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 272
  store ptr %14, ptr %15, align 8, !tbaa !16
  br label %17

16:                                               ; preds = %2
  tail call void (i32, ptr, ...) @gk_errexit(i32 noundef 15, ptr noundef nonnull @.str.2, i32 noundef %7) #3
  br label %17

17:                                               ; preds = %16, %12, %8
  %18 = getelementptr inbounds i8, ptr %0, i64 36
  %19 = load i32, ptr %18, align 4, !tbaa !17
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %48, label %20

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %0, i64 92
  %22 = load i32, ptr %21, align 4, !tbaa !18
  %23 = add nsw i32 %22, 1
  %24 = sext i32 %23 to i64
  %25 = tail call ptr @libmetis__imalloc(i64 noundef %24, ptr noundef nonnull @.str.3) #3
  %26 = getelementptr inbounds i8, ptr %0, i64 312
  store ptr %25, ptr %26, align 8, !tbaa !19
  %27 = load i32, ptr %21, align 4, !tbaa !18
  %28 = add nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  %30 = tail call ptr @libmetis__imalloc(i64 noundef %29, ptr noundef nonnull @.str.4) #3
  %31 = getelementptr inbounds i8, ptr %0, i64 320
  store ptr %30, ptr %31, align 8, !tbaa !20
  %32 = load i32, ptr %21, align 4, !tbaa !18
  %33 = sext i32 %32 to i64
  %34 = tail call ptr @libmetis__ismalloc(i64 noundef %33, i32 noundef 200, ptr noundef nonnull @.str.5) #3
  %35 = getelementptr inbounds i8, ptr %0, i64 280
  store ptr %34, ptr %35, align 8, !tbaa !21
  %36 = load i32, ptr %21, align 4, !tbaa !18
  %37 = sext i32 %36 to i64
  %38 = tail call ptr @libmetis__imalloc(i64 noundef %37, ptr noundef nonnull @.str.6) #3
  %39 = getelementptr inbounds i8, ptr %0, i64 288
  store ptr %38, ptr %39, align 8, !tbaa !22
  %40 = load i32, ptr %21, align 4, !tbaa !18
  %41 = sext i32 %40 to i64
  %42 = tail call ptr @libmetis__iAllocMatrix(i64 noundef %41, i64 noundef 200, i32 noundef 0, ptr noundef nonnull @.str.7) #3
  %43 = getelementptr inbounds i8, ptr %0, i64 296
  store ptr %42, ptr %43, align 8, !tbaa !23
  %44 = load i32, ptr %21, align 4, !tbaa !18
  %45 = sext i32 %44 to i64
  %46 = tail call ptr @libmetis__iAllocMatrix(i64 noundef %45, i64 noundef 200, i32 noundef 0, ptr noundef nonnull @.str.8) #3
  %47 = getelementptr inbounds i8, ptr %0, i64 304
  store ptr %46, ptr %47, align 8, !tbaa !24
  br label %48

48:                                               ; preds = %20, %17
  ret void
}

declare ptr @gk_malloc(i64 noundef, ptr noundef) local_unnamed_addr #1

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

declare ptr @libmetis__imalloc(i64 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @libmetis__ismalloc(i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @libmetis__iAllocMatrix(i64 noundef, i64 noundef, i32 noundef, ptr 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) #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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !13, i64 240}
!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, !7, i64 4}
!15 = !{!6, !10, i64 264}
!16 = !{!6, !10, i64 272}
!17 = !{!6, !7, i64 36}
!18 = !{!6, !7, i64 92}
!19 = !{!6, !10, i64 312}
!20 = !{!6, !10, i64 320}
!21 = !{!6, !10, i64 280}
!22 = !{!6, !10, i64 288}
!23 = !{!6, !10, i64 296}
!24 = !{!6, !10, i64 304}


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