; LLVM IR from tangjz/acm-icpc :: hdu (6175)

; 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"

@f = external dso_local global [5 x [100001 x i32]], align 16
@g = external dso_local global [2 x [5 x [100001 x i32]]], align 16
@cur = external dso_local global i32, align 4
@pre = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #0

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

13:                                               ; preds = %19, %0
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = mul nsw i32 %14, %15
  %17 = icmp slt i32 %16, 200002
  br i1 %17, label %18, label %22

18:                                               ; preds = %13
  br label %19

19:                                               ; preds = %18
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %4, align 4, !tbaa !5
  br label %13, !llvm.loop !9

22:                                               ; preds = %13
  %23 = load i32, ptr @cur, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %24
  %26 = getelementptr inbounds [5 x [100001 x i32]], ptr %25, i64 0, i64 0
  %27 = getelementptr inbounds [100001 x i32], ptr %26, i64 0, i64 0
  store i32 1, ptr %27, align 4, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %160, %22
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = mul nsw i32 %29, %30
  %32 = icmp slt i32 %31, 100001
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %28
  %35 = load i32, ptr @pre, align 4, !tbaa !5
  %36 = xor i32 %35, 1
  store i32 %36, ptr @pre, align 4, !tbaa !5
  %37 = load i32, ptr @cur, align 4, !tbaa !5
  %38 = xor i32 %37, 1
  store i32 %38, ptr @cur, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %156, %34
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = icmp slt i32 %40, 4
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %159

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

44:                                               ; preds = %152, %43
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = icmp slt i32 %45, 100001
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %155

48:                                               ; preds = %44
  %49 = load i32, ptr @cur, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %50
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [5 x [100001 x i32]], ptr %51, i64 0, i64 %53
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100001 x i32], ptr %54, i64 0, i64 %56
  store i32 0, ptr %57, align 4, !tbaa !5
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = icmp sge i32 %58, %59
  br i1 %60, label %61, label %83

61:                                               ; preds = %48
  %62 = load i32, ptr @cur, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %63
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [5 x [100001 x i32]], ptr %64, i64 0, i64 %66
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x i32], ptr %67, i64 0, i64 %69
  %71 = load i32, ptr @cur, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %72
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [5 x [100001 x i32]], ptr %73, i64 0, i64 %75
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = sub nsw i32 %77, %78
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100001 x i32], ptr %76, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %70, i32 noundef %82)
  br label %83

83:                                               ; preds = %61, %48
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = icmp sge i32 %84, %85
  br i1 %86, label %87, label %135

87:                                               ; preds = %83
  %88 = load i32, ptr @cur, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %89
  %91 = load i32, ptr %7, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [5 x [100001 x i32]], ptr %90, i64 0, i64 %92
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100001 x i32], ptr %93, i64 0, i64 %95
  %97 = load i32, ptr @pre, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %98
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [5 x [100001 x i32]], ptr %99, i64 0, i64 %101
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = sub nsw i32 %103, %104
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [100001 x i32], ptr %102, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %96, i32 noundef %108)
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %134

111:                                              ; preds = %87
  %112 = load i32, ptr @cur, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %113
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [5 x [100001 x i32]], ptr %114, i64 0, i64 %116
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100001 x i32], ptr %117, i64 0, i64 %119
  %121 = load i32, ptr @pre, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %122
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = sub nsw i32 %124, 1
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [5 x [100001 x i32]], ptr %123, i64 0, i64 %126
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = sub nsw i32 %128, %129
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [100001 x i32], ptr %127, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %120, i32 noundef %133)
  br label %134

134:                                              ; preds = %111, %87
  br label %135

135:                                              ; preds = %134, %83
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 %137
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x i32], ptr %138, i64 0, i64 %140
  %142 = load i32, ptr @cur, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %143
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [5 x [100001 x i32]], ptr %144, i64 0, i64 %146
  %148 = load i32, ptr %8, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100001 x i32], ptr %147, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %141, i32 noundef %151)
  br label %152

152:                                              ; preds = %135
  %153 = load i32, ptr %8, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %8, align 4, !tbaa !5
  br label %44, !llvm.loop !11

155:                                              ; preds = %47
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %7, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %7, align 4, !tbaa !5
  br label %39, !llvm.loop !12

159:                                              ; preds = %42
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %5, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %5, align 4, !tbaa !5
  br label %28, !llvm.loop !13

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

164:                                              ; preds = %224, %163
  %165 = load i32, ptr %9, align 4, !tbaa !5
  %166 = load i32, ptr %4, align 4, !tbaa !5
  %167 = icmp slt i32 %165, %166
  br i1 %167, label %169, label %168

168:                                              ; preds = %164
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %227

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

170:                                              ; preds = %220, %169
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = icmp slt i32 %171, 4
  br i1 %172, label %174, label %173

173:                                              ; preds = %170
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %223

174:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %175 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %175, ptr %11, align 4, !tbaa !5
  br label %176

176:                                              ; preds = %216, %174
  %177 = load i32, ptr %11, align 4, !tbaa !5
  %178 = icmp slt i32 %177, 100001
  br i1 %178, label %180, label %179

179:                                              ; preds = %176
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %219

180:                                              ; preds = %176
  %181 = load i32, ptr %10, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 %182
  %184 = load i32, ptr %11, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [100001 x i32], ptr %183, i64 0, i64 %185
  %187 = load i32, ptr %10, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 %188
  %190 = load i32, ptr %11, align 4, !tbaa !5
  %191 = load i32, ptr %9, align 4, !tbaa !5
  %192 = sub nsw i32 %190, %191
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [100001 x i32], ptr %189, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %186, i32 noundef %195)
  %196 = load i32, ptr %10, align 4, !tbaa !5
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %198, label %215

198:                                              ; preds = %180
  %199 = load i32, ptr %10, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 %200
  %202 = load i32, ptr %11, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [100001 x i32], ptr %201, i64 0, i64 %203
  %205 = load i32, ptr %10, align 4, !tbaa !5
  %206 = sub nsw i32 %205, 1
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 %207
  %209 = load i32, ptr %11, align 4, !tbaa !5
  %210 = load i32, ptr %9, align 4, !tbaa !5
  %211 = sub nsw i32 %209, %210
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [100001 x i32], ptr %208, i64 0, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %204, i32 noundef %214)
  br label %215

215:                                              ; preds = %198, %180
  br label %216

216:                                              ; preds = %215
  %217 = load i32, ptr %11, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %11, align 4, !tbaa !5
  br label %176, !llvm.loop !14

219:                                              ; preds = %179
  br label %220

220:                                              ; preds = %219
  %221 = load i32, ptr %10, align 4, !tbaa !5
  %222 = add nsw i32 %221, 1
  store i32 %222, ptr %10, align 4, !tbaa !5
  br label %170, !llvm.loop !15

223:                                              ; preds = %173
  br label %224

224:                                              ; preds = %223
  %225 = load i32, ptr %9, align 4, !tbaa !5
  %226 = add nsw i32 %225, 1
  store i32 %226, ptr %9, align 4, !tbaa !5
  br label %164, !llvm.loop !16

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

228:                                              ; preds = %255, %227
  %229 = load i32, ptr %12, align 4, !tbaa !5
  %230 = icmp slt i32 %229, 100001
  br i1 %230, label %232, label %231

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

232:                                              ; preds = %228
  %233 = load i32, ptr %12, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds ([5 x [100001 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = load i32, ptr %12, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds ([5 x [100001 x i32]], ptr @f, i64 0, i64 2), i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !5
  %242 = load i32, ptr %12, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds ([5 x [100001 x i32]], ptr @f, i64 0, i64 3), i64 0, i64 %243
  %245 = load i32, ptr %244, align 4, !tbaa !5
  %246 = add nsw i32 %241, %245
  %247 = sext i32 %246 to i64
  %248 = mul nsw i64 6, %247
  %249 = add nsw i64 %237, %248
  %250 = srem i64 %249, 998244353
  %251 = trunc i64 %250 to i32
  %252 = load i32, ptr %12, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %253
  store i32 %251, ptr %254, align 4, !tbaa !5
  br label %255

255:                                              ; preds = %232
  %256 = load i32, ptr %12, align 4, !tbaa !5
  %257 = add nsw i32 %256, 1
  store i32 %257, ptr %12, align 4, !tbaa !5
  br label %228, !llvm.loop !17

258:                                              ; preds = %231
  %259 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %260

260:                                              ; preds = %264, %258
  %261 = load i32, ptr %2, align 4, !tbaa !5
  %262 = add nsw i32 %261, -1
  store i32 %262, ptr %2, align 4, !tbaa !5
  %263 = icmp ne i32 %261, 0
  br i1 %263, label %264, label %271

264:                                              ; preds = %260
  %265 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %266 = load i32, ptr %3, align 4, !tbaa !5
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %267
  %269 = load i32, ptr %268, align 4, !tbaa !5
  %270 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %269)
  br label %260, !llvm.loop !18

271:                                              ; preds = %260
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %272 = load i32, ptr %1, align 4
  ret i32 %272
}

; 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

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

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 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !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"

@f = external dso_local global [5 x [100001 x i32]], align 16
@g = external dso_local global [2 x [5 x [100001 x i32]]], align 16
@cur = external dso_local local_unnamed_addr global i32, align 4
@pre = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
.lr.ph.preheader:
  %0 = alloca i32, align 4
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %2 = load i32, ptr @cur, align 4, !tbaa !5
  %3 = sext i32 %2 to i64
  %4 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %3
  store i32 1, ptr %4, align 4, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %32
  %indvars.iv104 = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next105, %32 ]
  %5 = load i32, ptr @pre, align 4, !tbaa !5
  %6 = xor i32 %5, 1
  store i32 %6, ptr @pre, align 4, !tbaa !5
  %7 = load i32, ptr @cur, align 4, !tbaa !5
  %8 = xor i32 %7, 1
  store i32 %8, ptr @cur, align 4, !tbaa !5
  br label %.preheader76

.preheader76:                                     ; preds = %.lr.ph, %.split.us
  %indvars.iv100 = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next101, %.split.us ]
  %.not72 = icmp eq i64 %indvars.iv100, 0
  %9 = add nsw i64 %indvars.iv100, -1
  br i1 %.not72, label %.preheader76.split.us, label %.preheader76.split

.preheader76.split.us:                            ; preds = %.preheader76, %26
  %indvars.iv96 = phi i64 [ %indvars.iv.next97, %26 ], [ 0, %.preheader76 ]
  %10 = load i32, ptr @cur, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %11, i64 0, i64 %indvars.iv96
  store i32 0, ptr %12, align 4, !tbaa !5
  %.not70.us = icmp ult i64 %indvars.iv96, %indvars.iv104
  br i1 %.not70.us, label %17, label %13

13:                                               ; preds = %.preheader76.split.us
  %14 = sub nsw i64 %indvars.iv96, %indvars.iv104
  %15 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %11, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %12, i32 noundef %16)
  %.pre130.pre = load i32, ptr @cur, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %13, %.preheader76.split.us
  %.pre130 = phi i32 [ %.pre130.pre, %13 ], [ %10, %.preheader76.split.us ]
  %.not71.us = icmp ult i64 %indvars.iv96, 448
  br i1 %.not71.us, label %26, label %18

18:                                               ; preds = %17
  %19 = sext i32 %.pre130 to i64
  %20 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %19, i64 0, i64 %indvars.iv96
  %21 = load i32, ptr @pre, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = add nsw i64 %indvars.iv96, -448
  %24 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %22, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %20, i32 noundef %25)
  %.pre129 = load i32, ptr @cur, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %18, %17
  %27 = phi i32 [ %.pre129, %18 ], [ %.pre130, %17 ]
  %28 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 0, i64 %indvars.iv96
  %29 = sext i32 %27 to i64
  %30 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %29, i64 0, i64 %indvars.iv96
  %31 = load i32, ptr %30, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %28, i32 noundef %31)
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %exitcond99.not = icmp eq i64 %indvars.iv.next97, 100001
  br i1 %exitcond99.not, label %.split.us, label %.preheader76.split.us, !llvm.loop !9

32:                                               ; preds = %.split.us
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %exitcond107.not = icmp eq i64 %indvars.iv.next105, 224
  br i1 %exitcond107.not, label %.lr.ph81.split.us.us.preheader, label %.lr.ph, !llvm.loop !11

.split.us:                                        ; preds = %56, %26
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond103.not = icmp eq i64 %indvars.iv.next101, 4
  br i1 %exitcond103.not, label %32, label %.preheader76, !llvm.loop !12

.preheader76.split:                               ; preds = %.preheader76, %56
  %indvars.iv = phi i64 [ %indvars.iv.next, %56 ], [ 0, %.preheader76 ]
  %33 = load i32, ptr @cur, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %34, i64 %indvars.iv100, i64 %indvars.iv
  store i32 0, ptr %35, align 4, !tbaa !5
  %.not70 = icmp ult i64 %indvars.iv, %indvars.iv104
  br i1 %.not70, label %40, label %36

36:                                               ; preds = %.preheader76.split
  %37 = sub nsw i64 %indvars.iv, %indvars.iv104
  %38 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %34, i64 %indvars.iv100, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %35, i32 noundef %39)
  %.pre128.pre = load i32, ptr @cur, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %36, %.preheader76.split
  %.pre128 = phi i32 [ %.pre128.pre, %36 ], [ %33, %.preheader76.split ]
  %.not71 = icmp ult i64 %indvars.iv, 448
  br i1 %.not71, label %56, label %41

41:                                               ; preds = %40
  %42 = sext i32 %.pre128 to i64
  %43 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %42, i64 %indvars.iv100, i64 %indvars.iv
  %44 = load i32, ptr @pre, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = add nsw i64 %indvars.iv, -448
  %47 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %45, i64 %indvars.iv100, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %43, i32 noundef %48)
  %49 = load i32, ptr @cur, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %50, i64 %indvars.iv100, i64 %indvars.iv
  %52 = load i32, ptr @pre, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %53, i64 %9, i64 %46
  %55 = load i32, ptr %54, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %51, i32 noundef %55)
  %.pre = load i32, ptr @cur, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %41, %40
  %57 = phi i32 [ %.pre, %41 ], [ %.pre128, %40 ]
  %58 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 %indvars.iv100, i64 %indvars.iv
  %59 = sext i32 %57 to i64
  %60 = getelementptr inbounds [2 x [5 x [100001 x i32]]], ptr @g, i64 0, i64 %59, i64 %indvars.iv100, i64 %indvars.iv
  %61 = load i32, ptr %60, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %58, i32 noundef %61)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100001
  br i1 %exitcond.not, label %.split.us, label %.preheader76.split, !llvm.loop !9

.lr.ph81.split.us.us.preheader:                   ; preds = %32, %.split87.us
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %.split87.us ], [ 1, %32 ]
  br label %.lr.ph81.split.us.us

.lr.ph81.split.us85.1:                            ; preds = %.lr.ph81.split.us.us, %.lr.ph81.split.us85.1
  %indvars.iv110.1 = phi i64 [ %indvars.iv.next111.1, %.lr.ph81.split.us85.1 ], [ %indvars.iv108, %.lr.ph81.split.us.us ]
  %62 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 1, i64 %indvars.iv110.1
  %63 = sub nuw nsw i64 %indvars.iv110.1, %indvars.iv108
  %64 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 1, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %62, i32 noundef %65)
  %66 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 0, i64 %63
  %67 = load i32, ptr %66, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %62, i32 noundef %67)
  %indvars.iv.next111.1 = add nuw nsw i64 %indvars.iv110.1, 1
  %exitcond113.1.not = icmp eq i64 %indvars.iv.next111.1, 100001
  br i1 %exitcond113.1.not, label %.lr.ph81.split.us85.2, label %.lr.ph81.split.us85.1, !llvm.loop !13

.lr.ph81.split.us85.2:                            ; preds = %.lr.ph81.split.us85.1, %.lr.ph81.split.us85.2
  %indvars.iv110.2 = phi i64 [ %indvars.iv.next111.2, %.lr.ph81.split.us85.2 ], [ %indvars.iv108, %.lr.ph81.split.us85.1 ]
  %68 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 2, i64 %indvars.iv110.2
  %69 = sub nuw nsw i64 %indvars.iv110.2, %indvars.iv108
  %70 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 2, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %68, i32 noundef %71)
  %72 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 1, i64 %69
  %73 = load i32, ptr %72, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %68, i32 noundef %73)
  %indvars.iv.next111.2 = add nuw nsw i64 %indvars.iv110.2, 1
  %exitcond113.2.not = icmp eq i64 %indvars.iv.next111.2, 100001
  br i1 %exitcond113.2.not, label %.lr.ph81.split.us85.3, label %.lr.ph81.split.us85.2, !llvm.loop !13

.lr.ph81.split.us85.3:                            ; preds = %.lr.ph81.split.us85.2, %.lr.ph81.split.us85.3
  %indvars.iv110.3 = phi i64 [ %indvars.iv.next111.3, %.lr.ph81.split.us85.3 ], [ %indvars.iv108, %.lr.ph81.split.us85.2 ]
  %74 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 3, i64 %indvars.iv110.3
  %75 = sub nuw nsw i64 %indvars.iv110.3, %indvars.iv108
  %76 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 3, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %74, i32 noundef %77)
  %78 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 2, i64 %75
  %79 = load i32, ptr %78, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %74, i32 noundef %79)
  %indvars.iv.next111.3 = add nuw nsw i64 %indvars.iv110.3, 1
  %exitcond113.3.not = icmp eq i64 %indvars.iv.next111.3, 100001
  br i1 %exitcond113.3.not, label %.split87.us, label %.lr.ph81.split.us85.3, !llvm.loop !13

.lr.ph81.split.us.us:                             ; preds = %.lr.ph81.split.us.us.preheader, %.lr.ph81.split.us.us
  %indvars.iv114 = phi i64 [ %indvars.iv108, %.lr.ph81.split.us.us.preheader ], [ %indvars.iv.next115, %.lr.ph81.split.us.us ]
  %80 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 0, i64 %indvars.iv114
  %81 = sub nuw nsw i64 %indvars.iv114, %indvars.iv108
  %82 = getelementptr inbounds [5 x [100001 x i32]], ptr @f, i64 0, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %80, i32 noundef %83)
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next115, 100001
  br i1 %exitcond117.not, label %.lr.ph81.split.us85.1, label %.lr.ph81.split.us.us, !llvm.loop !13

.split87.us:                                      ; preds = %.lr.ph81.split.us85.3
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %exitcond123.not = icmp eq i64 %indvars.iv.next109, 448
  br i1 %exitcond123.not, label %.preheader, label %.lr.ph81.split.us.us.preheader, !llvm.loop !14

84:                                               ; preds = %.preheader
  %85 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %0)
  %86 = load i32, ptr %0, align 4, !tbaa !5
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr %0, align 4, !tbaa !5
  %.not90 = icmp eq i32 %86, 0
  br i1 %.not90, label %._crit_edge, label %.lr.ph91

.preheader:                                       ; preds = %.split87.us, %.preheader
  %indvars.iv124 = phi i64 [ %indvars.iv.next125, %.preheader ], [ 1, %.split87.us ]
  %88 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds (i8, ptr @f, i64 400004), i64 0, i64 %indvars.iv124
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds (i8, ptr @f, i64 800008), i64 0, i64 %indvars.iv124
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds (i8, ptr @f, i64 1200012), i64 0, i64 %indvars.iv124
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = add nsw i32 %94, %92
  %96 = sext i32 %95 to i64
  %97 = mul nsw i64 %96, 6
  %98 = add nsw i64 %97, %90
  %99 = srem i64 %98, 998244353
  %100 = trunc nsw i64 %99 to i32
  %101 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %indvars.iv124
  store i32 %100, ptr %101, align 4, !tbaa !5
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %exitcond127.not = icmp eq i64 %indvars.iv.next125, 100001
  br i1 %exitcond127.not, label %84, label %.preheader, !llvm.loop !15

.lr.ph91:                                         ; preds = %84, %.lr.ph91
  %102 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %103 = load i32, ptr %1, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %106)
  %108 = load i32, ptr %0, align 4, !tbaa !5
  %109 = add nsw i32 %108, -1
  store i32 %109, ptr %0, align 4, !tbaa !5
  %.not = icmp eq i32 %108, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph91, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph91, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #4
  ret i32 0
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 norecurse nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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