; LLVM IR from kazunetakahashi/atcoder :: 2017/0826_AGC019 (F)

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

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

@inv = external dso_local global [1000010 x i64], align 16
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@S = external dso_local global [500010 x i64], align 16
@T = external dso_local global [500010 x i64], align 16
@U = external dso_local global [500010 x i64], align 16
@K = external dso_local global [500010 x i64], align 16
@R = external dso_local global [500010 x i64], align 16
@L = external dso_local global [500010 x i64], align 16
@bunbo = external dso_local global [500010 x i64], align 16
@bunshi = external dso_local global [500010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() #0

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @_Z4initv()
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %11 = load i64, ptr @N, align 8, !tbaa !5
  %12 = load i64, ptr @M, align 8, !tbaa !5
  %13 = icmp sgt i64 %11, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %0
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) @N, ptr noundef nonnull align 8 dereferenceable(8) @M) #7
  br label %15

15:                                               ; preds = %14, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %35, %15
  %17 = load i64, ptr %2, align 8, !tbaa !5
  %18 = load i64, ptr @N, align 8, !tbaa !5
  %19 = load i64, ptr @M, align 8, !tbaa !5
  %20 = add nsw i64 %18, %19
  %21 = icmp sle i64 %17, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %38

23:                                               ; preds = %16
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %25 = load i64, ptr %24, align 8, !tbaa !5
  %26 = load i64, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %26
  store i64 %25, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %28 = load i64, ptr %2, align 8, !tbaa !5
  %29 = load i64, ptr @M, align 8, !tbaa !5
  %30 = sub nsw i64 %28, %29
  store i64 %30, ptr %4, align 8, !tbaa !5
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = load i64, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds [500010 x i64], ptr @L, i64 0, i64 %33
  store i64 %32, ptr %34, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %35

35:                                               ; preds = %23
  %36 = load i64, ptr %2, align 8, !tbaa !5
  %37 = add nsw i64 %36, 1
  store i64 %37, ptr %2, align 8, !tbaa !5
  br label %16, !llvm.loop !9

38:                                               ; preds = %22
  store i64 2, ptr getelementptr inbounds ([500010 x i64], ptr @S, i64 0, i64 1), align 8, !tbaa !5
  store i64 2, ptr getelementptr inbounds ([500010 x i64], ptr @T, i64 0, i64 1), align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 1, ptr %5, align 4, !tbaa !11
  br label %39

39:                                               ; preds = %248, %38
  %40 = load i32, ptr %5, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = load i64, ptr @N, align 8, !tbaa !5
  %43 = load i64, ptr @M, align 8, !tbaa !5
  %44 = add nsw i64 %42, %43
  %45 = icmp slt i64 %41, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %251

47:                                               ; preds = %39
  %48 = load i32, ptr %5, align 4, !tbaa !11
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !5
  %52 = mul nsw i64 2, %51
  %53 = load i32, ptr %5, align 4, !tbaa !11
  %54 = add nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %55
  store i64 %52, ptr %56, align 8, !tbaa !5
  %57 = load i32, ptr %5, align 4, !tbaa !11
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !11
  %62 = sext i32 %61 to i64
  %63 = load i64, ptr @M, align 8, !tbaa !5
  %64 = sub nsw i64 %62, %63
  %65 = icmp eq i64 %60, %64
  br i1 %65, label %66, label %81

66:                                               ; preds = %47
  %67 = load i32, ptr %5, align 4, !tbaa !11
  %68 = load i32, ptr %5, align 4, !tbaa !11
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !5
  %72 = add nsw i64 %71, 1
  %73 = trunc i64 %72 to i32
  %74 = call noundef i64 @_Z1Cii(i32 noundef %67, i32 noundef %73)
  %75 = load i32, ptr %5, align 4, !tbaa !11
  %76 = add nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !5
  %80 = add nsw i64 %79, %74
  store i64 %80, ptr %78, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %66, %47
  %82 = load i32, ptr %5, align 4, !tbaa !11
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [500010 x i64], ptr @L, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !5
  %86 = load i32, ptr %5, align 4, !tbaa !11
  %87 = sext i32 %86 to i64
  %88 = load i64, ptr @M, align 8, !tbaa !5
  %89 = sub nsw i64 %87, %88
  %90 = icmp eq i64 %85, %89
  br i1 %90, label %91, label %108

91:                                               ; preds = %81
  %92 = load i32, ptr %5, align 4, !tbaa !11
  %93 = add nsw i32 %92, 1
  %94 = load i32, ptr %5, align 4, !tbaa !11
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [500010 x i64], ptr @L, i64 0, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !5
  %98 = sub nsw i64 %97, 1
  %99 = trunc i64 %98 to i32
  %100 = call noundef i64 @_Z1Cii(i32 noundef %93, i32 noundef %99)
  %101 = sub nsw i64 998244353, %100
  %102 = load i32, ptr %5, align 4, !tbaa !11
  %103 = add nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !5
  %107 = add nsw i64 %106, %101
  store i64 %107, ptr %105, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %91, %81
  %109 = load i32, ptr %5, align 4, !tbaa !11
  %110 = add nsw i32 %109, 1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !5
  %114 = srem i64 %113, 998244353
  store i64 %114, ptr %112, align 8, !tbaa !5
  %115 = load i32, ptr %5, align 4, !tbaa !11
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !5
  %119 = load i32, ptr %5, align 4, !tbaa !11
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [500010 x i64], ptr @K, i64 0, i64 %120
  store i64 %118, ptr %121, align 8, !tbaa !5
  %122 = load i32, ptr %5, align 4, !tbaa !11
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !5
  %126 = load i64, ptr @N, align 8, !tbaa !5
  %127 = icmp eq i64 %125, %126
  br i1 %127, label %128, label %155

128:                                              ; preds = %108
  %129 = load i32, ptr %5, align 4, !tbaa !11
  %130 = load i32, ptr %5, align 4, !tbaa !11
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !5
  %134 = load i32, ptr %5, align 4, !tbaa !11
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %137 = load i32, ptr %5, align 4, !tbaa !11
  %138 = sext i32 %137 to i64
  %139 = load i32, ptr %5, align 4, !tbaa !11
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !5
  %143 = sub nsw i64 %138, %142
  store i64 %143, ptr %6, align 8, !tbaa !5
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %136, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %145 = load i64, ptr %144, align 8, !tbaa !5
  %146 = mul nsw i64 %133, %145
  %147 = trunc i64 %146 to i32
  %148 = call noundef i64 @_Z1Cii(i32 noundef %129, i32 noundef %147)
  %149 = sub nsw i64 998244353, %148
  %150 = load i32, ptr %5, align 4, !tbaa !11
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [500010 x i64], ptr @K, i64 0, i64 %151
  %153 = load i64, ptr %152, align 8, !tbaa !5
  %154 = add nsw i64 %153, %149
  store i64 %154, ptr %152, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %155

155:                                              ; preds = %128, %108
  %156 = load i32, ptr %5, align 4, !tbaa !11
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [500010 x i64], ptr @K, i64 0, i64 %157
  %159 = load i64, ptr %158, align 8, !tbaa !5
  %160 = mul nsw i64 2, %159
  %161 = add nsw i64 %160, 998244353
  %162 = load i32, ptr %5, align 4, !tbaa !11
  %163 = load i32, ptr %5, align 4, !tbaa !11
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [500010 x i64], ptr @L, i64 0, i64 %164
  %166 = load i64, ptr %165, align 8, !tbaa !5
  %167 = trunc i64 %166 to i32
  %168 = call noundef i64 @_Z1Cii(i32 noundef %162, i32 noundef %167)
  %169 = load i32, ptr %5, align 4, !tbaa !11
  %170 = add nsw i32 %169, 1
  %171 = sext i32 %170 to i64
  %172 = mul nsw i64 %168, %171
  %173 = sub nsw i64 %161, %172
  %174 = load i32, ptr %5, align 4, !tbaa !11
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %175
  %177 = load i64, ptr %176, align 8, !tbaa !5
  %178 = add nsw i64 %173, %177
  %179 = load i32, ptr %5, align 4, !tbaa !11
  %180 = add nsw i32 %179, 1
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [500010 x i64], ptr @U, i64 0, i64 %181
  store i64 %178, ptr %182, align 8, !tbaa !5
  %183 = load i32, ptr %5, align 4, !tbaa !11
  %184 = add nsw i32 %183, 1
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [500010 x i64], ptr @U, i64 0, i64 %185
  %187 = load i64, ptr %186, align 8, !tbaa !5
  %188 = load i32, ptr %5, align 4, !tbaa !11
  %189 = add nsw i32 %188, 1
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %190
  store i64 %187, ptr %191, align 8, !tbaa !5
  %192 = load i32, ptr %5, align 4, !tbaa !11
  %193 = add nsw i32 %192, 1
  %194 = srem i32 %193, 2
  %195 = icmp eq i32 %194, 0
  br i1 %195, label %196, label %218

196:                                              ; preds = %155
  %197 = load i32, ptr %5, align 4, !tbaa !11
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [500010 x i64], ptr @L, i64 0, i64 %198
  %200 = load i64, ptr %199, align 8, !tbaa !5
  %201 = load i32, ptr %5, align 4, !tbaa !11
  %202 = sext i32 %201 to i64
  %203 = load i64, ptr @M, align 8, !tbaa !5
  %204 = sub nsw i64 %202, %203
  %205 = icmp eq i64 %200, %204
  br i1 %205, label %206, label %218

206:                                              ; preds = %196
  %207 = load i32, ptr %5, align 4, !tbaa !11
  %208 = add nsw i32 %207, 1
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %209
  %211 = load i64, ptr %210, align 8, !tbaa !5
  %212 = load i32, ptr %5, align 4, !tbaa !11
  %213 = add nsw i32 %212, 1
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %214
  %216 = load i64, ptr %215, align 8, !tbaa !5
  %217 = add nsw i64 %216, %211
  store i64 %217, ptr %215, align 8, !tbaa !5
  br label %218

218:                                              ; preds = %206, %196, %155
  %219 = load i32, ptr %5, align 4, !tbaa !11
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %220
  %222 = load i64, ptr %221, align 8, !tbaa !5
  %223 = load i64, ptr @N, align 8, !tbaa !5
  %224 = icmp eq i64 %222, %223
  br i1 %224, label %225, label %241

225:                                              ; preds = %218
  %226 = load i32, ptr %5, align 4, !tbaa !11
  %227 = add nsw i32 %226, 1
  %228 = load i32, ptr %5, align 4, !tbaa !11
  %229 = add nsw i32 %228, 1
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %230
  %232 = load i64, ptr %231, align 8, !tbaa !5
  %233 = trunc i64 %232 to i32
  %234 = call noundef i64 @_Z1Cii(i32 noundef %227, i32 noundef %233)
  %235 = load i32, ptr %5, align 4, !tbaa !11
  %236 = add nsw i32 %235, 1
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %237
  %239 = load i64, ptr %238, align 8, !tbaa !5
  %240 = add nsw i64 %239, %234
  store i64 %240, ptr %238, align 8, !tbaa !5
  br label %241

241:                                              ; preds = %225, %218
  %242 = load i32, ptr %5, align 4, !tbaa !11
  %243 = add nsw i32 %242, 1
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %244
  %246 = load i64, ptr %245, align 8, !tbaa !5
  %247 = srem i64 %246, 998244353
  store i64 %247, ptr %245, align 8, !tbaa !5
  br label %248

248:                                              ; preds = %241
  %249 = load i32, ptr %5, align 4, !tbaa !11
  %250 = add nsw i32 %249, 1
  store i32 %250, ptr %5, align 4, !tbaa !11
  br label %39, !llvm.loop !13

251:                                              ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !11
  br label %252

252:                                              ; preds = %310, %251
  %253 = load i32, ptr %8, align 4, !tbaa !11
  %254 = sext i32 %253 to i64
  %255 = load i64, ptr @N, align 8, !tbaa !5
  %256 = load i64, ptr @M, align 8, !tbaa !5
  %257 = add nsw i64 %255, %256
  %258 = icmp sle i64 %254, %257
  br i1 %258, label %260, label %259

259:                                              ; preds = %252
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %313

260:                                              ; preds = %252
  %261 = load i32, ptr %8, align 4, !tbaa !11
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %262
  %264 = load i64, ptr %263, align 8, !tbaa !5
  %265 = load i32, ptr %8, align 4, !tbaa !11
  %266 = sext i32 %265 to i64
  %267 = mul nsw i64 %264, %266
  %268 = srem i64 %267, 998244353
  %269 = load i32, ptr %8, align 4, !tbaa !11
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [500010 x i64], ptr @bunbo, i64 0, i64 %270
  store i64 %268, ptr %271, align 8, !tbaa !5
  %272 = load i32, ptr %8, align 4, !tbaa !11
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %273
  %275 = load i64, ptr %274, align 8, !tbaa !5
  %276 = load i32, ptr %8, align 4, !tbaa !11
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds [500010 x i64], ptr @bunshi, i64 0, i64 %277
  store i64 %275, ptr %278, align 8, !tbaa !5
  %279 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str)
  %280 = load i32, ptr %8, align 4, !tbaa !11
  %281 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %279, i32 noundef %280)
  %282 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %281, ptr noundef @.str.1)
  %283 = load i32, ptr %8, align 4, !tbaa !11
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [500010 x i64], ptr @bunshi, i64 0, i64 %284
  %286 = load i64, ptr %285, align 8, !tbaa !5
  %287 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %282, i64 noundef %286)
  %288 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %287, ptr noundef @.str.2)
  %289 = load i32, ptr %8, align 4, !tbaa !11
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [500010 x i64], ptr @bunbo, i64 0, i64 %290
  %292 = load i64, ptr %291, align 8, !tbaa !5
  %293 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %288, i64 noundef %292)
  %294 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %293, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %295 = load i32, ptr %8, align 4, !tbaa !11
  %296 = sext i32 %295 to i64
  %297 = getelementptr inbounds [500010 x i64], ptr @bunshi, i64 0, i64 %296
  %298 = load i64, ptr %297, align 8, !tbaa !5
  %299 = load i32, ptr %8, align 4, !tbaa !11
  %300 = sext i32 %299 to i64
  %301 = getelementptr inbounds [500010 x i64], ptr @bunbo, i64 0, i64 %300
  %302 = load i64, ptr %301, align 8, !tbaa !5
  %303 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %302
  %304 = load i64, ptr %303, align 8, !tbaa !5
  %305 = mul nsw i64 %298, %304
  %306 = load i64, ptr %7, align 8, !tbaa !5
  %307 = add nsw i64 %306, %305
  store i64 %307, ptr %7, align 8, !tbaa !5
  %308 = load i64, ptr %7, align 8, !tbaa !5
  %309 = srem i64 %308, 998244353
  store i64 %309, ptr %7, align 8, !tbaa !5
  br label %310

310:                                              ; preds = %260
  %311 = load i32, ptr %8, align 4, !tbaa !11
  %312 = add nsw i32 %311, 1
  store i32 %312, ptr %8, align 4, !tbaa !11
  br label %252, !llvm.loop !14

313:                                              ; preds = %259
  %314 = load i64, ptr %7, align 8, !tbaa !5
  %315 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %314)
  %316 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %315, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %317 = load i32, ptr %1, align 4
  ret i32 %317
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #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) #5

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

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

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

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

attributes #0 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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

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

@inv = external dso_local local_unnamed_addr global [1000010 x i64], align 16
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@S = external dso_local local_unnamed_addr global [500010 x i64], align 16
@T = external dso_local local_unnamed_addr global [500010 x i64], align 16
@U = external dso_local local_unnamed_addr global [500010 x i64], align 16
@K = external dso_local local_unnamed_addr global [500010 x i64], align 16
@R = external dso_local global [500010 x i64], align 16
@L = external dso_local local_unnamed_addr global [500010 x i64], align 16
@bunbo = external dso_local local_unnamed_addr global [500010 x i64], align 16
@bunshi = external dso_local local_unnamed_addr global [500010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  tail call void @_Z4initv()
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %6 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %7 = load i64, ptr @N, align 8, !tbaa !5
  %8 = load i64, ptr @M, align 8, !tbaa !5
  %9 = icmp sgt i64 %7, %8
  br i1 %9, label %10, label %11

10:                                               ; preds = %0
  tail call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) @N, ptr noundef nonnull align 8 dereferenceable(8) @M) #7
  %.pre = load i64, ptr @N, align 8, !tbaa !5
  %.pre84 = load i64, ptr @M, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %10, %0
  %12 = phi i64 [ %.pre84, %10 ], [ %8, %0 ]
  %13 = phi i64 [ %.pre, %10 ], [ %7, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  store i64 0, ptr %1, align 8, !tbaa !5
  %14 = add nsw i64 %12, %13
  %.not70 = icmp slt i64 %14, 0
  br i1 %.not70, label %.preheader.thread, label %.lr.ph

.preheader.thread:                                ; preds = %11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  store i64 2, ptr getelementptr inbounds (i8, ptr @S, i64 8), align 8, !tbaa !5
  store i64 2, ptr getelementptr inbounds (i8, ptr @T, i64 8), align 8, !tbaa !5
  br label %._crit_edge78

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  store i64 2, ptr getelementptr inbounds (i8, ptr @S, i64 8), align 8, !tbaa !5
  store i64 2, ptr getelementptr inbounds (i8, ptr @T, i64 8), align 8, !tbaa !5
  %15 = icmp sgt i64 %29, 1
  br i1 %15, label %.lr.ph73, label %.preheader

.lr.ph:                                           ; preds = %11, %.lr.ph
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %17 = load i64, ptr %16, align 8, !tbaa !5
  %18 = load i64, ptr %1, align 8, !tbaa !5
  %19 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %18
  store i64 %17, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  store i64 0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %20 = load i64, ptr @M, align 8, !tbaa !5
  %21 = sub nsw i64 %18, %20
  store i64 %21, ptr %3, align 8, !tbaa !5
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %23 = load i64, ptr %22, align 8, !tbaa !5
  %24 = load i64, ptr %1, align 8, !tbaa !5
  %25 = getelementptr inbounds [500010 x i64], ptr @L, i64 0, i64 %24
  store i64 %23, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %26 = add nsw i64 %24, 1
  store i64 %26, ptr %1, align 8, !tbaa !5
  %27 = load i64, ptr @N, align 8, !tbaa !5
  %28 = load i64, ptr @M, align 8, !tbaa !5
  %29 = add nsw i64 %28, %27
  %.not.not = icmp slt i64 %24, %29
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader:                                       ; preds = %112, %._crit_edge
  %.pre-phi89 = phi i64 [ %29, %._crit_edge ], [ %117, %112 ]
  %.not6574 = icmp slt i64 %.pre-phi89, 1
  br i1 %.not6574, label %._crit_edge78, label %.lr.ph77

.lr.ph73:                                         ; preds = %._crit_edge, %112
  %indvars.iv = phi i64 [ %indvars.iv.next, %112 ], [ 1, %._crit_edge ]
  %30 = phi i64 [ %116, %112 ], [ %28, %._crit_edge ]
  %31 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %indvars.iv
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = shl nsw i64 %32, 1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %indvars.iv.next
  store i64 %33, ptr %34, align 8, !tbaa !5
  %35 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %indvars.iv
  %36 = load i64, ptr %35, align 8, !tbaa !5
  %37 = sub nsw i64 %indvars.iv, %30
  %38 = icmp eq i64 %36, %37
  br i1 %38, label %39, label %46

39:                                               ; preds = %.lr.ph73
  %40 = trunc i64 %36 to i32
  %41 = add i32 %40, 1
  %42 = trunc nuw nsw i64 %indvars.iv to i32
  %43 = call noundef i64 @_Z1Cii(i32 noundef %42, i32 noundef %41)
  %44 = load i64, ptr %34, align 8, !tbaa !5
  %45 = add nsw i64 %44, %43
  store i64 %45, ptr %34, align 8, !tbaa !5
  %.pre85 = load i64, ptr @M, align 8, !tbaa !5
  %.pre87 = sub nsw i64 %indvars.iv, %.pre85
  br label %46

46:                                               ; preds = %39, %.lr.ph73
  %.pre-phi88 = phi i64 [ %.pre87, %39 ], [ %37, %.lr.ph73 ]
  %47 = phi i64 [ %45, %39 ], [ %33, %.lr.ph73 ]
  %48 = getelementptr inbounds [500010 x i64], ptr @L, i64 0, i64 %indvars.iv
  %49 = load i64, ptr %48, align 8, !tbaa !5
  %50 = icmp eq i64 %49, %.pre-phi88
  br i1 %50, label %51, label %58

51:                                               ; preds = %46
  %52 = trunc i64 %49 to i32
  %53 = add i32 %52, -1
  %54 = trunc nuw nsw i64 %indvars.iv.next to i32
  %55 = call noundef i64 @_Z1Cii(i32 noundef %54, i32 noundef %53)
  %56 = load i64, ptr %34, align 8, !tbaa !5
  %reass.sub79 = sub i64 %56, %55
  %57 = add i64 %reass.sub79, 998244353
  br label %58

58:                                               ; preds = %51, %46
  %59 = phi i64 [ %57, %51 ], [ %47, %46 ]
  %60 = srem i64 %59, 998244353
  store i64 %60, ptr %34, align 8, !tbaa !5
  %61 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %indvars.iv
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = getelementptr inbounds [500010 x i64], ptr @K, i64 0, i64 %indvars.iv
  store i64 %62, ptr %63, align 8, !tbaa !5
  %64 = load i64, ptr %35, align 8, !tbaa !5
  %65 = load i64, ptr @N, align 8, !tbaa !5
  %66 = icmp eq i64 %64, %65
  br i1 %66, label %67, label %._crit_edge90

._crit_edge90:                                    ; preds = %58
  %.pre91 = trunc nuw nsw i64 %indvars.iv to i32
  br label %77

67:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %68 = sub nsw i64 %indvars.iv, %64
  store i64 %68, ptr %4, align 8, !tbaa !5
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = mul nsw i64 %70, %64
  %72 = trunc i64 %71 to i32
  %73 = trunc nuw nsw i64 %indvars.iv to i32
  %74 = call noundef i64 @_Z1Cii(i32 noundef %73, i32 noundef %72)
  %75 = load i64, ptr %63, align 8, !tbaa !5
  %reass.sub = sub i64 %75, %74
  %76 = add i64 %reass.sub, 998244353
  store i64 %76, ptr %63, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %77

77:                                               ; preds = %._crit_edge90, %67
  %.pre-phi92 = phi i32 [ %.pre91, %._crit_edge90 ], [ %73, %67 ]
  %78 = phi i64 [ %62, %._crit_edge90 ], [ %76, %67 ]
  %79 = shl nsw i64 %78, 1
  %80 = add nsw i64 %79, 998244353
  %81 = load i64, ptr %48, align 8, !tbaa !5
  %82 = trunc i64 %81 to i32
  %83 = call noundef i64 @_Z1Cii(i32 noundef %.pre-phi92, i32 noundef %82)
  %84 = mul nsw i64 %83, %indvars.iv.next
  %85 = load i64, ptr %31, align 8, !tbaa !5
  %86 = add i64 %80, %85
  %87 = sub i64 %86, %84
  %88 = getelementptr inbounds [500010 x i64], ptr @U, i64 0, i64 %indvars.iv.next
  store i64 %87, ptr %88, align 8, !tbaa !5
  %89 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %indvars.iv.next
  store i64 %87, ptr %89, align 8, !tbaa !5
  %90 = and i32 %.pre-phi92, 1
  %.not67 = icmp eq i32 %90, 0
  br i1 %.not67, label %99, label %91

91:                                               ; preds = %77
  %92 = load i64, ptr %48, align 8, !tbaa !5
  %93 = load i64, ptr @M, align 8, !tbaa !5
  %94 = sub nsw i64 %indvars.iv, %93
  %95 = icmp eq i64 %92, %94
  br i1 %95, label %96, label %99

96:                                               ; preds = %91
  %97 = load i64, ptr %34, align 8, !tbaa !5
  %98 = add nsw i64 %97, %87
  store i64 %98, ptr %89, align 8, !tbaa !5
  br label %99

99:                                               ; preds = %96, %91, %77
  %100 = phi i64 [ %98, %96 ], [ %87, %91 ], [ %87, %77 ]
  %101 = load i64, ptr %35, align 8, !tbaa !5
  %102 = load i64, ptr @N, align 8, !tbaa !5
  %103 = icmp eq i64 %101, %102
  br i1 %103, label %104, label %112

104:                                              ; preds = %99
  %105 = getelementptr inbounds [500010 x i64], ptr @R, i64 0, i64 %indvars.iv.next
  %106 = load i64, ptr %105, align 8, !tbaa !5
  %107 = trunc i64 %106 to i32
  %108 = trunc nuw nsw i64 %indvars.iv.next to i32
  %109 = call noundef i64 @_Z1Cii(i32 noundef %108, i32 noundef %107)
  %110 = load i64, ptr %89, align 8, !tbaa !5
  %111 = add nsw i64 %110, %109
  %.pre86 = load i64, ptr @N, align 8, !tbaa !5
  br label %112

112:                                              ; preds = %104, %99
  %113 = phi i64 [ %.pre86, %104 ], [ %102, %99 ]
  %114 = phi i64 [ %111, %104 ], [ %100, %99 ]
  %115 = srem i64 %114, 998244353
  store i64 %115, ptr %89, align 8, !tbaa !5
  %116 = load i64, ptr @M, align 8, !tbaa !5
  %117 = add nsw i64 %116, %113
  %118 = icmp sgt i64 %117, %indvars.iv.next
  br i1 %118, label %.lr.ph73, label %.preheader, !llvm.loop !11

._crit_edge78:                                    ; preds = %.lr.ph77, %.preheader.thread, %.preheader
  %.058.lcssa = phi i64 [ 0, %.preheader ], [ 0, %.preheader.thread ], [ %145, %.lr.ph77 ]
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.058.lcssa)
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %119, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph77:                                         ; preds = %.preheader, %.lr.ph77
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.lr.ph77 ], [ 1, %.preheader ]
  %.05875 = phi i64 [ %145, %.lr.ph77 ], [ 0, %.preheader ]
  %121 = getelementptr inbounds [500010 x i64], ptr @S, i64 0, i64 %indvars.iv81
  %122 = load i64, ptr %121, align 8, !tbaa !5
  %123 = mul nsw i64 %122, %indvars.iv81
  %124 = srem i64 %123, 998244353
  %125 = getelementptr inbounds [500010 x i64], ptr @bunbo, i64 0, i64 %indvars.iv81
  store i64 %124, ptr %125, align 8, !tbaa !5
  %126 = getelementptr inbounds [500010 x i64], ptr @T, i64 0, i64 %indvars.iv81
  %127 = load i64, ptr %126, align 8, !tbaa !5
  %128 = getelementptr inbounds [500010 x i64], ptr @bunshi, i64 0, i64 %indvars.iv81
  store i64 %127, ptr %128, align 8, !tbaa !5
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str)
  %130 = trunc nuw nsw i64 %indvars.iv81 to i32
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %129, i32 noundef %130)
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %131, ptr noundef nonnull @.str.1)
  %133 = load i64, ptr %128, align 8, !tbaa !5
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %132, i64 noundef %133)
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %134, ptr noundef nonnull @.str.2)
  %136 = load i64, ptr %125, align 8, !tbaa !5
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %135, i64 noundef %136)
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %137, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %139 = load i64, ptr %128, align 8, !tbaa !5
  %140 = load i64, ptr %125, align 8, !tbaa !5
  %141 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !5
  %143 = mul nsw i64 %142, %139
  %144 = add nsw i64 %143, %.05875
  %145 = srem i64 %144, 998244353
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %146 = load i64, ptr @N, align 8, !tbaa !5
  %147 = load i64, ptr @M, align 8, !tbaa !5
  %148 = add nsw i64 %147, %146
  %.not65.not = icmp sgt i64 %148, %indvars.iv81
  br i1 %.not65.not, label %.lr.ph77, label %._crit_edge78, !llvm.loop !12
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #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 @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

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

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

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


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