; LLVM IR from HarshCasper/NeoAlgo :: C-Plus-Plus/graphs/BellmanFord.ll (Z11bellmanFordP5Graphi)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.Graph = type { i32, i32, ptr }
%struct.Edge = type { i32, i32, i32 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.2 = external hidden unnamed_addr constant [84 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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8showDistPii(ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11bellmanFordP5Graphi(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.Graph, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %21, align 8, !tbaa !11
  store i32 %22, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.Graph, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 4, !tbaa !13
  store i32 %25, ptr %6, align 4, !tbaa !9
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = zext i32 %26 to i64
  %28 = call ptr @llvm.stacksave.p0()
  store ptr %28, ptr %7, align 8
  %29 = alloca i32, i64 %27, align 16
  store i64 %27, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %39, %2
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %42

35:                                               ; preds = %30
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %29, i64 %37
  store i32 2147483647, ptr %38, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %35
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %9, align 4, !tbaa !9
  br label %30, !llvm.loop !14

42:                                               ; preds = %34
  %43 = load i32, ptr %4, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr %29, i64 %44
  store i32 0, ptr %45, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %115, %42
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = sub nsw i32 %48, 1
  %50 = icmp slt i32 %47, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %46
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %118

52:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %111, %52
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %114

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.Graph, ptr %59, i32 0, i32 2
  %61 = load ptr, ptr %60, align 8, !tbaa !16
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds %struct.Edge, ptr %61, i64 %63
  %65 = getelementptr inbounds %struct.Edge, ptr %64, i32 0, i32 0
  %66 = load i32, ptr %65, align 4, !tbaa !17
  store i32 %66, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.Graph, ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !16
  %70 = load i32, ptr %12, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %struct.Edge, ptr %69, i64 %71
  %73 = getelementptr inbounds %struct.Edge, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !19
  store i32 %74, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.Graph, ptr %75, i32 0, i32 2
  %77 = load ptr, ptr %76, align 8, !tbaa !16
  %78 = load i32, ptr %12, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds %struct.Edge, ptr %77, i64 %79
  %81 = getelementptr inbounds %struct.Edge, ptr %80, i32 0, i32 2
  %82 = load i32, ptr %81, align 4, !tbaa !20
  store i32 %82, ptr %15, align 4, !tbaa !9
  %83 = load i32, ptr %13, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i32, ptr %29, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = icmp ne i32 %86, 2147483647
  br i1 %87, label %88, label %110

88:                                               ; preds = %58
  %89 = load i32, ptr %13, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %29, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %93 = load i32, ptr %15, align 4, !tbaa !9
  %94 = add nsw i32 %92, %93
  %95 = load i32, ptr %14, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i32, ptr %29, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !9
  %99 = icmp slt i32 %94, %98
  br i1 %99, label %100, label %110

100:                                              ; preds = %88
  %101 = load i32, ptr %13, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr %29, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = load i32, ptr %15, align 4, !tbaa !9
  %106 = add nsw i32 %104, %105
  %107 = load i32, ptr %14, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %29, i64 %108
  store i32 %106, ptr %109, align 4, !tbaa !9
  br label %110

110:                                              ; preds = %100, %88, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %12, align 4, !tbaa !9
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %12, align 4, !tbaa !9
  br label %53, !llvm.loop !21

114:                                              ; preds = %57
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %10, align 4, !tbaa !9
  br label %46, !llvm.loop !22

118:                                              ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %119

119:                                              ; preds = %173, %118
  %120 = load i32, ptr %16, align 4, !tbaa !9
  %121 = load i32, ptr %6, align 4, !tbaa !9
  %122 = icmp slt i32 %120, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  store i32 11, ptr %11, align 4
  br label %176

124:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.Graph, ptr %125, i32 0, i32 2
  %127 = load ptr, ptr %126, align 8, !tbaa !16
  %128 = load i32, ptr %16, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds %struct.Edge, ptr %127, i64 %129
  %131 = getelementptr inbounds %struct.Edge, ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 4, !tbaa !17
  store i32 %132, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.Graph, ptr %133, i32 0, i32 2
  %135 = load ptr, ptr %134, align 8, !tbaa !16
  %136 = load i32, ptr %16, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds %struct.Edge, ptr %135, i64 %137
  %139 = getelementptr inbounds %struct.Edge, ptr %138, i32 0, i32 1
  %140 = load i32, ptr %139, align 4, !tbaa !19
  store i32 %140, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %141 = load ptr, ptr %3, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.Graph, ptr %141, i32 0, i32 2
  %143 = load ptr, ptr %142, align 8, !tbaa !16
  %144 = load i32, ptr %16, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds %struct.Edge, ptr %143, i64 %145
  %147 = getelementptr inbounds %struct.Edge, ptr %146, i32 0, i32 2
  %148 = load i32, ptr %147, align 4, !tbaa !20
  store i32 %148, ptr %19, align 4, !tbaa !9
  %149 = load i32, ptr %17, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds i32, ptr %29, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !9
  %153 = icmp ne i32 %152, 2147483647
  br i1 %153, label %154, label %169

154:                                              ; preds = %124
  %155 = load i32, ptr %17, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds i32, ptr %29, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !9
  %159 = load i32, ptr %19, align 4, !tbaa !9
  %160 = add nsw i32 %158, %159
  %161 = load i32, ptr %18, align 4, !tbaa !9
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds i32, ptr %29, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !9
  %165 = icmp slt i32 %160, %164
  br i1 %165, label %166, label %169

166:                                              ; preds = %154
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %167, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 1, ptr %11, align 4
  br label %170

169:                                              ; preds = %154, %124
  store i32 0, ptr %11, align 4
  br label %170

170:                                              ; preds = %169, %166
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  %171 = load i32, ptr %11, align 4
  switch i32 %171, label %176 [
    i32 0, label %172
  ]

172:                                              ; preds = %170
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr %16, align 4, !tbaa !9
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %16, align 4, !tbaa !9
  br label %119, !llvm.loop !23

176:                                              ; preds = %170, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  %177 = load i32, ptr %11, align 4
  switch i32 %177, label %180 [
    i32 11, label %178
  ]

178:                                              ; preds = %176
  %179 = load i32, ptr %5, align 4, !tbaa !9
  call void @_Z8showDistPii(ptr noundef %29, i32 noundef %179)
  store i32 0, ptr %11, align 4
  br label %180

180:                                              ; preds = %178, %176
  %181 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %181)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  %182 = load i32, ptr %11, align 4
  switch i32 %182, label %184 [
    i32 0, label %183
    i32 1, label %183
  ]

183:                                              ; preds = %180, %180
  ret void

184:                                              ; preds = %180
  unreachable
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint mustprogress 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 = { nocallback nofree nosync nounwind willreturn }
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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS5Graph", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = !{!12, !10, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!12, !6, i64 8}
!17 = !{!18, !10, i64 0}
!18 = !{!"_ZTS4Edge", !10, i64 0, !10, i64 4, !10, i64 8}
!19 = !{!18, !10, i64 4}
!20 = !{!18, !10, i64 8}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.Edge = type { i32, i32, i32 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8showDistPii(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11bellmanFordP5Graphi(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = load i32, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = load i32, ptr %4, align 4, !tbaa !11
  %6 = zext i32 %3 to i64
  %7 = alloca i32, i64 %6, align 16
  %8 = icmp sgt i32 %3, 0
  br i1 %8, label %.lr.ph.preheader, label %._crit_edge.thread

.lr.ph.preheader:                                 ; preds = %2
  %min.iters.check = icmp ult i32 %3, 8
  br i1 %min.iters.check, label %.lr.ph.preheader80, label %vector.ph

.lr.ph.preheader80:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %6, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %9 = getelementptr inbounds i32, ptr %7, i64 %index
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %9, align 16, !tbaa !12
  store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %10, align 16, !tbaa !12
  %index.next = add nuw i64 %index, 8
  %11 = icmp eq i64 %index.next, %n.vec
  br i1 %11, label %middle.block, label %vector.body, !llvm.loop !13

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

._crit_edge.thread:                               ; preds = %2
  %12 = sext i32 %1 to i64
  %13 = getelementptr inbounds i32, ptr %7, i64 %12
  store i32 0, ptr %13, align 4, !tbaa !12
  br label %.preheader

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %14 = sext i32 %1 to i64
  %15 = getelementptr inbounds i32, ptr %7, i64 %14
  store i32 0, ptr %15, align 4, !tbaa !12
  %.not79 = icmp eq i32 %3, 1
  br i1 %.not79, label %.preheader, label %.preheader56.lr.ph

.preheader56.lr.ph:                               ; preds = %._crit_edge
  %16 = icmp sgt i32 %5, 0
  br i1 %16, label %.preheader56.lr.ph.split.us, label %.critedge55

.preheader56.lr.ph.split.us:                      ; preds = %.preheader56.lr.ph
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %wide.trip.count70 = zext nneg i32 %5 to i64
  %19 = add nsw i32 %3, -2
  br label %.preheader56.us

.preheader56.us:                                  ; preds = %._crit_edge60.us, %.preheader56.lr.ph.split.us
  %.04461.us = phi i32 [ 0, %.preheader56.lr.ph.split.us ], [ %38, %._crit_edge60.us ]
  br label %20

20:                                               ; preds = %.preheader56.us, %37
  %indvars.iv67 = phi i64 [ 0, %.preheader56.us ], [ %indvars.iv.next68, %37 ]
  %21 = getelementptr inbounds %struct.Edge, ptr %18, i64 %indvars.iv67
  %22 = load i32, ptr %21, align 4, !tbaa !18
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr %7, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !12
  %.not53.us = icmp eq i32 %25, 2147483647
  br i1 %.not53.us, label %37, label %26

26:                                               ; preds = %20
  %27 = getelementptr inbounds i8, ptr %21, i64 8
  %28 = load i32, ptr %27, align 4, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %21, i64 4
  %30 = load i32, ptr %29, align 4, !tbaa !21
  %31 = add nsw i32 %28, %25
  %32 = sext i32 %30 to i64
  %33 = getelementptr inbounds i32, ptr %7, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !12
  %35 = icmp slt i32 %31, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %26
  store i32 %31, ptr %33, align 4, !tbaa !12
  br label %37

37:                                               ; preds = %36, %26, %20
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond71.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count70
  br i1 %exitcond71.not, label %._crit_edge60.us, label %20, !llvm.loop !22

._crit_edge60.us:                                 ; preds = %37
  %38 = add nuw nsw i32 %.04461.us, 1
  %exitcond72.not = icmp eq i32 %.04461.us, %19
  br i1 %exitcond72.not, label %.preheader, label %.preheader56.us, !llvm.loop !23

.lr.ph:                                           ; preds = %.lr.ph.preheader80, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader80 ]
  %39 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv
  store i32 2147483647, ptr %39, align 4, !tbaa !12
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %6
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !24

.preheader:                                       ; preds = %._crit_edge60.us, %._crit_edge.thread, %._crit_edge
  %.not5262 = icmp sgt i32 %5, 0
  br i1 %.not5262, label %.lr.ph64, label %.critedge55

.lr.ph64:                                         ; preds = %.preheader
  %40 = getelementptr inbounds i8, ptr %0, i64 8
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %wide.trip.count76 = zext nneg i32 %5 to i64
  br label %42

42:                                               ; preds = %.lr.ph64, %60
  %indvars.iv73 = phi i64 [ 0, %.lr.ph64 ], [ %indvars.iv.next74, %60 ]
  %43 = getelementptr inbounds %struct.Edge, ptr %41, i64 %indvars.iv73
  %44 = load i32, ptr %43, align 4, !tbaa !18
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr %7, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !12
  %.not = icmp eq i32 %47, 2147483647
  br i1 %.not, label %60, label %48

48:                                               ; preds = %42
  %49 = getelementptr inbounds i8, ptr %43, i64 8
  %50 = load i32, ptr %49, align 4, !tbaa !20
  %51 = getelementptr inbounds i8, ptr %43, i64 4
  %52 = load i32, ptr %51, align 4, !tbaa !21
  %53 = add nsw i32 %50, %47
  %54 = sext i32 %52 to i64
  %55 = getelementptr inbounds i32, ptr %7, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !12
  %57 = icmp slt i32 %53, %56
  br i1 %57, label %.critedge, label %60

.critedge:                                        ; preds = %48
  %58 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
  %59 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %61

60:                                               ; preds = %48, %42
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %exitcond77.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count76
  br i1 %exitcond77.not, label %.critedge55, label %42, !llvm.loop !25

.critedge55:                                      ; preds = %60, %.preheader56.lr.ph, %.preheader
  call void @_Z8showDistPii(ptr noundef nonnull %7, i32 noundef %3)
  br label %61

61:                                               ; preds = %.critedge, %.critedge55
  ret void
}

attributes #0 = { mustprogress 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 = { inlinehint mustprogress 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, !7, i64 0}
!6 = !{!"_ZTS5Graph", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14, !15, !16}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = !{!6, !10, i64 8}
!18 = !{!19, !7, i64 0}
!19 = !{!"_ZTS4Edge", !7, i64 0, !7, i64 4, !7, i64 8}
!20 = !{!19, !7, i64 8}
!21 = !{!19, !7, i64 4}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14, !16, !15}
!25 = distinct !{!25, !14}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass