; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/245 Division 1/Problem B (B)

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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [1002 x [1002 x i32]], align 16
@m1 = external dso_local global [1002 x [1002 x i64]], align 16
@m2 = external dso_local global [1002 x [1002 x i64]], align 16
@m3 = external dso_local global [1002 x [1002 x i64]], align 16
@m4 = external dso_local global [1002 x [1002 x i64]], align 16
@mx = external dso_local global i64, align 8
@cur = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_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 i32, align 4
  %4 = alloca i32, align 4
  %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 i64, align 8
  %16 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %41, %0
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %44

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

24:                                               ; preds = %37, %23
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = icmp sle i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %40

29:                                               ; preds = %24
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1002 x i32], ptr %32, i64 0, i64 %34
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %35)
  br label %37

37:                                               ; preds = %29
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %4, align 4, !tbaa !5
  br label %24, !llvm.loop !9

40:                                               ; preds = %28
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !11

44:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %92, %44
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = icmp sle i32 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %95

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %88, %50
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = load i32, ptr @m, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %91

56:                                               ; preds = %51
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = sub nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1002 x i64], ptr %60, i64 0, i64 %62
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %65
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = sub nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1002 x i64], ptr %66, i64 0, i64 %69
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %63, ptr noundef nonnull align 8 dereferenceable(8) %70)
  %72 = load i64, ptr %71, align 8, !tbaa !12
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %74
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1002 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = add nsw i64 %72, %80
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %83
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1002 x i64], ptr %84, i64 0, i64 %86
  store i64 %81, ptr %87, align 8, !tbaa !12
  br label %88

88:                                               ; preds = %56
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %6, align 4, !tbaa !5
  br label %51, !llvm.loop !14

91:                                               ; preds = %55
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %5, align 4, !tbaa !5
  br label %45, !llvm.loop !15

95:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %96 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %96, ptr %7, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %143, %95
  %98 = load i32, ptr %7, align 4, !tbaa !5
  %99 = icmp sge i32 %98, 1
  br i1 %99, label %101, label %100

100:                                              ; preds = %97
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %146

101:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %139, %101
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = load i32, ptr @m, align 4, !tbaa !5
  %105 = icmp sle i32 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %142

107:                                              ; preds = %102
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %110
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [1002 x i64], ptr %111, i64 0, i64 %113
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %116
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = sub nsw i32 %118, 1
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [1002 x i64], ptr %117, i64 0, i64 %120
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %114, ptr noundef nonnull align 8 dereferenceable(8) %121)
  %123 = load i64, ptr %122, align 8, !tbaa !12
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %125
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1002 x i32], ptr %126, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = add nsw i64 %123, %131
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %134
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [1002 x i64], ptr %135, i64 0, i64 %137
  store i64 %132, ptr %138, align 8, !tbaa !12
  br label %139

139:                                              ; preds = %107
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %8, align 4, !tbaa !5
  br label %102, !llvm.loop !16

142:                                              ; preds = %106
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = add nsw i32 %144, -1
  store i32 %145, ptr %7, align 4, !tbaa !5
  br label %97, !llvm.loop !17

146:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %194, %146
  %148 = load i32, ptr %9, align 4, !tbaa !5
  %149 = load i32, ptr @n, align 4, !tbaa !5
  %150 = icmp sle i32 %148, %149
  br i1 %150, label %152, label %151

151:                                              ; preds = %147
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %197

152:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %153 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %153, ptr %10, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %190, %152
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = icmp sge i32 %155, 1
  br i1 %156, label %158, label %157

157:                                              ; preds = %154
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %193

158:                                              ; preds = %154
  %159 = load i32, ptr %9, align 4, !tbaa !5
  %160 = sub nsw i32 %159, 1
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %161
  %163 = load i32, ptr %10, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [1002 x i64], ptr %162, i64 0, i64 %164
  %166 = load i32, ptr %9, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %167
  %169 = load i32, ptr %10, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [1002 x i64], ptr %168, i64 0, i64 %171
  %173 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %165, ptr noundef nonnull align 8 dereferenceable(8) %172)
  %174 = load i64, ptr %173, align 8, !tbaa !12
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %176
  %178 = load i32, ptr %10, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [1002 x i32], ptr %177, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = add nsw i64 %174, %182
  %184 = load i32, ptr %9, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %185
  %187 = load i32, ptr %10, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [1002 x i64], ptr %186, i64 0, i64 %188
  store i64 %183, ptr %189, align 8, !tbaa !12
  br label %190

190:                                              ; preds = %158
  %191 = load i32, ptr %10, align 4, !tbaa !5
  %192 = add nsw i32 %191, -1
  store i32 %192, ptr %10, align 4, !tbaa !5
  br label %154, !llvm.loop !18

193:                                              ; preds = %157
  br label %194

194:                                              ; preds = %193
  %195 = load i32, ptr %9, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %9, align 4, !tbaa !5
  br label %147, !llvm.loop !19

197:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %198 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %198, ptr %11, align 4, !tbaa !5
  br label %199

199:                                              ; preds = %245, %197
  %200 = load i32, ptr %11, align 4, !tbaa !5
  %201 = icmp sge i32 %200, 1
  br i1 %201, label %203, label %202

202:                                              ; preds = %199
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %248

203:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %204 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %204, ptr %12, align 4, !tbaa !5
  br label %205

205:                                              ; preds = %241, %203
  %206 = load i32, ptr %12, align 4, !tbaa !5
  %207 = icmp sge i32 %206, 1
  br i1 %207, label %209, label %208

208:                                              ; preds = %205
  store i32 29, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %244

209:                                              ; preds = %205
  %210 = load i32, ptr %11, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %211
  %213 = load i32, ptr %12, align 4, !tbaa !5
  %214 = add nsw i32 %213, 1
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [1002 x i64], ptr %212, i64 0, i64 %215
  %217 = load i32, ptr %11, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %219
  %221 = load i32, ptr %12, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [1002 x i64], ptr %220, i64 0, i64 %222
  %224 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %216, ptr noundef nonnull align 8 dereferenceable(8) %223)
  %225 = load i64, ptr %224, align 8, !tbaa !12
  %226 = load i32, ptr %11, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %227
  %229 = load i32, ptr %12, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [1002 x i32], ptr %228, i64 0, i64 %230
  %232 = load i32, ptr %231, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = add nsw i64 %225, %233
  %235 = load i32, ptr %11, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %236
  %238 = load i32, ptr %12, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [1002 x i64], ptr %237, i64 0, i64 %239
  store i64 %234, ptr %240, align 8, !tbaa !12
  br label %241

241:                                              ; preds = %209
  %242 = load i32, ptr %12, align 4, !tbaa !5
  %243 = add nsw i32 %242, -1
  store i32 %243, ptr %12, align 4, !tbaa !5
  br label %205, !llvm.loop !20

244:                                              ; preds = %208
  br label %245

245:                                              ; preds = %244
  %246 = load i32, ptr %11, align 4, !tbaa !5
  %247 = add nsw i32 %246, -1
  store i32 %247, ptr %11, align 4, !tbaa !5
  br label %199, !llvm.loop !21

248:                                              ; preds = %202
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 2, ptr %13, align 4, !tbaa !5
  br label %249

249:                                              ; preds = %339, %248
  %250 = load i32, ptr %13, align 4, !tbaa !5
  %251 = load i32, ptr @n, align 4, !tbaa !5
  %252 = icmp slt i32 %250, %251
  br i1 %252, label %254, label %253

253:                                              ; preds = %249
  store i32 32, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %342

254:                                              ; preds = %249
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 2, ptr %14, align 4, !tbaa !5
  br label %255

255:                                              ; preds = %335, %254
  %256 = load i32, ptr %14, align 4, !tbaa !5
  %257 = load i32, ptr @m, align 4, !tbaa !5
  %258 = icmp slt i32 %256, %257
  br i1 %258, label %260, label %259

259:                                              ; preds = %255
  store i32 35, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %338

260:                                              ; preds = %255
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %261 = load i32, ptr %13, align 4, !tbaa !5
  %262 = sub nsw i32 %261, 1
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %263
  %265 = load i32, ptr %14, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [1002 x i64], ptr %264, i64 0, i64 %266
  %268 = load i64, ptr %267, align 8, !tbaa !12
  %269 = load i32, ptr %13, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %270
  %272 = load i32, ptr %14, align 4, !tbaa !5
  %273 = sub nsw i32 %272, 1
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [1002 x i64], ptr %271, i64 0, i64 %274
  %276 = load i64, ptr %275, align 8, !tbaa !12
  %277 = add nsw i64 %268, %276
  %278 = load i32, ptr %13, align 4, !tbaa !5
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %279
  %281 = load i32, ptr %14, align 4, !tbaa !5
  %282 = add nsw i32 %281, 1
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [1002 x i64], ptr %280, i64 0, i64 %283
  %285 = load i64, ptr %284, align 8, !tbaa !12
  %286 = add nsw i64 %277, %285
  %287 = load i32, ptr %13, align 4, !tbaa !5
  %288 = add nsw i32 %287, 1
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %289
  %291 = load i32, ptr %14, align 4, !tbaa !5
  %292 = sext i32 %291 to i64
  %293 = getelementptr inbounds [1002 x i64], ptr %290, i64 0, i64 %292
  %294 = load i64, ptr %293, align 8, !tbaa !12
  %295 = add nsw i64 %286, %294
  store i64 %295, ptr %15, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %296 = load i32, ptr %13, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %297
  %299 = load i32, ptr %14, align 4, !tbaa !5
  %300 = sub nsw i32 %299, 1
  %301 = sext i32 %300 to i64
  %302 = getelementptr inbounds [1002 x i64], ptr %298, i64 0, i64 %301
  %303 = load i64, ptr %302, align 8, !tbaa !12
  %304 = load i32, ptr %13, align 4, !tbaa !5
  %305 = add nsw i32 %304, 1
  %306 = sext i32 %305 to i64
  %307 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %306
  %308 = load i32, ptr %14, align 4, !tbaa !5
  %309 = sext i32 %308 to i64
  %310 = getelementptr inbounds [1002 x i64], ptr %307, i64 0, i64 %309
  %311 = load i64, ptr %310, align 8, !tbaa !12
  %312 = add nsw i64 %303, %311
  %313 = load i32, ptr %13, align 4, !tbaa !5
  %314 = sub nsw i32 %313, 1
  %315 = sext i32 %314 to i64
  %316 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %315
  %317 = load i32, ptr %14, align 4, !tbaa !5
  %318 = sext i32 %317 to i64
  %319 = getelementptr inbounds [1002 x i64], ptr %316, i64 0, i64 %318
  %320 = load i64, ptr %319, align 8, !tbaa !12
  %321 = add nsw i64 %312, %320
  %322 = load i32, ptr %13, align 4, !tbaa !5
  %323 = sext i32 %322 to i64
  %324 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %323
  %325 = load i32, ptr %14, align 4, !tbaa !5
  %326 = add nsw i32 %325, 1
  %327 = sext i32 %326 to i64
  %328 = getelementptr inbounds [1002 x i64], ptr %324, i64 0, i64 %327
  %329 = load i64, ptr %328, align 8, !tbaa !12
  %330 = add nsw i64 %321, %329
  store i64 %330, ptr %16, align 8, !tbaa !12
  %331 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %332 = load i64, ptr %331, align 8, !tbaa !12
  store i64 %332, ptr @cur, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  %333 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mx, ptr noundef nonnull align 8 dereferenceable(8) @cur)
  %334 = load i64, ptr %333, align 8, !tbaa !12
  store i64 %334, ptr @mx, align 8, !tbaa !12
  br label %335

335:                                              ; preds = %260
  %336 = load i32, ptr %14, align 4, !tbaa !5
  %337 = add nsw i32 %336, 1
  store i32 %337, ptr %14, align 4, !tbaa !5
  br label %255, !llvm.loop !22

338:                                              ; preds = %259
  br label %339

339:                                              ; preds = %338
  %340 = load i32, ptr %13, align 4, !tbaa !5
  %341 = add nsw i32 %340, 1
  store i32 %341, ptr %13, align 4, !tbaa !5
  br label %249, !llvm.loop !23

342:                                              ; preds = %253
  %343 = load i64, ptr @mx, align 8, !tbaa !12
  %344 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %343)
  %345 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %344, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}


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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [1002 x [1002 x i32]], align 16
@m1 = external dso_local global [1002 x [1002 x i64]], align 16
@m2 = external dso_local global [1002 x [1002 x i64]], align 16
@m3 = external dso_local global [1002 x [1002 x i64]], align 16
@m4 = external dso_local global [1002 x [1002 x i64]], align 16
@mx = external dso_local global i64, align 8
@cur = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_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 i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %.not103 = icmp slt i32 %4, 1
  br i1 %.not103, label %._crit_edge135, label %.preheader99.lr.ph

.preheader99.lr.ph:                               ; preds = %0
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %6 = icmp slt i32 %5, 1
  br i1 %6, label %.preheader92, label %.preheader99

.preheader99:                                     ; preds = %.preheader99.lr.ph, %._crit_edge
  %7 = phi i32 [ %10, %._crit_edge ], [ %4, %.preheader99.lr.ph ]
  %8 = phi i32 [ %11, %._crit_edge ], [ %5, %.preheader99.lr.ph ]
  %indvars.iv145 = phi i64 [ %indvars.iv.next146, %._crit_edge ], [ 1, %.preheader99.lr.ph ]
  %.not91101 = icmp slt i32 %8, 1
  br i1 %.not91101, label %._crit_edge, label %.lr.ph

.preheader98:                                     ; preds = %._crit_edge
  %.not87109 = icmp slt i32 %10, 1
  br i1 %.not87109, label %._crit_edge135, label %.preheader97.lr.ph

.preheader97.lr.ph:                               ; preds = %.preheader98
  %.pr = load i32, ptr @m, align 4, !tbaa !5
  %9 = icmp slt i32 %.pr, 1
  br i1 %9, label %.preheader92, label %.preheader97

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader99
  %10 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %7, %.preheader99 ]
  %11 = phi i32 [ %15, %._crit_edge.loopexit ], [ %8, %.preheader99 ]
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %12 = sext i32 %10 to i64
  %.not.not = icmp slt i64 %indvars.iv145, %12
  br i1 %.not.not, label %.preheader99, label %.preheader98, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader99, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader99 ]
  %13 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %indvars.iv145, i64 %indvars.iv
  %14 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %13)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %.not91.not = icmp slt i64 %indvars.iv, %16
  br i1 %.not91.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

.preheader97:                                     ; preds = %.preheader97.lr.ph, %._crit_edge108
  %17 = phi i32 [ %23, %._crit_edge108 ], [ %10, %.preheader97.lr.ph ]
  %18 = phi i32 [ %24, %._crit_edge108 ], [ %.pr, %.preheader97.lr.ph ]
  %indvars.iv151 = phi i64 [ %indvars.iv.next152, %._crit_edge108 ], [ 1, %.preheader97.lr.ph ]
  %.not90105 = icmp slt i32 %18, 1
  br i1 %.not90105, label %._crit_edge108, label %.lr.ph107

.lr.ph107:                                        ; preds = %.preheader97
  %19 = add nsw i64 %indvars.iv151, -1
  br label %26

.preheader96:                                     ; preds = %._crit_edge108
  %20 = icmp sgt i32 %23, 0
  br i1 %20, label %.preheader95.lr.ph, label %._crit_edge135

.preheader95.lr.ph:                               ; preds = %.preheader96
  %.pr206 = load i32, ptr @m, align 4, !tbaa !5
  %21 = icmp slt i32 %.pr206, 1
  br i1 %21, label %.preheader92, label %.preheader95.preheader

.preheader95.preheader:                           ; preds = %.preheader95.lr.ph
  %22 = zext nneg i32 %23 to i64
  br label %.preheader95

._crit_edge108.loopexit:                          ; preds = %26
  %.pre178 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge108

._crit_edge108:                                   ; preds = %._crit_edge108.loopexit, %.preheader97
  %23 = phi i32 [ %.pre178, %._crit_edge108.loopexit ], [ %17, %.preheader97 ]
  %24 = phi i32 [ %37, %._crit_edge108.loopexit ], [ %18, %.preheader97 ]
  %indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
  %25 = sext i32 %23 to i64
  %.not87.not = icmp slt i64 %indvars.iv151, %25
  br i1 %.not87.not, label %.preheader97, label %.preheader96, !llvm.loop !13

26:                                               ; preds = %.lr.ph107, %26
  %indvars.iv148 = phi i64 [ 1, %.lr.ph107 ], [ %indvars.iv.next149, %26 ]
  %27 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %19, i64 %indvars.iv148
  %28 = add nsw i64 %indvars.iv148, -1
  %29 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %indvars.iv151, i64 %28
  %30 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i64, ptr %30, align 8, !tbaa !14
  %32 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %indvars.iv151, i64 %indvars.iv148
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = add nsw i64 %31, %34
  %36 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %indvars.iv151, i64 %indvars.iv148
  store i64 %35, ptr %36, align 8, !tbaa !14
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %37 = load i32, ptr @m, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %.not90.not = icmp slt i64 %indvars.iv148, %38
  br i1 %.not90.not, label %26, label %._crit_edge108.loopexit, !llvm.loop !16

.preheader95:                                     ; preds = %.preheader95.preheader, %._crit_edge114
  %39 = phi i32 [ %.pr206, %.preheader95.preheader ], [ %42, %._crit_edge114 ]
  %indvars.iv157 = phi i64 [ %22, %.preheader95.preheader ], [ %indvars.iv.next158, %._crit_edge114 ]
  %.not89111 = icmp slt i32 %39, 1
  br i1 %.not89111, label %._crit_edge114, label %.lr.ph113

.lr.ph113:                                        ; preds = %.preheader95
  %40 = add nuw nsw i64 %indvars.iv157, 1
  br label %44

.preheader94:                                     ; preds = %._crit_edge114
  %.pre179 = load i32, ptr @n, align 4, !tbaa !5
  %.not88120 = icmp slt i32 %.pre179, 1
  br i1 %.not88120, label %._crit_edge135, label %.lr.ph122

.lr.ph122:                                        ; preds = %.preheader94
  %.pr196 = load i32, ptr @m, align 4, !tbaa !5
  %41 = icmp sgt i32 %.pr196, 0
  br i1 %41, label %.lr.ph122.split, label %.preheader92

._crit_edge114:                                   ; preds = %44, %.preheader95
  %42 = phi i32 [ %39, %.preheader95 ], [ %55, %44 ]
  %indvars.iv.next158 = add nsw i64 %indvars.iv157, -1
  %43 = icmp sgt i64 %indvars.iv157, 1
  br i1 %43, label %.preheader95, label %.preheader94, !llvm.loop !17

44:                                               ; preds = %.lr.ph113, %44
  %indvars.iv154 = phi i64 [ 1, %.lr.ph113 ], [ %indvars.iv.next155, %44 ]
  %45 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %40, i64 %indvars.iv154
  %46 = add nsw i64 %indvars.iv154, -1
  %47 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %indvars.iv157, i64 %46
  %48 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef nonnull align 8 dereferenceable(8) %47)
  %49 = load i64, ptr %48, align 8, !tbaa !14
  %50 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %indvars.iv157, i64 %indvars.iv154
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = add nsw i64 %49, %52
  %54 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %indvars.iv157, i64 %indvars.iv154
  store i64 %53, ptr %54, align 8, !tbaa !14
  %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
  %55 = load i32, ptr @m, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %.not89.not = icmp slt i64 %indvars.iv154, %56
  br i1 %.not89.not, label %44, label %._crit_edge114, !llvm.loop !18

.preheader93:                                     ; preds = %._crit_edge119
  %57 = icmp sgt i32 %65, 0
  br i1 %57, label %.lr.ph130, label %._crit_edge135

.lr.ph130:                                        ; preds = %.preheader93
  %.pr209.pr = load i32, ptr @m, align 4, !tbaa !5
  %58 = icmp sgt i32 %.pr209.pr, 0
  br i1 %58, label %.lr.ph130.split.preheader, label %.preheader92

.lr.ph130.split.preheader:                        ; preds = %.lr.ph130
  %59 = zext nneg i32 %65 to i64
  br label %.lr.ph130.split

.lr.ph122.splitthread-pre-split:                  ; preds = %._crit_edge119
  %indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
  %.pr203 = load i32, ptr @m, align 4, !tbaa !5
  br label %.lr.ph122.split

.lr.ph122.split:                                  ; preds = %.lr.ph122, %.lr.ph122.splitthread-pre-split
  %60 = phi i32 [ %.pr203, %.lr.ph122.splitthread-pre-split ], [ %.pr196, %.lr.ph122 ]
  %61 = phi i32 [ %65, %.lr.ph122.splitthread-pre-split ], [ %.pre179, %.lr.ph122 ]
  %indvars.iv163 = phi i64 [ %indvars.iv.next164, %.lr.ph122.splitthread-pre-split ], [ 1, %.lr.ph122 ]
  %62 = icmp sgt i32 %60, 0
  br i1 %62, label %.lr.ph118, label %._crit_edge119

.lr.ph118:                                        ; preds = %.lr.ph122.split
  %63 = add nsw i64 %indvars.iv163, -1
  %64 = zext nneg i32 %60 to i64
  br label %67

._crit_edge119.loopexit:                          ; preds = %67
  %.pre180 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge119

._crit_edge119:                                   ; preds = %._crit_edge119.loopexit, %.lr.ph122.split
  %65 = phi i32 [ %.pre180, %._crit_edge119.loopexit ], [ %61, %.lr.ph122.split ]
  %66 = sext i32 %65 to i64
  %.not88.not = icmp slt i64 %indvars.iv163, %66
  br i1 %.not88.not, label %.lr.ph122.splitthread-pre-split, label %.preheader93, !llvm.loop !19

67:                                               ; preds = %.lr.ph118, %67
  %indvars.iv160 = phi i64 [ %64, %.lr.ph118 ], [ %indvars.iv.next161, %67 ]
  %68 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %63, i64 %indvars.iv160
  %69 = add nuw nsw i64 %indvars.iv160, 1
  %70 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %indvars.iv163, i64 %69
  %71 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull align 8 dereferenceable(8) %70)
  %72 = load i64, ptr %71, align 8, !tbaa !14
  %73 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %indvars.iv163, i64 %indvars.iv160
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = add nsw i64 %72, %75
  %77 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %indvars.iv163, i64 %indvars.iv160
  store i64 %76, ptr %77, align 8, !tbaa !14
  %indvars.iv.next161 = add nsw i64 %indvars.iv160, -1
  %78 = icmp ugt i64 %indvars.iv160, 1
  br i1 %78, label %67, label %._crit_edge119.loopexit, !llvm.loop !20

.preheader92.loopexit:                            ; preds = %._crit_edge128
  %.pre181 = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader92

.preheader92:                                     ; preds = %.preheader99.lr.ph, %.preheader97.lr.ph, %.lr.ph122, %.preheader95.lr.ph, %.lr.ph130, %.preheader92.loopexit
  %79 = phi i32 [ %.pre181, %.preheader92.loopexit ], [ %65, %.lr.ph130 ], [ %23, %.preheader95.lr.ph ], [ %.pre179, %.lr.ph122 ], [ %10, %.preheader97.lr.ph ], [ %4, %.preheader99.lr.ph ]
  %80 = icmp sgt i32 %79, 2
  %81 = load i32, ptr @m, align 4
  %82 = icmp sgt i32 %81, 2
  %or.cond = select i1 %80, i1 %82, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge135

.lr.ph130.splitthread-pre-split:                  ; preds = %._crit_edge128
  %indvars.iv.next170 = add nsw i64 %indvars.iv169, -1
  %.pr205 = load i32, ptr @m, align 4, !tbaa !5
  br label %.lr.ph130.split

.lr.ph130.split:                                  ; preds = %.lr.ph130.splitthread-pre-split, %.lr.ph130.split.preheader
  %83 = phi i32 [ %.pr205, %.lr.ph130.splitthread-pre-split ], [ %.pr209.pr, %.lr.ph130.split.preheader ]
  %indvars.iv169 = phi i64 [ %indvars.iv.next170, %.lr.ph130.splitthread-pre-split ], [ %59, %.lr.ph130.split.preheader ]
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.lr.ph127, label %._crit_edge128

.lr.ph127:                                        ; preds = %.lr.ph130.split
  %85 = add nuw nsw i64 %indvars.iv169, 1
  %86 = zext nneg i32 %83 to i64
  br label %88

._crit_edge128:                                   ; preds = %88, %.lr.ph130.split
  %87 = icmp sgt i64 %indvars.iv169, 1
  br i1 %87, label %.lr.ph130.splitthread-pre-split, label %.preheader92.loopexit, !llvm.loop !21

88:                                               ; preds = %.lr.ph127, %88
  %indvars.iv166 = phi i64 [ %86, %.lr.ph127 ], [ %indvars.iv.next167, %88 ]
  %89 = add nuw nsw i64 %indvars.iv166, 1
  %90 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %indvars.iv169, i64 %89
  %91 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %85, i64 %indvars.iv166
  %92 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %90, ptr noundef nonnull align 8 dereferenceable(8) %91)
  %93 = load i64, ptr %92, align 8, !tbaa !14
  %94 = getelementptr inbounds [1002 x [1002 x i32]], ptr @a, i64 0, i64 %indvars.iv169, i64 %indvars.iv166
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = add nsw i64 %93, %96
  %98 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %indvars.iv169, i64 %indvars.iv166
  store i64 %97, ptr %98, align 8, !tbaa !14
  %indvars.iv.next167 = add nsw i64 %indvars.iv166, -1
  %99 = icmp ugt i64 %indvars.iv166, 1
  br i1 %99, label %88, label %._crit_edge128, !llvm.loop !22

.preheader:                                       ; preds = %.preheader92, %._crit_edge133
  %100 = phi i32 [ %108, %._crit_edge133 ], [ %79, %.preheader92 ]
  %101 = phi i32 [ %109, %._crit_edge133 ], [ %81, %.preheader92 ]
  %indvars.iv175 = phi i64 [ %indvars.iv.next176.pre-phi, %._crit_edge133 ], [ 2, %.preheader92 ]
  %102 = icmp sgt i32 %101, 2
  br i1 %102, label %.lr.ph132, label %.preheader.._crit_edge133_crit_edge

.preheader.._crit_edge133_crit_edge:              ; preds = %.preheader
  %.pre183 = add nuw nsw i64 %indvars.iv175, 1
  br label %._crit_edge133

.lr.ph132:                                        ; preds = %.preheader
  %103 = add nsw i64 %indvars.iv175, -1
  %104 = add nuw nsw i64 %indvars.iv175, 1
  br label %112

._crit_edge135:                                   ; preds = %._crit_edge133, %0, %.preheader98, %.preheader96, %.preheader94, %.preheader93, %.preheader92
  %105 = load i64, ptr @mx, align 8, !tbaa !14
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %105)
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %106, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

._crit_edge133.loopexit:                          ; preds = %112
  %.pre182 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge133

._crit_edge133:                                   ; preds = %.preheader.._crit_edge133_crit_edge, %._crit_edge133.loopexit
  %indvars.iv.next176.pre-phi = phi i64 [ %.pre183, %.preheader.._crit_edge133_crit_edge ], [ %104, %._crit_edge133.loopexit ]
  %108 = phi i32 [ %100, %.preheader.._crit_edge133_crit_edge ], [ %.pre182, %._crit_edge133.loopexit ]
  %109 = phi i32 [ %101, %.preheader.._crit_edge133_crit_edge ], [ %140, %._crit_edge133.loopexit ]
  %110 = sext i32 %108 to i64
  %111 = icmp slt i64 %indvars.iv.next176.pre-phi, %110
  br i1 %111, label %.preheader, label %._crit_edge135, !llvm.loop !23

112:                                              ; preds = %.lr.ph132, %112
  %indvars.iv172 = phi i64 [ 2, %.lr.ph132 ], [ %indvars.iv.next173, %112 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %113 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %103, i64 %indvars.iv172
  %114 = load i64, ptr %113, align 8, !tbaa !14
  %115 = add nsw i64 %indvars.iv172, -1
  %116 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %indvars.iv175, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !14
  %118 = add nsw i64 %117, %114
  %indvars.iv.next173 = add nuw nsw i64 %indvars.iv172, 1
  %119 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %indvars.iv175, i64 %indvars.iv.next173
  %120 = load i64, ptr %119, align 8, !tbaa !14
  %121 = add nsw i64 %118, %120
  %122 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %104, i64 %indvars.iv172
  %123 = load i64, ptr %122, align 8, !tbaa !14
  %124 = add nsw i64 %121, %123
  store i64 %124, ptr %1, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %125 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m1, i64 0, i64 %indvars.iv175, i64 %115
  %126 = load i64, ptr %125, align 8, !tbaa !14
  %127 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m2, i64 0, i64 %104, i64 %indvars.iv172
  %128 = load i64, ptr %127, align 8, !tbaa !14
  %129 = add nsw i64 %128, %126
  %130 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m3, i64 0, i64 %103, i64 %indvars.iv172
  %131 = load i64, ptr %130, align 8, !tbaa !14
  %132 = add nsw i64 %129, %131
  %133 = getelementptr inbounds [1002 x [1002 x i64]], ptr @m4, i64 0, i64 %indvars.iv175, i64 %indvars.iv.next173
  %134 = load i64, ptr %133, align 8, !tbaa !14
  %135 = add nsw i64 %132, %134
  store i64 %135, ptr %2, align 8, !tbaa !14
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %137 = load i64, ptr %136, align 8, !tbaa !14
  store i64 %137, ptr @cur, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mx, ptr noundef nonnull align 8 dereferenceable(8) @cur)
  %139 = load i64, ptr %138, align 8, !tbaa !14
  store i64 %139, ptr @mx, align 8, !tbaa !14
  %140 = load i32, ptr @m, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = icmp slt i64 %indvars.iv.next173, %141
  br i1 %142, label %112, label %._crit_edge133.loopexit, !llvm.loop !24
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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) #2

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

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

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

; 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 #4 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

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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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 = { 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 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !11}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !11}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !11}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !11}
!24 = distinct !{!24, !10}


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