; LLVM IR from UtkarshPathrabe/Competitive-Coding :: Model Algorithms/Graphs/Bellman Ford Shortest Path Algorithm (for negative weight e_c648b70e (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 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 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
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 ptr, align 8
  %9 = alloca i64, align 8
  %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
  %20 = alloca i32, align 4
  %21 = 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) #5
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.Graph, ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !11
  store i32 %24, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.Graph, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 4, !tbaa !13
  store i32 %27, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.Graph, ptr %28, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  store ptr %30, ptr %7, align 8, !tbaa !5
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = call ptr @llvm.stacksave.p0()
  store ptr %33, ptr %8, align 8
  %34 = alloca i32, i64 %32, align 16
  store i64 %32, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %44, %2
  %36 = load i32, ptr %10, align 4, !tbaa !9
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %47

40:                                               ; preds = %35
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr %34, i64 %42
  store i32 2147483647, ptr %43, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %40
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %10, align 4, !tbaa !9
  br label %35, !llvm.loop !15

47:                                               ; preds = %39
  %48 = load i32, ptr %4, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %34, i64 %49
  store i32 0, ptr %50, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %114, %47
  %52 = load i32, ptr %11, align 4, !tbaa !9
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = sub nsw i32 %53, 1
  %55 = icmp sle i32 %52, %54
  br i1 %55, label %57, label %56

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

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

58:                                               ; preds = %110, %57
  %59 = load i32, ptr %13, align 4, !tbaa !9
  %60 = load i32, ptr %6, align 4, !tbaa !9
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %113

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

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

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

109:                                              ; preds = %99, %87, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %110

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

113:                                              ; preds = %62
  br label %114

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

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

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

122:                                              ; preds = %118
  store i32 11, ptr %12, align 4
  br label %169

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

147:                                              ; preds = %123
  %148 = load i32, ptr %18, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds i32, ptr %34, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !9
  %152 = load i32, ptr %20, align 4, !tbaa !9
  %153 = add nsw i32 %151, %152
  %154 = load i32, ptr %19, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds i32, ptr %34, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !9
  %158 = icmp slt i32 %153, %157
  br i1 %158, label %159, label %162

159:                                              ; preds = %147
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %160, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 1, ptr %12, align 4
  br label %163

162:                                              ; preds = %147, %123
  store i32 0, ptr %12, align 4
  br label %163

163:                                              ; preds = %162, %159
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  %164 = load i32, ptr %12, align 4
  switch i32 %164, label %169 [
    i32 0, label %165
  ]

165:                                              ; preds = %163
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %17, align 4, !tbaa !9
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %17, align 4, !tbaa !9
  br label %118, !llvm.loop !23

169:                                              ; preds = %163, %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  %170 = load i32, ptr %12, align 4
  switch i32 %170, label %196 [
    i32 11, label %171
  ]

171:                                              ; preds = %169
  %172 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %173 = load i32, ptr %4, align 4, !tbaa !9
  %174 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %172, i32 noundef %173)
  %175 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %174, ptr noundef @.str.2)
  %176 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %175, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %177

177:                                              ; preds = %192, %171
  %178 = load i32, ptr %21, align 4, !tbaa !9
  %179 = load i32, ptr %5, align 4, !tbaa !9
  %180 = icmp slt i32 %178, %179
  br i1 %180, label %182, label %181

181:                                              ; preds = %177
  store i32 14, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %195

182:                                              ; preds = %177
  %183 = load i32, ptr %21, align 4, !tbaa !9
  %184 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %183)
  %185 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %184, ptr noundef @.str.3)
  %186 = load i32, ptr %21, align 4, !tbaa !9
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds i32, ptr %34, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !9
  %190 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %185, i32 noundef %189)
  %191 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %190, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %192

192:                                              ; preds = %182
  %193 = load i32, ptr %21, align 4, !tbaa !9
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %21, align 4, !tbaa !9
  br label %177, !llvm.loop !24

195:                                              ; preds = %181
  store i32 0, ptr %12, align 4
  br label %196

196:                                              ; preds = %195, %169
  %197 = load ptr, ptr %8, align 8
  call void @llvm.stackrestore.p0(ptr %197)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %198 = load i32, ptr %12, align 4
  switch i32 %198, label %200 [
    i32 0, label %199
    i32 1, label %199
  ]

199:                                              ; preds = %196, %196
  ret void

200:                                              ; preds = %196
  unreachable
}

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

; 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) #3

; 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)) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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

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 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { 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 #4 = { "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 #5 = { 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 = !{!12, !6, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!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, !16}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}


; 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 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 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 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %8 = zext i32 %3 to i64
  %9 = alloca i32, i64 %8, align 16
  %10 = icmp sgt i32 %3, 0
  br i1 %10, 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.preheader95, label %vector.ph

.lr.ph.preheader95:                               ; 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 %8, 2147483640
  br label %vector.body

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

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

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

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %16 = sext i32 %1 to i64
  %17 = getelementptr inbounds i32, ptr %9, i64 %16
  store i32 0, ptr %17, align 4, !tbaa !13
  %.not.not68.not = icmp eq i32 %3, 1
  br i1 %.not.not68.not, label %.preheader, label %.preheader63.lr.ph

.preheader63.lr.ph:                               ; preds = %._crit_edge
  %18 = icmp sgt i32 %5, 0
  br i1 %18, label %.preheader63.us.preheader, label %.critedge62

.preheader63.us.preheader:                        ; preds = %.preheader63.lr.ph
  %wide.trip.count80 = zext nneg i32 %5 to i64
  br label %.preheader63.us

.preheader63.us:                                  ; preds = %.preheader63.us.preheader, %._crit_edge67.us
  %.05169.us = phi i32 [ %35, %._crit_edge67.us ], [ 1, %.preheader63.us.preheader ]
  br label %19

19:                                               ; preds = %.preheader63.us, %34
  %indvars.iv77 = phi i64 [ 0, %.preheader63.us ], [ %indvars.iv.next78, %34 ]
  %20 = getelementptr inbounds %struct.Edge, ptr %7, i64 %indvars.iv77
  %21 = load i32, ptr %20, align 4, !tbaa !18
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i32, ptr %9, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !13
  %.not60.us = icmp eq i32 %24, 2147483647
  br i1 %.not60.us, label %34, label %25

25:                                               ; preds = %19
  %26 = getelementptr inbounds i8, ptr %20, i64 8
  %27 = load i32, ptr %26, align 4, !tbaa !20
  %28 = getelementptr inbounds i8, ptr %20, i64 4
  %29 = load i32, ptr %28, align 4, !tbaa !21
  %30 = add nsw i32 %27, %24
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds i32, ptr %9, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !13
  %spec.store.select.us = tail call i32 @llvm.smin.i32(i32 %30, i32 %33)
  store i32 %spec.store.select.us, ptr %32, align 4
  br label %34

34:                                               ; preds = %25, %19
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond81.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count80
  br i1 %exitcond81.not, label %._crit_edge67.us, label %19, !llvm.loop !22

._crit_edge67.us:                                 ; preds = %34
  %35 = add nuw nsw i32 %.05169.us, 1
  %exitcond82.not = icmp eq i32 %35, %3
  br i1 %exitcond82.not, label %.preheader, label %.preheader63.us, !llvm.loop !23

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

.preheader:                                       ; preds = %._crit_edge67.us, %._crit_edge.thread, %._crit_edge
  %.not5970 = icmp sgt i32 %5, 0
  br i1 %.not5970, label %.lr.ph72.preheader, label %.critedge62

.lr.ph72.preheader:                               ; preds = %.preheader
  %wide.trip.count86 = zext nneg i32 %5 to i64
  br label %.lr.ph72

.lr.ph72:                                         ; preds = %.lr.ph72.preheader, %54
  %indvars.iv83 = phi i64 [ 0, %.lr.ph72.preheader ], [ %indvars.iv.next84, %54 ]
  %37 = getelementptr inbounds %struct.Edge, ptr %7, i64 %indvars.iv83
  %38 = load i32, ptr %37, align 4, !tbaa !18
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %9, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !13
  %.not = icmp eq i32 %41, 2147483647
  br i1 %.not, label %54, label %42

42:                                               ; preds = %.lr.ph72
  %43 = getelementptr inbounds i8, ptr %37, i64 8
  %44 = load i32, ptr %43, align 4, !tbaa !20
  %45 = getelementptr inbounds i8, ptr %37, i64 4
  %46 = load i32, ptr %45, align 4, !tbaa !21
  %47 = add nsw i32 %44, %41
  %48 = sext i32 %46 to i64
  %49 = getelementptr inbounds i32, ptr %9, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !13
  %51 = icmp slt i32 %47, %50
  br i1 %51, label %.critedge, label %54

.critedge:                                        ; preds = %42
  %52 = 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)
  %53 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %.loopexit

54:                                               ; preds = %42, %.lr.ph72
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
  br i1 %exitcond87.not, label %.critedge62, label %.lr.ph72, !llvm.loop !25

.critedge62:                                      ; preds = %54, %.preheader63.lr.ph, %.preheader
  %55 = 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.1)
  %56 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %55, i32 noundef %1)
  %57 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef nonnull @.str.2)
  %58 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br i1 %10, label %.lr.ph74, label %.loopexit

.lr.ph74:                                         ; preds = %.critedge62, %.lr.ph74
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %.lr.ph74 ], [ 0, %.critedge62 ]
  %59 = trunc nuw nsw i64 %indvars.iv88 to i32
  %60 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %59)
  %61 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %60, ptr noundef nonnull @.str.3)
  %62 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv88
  %63 = load i32, ptr %62, align 4, !tbaa !13
  %64 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %61, i32 noundef %63)
  %65 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %64, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %exitcond92.not = icmp eq i64 %indvars.iv.next89, %8
  br i1 %exitcond92.not, label %.loopexit, label %.lr.ph74, !llvm.loop !26

.loopexit:                                        ; preds = %.lr.ph74, %.critedge62, %.critedge
  ret void
}

; 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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3

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" }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!6, !10, i64 8}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15, !16, !17}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!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, !15}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !15, !17, !16}
!25 = distinct !{!25, !15}
!26 = distinct !{!26, !15}


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