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

; 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.ContactInfoType = type { i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.DTreeNodeType = type { i64, double, i64, i64, i64, i64, i64, i64 }

@.str.41 = external hidden unnamed_addr constant [31 x i8], align 1

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

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

; 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 @CheckDTreeSurface(i64 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store i64 %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %18 = load ptr, ptr %9, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.ContactInfoType, ptr %18, i32 0, i32 3
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  store ptr %20, ptr %15, align 8, !tbaa !9
  %21 = load ptr, ptr %9, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct.ContactInfoType, ptr %21, i32 0, i32 4
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  store ptr %23, ptr %16, align 8, !tbaa !9
  %24 = load ptr, ptr %9, align 8, !tbaa !9
  %25 = getelementptr inbounds %struct.ContactInfoType, ptr %24, i32 0, i32 8
  %26 = load ptr, ptr %25, align 8, !tbaa !14
  store ptr %26, ptr %17, align 8, !tbaa !9
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %121, %5
  %28 = load i64, ptr %11, align 8, !tbaa !5
  %29 = load i64, ptr %6, align 8, !tbaa !5
  %30 = icmp slt i64 %28, %29
  br i1 %30, label %31, label %124

31:                                               ; preds = %27
  %32 = load ptr, ptr %10, align 8, !tbaa !9
  %33 = load i64, ptr %11, align 8, !tbaa !5
  %34 = getelementptr inbounds i64, ptr %32, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = icmp ne i64 %35, 0
  br i1 %36, label %38, label %37

37:                                               ; preds = %31
  br label %121

38:                                               ; preds = %31
  store i64 0, ptr %14, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %76, %38
  %40 = load ptr, ptr %17, align 8, !tbaa !9
  %41 = load i64, ptr %14, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.DTreeNodeType, ptr %40, i64 %41
  %43 = getelementptr inbounds %struct.DTreeNodeType, ptr %42, i32 0, i32 4
  %44 = load i64, ptr %43, align 8, !tbaa !15
  %45 = icmp eq i64 %44, -1
  br i1 %45, label %46, label %78

46:                                               ; preds = %39
  %47 = load ptr, ptr %7, align 8, !tbaa !9
  %48 = load i64, ptr %11, align 8, !tbaa !5
  %49 = mul nsw i64 3, %48
  %50 = load ptr, ptr %17, align 8, !tbaa !9
  %51 = load i64, ptr %14, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.DTreeNodeType, ptr %50, i64 %51
  %53 = getelementptr inbounds %struct.DTreeNodeType, ptr %52, i32 0, i32 0
  %54 = load i64, ptr %53, align 8, !tbaa !18
  %55 = add nsw i64 %49, %54
  %56 = getelementptr inbounds double, ptr %47, i64 %55
  %57 = load double, ptr %56, align 8, !tbaa !19
  %58 = load ptr, ptr %17, align 8, !tbaa !9
  %59 = load i64, ptr %14, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.DTreeNodeType, ptr %58, i64 %59
  %61 = getelementptr inbounds %struct.DTreeNodeType, ptr %60, i32 0, i32 1
  %62 = load double, ptr %61, align 8, !tbaa !20
  %63 = fcmp ole double %57, %62
  br i1 %63, label %64, label %70

64:                                               ; preds = %46
  %65 = load ptr, ptr %17, align 8, !tbaa !9
  %66 = load i64, ptr %14, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.DTreeNodeType, ptr %65, i64 %66
  %68 = getelementptr inbounds %struct.DTreeNodeType, ptr %67, i32 0, i32 6
  %69 = load i64, ptr %68, align 8, !tbaa !21
  br label %76

70:                                               ; preds = %46
  %71 = load ptr, ptr %17, align 8, !tbaa !9
  %72 = load i64, ptr %14, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.DTreeNodeType, ptr %71, i64 %72
  %74 = getelementptr inbounds %struct.DTreeNodeType, ptr %73, i32 0, i32 7
  %75 = load i64, ptr %74, align 8, !tbaa !22
  br label %76

76:                                               ; preds = %70, %64
  %77 = phi i64 [ %69, %64 ], [ %75, %70 ]
  store i64 %77, ptr %14, align 8, !tbaa !5
  br label %39, !llvm.loop !23

78:                                               ; preds = %39
  %79 = load ptr, ptr %9, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct.ContactInfoType, ptr %79, i32 0, i32 7
  %81 = load ptr, ptr %80, align 8, !tbaa !25
  %82 = load i64, ptr %11, align 8, !tbaa !5
  %83 = getelementptr inbounds i64, ptr %81, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !5
  %85 = load ptr, ptr %17, align 8, !tbaa !9
  %86 = load i64, ptr %14, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.DTreeNodeType, ptr %85, i64 %86
  %88 = getelementptr inbounds %struct.DTreeNodeType, ptr %87, i32 0, i32 4
  %89 = load i64, ptr %88, align 8, !tbaa !15
  %90 = icmp ne i64 %84, %89
  br i1 %90, label %91, label %120

91:                                               ; preds = %78
  %92 = load i64, ptr %11, align 8, !tbaa !5
  %93 = load ptr, ptr %9, align 8, !tbaa !9
  %94 = getelementptr inbounds %struct.ContactInfoType, ptr %93, i32 0, i32 7
  %95 = load ptr, ptr %94, align 8, !tbaa !25
  %96 = load i64, ptr %11, align 8, !tbaa !5
  %97 = getelementptr inbounds i64, ptr %95, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !5
  %99 = load ptr, ptr %17, align 8, !tbaa !9
  %100 = load i64, ptr %14, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.DTreeNodeType, ptr %99, i64 %100
  %102 = getelementptr inbounds %struct.DTreeNodeType, ptr %101, i32 0, i32 4
  %103 = load i64, ptr %102, align 8, !tbaa !15
  %104 = load ptr, ptr %8, align 8, !tbaa !9
  %105 = load i64, ptr %11, align 8, !tbaa !5
  %106 = getelementptr inbounds i64, ptr %104, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !5
  %108 = load ptr, ptr %16, align 8, !tbaa !9
  %109 = load ptr, ptr %15, align 8, !tbaa !9
  %110 = load ptr, ptr %17, align 8, !tbaa !9
  %111 = load i64, ptr %14, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.DTreeNodeType, ptr %110, i64 %111
  %113 = getelementptr inbounds %struct.DTreeNodeType, ptr %112, i32 0, i32 4
  %114 = load i64, ptr %113, align 8, !tbaa !15
  %115 = getelementptr inbounds i64, ptr %109, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !5
  %117 = getelementptr inbounds i64, ptr %108, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !5
  %119 = call i32 (ptr, ...) @mprintf(ptr noundef @.str.41, i64 noundef %92, i64 noundef %98, i64 noundef %103, i64 noundef %107, i64 noundef %118)
  br label %120

120:                                              ; preds = %91, %78
  br label %121

121:                                              ; preds = %120, %37
  %122 = load i64, ptr %11, align 8, !tbaa !5
  %123 = add nsw i64 %122, 1
  store i64 %123, ptr %11, align 8, !tbaa !5
  br label %27, !llvm.loop !26

124:                                              ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret void
}

attributes #0 = { 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!13 = !{!12, !10, i64 32}
!14 = !{!12, !10, i64 64}
!15 = !{!16, !6, i64 32}
!16 = !{!"", !6, i64 0, !17, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!17 = !{!"double", !7, i64 0}
!18 = !{!16, !6, i64 0}
!19 = !{!17, !17, i64 0}
!20 = !{!16, !17, i64 8}
!21 = !{!16, !6, i64 48}
!22 = !{!16, !6, i64 56}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!12, !10, i64 56}
!26 = distinct !{!26, !24}


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

%struct.DTreeNodeType = type { i64, double, i64, i64, i64, i64, i64, i64 }

@.str.41 = external hidden unnamed_addr constant [31 x i8], align 1

declare i32 @mprintf(ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @CheckDTreeSurface(i64 noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %3, i64 24
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %3, i64 32
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %3, i64 64
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = icmp sgt i64 %0, 0
  br i1 %12, label %.lr.ph40, label %._crit_edge41

.lr.ph40:                                         ; preds = %5
  %13 = getelementptr inbounds i8, ptr %11, i64 32
  %14 = getelementptr inbounds i8, ptr %3, i64 56
  br label %15

15:                                               ; preds = %.lr.ph40, %45
  %.038 = phi i64 [ 0, %.lr.ph40 ], [ %46, %45 ]
  %16 = getelementptr inbounds i64, ptr %4, i64 %.038
  %17 = load i64, ptr %16, align 8, !tbaa !13
  %.not = icmp eq i64 %17, 0
  br i1 %.not, label %45, label %.preheader

.preheader:                                       ; preds = %15
  %18 = load i64, ptr %13, align 8, !tbaa !14
  %19 = icmp eq i64 %18, -1
  br i1 %19, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %.idx = mul i64 %.038, 24
  %20 = getelementptr i8, ptr %1, i64 %.idx
  br label %21

21:                                               ; preds = %.lr.ph, %21
  %22 = phi ptr [ %11, %.lr.ph ], [ %30, %21 ]
  %23 = load i64, ptr %22, align 8, !tbaa !17
  %24 = getelementptr double, ptr %20, i64 %23
  %25 = load double, ptr %24, align 8, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %22, i64 8
  %27 = load double, ptr %26, align 8, !tbaa !19
  %28 = fcmp ugt double %25, %27
  %.in.v = select i1 %28, i64 56, i64 48
  %.in = getelementptr inbounds i8, ptr %22, i64 %.in.v
  %29 = load i64, ptr %.in, align 8, !tbaa !13
  %30 = getelementptr inbounds %struct.DTreeNodeType, ptr %11, i64 %29
  %31 = getelementptr inbounds i8, ptr %30, i64 32
  %32 = load i64, ptr %31, align 8, !tbaa !14
  %33 = icmp eq i64 %32, -1
  br i1 %33, label %21, label %._crit_edge, !llvm.loop !20

._crit_edge:                                      ; preds = %21, %.preheader
  %.lcssa = phi i64 [ %18, %.preheader ], [ %32, %21 ]
  %34 = load ptr, ptr %14, align 8, !tbaa !22
  %35 = getelementptr inbounds i64, ptr %34, i64 %.038
  %36 = load i64, ptr %35, align 8, !tbaa !13
  %.not37 = icmp eq i64 %36, %.lcssa
  br i1 %.not37, label %45, label %37

37:                                               ; preds = %._crit_edge
  %38 = getelementptr inbounds i64, ptr %2, i64 %.038
  %39 = load i64, ptr %38, align 8, !tbaa !13
  %40 = getelementptr inbounds i64, ptr %7, i64 %.lcssa
  %41 = load i64, ptr %40, align 8, !tbaa !13
  %42 = getelementptr inbounds i64, ptr %9, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !13
  %44 = tail call i32 (ptr, ...) @mprintf(ptr noundef nonnull @.str.41, i64 noundef %.038, i64 noundef %36, i64 noundef %.lcssa, i64 noundef %39, i64 noundef %43) #2
  br label %45

45:                                               ; preds = %._crit_edge, %37, %15
  %46 = add nuw nsw i64 %.038, 1
  %exitcond.not = icmp eq i64 %46, %0
  br i1 %exitcond.not, label %._crit_edge41, label %15, !llvm.loop !23

._crit_edge41:                                    ; preds = %45, %5
  ret void
}

attributes #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 = { 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, !10, i64 24}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 32}
!12 = !{!6, !10, i64 64}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !7, i64 32}
!15 = !{!"", !7, i64 0, !16, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56}
!16 = !{!"double", !8, i64 0}
!17 = !{!15, !7, i64 0}
!18 = !{!16, !16, i64 0}
!19 = !{!15, !16, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!6, !10, i64 56}
!23 = distinct !{!23, !21}


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