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

; 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 [32769 x i32], align 16
@inv2 = external dso_local global [17 x i32], align 16
@inv = external dso_local global [10001 x i32], align 16
@pw = external dso_local global [10001 x i32], align 16
@s = external dso_local global [21 x [21 x i32]], align 16
@f = external dso_local global [21 x [10001 x i32]], align 16
@g = external dso_local global [32769 x i32], align 16
@h = external dso_local global [32769 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 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 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 @_Z3NTTiPii(i32 noundef, ptr noundef, i32 noundef) #2

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

; 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
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr @w, align 16, !tbaa !5
  %21 = call noundef i32 @_Z7mod_powii(i32 noundef 3, i32 noundef 30464)
  store i32 %21, ptr getelementptr inbounds ([32769 x i32], ptr @w, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %41, %0
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = icmp slt i32 %23, 32769
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %22
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sub nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [32769 x i32], ptr @w, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = load i32, ptr getelementptr inbounds ([32769 x i32], ptr @w, i64 0, i64 1), align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = mul nsw i64 %32, %34
  %36 = srem i64 %35, 998244353
  %37 = trunc i64 %36 to i32
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [32769 x i32], ptr @w, i64 0, i64 %39
  store i32 %37, ptr %40, align 4, !tbaa !5
  br label %41

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

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

45:                                               ; preds = %64, %44
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = icmp sle i32 %46, 15
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %67

49:                                               ; preds = %45
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sub nsw i32 %50, 1
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [17 x i32], ptr @inv2, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = load i32, ptr getelementptr inbounds ([17 x i32], ptr @inv2, i64 0, i64 1), align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = mul nsw i64 %55, %57
  %59 = srem i64 %58, 998244353
  %60 = trunc i64 %59 to i32
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [17 x i32], ptr @inv2, i64 0, i64 %62
  store i32 %60, ptr %63, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %49
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %3, align 4, !tbaa !5
  br label %45, !llvm.loop !11

67:                                               ; preds = %48
  store i32 1, ptr getelementptr inbounds ([10001 x i32], ptr getelementptr inbounds ([21 x [10001 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([10001 x i32], ptr @pw, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr @pw, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([10001 x i32], ptr @inv, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 2, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %136, %67
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = icmp slt i32 %69, 10001
  br i1 %70, label %72, label %71

71:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %139

72:                                               ; preds = %68
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = sdiv i32 998244353, %73
  %75 = sext i32 %74 to i64
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = srem i32 998244353, %76
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [10001 x i32], ptr @inv, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = mul nsw i64 %75, %81
  %83 = srem i64 %82, 998244353
  %84 = trunc i64 %83 to i32
  %85 = sub nsw i32 998244353, %84
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [10001 x i32], ptr @inv, i64 0, i64 %87
  store i32 %85, ptr %88, align 4, !tbaa !5
  %89 = load i32, ptr %5, align 4, !tbaa !5
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = call noundef i32 @_Z7mod_addii(i32 noundef %89, i32 noundef %90)
  store i32 %91, ptr %5, align 4, !tbaa !5
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [10001 x i32], ptr @pw, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = mul nsw i64 %97, %99
  %101 = srem i64 %100, 998244353
  %102 = load i32, ptr %4, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [10001 x i32], ptr @inv, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = mul nsw i64 %101, %106
  %108 = srem i64 %107, 998244353
  %109 = trunc i64 %108 to i32
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [10001 x i32], ptr @pw, i64 0, i64 %111
  store i32 %109, ptr %112, align 4, !tbaa !5
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [10001 x i32], ptr @inv, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = mul nsw i64 %114, %119
  %121 = srem i64 %120, 998244353
  %122 = trunc i64 %121 to i32
  store i32 %122, ptr %6, align 4, !tbaa !5
  %123 = load i32, ptr %4, align 4, !tbaa !5
  %124 = load i32, ptr %4, align 4, !tbaa !5
  %125 = sub nsw i32 %124, 2
  %126 = call noundef i32 @_Z7mod_powii(i32 noundef %123, i32 noundef %125)
  %127 = sext i32 %126 to i64
  %128 = load i32, ptr %6, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = mul nsw i64 %127, %129
  %131 = srem i64 %130, 998244353
  %132 = trunc i64 %131 to i32
  %133 = load i32, ptr %4, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [10001 x i32], ptr getelementptr inbounds ([21 x [10001 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 %134
  store i32 %132, ptr %135, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %72
  %137 = load i32, ptr %4, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %4, align 4, !tbaa !5
  br label %68, !llvm.loop !12

139:                                              ; preds = %71
  store i32 1, ptr @s, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %192, %139
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = icmp slt i32 %141, 21
  br i1 %142, label %144, label %143

143:                                              ; preds = %140
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %195

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

145:                                              ; preds = %182, %144
  %146 = load i32, ptr %9, align 4, !tbaa !5
  %147 = load i32, ptr %7, align 4, !tbaa !5
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %150, label %149

149:                                              ; preds = %145
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %185

150:                                              ; preds = %145
  %151 = load i32, ptr %7, align 4, !tbaa !5
  %152 = sub nsw i32 %151, 1
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %153
  %155 = load i32, ptr %9, align 4, !tbaa !5
  %156 = sub nsw i32 %155, 1
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [21 x i32], ptr %154, i64 0, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = load i32, ptr %9, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = load i32, ptr %7, align 4, !tbaa !5
  %164 = sub nsw i32 %163, 1
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %165
  %167 = load i32, ptr %9, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [21 x i32], ptr %166, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = mul nsw i64 %162, %171
  %173 = add nsw i64 %160, %172
  %174 = srem i64 %173, 998244353
  %175 = trunc i64 %174 to i32
  %176 = load i32, ptr %7, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %177
  %179 = load i32, ptr %9, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [21 x i32], ptr %178, i64 0, i64 %180
  store i32 %175, ptr %181, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %150
  %183 = load i32, ptr %9, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %9, align 4, !tbaa !5
  br label %145, !llvm.loop !13

185:                                              ; preds = %149
  %186 = load i32, ptr %7, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %187
  %189 = load i32, ptr %7, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [21 x i32], ptr %188, i64 0, i64 %190
  store i32 1, ptr %191, align 4, !tbaa !5
  br label %192

192:                                              ; preds = %185
  %193 = load i32, ptr %7, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %7, align 4, !tbaa !5
  br label %140, !llvm.loop !14

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

196:                                              ; preds = %200, %195
  %197 = load i32, ptr %10, align 4, !tbaa !5
  %198 = icmp slt i32 %197, 20002
  br i1 %198, label %199, label %203

199:                                              ; preds = %196
  br label %200

200:                                              ; preds = %199
  %201 = load i32, ptr %10, align 4, !tbaa !5
  %202 = shl i32 %201, 1
  store i32 %202, ptr %10, align 4, !tbaa !5
  br label %196, !llvm.loop !15

203:                                              ; preds = %196
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @g, ptr align 4 getelementptr inbounds ([21 x [10001 x i32]], ptr @f, i64 0, i64 1), i64 40004, i1 false)
  %204 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z3NTTiPii(i32 noundef %204, ptr noundef @g, i32 noundef 1)
  %205 = load i32, ptr %10, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = mul i64 %206, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @h, ptr align 16 @g, i64 %207, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 2, ptr %11, align 4, !tbaa !5
  br label %208

208:                                              ; preds = %253, %203
  %209 = load i32, ptr %11, align 4, !tbaa !5
  %210 = icmp slt i32 %209, 21
  br i1 %210, label %212, label %211

211:                                              ; preds = %208
  store i32 20, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %256

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

213:                                              ; preds = %235, %212
  %214 = load i32, ptr %12, align 4, !tbaa !5
  %215 = load i32, ptr %10, align 4, !tbaa !5
  %216 = icmp slt i32 %214, %215
  br i1 %216, label %218, label %217

217:                                              ; preds = %213
  store i32 23, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %238

218:                                              ; preds = %213
  %219 = load i32, ptr %12, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [32769 x i32], ptr @g, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = load i32, ptr %12, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [32769 x i32], ptr @h, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = mul nsw i64 %223, %228
  %230 = srem i64 %229, 998244353
  %231 = trunc i64 %230 to i32
  %232 = load i32, ptr %12, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [32769 x i32], ptr @h, i64 0, i64 %233
  store i32 %231, ptr %234, align 4, !tbaa !5
  br label %235

235:                                              ; preds = %218
  %236 = load i32, ptr %12, align 4, !tbaa !5
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %12, align 4, !tbaa !5
  br label %213, !llvm.loop !16

238:                                              ; preds = %217
  %239 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z3NTTiPii(i32 noundef %239, ptr noundef @h, i32 noundef -1)
  %240 = load i32, ptr %11, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [21 x [10001 x i32]], ptr @f, i64 0, i64 %241
  %243 = getelementptr inbounds [10001 x i32], ptr %242, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %243, ptr align 16 @h, i64 40004, i1 false)
  %244 = load i32, ptr %11, align 4, !tbaa !5
  %245 = icmp eq i32 %244, 20
  br i1 %245, label %246, label %247

246:                                              ; preds = %238
  br label %253

247:                                              ; preds = %238
  %248 = load i32, ptr %10, align 4, !tbaa !5
  %249 = sub nsw i32 %248, 10001
  %250 = sext i32 %249 to i64
  %251 = mul i64 %250, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @h, i64 10001), i8 0, i64 %251, i1 false)
  %252 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z3NTTiPii(i32 noundef %252, ptr noundef @h, i32 noundef 1)
  br label %253

253:                                              ; preds = %247, %246
  %254 = load i32, ptr %11, align 4, !tbaa !5
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %11, align 4, !tbaa !5
  br label %208, !llvm.loop !17

256:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %257 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %13)
  br label %258

258:                                              ; preds = %348, %256
  %259 = load i32, ptr %13, align 4, !tbaa !5
  %260 = add nsw i32 %259, -1
  store i32 %260, ptr %13, align 4, !tbaa !5
  %261 = icmp ne i32 %259, 0
  br i1 %261, label %262, label %351

262:                                              ; preds = %258
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !5
  %263 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %14, ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %264

264:                                              ; preds = %328, %262
  %265 = load i32, ptr %17, align 4, !tbaa !5
  %266 = load i32, ptr %15, align 4, !tbaa !5
  %267 = icmp sle i32 %265, %266
  br i1 %267, label %269, label %268

268:                                              ; preds = %264
  store i32 28, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %331

269:                                              ; preds = %264
  %270 = load i32, ptr %15, align 4, !tbaa !5
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %271
  %273 = load i32, ptr %17, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [21 x i32], ptr %272, i64 0, i64 %274
  %276 = load i32, ptr %275, align 4, !tbaa !5
  %277 = icmp ne i32 %276, 0
  br i1 %277, label %279, label %278

278:                                              ; preds = %269
  br label %328

279:                                              ; preds = %269
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %280 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %280, ptr %19, align 4, !tbaa !5
  br label %281

281:                                              ; preds = %308, %279
  %282 = load i32, ptr %19, align 4, !tbaa !5
  %283 = load i32, ptr %14, align 4, !tbaa !5
  %284 = icmp sle i32 %282, %283
  br i1 %284, label %286, label %285

285:                                              ; preds = %281
  store i32 31, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %311

286:                                              ; preds = %281
  %287 = load i32, ptr %18, align 4, !tbaa !5
  %288 = sext i32 %287 to i64
  %289 = load i32, ptr %14, align 4, !tbaa !5
  %290 = load i32, ptr %19, align 4, !tbaa !5
  %291 = sub nsw i32 %289, %290
  %292 = sext i32 %291 to i64
  %293 = getelementptr inbounds [10001 x i32], ptr @pw, i64 0, i64 %292
  %294 = load i32, ptr %293, align 4, !tbaa !5
  %295 = sext i32 %294 to i64
  %296 = load i32, ptr %17, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [21 x [10001 x i32]], ptr @f, i64 0, i64 %297
  %299 = load i32, ptr %19, align 4, !tbaa !5
  %300 = sext i32 %299 to i64
  %301 = getelementptr inbounds [10001 x i32], ptr %298, i64 0, i64 %300
  %302 = load i32, ptr %301, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = mul nsw i64 %295, %303
  %305 = add nsw i64 %288, %304
  %306 = srem i64 %305, 998244353
  %307 = trunc i64 %306 to i32
  store i32 %307, ptr %18, align 4, !tbaa !5
  br label %308

308:                                              ; preds = %286
  %309 = load i32, ptr %19, align 4, !tbaa !5
  %310 = add nsw i32 %309, 1
  store i32 %310, ptr %19, align 4, !tbaa !5
  br label %281, !llvm.loop !18

311:                                              ; preds = %285
  %312 = load i32, ptr %16, align 4, !tbaa !5
  %313 = sext i32 %312 to i64
  %314 = load i32, ptr %18, align 4, !tbaa !5
  %315 = sext i32 %314 to i64
  %316 = load i32, ptr %15, align 4, !tbaa !5
  %317 = sext i32 %316 to i64
  %318 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %317
  %319 = load i32, ptr %17, align 4, !tbaa !5
  %320 = sext i32 %319 to i64
  %321 = getelementptr inbounds [21 x i32], ptr %318, i64 0, i64 %320
  %322 = load i32, ptr %321, align 4, !tbaa !5
  %323 = sext i32 %322 to i64
  %324 = mul nsw i64 %315, %323
  %325 = add nsw i64 %313, %324
  %326 = srem i64 %325, 998244353
  %327 = trunc i64 %326 to i32
  store i32 %327, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %328

328:                                              ; preds = %311, %278
  %329 = load i32, ptr %17, align 4, !tbaa !5
  %330 = add nsw i32 %329, 1
  store i32 %330, ptr %17, align 4, !tbaa !5
  br label %264, !llvm.loop !19

331:                                              ; preds = %268
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 2, ptr %20, align 4, !tbaa !5
  br label %332

332:                                              ; preds = %345, %331
  %333 = load i32, ptr %20, align 4, !tbaa !5
  %334 = load i32, ptr %14, align 4, !tbaa !5
  %335 = icmp sle i32 %333, %334
  br i1 %335, label %337, label %336

336:                                              ; preds = %332
  store i32 34, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %348

337:                                              ; preds = %332
  %338 = load i32, ptr %16, align 4, !tbaa !5
  %339 = sext i32 %338 to i64
  %340 = load i32, ptr %20, align 4, !tbaa !5
  %341 = sext i32 %340 to i64
  %342 = mul nsw i64 %339, %341
  %343 = srem i64 %342, 998244353
  %344 = trunc i64 %343 to i32
  store i32 %344, ptr %16, align 4, !tbaa !5
  br label %345

345:                                              ; preds = %337
  %346 = load i32, ptr %20, align 4, !tbaa !5
  %347 = add nsw i32 %346, 1
  store i32 %347, ptr %20, align 4, !tbaa !5
  br label %332, !llvm.loop !20

348:                                              ; preds = %336
  %349 = load i32, ptr %16, align 4, !tbaa !5
  %350 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %349)
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %258, !llvm.loop !21

351:                                              ; preds = %258
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  %352 = load i32, ptr %1, align 4
  ret i32 %352
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { "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 #8 = { 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}
!21 = distinct !{!21, !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 [32769 x i32], align 16
@inv2 = external dso_local local_unnamed_addr global [17 x i32], align 16
@inv = external dso_local local_unnamed_addr global [10001 x i32], align 16
@pw = external dso_local local_unnamed_addr global [10001 x i32], align 16
@s = external dso_local local_unnamed_addr global [21 x [21 x i32]], align 16
@f = external dso_local local_unnamed_addr global [21 x [10001 x i32]], align 16
@g = external dso_local global [32769 x i32], align 16
@h = external dso_local global [32769 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 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 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 @_Z3NTTiPii(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

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

5:                                                ; preds = %6
  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 1, ptr getelementptr inbounds (i8, ptr @f, i64 40008), align 8, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @pw, i64 4), align 4, !tbaa !5
  store i32 1, ptr @pw, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @inv, i64 4), align 4, !tbaa !5
  br label %23

6:                                                ; preds = %15, %0
  %7 = phi i32 [ %4, %0 ], [ %20, %15 ]
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next.1, %15 ]
  %8 = sext i32 %7 to i64
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = mul nsw i64 %10, %8
  %12 = srem i64 %11, 998244353
  %13 = trunc nsw i64 %12 to i32
  %14 = getelementptr inbounds [32769 x i32], ptr @w, i64 0, i64 %indvars.iv
  store i32 %13, ptr %14, align 8, !tbaa !5
  %exitcond.not = icmp eq i64 %indvars.iv, 32768
  br i1 %exitcond.not, label %5, label %15, !llvm.loop !9

15:                                               ; preds = %6
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = mul nsw i64 %12, %17
  %19 = srem i64 %18, 998244353
  %20 = trunc nsw i64 %19 to i32
  %21 = getelementptr inbounds [32769 x i32], ptr @w, i64 0, i64 %indvars.iv.next
  store i32 %20, ptr %21, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  br label %6

22:                                               ; preds = %23
  store i32 1, ptr @s, align 16, !tbaa !5
  br label %.preheader98

23:                                               ; preds = %5, %23
  %indvars.iv136 = phi i64 [ 2, %5 ], [ %indvars.iv.next137, %23 ]
  %.084103 = phi i64 [ 1, %5 ], [ %51, %23 ]
  %.085102 = phi i32 [ 1, %5 ], [ %36, %23 ]
  %indvars138 = trunc i64 %indvars.iv136 to i32
  %24 = udiv i32 998244353, %indvars138
  %25 = zext nneg i32 %24 to i64
  %26 = urem i32 998244353, %indvars138
  %27 = zext nneg i32 %26 to i64
  %28 = getelementptr inbounds [10001 x i32], ptr @inv, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = mul nsw i64 %30, %25
  %32 = srem i64 %31, 998244353
  %33 = trunc nsw i64 %32 to i32
  %34 = sub nsw i32 998244353, %33
  %35 = getelementptr inbounds [10001 x i32], ptr @inv, i64 0, i64 %indvars.iv136
  store i32 %34, ptr %35, align 4, !tbaa !5
  %36 = tail call noundef i32 @_Z7mod_addii(i32 noundef %.085102, i32 noundef %.085102)
  %37 = add nsw i64 %indvars.iv136, -1
  %38 = getelementptr inbounds [10001 x i32], ptr @pw, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = sext i32 %36 to i64
  %42 = mul nsw i64 %40, %41
  %43 = srem i64 %42, 998244353
  %44 = load i32, ptr %35, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = mul nsw i64 %43, %45
  %47 = srem i64 %46, 998244353
  %48 = trunc nsw i64 %47 to i32
  %49 = getelementptr inbounds [10001 x i32], ptr @pw, i64 0, i64 %indvars.iv136
  store i32 %48, ptr %49, align 4, !tbaa !5
  %50 = mul nsw i64 %.084103, %45
  %51 = srem i64 %50, 998244353
  %52 = add nsw i32 %indvars138, -2
  %53 = tail call noundef i32 @_Z7mod_powii(i32 noundef %indvars138, i32 noundef %52)
  %54 = sext i32 %53 to i64
  %55 = mul nsw i64 %51, %54
  %56 = srem i64 %55, 998244353
  %57 = trunc nsw i64 %56 to i32
  %58 = getelementptr inbounds [10001 x i32], ptr getelementptr inbounds (i8, ptr @f, i64 40004), i64 0, i64 %indvars.iv136
  store i32 %57, ptr %58, align 4, !tbaa !5
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %exitcond139.not = icmp eq i64 %indvars.iv.next137, 10001
  br i1 %exitcond139.not, label %22, label %23, !llvm.loop !11

.preheader98:                                     ; preds = %22, %._crit_edge
  %indvar = phi i64 [ 0, %22 ], [ %indvar.next, %._crit_edge ]
  %indvars.iv144 = phi i64 [ 1, %22 ], [ %indvars.iv.next145, %._crit_edge ]
  %59 = icmp ugt i64 %indvars.iv144, 1
  br i1 %59, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader98
  %60 = add nsw i64 %indvars.iv144, -1
  %.phi.trans.insert = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %60, i64 0
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  %xtraiter = and i64 %indvar, 1
  %61 = icmp eq i64 %indvar, 1
  br i1 %61, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %indvar, -2
  br label %72

._crit_edge.loopexit.unr-lcssa:                   ; preds = %72, %.lr.ph
  %.unr = phi i32 [ %.pre, %.lr.ph ], [ %85, %72 ]
  %indvars.iv140.unr = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next141.1, %72 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %62 = sext i32 %.unr to i64
  %63 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %60, i64 %indvars.iv140.unr
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = mul nsw i64 %indvars.iv140.unr, %65
  %67 = add nsw i64 %66, %62
  %68 = srem i64 %67, 998244353
  %69 = trunc nsw i64 %68 to i32
  %70 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %indvars.iv144, i64 %indvars.iv140.unr
  store i32 %69, ptr %70, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %.preheader98
  %71 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %indvars.iv144, i64 %indvars.iv144
  store i32 1, ptr %71, align 4, !tbaa !5
  %indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
  %exitcond147.not = icmp eq i64 %indvars.iv.next145, 21
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond147.not, label %.preheader97.preheader, label %.preheader98, !llvm.loop !12

.preheader97.preheader:                           ; preds = %._crit_edge
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(40004) @g, ptr noundef nonnull align 4 dereferenceable(40004) getelementptr inbounds (i8, ptr @f, i64 40004), i64 40004, i1 false)
  tail call void @_Z3NTTiPii(i32 noundef 32768, ptr noundef nonnull @g, i32 noundef 1)
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(131072) @h, ptr noundef nonnull align 16 dereferenceable(131072) @g, i64 131072, i1 false)
  br label %.preheader96

72:                                               ; preds = %72, %.lr.ph.new
  %73 = phi i32 [ %.pre, %.lr.ph.new ], [ %85, %72 ]
  %indvars.iv140 = phi i64 [ 1, %.lr.ph.new ], [ %indvars.iv.next141.1, %72 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %72 ]
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %60, i64 %indvars.iv140
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = mul nsw i64 %indvars.iv140, %77
  %79 = add nsw i64 %78, %74
  %80 = srem i64 %79, 998244353
  %81 = trunc nsw i64 %80 to i32
  %82 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %indvars.iv144, i64 %indvars.iv140
  store i32 %81, ptr %82, align 4, !tbaa !5
  %indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
  %83 = sext i32 %76 to i64
  %84 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %60, i64 %indvars.iv.next141
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = mul nsw i64 %indvars.iv.next141, %86
  %88 = add nsw i64 %87, %83
  %89 = srem i64 %88, 998244353
  %90 = trunc nsw i64 %89 to i32
  %91 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %indvars.iv144, i64 %indvars.iv.next141
  store i32 %90, ptr %91, align 4, !tbaa !5
  %indvars.iv.next141.1 = add nuw nsw i64 %indvars.iv140, 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_edge.loopexit.unr-lcssa, label %72, !llvm.loop !13

.preheader96:                                     ; preds = %118, %.preheader97.preheader
  %indvars.iv152 = phi i64 [ 2, %.preheader97.preheader ], [ %indvars.iv.next153, %118 ]
  br label %99

92:                                               ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %93 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %94 = load i32, ptr %1, align 4, !tbaa !5
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr %1, align 4, !tbaa !5
  %.not126 = icmp eq i32 %94, 0
  br i1 %.not126, label %._crit_edge129, label %.lr.ph128

96:                                               ; preds = %99
  tail call void @_Z3NTTiPii(i32 noundef 32768, ptr noundef nonnull @h, i32 noundef -1)
  %97 = getelementptr inbounds [21 x [10001 x i32]], ptr @f, i64 0, i64 %indvars.iv152
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(40004) %97, ptr noundef nonnull align 16 dereferenceable(40004) @h, i64 40004, i1 false)
  %98 = icmp eq i64 %indvars.iv152, 20
  br i1 %98, label %92, label %118

99:                                               ; preds = %99, %.preheader96
  %indvars.iv148 = phi i64 [ 0, %.preheader96 ], [ %indvars.iv.next149.1, %99 ]
  %100 = getelementptr inbounds [32769 x i32], ptr @g, i64 0, i64 %indvars.iv148
  %101 = load i32, ptr %100, align 8, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [32769 x i32], ptr @h, i64 0, i64 %indvars.iv148
  %104 = load i32, ptr %103, align 8, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = mul nsw i64 %105, %102
  %107 = srem i64 %106, 998244353
  %108 = trunc nsw i64 %107 to i32
  store i32 %108, ptr %103, align 8, !tbaa !5
  %indvars.iv.next149 = or disjoint i64 %indvars.iv148, 1
  %109 = getelementptr inbounds [32769 x i32], ptr @g, i64 0, i64 %indvars.iv.next149
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [32769 x i32], ptr @h, i64 0, i64 %indvars.iv.next149
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = mul nsw i64 %114, %111
  %116 = srem i64 %115, 998244353
  %117 = trunc nsw i64 %116 to i32
  store i32 %117, ptr %112, align 4, !tbaa !5
  %indvars.iv.next149.1 = add nuw nsw i64 %indvars.iv148, 2
  %exitcond151.not.1 = icmp eq i64 %indvars.iv.next149.1, 32768
  br i1 %exitcond151.not.1, label %96, label %99, !llvm.loop !14

118:                                              ; preds = %96
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(91068) getelementptr inbounds (i8, ptr @h, i64 40004), i8 0, i64 91068, i1 false)
  tail call void @_Z3NTTiPii(i32 noundef 32768, ptr noundef nonnull @h, i32 noundef 1)
  %indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
  br label %.preheader96

.lr.ph128:                                        ; preds = %92, %._crit_edge124
  %119 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %120 = load i32, ptr %3, align 4, !tbaa !5
  %.not91113 = icmp slt i32 %120, 0
  %.pre170 = load i32, ptr %2, align 4
  br i1 %.not91113, label %.preheader95, label %.lr.ph118

.lr.ph118:                                        ; preds = %.lr.ph128
  %121 = zext nneg i32 %120 to i64
  %122 = sext i32 %.pre170 to i64
  %123 = add i32 %.pre170, 1
  %124 = add nuw i32 %120, 1
  %wide.trip.count163 = zext i32 %124 to i64
  %wide.trip.count = zext i32 %123 to i64
  br label %129

.preheader95:                                     ; preds = %148, %.lr.ph128
  %.078.lcssa = phi i32 [ 0, %.lr.ph128 ], [ %.1, %148 ]
  %.not92120 = icmp slt i32 %.pre170, 2
  br i1 %.not92120, label %._crit_edge124, label %.lr.ph123.preheader

.lr.ph123.preheader:                              ; preds = %.preheader95
  %125 = add nuw i32 %.pre170, 1
  %wide.trip.count168 = zext i32 %125 to i64
  %xtraiter176 = and i64 %wide.trip.count168, 1
  %126 = icmp eq i32 %125, 3
  br i1 %126, label %._crit_edge124.loopexit.unr-lcssa, label %.lr.ph123.preheader.new

.lr.ph123.preheader.new:                          ; preds = %.lr.ph123.preheader
  %127 = and i64 %wide.trip.count168, 4294967294
  %128 = add nsw i64 %127, -4
  br label %.lr.ph123

129:                                              ; preds = %.lr.ph118, %148
  %indvars.iv156 = phi i64 [ 0, %.lr.ph118 ], [ %indvars.iv.next157, %148 ]
  %.078114 = phi i32 [ 0, %.lr.ph118 ], [ %.1, %148 ]
  %130 = getelementptr inbounds [21 x [21 x i32]], ptr @s, i64 0, i64 %121, i64 %indvars.iv156
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %.not93 = icmp eq i32 %131, 0
  br i1 %.not93, label %148, label %.preheader

.preheader:                                       ; preds = %129
  %.not94108 = icmp sgt i64 %indvars.iv156, %122
  br i1 %.not94108, label %._crit_edge112, label %.lr.ph111

._crit_edge112:                                   ; preds = %.lr.ph111, %.preheader
  %.076.lcssa = phi i64 [ 0, %.preheader ], [ %147, %.lr.ph111 ]
  %132 = sext i32 %.078114 to i64
  %133 = sext i32 %131 to i64
  %134 = mul nsw i64 %.076.lcssa, %133
  %135 = add nsw i64 %134, %132
  %136 = srem i64 %135, 998244353
  %137 = trunc nsw i64 %136 to i32
  br label %148

.lr.ph111:                                        ; preds = %.preheader, %.lr.ph111
  %indvars.iv158 = phi i64 [ %indvars.iv.next159, %.lr.ph111 ], [ %indvars.iv156, %.preheader ]
  %.076109 = phi i64 [ %147, %.lr.ph111 ], [ 0, %.preheader ]
  %138 = sub nsw i64 %122, %indvars.iv158
  %139 = getelementptr inbounds [10001 x i32], ptr @pw, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [21 x [10001 x i32]], ptr @f, i64 0, i64 %indvars.iv156, i64 %indvars.iv158
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = mul nsw i64 %144, %141
  %146 = add nsw i64 %145, %.076109
  %147 = srem i64 %146, 998244353
  %indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1
  %exitcond161.not = icmp eq i64 %indvars.iv.next159, %wide.trip.count
  br i1 %exitcond161.not, label %._crit_edge112, label %.lr.ph111, !llvm.loop !15

148:                                              ; preds = %129, %._crit_edge112
  %.1 = phi i32 [ %137, %._crit_edge112 ], [ %.078114, %129 ]
  %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
  %exitcond164.not = icmp eq i64 %indvars.iv.next157, %wide.trip.count163
  br i1 %exitcond164.not, label %.preheader95, label %129, !llvm.loop !16

._crit_edge124.loopexit.unr-lcssa:                ; preds = %.lr.ph123, %.lr.ph123.preheader
  %.lcssa175.ph = phi i32 [ poison, %.lr.ph123.preheader ], [ %161, %.lr.ph123 ]
  %indvars.iv165.unr = phi i64 [ 2, %.lr.ph123.preheader ], [ %indvars.iv.next166.1, %.lr.ph123 ]
  %.2121.unr = phi i32 [ %.078.lcssa, %.lr.ph123.preheader ], [ %161, %.lr.ph123 ]
  %lcmp.mod177.not = icmp eq i64 %xtraiter176, 0
  br i1 %lcmp.mod177.not, label %._crit_edge124, label %.lr.ph123.epil

.lr.ph123.epil:                                   ; preds = %._crit_edge124.loopexit.unr-lcssa
  %149 = sext i32 %.2121.unr to i64
  %150 = mul nsw i64 %indvars.iv165.unr, %149
  %151 = srem i64 %150, 998244353
  %152 = trunc nsw i64 %151 to i32
  br label %._crit_edge124

._crit_edge124:                                   ; preds = %.lr.ph123.epil, %._crit_edge124.loopexit.unr-lcssa, %.preheader95
  %.2.lcssa = phi i32 [ %.078.lcssa, %.preheader95 ], [ %.lcssa175.ph, %._crit_edge124.loopexit.unr-lcssa ], [ %152, %.lr.ph123.epil ]
  %153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.2.lcssa)
  %154 = load i32, ptr %1, align 4, !tbaa !5
  %155 = add nsw i32 %154, -1
  store i32 %155, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %154, 0
  br i1 %.not, label %._crit_edge129, label %.lr.ph128, !llvm.loop !17

.lr.ph123:                                        ; preds = %.lr.ph123, %.lr.ph123.preheader.new
  %indvars.iv165 = phi i64 [ 2, %.lr.ph123.preheader.new ], [ %indvars.iv.next166.1, %.lr.ph123 ]
  %.2121 = phi i32 [ %.078.lcssa, %.lr.ph123.preheader.new ], [ %161, %.lr.ph123 ]
  %niter180 = phi i64 [ 0, %.lr.ph123.preheader.new ], [ %niter180.next.1, %.lr.ph123 ]
  %156 = sext i32 %.2121 to i64
  %157 = mul nsw i64 %indvars.iv165, %156
  %158 = srem i64 %157, 998244353
  %indvars.iv.next166 = or disjoint i64 %indvars.iv165, 1
  %159 = mul nsw i64 %indvars.iv.next166, %158
  %160 = srem i64 %159, 998244353
  %161 = trunc nsw i64 %160 to i32
  %indvars.iv.next166.1 = add nuw nsw i64 %indvars.iv165, 2
  %niter180.next.1 = add i64 %niter180, 2
  %niter180.ncmp.1 = icmp eq i64 %niter180, %128
  br i1 %niter180.ncmp.1, label %._crit_edge124.loopexit.unr-lcssa, label %.lr.ph123, !llvm.loop !18

._crit_edge129:                                   ; preds = %._crit_edge124, %92
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

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

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


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