; LLVM IR from ippeb/ACM-ICPC :: graph_theory/dijkstra/dijkstra_O(n**2).ll (Z8dijkstrai)

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

@edges = external dso_local global [1001 x [1001 x i32]], align 16
@degree = external dso_local global [1001 x i32], align 16
@nvertices = external dso_local global i32, align 4
@parent = external dso_local global [1001 x i32], align 16
@weight = external dso_local global [1001 x [1001 x i32]], align 16
@Weight = external dso_local global i32, align 4
@dist = external dso_local global i32, align 4
@v = external dso_local global i32, align 4
@w = external dso_local global i32, align 4
@Distance = external dso_local global [1001 x i32], align 16

; 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: mustprogress nounwind uwtable
define dso_local void @_Z8dijkstrai(i32 noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca [1001 x i8], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1001, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %22, %1
  %8 = load i32, ptr %4, align 4, !tbaa !5
  %9 = load i32, ptr @nvertices, align 4, !tbaa !5
  %10 = icmp sle i32 %8, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  br label %25

12:                                               ; preds = %7
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [1001 x i8], ptr %3, i64 0, i64 %14
  store i8 0, ptr %15, align 1, !tbaa !9
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %17
  store i32 1000000000, ptr %18, align 4, !tbaa !5
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1001 x i32], ptr @parent, i64 0, i64 %20
  store i32 -1, ptr %21, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %12
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %4, align 4, !tbaa !5
  br label %7, !llvm.loop !11

25:                                               ; preds = %11
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %27
  store i32 0, ptr %28, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %29, ptr @v, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %125, %25
  %31 = load i32, ptr @v, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1001 x i8], ptr %3, i64 0, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !9, !range !13, !noundef !14
  %35 = trunc i8 %34 to i1
  %36 = zext i1 %35 to i32
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %126

38:                                               ; preds = %30
  %39 = load i32, ptr @v, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1001 x i8], ptr %3, i64 0, i64 %40
  store i8 1, ptr %41, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %91, %38
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = load i32, ptr @v, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1001 x i32], ptr @degree, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = icmp slt i32 %43, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  br label %94

50:                                               ; preds = %42
  %51 = load i32, ptr @v, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1001 x [1001 x i32]], ptr @edges, i64 0, i64 %52
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1001 x i32], ptr %53, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  store i32 %57, ptr @w, align 4, !tbaa !5
  %58 = load i32, ptr @v, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1001 x [1001 x i32]], ptr @weight, i64 0, i64 %59
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1001 x i32], ptr %60, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  store i32 %64, ptr @Weight, align 4, !tbaa !5
  %65 = load i32, ptr @w, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = load i32, ptr @v, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = load i32, ptr @Weight, align 4, !tbaa !5
  %74 = add nsw i32 %72, %73
  %75 = icmp sgt i32 %68, %74
  br i1 %75, label %76, label %90

76:                                               ; preds = %50
  %77 = load i32, ptr @v, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load i32, ptr @Weight, align 4, !tbaa !5
  %82 = add nsw i32 %80, %81
  %83 = load i32, ptr @w, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %84
  store i32 %82, ptr %85, align 4, !tbaa !5
  %86 = load i32, ptr @v, align 4, !tbaa !5
  %87 = load i32, ptr @w, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1001 x i32], ptr @parent, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %76, %50
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %5, align 4, !tbaa !5
  br label %42, !llvm.loop !15

94:                                               ; preds = %49
  store i32 1, ptr @v, align 4, !tbaa !5
  store i32 1000000000, ptr @dist, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %122, %94
  %96 = load i32, ptr %6, align 4, !tbaa !5
  %97 = load i32, ptr @nvertices, align 4, !tbaa !5
  %98 = icmp sle i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  br label %125

100:                                              ; preds = %95
  %101 = load i32, ptr @dist, align 4, !tbaa !5
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = icmp sgt i32 %101, %105
  br i1 %106, label %107, label %121

107:                                              ; preds = %100
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1001 x i8], ptr %3, i64 0, i64 %109
  %111 = load i8, ptr %110, align 1, !tbaa !9, !range !13, !noundef !14
  %112 = trunc i8 %111 to i1
  %113 = zext i1 %112 to i32
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %115, label %121

115:                                              ; preds = %107
  %116 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %116, ptr @v, align 4, !tbaa !5
  %117 = load i32, ptr %6, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  store i32 %120, ptr @dist, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %115, %107, %100
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %6, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %6, align 4, !tbaa !5
  br label %95, !llvm.loop !16

125:                                              ; preds = %99
  br label %30, !llvm.loop !17

126:                                              ; preds = %30
  call void @llvm.lifetime.end.p0(i64 1001, ptr %3) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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

@edges = external dso_local local_unnamed_addr global [1001 x [1001 x i32]], align 16
@degree = external dso_local local_unnamed_addr global [1001 x i32], align 16
@nvertices = external dso_local local_unnamed_addr global i32, align 4
@parent = external dso_local local_unnamed_addr global [1001 x i32], align 16
@weight = external dso_local local_unnamed_addr global [1001 x [1001 x i32]], align 16
@Weight = external dso_local local_unnamed_addr global i32, align 4
@dist = external dso_local local_unnamed_addr global i32, align 4
@v = external dso_local local_unnamed_addr global i32, align 4
@w = external dso_local local_unnamed_addr global i32, align 4
@Distance = external dso_local local_unnamed_addr global [1001 x i32], align 16

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

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @_Z8dijkstrai(i32 noundef %0) local_unnamed_addr #1 {
  %2 = alloca [1001 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %2) #3
  %3 = load i32, ptr @nvertices, align 4, !tbaa !5
  %.not21 = icmp slt i32 %3, 1
  br i1 %.not21, label %.lr.ph40.thread, label %.lr.ph.preheader

.lr.ph40.thread:                                  ; preds = %1
  %.pre70 = sext i32 %0 to i64
  %4 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %.pre70
  store i32 0, ptr %4, align 4, !tbaa !5
  store i32 %0, ptr @v, align 4, !tbaa !5
  %5 = getelementptr inbounds [1001 x i8], ptr %2, i64 0, i64 %.pre70
  br label %.lr.ph40.split.us

.lr.ph.preheader:                                 ; preds = %1
  %scevgep = getelementptr inbounds i8, ptr %2, i64 1
  %6 = zext nneg i32 %3 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %scevgep, i8 0, i64 %6, i1 false), !tbaa !9
  %7 = shl nuw nsw i64 %6, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @parent, i64 4), i8 -1, i64 %7, i1 false), !tbaa !5
  %8 = add nuw i32 %3, 1
  %wide.trip.count = zext i32 %8 to i64
  %9 = zext nneg i32 %3 to i64
  %min.iters.check = icmp ult i32 %3, 8
  br i1 %min.iters.check, label %.lr.ph.preheader90, label %vector.ph

.lr.ph.preheader90:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %9, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %10 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %offset.idx
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %10, align 4, !tbaa !5
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %11, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %12 = icmp eq i64 %index.next, %n.vec
  br i1 %12, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %9
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader90

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %.phi.trans.insert = sext i32 %0 to i64
  %.phi.trans.insert69 = getelementptr inbounds [1001 x i8], ptr %2, i64 0, i64 %.phi.trans.insert
  %.pre = load i8, ptr %.phi.trans.insert69, align 1, !tbaa !9, !range !15
  %13 = icmp eq i8 %.pre, 0
  %14 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %.phi.trans.insert
  store i32 0, ptr %14, align 4, !tbaa !5
  store i32 %0, ptr @v, align 4, !tbaa !5
  %15 = getelementptr inbounds [1001 x i8], ptr %2, i64 0, i64 %.phi.trans.insert
  br i1 %13, label %.lr.ph40, label %96

.lr.ph40:                                         ; preds = %._crit_edge
  br i1 %.not21, label %.lr.ph40.split.us, label %.lr.ph40.split.preheader

.lr.ph40.split.preheader:                         ; preds = %.lr.ph40
  %16 = zext nneg i32 %3 to i64
  %xtraiter = and i64 %16, 1
  %17 = icmp eq i32 %8, 2
  %unroll_iter = and i64 %16, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph40.split

.lr.ph40.split.us:                                ; preds = %.lr.ph40.thread, %.lr.ph40
  %.pre-phi7274 = phi i64 [ %.pre70, %.lr.ph40.thread ], [ %.phi.trans.insert, %.lr.ph40 ]
  %18 = phi ptr [ %5, %.lr.ph40.thread ], [ %15, %.lr.ph40 ]
  %19 = getelementptr inbounds i8, ptr %2, i64 1
  br label %20

20:                                               ; preds = %.loopexit.us, %.lr.ph40.split.us
  %21 = phi ptr [ %18, %.lr.ph40.split.us ], [ %19, %.loopexit.us ]
  %22 = phi i64 [ %.pre-phi7274, %.lr.ph40.split.us ], [ 1, %.loopexit.us ]
  %.0303338.us = phi i32 [ %0, %.lr.ph40.split.us ], [ 1, %.loopexit.us ]
  store i8 1, ptr %21, align 1, !tbaa !9
  %23 = getelementptr inbounds [1001 x i32], ptr @degree, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph25.us, label %.loopexit.us

.loopexit.us:                                     ; preds = %._crit_edge26.us, %20
  %26 = load i8, ptr %19, align 1, !tbaa !9, !range !15, !noundef !16
  %27 = icmp eq i8 %26, 0
  br i1 %27, label %20, label %._crit_edge41, !llvm.loop !17

28:                                               ; preds = %.lr.ph25.us, %41
  %indvars.iv64 = phi i64 [ 0, %.lr.ph25.us ], [ %indvars.iv.next65, %41 ]
  %29 = getelementptr inbounds [1001 x [1001 x i32]], ptr @edges, i64 0, i64 %22, i64 %indvars.iv64
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = getelementptr inbounds [1001 x [1001 x i32]], ptr @weight, i64 0, i64 %22, i64 %indvars.iv64
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %30 to i64
  %34 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = load i32, ptr %42, align 4, !tbaa !5
  %37 = add nsw i32 %36, %32
  %38 = icmp sgt i32 %35, %37
  br i1 %38, label %39, label %41

39:                                               ; preds = %28
  store i32 %37, ptr %34, align 4, !tbaa !5
  %40 = getelementptr inbounds [1001 x i32], ptr @parent, i64 0, i64 %33
  store i32 %.0303338.us, ptr %40, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %39, %28
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %exitcond68.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count67
  br i1 %exitcond68.not, label %._crit_edge26.us, label %28, !llvm.loop !18

.lr.ph25.us:                                      ; preds = %20
  %42 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %22
  %wide.trip.count67 = zext nneg i32 %24 to i64
  br label %28

._crit_edge26.us:                                 ; preds = %41
  store i32 %30, ptr @w, align 4, !tbaa !5
  store i32 %32, ptr @Weight, align 4, !tbaa !5
  br label %.loopexit.us

.lr.ph:                                           ; preds = %.lr.ph.preheader90, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader90 ]
  %43 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %indvars.iv
  store i32 1000000000, ptr %43, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !19

..loopexit_crit_edge.unr-lcssa:                   ; preds = %94, %.lr.ph32.preheader
  %.03034.lcssa.ph = phi i32 [ poison, %.lr.ph32.preheader ], [ %.03034.1, %94 ]
  %.lcssa89.ph = phi i32 [ poison, %.lr.ph32.preheader ], [ %95, %94 ]
  %indvars.iv59.unr = phi i64 [ 1, %.lr.ph32.preheader ], [ %indvars.iv.next60.1, %94 ]
  %.03035.unr = phi i32 [ 1, %.lr.ph32.preheader ], [ %.03034.1, %94 ]
  %.unr = phi i32 [ 1000000000, %.lr.ph32.preheader ], [ %95, %94 ]
  br i1 %lcmp.mod.not, label %..loopexit_crit_edge, label %.lr.ph32.epil

.lr.ph32.epil:                                    ; preds = %..loopexit_crit_edge.unr-lcssa
  %44 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %indvars.iv59.unr
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp sgt i32 %.unr, %45
  br i1 %46, label %47, label %..loopexit_crit_edge

47:                                               ; preds = %.lr.ph32.epil
  %48 = getelementptr inbounds [1001 x i8], ptr %2, i64 0, i64 %indvars.iv59.unr
  %49 = load i8, ptr %48, align 1, !tbaa !9, !range !15, !noundef !16
  %50 = icmp eq i8 %49, 0
  %51 = trunc nuw nsw i64 %indvars.iv59.unr to i32
  %spec.select.epil = select i1 %50, i32 %51, i32 %.03035.unr
  %spec.select47.epil = select i1 %50, i32 %45, i32 %.unr
  br label %..loopexit_crit_edge

..loopexit_crit_edge:                             ; preds = %.lr.ph32.epil, %47, %..loopexit_crit_edge.unr-lcssa
  %.03034.lcssa = phi i32 [ %.03034.lcssa.ph, %..loopexit_crit_edge.unr-lcssa ], [ %.03035.unr, %.lr.ph32.epil ], [ %spec.select.epil, %47 ]
  %.lcssa89 = phi i32 [ %.lcssa89.ph, %..loopexit_crit_edge.unr-lcssa ], [ %.unr, %.lr.ph32.epil ], [ %spec.select47.epil, %47 ]
  %52 = sext i32 %.03034.lcssa to i64
  %53 = getelementptr inbounds [1001 x i8], ptr %2, i64 0, i64 %52
  %54 = load i8, ptr %53, align 1, !tbaa !9, !range !15, !noundef !16
  %55 = icmp eq i8 %54, 0
  br i1 %55, label %.lr.ph40.split, label %._crit_edge41, !llvm.loop !17

.lr.ph40.split:                                   ; preds = %.lr.ph40.split.preheader, %..loopexit_crit_edge
  %56 = phi ptr [ %53, %..loopexit_crit_edge ], [ %15, %.lr.ph40.split.preheader ]
  %57 = phi i64 [ %52, %..loopexit_crit_edge ], [ %.phi.trans.insert, %.lr.ph40.split.preheader ]
  %.0303338 = phi i32 [ %.03034.lcssa, %..loopexit_crit_edge ], [ %0, %.lr.ph40.split.preheader ]
  store i8 1, ptr %56, align 1, !tbaa !9
  %58 = getelementptr inbounds [1001 x i32], ptr @degree, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %.lr.ph25, label %.lr.ph32.preheader

.lr.ph32.preheader:                               ; preds = %._crit_edge26, %.lr.ph40.split
  br i1 %17, label %..loopexit_crit_edge.unr-lcssa, label %.lr.ph32

.lr.ph25:                                         ; preds = %.lr.ph40.split
  %61 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %57
  %wide.trip.count57 = zext nneg i32 %59 to i64
  br label %62

._crit_edge26:                                    ; preds = %75
  store i32 %64, ptr @w, align 4, !tbaa !5
  store i32 %66, ptr @Weight, align 4, !tbaa !5
  br label %.lr.ph32.preheader

62:                                               ; preds = %.lr.ph25, %75
  %indvars.iv54 = phi i64 [ 0, %.lr.ph25 ], [ %indvars.iv.next55, %75 ]
  %63 = getelementptr inbounds [1001 x [1001 x i32]], ptr @edges, i64 0, i64 %57, i64 %indvars.iv54
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = getelementptr inbounds [1001 x [1001 x i32]], ptr @weight, i64 0, i64 %57, i64 %indvars.iv54
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %64 to i64
  %68 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = load i32, ptr %61, align 4, !tbaa !5
  %71 = add nsw i32 %70, %66
  %72 = icmp sgt i32 %69, %71
  br i1 %72, label %73, label %75

73:                                               ; preds = %62
  store i32 %71, ptr %68, align 4, !tbaa !5
  %74 = getelementptr inbounds [1001 x i32], ptr @parent, i64 0, i64 %67
  store i32 %.0303338, ptr %74, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %62, %73
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond58.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count57
  br i1 %exitcond58.not, label %._crit_edge26, label %62, !llvm.loop !18

.lr.ph32:                                         ; preds = %.lr.ph32.preheader, %94
  %indvars.iv59 = phi i64 [ %indvars.iv.next60.1, %94 ], [ 1, %.lr.ph32.preheader ]
  %.03035 = phi i32 [ %.03034.1, %94 ], [ 1, %.lr.ph32.preheader ]
  %76 = phi i32 [ %95, %94 ], [ 1000000000, %.lr.ph32.preheader ]
  %niter = phi i64 [ %niter.next.1, %94 ], [ 0, %.lr.ph32.preheader ]
  %77 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %indvars.iv59
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp sgt i32 %76, %78
  br i1 %79, label %80, label %.lr.ph32.1

80:                                               ; preds = %.lr.ph32
  %81 = getelementptr inbounds [1001 x i8], ptr %2, i64 0, i64 %indvars.iv59
  %82 = load i8, ptr %81, align 1, !tbaa !9, !range !15, !noundef !16
  %83 = icmp eq i8 %82, 0
  %84 = trunc nuw nsw i64 %indvars.iv59 to i32
  %spec.select = select i1 %83, i32 %84, i32 %.03035
  %spec.select47 = select i1 %83, i32 %78, i32 %76
  br label %.lr.ph32.1

.lr.ph32.1:                                       ; preds = %80, %.lr.ph32
  %.03034 = phi i32 [ %.03035, %.lr.ph32 ], [ %spec.select, %80 ]
  %85 = phi i32 [ %76, %.lr.ph32 ], [ %spec.select47, %80 ]
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %86 = getelementptr inbounds [1001 x i32], ptr @Distance, i64 0, i64 %indvars.iv.next60
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = icmp sgt i32 %85, %87
  br i1 %88, label %89, label %94

89:                                               ; preds = %.lr.ph32.1
  %90 = getelementptr inbounds [1001 x i8], ptr %2, i64 0, i64 %indvars.iv.next60
  %91 = load i8, ptr %90, align 1, !tbaa !9, !range !15, !noundef !16
  %92 = icmp eq i8 %91, 0
  %93 = trunc nuw nsw i64 %indvars.iv.next60 to i32
  %spec.select.1 = select i1 %92, i32 %93, i32 %.03034
  %spec.select47.1 = select i1 %92, i32 %87, i32 %85
  br label %94

94:                                               ; preds = %89, %.lr.ph32.1
  %.03034.1 = phi i32 [ %.03034, %.lr.ph32.1 ], [ %spec.select.1, %89 ]
  %95 = phi i32 [ %85, %.lr.ph32.1 ], [ %spec.select47.1, %89 ]
  %indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %..loopexit_crit_edge.unr-lcssa, label %.lr.ph32, !llvm.loop !20

._crit_edge41:                                    ; preds = %..loopexit_crit_edge, %.loopexit.us
  %.us-phi = phi i32 [ 1000000000, %.loopexit.us ], [ %.lcssa89, %..loopexit_crit_edge ]
  %.us-phi46 = phi i32 [ 1, %.loopexit.us ], [ %.03034.lcssa, %..loopexit_crit_edge ]
  store i32 %.us-phi46, ptr @v, align 4, !tbaa !5
  store i32 %.us-phi, ptr @dist, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %._crit_edge41, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %2) #3
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12, !14, !13}
!20 = distinct !{!20, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass