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

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

33:                                               ; preds = %24, %6
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = call i64 @GENDUALMETIS_COUNT(i64 noundef %35, i64 noundef %37, i64 noundef %39, ptr noundef %40, ptr noundef %41)
  store i64 %42, ptr %13, align 8, !tbaa !9
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = icmp eq i64 %44, 1
  br i1 %45, label %46, label %55

46:                                               ; preds = %33
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = load i64, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds [6 x i64], ptr %14, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = mul nsw i64 %48, %52
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  call void @ChangeMesh2FNumbering3(i64 noundef %53, ptr noundef %54)
  br label %55

55:                                               ; preds = %46, %33
  %56 = load i64, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret i64 %56
}

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

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

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

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

declare void @ChangeMesh2FNumbering3(i64 noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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: nounwind uwtable
define dso_local i64 @METIS_MeshToDualCount(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) local_unnamed_addr #0 {
  %7 = alloca [6 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #3
  store i64 -1, ptr %7, align 16
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  store i64 3, ptr %8, align 8
  %9 = getelementptr inbounds i8, ptr %7, i64 16
  store i64 4, ptr %9, align 16
  %10 = getelementptr inbounds i8, ptr %7, i64 24
  store i64 8, ptr %10, align 8
  %11 = getelementptr inbounds i8, ptr %7, i64 32
  store i64 4, ptr %11, align 16
  %12 = getelementptr inbounds i8, ptr %7, i64 40
  store i64 2, ptr %12, align 8
  %13 = load i64, ptr %5, align 8, !tbaa !5
  %14 = icmp eq i64 %13, 1
  br i1 %14, label %15, label %21

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

21:                                               ; preds = %15, %6
  %22 = load i64, ptr %0, align 8, !tbaa !5
  %23 = load i64, ptr %1, align 8, !tbaa !5
  %24 = load i64, ptr %4, align 8, !tbaa !5
  %25 = tail call i64 @GENDUALMETIS_COUNT(i64 noundef %22, i64 noundef %23, i64 noundef %24, ptr noundef %2, ptr noundef %3)
  %26 = load i64, ptr %5, align 8, !tbaa !5
  %27 = icmp eq i64 %26, 1
  br i1 %27, label %28, label %34

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

34:                                               ; preds = %28, %21
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #3
  ret i64 %25
}

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

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

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

declare void @ChangeMesh2FNumbering3(i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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