; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/Bayan 2015 Warmup/Problem C (C)

; 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
@cnt = external dso_local global i32, align 4
@g = external dso_local global [1002 x [1002 x i32]], align 16
@up = external dso_local global [1002 x [1002 x i32]], align 16
@lef = external dso_local global [1002 x [1002 x i32]], align 16
@tot = external dso_local global [1002 x [1002 x i32]], align 16
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@s = external dso_local global [1002 x i8], align 16
@.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
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4rectiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2goiii(i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  store i32 0, ptr %1, align 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %54, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %14
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @s)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %50, %19
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %53

26:                                               ; preds = %21
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = sub nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1002 x i8], ptr @s, i64 0, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !9
  %32 = sext i8 %31 to i32
  %33 = icmp eq i32 %32, 88
  %34 = zext i1 %33 to i32
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %36
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1002 x i32], ptr %37, i64 0, i64 %39
  store i32 %34, ptr %40, align 4, !tbaa !5
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1002 x i32], ptr %43, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr @cnt, align 4, !tbaa !5
  %49 = add nsw i32 %48, %47
  store i32 %49, ptr @cnt, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %26
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %4, align 4, !tbaa !5
  br label %21, !llvm.loop !10

53:                                               ; preds = %25
  br label %54

54:                                               ; preds = %53
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !12

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

58:                                               ; preds = %127, %57
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = icmp sle i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %130

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

64:                                               ; preds = %123, %63
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = load i32, ptr @m, align 4, !tbaa !5
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %71
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1002 x i32], ptr %72, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %109

78:                                               ; preds = %69
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = sub nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %81
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1002 x i32], ptr %82, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %89
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1002 x i32], ptr %90, i64 0, i64 %92
  store i32 %87, ptr %93, align 4, !tbaa !5
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1002 x [1002 x i32]], ptr @lef, i64 0, i64 %95
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = sub nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1002 x i32], ptr %96, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1002 x [1002 x i32]], ptr @lef, i64 0, i64 %104
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1002 x i32], ptr %105, i64 0, i64 %107
  store i32 %102, ptr %108, align 4, !tbaa !5
  br label %122

109:                                              ; preds = %69
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %111
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1002 x i32], ptr %112, i64 0, i64 %114
  store i32 0, ptr %115, align 4, !tbaa !5
  %116 = load i32, ptr %5, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1002 x [1002 x i32]], ptr @lef, i64 0, i64 %117
  %119 = load i32, ptr %6, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [1002 x i32], ptr %118, i64 0, i64 %120
  store i32 0, ptr %121, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %109, %78
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %6, align 4, !tbaa !5
  br label %64, !llvm.loop !13

126:                                              ; preds = %68
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %5, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %5, align 4, !tbaa !5
  br label %58, !llvm.loop !14

130:                                              ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %185, %130
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = load i32, ptr @n, align 4, !tbaa !5
  %134 = icmp sle i32 %132, %133
  br i1 %134, label %136, label %135

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

136:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %181, %136
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = load i32, ptr @m, align 4, !tbaa !5
  %140 = icmp sle i32 %138, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %184

142:                                              ; preds = %137
  %143 = load i32, ptr %7, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %145
  %147 = load i32, ptr %8, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [1002 x i32], ptr %146, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %161, label %152

152:                                              ; preds = %142
  %153 = load i32, ptr %7, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %154
  %156 = load i32, ptr %8, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1002 x i32], ptr %155, i64 0, i64 %157
  %159 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @y, ptr noundef nonnull align 4 dereferenceable(4) %158)
  %160 = load i32, ptr %159, align 4, !tbaa !5
  store i32 %160, ptr @y, align 4, !tbaa !5
  br label %161

161:                                              ; preds = %152, %142
  %162 = load i32, ptr %7, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %163
  %165 = load i32, ptr %8, align 4, !tbaa !5
  %166 = sub nsw i32 %165, 1
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1002 x i32], ptr %164, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %180, label %171

171:                                              ; preds = %161
  %172 = load i32, ptr %7, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [1002 x [1002 x i32]], ptr @lef, i64 0, i64 %173
  %175 = load i32, ptr %8, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [1002 x i32], ptr %174, i64 0, i64 %176
  %178 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @x, ptr noundef nonnull align 4 dereferenceable(4) %177)
  %179 = load i32, ptr %178, align 4, !tbaa !5
  store i32 %179, ptr @x, align 4, !tbaa !5
  br label %180

180:                                              ; preds = %171, %161
  br label %181

181:                                              ; preds = %180
  %182 = load i32, ptr %8, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %8, align 4, !tbaa !5
  br label %137, !llvm.loop !15

184:                                              ; preds = %141
  br label %185

185:                                              ; preds = %184
  %186 = load i32, ptr %7, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %7, align 4, !tbaa !5
  br label %131, !llvm.loop !16

188:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %227, %188
  %190 = load i32, ptr %9, align 4, !tbaa !5
  %191 = load i32, ptr @n, align 4, !tbaa !5
  %192 = icmp sle i32 %190, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %189
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %230

194:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %195

195:                                              ; preds = %223, %194
  %196 = load i32, ptr %10, align 4, !tbaa !5
  %197 = load i32, ptr @m, align 4, !tbaa !5
  %198 = icmp sle i32 %196, %197
  br i1 %198, label %200, label %199

199:                                              ; preds = %195
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %226

200:                                              ; preds = %195
  %201 = load i32, ptr %9, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [1002 x [1002 x i32]], ptr @tot, i64 0, i64 %202
  %204 = load i32, ptr %10, align 4, !tbaa !5
  %205 = sub nsw i32 %204, 1
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [1002 x i32], ptr %203, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = load i32, ptr %9, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %210
  %212 = load i32, ptr %10, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1002 x i32], ptr %211, i64 0, i64 %213
  %215 = load i32, ptr %214, align 4, !tbaa !5
  %216 = add nsw i32 %208, %215
  %217 = load i32, ptr %9, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [1002 x [1002 x i32]], ptr @tot, i64 0, i64 %218
  %220 = load i32, ptr %10, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [1002 x i32], ptr %219, i64 0, i64 %221
  store i32 %216, ptr %222, align 4, !tbaa !5
  br label %223

223:                                              ; preds = %200
  %224 = load i32, ptr %10, align 4, !tbaa !5
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %10, align 4, !tbaa !5
  br label %195, !llvm.loop !17

226:                                              ; preds = %199
  br label %227

227:                                              ; preds = %226
  %228 = load i32, ptr %9, align 4, !tbaa !5
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %9, align 4, !tbaa !5
  br label %189, !llvm.loop !18

230:                                              ; preds = %193
  %231 = load i32, ptr @x, align 4, !tbaa !5
  %232 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %231)
  %233 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %232, ptr noundef @.str.2)
  %234 = load i32, ptr @y, align 4, !tbaa !5
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %233, i32 noundef %234)
  %236 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %235, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %237

237:                                              ; preds = %344, %230
  %238 = load i32, ptr %11, align 4, !tbaa !5
  %239 = load i32, ptr @n, align 4, !tbaa !5
  %240 = icmp sle i32 %238, %239
  br i1 %240, label %242, label %241

241:                                              ; preds = %237
  store i32 26, ptr %3, align 4
  br label %347

242:                                              ; preds = %237
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %243

243:                                              ; preds = %338, %242
  %244 = load i32, ptr %12, align 4, !tbaa !5
  %245 = load i32, ptr @m, align 4, !tbaa !5
  %246 = icmp sle i32 %244, %245
  br i1 %246, label %248, label %247

247:                                              ; preds = %243
  store i32 29, ptr %3, align 4
  br label %341

248:                                              ; preds = %243
  %249 = load i32, ptr %11, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %250
  %252 = load i32, ptr %12, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [1002 x i32], ptr %251, i64 0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !5
  %256 = icmp ne i32 %255, 0
  br i1 %256, label %257, label %337

257:                                              ; preds = %248
  %258 = load i32, ptr %11, align 4, !tbaa !5
  %259 = load i32, ptr %12, align 4, !tbaa !5
  %260 = load i32, ptr %11, align 4, !tbaa !5
  %261 = load i32, ptr @x, align 4, !tbaa !5
  %262 = add nsw i32 %260, %261
  %263 = sub nsw i32 %262, 1
  %264 = load i32, ptr %12, align 4, !tbaa !5
  %265 = load i32, ptr @y, align 4, !tbaa !5
  %266 = add nsw i32 %264, %265
  %267 = sub nsw i32 %266, 1
  %268 = call noundef i32 @_Z4rectiiii(i32 noundef %258, i32 noundef %259, i32 noundef %263, i32 noundef %267)
  %269 = load i32, ptr @x, align 4, !tbaa !5
  %270 = load i32, ptr @y, align 4, !tbaa !5
  %271 = mul nsw i32 %269, %270
  %272 = icmp slt i32 %268, %271
  br i1 %272, label %273, label %275

273:                                              ; preds = %257
  %274 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %341

275:                                              ; preds = %257
  %276 = load i32, ptr @x, align 4, !tbaa !5
  %277 = load i32, ptr @y, align 4, !tbaa !5
  %278 = mul nsw i32 %276, %277
  %279 = load i32, ptr @cnt, align 4, !tbaa !5
  %280 = sub nsw i32 %279, %278
  store i32 %280, ptr @cnt, align 4, !tbaa !5
  %281 = load i32, ptr @cnt, align 4, !tbaa !5
  %282 = icmp eq i32 %281, 0
  br i1 %282, label %283, label %288

283:                                              ; preds = %275
  %284 = load i32, ptr @x, align 4, !tbaa !5
  %285 = load i32, ptr @y, align 4, !tbaa !5
  %286 = mul nsw i32 %284, %285
  %287 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %286)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %341

288:                                              ; preds = %275
  %289 = load i32, ptr %11, align 4, !tbaa !5
  %290 = load i32, ptr @x, align 4, !tbaa !5
  %291 = add nsw i32 %289, %290
  %292 = sub nsw i32 %291, 1
  store i32 %292, ptr %11, align 4, !tbaa !5
  %293 = load i32, ptr %12, align 4, !tbaa !5
  %294 = load i32, ptr @y, align 4, !tbaa !5
  %295 = add nsw i32 %293, %294
  %296 = sub nsw i32 %295, 1
  store i32 %296, ptr %12, align 4, !tbaa !5
  %297 = load i32, ptr %11, align 4, !tbaa !5
  %298 = sext i32 %297 to i64
  %299 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %298
  %300 = load i32, ptr %12, align 4, !tbaa !5
  %301 = add nsw i32 %300, 1
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds [1002 x i32], ptr %299, i64 0, i64 %302
  %304 = load i32, ptr %303, align 4, !tbaa !5
  %305 = icmp ne i32 %304, 0
  br i1 %305, label %306, label %310

306:                                              ; preds = %288
  %307 = load i32, ptr %11, align 4, !tbaa !5
  %308 = load i32, ptr %12, align 4, !tbaa !5
  %309 = add nsw i32 %308, 1
  call void @_Z2goiii(i32 noundef %307, i32 noundef %309, i32 noundef 1)
  br label %310

310:                                              ; preds = %306, %288
  %311 = load i32, ptr %11, align 4, !tbaa !5
  %312 = add nsw i32 %311, 1
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %313
  %315 = load i32, ptr %12, align 4, !tbaa !5
  %316 = sext i32 %315 to i64
  %317 = getelementptr inbounds [1002 x i32], ptr %314, i64 0, i64 %316
  %318 = load i32, ptr %317, align 4, !tbaa !5
  %319 = icmp ne i32 %318, 0
  br i1 %319, label %320, label %324

320:                                              ; preds = %310
  %321 = load i32, ptr %11, align 4, !tbaa !5
  %322 = add nsw i32 %321, 1
  %323 = load i32, ptr %12, align 4, !tbaa !5
  call void @_Z2goiii(i32 noundef %322, i32 noundef %323, i32 noundef 2)
  br label %326

324:                                              ; preds = %310
  %325 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %341

326:                                              ; preds = %320
  %327 = load i32, ptr @cnt, align 4, !tbaa !5
  %328 = icmp eq i32 %327, 0
  br i1 %328, label %329, label %334

329:                                              ; preds = %326
  %330 = load i32, ptr @x, align 4, !tbaa !5
  %331 = load i32, ptr @y, align 4, !tbaa !5
  %332 = mul nsw i32 %330, %331
  %333 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %332)
  br label %336

334:                                              ; preds = %326
  %335 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %336

336:                                              ; preds = %334, %329
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %341

337:                                              ; preds = %248
  br label %338

338:                                              ; preds = %337
  %339 = load i32, ptr %12, align 4, !tbaa !5
  %340 = add nsw i32 %339, 1
  store i32 %340, ptr %12, align 4, !tbaa !5
  br label %243, !llvm.loop !19

341:                                              ; preds = %336, %324, %283, %273, %247
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %342 = load i32, ptr %3, align 4
  switch i32 %342, label %347 [
    i32 29, label %343
  ]

343:                                              ; preds = %341
  br label %344

344:                                              ; preds = %343
  %345 = load i32, ptr %11, align 4, !tbaa !5
  %346 = add nsw i32 %345, 1
  store i32 %346, ptr %11, align 4, !tbaa !5
  br label %237, !llvm.loop !20

347:                                              ; preds = %341, %241
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %348 = load i32, ptr %3, align 4
  switch i32 %348, label %352 [
    i32 26, label %349
    i32 1, label %350
  ]

349:                                              ; preds = %347
  store i32 0, ptr %1, align 4
  br label %350

350:                                              ; preds = %349, %347
  %351 = load i32, ptr %1, align 4
  ret i32 %351

352:                                              ; preds = %347
  unreachable
}

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

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

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

; 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)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6

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

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

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

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


; 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
@cnt = external dso_local local_unnamed_addr global i32, align 4
@g = external dso_local local_unnamed_addr global [1002 x [1002 x i32]], align 16
@up = external dso_local global [1002 x [1002 x i32]], align 16
@lef = external dso_local global [1002 x [1002 x i32]], align 16
@tot = external dso_local local_unnamed_addr global [1002 x [1002 x i32]], align 16
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@s = external dso_local global [1002 x i8], align 16
@.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
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4rectiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2goiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %.not115 = icmp slt i32 %2, 1
  br i1 %.not115, label %._crit_edge138, label %.lr.ph118

.preheader108:                                    ; preds = %23
  %.not86123 = icmp slt i32 %24, 1
  br i1 %.not86123, label %._crit_edge138, label %.preheader107.lr.ph

.preheader107.lr.ph:                              ; preds = %.preheader108
  %3 = load i32, ptr @m, align 4, !tbaa !5
  %.not98119 = icmp slt i32 %3, 1
  br i1 %.not98119, label %._crit_edge138, label %.preheader107.preheader

.preheader107.preheader:                          ; preds = %.preheader107.lr.ph
  %4 = add nuw i32 %3, 1
  %5 = add nuw i32 %24, 1
  %wide.trip.count166 = zext i32 %5 to i64
  %wide.trip.count161 = zext i32 %4 to i64
  br label %.preheader107

.lr.ph118:                                        ; preds = %0, %23
  %indvars.iv155 = phi i64 [ %indvars.iv.next156, %23 ], [ 1, %0 ]
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @s)
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %.not100112 = icmp slt i32 %7, 1
  br i1 %.not100112, label %23, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph118
  %cnt.promoted = load i32, ptr @cnt, align 4, !tbaa !5
  %8 = add nuw i32 %7, 1
  %wide.trip.count = zext i32 %8 to i64
  %9 = zext nneg i32 %7 to i64
  %min.iters.check = icmp ult i32 %7, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph ], [ %ind.end, %middle.block ]
  %.ph = phi i32 [ %cnt.promoted, %.lr.ph ], [ %22, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %9, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %cnt.promoted, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %10, %vector.ph ], [ %19, %vector.body ]
  %vec.phi223 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %11 = getelementptr inbounds [1002 x i8], ptr @s, i64 0, i64 %index
  %12 = getelementptr inbounds i8, ptr %11, i64 4
  %wide.load = load <4 x i8>, ptr %11, align 8, !tbaa !9
  %wide.load224 = load <4 x i8>, ptr %12, align 4, !tbaa !9
  %13 = icmp eq <4 x i8> %wide.load, <i8 88, i8 88, i8 88, i8 88>
  %14 = icmp eq <4 x i8> %wide.load224, <i8 88, i8 88, i8 88, i8 88>
  %15 = zext <4 x i1> %13 to <4 x i32>
  %16 = zext <4 x i1> %14 to <4 x i32>
  %17 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %indvars.iv155, i64 %offset.idx
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  store <4 x i32> %15, ptr %17, align 4, !tbaa !5
  store <4 x i32> %16, ptr %18, align 4, !tbaa !5
  %19 = add <4 x i32> %vec.phi, %15
  %20 = add <4 x i32> %vec.phi223, %16
  %index.next = add nuw i64 %index, 8
  %21 = icmp eq i64 %index.next, %n.vec
  br i1 %21, label %middle.block, label %vector.body, !llvm.loop !10

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %20, %19
  %22 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %9
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %scalar.ph, %middle.block
  %.lcssa221 = phi i32 [ %22, %middle.block ], [ %33, %scalar.ph ]
  store i32 %.lcssa221, ptr @cnt, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %._crit_edge, %.lr.ph118
  %indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %.not.not = icmp slt i64 %indvars.iv155, %25
  br i1 %.not.not, label %.lr.ph118, label %.preheader108, !llvm.loop !14

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %26 = phi i32 [ %33, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %27 = add nsw i64 %indvars.iv, -1
  %28 = getelementptr inbounds [1002 x i8], ptr @s, i64 0, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !9
  %30 = icmp eq i8 %29, 88
  %31 = zext i1 %30 to i32
  %32 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %indvars.iv155, i64 %indvars.iv
  store i32 %31, ptr %32, align 4, !tbaa !5
  %33 = add nsw i32 %26, %31
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !15

.preheader107:                                    ; preds = %.preheader107.preheader, %._crit_edge122
  %indvars.iv163 = phi i64 [ 1, %.preheader107.preheader ], [ %indvars.iv.next164, %._crit_edge122 ]
  %34 = add nsw i64 %indvars.iv163, -1
  br label %36

.preheader106:                                    ; preds = %._crit_edge122
  %.pr = load i32, ptr @m, align 4
  %35 = icmp slt i32 %.pr, 1
  %or.cond = select i1 %.not86123, i1 true, i1 %35
  br i1 %or.cond, label %.preheader104, label %.preheader105

._crit_edge122:                                   ; preds = %47
  %indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
  %exitcond167.not = icmp eq i64 %indvars.iv.next164, %wide.trip.count166
  br i1 %exitcond167.not, label %.preheader106, label %.preheader107, !llvm.loop !16

36:                                               ; preds = %.preheader107, %47
  %indvars.iv158 = phi i64 [ 1, %.preheader107 ], [ %indvars.iv.next159, %47 ]
  %37 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %indvars.iv163, i64 %indvars.iv158
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %.not99 = icmp eq i32 %38, 0
  br i1 %.not99, label %47, label %39

39:                                               ; preds = %36
  %40 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %34, i64 %indvars.iv158
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  %43 = add nsw i64 %indvars.iv158, -1
  %44 = getelementptr inbounds [1002 x [1002 x i32]], ptr @lef, i64 0, i64 %indvars.iv163, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  br label %47

47:                                               ; preds = %36, %39
  %.sink194 = phi i32 [ %42, %39 ], [ 0, %36 ]
  %.sink = phi i32 [ %46, %39 ], [ 0, %36 ]
  %48 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %indvars.iv163, i64 %indvars.iv158
  store i32 %.sink194, ptr %48, align 4
  %49 = getelementptr inbounds [1002 x [1002 x i32]], ptr @lef, i64 0, i64 %indvars.iv163, i64 %indvars.iv158
  store i32 %.sink, ptr %49, align 4
  %indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1
  %exitcond162.not = icmp eq i64 %indvars.iv.next159, %wide.trip.count161
  br i1 %exitcond162.not, label %._crit_edge122, label %36, !llvm.loop !17

.preheader105:                                    ; preds = %.preheader106, %._crit_edge128
  %50 = phi i32 [ %55, %._crit_edge128 ], [ %24, %.preheader106 ]
  %51 = phi i32 [ %56, %._crit_edge128 ], [ %.pr, %.preheader106 ]
  %indvars.iv171 = phi i64 [ %.pre196, %._crit_edge128 ], [ 1, %.preheader106 ]
  %.not95125 = icmp slt i32 %51, 1
  %.pre196 = add nuw nsw i64 %indvars.iv171, 1
  br i1 %.not95125, label %._crit_edge128, label %.lr.ph127

.preheader104:                                    ; preds = %._crit_edge128, %.preheader106
  %.lcssa = phi i32 [ %24, %.preheader106 ], [ %55, %._crit_edge128 ]
  %.not88136 = icmp slt i32 %.lcssa, 1
  br i1 %.not88136, label %._crit_edge138, label %.preheader103.lr.ph

.preheader103.lr.ph:                              ; preds = %.preheader104
  %.pr208 = load i32, ptr @m, align 4, !tbaa !5
  %.not94132 = icmp slt i32 %.pr208, 1
  br i1 %.not94132, label %._crit_edge138, label %.preheader103.preheader

.preheader103.preheader:                          ; preds = %.preheader103.lr.ph
  %52 = add nuw i32 %.lcssa, 1
  %wide.trip.count182 = zext i32 %52 to i64
  %53 = zext nneg i32 %.pr208 to i64
  %xtraiter = and i64 %53, 1
  %54 = icmp eq i32 %.pr208, 1
  %unroll_iter = and i64 %53, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader103

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

._crit_edge128:                                   ; preds = %.preheader105, %._crit_edge128.loopexit
  %55 = phi i32 [ %.pre, %._crit_edge128.loopexit ], [ %50, %.preheader105 ]
  %56 = phi i32 [ %73, %._crit_edge128.loopexit ], [ %51, %.preheader105 ]
  %57 = sext i32 %55 to i64
  %.not87.not = icmp slt i64 %indvars.iv171, %57
  br i1 %.not87.not, label %.preheader105, label %.preheader104, !llvm.loop !18

.lr.ph127:                                        ; preds = %.preheader105, %72
  %indvars.iv168 = phi i64 [ %indvars.iv.next169, %72 ], [ 1, %.preheader105 ]
  %58 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %.pre196, i64 %indvars.iv168
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %.not96 = icmp eq i32 %59, 0
  br i1 %.not96, label %60, label %64

60:                                               ; preds = %.lr.ph127
  %61 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %indvars.iv171, i64 %indvars.iv168
  %62 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @y, ptr noundef nonnull align 4 dereferenceable(4) %61)
  %63 = load i32, ptr %62, align 4, !tbaa !5
  store i32 %63, ptr @y, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %60, %.lr.ph127
  %65 = add nsw i64 %indvars.iv168, -1
  %66 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %indvars.iv171, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %.not97 = icmp eq i32 %67, 0
  br i1 %.not97, label %68, label %72

68:                                               ; preds = %64
  %69 = getelementptr inbounds [1002 x [1002 x i32]], ptr @lef, i64 0, i64 %indvars.iv171, i64 %indvars.iv168
  %70 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @x, ptr noundef nonnull align 4 dereferenceable(4) %69)
  %71 = load i32, ptr %70, align 4, !tbaa !5
  store i32 %71, ptr @x, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %64, %68
  %indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %.not95.not = icmp slt i64 %indvars.iv168, %74
  br i1 %.not95.not, label %.lr.ph127, label %._crit_edge128.loopexit, !llvm.loop !20

.preheader103:                                    ; preds = %.preheader103.preheader, %._crit_edge135
  %indvars.iv179 = phi i64 [ 1, %.preheader103.preheader ], [ %indvars.iv.next180, %._crit_edge135 ]
  %.phi.trans.insert = getelementptr inbounds [1002 x [1002 x i32]], ptr @tot, i64 0, i64 %indvars.iv179, i64 0
  %.pre195 = load i32, ptr %.phi.trans.insert, align 8, !tbaa !5
  br i1 %54, label %._crit_edge135.unr-lcssa, label %.preheader103.new

._crit_edge138:                                   ; preds = %._crit_edge135, %.preheader108, %0, %.preheader107.lr.ph, %.preheader103.lr.ph, %.preheader104
  %75 = load i32, ptr @x, align 4, !tbaa !5
  %76 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %75)
  %77 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %76, ptr noundef nonnull @.str.2)
  %78 = load i32, ptr @y, align 4, !tbaa !5
  %79 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %77, i32 noundef %78)
  %80 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %79, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %.not89143 = icmp slt i32 %81, 1
  br i1 %.not89143, label %.thread, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %._crit_edge138
  %82 = load i32, ptr @m, align 4, !tbaa !5
  %.not90139 = icmp slt i32 %82, 1
  br i1 %.not90139, label %.thread, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader.lr.ph
  %83 = add nuw i32 %82, 1
  %84 = add nuw i32 %81, 1
  %wide.trip.count192 = zext i32 %84 to i64
  %wide.trip.count187 = zext i32 %83 to i64
  br label %.preheader

._crit_edge135.unr-lcssa:                         ; preds = %.preheader103.new, %.preheader103
  %.unr = phi i32 [ %.pre195, %.preheader103 ], [ %96, %.preheader103.new ]
  %indvars.iv174.unr = phi i64 [ 1, %.preheader103 ], [ %indvars.iv.next175.1, %.preheader103.new ]
  br i1 %lcmp.mod.not, label %._crit_edge135, label %._crit_edge135.epilog-lcssa

._crit_edge135.epilog-lcssa:                      ; preds = %._crit_edge135.unr-lcssa
  %85 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %indvars.iv179, i64 %indvars.iv174.unr
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = add nsw i32 %86, %.unr
  %88 = getelementptr inbounds [1002 x [1002 x i32]], ptr @tot, i64 0, i64 %indvars.iv179, i64 %indvars.iv174.unr
  store i32 %87, ptr %88, align 4, !tbaa !5
  br label %._crit_edge135

._crit_edge135:                                   ; preds = %._crit_edge135.unr-lcssa, %._crit_edge135.epilog-lcssa
  %indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
  %exitcond183.not = icmp eq i64 %indvars.iv.next180, %wide.trip.count182
  br i1 %exitcond183.not, label %._crit_edge138, label %.preheader103, !llvm.loop !21

.preheader103.new:                                ; preds = %.preheader103, %.preheader103.new
  %89 = phi i32 [ %96, %.preheader103.new ], [ %.pre195, %.preheader103 ]
  %indvars.iv174 = phi i64 [ %indvars.iv.next175.1, %.preheader103.new ], [ 1, %.preheader103 ]
  %niter = phi i64 [ %niter.next.1, %.preheader103.new ], [ 0, %.preheader103 ]
  %90 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %indvars.iv179, i64 %indvars.iv174
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nsw i32 %91, %89
  %93 = getelementptr inbounds [1002 x [1002 x i32]], ptr @tot, i64 0, i64 %indvars.iv179, i64 %indvars.iv174
  store i32 %92, ptr %93, align 4, !tbaa !5
  %indvars.iv.next175 = add nuw nsw i64 %indvars.iv174, 1
  %94 = getelementptr inbounds [1002 x [1002 x i32]], ptr @up, i64 0, i64 %indvars.iv179, i64 %indvars.iv.next175
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = add nsw i32 %95, %92
  %97 = getelementptr inbounds [1002 x [1002 x i32]], ptr @tot, i64 0, i64 %indvars.iv179, i64 %indvars.iv.next175
  store i32 %96, ptr %97, align 4, !tbaa !5
  %indvars.iv.next175.1 = add nuw nsw i64 %indvars.iv174, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge135.unr-lcssa, label %.preheader103.new, !llvm.loop !22

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge142
  %indvars.iv189 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next190, %._crit_edge142 ]
  br label %98

98:                                               ; preds = %.preheader, %150
  %indvars.iv184 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next185, %150 ]
  %99 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %indvars.iv189, i64 %indvars.iv184
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %.not91 = icmp eq i32 %100, 0
  br i1 %.not91, label %150, label %101

101:                                              ; preds = %98
  %102 = trunc nuw nsw i64 %indvars.iv189 to i32
  %103 = trunc nuw nsw i64 %indvars.iv184 to i32
  %104 = load i32, ptr @x, align 4, !tbaa !5
  %105 = add nsw i32 %102, -1
  %106 = add i32 %105, %104
  %107 = load i32, ptr @y, align 4, !tbaa !5
  %108 = add nsw i32 %103, -1
  %109 = add i32 %108, %107
  %110 = tail call noundef i32 @_Z4rectiiii(i32 noundef %102, i32 noundef %103, i32 noundef %106, i32 noundef %109)
  %111 = load i32, ptr @x, align 4, !tbaa !5
  %112 = load i32, ptr @y, align 4, !tbaa !5
  %113 = mul nsw i32 %112, %111
  %114 = icmp slt i32 %110, %113
  br i1 %114, label %115, label %117

115:                                              ; preds = %101
  %116 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.thread

117:                                              ; preds = %101
  %118 = load i32, ptr @cnt, align 4, !tbaa !5
  %119 = sub nsw i32 %118, %113
  store i32 %119, ptr @cnt, align 4, !tbaa !5
  %120 = icmp eq i32 %118, %113
  br i1 %120, label %121, label %123

121:                                              ; preds = %117
  %122 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %113)
  br label %.thread

123:                                              ; preds = %117
  %124 = add nsw i32 %111, %102
  %125 = add nsw i32 %124, -1
  %126 = add nsw i32 %112, %103
  %127 = add nsw i32 %126, -1
  %128 = sext i32 %125 to i64
  %129 = sext i32 %126 to i64
  %130 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %128, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %.not92 = icmp eq i32 %131, 0
  br i1 %.not92, label %133, label %132

132:                                              ; preds = %123
  tail call void @_Z2goiii(i32 noundef %125, i32 noundef %126, i32 noundef 1)
  br label %133

133:                                              ; preds = %132, %123
  %134 = sext i32 %124 to i64
  %135 = sext i32 %127 to i64
  %136 = getelementptr inbounds [1002 x [1002 x i32]], ptr @g, i64 0, i64 %134, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %.not93 = icmp eq i32 %137, 0
  br i1 %.not93, label %141, label %138

138:                                              ; preds = %133
  tail call void @_Z2goiii(i32 noundef %124, i32 noundef %127, i32 noundef 2)
  %139 = load i32, ptr @cnt, align 4, !tbaa !5
  %140 = icmp eq i32 %139, 0
  br i1 %140, label %143, label %148

141:                                              ; preds = %133
  %142 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.thread

143:                                              ; preds = %138
  %144 = load i32, ptr @x, align 4, !tbaa !5
  %145 = load i32, ptr @y, align 4, !tbaa !5
  %146 = mul nsw i32 %145, %144
  %147 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %146)
  br label %.thread

148:                                              ; preds = %138
  %149 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.thread

150:                                              ; preds = %98
  %indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1
  %exitcond188.not = icmp eq i64 %indvars.iv.next185, %wide.trip.count187
  br i1 %exitcond188.not, label %._crit_edge142, label %98, !llvm.loop !23

._crit_edge142:                                   ; preds = %150
  %indvars.iv.next190 = add nuw nsw i64 %indvars.iv189, 1
  %exitcond193.not = icmp eq i64 %indvars.iv.next190, %wide.trip.count192
  br i1 %exitcond193.not, label %.thread, label %.preheader, !llvm.loop !24

.thread:                                          ; preds = %._crit_edge142, %.preheader.lr.ph, %._crit_edge138, %115, %121, %141, %148, %143
  ret i32 0
}

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

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

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

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

; 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 #1 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #7

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

!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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11, !13, !12}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !11}
!24 = distinct !{!24, !11}


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