; LLVM IR from tangjz/acm-icpc :: codeforces (438E)

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

@w = external dso_local global [262145 x i32], align 16
@inv2 = external dso_local global [19 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@inv = external dso_local global [100001 x i32], align 16
@A = external dso_local global [262145 x i32], align 16
@B = external dso_local global [262145 x i32], 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
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7PolyInviPiS_(i32 noundef, ptr noundef, ptr noundef) #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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z3NTTiPii(i32 noundef, ptr noundef, i32 noundef) #3

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %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
  store i32 1, ptr @w, align 16, !tbaa !5
  %13 = call noundef i32 @_Z7mod_powii(i32 noundef 3, i32 noundef 3808)
  store i32 %13, ptr getelementptr inbounds ([262145 x i32], ptr @w, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %33, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 262144
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %36

18:                                               ; preds = %14
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sub nsw i32 %19, 1
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [262145 x i32], ptr @w, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = load i32, ptr getelementptr inbounds ([262145 x i32], ptr @w, i64 0, i64 1), align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = mul nsw i64 %24, %26
  %28 = srem i64 %27, 998244353
  %29 = trunc i64 %28 to i32
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [262145 x i32], ptr @w, i64 0, i64 %31
  store i32 %29, ptr %32, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %18
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !9

36:                                               ; preds = %17
  store i32 1, ptr @inv2, align 16, !tbaa !5
  store i32 499122177, ptr getelementptr inbounds ([19 x i32], ptr @inv2, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 2, ptr %3, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %56, %36
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = icmp sle i32 %38, 18
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %59

41:                                               ; preds = %37
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sub nsw i32 %42, 1
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [19 x i32], ptr @inv2, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = load i32, ptr getelementptr inbounds ([19 x i32], ptr @inv2, i64 0, i64 1), align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = mul nsw i64 %47, %49
  %51 = srem i64 %50, 998244353
  %52 = trunc i64 %51 to i32
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [19 x i32], ptr @inv2, i64 0, i64 %54
  store i32 %52, ptr %55, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %41
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %3, align 4, !tbaa !5
  br label %37, !llvm.loop !11

59:                                               ; preds = %40
  %60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m, ptr noundef @n)
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr @n, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %78, %59
  %64 = load i32, ptr @m, align 4, !tbaa !5
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr @m, align 4, !tbaa !5
  %66 = icmp ne i32 %64, 0
  br i1 %66, label %67, label %79

67:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4)
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %72, label %78

72:                                               ; preds = %67
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %75, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %72, %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %63, !llvm.loop !12

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

80:                                               ; preds = %102, %79
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = load i32, ptr @n, align 4, !tbaa !5
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %85, label %84

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

85:                                               ; preds = %80
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %101

91:                                               ; preds = %85
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = shl i32 %95, 2
  %97 = sub nsw i32 998244353, %96
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %99
  store i32 %97, ptr %100, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %91, %85
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %5, align 4, !tbaa !5
  br label %80, !llvm.loop !13

105:                                              ; preds = %84
  store i32 1, ptr getelementptr inbounds ([100001 x i32], ptr @inv, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 2, ptr %6, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %128, %105
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = load i32, ptr @n, align 4, !tbaa !5
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %131

111:                                              ; preds = %106
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = sdiv i32 998244353, %112
  %114 = sext i32 %113 to i64
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = srem i32 998244353, %115
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100001 x i32], ptr @inv, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = mul nsw i64 %114, %120
  %122 = srem i64 %121, 998244353
  %123 = trunc i64 %122 to i32
  %124 = sub nsw i32 998244353, %123
  %125 = load i32, ptr %6, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100001 x i32], ptr @inv, i64 0, i64 %126
  store i32 %124, ptr %127, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %111
  %129 = load i32, ptr %6, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %6, align 4, !tbaa !5
  br label %106, !llvm.loop !14

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

132:                                              ; preds = %138, %131
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = load i32, ptr @n, align 4, !tbaa !5
  %135 = shl i32 %134, 1
  %136 = icmp slt i32 %133, %135
  br i1 %136, label %137, label %141

137:                                              ; preds = %132
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %7, align 4, !tbaa !5
  %140 = shl i32 %139, 1
  store i32 %140, ptr %7, align 4, !tbaa !5
  br label %132, !llvm.loop !15

141:                                              ; preds = %132
  %142 = load i32, ptr @n, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds i32, ptr @A, i64 %143
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = load i32, ptr @n, align 4, !tbaa !5
  %147 = sub nsw i32 %145, %146
  %148 = sext i32 %147 to i64
  %149 = mul i64 %148, 4
  call void @llvm.memset.p0.i64(ptr align 4 %144, i8 0, i64 %149, i1 false)
  %150 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z7PolyInviPiS_(i32 noundef %150, ptr noundef @A, ptr noundef @B)
  %151 = load i32, ptr @n, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds i32, ptr @B, i64 %152
  %154 = load i32, ptr %7, align 4, !tbaa !5
  %155 = load i32, ptr @n, align 4, !tbaa !5
  %156 = sub nsw i32 %154, %155
  %157 = sext i32 %156 to i64
  %158 = mul i64 %157, 4
  call void @llvm.memset.p0.i64(ptr align 4 %153, i8 0, i64 %158, i1 false)
  %159 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z3NTTiPii(i32 noundef %159, ptr noundef @B, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %180, %141
  %161 = load i32, ptr %8, align 4, !tbaa !5
  %162 = load i32, ptr @n, align 4, !tbaa !5
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %165, label %164

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

165:                                              ; preds = %160
  %166 = load i32, ptr %8, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = load i32, ptr %8, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = mul nsw i64 %170, %172
  %174 = srem i64 %173, 998244353
  %175 = trunc i64 %174 to i32
  %176 = load i32, ptr %8, align 4, !tbaa !5
  %177 = sub nsw i32 %176, 1
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %178
  store i32 %175, ptr %179, align 4, !tbaa !5
  br label %180

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

183:                                              ; preds = %164
  %184 = load i32, ptr @n, align 4, !tbaa !5
  %185 = sub nsw i32 %184, 1
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %186
  store i32 0, ptr %187, align 4, !tbaa !5
  %188 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z3NTTiPii(i32 noundef %188, ptr noundef @A, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %211, %183
  %190 = load i32, ptr %9, align 4, !tbaa !5
  %191 = load i32, ptr %7, align 4, !tbaa !5
  %192 = icmp slt i32 %190, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %189
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %214

194:                                              ; preds = %189
  %195 = load i32, ptr %9, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = load i32, ptr %9, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = mul nsw i64 %199, %204
  %206 = srem i64 %205, 998244353
  %207 = trunc i64 %206 to i32
  %208 = load i32, ptr %9, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %209
  store i32 %207, ptr %210, align 4, !tbaa !5
  br label %211

211:                                              ; preds = %194
  %212 = load i32, ptr %9, align 4, !tbaa !5
  %213 = add nsw i32 %212, 1
  store i32 %213, ptr %9, align 4, !tbaa !5
  br label %189, !llvm.loop !17

214:                                              ; preds = %193
  %215 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z3NTTiPii(i32 noundef %215, ptr noundef @B, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %216

216:                                              ; preds = %235, %214
  %217 = load i32, ptr %10, align 4, !tbaa !5
  %218 = load i32, ptr @n, align 4, !tbaa !5
  %219 = icmp slt i32 %217, %218
  br i1 %219, label %221, label %220

220:                                              ; preds = %216
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %238

221:                                              ; preds = %216
  %222 = load i32, ptr %10, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = load i32, ptr getelementptr inbounds ([19 x i32], ptr @inv2, i64 0, i64 1), align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = mul nsw i64 %226, %228
  %230 = srem i64 %229, 998244353
  %231 = trunc i64 %230 to i32
  %232 = load i32, ptr %10, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %233
  store i32 %231, ptr %234, align 4, !tbaa !5
  br label %235

235:                                              ; preds = %221
  %236 = load i32, ptr %10, align 4, !tbaa !5
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %10, align 4, !tbaa !5
  br label %216, !llvm.loop !18

238:                                              ; preds = %220
  %239 = load i32, ptr %7, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = mul i64 %240, 4
  call void @llvm.memset.p0.i64(ptr align 16 @A, i8 0, i64 %241, i1 false)
  %242 = load i32, ptr @n, align 4, !tbaa !5
  %243 = sub nsw i32 %242, 1
  call void @_Z3cdqii(i32 noundef 0, i32 noundef %243)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %244

244:                                              ; preds = %263, %238
  %245 = load i32, ptr %11, align 4, !tbaa !5
  %246 = load i32, ptr @n, align 4, !tbaa !5
  %247 = icmp slt i32 %245, %246
  br i1 %247, label %249, label %248

248:                                              ; preds = %244
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %266

249:                                              ; preds = %244
  %250 = load i32, ptr %11, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %251
  %253 = load i32, ptr %252, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = load i32, ptr getelementptr inbounds ([19 x i32], ptr @inv2, i64 0, i64 1), align 4, !tbaa !5
  %256 = sext i32 %255 to i64
  %257 = mul nsw i64 %254, %256
  %258 = srem i64 %257, 998244353
  %259 = trunc i64 %258 to i32
  %260 = load i32, ptr %11, align 4, !tbaa !5
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %261
  store i32 %259, ptr %262, align 4, !tbaa !5
  br label %263

263:                                              ; preds = %249
  %264 = load i32, ptr %11, align 4, !tbaa !5
  %265 = add nsw i32 %264, 1
  store i32 %265, ptr %11, align 4, !tbaa !5
  br label %244, !llvm.loop !19

266:                                              ; preds = %248
  %267 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z7PolyInviPiS_(i32 noundef %267, ptr noundef @A, ptr noundef @B)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %268

268:                                              ; preds = %279, %266
  %269 = load i32, ptr %12, align 4, !tbaa !5
  %270 = load i32, ptr @n, align 4, !tbaa !5
  %271 = icmp slt i32 %269, %270
  br i1 %271, label %273, label %272

272:                                              ; preds = %268
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %282

273:                                              ; preds = %268
  %274 = load i32, ptr %12, align 4, !tbaa !5
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %275
  %277 = load i32, ptr %276, align 4, !tbaa !5
  %278 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %277)
  br label %279

279:                                              ; preds = %273
  %280 = load i32, ptr %12, align 4, !tbaa !5
  %281 = add nsw i32 %280, 1
  store i32 %281, ptr %12, align 4, !tbaa !5
  br label %268, !llvm.loop !20

282:                                              ; preds = %272
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  ret i32 0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) #5

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { 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 #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 = { "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 = 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}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !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"

@w = external dso_local local_unnamed_addr global [262145 x i32], align 16
@inv2 = external dso_local local_unnamed_addr global [19 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@inv = external dso_local local_unnamed_addr global [100001 x i32], align 16
@A = external dso_local global [262145 x i32], align 16
@B = external dso_local global [262145 x i32], 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
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7PolyInviPiS_(i32 noundef, ptr noundef, ptr noundef) 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z3NTTiPii(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; 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 uwtable
declare dso_local void @_Z3cdqii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  store i32 1, ptr @w, align 16, !tbaa !5
  %2 = tail call noundef i32 @_Z7mod_powii(i32 noundef 3, i32 noundef 3808)
  store i32 %2, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !5
  br label %9

3:                                                ; preds = %9
  store <4 x i32> <i32 1, i32 499122177, i32 748683265, i32 873463809>, ptr @inv2, align 16, !tbaa !5
  store <4 x i32> <i32 935854081, i32 967049217, i32 982646785, i32 990445569>, ptr getelementptr inbounds (i8, ptr @inv2, i64 16), align 16, !tbaa !5
  store <4 x i32> <i32 994344961, i32 996294657, i32 997269505, i32 997756929>, ptr getelementptr inbounds (i8, ptr @inv2, i64 32), align 16, !tbaa !5
  store <4 x i32> <i32 998000641, i32 998122497, i32 998183425, i32 998213889>, ptr getelementptr inbounds (i8, ptr @inv2, i64 48), align 16, !tbaa !5
  store i32 998229121, ptr getelementptr inbounds (i8, ptr @inv2, i64 64), align 16, !tbaa !5
  store i32 998236737, ptr getelementptr inbounds (i8, ptr @inv2, i64 68), align 4, !tbaa !5
  store i32 998240545, ptr getelementptr inbounds (i8, ptr @inv2, i64 72), align 8, !tbaa !5
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @n)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = add nsw i32 %5, 1
  store i32 %6, ptr @n, align 4, !tbaa !5
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @m, align 4, !tbaa !5
  %.not67 = icmp eq i32 %7, 0
  br i1 %.not67, label %._crit_edge, label %.lr.ph

9:                                                ; preds = %9, %0
  %10 = phi i32 [ %2, %0 ], [ %22, %9 ]
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next.1, %9 ]
  %11 = sext i32 %10 to i64
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = mul nsw i64 %13, %11
  %15 = srem i64 %14, 998244353
  %16 = trunc nsw i64 %15 to i32
  %17 = getelementptr inbounds [262145 x i32], ptr @w, i64 0, i64 %indvars.iv
  store i32 %16, ptr %17, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = mul nsw i64 %15, %19
  %21 = srem i64 %20, 998244353
  %22 = trunc nsw i64 %21 to i32
  %23 = getelementptr inbounds [262145 x i32], ptr @w, i64 0, i64 %indvars.iv.next
  store i32 %22, ptr %23, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 262144
  br i1 %exitcond.not.1, label %3, label %9, !llvm.loop !9

.lr.ph:                                           ; preds = %3, %33
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %28, label %33

28:                                               ; preds = %.lr.ph
  %29 = sext i32 %25 to i64
  %30 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %30, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %28, %.lr.ph
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %34 = load i32, ptr @m, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %34, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %33, %3
  %36 = phi i32 [ %6, %3 ], [ %26, %33 ]
  store i32 1, ptr @A, align 16, !tbaa !5
  %37 = icmp sgt i32 %36, 1
  br i1 %37, label %.lr.ph70.preheader, label %._crit_edge71.thread

._crit_edge71.thread:                             ; preds = %._crit_edge
  store i32 1, ptr getelementptr inbounds (i8, ptr @inv, i64 4), align 4, !tbaa !5
  br label %.preheader

.lr.ph70.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %36 to i64
  %38 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %36, 9
  br i1 %min.iters.check, label %.lr.ph70.preheader151, label %vector.ph

.lr.ph70.preheader151:                            ; preds = %middle.block, %.lr.ph70.preheader
  %indvars.iv103.ph = phi i64 [ 1, %.lr.ph70.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph70

vector.ph:                                        ; preds = %.lr.ph70.preheader
  %n.vec = and i64 %38, -8
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %pred.store.continue150, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue150 ]
  %offset.idx = or disjoint i64 %index, 1
  %39 = or disjoint i64 %index, 5
  %40 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %offset.idx
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %wide.load = load <4 x i32>, ptr %40, align 4, !tbaa !5
  %wide.load136 = load <4 x i32>, ptr %41, align 4, !tbaa !5
  %42 = icmp ne <4 x i32> %wide.load, zeroinitializer
  %43 = icmp ne <4 x i32> %wide.load136, zeroinitializer
  %44 = extractelement <4 x i1> %42, i64 0
  br i1 %44, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body
  %45 = extractelement <4 x i32> %wide.load, i64 0
  %46 = shl i32 %45, 2
  %47 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %offset.idx
  %48 = sub nsw i32 998244353, %46
  store i32 %48, ptr %47, align 4, !tbaa !5
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body
  %49 = extractelement <4 x i1> %42, i64 1
  br i1 %49, label %pred.store.if137, label %pred.store.continue138

pred.store.if137:                                 ; preds = %pred.store.continue
  %50 = or disjoint i64 %index, 2
  %51 = extractelement <4 x i32> %wide.load, i64 1
  %52 = shl i32 %51, 2
  %53 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %50
  %54 = sub nsw i32 998244353, %52
  store i32 %54, ptr %53, align 8, !tbaa !5
  br label %pred.store.continue138

pred.store.continue138:                           ; preds = %pred.store.if137, %pred.store.continue
  %55 = extractelement <4 x i1> %42, i64 2
  br i1 %55, label %pred.store.if139, label %pred.store.continue140

pred.store.if139:                                 ; preds = %pred.store.continue138
  %56 = or disjoint i64 %index, 3
  %57 = extractelement <4 x i32> %wide.load, i64 2
  %58 = shl i32 %57, 2
  %59 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %56
  %60 = sub nsw i32 998244353, %58
  store i32 %60, ptr %59, align 4, !tbaa !5
  br label %pred.store.continue140

pred.store.continue140:                           ; preds = %pred.store.if139, %pred.store.continue138
  %61 = extractelement <4 x i1> %42, i64 3
  br i1 %61, label %pred.store.if141, label %pred.store.continue142

pred.store.if141:                                 ; preds = %pred.store.continue140
  %62 = or disjoint i64 %index, 4
  %63 = extractelement <4 x i32> %wide.load, i64 3
  %64 = shl i32 %63, 2
  %65 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %62
  %66 = sub nsw i32 998244353, %64
  store i32 %66, ptr %65, align 16, !tbaa !5
  br label %pred.store.continue142

pred.store.continue142:                           ; preds = %pred.store.if141, %pred.store.continue140
  %67 = extractelement <4 x i1> %43, i64 0
  br i1 %67, label %pred.store.if143, label %pred.store.continue144

pred.store.if143:                                 ; preds = %pred.store.continue142
  %68 = extractelement <4 x i32> %wide.load136, i64 0
  %69 = shl i32 %68, 2
  %70 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %39
  %71 = sub nsw i32 998244353, %69
  store i32 %71, ptr %70, align 4, !tbaa !5
  br label %pred.store.continue144

pred.store.continue144:                           ; preds = %pred.store.if143, %pred.store.continue142
  %72 = extractelement <4 x i1> %43, i64 1
  br i1 %72, label %pred.store.if145, label %pred.store.continue146

pred.store.if145:                                 ; preds = %pred.store.continue144
  %73 = or disjoint i64 %index, 6
  %74 = extractelement <4 x i32> %wide.load136, i64 1
  %75 = shl i32 %74, 2
  %76 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %73
  %77 = sub nsw i32 998244353, %75
  store i32 %77, ptr %76, align 8, !tbaa !5
  br label %pred.store.continue146

pred.store.continue146:                           ; preds = %pred.store.if145, %pred.store.continue144
  %78 = extractelement <4 x i1> %43, i64 2
  br i1 %78, label %pred.store.if147, label %pred.store.continue148

pred.store.if147:                                 ; preds = %pred.store.continue146
  %79 = or disjoint i64 %index, 7
  %80 = extractelement <4 x i32> %wide.load136, i64 2
  %81 = shl i32 %80, 2
  %82 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %79
  %83 = sub nsw i32 998244353, %81
  store i32 %83, ptr %82, align 4, !tbaa !5
  br label %pred.store.continue148

pred.store.continue148:                           ; preds = %pred.store.if147, %pred.store.continue146
  %84 = extractelement <4 x i1> %43, i64 3
  br i1 %84, label %pred.store.if149, label %pred.store.continue150

pred.store.if149:                                 ; preds = %pred.store.continue148
  %85 = add i64 %index, 8
  %86 = extractelement <4 x i32> %wide.load136, i64 3
  %87 = shl i32 %86, 2
  %88 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %85
  %89 = sub nsw i32 998244353, %87
  store i32 %89, ptr %88, align 16, !tbaa !5
  br label %pred.store.continue150

pred.store.continue150:                           ; preds = %pred.store.if149, %pred.store.continue148
  %index.next = add nuw i64 %index, 8
  %90 = icmp eq i64 %index.next, %n.vec
  br i1 %90, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %pred.store.continue150
  %cmp.n = icmp eq i64 %38, %n.vec
  br i1 %cmp.n, label %._crit_edge71, label %.lr.ph70.preheader151

._crit_edge71:                                    ; preds = %96, %middle.block
  store i32 1, ptr getelementptr inbounds (i8, ptr @inv, i64 4), align 4, !tbaa !5
  %.not135 = icmp eq i32 %36, 2
  br i1 %.not135, label %.preheader, label %.lr.ph74.preheader

.lr.ph74.preheader:                               ; preds = %._crit_edge71
  %wide.trip.count110 = zext nneg i32 %36 to i64
  br label %.lr.ph74

.lr.ph70:                                         ; preds = %.lr.ph70.preheader151, %96
  %indvars.iv103 = phi i64 [ %indvars.iv.next104, %96 ], [ %indvars.iv103.ph, %.lr.ph70.preheader151 ]
  %91 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv103
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %.not61 = icmp eq i32 %92, 0
  br i1 %.not61, label %96, label %93

93:                                               ; preds = %.lr.ph70
  %94 = shl i32 %92, 2
  %95 = sub nsw i32 998244353, %94
  store i32 %95, ptr %91, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %.lr.ph70, %93
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %exitcond106.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count
  br i1 %exitcond106.not, label %._crit_edge71, label %.lr.ph70, !llvm.loop !15

.preheader:                                       ; preds = %.lr.ph74, %._crit_edge71.thread, %._crit_edge71
  %97 = shl i32 %36, 1
  br label %111

.lr.ph74:                                         ; preds = %.lr.ph74.preheader, %.lr.ph74
  %indvars.iv107 = phi i64 [ 2, %.lr.ph74.preheader ], [ %indvars.iv.next108, %.lr.ph74 ]
  %98 = trunc nuw nsw i64 %indvars.iv107 to i32
  %99 = udiv i32 998244353, %98
  %100 = zext nneg i32 %99 to i64
  %101 = urem i32 998244353, %98
  %102 = zext nneg i32 %101 to i64
  %103 = getelementptr inbounds [100001 x i32], ptr @inv, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = mul nsw i64 %105, %100
  %107 = srem i64 %106, 998244353
  %108 = trunc nsw i64 %107 to i32
  %109 = sub nsw i32 998244353, %108
  %110 = getelementptr inbounds [100001 x i32], ptr @inv, i64 0, i64 %indvars.iv107
  store i32 %109, ptr %110, align 4, !tbaa !5
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %exitcond111.not = icmp eq i64 %indvars.iv.next108, %wide.trip.count110
  br i1 %exitcond111.not, label %.preheader, label %.lr.ph74, !llvm.loop !16

111:                                              ; preds = %111, %.preheader
  %.052 = phi i32 [ %113, %111 ], [ 1, %.preheader ]
  %112 = icmp slt i32 %.052, %97
  %113 = shl i32 %.052, 1
  br i1 %112, label %111, label %114, !llvm.loop !17

114:                                              ; preds = %111
  %115 = sext i32 %36 to i64
  %116 = getelementptr inbounds i32, ptr @A, i64 %115
  %117 = sub nsw i32 %.052, %36
  %118 = sext i32 %117 to i64
  %119 = shl nsw i64 %118, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %116, i8 0, i64 %119, i1 false)
  call void @_Z7PolyInviPiS_(i32 noundef %36, ptr noundef nonnull @A, ptr noundef nonnull @B)
  %120 = load i32, ptr @n, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i32, ptr @B, i64 %121
  %123 = sub nsw i32 %.052, %120
  %124 = sext i32 %123 to i64
  %125 = shl nsw i64 %124, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %122, i8 0, i64 %125, i1 false)
  call void @_Z3NTTiPii(i32 noundef %.052, ptr noundef nonnull @B, i32 noundef 1)
  %126 = load i32, ptr @n, align 4, !tbaa !5
  %127 = icmp sgt i32 %126, 1
  br i1 %127, label %.lr.ph77.preheader, label %._crit_edge78

.lr.ph77.preheader:                               ; preds = %114
  %wide.trip.count115 = zext nneg i32 %126 to i64
  %128 = add nsw i64 %wide.trip.count115, -1
  %xtraiter = and i64 %128, 1
  %129 = icmp eq i32 %126, 2
  br i1 %129, label %._crit_edge78.loopexit.unr-lcssa, label %.lr.ph77.preheader.new

.lr.ph77.preheader.new:                           ; preds = %.lr.ph77.preheader
  %unroll_iter = and i64 %128, -2
  br label %.lr.ph77

._crit_edge78.loopexit.unr-lcssa:                 ; preds = %.lr.ph77, %.lr.ph77.preheader
  %indvars.iv112.unr = phi i64 [ 1, %.lr.ph77.preheader ], [ %indvars.iv.next113.1, %.lr.ph77 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge78, label %.lr.ph77.epil

.lr.ph77.epil:                                    ; preds = %._crit_edge78.loopexit.unr-lcssa
  %130 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv112.unr
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = mul nsw i64 %indvars.iv112.unr, %132
  %134 = srem i64 %133, 998244353
  %135 = trunc nsw i64 %134 to i32
  %136 = add nsw i64 %indvars.iv112.unr, -1
  %137 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %136
  store i32 %135, ptr %137, align 4, !tbaa !5
  br label %._crit_edge78

._crit_edge78:                                    ; preds = %.lr.ph77.epil, %._crit_edge78.loopexit.unr-lcssa, %114
  %138 = add nsw i32 %126, -1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %139
  store i32 0, ptr %140, align 4, !tbaa !5
  call void @_Z3NTTiPii(i32 noundef %.052, ptr noundef nonnull @A, i32 noundef 1)
  %141 = icmp sgt i32 %.052, 0
  br i1 %141, label %.lr.ph82.preheader, label %._crit_edge83

.lr.ph82.preheader:                               ; preds = %._crit_edge78
  %wide.trip.count120 = zext nneg i32 %.052 to i64
  %xtraiter152 = and i64 %wide.trip.count120, 1
  %142 = icmp eq i32 %.052, 1
  br i1 %142, label %._crit_edge83.loopexit.unr-lcssa, label %.lr.ph82.preheader.new

.lr.ph82.preheader.new:                           ; preds = %.lr.ph82.preheader
  %unroll_iter154 = and i64 %wide.trip.count120, 2147483646
  br label %.lr.ph82

.lr.ph77:                                         ; preds = %.lr.ph77, %.lr.ph77.preheader.new
  %indvars.iv112 = phi i64 [ 1, %.lr.ph77.preheader.new ], [ %indvars.iv.next113.1, %.lr.ph77 ]
  %niter = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %niter.next.1, %.lr.ph77 ]
  %143 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv112
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = mul nsw i64 %indvars.iv112, %145
  %147 = srem i64 %146, 998244353
  %148 = trunc nsw i64 %147 to i32
  %149 = add nsw i64 %indvars.iv112, -1
  %150 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %149
  store i32 %148, ptr %150, align 4, !tbaa !5
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %151 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv.next113
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = mul nsw i64 %indvars.iv.next113, %153
  %155 = srem i64 %154, 998244353
  %156 = trunc nsw i64 %155 to i32
  %157 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv112
  store i32 %156, ptr %157, align 4, !tbaa !5
  %indvars.iv.next113.1 = add nuw nsw i64 %indvars.iv112, 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_edge78.loopexit.unr-lcssa, label %.lr.ph77, !llvm.loop !18

._crit_edge83.loopexit.unr-lcssa:                 ; preds = %.lr.ph82, %.lr.ph82.preheader
  %indvars.iv117.unr = phi i64 [ 0, %.lr.ph82.preheader ], [ %indvars.iv.next118.1, %.lr.ph82 ]
  %lcmp.mod153.not = icmp eq i64 %xtraiter152, 0
  br i1 %lcmp.mod153.not, label %._crit_edge83, label %.lr.ph82.epil

.lr.ph82.epil:                                    ; preds = %._crit_edge83.loopexit.unr-lcssa
  %158 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv117.unr
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %indvars.iv117.unr
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = mul nsw i64 %163, %160
  %165 = srem i64 %164, 998244353
  %166 = trunc nsw i64 %165 to i32
  store i32 %166, ptr %161, align 4, !tbaa !5
  br label %._crit_edge83

._crit_edge83:                                    ; preds = %.lr.ph82.epil, %._crit_edge83.loopexit.unr-lcssa, %._crit_edge78
  call void @_Z3NTTiPii(i32 noundef %.052, ptr noundef nonnull @B, i32 noundef -1)
  %167 = load i32, ptr @n, align 4, !tbaa !5
  %168 = icmp sgt i32 %167, 0
  br i1 %168, label %.lr.ph86, label %._crit_edge87

.lr.ph86:                                         ; preds = %._crit_edge83
  %169 = load i32, ptr getelementptr inbounds (i8, ptr @inv2, i64 4), align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %wide.trip.count125 = zext nneg i32 %167 to i64
  %xtraiter156 = and i64 %wide.trip.count125, 1
  %171 = icmp eq i32 %167, 1
  br i1 %171, label %._crit_edge87.loopexit.unr-lcssa, label %.lr.ph86.new

.lr.ph86.new:                                     ; preds = %.lr.ph86
  %unroll_iter158 = and i64 %wide.trip.count125, 2147483646
  br label %205

.lr.ph82:                                         ; preds = %.lr.ph82, %.lr.ph82.preheader.new
  %indvars.iv117 = phi i64 [ 0, %.lr.ph82.preheader.new ], [ %indvars.iv.next118.1, %.lr.ph82 ]
  %niter155 = phi i64 [ 0, %.lr.ph82.preheader.new ], [ %niter155.next.1, %.lr.ph82 ]
  %172 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv117
  %173 = load i32, ptr %172, align 8, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %indvars.iv117
  %176 = load i32, ptr %175, align 8, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = mul nsw i64 %177, %174
  %179 = srem i64 %178, 998244353
  %180 = trunc nsw i64 %179 to i32
  store i32 %180, ptr %175, align 8, !tbaa !5
  %indvars.iv.next118 = or disjoint i64 %indvars.iv117, 1
  %181 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv.next118
  %182 = load i32, ptr %181, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %indvars.iv.next118
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = mul nsw i64 %186, %183
  %188 = srem i64 %187, 998244353
  %189 = trunc nsw i64 %188 to i32
  store i32 %189, ptr %184, align 4, !tbaa !5
  %indvars.iv.next118.1 = add nuw nsw i64 %indvars.iv117, 2
  %niter155.next.1 = add i64 %niter155, 2
  %niter155.ncmp.1 = icmp eq i64 %niter155.next.1, %unroll_iter154
  br i1 %niter155.ncmp.1, label %._crit_edge83.loopexit.unr-lcssa, label %.lr.ph82, !llvm.loop !19

._crit_edge87.loopexit.unr-lcssa:                 ; preds = %205, %.lr.ph86
  %indvars.iv122.unr = phi i64 [ 0, %.lr.ph86 ], [ %indvars.iv.next123.1, %205 ]
  %lcmp.mod157.not = icmp eq i64 %xtraiter156, 0
  br i1 %lcmp.mod157.not, label %._crit_edge87, label %._crit_edge87.loopexit.epilog-lcssa

._crit_edge87.loopexit.epilog-lcssa:              ; preds = %._crit_edge87.loopexit.unr-lcssa
  %190 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %indvars.iv122.unr
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = mul nsw i64 %170, %192
  %194 = srem i64 %193, 998244353
  %195 = trunc nsw i64 %194 to i32
  store i32 %195, ptr %190, align 4, !tbaa !5
  br label %._crit_edge87

._crit_edge87:                                    ; preds = %._crit_edge87.loopexit.epilog-lcssa, %._crit_edge87.loopexit.unr-lcssa, %._crit_edge83
  %196 = sext i32 %.052 to i64
  %197 = shl nsw i64 %196, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @A, i8 0, i64 %197, i1 false)
  %198 = add nsw i32 %167, -1
  call void @_Z3cdqii(i32 noundef 0, i32 noundef %198)
  %199 = load i32, ptr @n, align 4, !tbaa !5
  %200 = icmp sgt i32 %199, 1
  br i1 %200, label %.lr.ph91, label %._crit_edge92

.lr.ph91:                                         ; preds = %._crit_edge87
  %201 = load i32, ptr getelementptr inbounds (i8, ptr @inv2, i64 4), align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %wide.trip.count130 = zext nneg i32 %199 to i64
  %203 = add nsw i64 %wide.trip.count130, -1
  %xtraiter161 = and i64 %203, 1
  %204 = icmp eq i32 %199, 2
  br i1 %204, label %._crit_edge92.loopexit.unr-lcssa, label %.lr.ph91.new

.lr.ph91.new:                                     ; preds = %.lr.ph91
  %unroll_iter163 = and i64 %203, -2
  br label %226

205:                                              ; preds = %205, %.lr.ph86.new
  %indvars.iv122 = phi i64 [ 0, %.lr.ph86.new ], [ %indvars.iv.next123.1, %205 ]
  %niter159 = phi i64 [ 0, %.lr.ph86.new ], [ %niter159.next.1, %205 ]
  %206 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %indvars.iv122
  %207 = load i32, ptr %206, align 8, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = mul nsw i64 %170, %208
  %210 = srem i64 %209, 998244353
  %211 = trunc nsw i64 %210 to i32
  store i32 %211, ptr %206, align 8, !tbaa !5
  %indvars.iv.next123 = or disjoint i64 %indvars.iv122, 1
  %212 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %indvars.iv.next123
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = mul nsw i64 %170, %214
  %216 = srem i64 %215, 998244353
  %217 = trunc nsw i64 %216 to i32
  store i32 %217, ptr %212, align 4, !tbaa !5
  %indvars.iv.next123.1 = add nuw nsw i64 %indvars.iv122, 2
  %niter159.next.1 = add i64 %niter159, 2
  %niter159.ncmp.1 = icmp eq i64 %niter159.next.1, %unroll_iter158
  br i1 %niter159.ncmp.1, label %._crit_edge87.loopexit.unr-lcssa, label %205, !llvm.loop !20

._crit_edge92.loopexit.unr-lcssa:                 ; preds = %226, %.lr.ph91
  %indvars.iv127.unr = phi i64 [ 1, %.lr.ph91 ], [ %indvars.iv.next128.1, %226 ]
  %lcmp.mod162.not = icmp eq i64 %xtraiter161, 0
  br i1 %lcmp.mod162.not, label %._crit_edge92, label %._crit_edge92.loopexit.epilog-lcssa

._crit_edge92.loopexit.epilog-lcssa:              ; preds = %._crit_edge92.loopexit.unr-lcssa
  %218 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv127.unr
  %219 = load i32, ptr %218, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = mul nsw i64 %202, %220
  %222 = srem i64 %221, 998244353
  %223 = trunc nsw i64 %222 to i32
  store i32 %223, ptr %218, align 4, !tbaa !5
  br label %._crit_edge92

._crit_edge92:                                    ; preds = %._crit_edge92.loopexit.epilog-lcssa, %._crit_edge92.loopexit.unr-lcssa, %._crit_edge87
  call void @_Z7PolyInviPiS_(i32 noundef %199, ptr noundef nonnull @A, ptr noundef nonnull @B)
  %224 = load i32, ptr @n, align 4, !tbaa !5
  %225 = icmp sgt i32 %224, 1
  br i1 %225, label %.lr.ph96, label %._crit_edge97

226:                                              ; preds = %226, %.lr.ph91.new
  %indvars.iv127 = phi i64 [ 1, %.lr.ph91.new ], [ %indvars.iv.next128.1, %226 ]
  %niter164 = phi i64 [ 0, %.lr.ph91.new ], [ %niter164.next.1, %226 ]
  %227 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv127
  %228 = load i32, ptr %227, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = mul nsw i64 %202, %229
  %231 = srem i64 %230, 998244353
  %232 = trunc nsw i64 %231 to i32
  store i32 %232, ptr %227, align 4, !tbaa !5
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %233 = getelementptr inbounds [262145 x i32], ptr @A, i64 0, i64 %indvars.iv.next128
  %234 = load i32, ptr %233, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = mul nsw i64 %202, %235
  %237 = srem i64 %236, 998244353
  %238 = trunc nsw i64 %237 to i32
  store i32 %238, ptr %233, align 4, !tbaa !5
  %indvars.iv.next128.1 = add nuw nsw i64 %indvars.iv127, 2
  %niter164.next.1 = add i64 %niter164, 2
  %niter164.ncmp.1 = icmp eq i64 %niter164.next.1, %unroll_iter163
  br i1 %niter164.ncmp.1, label %._crit_edge92.loopexit.unr-lcssa, label %226, !llvm.loop !21

._crit_edge97:                                    ; preds = %.lr.ph96, %._crit_edge92
  ret i32 0

.lr.ph96:                                         ; preds = %._crit_edge92, %.lr.ph96
  %indvars.iv132 = phi i64 [ %indvars.iv.next133, %.lr.ph96 ], [ 1, %._crit_edge92 ]
  %239 = getelementptr inbounds [262145 x i32], ptr @B, i64 0, i64 %indvars.iv132
  %240 = load i32, ptr %239, align 4, !tbaa !5
  %241 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %240)
  %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
  %242 = load i32, ptr @n, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = icmp slt i64 %indvars.iv.next133, %243
  br i1 %244, label %.lr.ph96, label %._crit_edge97, !llvm.loop !22
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) local_unnamed_addr #5

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

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

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


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