; LLVM IR from tangjz/acm-icpc :: 51nod (1198)

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

%struct.Poly = type { i32, [122 x i32] }

@iact = external dso_local global [62 x i32], align 16
@t = external dso_local global i32, align 4
@deg = external dso_local global i32, align 4
@val = external dso_local global [62 x i32], align 16
@nxt = external dso_local global [62 x i32], align 16
@seq = external dso_local global [62 x i32], align 16
@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@A = external dso_local global %struct.Poly, align 4
@B = external dso_local global %struct.Poly, align 4
@M = external dso_local global %struct.Poly, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 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 @_Z5valuei(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 norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %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 %struct.Poly, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.Poly, align 4
  %18 = alloca %struct.Poly, align 4
  %19 = alloca %struct.Poly, align 4
  %20 = alloca %struct.Poly, align 4
  %21 = alloca %struct.Poly, align 4
  %22 = alloca %struct.Poly, align 4
  store i32 0, ptr %1, align 4
  store i32 0, ptr @iact, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([62 x i32], ptr @iact, 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 %23

23:                                               ; preds = %44, %0
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp sle i32 %24, 61
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %23
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sdiv i32 1000000007, %28
  %30 = sext i32 %29 to i64
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = srem i32 1000000007, %31
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = mul nsw i64 %30, %36
  %38 = srem i64 %37, 1000000007
  %39 = sub nsw i64 1000000007, %38
  %40 = trunc i64 %39 to i32
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %42
  store i32 %40, ptr %43, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %27
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %2, align 4, !tbaa !5
  br label %23, !llvm.loop !9

47:                                               ; preds = %26
  store i32 1, ptr @iact, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %70, %47
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = icmp sle i32 %49, 61
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %48
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sub nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = mul nsw i64 %58, %63
  %65 = srem i64 %64, 1000000007
  %66 = trunc i64 %65 to i32
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %68
  store i32 %66, ptr %69, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %52
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %3, align 4, !tbaa !5
  br label %48, !llvm.loop !11

73:                                               ; preds = %51
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %75

75:                                               ; preds = %292, %73
  %76 = load i32, ptr @t, align 4, !tbaa !5
  %77 = add nsw i32 %76, -1
  store i32 %77, ptr @t, align 4, !tbaa !5
  %78 = icmp ne i32 %76, 0
  br i1 %78, label %79, label %295

79:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %81 = load i64, ptr @n, align 8, !tbaa !12
  %82 = shl i64 %81, 1
  %83 = sub nsw i64 %82, 1
  store i64 %83, ptr %5, align 8, !tbaa !12
  store i32 1, ptr @val, align 16, !tbaa !5
  store i32 1, ptr @deg, align 4, !tbaa !5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %149, %79
  %85 = load i64, ptr %5, align 8, !tbaa !12
  %86 = add nsw i64 %85, -1
  store i64 %86, ptr %5, align 8, !tbaa !12
  %87 = icmp sge i64 %86, 0
  br i1 %87, label %88, label %152

88:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %89 = load i64, ptr %5, align 8, !tbaa !12
  %90 = and i64 %89, 1
  %91 = trunc i64 %90 to i32
  store i32 %91, ptr %7, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %115, %88
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = load i32, ptr @deg, align 4, !tbaa !5
  %95 = icmp sle i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %120

97:                                               ; preds = %92
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = icmp sgt i32 %98, 0
  br i1 %99, label %100, label %106

100:                                              ; preds = %97
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sub nsw i32 %101, 1
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  br label %107

106:                                              ; preds = %97
  br label %107

107:                                              ; preds = %106, %100
  %108 = phi i32 [ %105, %100 ], [ 0, %106 ]
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = call noundef i32 @_Z5valuei(i32 noundef %109)
  %111 = call noundef i32 @_Z7mod_addii(i32 noundef %108, i32 noundef %110)
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %113
  store i32 %111, ptr %114, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %107
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %6, align 4, !tbaa !5
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = call noundef i32 @_Z7mod_addii(i32 noundef %118, i32 noundef 2)
  store i32 %119, ptr %7, align 4, !tbaa !5
  br label %92, !llvm.loop !14

120:                                              ; preds = %96
  %121 = load i32, ptr @deg, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr @deg, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %136, %120
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = load i32, ptr @deg, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %128, label %127

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

128:                                              ; preds = %123
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [62 x i32], ptr @val, i64 0, i64 %134
  store i32 %132, ptr %135, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %128
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %8, align 4, !tbaa !5
  br label %123, !llvm.loop !15

139:                                              ; preds = %127
  %140 = load i64, ptr %5, align 8, !tbaa !12
  %141 = ashr i64 %140, 1
  store i64 %141, ptr %5, align 8, !tbaa !12
  %142 = load i64, ptr %5, align 8, !tbaa !12
  %143 = srem i64 %142, 1000000007
  %144 = trunc i64 %143 to i32
  %145 = call noundef i32 @_Z5valuei(i32 noundef %144)
  %146 = load i32, ptr %4, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [62 x i32], ptr @seq, i64 0, i64 %147
  store i32 %145, ptr %148, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %139
  %150 = load i32, ptr %4, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %4, align 4, !tbaa !5
  br label %84, !llvm.loop !16

152:                                              ; preds = %84
  %153 = load i32, ptr %4, align 4, !tbaa !5
  %154 = add nsw i32 %153, -1
  store i32 %154, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %155 = load i64, ptr @n, align 8, !tbaa !12
  %156 = sub nsw i64 %155, 1
  store i64 %156, ptr %9, align 8, !tbaa !12
  store i32 1, ptr @val, align 16, !tbaa !5
  store i32 1, ptr @deg, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %157

157:                                              ; preds = %228, %152
  %158 = load i64, ptr %9, align 8, !tbaa !12
  %159 = add nsw i64 %158, -1
  store i64 %159, ptr %9, align 8, !tbaa !12
  %160 = icmp sge i64 %159, 0
  br i1 %160, label %162, label %161

161:                                              ; preds = %157
  store i32 19, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %231

162:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %163 = load i64, ptr %9, align 8, !tbaa !12
  %164 = and i64 %163, 1
  %165 = trunc i64 %164 to i32
  store i32 %165, ptr %13, align 4, !tbaa !5
  br label %166

166:                                              ; preds = %189, %162
  %167 = load i32, ptr %12, align 4, !tbaa !5
  %168 = load i32, ptr @deg, align 4, !tbaa !5
  %169 = icmp sle i32 %167, %168
  br i1 %169, label %171, label %170

170:                                              ; preds = %166
  store i32 22, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %194

171:                                              ; preds = %166
  %172 = load i32, ptr %12, align 4, !tbaa !5
  %173 = icmp sgt i32 %172, 0
  br i1 %173, label %174, label %180

174:                                              ; preds = %171
  %175 = load i32, ptr %12, align 4, !tbaa !5
  %176 = sub nsw i32 %175, 1
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !5
  br label %181

180:                                              ; preds = %171
  br label %181

181:                                              ; preds = %180, %174
  %182 = phi i32 [ %179, %174 ], [ 0, %180 ]
  %183 = load i32, ptr %13, align 4, !tbaa !5
  %184 = call noundef i32 @_Z5valuei(i32 noundef %183)
  %185 = call noundef i32 @_Z7mod_addii(i32 noundef %182, i32 noundef %184)
  %186 = load i32, ptr %12, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %187
  store i32 %185, ptr %188, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %181
  %190 = load i32, ptr %12, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %12, align 4, !tbaa !5
  %192 = load i32, ptr %13, align 4, !tbaa !5
  %193 = call noundef i32 @_Z7mod_addii(i32 noundef %192, i32 noundef 2)
  store i32 %193, ptr %13, align 4, !tbaa !5
  br label %166, !llvm.loop !17

194:                                              ; preds = %170
  %195 = load i32, ptr @deg, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr @deg, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %210, %194
  %198 = load i32, ptr %14, align 4, !tbaa !5
  %199 = load i32, ptr @deg, align 4, !tbaa !5
  %200 = icmp slt i32 %198, %199
  br i1 %200, label %202, label %201

201:                                              ; preds = %197
  store i32 25, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %213

202:                                              ; preds = %197
  %203 = load i32, ptr %14, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %207 = load i32, ptr %14, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [62 x i32], ptr @val, i64 0, i64 %208
  store i32 %206, ptr %209, align 4, !tbaa !5
  br label %210

210:                                              ; preds = %202
  %211 = load i32, ptr %14, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %14, align 4, !tbaa !5
  br label %197, !llvm.loop !18

213:                                              ; preds = %201
  %214 = load i64, ptr %9, align 8, !tbaa !12
  %215 = ashr i64 %214, 1
  store i64 %215, ptr %9, align 8, !tbaa !12
  %216 = load i32, ptr %10, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [62 x i32], ptr @seq, i64 0, i64 %217
  %219 = load i32, ptr %218, align 4, !tbaa !5
  %220 = load i64, ptr %9, align 8, !tbaa !12
  %221 = srem i64 %220, 1000000007
  %222 = trunc i64 %221 to i32
  %223 = call noundef i32 @_Z5valuei(i32 noundef %222)
  %224 = call noundef i32 @_Z7mod_decii(i32 noundef %219, i32 noundef %223)
  %225 = load i32, ptr %10, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [62 x i32], ptr @seq, i64 0, i64 %226
  store i32 %224, ptr %227, align 4, !tbaa !5
  br label %228

228:                                              ; preds = %213
  %229 = load i32, ptr %10, align 4, !tbaa !5
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %10, align 4, !tbaa !5
  br label %157, !llvm.loop !19

231:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 492, ptr %15) #8
  call void @llvm.memset.p0.i64(ptr align 4 %15, i8 0, i64 492, i1 false)
  %232 = getelementptr inbounds %struct.Poly, ptr %15, i32 0, i32 0
  %233 = load i32, ptr %4, align 4, !tbaa !5
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %232, align 4, !tbaa !20
  %235 = getelementptr inbounds %struct.Poly, ptr %15, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @M, ptr align 4 %15, i64 492, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 492, ptr %15) #8
  %236 = load i32, ptr %4, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [122 x i32], ptr getelementptr inbounds (%struct.Poly, ptr @M, i32 0, i32 1), i64 0, i64 %237
  store i32 1, ptr %238, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %239

239:                                              ; preds = %255, %231
  %240 = load i32, ptr %16, align 4, !tbaa !5
  %241 = load i32, ptr %4, align 4, !tbaa !5
  %242 = icmp slt i32 %240, %241
  br i1 %242, label %244, label %243

243:                                              ; preds = %239
  store i32 28, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %258

244:                                              ; preds = %239
  %245 = load i32, ptr %4, align 4, !tbaa !5
  %246 = load i32, ptr %16, align 4, !tbaa !5
  %247 = sub nsw i32 %245, %246
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [62 x i32], ptr @seq, i64 0, i64 %248
  %250 = load i32, ptr %249, align 4, !tbaa !5
  %251 = sub nsw i32 1000000007, %250
  %252 = load i32, ptr %16, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [122 x i32], ptr getelementptr inbounds (%struct.Poly, ptr @M, i32 0, i32 1), i64 0, i64 %253
  store i32 %251, ptr %254, align 4, !tbaa !5
  br label %255

255:                                              ; preds = %244
  %256 = load i32, ptr %16, align 4, !tbaa !5
  %257 = add nsw i32 %256, 1
  store i32 %257, ptr %16, align 4, !tbaa !5
  br label %239, !llvm.loop !24

258:                                              ; preds = %243
  call void @llvm.lifetime.start.p0(i64 492, ptr %17) #8
  call void @llvm.memset.p0.i64(ptr align 4 %17, i8 0, i64 492, i1 false)
  %259 = getelementptr inbounds %struct.Poly, ptr %17, i32 0, i32 0
  store i32 1, ptr %259, align 4, !tbaa !20
  %260 = getelementptr inbounds %struct.Poly, ptr %17, i32 0, i32 1
  store i32 1, ptr %260, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @A, ptr align 4 %17, i64 492, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 492, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 492, ptr %18) #8
  call void @llvm.memset.p0.i64(ptr align 4 %18, i8 0, i64 492, i1 false)
  %261 = getelementptr inbounds %struct.Poly, ptr %18, i32 0, i32 0
  store i32 2, ptr %261, align 4, !tbaa !20
  %262 = getelementptr inbounds %struct.Poly, ptr %18, i32 0, i32 1
  %263 = getelementptr inbounds i32, ptr %262, i64 1
  store i32 1, ptr %263, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @B, ptr align 4 %18, i64 492, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 492, ptr %18) #8
  %264 = load i32, ptr %4, align 4, !tbaa !5
  %265 = sub nsw i32 %264, 1
  %266 = sext i32 %265 to i64
  %267 = load i64, ptr @m, align 8, !tbaa !12
  %268 = add nsw i64 %267, %266
  store i64 %268, ptr @m, align 8, !tbaa !12
  br label %269

269:                                              ; preds = %278, %258
  %270 = load i64, ptr @m, align 8, !tbaa !12
  %271 = icmp sgt i64 %270, 0
  br i1 %271, label %272, label %281

272:                                              ; preds = %269
  %273 = load i64, ptr @m, align 8, !tbaa !12
  %274 = and i64 %273, 1
  %275 = icmp ne i64 %274, 0
  br i1 %275, label %276, label %277

276:                                              ; preds = %272
  call void @llvm.lifetime.start.p0(i64 492, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 492, ptr %20) #8
  call void @_ZNK4PolymlERKS_(ptr dead_on_unwind writable sret(%struct.Poly) align 4 %20, ptr noundef nonnull align 4 dereferenceable(492) @A, ptr noundef nonnull align 4 dereferenceable(492) @B)
  call void @_ZNK4PolyrmERKS_(ptr dead_on_unwind writable sret(%struct.Poly) align 4 %19, ptr noundef nonnull align 4 dereferenceable(492) %20, ptr noundef nonnull align 4 dereferenceable(492) @M)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @A, ptr align 4 %19, i64 492, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 492, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 492, ptr %19) #8
  br label %277

277:                                              ; preds = %276, %272
  br label %278

278:                                              ; preds = %277
  %279 = load i64, ptr @m, align 8, !tbaa !12
  %280 = ashr i64 %279, 1
  store i64 %280, ptr @m, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 492, ptr %21) #8
  call void @llvm.lifetime.start.p0(i64 492, ptr %22) #8
  call void @_ZNK4PolymlERKS_(ptr dead_on_unwind writable sret(%struct.Poly) align 4 %22, ptr noundef nonnull align 4 dereferenceable(492) @B, ptr noundef nonnull align 4 dereferenceable(492) @B)
  call void @_ZNK4PolyrmERKS_(ptr dead_on_unwind writable sret(%struct.Poly) align 4 %21, ptr noundef nonnull align 4 dereferenceable(492) %22, ptr noundef nonnull align 4 dereferenceable(492) @M)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @B, ptr align 4 %21, i64 492, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 492, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 492, ptr %21) #8
  br label %269, !llvm.loop !25

281:                                              ; preds = %269
  %282 = load i32, ptr @A, align 4, !tbaa !20
  %283 = load i32, ptr %4, align 4, !tbaa !5
  %284 = icmp eq i32 %282, %283
  br i1 %284, label %285, label %291

285:                                              ; preds = %281
  %286 = load i32, ptr %4, align 4, !tbaa !5
  %287 = sub nsw i32 %286, 1
  %288 = sext i32 %287 to i64
  %289 = getelementptr inbounds [122 x i32], ptr getelementptr inbounds (%struct.Poly, ptr @A, i32 0, i32 1), i64 0, i64 %288
  %290 = load i32, ptr %289, align 4, !tbaa !5
  br label %292

291:                                              ; preds = %281
  br label %292

292:                                              ; preds = %291, %285
  %293 = phi i32 [ %290, %285 ], [ 0, %291 ]
  %294 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %293)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %75, !llvm.loop !26

295:                                              ; preds = %75
  ret i32 0
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK4PolymlERKS_(ptr dead_on_unwind noalias writable sret(%struct.Poly) align 4, ptr noundef nonnull align 4 dereferenceable(492), ptr noundef nonnull align 4 dereferenceable(492)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4PolyrmERKS_(ptr dead_on_unwind noalias writable sret(%struct.Poly) align 4, ptr noundef nonnull align 4 dereferenceable(492), ptr noundef nonnull align 4 dereferenceable(492)) #7 align 2

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

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

%struct.Poly = type { i32, [122 x i32] }

@iact = external dso_local local_unnamed_addr global [62 x i32], align 16
@t = external dso_local global i32, align 4
@deg = external dso_local local_unnamed_addr global i32, align 4
@val = external dso_local local_unnamed_addr global [62 x i32], align 16
@nxt = external dso_local local_unnamed_addr global [62 x i32], align 16
@seq = external dso_local local_unnamed_addr global [62 x i32], align 16
@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@A = external dso_local global %struct.Poly, align 4
@B = external dso_local global %struct.Poly, align 4
@M = external dso_local global %struct.Poly, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 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 @_Z5valuei(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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca %struct.Poly, align 4
  %2 = alloca %struct.Poly, align 4
  %3 = alloca %struct.Poly, align 4
  %4 = alloca %struct.Poly, align 4
  store i32 0, ptr @iact, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @iact, i64 4), align 4, !tbaa !5
  br label %6

5:                                                ; preds = %6
  store i32 1, ptr @iact, align 16, !tbaa !5
  br label %24

6:                                                ; preds = %0, %6
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next, %6 ]
  %7 = trunc nuw nsw i64 %indvars.iv to i32
  %8 = udiv i32 1000000007, %7
  %9 = zext nneg i32 %8 to i64
  %10 = urem i32 1000000007, %7
  %11 = zext nneg i32 %10 to i64
  %12 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %11
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = mul nsw i64 %14, %9
  %16 = srem i64 %15, 1000000007
  %17 = trunc nsw i64 %16 to i32
  %18 = sub nsw i32 1000000007, %17
  %19 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %indvars.iv
  store i32 %18, ptr %19, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 62
  br i1 %exitcond.not, label %5, label %6, !llvm.loop !9

20:                                               ; preds = %24
  %21 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %22 = load i32, ptr @t, align 4, !tbaa !5
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr @t, align 4, !tbaa !5
  %.not127 = icmp eq i32 %22, 0
  br i1 %.not127, label %._crit_edge130, label %.lr.ph129

24:                                               ; preds = %32, %5
  %25 = phi i64 [ 1, %5 ], [ %37, %32 ]
  %indvars.iv137 = phi i64 [ 1, %5 ], [ %indvars.iv.next138.1, %32 ]
  %26 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %indvars.iv137
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = mul nsw i64 %25, %28
  %30 = srem i64 %29, 1000000007
  %31 = trunc nsw i64 %30 to i32
  store i32 %31, ptr %26, align 4, !tbaa !5
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %exitcond140.not = icmp eq i64 %indvars.iv.next138, 62
  br i1 %exitcond140.not, label %20, label %32, !llvm.loop !11

32:                                               ; preds = %24
  %33 = getelementptr inbounds [62 x i32], ptr @iact, i64 0, i64 %indvars.iv.next138
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = mul nsw i64 %30, %35
  %37 = srem i64 %36, 1000000007
  %38 = trunc nsw i64 %37 to i32
  store i32 %38, ptr %33, align 4, !tbaa !5
  %indvars.iv.next138.1 = add nuw nsw i64 %indvars.iv137, 2
  br label %24

.lr.ph129:                                        ; preds = %20, %141
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %40 = load i64, ptr @n, align 8, !tbaa !12
  %41 = shl i64 %40, 1
  store i32 1, ptr @val, align 16, !tbaa !5
  store i32 1, ptr @deg, align 4, !tbaa !5
  %42 = icmp sgt i64 %41, 1
  br i1 %42, label %.lr.ph101.preheader, label %._crit_edge102

.lr.ph101.preheader:                              ; preds = %.lr.ph129
  %43 = add nsw i64 %41, -2
  br label %.lr.ph101

.lr.ph101thread-pre-split:                        ; preds = %._crit_edge98
  %44 = add nsw i64 %66, -1
  %.pr167 = load i32, ptr @deg, align 4, !tbaa !5
  br label %.lr.ph101

.lr.ph101:                                        ; preds = %.lr.ph101thread-pre-split, %.lr.ph101.preheader
  %45 = phi i32 [ %.pr167, %.lr.ph101thread-pre-split ], [ 1, %.lr.ph101.preheader ]
  %indvars.iv148 = phi i64 [ %indvars.iv.next149, %.lr.ph101thread-pre-split ], [ 1, %.lr.ph101.preheader ]
  %46 = phi i64 [ %44, %.lr.ph101thread-pre-split ], [ %43, %.lr.ph101.preheader ]
  %.not8491 = icmp slt i32 %45, 0
  br i1 %.not8491, label %._crit_edge.thread, label %.lr.ph.preheader

._crit_edge.thread:                               ; preds = %.lr.ph101
  %47 = add nsw i32 %45, 1
  store i32 %47, ptr @deg, align 4, !tbaa !5
  br label %._crit_edge98

.lr.ph.preheader:                                 ; preds = %.lr.ph101
  %48 = trunc i64 %46 to i32
  %49 = and i32 %48, 1
  %50 = call noundef i32 @_Z5valuei(i32 noundef %49)
  %51 = call noundef i32 @_Z7mod_addii(i32 noundef 0, i32 noundef %50)
  store i32 %51, ptr @nxt, align 16, !tbaa !5
  %52 = call noundef i32 @_Z7mod_addii(i32 noundef %49, i32 noundef 2)
  %53 = load i32, ptr @deg, align 4, !tbaa !5
  %.not84.not.peel = icmp sgt i32 %53, 0
  br i1 %.not84.not.peel, label %.lr.ph.peel.next, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.peel.next, %.lr.ph.preheader
  %.lcssa = phi i32 [ %53, %.lr.ph.preheader ], [ %64, %.lr.ph.peel.next ]
  %54 = add i32 %.lcssa, 1
  store i32 %54, ptr @deg, align 4, !tbaa !5
  %.not8794 = icmp slt i32 %.lcssa, 0
  br i1 %.not8794, label %._crit_edge98, label %.lr.ph97.preheader

.lr.ph97.preheader:                               ; preds = %._crit_edge
  %55 = zext i32 %54 to i64
  %56 = shl nuw nsw i64 %55, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @val, ptr nonnull align 16 @nxt, i64 %56, i1 false), !tbaa !5
  br label %._crit_edge98

.lr.ph.peel.next:                                 ; preds = %.lr.ph.preheader, %.lr.ph.peel.next
  %indvars.iv141 = phi i64 [ %indvars.iv.next142, %.lr.ph.peel.next ], [ 1, %.lr.ph.preheader ]
  %.07093 = phi i32 [ %63, %.lr.ph.peel.next ], [ %52, %.lr.ph.preheader ]
  %57 = add nsw i64 %indvars.iv141, -1
  %58 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = call noundef i32 @_Z5valuei(i32 noundef %.07093)
  %61 = call noundef i32 @_Z7mod_addii(i32 noundef %59, i32 noundef %60)
  %62 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %indvars.iv141
  store i32 %61, ptr %62, align 4, !tbaa !5
  %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
  %63 = call noundef i32 @_Z7mod_addii(i32 noundef %.07093, i32 noundef 2)
  %64 = load i32, ptr @deg, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %.not84.not = icmp slt i64 %indvars.iv141, %65
  br i1 %.not84.not, label %.lr.ph.peel.next, label %._crit_edge, !llvm.loop !14

._crit_edge98:                                    ; preds = %._crit_edge.thread, %.lr.ph97.preheader, %._crit_edge
  %66 = lshr i64 %46, 1
  %67 = urem i64 %66, 1000000007
  %68 = trunc nuw nsw i64 %67 to i32
  %69 = call noundef i32 @_Z5valuei(i32 noundef %68)
  %70 = getelementptr inbounds [62 x i32], ptr @seq, i64 0, i64 %indvars.iv148
  store i32 %69, ptr %70, align 4, !tbaa !5
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %.not131 = icmp ult i64 %46, 2
  br i1 %.not131, label %._crit_edge102.loopexit, label %.lr.ph101thread-pre-split, !llvm.loop !16

._crit_edge102.loopexit:                          ; preds = %._crit_edge98
  %71 = trunc nuw i64 %indvars.iv.next149 to i32
  %.pre = load i64, ptr @n, align 8, !tbaa !12
  br label %._crit_edge102

._crit_edge102:                                   ; preds = %._crit_edge102.loopexit, %.lr.ph129
  %72 = phi i64 [ %40, %.lr.ph129 ], [ %.pre, %._crit_edge102.loopexit ]
  %.073.lcssa = phi i32 [ 1, %.lr.ph129 ], [ %71, %._crit_edge102.loopexit ]
  %73 = add i32 %.073.lcssa, -1
  store i32 1, ptr @val, align 16, !tbaa !5
  store i32 1, ptr @deg, align 4, !tbaa !5
  %74 = icmp sgt i64 %72, 1
  br i1 %74, label %.lr.ph118.preheader, label %._crit_edge119

.lr.ph118.preheader:                              ; preds = %._crit_edge102
  %75 = add nsw i64 %72, -2
  br label %.lr.ph118

._crit_edge119:                                   ; preds = %._crit_edge115, %._crit_edge102
  store i32 %.073.lcssa, ptr @M, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(488) getelementptr inbounds (i8, ptr @M, i64 4), i8 0, i64 488, i1 false)
  %76 = sext i32 %73 to i64
  %77 = getelementptr inbounds [122 x i32], ptr getelementptr inbounds (i8, ptr @M, i64 4), i64 0, i64 %76
  store i32 1, ptr %77, align 4, !tbaa !5
  %78 = icmp sgt i32 %.073.lcssa, 1
  br i1 %78, label %.lr.ph122.preheader, label %._crit_edge123

.lr.ph122.preheader:                              ; preds = %._crit_edge119
  %wide.trip.count = zext nneg i32 %73 to i64
  %min.iters.check = icmp ult i32 %.073.lcssa, 9
  br i1 %min.iters.check, label %.lr.ph122.preheader179, label %vector.ph

.lr.ph122.preheader179:                           ; preds = %middle.block, %.lr.ph122.preheader
  %indvars.iv161.ph = phi i64 [ 0, %.lr.ph122.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph122

vector.ph:                                        ; preds = %.lr.ph122.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %79 = sub nsw i64 %76, %index
  %80 = getelementptr inbounds [62 x i32], ptr @seq, i64 0, i64 %79
  %81 = getelementptr inbounds i8, ptr %80, i64 -12
  %82 = getelementptr inbounds i8, ptr %80, i64 -28
  %wide.load = load <4 x i32>, ptr %81, align 4, !tbaa !5
  %wide.load177 = load <4 x i32>, ptr %82, align 4, !tbaa !5
  %83 = sub nsw <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, %wide.load
  %84 = shufflevector <4 x i32> %83, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %85 = sub nsw <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, %wide.load177
  %86 = shufflevector <4 x i32> %85, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %87 = getelementptr inbounds [122 x i32], ptr getelementptr inbounds (i8, ptr @M, i64 4), i64 0, i64 %index
  %88 = getelementptr inbounds i8, ptr %87, i64 16
  store <4 x i32> %84, ptr %87, align 4, !tbaa !5
  store <4 x i32> %86, ptr %88, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %89 = icmp eq i64 %index.next, %n.vec
  br i1 %89, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge123, label %.lr.ph122.preheader179

.lr.ph118thread-pre-split:                        ; preds = %._crit_edge115
  %90 = add nsw i64 %112, -1
  %indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1
  %.pr170 = load i32, ptr @deg, align 4, !tbaa !5
  br label %.lr.ph118

.lr.ph118:                                        ; preds = %.lr.ph118thread-pre-split, %.lr.ph118.preheader
  %91 = phi i32 [ %.pr170, %.lr.ph118thread-pre-split ], [ 1, %.lr.ph118.preheader ]
  %indvars.iv158 = phi i64 [ %indvars.iv.next159, %.lr.ph118thread-pre-split ], [ 1, %.lr.ph118.preheader ]
  %92 = phi i64 [ %90, %.lr.ph118thread-pre-split ], [ %75, %.lr.ph118.preheader ]
  %.not82104 = icmp slt i32 %91, 0
  br i1 %.not82104, label %._crit_edge109.thread, label %.lr.ph108.preheader

._crit_edge109.thread:                            ; preds = %.lr.ph118
  %93 = add nsw i32 %91, 1
  store i32 %93, ptr @deg, align 4, !tbaa !5
  br label %._crit_edge115

.lr.ph108.preheader:                              ; preds = %.lr.ph118
  %94 = trunc i64 %92 to i32
  %95 = and i32 %94, 1
  %96 = call noundef i32 @_Z5valuei(i32 noundef %95)
  %97 = call noundef i32 @_Z7mod_addii(i32 noundef 0, i32 noundef %96)
  store i32 %97, ptr @nxt, align 16, !tbaa !5
  %98 = call noundef i32 @_Z7mod_addii(i32 noundef %95, i32 noundef 2)
  %99 = load i32, ptr @deg, align 4, !tbaa !5
  %.not82.not.peel = icmp sgt i32 %99, 0
  br i1 %.not82.not.peel, label %.lr.ph108.peel.next, label %._crit_edge109

._crit_edge109:                                   ; preds = %.lr.ph108.peel.next, %.lr.ph108.preheader
  %.lcssa88 = phi i32 [ %99, %.lr.ph108.preheader ], [ %110, %.lr.ph108.peel.next ]
  %100 = add i32 %.lcssa88, 1
  store i32 %100, ptr @deg, align 4, !tbaa !5
  %.not86111 = icmp slt i32 %.lcssa88, 0
  br i1 %.not86111, label %._crit_edge115, label %.lr.ph114.preheader

.lr.ph114.preheader:                              ; preds = %._crit_edge109
  %101 = zext i32 %100 to i64
  %102 = shl nuw nsw i64 %101, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @val, ptr nonnull align 16 @nxt, i64 %102, i1 false), !tbaa !5
  br label %._crit_edge115

.lr.ph108.peel.next:                              ; preds = %.lr.ph108.preheader, %.lr.ph108.peel.next
  %indvars.iv151 = phi i64 [ %indvars.iv.next152, %.lr.ph108.peel.next ], [ 1, %.lr.ph108.preheader ]
  %.065106 = phi i32 [ %109, %.lr.ph108.peel.next ], [ %98, %.lr.ph108.preheader ]
  %103 = add nsw i64 %indvars.iv151, -1
  %104 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = call noundef i32 @_Z5valuei(i32 noundef %.065106)
  %107 = call noundef i32 @_Z7mod_addii(i32 noundef %105, i32 noundef %106)
  %108 = getelementptr inbounds [62 x i32], ptr @nxt, i64 0, i64 %indvars.iv151
  store i32 %107, ptr %108, align 4, !tbaa !5
  %indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
  %109 = call noundef i32 @_Z7mod_addii(i32 noundef %.065106, i32 noundef 2)
  %110 = load i32, ptr @deg, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %.not82.not = icmp slt i64 %indvars.iv151, %111
  br i1 %.not82.not, label %.lr.ph108.peel.next, label %._crit_edge109, !llvm.loop !20

._crit_edge115:                                   ; preds = %._crit_edge109.thread, %.lr.ph114.preheader, %._crit_edge109
  %112 = lshr i64 %92, 1
  %113 = getelementptr inbounds [62 x i32], ptr @seq, i64 0, i64 %indvars.iv158
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = urem i64 %112, 1000000007
  %116 = trunc nuw nsw i64 %115 to i32
  %117 = call noundef i32 @_Z5valuei(i32 noundef %116)
  %118 = call noundef i32 @_Z7mod_decii(i32 noundef %114, i32 noundef %117)
  store i32 %118, ptr %113, align 4, !tbaa !5
  %.not132 = icmp ult i64 %92, 2
  br i1 %.not132, label %._crit_edge119, label %.lr.ph118thread-pre-split, !llvm.loop !21

._crit_edge123:                                   ; preds = %.lr.ph122, %middle.block, %._crit_edge119
  store i32 1, ptr @A, align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @A, i64 4), align 4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(484) getelementptr inbounds (i8, ptr @A, i64 8), i8 0, i64 484, i1 false)
  store i32 2, ptr @B, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @B, i64 4), align 4
  store i32 1, ptr getelementptr inbounds (i8, ptr @B, i64 8), align 4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(480) getelementptr inbounds (i8, ptr @B, i64 12), i8 0, i64 480, i1 false)
  %119 = add nsw i32 %.073.lcssa, -2
  %120 = sext i32 %119 to i64
  %121 = load i64, ptr @m, align 8, !tbaa !12
  %122 = add nsw i64 %121, %120
  store i64 %122, ptr @m, align 8, !tbaa !12
  %123 = icmp sgt i64 %122, 0
  br i1 %123, label %.lr.ph125, label %._crit_edge126

.lr.ph122:                                        ; preds = %.lr.ph122.preheader179, %.lr.ph122
  %indvars.iv161 = phi i64 [ %indvars.iv.next162, %.lr.ph122 ], [ %indvars.iv161.ph, %.lr.ph122.preheader179 ]
  %124 = sub nsw i64 %76, %indvars.iv161
  %125 = getelementptr inbounds [62 x i32], ptr @seq, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sub nsw i32 1000000007, %126
  %128 = getelementptr inbounds [122 x i32], ptr getelementptr inbounds (i8, ptr @M, i64 4), i64 0, i64 %indvars.iv161
  store i32 %127, ptr %128, align 4, !tbaa !5
  %indvars.iv.next162 = add nuw nsw i64 %indvars.iv161, 1
  %exitcond164.not = icmp eq i64 %indvars.iv.next162, %wide.trip.count
  br i1 %exitcond164.not, label %._crit_edge123, label %.lr.ph122, !llvm.loop !22

.lr.ph125:                                        ; preds = %._crit_edge123, %132
  %129 = phi i64 [ %.pr, %132 ], [ %122, %._crit_edge123 ]
  %130 = and i64 %129, 1
  %.not81 = icmp eq i64 %130, 0
  br i1 %.not81, label %132, label %131

131:                                              ; preds = %.lr.ph125
  call void @llvm.lifetime.start.p0(i64 492, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 492, ptr nonnull %2) #8
  call void @_ZNK4PolymlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Poly) align 4 %2, ptr noundef nonnull align 4 dereferenceable(492) @A, ptr noundef nonnull align 4 dereferenceable(492) @B)
  call void @_ZNK4PolyrmERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Poly) align 4 %1, ptr noundef nonnull align 4 dereferenceable(492) %2, ptr noundef nonnull align 4 dereferenceable(492) @M)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(492) @A, ptr noundef nonnull align 4 dereferenceable(492) %1, i64 492, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 492, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 492, ptr nonnull %1) #8
  %.pre165 = load i64, ptr @m, align 8, !tbaa !12
  br label %132

132:                                              ; preds = %.lr.ph125, %131
  %133 = phi i64 [ %129, %.lr.ph125 ], [ %.pre165, %131 ]
  %134 = ashr i64 %133, 1
  store i64 %134, ptr @m, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 492, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 492, ptr nonnull %4) #8
  call void @_ZNK4PolymlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Poly) align 4 %4, ptr noundef nonnull align 4 dereferenceable(492) @B, ptr noundef nonnull align 4 dereferenceable(492) @B)
  call void @_ZNK4PolyrmERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Poly) align 4 %3, ptr noundef nonnull align 4 dereferenceable(492) %4, ptr noundef nonnull align 4 dereferenceable(492) @M)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(492) @B, ptr noundef nonnull align 4 dereferenceable(492) %3, i64 492, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 492, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 492, ptr nonnull %3) #8
  %.pr = load i64, ptr @m, align 8, !tbaa !12
  %135 = icmp sgt i64 %.pr, 0
  br i1 %135, label %.lr.ph125, label %._crit_edge126.loopexit, !llvm.loop !25

._crit_edge126.loopexit:                          ; preds = %132
  %.pre166 = load i32, ptr @A, align 4, !tbaa !26
  br label %._crit_edge126

._crit_edge126:                                   ; preds = %._crit_edge126.loopexit, %._crit_edge123
  %136 = phi i32 [ %.pre166, %._crit_edge126.loopexit ], [ 1, %._crit_edge123 ]
  %137 = icmp eq i32 %136, %73
  br i1 %137, label %138, label %141

138:                                              ; preds = %._crit_edge126
  %139 = getelementptr inbounds [122 x i32], ptr getelementptr inbounds (i8, ptr @A, i64 4), i64 0, i64 %120
  %140 = load i32, ptr %139, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %._crit_edge126, %138
  %142 = phi i32 [ %140, %138 ], [ 0, %._crit_edge126 ]
  %143 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %142)
  %144 = load i32, ptr @t, align 4, !tbaa !5
  %145 = add nsw i32 %144, -1
  store i32 %145, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %144, 0
  br i1 %.not, label %._crit_edge130, label %.lr.ph129, !llvm.loop !28

._crit_edge130:                                   ; preds = %141, %20
  ret i32 0
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK4PolymlERKS_(ptr dead_on_unwind noalias writable sret(%struct.Poly) align 4, ptr noundef nonnull align 4 dereferenceable(492), ptr noundef nonnull align 4 dereferenceable(492)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4PolyrmERKS_(ptr dead_on_unwind noalias writable sret(%struct.Poly) align 4, ptr noundef nonnull align 4 dereferenceable(492), ptr noundef nonnull align 4 dereferenceable(492)) local_unnamed_addr #7 align 2

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.peeled.count", i32 1}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !10, !15}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !19, !18}
!23 = !{i64 0, i64 4, !5, i64 4, i64 488, !24}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !10}
!26 = !{!27, !6, i64 0}
!27 = !{!"_ZTS4Poly", !6, i64 0, !7, i64 4}
!28 = distinct !{!28, !10}


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