; LLVM IR from kazunetakahashi/atcoder :: 201610_12/1002_KUPC2016/H.ll (Z13min_cost_flowiix)

; 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<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>
%struct.edge = type { i32, i64, i64, i32 }

@V = external dso_local global i32, align 4
@G = external dso_local global [1010 x %"class.std::vector"], align 16
@h = external dso_local global [1010 x i64], align 16
@dist = external dso_local global [1010 x i64], align 16
@prevv = external dso_local global [1010 x i32], align 16
@preve = external dso_local global [1010 x i32], align 16
@_ZL5infty = external hidden constant i64, align 8

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

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

; 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 noundef i64 @_Z13min_cost_flowiix(i32 noundef %0, i32 noundef %1, i64 noundef %2) #2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::priority_queue", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca %"struct.std::pair", align 8
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  %26 = load i32, ptr @V, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i64, ptr @h, i64 %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @h, ptr noundef %28, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %29

29:                                               ; preds = %299, %3
  %30 = load i64, ptr %7, align 8, !tbaa !9
  %31 = icmp sgt i64 %30, 0
  br i1 %31, label %32, label %301

32:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #6
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %10)
  %33 = load i32, ptr @V, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i64, ptr @dist, i64 %34
  invoke void @_ZSt4fillIPxxEvT_S1_RKT0_(ptr noundef @dist, ptr noundef %35, ptr noundef nonnull align 8 dereferenceable(8) @_ZL5infty)
          to label %36 unwind label %60

36:                                               ; preds = %32
  %37 = load i32, ptr %5, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %38
  store i64 0, ptr %39, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  invoke void @_ZNSt4pairIxiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %40 unwind label %64

40:                                               ; preds = %36
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %10, ptr noundef nonnull align 8 dereferenceable(12) %13)
          to label %41 unwind label %64

41:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %42

42:                                               ; preds = %179, %177, %41
  %43 = invoke noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %10)
          to label %44 unwind label %60

44:                                               ; preds = %42
  %45 = xor i1 %43, true
  br i1 %45, label %46, label %181

46:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #6
  %47 = invoke noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %10)
          to label %48 unwind label %68

48:                                               ; preds = %46
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %47, i64 16, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %10)
          to label %49 unwind label %68

49:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %50 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 1
  %51 = load i32, ptr %50, align 8, !tbaa !11
  store i32 %51, ptr %16, align 4, !tbaa !5
  %52 = load i32, ptr %16, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 0
  %57 = load i64, ptr %56, align 8, !tbaa !13
  %58 = icmp slt i64 %55, %57
  br i1 %58, label %59, label %72

59:                                               ; preds = %49
  store i32 4, ptr %17, align 4
  br label %177, !llvm.loop !14

60:                                               ; preds = %42, %32
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %11, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %12, align 4
  br label %300

64:                                               ; preds = %40, %36
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %11, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %300

68:                                               ; preds = %48, %46
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %11, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %12, align 4
  br label %180

72:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %173, %72
  %74 = load i32, ptr %18, align 4, !tbaa !5
  %75 = load i32, ptr %16, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %76
  %78 = call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %77) #6
  %79 = trunc i64 %78 to i32
  %80 = icmp slt i32 %74, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %73
  store i32 6, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %176

82:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %83 = load i32, ptr %16, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %84
  %86 = load i32, ptr %18, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %85, i64 noundef %87) #6
  store ptr %88, ptr %19, align 8, !tbaa !16
  %89 = load ptr, ptr %19, align 8, !tbaa !16
  %90 = getelementptr inbounds %struct.edge, ptr %89, i32 0, i32 1
  %91 = load i64, ptr %90, align 8, !tbaa !18
  %92 = icmp sgt i64 %91, 0
  br i1 %92, label %93, label %172

93:                                               ; preds = %82
  %94 = load ptr, ptr %19, align 8, !tbaa !16
  %95 = getelementptr inbounds %struct.edge, ptr %94, i32 0, i32 0
  %96 = load i32, ptr %95, align 8, !tbaa !20
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = load i32, ptr %16, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !9
  %104 = load ptr, ptr %19, align 8, !tbaa !16
  %105 = getelementptr inbounds %struct.edge, ptr %104, i32 0, i32 2
  %106 = load i64, ptr %105, align 8, !tbaa !21
  %107 = add nsw i64 %103, %106
  %108 = load i32, ptr %16, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !9
  %112 = add nsw i64 %107, %111
  %113 = load ptr, ptr %19, align 8, !tbaa !16
  %114 = getelementptr inbounds %struct.edge, ptr %113, i32 0, i32 0
  %115 = load i32, ptr %114, align 8, !tbaa !20
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !9
  %119 = sub nsw i64 %112, %118
  %120 = icmp sgt i64 %99, %119
  br i1 %120, label %121, label %172

121:                                              ; preds = %93
  %122 = load i32, ptr %16, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !9
  %126 = load ptr, ptr %19, align 8, !tbaa !16
  %127 = getelementptr inbounds %struct.edge, ptr %126, i32 0, i32 2
  %128 = load i64, ptr %127, align 8, !tbaa !21
  %129 = add nsw i64 %125, %128
  %130 = load i32, ptr %16, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !9
  %134 = add nsw i64 %129, %133
  %135 = load ptr, ptr %19, align 8, !tbaa !16
  %136 = getelementptr inbounds %struct.edge, ptr %135, i32 0, i32 0
  %137 = load i32, ptr %136, align 8, !tbaa !20
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !9
  %141 = sub nsw i64 %134, %140
  %142 = load ptr, ptr %19, align 8, !tbaa !16
  %143 = getelementptr inbounds %struct.edge, ptr %142, i32 0, i32 0
  %144 = load i32, ptr %143, align 8, !tbaa !20
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %145
  store i64 %141, ptr %146, align 8, !tbaa !9
  %147 = load i32, ptr %16, align 4, !tbaa !5
  %148 = load ptr, ptr %19, align 8, !tbaa !16
  %149 = getelementptr inbounds %struct.edge, ptr %148, i32 0, i32 0
  %150 = load i32, ptr %149, align 8, !tbaa !20
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %151
  store i32 %147, ptr %152, align 4, !tbaa !5
  %153 = load i32, ptr %18, align 4, !tbaa !5
  %154 = load ptr, ptr %19, align 8, !tbaa !16
  %155 = getelementptr inbounds %struct.edge, ptr %154, i32 0, i32 0
  %156 = load i32, ptr %155, align 8, !tbaa !20
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %157
  store i32 %153, ptr %158, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #6
  %159 = load ptr, ptr %19, align 8, !tbaa !16
  %160 = getelementptr inbounds %struct.edge, ptr %159, i32 0, i32 0
  %161 = load i32, ptr %160, align 8, !tbaa !20
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %162
  %164 = load ptr, ptr %19, align 8, !tbaa !16
  %165 = getelementptr inbounds %struct.edge, ptr %164, i32 0, i32 0
  invoke void @_ZNSt4pairIxiEC2IRxRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(12) %20, ptr noundef nonnull align 8 dereferenceable(8) %163, ptr noundef nonnull align 4 dereferenceable(4) %165)
          to label %166 unwind label %168

166:                                              ; preds = %121
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %10, ptr noundef nonnull align 8 dereferenceable(12) %20)
          to label %167 unwind label %168

167:                                              ; preds = %166
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  br label %172

168:                                              ; preds = %166, %121
  %169 = landingpad { ptr, i32 }
          cleanup
  %170 = extractvalue { ptr, i32 } %169, 0
  store ptr %170, ptr %11, align 8
  %171 = extractvalue { ptr, i32 } %169, 1
  store i32 %171, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %180

172:                                              ; preds = %167, %93, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr %18, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %18, align 4, !tbaa !5
  br label %73, !llvm.loop !22

176:                                              ; preds = %81
  store i32 0, ptr %17, align 4
  br label %177

177:                                              ; preds = %176, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  %178 = load i32, ptr %17, align 4
  switch i32 %178, label %311 [
    i32 0, label %179
    i32 4, label %42
  ]

179:                                              ; preds = %177
  br label %42, !llvm.loop !14

180:                                              ; preds = %168, %68
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  br label %300

181:                                              ; preds = %44
  %182 = load i32, ptr %6, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %183
  %185 = load i64, ptr %184, align 8, !tbaa !9
  %186 = icmp eq i64 %185, 10000000000000007
  br i1 %186, label %187, label %188

187:                                              ; preds = %181
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %297

188:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %204, %188
  %190 = load i32, ptr %21, align 4, !tbaa !5
  %191 = load i32, ptr @V, align 4, !tbaa !5
  %192 = icmp slt i32 %190, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %189
  store i32 9, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %207

194:                                              ; preds = %189
  %195 = load i32, ptr %21, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %196
  %198 = load i64, ptr %197, align 8, !tbaa !9
  %199 = load i32, ptr %21, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %200
  %202 = load i64, ptr %201, align 8, !tbaa !9
  %203 = add nsw i64 %202, %198
  store i64 %203, ptr %201, align 8, !tbaa !9
  br label %204

204:                                              ; preds = %194
  %205 = load i32, ptr %21, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %21, align 4, !tbaa !5
  br label %189, !llvm.loop !23

207:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %208 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %208, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %209 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %209, ptr %23, align 4, !tbaa !5
  br label %210

210:                                              ; preds = %232, %207
  %211 = load i32, ptr %23, align 4, !tbaa !5
  %212 = load i32, ptr %5, align 4, !tbaa !5
  %213 = icmp ne i32 %211, %212
  br i1 %213, label %215, label %214

214:                                              ; preds = %210
  store i32 12, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %241

215:                                              ; preds = %210
  %216 = load i32, ptr %23, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %217
  %219 = load i32, ptr %218, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %220
  %222 = load i32, ptr %23, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %221, i64 noundef %226) #6
  %228 = getelementptr inbounds %struct.edge, ptr %227, i32 0, i32 1
  %229 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %228)
          to label %230 unwind label %237

230:                                              ; preds = %215
  %231 = load i64, ptr %229, align 8, !tbaa !9
  store i64 %231, ptr %22, align 8, !tbaa !9
  br label %232

232:                                              ; preds = %230
  %233 = load i32, ptr %23, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  store i32 %236, ptr %23, align 4, !tbaa !5
  br label %210, !llvm.loop !24

237:                                              ; preds = %215
  %238 = landingpad { ptr, i32 }
          cleanup
  %239 = extractvalue { ptr, i32 } %238, 0
  store ptr %239, ptr %11, align 8
  %240 = extractvalue { ptr, i32 } %238, 1
  store i32 %240, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %300

241:                                              ; preds = %214
  %242 = load i64, ptr %22, align 8, !tbaa !9
  %243 = load i64, ptr %7, align 8, !tbaa !9
  %244 = sub nsw i64 %243, %242
  store i64 %244, ptr %7, align 8, !tbaa !9
  %245 = load i64, ptr %22, align 8, !tbaa !9
  %246 = load i32, ptr %6, align 4, !tbaa !5
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %247
  %249 = load i64, ptr %248, align 8, !tbaa !9
  %250 = mul nsw i64 %245, %249
  %251 = load i32, ptr %8, align 4, !tbaa !5
  %252 = sext i32 %251 to i64
  %253 = add nsw i64 %252, %250
  %254 = trunc i64 %253 to i32
  store i32 %254, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  %255 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %255, ptr %24, align 4, !tbaa !5
  br label %256

256:                                              ; preds = %291, %241
  %257 = load i32, ptr %24, align 4, !tbaa !5
  %258 = load i32, ptr %5, align 4, !tbaa !5
  %259 = icmp ne i32 %257, %258
  br i1 %259, label %261, label %260

260:                                              ; preds = %256
  store i32 15, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %296

261:                                              ; preds = %256
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %262 = load i32, ptr %24, align 4, !tbaa !5
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %263
  %265 = load i32, ptr %264, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %266
  %268 = load i32, ptr %24, align 4, !tbaa !5
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %269
  %271 = load i32, ptr %270, align 4, !tbaa !5
  %272 = sext i32 %271 to i64
  %273 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %267, i64 noundef %272) #6
  store ptr %273, ptr %25, align 8, !tbaa !16
  %274 = load i64, ptr %22, align 8, !tbaa !9
  %275 = load ptr, ptr %25, align 8, !tbaa !16
  %276 = getelementptr inbounds %struct.edge, ptr %275, i32 0, i32 1
  %277 = load i64, ptr %276, align 8, !tbaa !18
  %278 = sub nsw i64 %277, %274
  store i64 %278, ptr %276, align 8, !tbaa !18
  %279 = load i64, ptr %22, align 8, !tbaa !9
  %280 = load i32, ptr %24, align 4, !tbaa !5
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %281
  %283 = load ptr, ptr %25, align 8, !tbaa !16
  %284 = getelementptr inbounds %struct.edge, ptr %283, i32 0, i32 3
  %285 = load i32, ptr %284, align 8, !tbaa !25
  %286 = sext i32 %285 to i64
  %287 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %282, i64 noundef %286) #6
  %288 = getelementptr inbounds %struct.edge, ptr %287, i32 0, i32 1
  %289 = load i64, ptr %288, align 8, !tbaa !18
  %290 = add nsw i64 %289, %279
  store i64 %290, ptr %288, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  br label %291

291:                                              ; preds = %261
  %292 = load i32, ptr %24, align 4, !tbaa !5
  %293 = sext i32 %292 to i64
  %294 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %293
  %295 = load i32, ptr %294, align 4, !tbaa !5
  store i32 %295, ptr %24, align 4, !tbaa !5
  br label %256, !llvm.loop !26

296:                                              ; preds = %260
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  store i32 0, ptr %17, align 4
  br label %297

297:                                              ; preds = %296, %187
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #6
  %298 = load i32, ptr %17, align 4
  switch i32 %298, label %304 [
    i32 0, label %299
  ]

299:                                              ; preds = %297
  br label %29, !llvm.loop !27

300:                                              ; preds = %237, %180, %64, %60
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %306

301:                                              ; preds = %29
  %302 = load i32, ptr %8, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  store i64 %303, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %304

304:                                              ; preds = %301, %297
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %305 = load i64, ptr %4, align 8
  ret i64 %305

306:                                              ; preds = %300
  %307 = load ptr, ptr %11, align 8
  %308 = load i32, ptr %12, align 4
  %309 = insertvalue { ptr, i32 } poison, ptr %307, 0
  %310 = insertvalue { ptr, i32 } %309, i32 %308, 1
  resume { ptr, i32 } %310

311:                                              ; preds = %177
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxxEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(12)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxiEC2IRxRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint 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 #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTSSt4pairIxiE", !10, i64 0, !6, i64 8}
!13 = !{!12, !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !17, i64 0}
!17 = !{!"any pointer", !7, i64 0}
!18 = !{!19, !10, i64 8}
!19 = !{!"_ZTS4edge", !6, i64 0, !10, i64 8, !10, i64 16, !6, i64 24}
!20 = !{!19, !6, i64 0}
!21 = !{!19, !10, i64 16}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !15}
!25 = !{!19, !6, i64 24}
!26 = distinct !{!26, !15}
!27 = distinct !{!27, !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<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>

@V = external dso_local local_unnamed_addr global i32, align 4
@G = external dso_local global [1010 x %"class.std::vector"], align 16
@h = external dso_local global [1010 x i64], align 16
@dist = external dso_local global [1010 x i64], align 16
@prevv = external dso_local local_unnamed_addr global [1010 x i32], align 16
@preve = external dso_local local_unnamed_addr global [1010 x i32], align 16
@_ZL5infty = external hidden constant i64, align 8

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; 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 noundef i64 @_Z13min_cost_flowiix(i32 noundef %0, i32 noundef %1, i64 noundef %2) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::priority_queue", align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i64, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  %11 = load i32, ptr @V, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds i64, ptr @h, i64 %12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @h, ptr noundef nonnull %13, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %14 = sext i32 %1 to i64
  %15 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %14
  %16 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %14
  %17 = icmp sgt i64 %2, 0
  br i1 %17, label %.lr.ph119, label %.loopexit71

.lr.ph119:                                        ; preds = %3, %._crit_edge92
  %.053117 = phi i64 [ %139, %._crit_edge92 ], [ %2, %3 ]
  %.057116 = phi i32 [ %140, %._crit_edge92 ], [ 0, %3 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #5
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  %18 = load i32, ptr @V, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds i64, ptr @dist, i64 %19
  invoke void @_ZSt4fillIPxxEvT_S1_RKT0_(ptr noundef nonnull @dist, ptr noundef nonnull %20, ptr noundef nonnull align 8 dereferenceable(8) @_ZL5infty)
          to label %21 unwind label %38

21:                                               ; preds = %.lr.ph119
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %23
  store i64 0, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @_ZNSt4pairIxiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %4)
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 8 dereferenceable(12) %7)
          to label %25 unwind label %40

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  %26 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  br i1 %26, label %._crit_edge, label %.lr.ph79

.lr.ph79:                                         ; preds = %25, %.loopexit
  %27 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  %.sroa.0.0.copyload = load i64, ptr %27, align 8
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %27, i64 8
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 8
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %28 unwind label %42

28:                                               ; preds = %.lr.ph79
  %29 = sext i32 %.sroa.5.0.copyload to i64
  %30 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !9
  %32 = icmp slt i64 %31, %.sroa.0.0.copyload
  br i1 %32, label %.loopexit, label %.preheader, !llvm.loop !11

.preheader:                                       ; preds = %28
  %33 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %29
  %34 = call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %33) #5
  %35 = trunc i64 %34 to i32
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader
  %37 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %29
  br label %44

38:                                               ; preds = %.lr.ph119
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %142

40:                                               ; preds = %21
  %41 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  br label %142

42:                                               ; preds = %.lr.ph79
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %142

44:                                               ; preds = %.lr.ph, %76
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %76 ]
  %45 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %indvars.iv) #5
  %46 = getelementptr inbounds i8, ptr %45, i64 8
  %47 = load i64, ptr %46, align 8, !tbaa !13
  %48 = icmp sgt i64 %47, 0
  br i1 %48, label %49, label %76

49:                                               ; preds = %44
  %50 = load i32, ptr %45, align 8, !tbaa !15
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = load i64, ptr %30, align 8, !tbaa !9
  %55 = getelementptr inbounds i8, ptr %45, i64 16
  %56 = load i64, ptr %55, align 8, !tbaa !16
  %57 = add nsw i64 %56, %54
  %58 = load i64, ptr %37, align 8, !tbaa !9
  %59 = add nsw i64 %57, %58
  %60 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %51
  %61 = load i64, ptr %60, align 8, !tbaa !9
  %62 = sub i64 %59, %61
  %63 = icmp sgt i64 %53, %62
  br i1 %63, label %64, label %76

64:                                               ; preds = %49
  store i64 %62, ptr %52, align 8, !tbaa !9
  %65 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %51
  store i32 %.sroa.5.0.copyload, ptr %65, align 4, !tbaa !5
  %66 = load i32, ptr %45, align 8, !tbaa !15
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %67
  %69 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %69, ptr %68, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #5
  %70 = load i32, ptr %45, align 8, !tbaa !15
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %71
  call void @_ZNSt4pairIxiEC2IRxRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(12) %9, ptr noundef nonnull align 8 dereferenceable(8) %72, ptr noundef nonnull align 4 dereferenceable(4) %45)
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 8 dereferenceable(12) %9)
          to label %73 unwind label %74

73:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  br label %76

74:                                               ; preds = %64
  %75 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  br label %142

76:                                               ; preds = %73, %49, %44
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %77 = call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %33) #5
  %sext = shl i64 %77, 32
  %78 = ashr exact i64 %sext, 32
  %79 = icmp slt i64 %indvars.iv.next, %78
  br i1 %79, label %44, label %.loopexit, !llvm.loop !17

.loopexit:                                        ; preds = %76, %.preheader, %28
  %80 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  br i1 %80, label %._crit_edge, label %.lr.ph79

._crit_edge:                                      ; preds = %.loopexit, %25
  %81 = load i64, ptr %15, align 8, !tbaa !9
  %.not65 = icmp eq i64 %81, 10000000000000007
  br i1 %.not65, label %.thread, label %.preheader70

.preheader70:                                     ; preds = %._crit_edge
  %82 = load i32, ptr @V, align 4, !tbaa !5
  %83 = icmp sgt i32 %82, 0
  br i1 %83, label %.lr.ph81.preheader, label %._crit_edge82

.lr.ph81.preheader:                               ; preds = %.preheader70
  %wide.trip.count = zext nneg i32 %82 to i64
  %min.iters.check = icmp ult i32 %82, 4
  br i1 %min.iters.check, label %.lr.ph81.preheader124, label %vector.ph

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

vector.ph:                                        ; preds = %.lr.ph81.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %84 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %index
  %85 = getelementptr inbounds i8, ptr %84, i64 16
  %wide.load = load <2 x i64>, ptr %84, align 16, !tbaa !9
  %wide.load121 = load <2 x i64>, ptr %85, align 16, !tbaa !9
  %86 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %index
  %87 = getelementptr inbounds i8, ptr %86, i64 16
  %wide.load122 = load <2 x i64>, ptr %86, align 16, !tbaa !9
  %wide.load123 = load <2 x i64>, ptr %87, align 16, !tbaa !9
  %88 = add nsw <2 x i64> %wide.load122, %wide.load
  %89 = add nsw <2 x i64> %wide.load123, %wide.load121
  store <2 x i64> %88, ptr %86, align 16, !tbaa !9
  store <2 x i64> %89, ptr %87, align 16, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %90 = icmp eq i64 %index.next, %n.vec
  br i1 %90, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge82, label %.lr.ph81.preheader124

.thread:                                          ; preds = %._crit_edge
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  br label %.loopexit71

._crit_edge82:                                    ; preds = %.lr.ph81, %middle.block, %.preheader70
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  store i64 %.053117, ptr %10, align 8, !tbaa !9
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %.not83 = icmp eq i32 %91, %1
  br i1 %.not83, label %._crit_edge87.thread, label %.lr.ph86

._crit_edge87.thread:                             ; preds = %._crit_edge82
  %92 = load i64, ptr %16, align 8, !tbaa !9
  %93 = mul nsw i64 %92, %.053117
  br label %._crit_edge92

.lr.ph81:                                         ; preds = %.lr.ph81.preheader124, %.lr.ph81
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %.lr.ph81 ], [ %indvars.iv100.ph, %.lr.ph81.preheader124 ]
  %94 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %indvars.iv100
  %95 = load i64, ptr %94, align 8, !tbaa !9
  %96 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %indvars.iv100
  %97 = load i64, ptr %96, align 8, !tbaa !9
  %98 = add nsw i64 %97, %95
  store i64 %98, ptr %96, align 8, !tbaa !9
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge82, label %.lr.ph81, !llvm.loop !21

._crit_edge87:                                    ; preds = %.lr.ph86
  %99 = sub nsw i64 %.053117, %113
  %100 = load i64, ptr %16, align 8, !tbaa !9
  %101 = mul nsw i64 %100, %113
  %.not6488 = icmp eq i32 %114, %1
  br i1 %.not6488, label %._crit_edge92, label %.lr.ph91

.lr.ph86:                                         ; preds = %._crit_edge82, %.lr.ph86
  %.05184 = phi i32 [ %114, %.lr.ph86 ], [ %1, %._crit_edge82 ]
  %102 = sext i32 %.05184 to i64
  %103 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %105
  %107 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %102
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %106, i64 noundef %109) #5
  %111 = getelementptr inbounds i8, ptr %110, i64 8
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %111)
  %113 = load i64, ptr %112, align 8, !tbaa !9
  store i64 %113, ptr %10, align 8, !tbaa !9
  %114 = load i32, ptr %103, align 4, !tbaa !5
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %.not = icmp eq i32 %114, %115
  br i1 %.not, label %._crit_edge87, label %.lr.ph86, !llvm.loop !22

.lr.ph91:                                         ; preds = %._crit_edge87, %.lr.ph91
  %.05089 = phi i32 [ %137, %.lr.ph91 ], [ %1, %._crit_edge87 ]
  %116 = sext i32 %.05089 to i64
  %117 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %119
  %121 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %116
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %120, i64 noundef %123) #5
  %125 = load i64, ptr %10, align 8, !tbaa !9
  %126 = getelementptr inbounds i8, ptr %124, i64 8
  %127 = load i64, ptr %126, align 8, !tbaa !13
  %128 = sub nsw i64 %127, %125
  store i64 %128, ptr %126, align 8, !tbaa !13
  %129 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %116
  %130 = getelementptr inbounds i8, ptr %124, i64 24
  %131 = load i32, ptr %130, align 8, !tbaa !23
  %132 = sext i32 %131 to i64
  %133 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %129, i64 noundef %132) #5
  %134 = getelementptr inbounds i8, ptr %133, i64 8
  %135 = load i64, ptr %134, align 8, !tbaa !13
  %136 = add nsw i64 %135, %125
  store i64 %136, ptr %134, align 8, !tbaa !13
  %137 = load i32, ptr %117, align 4, !tbaa !5
  %138 = load i32, ptr %4, align 4, !tbaa !5
  %.not64 = icmp eq i32 %137, %138
  br i1 %.not64, label %._crit_edge92, label %.lr.ph91, !llvm.loop !24

._crit_edge92:                                    ; preds = %.lr.ph91, %._crit_edge87.thread, %._crit_edge87
  %.pn.in = phi i64 [ %93, %._crit_edge87.thread ], [ %101, %._crit_edge87 ], [ %101, %.lr.ph91 ]
  %139 = phi i64 [ 0, %._crit_edge87.thread ], [ %99, %._crit_edge87 ], [ %99, %.lr.ph91 ]
  %.pn = trunc i64 %.pn.in to i32
  %140 = add i32 %.057116, %.pn
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  %141 = icmp sgt i64 %139, 0
  br i1 %141, label %.lr.ph119, label %._crit_edge120

142:                                              ; preds = %42, %74, %40, %38
  %.pn.pn = phi { ptr, i32 } [ %41, %40 ], [ %39, %38 ], [ %75, %74 ], [ %43, %42 ]
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  resume { ptr, i32 } %.pn.pn

._crit_edge120:                                   ; preds = %._crit_edge92
  %143 = sext i32 %140 to i64
  br label %.loopexit71

.loopexit71:                                      ; preds = %3, %._crit_edge120, %.thread
  %.2 = phi i64 [ -1, %.thread ], [ %143, %._crit_edge120 ], [ 0, %3 ]
  ret i64 %.2
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxxEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxiEC2IRxRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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 = { inlinehint 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTS4edge", !6, i64 0, !10, i64 8, !10, i64 16, !6, i64 24}
!15 = !{!14, !6, i64 0}
!16 = !{!14, !10, i64 16}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !12, !20, !19}
!22 = distinct !{!22, !12}
!23 = !{!14, !6, i64 24}
!24 = distinct !{!24, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass