; LLVM IR from eyangch/competitive-programming :: USACOcontests/silver/2013.11 (pogocow)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@dp = external dso_local global [1000 x [1000 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %20 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %21 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %22 = getelementptr i8, ptr %21, i64 -24
  %23 = load i64, ptr %22, align 8
  %24 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %23
  %25 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %24, ptr noundef null)
  %26 = load ptr, ptr @stdin, align 8, !tbaa !8
  %27 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %26)
  %28 = load ptr, ptr @stdout, align 8, !tbaa !8
  %29 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %28)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %31 = load i32, ptr %2, align 4, !tbaa !11
  %32 = zext i32 %31 to i64
  %33 = call ptr @llvm.stacksave.p0()
  store ptr %33, ptr %3, align 8
  %34 = alloca %"struct.std::pair", i64 %32, align 16
  store i64 %32, ptr %4, align 8
  %35 = icmp eq i64 %32, 0
  br i1 %35, label %42, label %36

36:                                               ; preds = %0
  %37 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %32
  br label %38

38:                                               ; preds = %38, %36
  %39 = phi ptr [ %34, %36 ], [ %40, %38 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %39)
  %40 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 1
  %41 = icmp eq ptr %40, %37
  br i1 %41, label %42, label %38

42:                                               ; preds = %38, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %43

43:                                               ; preds = %59, %42
  %44 = load i32, ptr %5, align 4, !tbaa !11
  %45 = load i32, ptr %2, align 4, !tbaa !11
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %43
  %49 = load i32, ptr %5, align 4, !tbaa !11
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %50
  %52 = getelementptr inbounds %"struct.std::pair", ptr %51, i32 0, i32 0
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %52)
  %54 = load i32, ptr %5, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %55
  %57 = getelementptr inbounds %"struct.std::pair", ptr %56, i32 0, i32 1
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 4 dereferenceable(4) %57)
  br label %59

59:                                               ; preds = %48
  %60 = load i32, ptr %5, align 4, !tbaa !11
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %5, align 4, !tbaa !11
  br label %43, !llvm.loop !13

62:                                               ; preds = %47
  %63 = load i32, ptr %2, align 4, !tbaa !11
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %64
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef %34, ptr noundef %65)
  %66 = load i32, ptr %2, align 4, !tbaa !11
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %68
  %70 = getelementptr inbounds [1000 x i32], ptr %69, i64 0, i64 0
  %71 = load i32, ptr %2, align 4, !tbaa !11
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i32, ptr %70, i64 %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !11
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @dp, ptr noundef %73, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %99, %62
  %75 = load i32, ptr %8, align 4, !tbaa !11
  %76 = load i32, ptr %2, align 4, !tbaa !11
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %102

79:                                               ; preds = %74
  %80 = load i32, ptr %8, align 4, !tbaa !11
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %81
  %83 = getelementptr inbounds %"struct.std::pair", ptr %82, i32 0, i32 1
  %84 = load i32, ptr %83, align 4, !tbaa !15
  %85 = load i32, ptr %8, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %86
  %88 = load i32, ptr %8, align 4, !tbaa !11
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1000 x i32], ptr %87, i64 0, i64 %89
  store i32 %84, ptr %90, align 4, !tbaa !11
  %91 = load i32, ptr %8, align 4, !tbaa !11
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %92
  %94 = load i32, ptr %8, align 4, !tbaa !11
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1000 x i32], ptr %93, i64 0, i64 %95
  %97 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %96)
  %98 = load i32, ptr %97, align 4, !tbaa !11
  store i32 %98, ptr %7, align 4, !tbaa !11
  br label %99

99:                                               ; preds = %79
  %100 = load i32, ptr %8, align 4, !tbaa !11
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %8, align 4, !tbaa !11
  br label %74, !llvm.loop !17

102:                                              ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %103

103:                                              ; preds = %191, %102
  %104 = load i32, ptr %9, align 4, !tbaa !11
  %105 = load i32, ptr %2, align 4, !tbaa !11
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %194

108:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %109

109:                                              ; preds = %187, %108
  %110 = load i32, ptr %11, align 4, !tbaa !11
  %111 = load i32, ptr %9, align 4, !tbaa !11
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %190

114:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %115 = load i32, ptr %9, align 4, !tbaa !11
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %116
  %118 = getelementptr inbounds %"struct.std::pair", ptr %117, i32 0, i32 0
  %119 = load i32, ptr %118, align 8, !tbaa !18
  %120 = load i32, ptr %11, align 4, !tbaa !11
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %121
  %123 = getelementptr inbounds %"struct.std::pair", ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 8, !tbaa !18
  %125 = sub nsw i32 %119, %124
  store i32 %125, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %126 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %126, ptr %13, align 4, !tbaa !11
  br label %127

127:                                              ; preds = %175, %114
  %128 = load i32, ptr %13, align 4, !tbaa !11
  %129 = icmp sge i32 %128, 0
  br i1 %129, label %130, label %144

130:                                              ; preds = %127
  %131 = load i32, ptr %11, align 4, !tbaa !11
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %132
  %134 = getelementptr inbounds %"struct.std::pair", ptr %133, i32 0, i32 0
  %135 = load i32, ptr %134, align 8, !tbaa !18
  %136 = load i32, ptr %13, align 4, !tbaa !11
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %137
  %139 = getelementptr inbounds %"struct.std::pair", ptr %138, i32 0, i32 0
  %140 = load i32, ptr %139, align 8, !tbaa !18
  %141 = sub nsw i32 %135, %140
  %142 = load i32, ptr %12, align 4, !tbaa !11
  %143 = icmp sle i32 %141, %142
  br label %144

144:                                              ; preds = %130, %127
  %145 = phi i1 [ false, %127 ], [ %143, %130 ]
  br i1 %145, label %147, label %146

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

147:                                              ; preds = %144
  %148 = load i32, ptr %9, align 4, !tbaa !11
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %149
  %151 = load i32, ptr %11, align 4, !tbaa !11
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [1000 x i32], ptr %150, i64 0, i64 %152
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %154 = load i32, ptr %11, align 4, !tbaa !11
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %155
  %157 = load i32, ptr %13, align 4, !tbaa !11
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1000 x i32], ptr %156, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !11
  %161 = load i32, ptr %9, align 4, !tbaa !11
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %162
  %164 = getelementptr inbounds %"struct.std::pair", ptr %163, i32 0, i32 1
  %165 = load i32, ptr %164, align 4, !tbaa !15
  %166 = add nsw i32 %160, %165
  store i32 %166, ptr %14, align 4, !tbaa !11
  %167 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %153, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %168 = load i32, ptr %167, align 4, !tbaa !11
  %169 = load i32, ptr %9, align 4, !tbaa !11
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %170
  %172 = load i32, ptr %11, align 4, !tbaa !11
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [1000 x i32], ptr %171, i64 0, i64 %173
  store i32 %168, ptr %174, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %175

175:                                              ; preds = %147
  %176 = load i32, ptr %13, align 4, !tbaa !11
  %177 = add nsw i32 %176, -1
  store i32 %177, ptr %13, align 4, !tbaa !11
  br label %127, !llvm.loop !19

178:                                              ; preds = %146
  %179 = load i32, ptr %9, align 4, !tbaa !11
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %180
  %182 = load i32, ptr %11, align 4, !tbaa !11
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [1000 x i32], ptr %181, i64 0, i64 %183
  %185 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %184)
  %186 = load i32, ptr %185, align 4, !tbaa !11
  store i32 %186, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %187

187:                                              ; preds = %178
  %188 = load i32, ptr %11, align 4, !tbaa !11
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %11, align 4, !tbaa !11
  br label %109, !llvm.loop !20

190:                                              ; preds = %113
  br label %191

191:                                              ; preds = %190
  %192 = load i32, ptr %9, align 4, !tbaa !11
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %9, align 4, !tbaa !11
  br label %103, !llvm.loop !21

194:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %195 = load i32, ptr %2, align 4, !tbaa !11
  %196 = sub nsw i32 %195, 1
  store i32 %196, ptr %15, align 4, !tbaa !11
  br label %197

197:                                              ; preds = %287, %194
  %198 = load i32, ptr %15, align 4, !tbaa !11
  %199 = icmp sge i32 %198, 0
  br i1 %199, label %201, label %200

200:                                              ; preds = %197
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %290

201:                                              ; preds = %197
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %202 = load i32, ptr %2, align 4, !tbaa !11
  %203 = sub nsw i32 %202, 1
  store i32 %203, ptr %16, align 4, !tbaa !11
  br label %204

204:                                              ; preds = %283, %201
  %205 = load i32, ptr %16, align 4, !tbaa !11
  %206 = load i32, ptr %15, align 4, !tbaa !11
  %207 = icmp sgt i32 %205, %206
  br i1 %207, label %209, label %208

208:                                              ; preds = %204
  store i32 20, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %286

209:                                              ; preds = %204
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %210 = load i32, ptr %16, align 4, !tbaa !11
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %211
  %213 = getelementptr inbounds %"struct.std::pair", ptr %212, i32 0, i32 0
  %214 = load i32, ptr %213, align 8, !tbaa !18
  %215 = load i32, ptr %15, align 4, !tbaa !11
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %216
  %218 = getelementptr inbounds %"struct.std::pair", ptr %217, i32 0, i32 0
  %219 = load i32, ptr %218, align 8, !tbaa !18
  %220 = sub nsw i32 %214, %219
  store i32 %220, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %221 = load i32, ptr %16, align 4, !tbaa !11
  store i32 %221, ptr %18, align 4, !tbaa !11
  br label %222

222:                                              ; preds = %271, %209
  %223 = load i32, ptr %18, align 4, !tbaa !11
  %224 = load i32, ptr %2, align 4, !tbaa !11
  %225 = icmp slt i32 %223, %224
  br i1 %225, label %226, label %240

226:                                              ; preds = %222
  %227 = load i32, ptr %18, align 4, !tbaa !11
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %228
  %230 = getelementptr inbounds %"struct.std::pair", ptr %229, i32 0, i32 0
  %231 = load i32, ptr %230, align 8, !tbaa !18
  %232 = load i32, ptr %16, align 4, !tbaa !11
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %233
  %235 = getelementptr inbounds %"struct.std::pair", ptr %234, i32 0, i32 0
  %236 = load i32, ptr %235, align 8, !tbaa !18
  %237 = sub nsw i32 %231, %236
  %238 = load i32, ptr %17, align 4, !tbaa !11
  %239 = icmp sle i32 %237, %238
  br label %240

240:                                              ; preds = %226, %222
  %241 = phi i1 [ false, %222 ], [ %239, %226 ]
  br i1 %241, label %243, label %242

242:                                              ; preds = %240
  store i32 23, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %274

243:                                              ; preds = %240
  %244 = load i32, ptr %15, align 4, !tbaa !11
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %245
  %247 = load i32, ptr %16, align 4, !tbaa !11
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [1000 x i32], ptr %246, i64 0, i64 %248
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %250 = load i32, ptr %16, align 4, !tbaa !11
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %251
  %253 = load i32, ptr %18, align 4, !tbaa !11
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [1000 x i32], ptr %252, i64 0, i64 %254
  %256 = load i32, ptr %255, align 4, !tbaa !11
  %257 = load i32, ptr %15, align 4, !tbaa !11
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %258
  %260 = getelementptr inbounds %"struct.std::pair", ptr %259, i32 0, i32 1
  %261 = load i32, ptr %260, align 4, !tbaa !15
  %262 = add nsw i32 %256, %261
  store i32 %262, ptr %19, align 4, !tbaa !11
  %263 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %249, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %264 = load i32, ptr %263, align 4, !tbaa !11
  %265 = load i32, ptr %15, align 4, !tbaa !11
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %266
  %268 = load i32, ptr %16, align 4, !tbaa !11
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [1000 x i32], ptr %267, i64 0, i64 %269
  store i32 %264, ptr %270, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %271

271:                                              ; preds = %243
  %272 = load i32, ptr %18, align 4, !tbaa !11
  %273 = add nsw i32 %272, 1
  store i32 %273, ptr %18, align 4, !tbaa !11
  br label %222, !llvm.loop !22

274:                                              ; preds = %242
  %275 = load i32, ptr %15, align 4, !tbaa !11
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %276
  %278 = load i32, ptr %16, align 4, !tbaa !11
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [1000 x i32], ptr %277, i64 0, i64 %279
  %281 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %280)
  %282 = load i32, ptr %281, align 4, !tbaa !11
  store i32 %282, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %283

283:                                              ; preds = %274
  %284 = load i32, ptr %16, align 4, !tbaa !11
  %285 = add nsw i32 %284, -1
  store i32 %285, ptr %16, align 4, !tbaa !11
  br label %204, !llvm.loop !23

286:                                              ; preds = %208
  br label %287

287:                                              ; preds = %286
  %288 = load i32, ptr %15, align 4, !tbaa !11
  %289 = add nsw i32 %288, -1
  store i32 %289, ptr %15, align 4, !tbaa !11
  br label %197, !llvm.loop !24

290:                                              ; preds = %200
  %291 = load i32, ptr %7, align 4, !tbaa !11
  %292 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %291)
  %293 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %292, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  %294 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %294)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %295 = load i32, ptr %1, align 4
  ret i32 %295
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) #5

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

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

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

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@dp = external dso_local global [1000 x [1000 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = load ptr, ptr @stdin, align 8, !tbaa !8
  %13 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %12)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !8
  %15 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %17 = load i32, ptr %1, align 4, !tbaa !11
  %18 = zext i32 %17 to i64
  %19 = call ptr @llvm.stacksave.p0()
  %20 = alloca %"struct.std::pair", i64 %18, align 16
  %21 = icmp eq i32 %17, 0
  br i1 %21, label %.loopexit71, label %22

22:                                               ; preds = %0
  %23 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %18
  br label %24

24:                                               ; preds = %24, %22
  %25 = phi ptr [ %20, %22 ], [ %26, %24 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %25)
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = icmp eq ptr %26, %23
  br i1 %27, label %.loopexit71, label %24

.loopexit71:                                      ; preds = %24, %0
  %28 = load i32, ptr %1, align 4, !tbaa !11
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph, label %.loopexit71.._crit_edge_crit_edge

.loopexit71.._crit_edge_crit_edge:                ; preds = %.loopexit71
  %.pre121 = sext i32 %28 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.loopexit71.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre121, %.loopexit71.._crit_edge_crit_edge ], [ %44, %.lr.ph ]
  %30 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %.pre-phi
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull %20, ptr noundef nonnull %30)
  %31 = load i32, ptr %1, align 4, !tbaa !11
  %32 = add nsw i32 %31, -1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %33
  %35 = sext i32 %31 to i64
  %36 = getelementptr inbounds i32, ptr %34, i64 %35
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 0, ptr %2, align 4, !tbaa !11
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @dp, ptr noundef nonnull %36, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 0, ptr %3, align 4, !tbaa !11
  %37 = load i32, ptr %1, align 4, !tbaa !11
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph76, label %._crit_edge98

.lr.ph:                                           ; preds = %.loopexit71, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.loopexit71 ]
  %39 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %indvars.iv
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %39)
  %41 = getelementptr inbounds i8, ptr %39, i64 4
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %40, ptr noundef nonnull align 4 dereferenceable(4) %41)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = load i32, ptr %1, align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next, %44
  br i1 %45, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.preheader70:                                     ; preds = %.lr.ph76
  %46 = icmp sgt i32 %52, 0
  br i1 %46, label %.preheader69, label %._crit_edge98

.lr.ph76:                                         ; preds = %._crit_edge, %.lr.ph76
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %.lr.ph76 ], [ 0, %._crit_edge ]
  %47 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %indvars.iv104, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !15
  %49 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %indvars.iv104, i64 %indvars.iv104
  store i32 %48, ptr %49, align 4, !tbaa !11
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %49)
  %51 = load i32, ptr %50, align 4, !tbaa !11
  store i32 %51, ptr %3, align 4, !tbaa !11
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %52 = load i32, ptr %1, align 4, !tbaa !11
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %indvars.iv.next105, %53
  br i1 %54, label %.lr.ph76, label %.preheader70, !llvm.loop !17

.preheader69:                                     ; preds = %.preheader70, %._crit_edge83
  %55 = phi i32 [ %61, %._crit_edge83 ], [ %51, %.preheader70 ]
  %56 = phi i32 [ %62, %._crit_edge83 ], [ %52, %.preheader70 ]
  %indvars.iv110 = phi i64 [ %indvars.iv.next111, %._crit_edge83 ], [ 0, %.preheader70 ]
  %.not99 = icmp eq i64 %indvars.iv110, 0
  br i1 %.not99, label %._crit_edge83, label %.lr.ph82

.lr.ph82:                                         ; preds = %.preheader69
  %57 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %indvars.iv110
  %58 = getelementptr inbounds i8, ptr %57, i64 4
  br label %.lr.ph79

.preheader:                                       ; preds = %._crit_edge83
  %59 = icmp sgt i32 %62, 0
  br i1 %59, label %.lr.ph97.preheader, label %._crit_edge98

.lr.ph97.preheader:                               ; preds = %.preheader
  %60 = zext nneg i32 %62 to i64
  br label %.lr.ph97

._crit_edge83.loopexit:                           ; preds = %.critedge
  %.pre = load i32, ptr %1, align 4, !tbaa !11
  br label %._crit_edge83

._crit_edge83:                                    ; preds = %._crit_edge83.loopexit, %.preheader69
  %61 = phi i32 [ %79, %._crit_edge83.loopexit ], [ %55, %.preheader69 ]
  %62 = phi i32 [ %.pre, %._crit_edge83.loopexit ], [ %56, %.preheader69 ]
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %63 = sext i32 %62 to i64
  %64 = icmp slt i64 %indvars.iv.next111, %63
  br i1 %64, label %.preheader69, label %.preheader, !llvm.loop !18

.lr.ph79:                                         ; preds = %.critedge, %.lr.ph82
  %indvars.iv107 = phi i64 [ 0, %.lr.ph82 ], [ %indvars.iv.next108, %.critedge ]
  %65 = load i32, ptr %57, align 8, !tbaa !19
  %66 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %indvars.iv107
  %67 = load i32, ptr %66, align 8, !tbaa !19
  %68 = sub nsw i32 %65, %67
  %69 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %indvars.iv110, i64 %indvars.iv107
  %70 = trunc nuw nsw i64 %indvars.iv107 to i32
  br label %71

71:                                               ; preds = %.lr.ph79, %80
  %.06077 = phi i32 [ %70, %.lr.ph79 ], [ %87, %80 ]
  %72 = load i32, ptr %66, align 8, !tbaa !19
  %73 = zext nneg i32 %.06077 to i64
  %74 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %73
  %75 = load i32, ptr %74, align 8, !tbaa !19
  %76 = sub nsw i32 %72, %75
  %.not68 = icmp sgt i32 %76, %68
  br i1 %.not68, label %.critedge, label %80

.critedge:                                        ; preds = %71, %80
  %77 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %indvars.iv110, i64 %indvars.iv107
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %77)
  %79 = load i32, ptr %78, align 4, !tbaa !11
  store i32 %79, ptr %3, align 4, !tbaa !11
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next108, %indvars.iv110
  br i1 %exitcond.not, label %._crit_edge83.loopexit, label %.lr.ph79, !llvm.loop !20

80:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %81 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %indvars.iv107, i64 %73
  %82 = load i32, ptr %81, align 4, !tbaa !11
  %83 = load i32, ptr %58, align 4, !tbaa !15
  %84 = add nsw i32 %83, %82
  store i32 %84, ptr %4, align 4, !tbaa !11
  %85 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %69, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %86 = load i32, ptr %85, align 4, !tbaa !11
  store i32 %86, ptr %69, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %87 = add nsw i32 %.06077, -1
  %88 = icmp sgt i32 %.06077, 0
  br i1 %88, label %71, label %.critedge, !llvm.loop !21

.loopexit:                                        ; preds = %.critedge2, %.lr.ph97
  %89 = phi i32 [ %94, %.lr.ph97 ], [ %116, %.critedge2 ]
  %90 = icmp sgt i64 %indvars.iv118, 1
  br i1 %90, label %.lr.ph97, label %._crit_edge98, !llvm.loop !22

._crit_edge98:                                    ; preds = %.loopexit, %._crit_edge, %.preheader70, %.preheader
  %91 = phi i32 [ %61, %.preheader ], [ %51, %.preheader70 ], [ 0, %._crit_edge ], [ %89, %.loopexit ]
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %91)
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %92, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.stackrestore.p0(ptr %19)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

.lr.ph97:                                         ; preds = %.lr.ph97.preheader, %.loopexit
  %94 = phi i32 [ %61, %.lr.ph97.preheader ], [ %89, %.loopexit ]
  %indvars.iv118 = phi i64 [ %60, %.lr.ph97.preheader ], [ %indvars.iv.next119, %.loopexit ]
  %indvars.iv.next119 = add nsw i64 %indvars.iv118, -1
  %95 = load i32, ptr %1, align 4, !tbaa !11
  %96 = sext i32 %95 to i64
  %97 = icmp slt i64 %indvars.iv118, %96
  br i1 %97, label %.lr.ph93, label %.loopexit

.lr.ph93:                                         ; preds = %.lr.ph97
  %98 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %indvars.iv.next119
  %99 = getelementptr inbounds i8, ptr %98, i64 4
  br label %100

100:                                              ; preds = %.lr.ph93, %.critedge2
  %indvars.iv113.in = phi i32 [ %95, %.lr.ph93 ], [ %indvars.iv113, %.critedge2 ]
  %.05891.in = phi i32 [ %95, %.lr.ph93 ], [ %.05891, %.critedge2 ]
  %indvars.iv113 = add i32 %indvars.iv113.in, -1
  %.05891 = add nsw i32 %.05891.in, -1
  %101 = zext nneg i32 %.05891 to i64
  %102 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %101
  %103 = load i32, ptr %102, align 8, !tbaa !19
  %104 = load i32, ptr %98, align 8, !tbaa !19
  %105 = sub nsw i32 %103, %104
  %106 = load i32, ptr %1, align 4, !tbaa !11
  %.not100 = icmp sgt i32 %.05891.in, %106
  br i1 %.not100, label %.critedge2, label %.lr.ph88

.lr.ph88:                                         ; preds = %100
  %107 = zext i32 %indvars.iv113 to i64
  %108 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next119, i64 %101
  br label %109

109:                                              ; preds = %.lr.ph88, %119
  %indvars.iv115 = phi i64 [ %107, %.lr.ph88 ], [ %indvars.iv.next116, %119 ]
  %110 = getelementptr inbounds %"struct.std::pair", ptr %20, i64 %indvars.iv115
  %111 = load i32, ptr %110, align 8, !tbaa !19
  %112 = load i32, ptr %102, align 8, !tbaa !19
  %113 = sub nsw i32 %111, %112
  %.not = icmp sgt i32 %113, %105
  br i1 %.not, label %.critedge2, label %119

.critedge2:                                       ; preds = %109, %119, %100
  %114 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next119, i64 %101
  %115 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %114)
  %116 = load i32, ptr %115, align 4, !tbaa !11
  store i32 %116, ptr %3, align 4, !tbaa !11
  %117 = sext i32 %.05891 to i64
  %118 = icmp slt i64 %indvars.iv118, %117
  br i1 %118, label %100, label %.loopexit, !llvm.loop !23

119:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %120 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp, i64 0, i64 %101, i64 %indvars.iv115
  %121 = load i32, ptr %120, align 4, !tbaa !11
  %122 = load i32, ptr %99, align 4, !tbaa !15
  %123 = add nsw i32 %122, %121
  store i32 %123, ptr %5, align 4, !tbaa !11
  %124 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %108, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %125 = load i32, ptr %124, align 4, !tbaa !11
  store i32 %125, ptr %108, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %126 = load i32, ptr %1, align 4, !tbaa !11
  %127 = trunc nuw i64 %indvars.iv.next116 to i32
  %128 = icmp sgt i32 %126, %127
  br i1 %128, label %109, label %.critedge2, !llvm.loop !24
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

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

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

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

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

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


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