; LLVM IR from ekoontz/graphlab :: src/graphlab/extern/metis/libmetis/mincover.ll_libmetis (MinCover_ColDFS)

; 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 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 @libmetis__MinCover_ColDFS(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, i64 noundef %5) #1 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store i64 %5, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  %15 = load i64, ptr %12, align 8, !tbaa !9
  %16 = icmp eq i64 %15, 10
  br i1 %16, label %17, label %53

17:                                               ; preds = %6
  %18 = load ptr, ptr %11, align 8, !tbaa !5
  %19 = load i64, ptr %9, align 8, !tbaa !9
  %20 = getelementptr inbounds i64, ptr %18, i64 %19
  %21 = load i64, ptr %20, align 8, !tbaa !9
  %22 = icmp eq i64 %21, 3
  br i1 %22, label %23, label %24

23:                                               ; preds = %17
  store i32 1, ptr %14, align 4
  br label %80

24:                                               ; preds = %17
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = load i64, ptr %9, align 8, !tbaa !9
  %27 = getelementptr inbounds i64, ptr %25, i64 %26
  store i64 3, ptr %27, align 8, !tbaa !9
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load i64, ptr %9, align 8, !tbaa !9
  %30 = getelementptr inbounds i64, ptr %28, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !9
  store i64 %31, ptr %13, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %49, %24
  %33 = load i64, ptr %13, align 8, !tbaa !9
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i64, ptr %9, align 8, !tbaa !9
  %36 = add nsw i64 %35, 1
  %37 = getelementptr inbounds i64, ptr %34, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !9
  %39 = icmp slt i64 %33, %38
  br i1 %39, label %40, label %52

40:                                               ; preds = %32
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load i64, ptr %13, align 8, !tbaa !9
  %45 = getelementptr inbounds i64, ptr %43, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  call void @libmetis__MinCover_ColDFS(ptr noundef %41, ptr noundef %42, i64 noundef %46, ptr noundef %47, ptr noundef %48, i64 noundef 20)
  br label %49

49:                                               ; preds = %40
  %50 = load i64, ptr %13, align 8, !tbaa !9
  %51 = add nsw i64 %50, 1
  store i64 %51, ptr %13, align 8, !tbaa !9
  br label %32, !llvm.loop !11

52:                                               ; preds = %32
  br label %79

53:                                               ; preds = %6
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = load i64, ptr %9, align 8, !tbaa !9
  %56 = getelementptr inbounds i64, ptr %54, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = icmp eq i64 %57, 6
  br i1 %58, label %59, label %60

59:                                               ; preds = %53
  store i32 1, ptr %14, align 4
  br label %80

60:                                               ; preds = %53
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = load i64, ptr %9, align 8, !tbaa !9
  %63 = getelementptr inbounds i64, ptr %61, i64 %62
  store i64 6, ptr %63, align 8, !tbaa !9
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = load i64, ptr %9, align 8, !tbaa !9
  %66 = getelementptr inbounds i64, ptr %64, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !9
  %68 = icmp ne i64 %67, -1
  br i1 %68, label %69, label %78

69:                                               ; preds = %60
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = load i64, ptr %9, align 8, !tbaa !9
  %74 = getelementptr inbounds i64, ptr %72, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  call void @libmetis__MinCover_ColDFS(ptr noundef %70, ptr noundef %71, i64 noundef %75, ptr noundef %76, ptr noundef %77, i64 noundef 10)
  br label %78

78:                                               ; preds = %69, %60
  br label %79

79:                                               ; preds = %78, %52
  store i32 0, ptr %14, align 4
  br label %80

80:                                               ; preds = %79, %59, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  %81 = load i32, ptr %14, align 4
  switch i32 %81, label %83 [
    i32 0, label %82
    i32 1, label %82
  ]

82:                                               ; preds = %80, %80
  ret void

83:                                               ; preds = %80
  unreachable
}

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 = { 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}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @libmetis__MinCover_ColDFS(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i64 noundef %2, ptr nocapture noundef readonly %3, ptr nocapture noundef %4, i64 noundef %5) local_unnamed_addr #0 {
tailrecurse.peel.begin:
  %6 = icmp eq i64 %5, 10
  br i1 %6, label %.loopexit40, label %7

7:                                                ; preds = %tailrecurse.peel.begin
  %8 = getelementptr inbounds i64, ptr %4, i64 %2
  %9 = load i64, ptr %8, align 8, !tbaa !5
  %10 = icmp eq i64 %9, 6
  br i1 %10, label %.loopexit, label %11

11:                                               ; preds = %7
  store i64 6, ptr %8, align 8, !tbaa !5
  %12 = getelementptr inbounds i64, ptr %3, i64 %2
  %13 = load i64, ptr %12, align 8, !tbaa !5
  %.not.peel = icmp eq i64 %13, -1
  br i1 %.not.peel, label %.loopexit, label %.loopexit40

.loopexit40:                                      ; preds = %11, %tailrecurse.peel.begin
  %.tr30.lcssa = phi i64 [ %2, %tailrecurse.peel.begin ], [ %13, %11 ]
  %14 = getelementptr inbounds i64, ptr %4, i64 %.tr30.lcssa
  %15 = load i64, ptr %14, align 8, !tbaa !5
  %16 = icmp eq i64 %15, 3
  br i1 %16, label %.loopexit, label %17

17:                                               ; preds = %.loopexit40
  store i64 3, ptr %14, align 8, !tbaa !5
  %18 = getelementptr inbounds i64, ptr %0, i64 %.tr30.lcssa
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %18, i64 8
  %21 = load i64, ptr %20, align 8, !tbaa !5
  %22 = icmp slt i64 %19, %21
  br i1 %22, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %17, %.lr.ph
  %.036 = phi i64 [ %25, %.lr.ph ], [ %19, %17 ]
  %23 = getelementptr inbounds i64, ptr %1, i64 %.036
  %24 = load i64, ptr %23, align 8, !tbaa !5
  tail call void @libmetis__MinCover_ColDFS(ptr noundef nonnull %0, ptr noundef %1, i64 noundef %24, ptr noundef %3, ptr noundef %4, i64 noundef 20)
  %25 = add nsw i64 %.036, 1
  %26 = load i64, ptr %20, align 8, !tbaa !5
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %.lr.ph, label %.loopexit, !llvm.loop !9

.loopexit:                                        ; preds = %.lr.ph, %7, %11, %17, %.loopexit40
  ret void
}

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

!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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass