; LLVM IR from ahampriyanshu/algo-ds-101 :: Algorithms/Graph/Johnson_algorithm/Johnson_algorithm.ll (Z11BellmanFordP5Graph)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Graph = type { i32, i32, ptr }
%struct.Edge = type { i32, i32, i32 }

@.str = external hidden unnamed_addr constant [37 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 @_Z11BellmanFordP5Graph(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef %1) #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i1, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %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
  %22 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.Graph, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !9
  store i32 %25, ptr %5, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.Graph, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !13
  store i32 %28, ptr %6, align 4, !tbaa !12
  store i1 false, ptr %7, align 1
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %29

29:                                               ; preds = %36, %2
  %30 = load i32, ptr %8, align 4, !tbaa !12
  %31 = load i32, ptr %5, align 4, !tbaa !12
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %43

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 2147483647, ptr %9, align 4, !tbaa !12
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %35 unwind label %39

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

36:                                               ; preds = %35
  %37 = load i32, ptr %8, align 4, !tbaa !12
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %8, align 4, !tbaa !12
  br label %29, !llvm.loop !14

39:                                               ; preds = %34
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %10, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %232

43:                                               ; preds = %33
  %44 = load i32, ptr %5, align 4, !tbaa !12
  %45 = sext i32 %44 to i64
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %45) #4
  store i32 0, ptr %46, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %47

47:                                               ; preds = %88, %43
  %48 = load i32, ptr %12, align 4, !tbaa !12
  %49 = load i32, ptr %5, align 4, !tbaa !12
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %91

52:                                               ; preds = %47
  %53 = load i32, ptr %5, align 4, !tbaa !12
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.Graph, ptr %54, i32 0, i32 2
  %56 = load ptr, ptr %55, align 8, !tbaa !16
  %57 = load i32, ptr %6, align 4, !tbaa !12
  %58 = load i32, ptr %5, align 4, !tbaa !12
  %59 = sub nsw i32 %57, %58
  %60 = load i32, ptr %12, align 4, !tbaa !12
  %61 = add nsw i32 %59, %60
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds %struct.Edge, ptr %56, i64 %62
  %64 = getelementptr inbounds %struct.Edge, ptr %63, i32 0, i32 0
  store i32 %53, ptr %64, align 4, !tbaa !17
  %65 = load i32, ptr %12, align 4, !tbaa !12
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.Graph, ptr %66, i32 0, i32 2
  %68 = load ptr, ptr %67, align 8, !tbaa !16
  %69 = load i32, ptr %6, align 4, !tbaa !12
  %70 = load i32, ptr %5, align 4, !tbaa !12
  %71 = sub nsw i32 %69, %70
  %72 = load i32, ptr %12, align 4, !tbaa !12
  %73 = add nsw i32 %71, %72
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds %struct.Edge, ptr %68, i64 %74
  %76 = getelementptr inbounds %struct.Edge, ptr %75, i32 0, i32 1
  store i32 %65, ptr %76, align 4, !tbaa !19
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.Graph, ptr %77, i32 0, i32 2
  %79 = load ptr, ptr %78, align 8, !tbaa !16
  %80 = load i32, ptr %6, align 4, !tbaa !12
  %81 = load i32, ptr %5, align 4, !tbaa !12
  %82 = sub nsw i32 %80, %81
  %83 = load i32, ptr %12, align 4, !tbaa !12
  %84 = add nsw i32 %82, %83
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds %struct.Edge, ptr %79, i64 %85
  %87 = getelementptr inbounds %struct.Edge, ptr %86, i32 0, i32 2
  store i32 0, ptr %87, align 4, !tbaa !20
  br label %88

88:                                               ; preds = %52
  %89 = load i32, ptr %12, align 4, !tbaa !12
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %12, align 4, !tbaa !12
  br label %47, !llvm.loop !21

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

92:                                               ; preds = %160, %91
  %93 = load i32, ptr %13, align 4, !tbaa !12
  %94 = load i32, ptr %5, align 4, !tbaa !12
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 8, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %163

97:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !12
  br label %98

98:                                               ; preds = %156, %97
  %99 = load i32, ptr %15, align 4, !tbaa !12
  %100 = load i32, ptr %6, align 4, !tbaa !12
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %103, label %102

102:                                              ; preds = %98
  store i32 11, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %159

103:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.Graph, ptr %104, i32 0, i32 2
  %106 = load ptr, ptr %105, align 8, !tbaa !16
  %107 = load i32, ptr %15, align 4, !tbaa !12
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds %struct.Edge, ptr %106, i64 %108
  %110 = getelementptr inbounds %struct.Edge, ptr %109, i32 0, i32 0
  %111 = load i32, ptr %110, align 4, !tbaa !17
  store i32 %111, ptr %16, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.Graph, ptr %112, i32 0, i32 2
  %114 = load ptr, ptr %113, align 8, !tbaa !16
  %115 = load i32, ptr %15, align 4, !tbaa !12
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds %struct.Edge, ptr %114, i64 %116
  %118 = getelementptr inbounds %struct.Edge, ptr %117, i32 0, i32 1
  %119 = load i32, ptr %118, align 4, !tbaa !19
  store i32 %119, ptr %17, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.Graph, ptr %120, i32 0, i32 2
  %122 = load ptr, ptr %121, align 8, !tbaa !16
  %123 = load i32, ptr %15, align 4, !tbaa !12
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds %struct.Edge, ptr %122, i64 %124
  %126 = getelementptr inbounds %struct.Edge, ptr %125, i32 0, i32 2
  %127 = load i32, ptr %126, align 4, !tbaa !20
  store i32 %127, ptr %18, align 4, !tbaa !12
  %128 = load i32, ptr %16, align 4, !tbaa !12
  %129 = sext i32 %128 to i64
  %130 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %129) #4
  %131 = load i32, ptr %130, align 4, !tbaa !12
  %132 = icmp ne i32 %131, 2147483647
  br i1 %132, label %133, label %155

133:                                              ; preds = %103
  %134 = load i32, ptr %16, align 4, !tbaa !12
  %135 = sext i32 %134 to i64
  %136 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %135) #4
  %137 = load i32, ptr %136, align 4, !tbaa !12
  %138 = load i32, ptr %18, align 4, !tbaa !12
  %139 = add nsw i32 %137, %138
  %140 = load i32, ptr %17, align 4, !tbaa !12
  %141 = sext i32 %140 to i64
  %142 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %141) #4
  %143 = load i32, ptr %142, align 4, !tbaa !12
  %144 = icmp slt i32 %139, %143
  br i1 %144, label %145, label %155

145:                                              ; preds = %133
  %146 = load i32, ptr %16, align 4, !tbaa !12
  %147 = sext i32 %146 to i64
  %148 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %147) #4
  %149 = load i32, ptr %148, align 4, !tbaa !12
  %150 = load i32, ptr %18, align 4, !tbaa !12
  %151 = add nsw i32 %149, %150
  %152 = load i32, ptr %17, align 4, !tbaa !12
  %153 = sext i32 %152 to i64
  %154 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %153) #4
  store i32 %151, ptr %154, align 4, !tbaa !12
  br label %155

155:                                              ; preds = %145, %133, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %15, align 4, !tbaa !12
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %15, align 4, !tbaa !12
  br label %98, !llvm.loop !22

159:                                              ; preds = %102
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %13, align 4, !tbaa !12
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %13, align 4, !tbaa !12
  br label %92, !llvm.loop !23

163:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 0, ptr %19, align 4, !tbaa !12
  br label %164

164:                                              ; preds = %222, %163
  %165 = load i32, ptr %19, align 4, !tbaa !12
  %166 = load i32, ptr %6, align 4, !tbaa !12
  %167 = icmp slt i32 %165, %166
  br i1 %167, label %169, label %168

168:                                              ; preds = %164
  store i32 14, ptr %14, align 4
  br label %225

169:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %170 = load ptr, ptr %4, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.Graph, ptr %170, i32 0, i32 2
  %172 = load ptr, ptr %171, align 8, !tbaa !16
  %173 = load i32, ptr %19, align 4, !tbaa !12
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds %struct.Edge, ptr %172, i64 %174
  %176 = getelementptr inbounds %struct.Edge, ptr %175, i32 0, i32 0
  %177 = load i32, ptr %176, align 4, !tbaa !17
  store i32 %177, ptr %20, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %178 = load ptr, ptr %4, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.Graph, ptr %178, i32 0, i32 2
  %180 = load ptr, ptr %179, align 8, !tbaa !16
  %181 = load i32, ptr %19, align 4, !tbaa !12
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds %struct.Edge, ptr %180, i64 %182
  %184 = getelementptr inbounds %struct.Edge, ptr %183, i32 0, i32 1
  %185 = load i32, ptr %184, align 4, !tbaa !19
  store i32 %185, ptr %21, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %186 = load ptr, ptr %4, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.Graph, ptr %186, i32 0, i32 2
  %188 = load ptr, ptr %187, align 8, !tbaa !16
  %189 = load i32, ptr %19, align 4, !tbaa !12
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds %struct.Edge, ptr %188, i64 %190
  %192 = getelementptr inbounds %struct.Edge, ptr %191, i32 0, i32 2
  %193 = load i32, ptr %192, align 4, !tbaa !20
  store i32 %193, ptr %22, align 4, !tbaa !12
  %194 = load i32, ptr %20, align 4, !tbaa !12
  %195 = sext i32 %194 to i64
  %196 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %195) #4
  %197 = load i32, ptr %196, align 4, !tbaa !12
  %198 = icmp ne i32 %197, 2147483647
  br i1 %198, label %199, label %218

199:                                              ; preds = %169
  %200 = load i32, ptr %20, align 4, !tbaa !12
  %201 = sext i32 %200 to i64
  %202 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %201) #4
  %203 = load i32, ptr %202, align 4, !tbaa !12
  %204 = load i32, ptr %22, align 4, !tbaa !12
  %205 = add nsw i32 %203, %204
  %206 = load i32, ptr %21, align 4, !tbaa !12
  %207 = sext i32 %206 to i64
  %208 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %207) #4
  %209 = load i32, ptr %208, align 4, !tbaa !12
  %210 = icmp slt i32 %205, %209
  br i1 %210, label %211, label %218

211:                                              ; preds = %199
  %212 = invoke i32 (ptr, ...) @printf(ptr noundef @.str)
          to label %213 unwind label %214

213:                                              ; preds = %211
  store i1 true, ptr %7, align 1
  store i32 1, ptr %14, align 4
  br label %219

214:                                              ; preds = %211
  %215 = landingpad { ptr, i32 }
          cleanup
  %216 = extractvalue { ptr, i32 } %215, 0
  store ptr %216, ptr %10, align 8
  %217 = extractvalue { ptr, i32 } %215, 1
  store i32 %217, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %232

218:                                              ; preds = %199, %169
  store i32 0, ptr %14, align 4
  br label %219

219:                                              ; preds = %218, %213
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  %220 = load i32, ptr %14, align 4
  switch i32 %220, label %225 [
    i32 0, label %221
  ]

221:                                              ; preds = %219
  br label %222

222:                                              ; preds = %221
  %223 = load i32, ptr %19, align 4, !tbaa !12
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %19, align 4, !tbaa !12
  br label %164, !llvm.loop !24

225:                                              ; preds = %219, %168
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  %226 = load i32, ptr %14, align 4
  switch i32 %226, label %228 [
    i32 14, label %227
  ]

227:                                              ; preds = %225
  call void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  store i1 true, ptr %7, align 1
  store i32 1, ptr %14, align 4
  br label %228

228:                                              ; preds = %227, %225
  %229 = load i1, ptr %7, align 1
  br i1 %229, label %231, label %230

230:                                              ; preds = %228
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %231

231:                                              ; preds = %230, %228
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void

232:                                              ; preds = %214, %39
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %233

233:                                              ; preds = %232
  %234 = load ptr, ptr %10, align 8
  %235 = load i32, ptr %11, align 4
  %236 = insertvalue { ptr, i32 } poison, ptr %234, 0
  %237 = insertvalue { ptr, i32 } %236, i32 %235, 1
  resume { ptr, i32 } %237
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 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 = { 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 #3 = { "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 = { 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, !11, i64 0}
!10 = !{!"_ZTS5Graph", !11, i64 0, !11, i64 4, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !6, i64 8}
!17 = !{!18, !11, i64 0}
!18 = !{!"_ZTS4Edge", !11, i64 0, !11, i64 4, !11, i64 8}
!19 = !{!18, !11, i64 4}
!20 = !{!18, !11, i64 8}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Edge = type { i32, i32, i32 }

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

; 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 uwtable
define dso_local void @_Z11BellmanFordP5Graph(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector") align 8 %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = load i32, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !11
  tail call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %.not79 = icmp slt i32 %4, 0
  br i1 %.not79, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %2
  %7 = sext i32 %4 to i64
  %8 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %7) #4
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %.preheader

._crit_edge:                                      ; preds = %16
  %9 = zext nneg i32 %4 to i64
  %10 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %9) #4
  store i32 0, ptr %10, align 4, !tbaa !12
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %.preheader, label %.lr.ph83

.lr.ph83:                                         ; preds = %._crit_edge
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = sub i32 %6, %4
  %14 = sext i32 %13 to i64
  %wide.trip.count = zext nneg i32 %4 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %15 = icmp eq i32 %4, 1
  br i1 %15, label %.preheader78.unr-lcssa, label %.lr.ph83.new

.lr.ph83.new:                                     ; preds = %.lr.ph83
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %53

.lr.ph:                                           ; preds = %2, %16
  %.06080 = phi i32 [ %17, %16 ], [ 0, %2 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  store i32 2147483647, ptr %3, align 4, !tbaa !12
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %16 unwind label %18

16:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %17 = add nuw i32 %.06080, 1
  %exitcond.not = icmp eq i32 %.06080, %4
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14

18:                                               ; preds = %.lr.ph
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  resume { ptr, i32 } %19

.preheader78.unr-lcssa:                           ; preds = %53, %.lr.ph83
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph83 ], [ %indvars.iv.next.1, %53 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader78, label %.preheader78.epilog-lcssa

.preheader78.epilog-lcssa:                        ; preds = %.preheader78.unr-lcssa
  %20 = add nsw i64 %indvars.iv.unr, %14
  %21 = getelementptr inbounds %struct.Edge, ptr %12, i64 %20
  store i32 %4, ptr %21, align 4, !tbaa !16
  %22 = getelementptr inbounds %struct.Edge, ptr %12, i64 %20, i32 1
  %23 = trunc nuw nsw i64 %indvars.iv.unr to i32
  store i32 %23, ptr %22, align 4, !tbaa !18
  %24 = getelementptr inbounds %struct.Edge, ptr %12, i64 %20, i32 2
  store i32 0, ptr %24, align 4, !tbaa !19
  br label %.preheader78

.preheader78:                                     ; preds = %.preheader78.unr-lcssa, %.preheader78.epilog-lcssa
  br i1 %.not, label %.preheader, label %.preheader77.lr.ph

.preheader77.lr.ph:                               ; preds = %.preheader78
  %25 = icmp sgt i32 %6, 0
  %26 = getelementptr inbounds i8, ptr %1, i64 8
  br i1 %25, label %.preheader77.us.preheader, label %.critedge

.preheader77.us.preheader:                        ; preds = %.preheader77.lr.ph
  %wide.trip.count97 = zext nneg i32 %6 to i64
  br label %.preheader77.us

.preheader77.us:                                  ; preds = %.preheader77.us.preheader, %._crit_edge86.us
  %.06387.us = phi i32 [ %52, %._crit_edge86.us ], [ 0, %.preheader77.us.preheader ]
  br label %27

27:                                               ; preds = %.preheader77.us, %51
  %indvars.iv94 = phi i64 [ 0, %.preheader77.us ], [ %indvars.iv.next95, %51 ]
  %28 = load ptr, ptr %26, align 8, !tbaa !13
  %29 = getelementptr inbounds %struct.Edge, ptr %28, i64 %indvars.iv94
  %30 = load i32, ptr %29, align 4, !tbaa !16
  %31 = getelementptr inbounds i8, ptr %29, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !18
  %33 = getelementptr inbounds i8, ptr %29, i64 8
  %34 = load i32, ptr %33, align 4, !tbaa !19
  %35 = sext i32 %30 to i64
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %35) #4
  %37 = load i32, ptr %36, align 4, !tbaa !12
  %.not70.us = icmp eq i32 %37, 2147483647
  br i1 %.not70.us, label %51, label %38

38:                                               ; preds = %27
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %35) #4
  %40 = load i32, ptr %39, align 4, !tbaa !12
  %41 = add nsw i32 %40, %34
  %42 = sext i32 %32 to i64
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %42) #4
  %44 = load i32, ptr %43, align 4, !tbaa !12
  %45 = icmp slt i32 %41, %44
  br i1 %45, label %46, label %51

46:                                               ; preds = %38
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %35) #4
  %48 = load i32, ptr %47, align 4, !tbaa !12
  %49 = add nsw i32 %48, %34
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %42) #4
  store i32 %49, ptr %50, align 4, !tbaa !12
  br label %51

51:                                               ; preds = %46, %38, %27
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %exitcond98.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count97
  br i1 %exitcond98.not, label %._crit_edge86.us, label %27, !llvm.loop !20

._crit_edge86.us:                                 ; preds = %51
  %52 = add nuw nsw i32 %.06387.us, 1
  %exitcond99.not = icmp eq i32 %52, %4
  br i1 %exitcond99.not, label %.preheader, label %.preheader77.us, !llvm.loop !21

53:                                               ; preds = %53, %.lr.ph83.new
  %indvars.iv = phi i64 [ 0, %.lr.ph83.new ], [ %indvars.iv.next.1, %53 ]
  %niter = phi i64 [ 0, %.lr.ph83.new ], [ %niter.next.1, %53 ]
  %54 = add nsw i64 %indvars.iv, %14
  %55 = getelementptr inbounds %struct.Edge, ptr %12, i64 %54
  store i32 %4, ptr %55, align 4, !tbaa !16
  %56 = getelementptr inbounds %struct.Edge, ptr %12, i64 %54, i32 1
  %57 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %57, ptr %56, align 4, !tbaa !18
  %58 = getelementptr inbounds %struct.Edge, ptr %12, i64 %54, i32 2
  store i32 0, ptr %58, align 4, !tbaa !19
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %59 = add nsw i64 %indvars.iv.next, %14
  %60 = getelementptr inbounds %struct.Edge, ptr %12, i64 %59
  store i32 %4, ptr %60, align 4, !tbaa !16
  %61 = getelementptr inbounds %struct.Edge, ptr %12, i64 %59, i32 1
  %62 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %62, ptr %61, align 4, !tbaa !18
  %63 = getelementptr inbounds %struct.Edge, ptr %12, i64 %59, i32 2
  store i32 0, ptr %63, align 4, !tbaa !19
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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 %.preheader78.unr-lcssa, label %53, !llvm.loop !22

.preheader:                                       ; preds = %._crit_edge86.us, %._crit_edge, %._crit_edge.thread, %.preheader78
  %.not6988 = icmp sgt i32 %6, 0
  br i1 %.not6988, label %.lr.ph90, label %.critedge

.lr.ph90:                                         ; preds = %.preheader
  %64 = getelementptr inbounds i8, ptr %1, i64 8
  %wide.trip.count103 = zext nneg i32 %6 to i64
  br label %65

65:                                               ; preds = %.lr.ph90, %84
  %indvars.iv100 = phi i64 [ 0, %.lr.ph90 ], [ %indvars.iv.next101, %84 ]
  %66 = load ptr, ptr %64, align 8, !tbaa !13
  %67 = getelementptr inbounds %struct.Edge, ptr %66, i64 %indvars.iv100
  %68 = load i32, ptr %67, align 4, !tbaa !16
  %69 = getelementptr inbounds i8, ptr %67, i64 4
  %70 = load i32, ptr %69, align 4, !tbaa !18
  %71 = getelementptr inbounds i8, ptr %67, i64 8
  %72 = load i32, ptr %71, align 4, !tbaa !19
  %73 = sext i32 %68 to i64
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %73) #4
  %75 = load i32, ptr %74, align 4, !tbaa !12
  %.not68 = icmp eq i32 %75, 2147483647
  br i1 %.not68, label %84, label %76

76:                                               ; preds = %65
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %73) #4
  %78 = load i32, ptr %77, align 4, !tbaa !12
  %79 = add nsw i32 %78, %72
  %80 = sext i32 %70 to i64
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %80) #4
  %82 = load i32, ptr %81, align 4, !tbaa !12
  %83 = icmp slt i32 %79, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %76, %65
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond104.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count103
  br i1 %exitcond104.not, label %.critedge, label %65, !llvm.loop !23

.critedge:                                        ; preds = %84, %.preheader77.lr.ph, %.preheader
  call void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %87

85:                                               ; preds = %76
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %87

87:                                               ; preds = %85, %.critedge
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

attributes #0 = { mustprogress 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 = { 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 #3 = { nofree nounwind "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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 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 = !{!6, !10, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !7, i64 0}
!17 = !{!"_ZTS4Edge", !7, i64 0, !7, i64 4, !7, i64 8}
!18 = !{!17, !7, i64 4}
!19 = !{!17, !7, i64 8}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}


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