; LLVM IR from ekoontz/graphlab :: src/graphlab/extern/metis/libmetis (mesh)

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

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

declare void @libmetis__ChangeMesh2CNumbering(i64 noundef, ptr noundef) #2

; 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
define dso_local void @METIS_MeshToDual(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #3 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca [6 x i64], align 16
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store ptr %7, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %17) #4
  call void @llvm.memset.p0.i64(ptr align 16 %17, i8 0, i64 48, i1 false)
  %18 = getelementptr inbounds [6 x i64], ptr %17, i32 0, i32 0
  store i64 -1, ptr %18, align 16
  %19 = getelementptr inbounds [6 x i64], ptr %17, i32 0, i32 1
  store i64 3, ptr %19, align 8
  %20 = getelementptr inbounds [6 x i64], ptr %17, i32 0, i32 2
  store i64 4, ptr %20, align 16
  %21 = getelementptr inbounds [6 x i64], ptr %17, i32 0, i32 3
  store i64 8, ptr %21, align 8
  %22 = getelementptr inbounds [6 x i64], ptr %17, i32 0, i32 4
  store i64 4, ptr %22, align 16
  %23 = getelementptr inbounds [6 x i64], ptr %17, i32 0, i32 5
  store i64 2, ptr %23, align 8
  %24 = load ptr, ptr %14, align 8, !tbaa !5
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = icmp eq i64 %25, 1
  br i1 %26, label %27, label %36

27:                                               ; preds = %8
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  %31 = load i64, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds [6 x i64], ptr %17, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !9
  %34 = mul nsw i64 %29, %33
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  call void @libmetis__ChangeMesh2CNumbering(i64 noundef %34, ptr noundef %35)
  br label %36

36:                                               ; preds = %27, %8
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = load i64, ptr %37, align 8, !tbaa !9
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = load i64, ptr %39, align 8, !tbaa !9
  %41 = load ptr, ptr %13, align 8, !tbaa !5
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = load ptr, ptr %15, align 8, !tbaa !5
  %46 = load ptr, ptr %16, align 8, !tbaa !5
  call void @GENDUALMETIS(i64 noundef %38, i64 noundef %40, i64 noundef %42, ptr noundef %43, ptr noundef %44, ptr noundef %45, ptr noundef %46)
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = icmp eq i64 %48, 1
  br i1 %49, label %50, label %63

50:                                               ; preds = %36
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = load i64, ptr %53, align 8, !tbaa !9
  %55 = getelementptr inbounds [6 x i64], ptr %17, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = mul nsw i64 %52, %56
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = load i64, ptr %59, align 8, !tbaa !9
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  %62 = load ptr, ptr %16, align 8, !tbaa !5
  call void @libmetis__ChangeMesh2FNumbering(i64 noundef %57, ptr noundef %58, i64 noundef %60, ptr noundef %61, ptr noundef %62)
  br label %63

63:                                               ; preds = %50, %36
  call void @llvm.lifetime.end.p0(i64 48, ptr %17) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @GENDUALMETIS(i64 noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare void @libmetis__ChangeMesh2FNumbering(i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 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 }

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


; 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

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

; 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
define dso_local void @METIS_MeshToDual(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr noundef %2, ptr noundef %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #2 {
  %9 = alloca [6 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %9) #3
  store i64 -1, ptr %9, align 16
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  store i64 3, ptr %10, align 8
  %11 = getelementptr inbounds i8, ptr %9, i64 16
  store i64 4, ptr %11, align 16
  %12 = getelementptr inbounds i8, ptr %9, i64 24
  store i64 8, ptr %12, align 8
  %13 = getelementptr inbounds i8, ptr %9, i64 32
  store i64 4, ptr %13, align 16
  %14 = getelementptr inbounds i8, ptr %9, i64 40
  store i64 2, ptr %14, align 8
  %15 = load i64, ptr %5, align 8, !tbaa !5
  %16 = icmp eq i64 %15, 1
  br i1 %16, label %17, label %23

17:                                               ; preds = %8
  %18 = load i64, ptr %0, align 8, !tbaa !5
  %19 = load i64, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds [6 x i64], ptr %9, i64 0, i64 %19
  %21 = load i64, ptr %20, align 8, !tbaa !5
  %22 = mul nsw i64 %21, %18
  tail call void @libmetis__ChangeMesh2CNumbering(i64 noundef %22, ptr noundef %2) #3
  br label %23

23:                                               ; preds = %17, %8
  %24 = load i64, ptr %0, align 8, !tbaa !5
  %25 = load i64, ptr %1, align 8, !tbaa !5
  %26 = load i64, ptr %4, align 8, !tbaa !5
  tail call void @GENDUALMETIS(i64 noundef %24, i64 noundef %25, i64 noundef %26, ptr noundef %2, ptr noundef %3, ptr noundef %6, ptr noundef %7)
  %27 = load i64, ptr %5, align 8, !tbaa !5
  %28 = icmp eq i64 %27, 1
  br i1 %28, label %29, label %35

29:                                               ; preds = %23
  %30 = load i64, ptr %0, align 8, !tbaa !5
  %31 = load i64, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds [6 x i64], ptr %9, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !5
  %34 = mul nsw i64 %33, %30
  tail call void @libmetis__ChangeMesh2FNumbering(i64 noundef %34, ptr noundef %2, i64 noundef %30, ptr noundef %6, ptr noundef %7) #3
  br label %35

35:                                               ; preds = %29, %23
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @GENDUALMETIS(i64 noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress 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 = { 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 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass