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

; 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.controldef = type { i64, i64, i64, i64, i64, i64, float, i64, i64, i64, i64, %struct.workspacedef, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%struct.workspacedef = type { ptr, i64, i64, ptr, ptr, i64, ptr, ptr }
%struct.graphdef = type { i64, i64, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i64, i64, ptr, ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @libmetis__MocInit2WayPartition(ptr noundef %0, ptr noundef %1, ptr noundef %2, float noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store float %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.controldef, ptr %11, i32 0, i32 1
  %13 = load i64, ptr %12, align 8, !tbaa !11
  store i64 %13, ptr %10, align 8, !tbaa !16
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.controldef, ptr %14, i32 0, i32 1
  %16 = load i64, ptr %15, align 8, !tbaa !11
  %17 = and i64 %16, 8
  %18 = icmp ne i64 %17, 0
  br i1 %18, label %19, label %24

19:                                               ; preds = %4
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.controldef, ptr %20, i32 0, i32 1
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = sub nsw i64 %22, 8
  store i64 %23, ptr %21, align 8, !tbaa !11
  br label %24

24:                                               ; preds = %19, %4
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.controldef, ptr %25, i32 0, i32 1
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = and i64 %27, 32
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %30, label %35

30:                                               ; preds = %24
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.controldef, ptr %31, i32 0, i32 1
  %33 = load i64, ptr %32, align 8, !tbaa !11
  %34 = sub nsw i64 %33, 32
  store i64 %34, ptr %32, align 8, !tbaa !11
  br label %35

35:                                               ; preds = %30, %24
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.controldef, ptr %36, i32 0, i32 1
  %38 = load i64, ptr %37, align 8, !tbaa !11
  %39 = and i64 %38, 1
  %40 = icmp ne i64 %39, 0
  br i1 %40, label %41, label %47

41:                                               ; preds = %35
  %42 = call double @gk_CPUSeconds()
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.controldef, ptr %43, i32 0, i32 13
  %45 = load double, ptr %44, align 8, !tbaa !17
  %46 = fsub double %45, %42
  store double %46, ptr %44, align 8, !tbaa !17
  br label %47

47:                                               ; preds = %41, %35
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.controldef, ptr %48, i32 0, i32 3
  %50 = load i64, ptr %49, align 8, !tbaa !18
  switch i64 %50, label %72 [
    i64 1, label %51
    i64 2, label %67
  ]

51:                                               ; preds = %47
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.graphdef, ptr %52, i32 0, i32 1
  %54 = load i64, ptr %53, align 8, !tbaa !19
  %55 = icmp eq i64 %54, 0
  br i1 %55, label %56, label %61

56:                                               ; preds = %51
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = load float, ptr %8, align 4, !tbaa !9
  call void @libmetis__MocRandomBisection(ptr noundef %57, ptr noundef %58, ptr noundef %59, float noundef %60)
  br label %66

61:                                               ; preds = %51
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = load float, ptr %8, align 4, !tbaa !9
  call void @libmetis__MocGrowBisection(ptr noundef %62, ptr noundef %63, ptr noundef %64, float noundef %65)
  br label %66

66:                                               ; preds = %61, %56
  br label %76

67:                                               ; preds = %47
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load float, ptr %8, align 4, !tbaa !9
  call void @libmetis__MocRandomBisection(ptr noundef %68, ptr noundef %69, ptr noundef %70, float noundef %71)
  br label %76

72:                                               ; preds = %47
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.controldef, ptr %73, i32 0, i32 3
  %75 = load i64, ptr %74, align 8, !tbaa !18
  call void (ptr, ...) @errexit(ptr noundef @.str, i64 noundef %75)
  br label %76

76:                                               ; preds = %72, %67, %66
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.controldef, ptr %77, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !11
  %80 = and i64 %79, 16
  %81 = icmp ne i64 %80, 0
  br i1 %81, label %82, label %92

82:                                               ; preds = %76
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.graphdef, ptr %83, i32 0, i32 16
  %85 = load i64, ptr %84, align 8, !tbaa !22
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.graphdef, ptr %86, i32 0, i32 18
  %88 = load ptr, ptr %87, align 8, !tbaa !23
  %89 = getelementptr inbounds i64, ptr %88, i64 0
  %90 = load i64, ptr %89, align 8, !tbaa !16
  %91 = call i32 (ptr, ...) @mprintf(ptr noundef @.str.1, i64 noundef %85, i64 noundef %90)
  br label %92

92:                                               ; preds = %82, %76
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.controldef, ptr %93, i32 0, i32 1
  %95 = load i64, ptr %94, align 8, !tbaa !11
  %96 = and i64 %95, 1
  %97 = icmp ne i64 %96, 0
  br i1 %97, label %98, label %104

98:                                               ; preds = %92
  %99 = call double @gk_CPUSeconds()
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.controldef, ptr %100, i32 0, i32 13
  %102 = load double, ptr %101, align 8, !tbaa !17
  %103 = fadd double %102, %99
  store double %103, ptr %101, align 8, !tbaa !17
  br label %104

104:                                              ; preds = %98, %92
  %105 = load i64, ptr %10, align 8, !tbaa !16
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.controldef, ptr %106, i32 0, i32 1
  store i64 %105, ptr %107, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret void
}

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

declare double @gk_CPUSeconds() #2

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__MocRandomBisection(ptr noundef, ptr noundef, ptr noundef, float noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__MocGrowBisection(ptr noundef, ptr noundef, ptr noundef, float noundef) #0

declare void @errexit(ptr noundef, ...) #2

declare i32 @mprintf(ptr noundef, ...) #2

; 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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"controldef", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !10, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !14, i64 88, !15, i64 152, !15, i64 160, !15, i64 168, !15, i64 176, !15, i64 184, !15, i64 192, !15, i64 200, !15, i64 208, !15, i64 216, !15, i64 224, !15, i64 232, !15, i64 240, !15, i64 248, !15, i64 256, !15, i64 264, !15, i64 272}
!13 = !{!"long", !7, i64 0}
!14 = !{!"workspacedef", !6, i64 0, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !6, i64 48, !6, i64 56}
!15 = !{!"double", !7, i64 0}
!16 = !{!13, !13, i64 0}
!17 = !{!12, !15, i64 160}
!18 = !{!12, !13, i64 24}
!19 = !{!20, !13, i64 8}
!20 = !{!"graphdef", !13, i64 0, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !21, i64 56, !21, i64 60, !21, i64 64, !21, i64 68, !21, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !13, i64 112, !13, i64 120, !6, i64 128, !6, i64 136, !13, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !13, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240}
!21 = !{!"int", !7, i64 0}
!22 = !{!20, !13, i64 112}
!23 = !{!20, !6, i64 128}


; 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 [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @libmetis__MocInit2WayPartition(ptr noundef %0, ptr noundef %1, ptr noundef %2, float noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = and i64 %6, 8
  %.not.not = icmp eq i64 %7, 0
  %8 = add nsw i64 %6, -8
  %9 = select i1 %.not.not, i64 %6, i64 %8
  %10 = and i64 %9, 32
  %.not28.not = icmp eq i64 %10, 0
  %11 = add nsw i64 %9, -32
  %12 = select i1 %.not28.not, i64 %9, i64 %11
  %13 = or disjoint i64 %7, %10
  %.not32 = icmp eq i64 %13, 0
  br i1 %.not32, label %15, label %14

14:                                               ; preds = %4
  store i64 %12, ptr %5, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %4, %14
  %16 = and i64 %12, 1
  %.not29 = icmp eq i64 %16, 0
  br i1 %.not29, label %22, label %17

17:                                               ; preds = %15
  %18 = tail call double @gk_CPUSeconds() #2
  %19 = getelementptr inbounds i8, ptr %0, i64 160
  %20 = load double, ptr %19, align 8, !tbaa !14
  %21 = fsub double %20, %18
  store double %21, ptr %19, align 8, !tbaa !14
  br label %22

22:                                               ; preds = %17, %15
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  %24 = load i64, ptr %23, align 8, !tbaa !15
  switch i64 %24, label %32 [
    i64 1, label %25
    i64 2, label %31
  ]

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %1, i64 8
  %27 = load i64, ptr %26, align 8, !tbaa !16
  %28 = icmp eq i64 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %25
  tail call void @libmetis__MocRandomBisection(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %2, float noundef %3)
  br label %33

30:                                               ; preds = %25
  tail call void @libmetis__MocGrowBisection(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %2, float noundef %3)
  br label %33

31:                                               ; preds = %22
  tail call void @libmetis__MocRandomBisection(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, float noundef %3)
  br label %33

32:                                               ; preds = %22
  tail call void (ptr, ...) @errexit(ptr noundef nonnull @.str, i64 noundef %24) #2
  br label %33

33:                                               ; preds = %29, %30, %32, %31
  %34 = load i64, ptr %5, align 8, !tbaa !5
  %35 = and i64 %34, 16
  %.not30 = icmp eq i64 %35, 0
  br i1 %.not30, label %43, label %36

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %1, i64 112
  %38 = load i64, ptr %37, align 8, !tbaa !19
  %39 = getelementptr inbounds i8, ptr %1, i64 128
  %40 = load ptr, ptr %39, align 8, !tbaa !20
  %41 = load i64, ptr %40, align 8, !tbaa !21
  %42 = tail call i32 (ptr, ...) @mprintf(ptr noundef nonnull @.str.1, i64 noundef %38, i64 noundef %41) #2
  %.pre = load i64, ptr %5, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %36, %33
  %44 = phi i64 [ %.pre, %36 ], [ %34, %33 ]
  %45 = and i64 %44, 1
  %.not31 = icmp eq i64 %45, 0
  br i1 %.not31, label %51, label %46

46:                                               ; preds = %43
  %47 = tail call double @gk_CPUSeconds() #2
  %48 = getelementptr inbounds i8, ptr %0, i64 160
  %49 = load double, ptr %48, align 8, !tbaa !14
  %50 = fadd double %47, %49
  store double %50, ptr %48, align 8, !tbaa !14
  br label %51

51:                                               ; preds = %46, %43
  store i64 %6, ptr %5, align 8, !tbaa !5
  ret void
}

declare double @gk_CPUSeconds() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__MocRandomBisection(ptr noundef, ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @libmetis__MocGrowBisection(ptr noundef, ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

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

declare i32 @mprintf(ptr noundef, ...) local_unnamed_addr #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" }
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, !7, i64 8}
!6 = !{!"controldef", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !11, i64 88, !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, !13, i64 232, !13, i64 240, !13, i64 248, !13, i64 256, !13, i64 264, !13, i64 272}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"workspacedef", !12, i64 0, !7, i64 8, !7, i64 16, !12, i64 24, !12, i64 32, !7, i64 40, !12, i64 48, !12, i64 56}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!6, !13, i64 160}
!15 = !{!6, !7, i64 24}
!16 = !{!17, !7, i64 8}
!17 = !{!"graphdef", !7, i64 0, !7, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !18, i64 56, !18, i64 60, !18, i64 64, !18, i64 68, !18, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !7, i64 112, !7, i64 120, !12, i64 128, !12, i64 136, !7, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !7, i64 208, !12, i64 216, !12, i64 224, !12, i64 232, !12, i64 240}
!18 = !{!"int", !8, i64 0}
!19 = !{!17, !7, i64 112}
!20 = !{!17, !12, i64 128}
!21 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass