; LLVM IR from kazunetakahashi/atcoder :: 201610_12/1002_KUPC2016/G.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 = %287, %3
  %30 = load i64, ptr %7, align 8, !tbaa !9
  %31 = icmp sgt i64 %30, 0
  br i1 %31, label %32, label %289

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 = %167, %165, %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 %169

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 %165, !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 %288

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 %288

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 %168

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 = %161, %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 %164

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 %160

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 = icmp sgt i64 %99, %107
  br i1 %108, label %109, label %160

109:                                              ; preds = %93
  %110 = load i32, ptr %16, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !9
  %114 = load ptr, ptr %19, align 8, !tbaa !16
  %115 = getelementptr inbounds %struct.edge, ptr %114, i32 0, i32 2
  %116 = load i64, ptr %115, align 8, !tbaa !21
  %117 = add nsw i64 %113, %116
  %118 = load i32, ptr %16, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %119
  %121 = load i64, ptr %120, align 8, !tbaa !9
  %122 = add nsw i64 %117, %121
  %123 = load ptr, ptr %19, align 8, !tbaa !16
  %124 = getelementptr inbounds %struct.edge, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 8, !tbaa !20
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !9
  %129 = sub nsw i64 %122, %128
  %130 = load ptr, ptr %19, align 8, !tbaa !16
  %131 = getelementptr inbounds %struct.edge, ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 8, !tbaa !20
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %133
  store i64 %129, ptr %134, align 8, !tbaa !9
  %135 = load i32, ptr %16, align 4, !tbaa !5
  %136 = load ptr, ptr %19, align 8, !tbaa !16
  %137 = getelementptr inbounds %struct.edge, ptr %136, i32 0, i32 0
  %138 = load i32, ptr %137, align 8, !tbaa !20
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %139
  store i32 %135, ptr %140, align 4, !tbaa !5
  %141 = load i32, ptr %18, align 4, !tbaa !5
  %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 i32], ptr @preve, i64 0, i64 %145
  store i32 %141, ptr %146, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #6
  %147 = load ptr, ptr %19, align 8, !tbaa !16
  %148 = getelementptr inbounds %struct.edge, ptr %147, i32 0, i32 0
  %149 = load i32, ptr %148, align 8, !tbaa !20
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %150
  %152 = load ptr, ptr %19, align 8, !tbaa !16
  %153 = getelementptr inbounds %struct.edge, ptr %152, 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) %151, ptr noundef nonnull align 4 dereferenceable(4) %153)
          to label %154 unwind label %156

154:                                              ; preds = %109
  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 %155 unwind label %156

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

156:                                              ; preds = %154, %109
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %11, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, 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 %168

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

161:                                              ; preds = %160
  %162 = load i32, ptr %18, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %18, align 4, !tbaa !5
  br label %73, !llvm.loop !22

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

165:                                              ; preds = %164, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  %166 = load i32, ptr %17, align 4
  switch i32 %166, label %299 [
    i32 0, label %167
    i32 4, label %42
  ]

167:                                              ; preds = %165
  br label %42, !llvm.loop !14

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

169:                                              ; preds = %44
  %170 = load i32, ptr %6, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %171
  %173 = load i64, ptr %172, align 8, !tbaa !9
  %174 = icmp eq i64 %173, 10000000000000007
  br i1 %174, label %175, label %176

175:                                              ; preds = %169
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %285

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

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

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

182:                                              ; preds = %177
  %183 = load i32, ptr %21, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %184
  %186 = load i64, ptr %185, align 8, !tbaa !9
  %187 = load i32, ptr %21, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %188
  %190 = load i64, ptr %189, align 8, !tbaa !9
  %191 = add nsw i64 %190, %186
  store i64 %191, ptr %189, align 8, !tbaa !9
  br label %192

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

195:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %196 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %196, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %197 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %197, ptr %23, align 4, !tbaa !5
  br label %198

198:                                              ; preds = %220, %195
  %199 = load i32, ptr %23, align 4, !tbaa !5
  %200 = load i32, ptr %5, align 4, !tbaa !5
  %201 = icmp ne i32 %199, %200
  br i1 %201, label %203, label %202

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

203:                                              ; preds = %198
  %204 = load i32, ptr %23, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %205
  %207 = load i32, ptr %206, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %208
  %210 = load i32, ptr %23, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %209, i64 noundef %214) #6
  %216 = getelementptr inbounds %struct.edge, ptr %215, i32 0, i32 1
  %217 = 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) %216)
          to label %218 unwind label %225

218:                                              ; preds = %203
  %219 = load i64, ptr %217, align 8, !tbaa !9
  store i64 %219, ptr %22, align 8, !tbaa !9
  br label %220

220:                                              ; preds = %218
  %221 = load i32, ptr %23, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  store i32 %224, ptr %23, align 4, !tbaa !5
  br label %198, !llvm.loop !24

225:                                              ; preds = %203
  %226 = landingpad { ptr, i32 }
          cleanup
  %227 = extractvalue { ptr, i32 } %226, 0
  store ptr %227, ptr %11, align 8
  %228 = extractvalue { ptr, i32 } %226, 1
  store i32 %228, 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 %288

229:                                              ; preds = %202
  %230 = load i64, ptr %22, align 8, !tbaa !9
  %231 = load i64, ptr %7, align 8, !tbaa !9
  %232 = sub nsw i64 %231, %230
  store i64 %232, ptr %7, align 8, !tbaa !9
  %233 = load i64, ptr %22, align 8, !tbaa !9
  %234 = load i32, ptr %6, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %235
  %237 = load i64, ptr %236, align 8, !tbaa !9
  %238 = mul nsw i64 %233, %237
  %239 = load i32, ptr %8, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = add nsw i64 %240, %238
  %242 = trunc i64 %241 to i32
  store i32 %242, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  %243 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %243, ptr %24, align 4, !tbaa !5
  br label %244

244:                                              ; preds = %279, %229
  %245 = load i32, ptr %24, align 4, !tbaa !5
  %246 = load i32, ptr %5, align 4, !tbaa !5
  %247 = icmp ne i32 %245, %246
  br i1 %247, label %249, label %248

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

249:                                              ; preds = %244
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %250 = load i32, ptr %24, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %251
  %253 = load i32, ptr %252, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %254
  %256 = load i32, ptr %24, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %257
  %259 = load i32, ptr %258, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %255, i64 noundef %260) #6
  store ptr %261, ptr %25, align 8, !tbaa !16
  %262 = load i64, ptr %22, align 8, !tbaa !9
  %263 = load ptr, ptr %25, align 8, !tbaa !16
  %264 = getelementptr inbounds %struct.edge, ptr %263, i32 0, i32 1
  %265 = load i64, ptr %264, align 8, !tbaa !18
  %266 = sub nsw i64 %265, %262
  store i64 %266, ptr %264, align 8, !tbaa !18
  %267 = load i64, ptr %22, align 8, !tbaa !9
  %268 = load i32, ptr %24, align 4, !tbaa !5
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %269
  %271 = load ptr, ptr %25, align 8, !tbaa !16
  %272 = getelementptr inbounds %struct.edge, ptr %271, i32 0, i32 3
  %273 = load i32, ptr %272, align 8, !tbaa !25
  %274 = sext i32 %273 to i64
  %275 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %270, i64 noundef %274) #6
  %276 = getelementptr inbounds %struct.edge, ptr %275, i32 0, i32 1
  %277 = load i64, ptr %276, align 8, !tbaa !18
  %278 = add nsw i64 %277, %267
  store i64 %278, ptr %276, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  br label %279

279:                                              ; preds = %249
  %280 = load i32, ptr %24, align 4, !tbaa !5
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %281
  %283 = load i32, ptr %282, align 4, !tbaa !5
  store i32 %283, ptr %24, align 4, !tbaa !5
  br label %244, !llvm.loop !26

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

285:                                              ; preds = %284, %175
  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
  %286 = load i32, ptr %17, align 4
  switch i32 %286, label %292 [
    i32 0, label %287
  ]

287:                                              ; preds = %285
  br label %29, !llvm.loop !27

288:                                              ; preds = %225, %168, %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 %294

289:                                              ; preds = %29
  %290 = load i32, ptr %8, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  store i64 %291, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %292

292:                                              ; preds = %289, %285
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %293 = load i64, ptr %4, align 8
  ret i64 %293

294:                                              ; preds = %288
  %295 = load ptr, ptr %11, align 8
  %296 = load i32, ptr %12, align 4
  %297 = insertvalue { ptr, i32 } poison, ptr %295, 0
  %298 = insertvalue { ptr, i32 } %297, i32 %296, 1
  resume { ptr, i32 } %298

299:                                              ; preds = %165
  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 = icmp sgt i64 %2, 0
  br i1 %16, label %.lr.ph117, label %.loopexit69

.lr.ph117:                                        ; preds = %3, %._crit_edge90
  %.051115 = phi i64 [ %136, %._crit_edge90 ], [ %2, %3 ]
  %.055114 = phi i32 [ %137, %._crit_edge90 ], [ 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)
  %17 = load i32, ptr @V, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i64, ptr @dist, i64 %18
  invoke void @_ZSt4fillIPxxEvT_S1_RKT0_(ptr noundef nonnull @dist, ptr noundef nonnull %19, ptr noundef nonnull align 8 dereferenceable(8) @_ZL5infty)
          to label %20 unwind label %37

20:                                               ; preds = %.lr.ph117
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %22
  store i64 0, ptr %23, 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 %24 unwind label %39

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

.lr.ph77:                                         ; preds = %24, %.loopexit
  %26 = 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 %26, align 8
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %26, 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 %27 unwind label %41

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

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

.lr.ph:                                           ; preds = %.preheader
  %36 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %28
  br label %43

37:                                               ; preds = %.lr.ph117
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %139

39:                                               ; preds = %20
  %40 = 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 %139

41:                                               ; preds = %.lr.ph77
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %139

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

48:                                               ; preds = %43
  %49 = load i32, ptr %44, align 8, !tbaa !15
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = load i64, ptr %29, align 8, !tbaa !9
  %54 = getelementptr inbounds i8, ptr %44, i64 16
  %55 = load i64, ptr %54, align 8, !tbaa !16
  %56 = add nsw i64 %55, %53
  %57 = icmp sgt i64 %52, %56
  br i1 %57, label %58, label %75

58:                                               ; preds = %48
  %59 = load i64, ptr %36, align 8, !tbaa !9
  %60 = add nsw i64 %59, %56
  %61 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %50
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = sub i64 %60, %62
  store i64 %63, ptr %51, align 8, !tbaa !9
  %64 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %50
  store i32 %.sroa.5.0.copyload, ptr %64, align 4, !tbaa !5
  %65 = load i32, ptr %44, align 8, !tbaa !15
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %66
  %68 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %68, ptr %67, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #5
  %69 = load i32, ptr %44, align 8, !tbaa !15
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %70
  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) %71, ptr noundef nonnull align 4 dereferenceable(4) %44)
  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 %72 unwind label %73

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

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

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

.loopexit:                                        ; preds = %75, %.preheader, %27
  %79 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  br i1 %79, label %._crit_edge, label %.lr.ph77

._crit_edge:                                      ; preds = %.loopexit, %24
  %80 = load i64, ptr %15, align 8, !tbaa !9
  %.not63 = icmp eq i64 %80, 10000000000000007
  br i1 %.not63, label %.thread, label %.preheader68

.preheader68:                                     ; preds = %._crit_edge
  %81 = load i32, ptr @V, align 4, !tbaa !5
  %82 = icmp sgt i32 %81, 0
  br i1 %82, label %.lr.ph79.preheader, label %._crit_edge80

.lr.ph79.preheader:                               ; preds = %.preheader68
  %wide.trip.count = zext nneg i32 %81 to i64
  %min.iters.check = icmp ult i32 %81, 4
  br i1 %min.iters.check, label %.lr.ph79.preheader122, label %vector.ph

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

vector.ph:                                        ; preds = %.lr.ph79.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 ]
  %83 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %index
  %84 = getelementptr inbounds i8, ptr %83, i64 16
  %wide.load = load <2 x i64>, ptr %83, align 16, !tbaa !9
  %wide.load119 = load <2 x i64>, ptr %84, align 16, !tbaa !9
  %85 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %index
  %86 = getelementptr inbounds i8, ptr %85, i64 16
  %wide.load120 = load <2 x i64>, ptr %85, align 16, !tbaa !9
  %wide.load121 = load <2 x i64>, ptr %86, align 16, !tbaa !9
  %87 = add nsw <2 x i64> %wide.load120, %wide.load
  %88 = add nsw <2 x i64> %wide.load121, %wide.load119
  store <2 x i64> %87, ptr %85, align 16, !tbaa !9
  store <2 x i64> %88, ptr %86, align 16, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %89 = icmp eq i64 %index.next, %n.vec
  br i1 %89, 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_edge80, label %.lr.ph79.preheader122

.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 %.loopexit69

._crit_edge80:                                    ; preds = %.lr.ph79, %middle.block, %.preheader68
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  store i64 %.051115, ptr %10, align 8, !tbaa !9
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %.not81 = icmp eq i32 %90, %1
  br i1 %.not81, label %._crit_edge85.thread, label %.lr.ph84

._crit_edge85.thread:                             ; preds = %._crit_edge80
  %91 = mul nsw i64 %80, %.051115
  br label %._crit_edge90

.lr.ph79:                                         ; preds = %.lr.ph79.preheader122, %.lr.ph79
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %.lr.ph79 ], [ %indvars.iv98.ph, %.lr.ph79.preheader122 ]
  %92 = getelementptr inbounds [1010 x i64], ptr @dist, i64 0, i64 %indvars.iv98
  %93 = load i64, ptr %92, align 8, !tbaa !9
  %94 = getelementptr inbounds [1010 x i64], ptr @h, i64 0, i64 %indvars.iv98
  %95 = load i64, ptr %94, align 8, !tbaa !9
  %96 = add nsw i64 %95, %93
  store i64 %96, ptr %94, align 8, !tbaa !9
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge80, label %.lr.ph79, !llvm.loop !21

._crit_edge85:                                    ; preds = %.lr.ph84
  %.pre = load i64, ptr %15, align 8, !tbaa !9
  %97 = sub nsw i64 %.051115, %110
  %98 = mul nsw i64 %.pre, %110
  %.not6286 = icmp eq i32 %111, %1
  br i1 %.not6286, label %._crit_edge90, label %.lr.ph89

.lr.ph84:                                         ; preds = %._crit_edge80, %.lr.ph84
  %.04982 = phi i32 [ %111, %.lr.ph84 ], [ %1, %._crit_edge80 ]
  %99 = sext i32 %.04982 to i64
  %100 = getelementptr inbounds [1010 x i32], ptr @prevv, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @G, i64 0, i64 %102
  %104 = getelementptr inbounds [1010 x i32], ptr @preve, i64 0, i64 %99
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef %106) #5
  %108 = getelementptr inbounds i8, ptr %107, i64 8
  %109 = 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) %108)
  %110 = load i64, ptr %109, align 8, !tbaa !9
  store i64 %110, ptr %10, align 8, !tbaa !9
  %111 = load i32, ptr %100, align 4, !tbaa !5
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %.not = icmp eq i32 %111, %112
  br i1 %.not, label %._crit_edge85, label %.lr.ph84, !llvm.loop !22

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

._crit_edge90:                                    ; preds = %.lr.ph89, %._crit_edge85.thread, %._crit_edge85
  %.pn.in = phi i64 [ %91, %._crit_edge85.thread ], [ %98, %._crit_edge85 ], [ %98, %.lr.ph89 ]
  %136 = phi i64 [ 0, %._crit_edge85.thread ], [ %97, %._crit_edge85 ], [ %97, %.lr.ph89 ]
  %.pn = trunc i64 %.pn.in to i32
  %137 = add i32 %.055114, %.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
  %138 = icmp sgt i64 %136, 0
  br i1 %138, label %.lr.ph117, label %._crit_edge118

139:                                              ; preds = %41, %73, %39, %37
  %.pn.pn = phi { ptr, i32 } [ %40, %39 ], [ %38, %37 ], [ %74, %73 ], [ %42, %41 ]
  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_edge118:                                   ; preds = %._crit_edge90
  %140 = sext i32 %137 to i64
  br label %.loopexit69

.loopexit69:                                      ; preds = %3, %._crit_edge118, %.thread
  %.2 = phi i64 [ -1, %.thread ], [ %140, %._crit_edge118 ], [ 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: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass