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

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@cur = external dso_local global i32, align 4
@pre = external dso_local global i32, align 4
@f = external dso_local global [2 x [37 x i32]], align 16
@deg = external dso_local global [2 x i32], align 4
@m = external dso_local global i64, align 8
@mat = external dso_local global [2 x [35 x [35 x i32]]], align 16
@g = external dso_local global [35 x [35 x i64]], align 16
@vec = external dso_local global [71 x i64], align 16
@.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 [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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
  store i32 0, ptr %1, align 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %20

20:                                               ; preds = %419, %49, %33, %0
  %21 = load i32, ptr @t, align 4, !tbaa !5
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr @t, align 4, !tbaa !5
  %23 = icmp ne i32 %21, 0
  br i1 %23, label %24, label %424

24:                                               ; preds = %20
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m, ptr noundef @mod)
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = and i32 %26, 1
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %35

29:                                               ; preds = %24
  %30 = load i64, ptr @m, align 8, !tbaa !9
  %31 = and i64 %30, 1
  %32 = icmp ne i64 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %29
  %34 = call i32 @puts(ptr noundef @.str.2)
  br label %20, !llvm.loop !11

35:                                               ; preds = %29, %24
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = load i64, ptr @m, align 8, !tbaa !9
  %39 = icmp sgt i64 %37, %38
  br i1 %39, label %40, label %46

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %41 = load i64, ptr @m, align 8, !tbaa !9
  %42 = trunc i64 %41 to i32
  store i32 %42, ptr %2, align 4, !tbaa !5
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  store i64 %44, ptr @m, align 8, !tbaa !9
  %45 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %45, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %46

46:                                               ; preds = %40, %35
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = icmp eq i32 %47, 1
  br i1 %48, label %49, label %51

49:                                               ; preds = %46
  %50 = call i32 @puts(ptr noundef @.str.3)
  br label %20, !llvm.loop !11

51:                                               ; preds = %46
  %52 = load i32, ptr @cur, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %53
  %55 = getelementptr inbounds [37 x i32], ptr %54, i64 0, i64 0
  store i32 1, ptr %55, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %143, %51
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = icmp sle i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 4, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %146

61:                                               ; preds = %56
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @cur, ptr noundef nonnull align 4 dereferenceable(4) @pre) #7
  %62 = load i32, ptr @pre, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %63
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = sub nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [37 x i32], ptr %64, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = load i32, ptr @cur, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %71
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [37 x i32], ptr %72, i64 0, i64 %74
  store i32 %69, ptr %75, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  store i32 %77, ptr %5, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %128, %61
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = icmp sgt i32 %79, 0
  br i1 %80, label %82, label %81

81:                                               ; preds = %78
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %131

82:                                               ; preds = %78
  %83 = load i32, ptr @pre, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %84
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sub nsw i32 %86, 1
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [37 x i32], ptr %85, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = load i32, ptr @cur, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %92
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [37 x i32], ptr %93, i64 0, i64 %95
  store i32 %90, ptr %96, align 4, !tbaa !5
  %97 = load i32, ptr @cur, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %98
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [37 x i32], ptr %99, i64 0, i64 %101
  %103 = load i32, ptr @mod, align 4, !tbaa !5
  %104 = load i32, ptr @pre, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %105
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [37 x i32], ptr %106, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sub nsw i32 %103, %110
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %102, i32 noundef %111)
  %112 = load i32, ptr @cur, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %113
  %115 = load i32, ptr %5, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [37 x i32], ptr %114, i64 0, i64 %116
  %118 = load i32, ptr @mod, align 4, !tbaa !5
  %119 = load i32, ptr @cur, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %120
  %122 = load i32, ptr %5, align 4, !tbaa !5
  %123 = sub nsw i32 %122, 1
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [37 x i32], ptr %121, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sub nsw i32 %118, %126
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %117, i32 noundef %127)
  br label %128

128:                                              ; preds = %82
  %129 = load i32, ptr %5, align 4, !tbaa !5
  %130 = add nsw i32 %129, -1
  store i32 %130, ptr %5, align 4, !tbaa !5
  br label %78, !llvm.loop !13

131:                                              ; preds = %81
  %132 = load i32, ptr @mod, align 4, !tbaa !5
  %133 = load i32, ptr @pre, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %134
  %136 = getelementptr inbounds [37 x i32], ptr %135, i64 0, i64 0
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = sub nsw i32 %132, %137
  %139 = load i32, ptr @cur, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %140
  %142 = getelementptr inbounds [37 x i32], ptr %141, i64 0, i64 0
  store i32 %138, ptr %142, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %131
  %144 = load i32, ptr %3, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %3, align 4, !tbaa !5
  br label %56, !llvm.loop !14

146:                                              ; preds = %60
  %147 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %147, ptr getelementptr inbounds ([2 x i32], ptr @deg, i64 0, i64 1), align 4, !tbaa !5
  %148 = load i32, ptr @cur, align 4, !tbaa !5
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %159, label %150

150:                                              ; preds = %146
  %151 = load i32, ptr @cur, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %152
  %154 = getelementptr inbounds [37 x i32], ptr %153, i64 0, i64 0
  %155 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @deg, i64 0, i64 1), align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  %157 = sext i32 %156 to i64
  %158 = mul i64 %157, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 getelementptr inbounds ([2 x [37 x i32]], ptr @f, i64 0, i64 1), ptr align 4 %154, i64 %158, i1 false)
  br label %159

159:                                              ; preds = %150, %146
  store i32 0, ptr @deg, align 4, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %168, %159
  %161 = load i32, ptr %6, align 4, !tbaa !5
  %162 = zext i32 %161 to i64
  %163 = shl i64 1, %162
  %164 = load i64, ptr @m, align 8, !tbaa !9
  %165 = ashr i64 %164, 1
  %166 = icmp sle i64 %163, %165
  br i1 %166, label %167, label %171

167:                                              ; preds = %160
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %6, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %6, align 4, !tbaa !5
  br label %160, !llvm.loop !15

171:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %172 = load i32, ptr %6, align 4, !tbaa !5
  %173 = sub nsw i32 %172, 1
  store i32 %173, ptr %7, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %249, %171
  %175 = load i32, ptr %7, align 4, !tbaa !5
  %176 = icmp sge i32 %175, 0
  br i1 %176, label %178, label %177

177:                                              ; preds = %174
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %252

178:                                              ; preds = %174
  %179 = load i32, ptr @deg, align 4, !tbaa !5
  %180 = shl i32 %179, 1
  %181 = or i32 %180, 1
  %182 = sext i32 %181 to i64
  %183 = mul i64 %182, 8
  call void @llvm.memset.p0.i64(ptr align 16 @vec, i8 0, i64 %183, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %184

184:                                              ; preds = %213, %178
  %185 = load i32, ptr %8, align 4, !tbaa !5
  %186 = load i32, ptr @deg, align 4, !tbaa !5
  %187 = icmp sle i32 %185, %186
  br i1 %187, label %189, label %188

188:                                              ; preds = %184
  store i32 16, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %216

189:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %209, %189
  %191 = load i32, ptr %9, align 4, !tbaa !5
  %192 = load i32, ptr @deg, align 4, !tbaa !5
  %193 = icmp sle i32 %191, %192
  br i1 %193, label %195, label %194

194:                                              ; preds = %190
  store i32 19, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %212

195:                                              ; preds = %190
  %196 = load i32, ptr %8, align 4, !tbaa !5
  %197 = load i32, ptr %9, align 4, !tbaa !5
  %198 = add nsw i32 %196, %197
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [71 x i64], ptr @vec, i64 0, i64 %199
  %201 = load i32, ptr %8, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = load i32, ptr %9, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  call void @_Z11mod_inc_mulRxii(ptr noundef nonnull align 8 dereferenceable(8) %200, i32 noundef %204, i32 noundef %208)
  br label %209

209:                                              ; preds = %195
  %210 = load i32, ptr %9, align 4, !tbaa !5
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %9, align 4, !tbaa !5
  br label %190, !llvm.loop !16

212:                                              ; preds = %194
  br label %213

213:                                              ; preds = %212
  %214 = load i32, ptr %8, align 4, !tbaa !5
  %215 = add nsw i32 %214, 1
  store i32 %215, ptr %8, align 4, !tbaa !5
  br label %184, !llvm.loop !17

216:                                              ; preds = %188
  %217 = load i32, ptr @deg, align 4, !tbaa !5
  %218 = shl i32 %217, 1
  store i32 %218, ptr @deg, align 4, !tbaa !5
  call void @_Z8poly_modv()
  %219 = load i64, ptr @m, align 8, !tbaa !9
  %220 = load i32, ptr %7, align 4, !tbaa !5
  %221 = add nsw i32 %220, 1
  %222 = zext i32 %221 to i64
  %223 = ashr i64 %219, %222
  %224 = and i64 %223, 1
  %225 = icmp ne i64 %224, 0
  br i1 %225, label %226, label %248

226:                                              ; preds = %216
  store i64 0, ptr @vec, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %227

227:                                              ; preds = %242, %226
  %228 = load i32, ptr %10, align 4, !tbaa !5
  %229 = load i32, ptr @deg, align 4, !tbaa !5
  %230 = icmp sle i32 %228, %229
  br i1 %230, label %232, label %231

231:                                              ; preds = %227
  store i32 22, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %245

232:                                              ; preds = %227
  %233 = load i32, ptr %10, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = load i32, ptr %10, align 4, !tbaa !5
  %239 = add nsw i32 %238, 1
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [71 x i64], ptr @vec, i64 0, i64 %240
  store i64 %237, ptr %241, align 8, !tbaa !9
  br label %242

242:                                              ; preds = %232
  %243 = load i32, ptr %10, align 4, !tbaa !5
  %244 = add nsw i32 %243, 1
  store i32 %244, ptr %10, align 4, !tbaa !5
  br label %227, !llvm.loop !18

245:                                              ; preds = %231
  %246 = load i32, ptr @deg, align 4, !tbaa !5
  %247 = add nsw i32 %246, 1
  store i32 %247, ptr @deg, align 4, !tbaa !5
  call void @_Z8poly_modv()
  br label %248

248:                                              ; preds = %245, %216
  br label %249

249:                                              ; preds = %248
  %250 = load i32, ptr %7, align 4, !tbaa !5
  %251 = add nsw i32 %250, -1
  store i32 %251, ptr %7, align 4, !tbaa !5
  br label %174, !llvm.loop !19

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

253:                                              ; preds = %280, %252
  %254 = load i32, ptr %11, align 4, !tbaa !5
  %255 = load i32, ptr @n, align 4, !tbaa !5
  %256 = icmp slt i32 %254, %255
  br i1 %256, label %258, label %257

257:                                              ; preds = %253
  store i32 25, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %283

258:                                              ; preds = %253
  %259 = load i32, ptr %11, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [35 x [35 x i32]], ptr @mat, i64 0, i64 %260
  %262 = getelementptr inbounds [35 x i32], ptr %261, i64 0, i64 0
  %263 = load i32, ptr @n, align 4, !tbaa !5
  %264 = sext i32 %263 to i64
  %265 = mul i64 %264, 4
  call void @llvm.memset.p0.i64(ptr align 4 %262, i8 0, i64 %265, i1 false)
  %266 = load i32, ptr %11, align 4, !tbaa !5
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [35 x [35 x i32]], ptr getelementptr inbounds ([2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 1), i64 0, i64 %267
  %269 = getelementptr inbounds [35 x i32], ptr %268, i64 0, i64 0
  %270 = load i32, ptr @n, align 4, !tbaa !5
  %271 = sext i32 %270 to i64
  %272 = mul i64 %271, 4
  call void @llvm.memset.p0.i64(ptr align 4 %269, i8 0, i64 %272, i1 false)
  %273 = load i32, ptr %11, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %274
  %276 = getelementptr inbounds [35 x i64], ptr %275, i64 0, i64 0
  %277 = load i32, ptr @n, align 4, !tbaa !5
  %278 = sext i32 %277 to i64
  %279 = mul i64 %278, 8
  call void @llvm.memset.p0.i64(ptr align 8 %276, i8 0, i64 %279, i1 false)
  br label %280

280:                                              ; preds = %258
  %281 = load i32, ptr %11, align 4, !tbaa !5
  %282 = add nsw i32 %281, 1
  store i32 %282, ptr %11, align 4, !tbaa !5
  br label %253, !llvm.loop !20

283:                                              ; preds = %257
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %284

284:                                              ; preds = %366, %283
  %285 = load i32, ptr %12, align 4, !tbaa !5
  %286 = load i32, ptr @deg, align 4, !tbaa !5
  %287 = icmp sle i32 %285, %286
  br i1 %287, label %289, label %288

288:                                              ; preds = %284
  store i32 28, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %369

289:                                              ; preds = %284
  %290 = load i32, ptr %12, align 4, !tbaa !5
  %291 = icmp ne i32 %290, 0
  br i1 %291, label %292, label %293

292:                                              ; preds = %289
  call void @_Z8mat_nextv()
  call void @_Z8mat_nextv()
  br label %318

293:                                              ; preds = %289
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %294

294:                                              ; preds = %309, %293
  %295 = load i32, ptr %13, align 4, !tbaa !5
  %296 = load i32, ptr @n, align 4, !tbaa !5
  %297 = icmp slt i32 %295, %296
  br i1 %297, label %299, label %298

298:                                              ; preds = %294
  store i32 31, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %312

299:                                              ; preds = %294
  %300 = load i32, ptr @cur, align 4, !tbaa !5
  %301 = sext i32 %300 to i64
  %302 = getelementptr inbounds [2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 %301
  %303 = load i32, ptr %13, align 4, !tbaa !5
  %304 = sext i32 %303 to i64
  %305 = getelementptr inbounds [35 x [35 x i32]], ptr %302, i64 0, i64 %304
  %306 = load i32, ptr %13, align 4, !tbaa !5
  %307 = sext i32 %306 to i64
  %308 = getelementptr inbounds [35 x i32], ptr %305, i64 0, i64 %307
  store i32 1, ptr %308, align 4, !tbaa !5
  br label %309

309:                                              ; preds = %299
  %310 = load i32, ptr %13, align 4, !tbaa !5
  %311 = add nsw i32 %310, 1
  store i32 %311, ptr %13, align 4, !tbaa !5
  br label %294, !llvm.loop !21

312:                                              ; preds = %298
  %313 = load i64, ptr @m, align 8, !tbaa !9
  %314 = and i64 %313, 1
  %315 = icmp ne i64 %314, 0
  br i1 %315, label %316, label %317

316:                                              ; preds = %312
  call void @_Z8mat_nextv()
  br label %317

317:                                              ; preds = %316, %312
  br label %318

318:                                              ; preds = %317, %292
  %319 = load i32, ptr %12, align 4, !tbaa !5
  %320 = sext i32 %319 to i64
  %321 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %320
  %322 = load i32, ptr %321, align 4, !tbaa !5
  %323 = icmp ne i32 %322, 0
  br i1 %323, label %324, label %365

324:                                              ; preds = %318
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %325

325:                                              ; preds = %361, %324
  %326 = load i32, ptr %14, align 4, !tbaa !5
  %327 = load i32, ptr @n, align 4, !tbaa !5
  %328 = icmp slt i32 %326, %327
  br i1 %328, label %330, label %329

329:                                              ; preds = %325
  store i32 34, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %364

330:                                              ; preds = %325
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %331

331:                                              ; preds = %357, %330
  %332 = load i32, ptr %15, align 4, !tbaa !5
  %333 = load i32, ptr @n, align 4, !tbaa !5
  %334 = icmp slt i32 %332, %333
  br i1 %334, label %336, label %335

335:                                              ; preds = %331
  store i32 37, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %360

336:                                              ; preds = %331
  %337 = load i32, ptr %14, align 4, !tbaa !5
  %338 = sext i32 %337 to i64
  %339 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %338
  %340 = load i32, ptr %15, align 4, !tbaa !5
  %341 = sext i32 %340 to i64
  %342 = getelementptr inbounds [35 x i64], ptr %339, i64 0, i64 %341
  %343 = load i32, ptr %12, align 4, !tbaa !5
  %344 = sext i32 %343 to i64
  %345 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %344
  %346 = load i32, ptr %345, align 4, !tbaa !5
  %347 = load i32, ptr @cur, align 4, !tbaa !5
  %348 = sext i32 %347 to i64
  %349 = getelementptr inbounds [2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 %348
  %350 = load i32, ptr %14, align 4, !tbaa !5
  %351 = sext i32 %350 to i64
  %352 = getelementptr inbounds [35 x [35 x i32]], ptr %349, i64 0, i64 %351
  %353 = load i32, ptr %15, align 4, !tbaa !5
  %354 = sext i32 %353 to i64
  %355 = getelementptr inbounds [35 x i32], ptr %352, i64 0, i64 %354
  %356 = load i32, ptr %355, align 4, !tbaa !5
  call void @_Z11mod_inc_mulRxii(ptr noundef nonnull align 8 dereferenceable(8) %342, i32 noundef %346, i32 noundef %356)
  br label %357

357:                                              ; preds = %336
  %358 = load i32, ptr %15, align 4, !tbaa !5
  %359 = add nsw i32 %358, 1
  store i32 %359, ptr %15, align 4, !tbaa !5
  br label %331, !llvm.loop !22

360:                                              ; preds = %335
  br label %361

361:                                              ; preds = %360
  %362 = load i32, ptr %14, align 4, !tbaa !5
  %363 = add nsw i32 %362, 1
  store i32 %363, ptr %14, align 4, !tbaa !5
  br label %325, !llvm.loop !23

364:                                              ; preds = %329
  br label %365

365:                                              ; preds = %364, %318
  br label %366

366:                                              ; preds = %365
  %367 = load i32, ptr %12, align 4, !tbaa !5
  %368 = add nsw i32 %367, 1
  store i32 %368, ptr %12, align 4, !tbaa !5
  br label %284, !llvm.loop !24

369:                                              ; preds = %288
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %370 = load i64, ptr @m, align 8, !tbaa !9
  %371 = and i64 %370, 1
  %372 = icmp ne i64 %371, 0
  %373 = xor i1 %372, true
  %374 = zext i1 %373 to i32
  store i32 %374, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %375

375:                                              ; preds = %416, %369
  %376 = load i32, ptr %17, align 4, !tbaa !5
  %377 = load i32, ptr %17, align 4, !tbaa !5
  %378 = add nsw i32 %376, %377
  %379 = load i32, ptr %16, align 4, !tbaa !5
  %380 = add nsw i32 %378, %379
  %381 = load i32, ptr @n, align 4, !tbaa !5
  %382 = icmp slt i32 %380, %381
  br i1 %382, label %384, label %383

383:                                              ; preds = %375
  store i32 40, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %419

384:                                              ; preds = %375
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %385

385:                                              ; preds = %412, %384
  %386 = load i32, ptr %18, align 4, !tbaa !5
  %387 = load i32, ptr %18, align 4, !tbaa !5
  %388 = add nsw i32 %386, %387
  %389 = add nsw i32 %388, 1
  %390 = load i32, ptr @n, align 4, !tbaa !5
  %391 = icmp slt i32 %389, %390
  br i1 %391, label %393, label %392

392:                                              ; preds = %385
  store i32 43, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %415

393:                                              ; preds = %385
  %394 = load i32, ptr %17, align 4, !tbaa !5
  %395 = shl i32 %394, 1
  %396 = load i32, ptr %16, align 4, !tbaa !5
  %397 = or i32 %395, %396
  %398 = sext i32 %397 to i64
  %399 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %398
  %400 = load i32, ptr %18, align 4, !tbaa !5
  %401 = shl i32 %400, 1
  %402 = or i32 %401, 1
  %403 = sext i32 %402 to i64
  %404 = getelementptr inbounds [35 x i64], ptr %399, i64 0, i64 %403
  %405 = load i64, ptr %404, align 8, !tbaa !9
  %406 = load i32, ptr %17, align 4, !tbaa !5
  %407 = sext i32 %406 to i64
  %408 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %407
  %409 = load i32, ptr %18, align 4, !tbaa !5
  %410 = sext i32 %409 to i64
  %411 = getelementptr inbounds [35 x i64], ptr %408, i64 0, i64 %410
  store i64 %405, ptr %411, align 8, !tbaa !9
  br label %412

412:                                              ; preds = %393
  %413 = load i32, ptr %18, align 4, !tbaa !5
  %414 = add nsw i32 %413, 1
  store i32 %414, ptr %18, align 4, !tbaa !5
  br label %385, !llvm.loop !25

415:                                              ; preds = %392
  br label %416

416:                                              ; preds = %415
  %417 = load i32, ptr %17, align 4, !tbaa !5
  %418 = add nsw i32 %417, 1
  store i32 %418, ptr %17, align 4, !tbaa !5
  br label %375, !llvm.loop !26

419:                                              ; preds = %383
  %420 = load i32, ptr @n, align 4, !tbaa !5
  %421 = ashr i32 %420, 1
  store i32 %421, ptr @n, align 4, !tbaa !5
  %422 = call noundef i32 @_Z7mat_detv()
  %423 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %422)
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %20, !llvm.loop !11

424:                                              ; preds = %20
  ret i32 0
}

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

declare i32 @puts(ptr noundef) #1

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

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

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

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

; 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) #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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z11mod_inc_mulRxii(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z8poly_modv() #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z8mat_nextv() #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z7mat_detv() #6

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}


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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@cur = external dso_local global i32, align 4
@pre = external dso_local global i32, align 4
@f = external dso_local global [2 x [37 x i32]], align 16
@deg = external dso_local local_unnamed_addr global [2 x i32], align 4
@m = external dso_local global i64, align 8
@mat = external dso_local local_unnamed_addr global [2 x [35 x [35 x i32]]], align 16
@g = external dso_local global [35 x [35 x i64]], align 16
@vec = external dso_local global [71 x i64], align 16
@.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 [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @t, align 4, !tbaa !5
  %.not155 = icmp eq i32 %2, 0
  br i1 %.not155, label %._crit_edge158, label %.lr.ph157

.lr.ph157:                                        ; preds = %0, %.backedge
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @mod)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = and i32 %5, 1
  %.not87 = icmp eq i32 %6, 0
  %.pre = load i64, ptr @m, align 8, !tbaa !9
  %7 = and i64 %.pre, 1
  %.not88 = icmp eq i64 %7, 0
  %or.cond252 = select i1 %.not87, i1 true, i1 %.not88
  br i1 %or.cond252, label %12, label %8

8:                                                ; preds = %.lr.ph157
  %9 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %.backedge

.backedge:                                        ; preds = %8, %19, %._crit_edge152
  %10 = load i32, ptr @t, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %._crit_edge158, label %.lr.ph157, !llvm.loop !11

12:                                               ; preds = %.lr.ph157
  %13 = sext i32 %5 to i64
  %14 = icmp slt i64 %.pre, %13
  br i1 %14, label %15, label %thread-pre-split

15:                                               ; preds = %12
  %16 = trunc i64 %.pre to i32
  store i64 %13, ptr @m, align 8, !tbaa !9
  store i32 %16, ptr @n, align 4, !tbaa !5
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %12, %15
  %17 = phi i32 [ %16, %15 ], [ %5, %12 ]
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %19, label %21

19:                                               ; preds = %thread-pre-split
  %20 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.backedge

21:                                               ; preds = %thread-pre-split
  %22 = load i32, ptr @cur, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %23
  store i32 1, ptr %24, align 4, !tbaa !5
  %.not89112 = icmp slt i32 %17, 1
  br i1 %.not89112, label %._crit_edge116, label %.lr.ph115

._crit_edge116:                                   ; preds = %._crit_edge, %21
  %25 = phi i32 [ %22, %21 ], [ %35, %._crit_edge ]
  %.lcssa = phi i32 [ %17, %21 ], [ %41, %._crit_edge ]
  store i32 %.lcssa, ptr getelementptr inbounds (i8, ptr @deg, i64 4), align 4, !tbaa !5
  %.not90 = icmp eq i32 %25, 0
  br i1 %.not90, label %63, label %67

.lr.ph115:                                        ; preds = %21, %._crit_edge
  %indvars.iv169 = phi i64 [ %indvars.iv.next170, %._crit_edge ], [ 1, %21 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %21 ]
  tail call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @cur, ptr noundef nonnull align 4 dereferenceable(4) @pre) #6
  %26 = load i32, ptr @pre, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = add nsw i64 %indvars.iv169, -1
  %29 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %27, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = load i32, ptr @cur, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %32, i64 %indvars.iv169
  store i32 %30, ptr %33, align 4, !tbaa !5
  %34 = icmp ugt i64 %indvars.iv169, 1
  br i1 %34, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre231 = load i32, ptr @pre, align 4, !tbaa !5
  %.pre232 = load i32, ptr @cur, align 4, !tbaa !5
  %.pre234 = sext i32 %.pre231 to i64
  %.pre235 = sext i32 %.pre232 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph115
  %.pre-phi236 = phi i64 [ %.pre235, %._crit_edge.loopexit ], [ %32, %.lr.ph115 ]
  %.pre-phi = phi i64 [ %.pre234, %._crit_edge.loopexit ], [ %27, %.lr.ph115 ]
  %35 = phi i32 [ %.pre232, %._crit_edge.loopexit ], [ %31, %.lr.ph115 ]
  %36 = load i32, ptr @mod, align 4, !tbaa !5
  %37 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %.pre-phi
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sub nsw i32 %36, %38
  %40 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %.pre-phi236
  store i32 %39, ptr %40, align 4, !tbaa !5
  %indvars.iv.next170 = add nuw nsw i64 %indvars.iv169, 1
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %.not89.not = icmp slt i64 %indvars.iv169, %42
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br i1 %.not89.not, label %.lr.ph115, label %._crit_edge116, !llvm.loop !13

.lr.ph:                                           ; preds = %.lr.ph115, %.lr.ph
  %indvars.iv166 = phi i64 [ %indvars.iv.next167, %.lr.ph ], [ %indvars.iv, %.lr.ph115 ]
  %43 = load i32, ptr @pre, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %indvars.iv.next167 = add nsw i64 %indvars.iv166, -1
  %45 = and i64 %indvars.iv.next167, 4294967295
  %46 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %44, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr @cur, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %49, i64 %indvars.iv166
  store i32 %47, ptr %50, align 4, !tbaa !5
  %51 = load i32, ptr @mod, align 4, !tbaa !5
  %52 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %44, i64 %indvars.iv166
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sub nsw i32 %51, %53
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %50, i32 noundef %54)
  %55 = load i32, ptr @cur, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %56, i64 %indvars.iv166
  %58 = load i32, ptr @mod, align 4, !tbaa !5
  %59 = getelementptr inbounds [2 x [37 x i32]], ptr @f, i64 0, i64 %56, i64 %45
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sub nsw i32 %58, %60
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %57, i32 noundef %61)
  %62 = icmp sgt i64 %indvars.iv166, 1
  br i1 %62, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !14

63:                                               ; preds = %._crit_edge116
  %64 = add nsw i32 %.lcssa, 1
  %65 = sext i32 %64 to i64
  %66 = shl nsw i64 %65, 2
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @f, i64 148), ptr nonnull align 16 @f, i64 %66, i1 false)
  br label %67

67:                                               ; preds = %63, %._crit_edge116
  store i32 0, ptr @deg, align 4, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  %68 = load i64, ptr @m, align 8, !tbaa !9
  %69 = ashr i64 %68, 1
  br label %70

70:                                               ; preds = %70, %67
  %indvars.iv173 = phi i64 [ %indvars.iv.next174, %70 ], [ 0, %67 ]
  %71 = shl nuw i64 1, %indvars.iv173
  %.not91 = icmp sgt i64 %71, %69
  %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
  br i1 %.not91, label %.preheader107, label %70, !llvm.loop !15

.preheader107:                                    ; preds = %70
  %.not160 = icmp eq i64 %indvars.iv173, 0
  br i1 %.not160, label %.preheader106, label %.lr.ph134

.preheader106.loopexit:                           ; preds = %112
  %.pre233 = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader106

.preheader106:                                    ; preds = %.preheader106.loopexit, %.preheader107
  %72 = phi i32 [ %.pre233, %.preheader106.loopexit ], [ %.lcssa, %.preheader107 ]
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph136, label %.preheader105

.lr.ph136:                                        ; preds = %.preheader106
  %74 = zext nneg i32 %72 to i64
  %75 = shl nuw nsw i64 %74, 2
  %76 = shl nuw nsw i64 %74, 3
  %xtraiter = and i64 %74, 1
  %77 = icmp eq i32 %72, 1
  br i1 %77, label %.preheader105.loopexit.unr-lcssa, label %.lr.ph136.new

.lr.ph136.new:                                    ; preds = %.lr.ph136
  %unroll_iter = and i64 %74, 2147483646
  br label %118

.lr.ph134:                                        ; preds = %.preheader107, %112
  %indvars.iv189 = phi i64 [ %indvars.iv.next190, %112 ], [ %indvars.iv173, %.preheader107 ]
  %indvars.iv.next190 = add nsw i64 %indvars.iv189, -1
  %78 = load i32, ptr @deg, align 4, !tbaa !5
  %79 = shl i32 %78, 1
  %80 = or disjoint i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = shl nsw i64 %81, 3
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @vec, i8 0, i64 %82, i1 false)
  %.not97121 = icmp slt i32 %78, 0
  br i1 %.not97121, label %._crit_edge123, label %.preheader101

.preheader101:                                    ; preds = %.lr.ph134, %._crit_edge120
  %83 = phi i32 [ %89, %._crit_edge120 ], [ %78, %.lr.ph134 ]
  %indvars.iv181 = phi i64 [ %indvars.iv.next182, %._crit_edge120 ], [ 0, %.lr.ph134 ]
  %.not100117 = icmp slt i32 %83, 0
  br i1 %.not100117, label %.preheader101.._crit_edge120_crit_edge, label %.lr.ph119

.preheader101.._crit_edge120_crit_edge:           ; preds = %.preheader101
  %.pre241 = sext i32 %83 to i64
  br label %._crit_edge120

.lr.ph119:                                        ; preds = %.preheader101
  %84 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %indvars.iv181
  br label %90

._crit_edge123:                                   ; preds = %._crit_edge120, %.lr.ph134
  %.lcssa108 = phi i32 [ %78, %.lr.ph134 ], [ %89, %._crit_edge120 ]
  %85 = shl i32 %.lcssa108, 1
  store i32 %85, ptr @deg, align 4, !tbaa !5
  tail call void @_Z8poly_modv()
  %86 = load i64, ptr @m, align 8, !tbaa !9
  %87 = shl nuw i64 1, %indvars.iv189
  %88 = and i64 %86, %87
  %.not98 = icmp eq i64 %88, 0
  br i1 %.not98, label %112, label %98

._crit_edge120:                                   ; preds = %90, %.preheader101.._crit_edge120_crit_edge
  %.pre-phi242 = phi i64 [ %.pre241, %.preheader101.._crit_edge120_crit_edge ], [ %97, %90 ]
  %89 = phi i32 [ %83, %.preheader101.._crit_edge120_crit_edge ], [ %96, %90 ]
  %indvars.iv.next182 = add nuw nsw i64 %indvars.iv181, 1
  %.not97.not = icmp slt i64 %indvars.iv181, %.pre-phi242
  br i1 %.not97.not, label %.preheader101, label %._crit_edge123, !llvm.loop !16

90:                                               ; preds = %.lr.ph119, %90
  %indvars.iv177 = phi i64 [ 0, %.lr.ph119 ], [ %indvars.iv.next178, %90 ]
  %91 = add nuw nsw i64 %indvars.iv177, %indvars.iv181
  %92 = getelementptr inbounds [71 x i64], ptr @vec, i64 0, i64 %91
  %93 = load i32, ptr %84, align 4, !tbaa !5
  %94 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %indvars.iv177
  %95 = load i32, ptr %94, align 4, !tbaa !5
  tail call void @_Z11mod_inc_mulRxii(ptr noundef nonnull align 8 dereferenceable(8) %92, i32 noundef %93, i32 noundef %95)
  %indvars.iv.next178 = add nuw nsw i64 %indvars.iv177, 1
  %96 = load i32, ptr @deg, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %.not100.not = icmp slt i64 %indvars.iv177, %97
  br i1 %.not100.not, label %90, label %._crit_edge120, !llvm.loop !18

98:                                               ; preds = %._crit_edge123
  store i64 0, ptr @vec, align 16, !tbaa !9
  %99 = load i32, ptr @deg, align 4, !tbaa !5
  %.not99125 = icmp slt i32 %99, 0
  %.pre239 = add i32 %99, 1
  br i1 %.not99125, label %._crit_edge129, label %.lr.ph128.preheader

.lr.ph128.preheader:                              ; preds = %98
  %wide.trip.count = zext i32 %.pre239 to i64
  %min.iters.check = icmp ult i32 %.pre239, 4
  br i1 %min.iters.check, label %.lr.ph128.preheader264, label %vector.ph

.lr.ph128.preheader264:                           ; preds = %middle.block, %.lr.ph128.preheader
  %indvars.iv185.ph = phi i64 [ 0, %.lr.ph128.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph128

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

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %100 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %index
  %101 = getelementptr inbounds i8, ptr %100, i64 8
  %wide.load = load <2 x i32>, ptr %100, align 16, !tbaa !5
  %wide.load263 = load <2 x i32>, ptr %101, align 8, !tbaa !5
  %102 = sext <2 x i32> %wide.load to <2 x i64>
  %103 = sext <2 x i32> %wide.load263 to <2 x i64>
  %104 = or disjoint i64 %index, 1
  %105 = getelementptr inbounds [71 x i64], ptr @vec, i64 0, i64 %104
  %106 = getelementptr inbounds i8, ptr %105, i64 16
  store <2 x i64> %102, ptr %105, align 8, !tbaa !9
  store <2 x i64> %103, ptr %106, align 8, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %107 = icmp eq i64 %index.next, %n.vec
  br i1 %107, label %middle.block, label %vector.body, !llvm.loop !19

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

._crit_edge129:                                   ; preds = %.lr.ph128, %middle.block, %98
  store i32 %.pre239, ptr @deg, align 4, !tbaa !5
  tail call void @_Z8poly_modv()
  br label %112

.lr.ph128:                                        ; preds = %.lr.ph128.preheader264, %.lr.ph128
  %indvars.iv185 = phi i64 [ %indvars.iv.next186, %.lr.ph128 ], [ %indvars.iv185.ph, %.lr.ph128.preheader264 ]
  %108 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %indvars.iv185
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %indvars.iv.next186 = add nuw nsw i64 %indvars.iv185, 1
  %111 = getelementptr inbounds [71 x i64], ptr @vec, i64 0, i64 %indvars.iv.next186
  store i64 %110, ptr %111, align 8, !tbaa !9
  %exitcond.not = icmp eq i64 %indvars.iv.next186, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge129, label %.lr.ph128, !llvm.loop !22

112:                                              ; preds = %._crit_edge123, %._crit_edge129
  %113 = icmp sgt i64 %indvars.iv189, 1
  br i1 %113, label %.lr.ph134, label %.preheader106.loopexit, !llvm.loop !23

.preheader105.loopexit.unr-lcssa:                 ; preds = %118, %.lr.ph136
  %indvars.iv193.unr = phi i64 [ 0, %.lr.ph136 ], [ %indvars.iv.next194.1, %118 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader105, label %.preheader105.loopexit.epilog-lcssa

.preheader105.loopexit.epilog-lcssa:              ; preds = %.preheader105.loopexit.unr-lcssa
  %114 = getelementptr inbounds [35 x [35 x i32]], ptr @mat, i64 0, i64 %indvars.iv193.unr
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %114, i8 0, i64 %75, i1 false)
  %115 = getelementptr inbounds [35 x [35 x i32]], ptr getelementptr inbounds (i8, ptr @mat, i64 4900), i64 0, i64 %indvars.iv193.unr
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %115, i8 0, i64 %75, i1 false)
  %116 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %indvars.iv193.unr
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %116, i8 0, i64 %76, i1 false)
  br label %.preheader105

.preheader105:                                    ; preds = %.preheader105.loopexit.epilog-lcssa, %.preheader105.loopexit.unr-lcssa, %.preheader106
  %117 = load i32, ptr @deg, align 4, !tbaa !5
  %.not92144 = icmp slt i32 %117, 0
  br i1 %.not92144, label %._crit_edge147, label %.lr.ph146

118:                                              ; preds = %118, %.lr.ph136.new
  %indvars.iv193 = phi i64 [ 0, %.lr.ph136.new ], [ %indvars.iv.next194.1, %118 ]
  %niter = phi i64 [ 0, %.lr.ph136.new ], [ %niter.next.1, %118 ]
  %119 = getelementptr inbounds [35 x [35 x i32]], ptr @mat, i64 0, i64 %indvars.iv193
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %119, i8 0, i64 %75, i1 false)
  %120 = getelementptr inbounds [35 x [35 x i32]], ptr getelementptr inbounds (i8, ptr @mat, i64 4900), i64 0, i64 %indvars.iv193
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %120, i8 0, i64 %75, i1 false)
  %121 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %indvars.iv193
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 %121, i8 0, i64 %76, i1 false)
  %indvars.iv.next194 = or disjoint i64 %indvars.iv193, 1
  %122 = getelementptr inbounds [35 x [35 x i32]], ptr @mat, i64 0, i64 %indvars.iv.next194
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %122, i8 0, i64 %75, i1 false)
  %123 = getelementptr inbounds [35 x [35 x i32]], ptr getelementptr inbounds (i8, ptr @mat, i64 4900), i64 0, i64 %indvars.iv.next194
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %123, i8 0, i64 %75, i1 false)
  %124 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %indvars.iv.next194
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %124, i8 0, i64 %76, i1 false)
  %indvars.iv.next194.1 = add nuw nsw i64 %indvars.iv193, 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 %.preheader105.loopexit.unr-lcssa, label %118, !llvm.loop !24

._crit_edge147:                                   ; preds = %.loopexit, %.preheader105
  %125 = phi i32 [ %72, %.preheader105 ], [ %185, %.loopexit ]
  %126 = load i64, ptr @m, align 8, !tbaa !9
  %127 = trunc i64 %126 to i32
  %128 = and i32 %127, 1
  %129 = xor i32 %128, 1
  %130 = icmp slt i32 %129, %125
  %131 = icmp ugt i32 %125, 1
  %or.cond253 = and i1 %130, %131
  br i1 %or.cond253, label %.preheader102.us.preheader, label %._crit_edge152

.preheader102.us.preheader:                       ; preds = %._crit_edge147
  %132 = add nsw i32 %125, -2
  %133 = lshr i32 %132, 1
  %134 = add nuw nsw i32 %133, 1
  %135 = and i64 %126, 1
  %wide.trip.count225 = zext nneg i32 %134 to i64
  %xtraiter280 = and i64 %wide.trip.count225, 1
  %136 = icmp ult i32 %132, 2
  %unroll_iter283 = and i64 %wide.trip.count225, 2147483646
  %lcmp.mod282.not = icmp eq i64 %xtraiter280, 0
  br label %.preheader102.us

.preheader102.us:                                 ; preds = %.preheader102.us.preheader, %._crit_edge150.us
  %indvars.iv227 = phi i64 [ 0, %.preheader102.us.preheader ], [ %indvars.iv.next228, %._crit_edge150.us ]
  %137 = phi i32 [ %129, %.preheader102.us.preheader ], [ %151, %._crit_edge150.us ]
  %138 = zext nneg i32 %137 to i64
  br i1 %136, label %._crit_edge150.us.unr-lcssa, label %.preheader102.us.new

.preheader102.us.new:                             ; preds = %.preheader102.us, %.preheader102.us.new
  %indvars.iv219 = phi i64 [ %indvars.iv.next220.1, %.preheader102.us.new ], [ 0, %.preheader102.us ]
  %indvars.iv217 = phi i64 [ %indvars.iv.next218.1, %.preheader102.us.new ], [ 1, %.preheader102.us ]
  %niter284 = phi i64 [ %niter284.next.1, %.preheader102.us.new ], [ 0, %.preheader102.us ]
  %139 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %138, i64 %indvars.iv217
  %140 = load i64, ptr %139, align 8, !tbaa !9
  %141 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %indvars.iv227, i64 %indvars.iv219
  store i64 %140, ptr %141, align 8, !tbaa !9
  %indvars.iv.next220 = or disjoint i64 %indvars.iv219, 1
  %indvars.iv.next218 = add nuw nsw i64 %indvars.iv217, 2
  %142 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %138, i64 %indvars.iv.next218
  %143 = load i64, ptr %142, align 8, !tbaa !9
  %144 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %indvars.iv227, i64 %indvars.iv.next220
  store i64 %143, ptr %144, align 8, !tbaa !9
  %indvars.iv.next220.1 = add nuw nsw i64 %indvars.iv219, 2
  %indvars.iv.next218.1 = add nuw nsw i64 %indvars.iv217, 4
  %niter284.next.1 = add i64 %niter284, 2
  %niter284.ncmp.1 = icmp eq i64 %niter284.next.1, %unroll_iter283
  br i1 %niter284.ncmp.1, label %._crit_edge150.us.unr-lcssa, label %.preheader102.us.new, !llvm.loop !25

._crit_edge150.us.unr-lcssa:                      ; preds = %.preheader102.us.new, %.preheader102.us
  %indvars.iv219.unr = phi i64 [ 0, %.preheader102.us ], [ %indvars.iv.next220.1, %.preheader102.us.new ]
  %indvars.iv217.unr = phi i64 [ 1, %.preheader102.us ], [ %indvars.iv.next218.1, %.preheader102.us.new ]
  br i1 %lcmp.mod282.not, label %._crit_edge150.us, label %._crit_edge150.us.epilog-lcssa

._crit_edge150.us.epilog-lcssa:                   ; preds = %._crit_edge150.us.unr-lcssa
  %145 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %138, i64 %indvars.iv217.unr
  %146 = load i64, ptr %145, align 8, !tbaa !9
  %147 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %indvars.iv227, i64 %indvars.iv219.unr
  store i64 %146, ptr %147, align 8, !tbaa !9
  br label %._crit_edge150.us

._crit_edge150.us:                                ; preds = %._crit_edge150.us.unr-lcssa, %._crit_edge150.us.epilog-lcssa
  %indvars.iv.next228 = add nuw nsw i64 %indvars.iv227, 1
  %148 = shl nuw nsw i64 %indvars.iv.next228, 1
  %149 = or disjoint i64 %148, %135
  %150 = trunc nuw i64 %149 to i32
  %151 = xor i32 %150, 1
  %152 = icmp slt i32 %151, %125
  br i1 %152, label %.preheader102.us, label %._crit_edge152, !llvm.loop !26

.lr.ph146:                                        ; preds = %.preheader105, %.loopexit
  %153 = phi i32 [ %185, %.loopexit ], [ %72, %.preheader105 ]
  %indvars.iv213 = phi i64 [ %indvars.iv.next214, %.loopexit ], [ 0, %.preheader105 ]
  %.not94 = icmp eq i64 %indvars.iv213, 0
  br i1 %.not94, label %.preheader104, label %158

.preheader104:                                    ; preds = %.lr.ph146
  %154 = icmp sgt i32 %153, 0
  br i1 %154, label %.lr.ph138, label %._crit_edge139

.lr.ph138:                                        ; preds = %.preheader104
  %155 = load i32, ptr @cur, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %wide.trip.count203 = zext nneg i32 %153 to i64
  %xtraiter275 = and i64 %wide.trip.count203, 3
  %157 = icmp ult i32 %153, 4
  br i1 %157, label %._crit_edge139.loopexit.unr-lcssa, label %.lr.ph138.new

.lr.ph138.new:                                    ; preds = %.lr.ph138
  %unroll_iter277 = and i64 %wide.trip.count203, 2147483644
  br label %162

158:                                              ; preds = %.lr.ph146
  tail call void @_Z8mat_nextv()
  br label %.sink.split

._crit_edge139.loopexit.unr-lcssa:                ; preds = %162, %.lr.ph138
  %indvars.iv199.unr = phi i64 [ 0, %.lr.ph138 ], [ %indvars.iv.next200.3, %162 ]
  %lcmp.mod276.not = icmp eq i64 %xtraiter275, 0
  br i1 %lcmp.mod276.not, label %._crit_edge139, label %.epil.preheader274

.epil.preheader274:                               ; preds = %._crit_edge139.loopexit.unr-lcssa, %.epil.preheader274
  %indvars.iv199.epil = phi i64 [ %indvars.iv.next200.epil, %.epil.preheader274 ], [ %indvars.iv199.unr, %._crit_edge139.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader274 ], [ 0, %._crit_edge139.loopexit.unr-lcssa ]
  %159 = getelementptr inbounds [2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 %156, i64 %indvars.iv199.epil, i64 %indvars.iv199.epil
  store i32 1, ptr %159, align 4, !tbaa !5
  %indvars.iv.next200.epil = add nuw nsw i64 %indvars.iv199.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter275
  br i1 %epil.iter.cmp.not, label %._crit_edge139, label %.epil.preheader274, !llvm.loop !27

._crit_edge139:                                   ; preds = %._crit_edge139.loopexit.unr-lcssa, %.epil.preheader274, %.preheader104
  %160 = load i64, ptr @m, align 8, !tbaa !9
  %161 = and i64 %160, 1
  %.not95 = icmp eq i64 %161, 0
  br i1 %.not95, label %167, label %.sink.split

162:                                              ; preds = %162, %.lr.ph138.new
  %indvars.iv199 = phi i64 [ 0, %.lr.ph138.new ], [ %indvars.iv.next200.3, %162 ]
  %niter278 = phi i64 [ 0, %.lr.ph138.new ], [ %niter278.next.3, %162 ]
  %163 = getelementptr inbounds [2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 %156, i64 %indvars.iv199, i64 %indvars.iv199
  store i32 1, ptr %163, align 4, !tbaa !5
  %indvars.iv.next200 = or disjoint i64 %indvars.iv199, 1
  %164 = getelementptr inbounds [2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 %156, i64 %indvars.iv.next200, i64 %indvars.iv.next200
  store i32 1, ptr %164, align 4, !tbaa !5
  %indvars.iv.next200.1 = or disjoint i64 %indvars.iv199, 2
  %165 = getelementptr inbounds [2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 %156, i64 %indvars.iv.next200.1, i64 %indvars.iv.next200.1
  store i32 1, ptr %165, align 4, !tbaa !5
  %indvars.iv.next200.2 = or disjoint i64 %indvars.iv199, 3
  %166 = getelementptr inbounds [2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 %156, i64 %indvars.iv.next200.2, i64 %indvars.iv.next200.2
  store i32 1, ptr %166, align 4, !tbaa !5
  %indvars.iv.next200.3 = add nuw nsw i64 %indvars.iv199, 4
  %niter278.next.3 = add i64 %niter278, 4
  %niter278.ncmp.3 = icmp eq i64 %niter278.next.3, %unroll_iter277
  br i1 %niter278.ncmp.3, label %._crit_edge139.loopexit.unr-lcssa, label %162, !llvm.loop !29

.sink.split:                                      ; preds = %._crit_edge139, %158
  tail call void @_Z8mat_nextv()
  br label %167

167:                                              ; preds = %.sink.split, %._crit_edge139
  %168 = getelementptr inbounds [37 x i32], ptr @f, i64 0, i64 %indvars.iv213
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %.not96 = icmp ne i32 %169, 0
  %170 = load i32, ptr @n, align 4
  %171 = icmp sgt i32 %170, 0
  %or.cond = select i1 %.not96, i1 %171, i1 false
  br i1 %or.cond, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %167, %._crit_edge142
  %172 = phi i32 [ %174, %._crit_edge142 ], [ %170, %167 ]
  %indvars.iv209 = phi i64 [ %indvars.iv.next210, %._crit_edge142 ], [ 0, %167 ]
  %173 = icmp sgt i32 %172, 0
  br i1 %173, label %.lr.ph141, label %.preheader.._crit_edge142_crit_edge

.preheader.._crit_edge142_crit_edge:              ; preds = %.preheader
  %.pre237 = sext i32 %172 to i64
  br label %._crit_edge142

._crit_edge142:                                   ; preds = %.lr.ph141, %.preheader.._crit_edge142_crit_edge
  %.pre-phi238 = phi i64 [ %.pre237, %.preheader.._crit_edge142_crit_edge ], [ %183, %.lr.ph141 ]
  %174 = phi i32 [ %172, %.preheader.._crit_edge142_crit_edge ], [ %182, %.lr.ph141 ]
  %indvars.iv.next210 = add nuw nsw i64 %indvars.iv209, 1
  %175 = icmp slt i64 %indvars.iv.next210, %.pre-phi238
  br i1 %175, label %.preheader, label %.loopexit, !llvm.loop !30

.lr.ph141:                                        ; preds = %.preheader, %.lr.ph141
  %indvars.iv205 = phi i64 [ %indvars.iv.next206, %.lr.ph141 ], [ 0, %.preheader ]
  %176 = getelementptr inbounds [35 x [35 x i64]], ptr @g, i64 0, i64 %indvars.iv209, i64 %indvars.iv205
  %177 = load i32, ptr %168, align 4, !tbaa !5
  %178 = load i32, ptr @cur, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [2 x [35 x [35 x i32]]], ptr @mat, i64 0, i64 %179, i64 %indvars.iv209, i64 %indvars.iv205
  %181 = load i32, ptr %180, align 4, !tbaa !5
  tail call void @_Z11mod_inc_mulRxii(ptr noundef nonnull align 8 dereferenceable(8) %176, i32 noundef %177, i32 noundef %181)
  %indvars.iv.next206 = add nuw nsw i64 %indvars.iv205, 1
  %182 = load i32, ptr @n, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = icmp slt i64 %indvars.iv.next206, %183
  br i1 %184, label %.lr.ph141, label %._crit_edge142, !llvm.loop !31

.loopexit:                                        ; preds = %._crit_edge142, %167
  %185 = phi i32 [ %170, %167 ], [ %174, %._crit_edge142 ]
  %indvars.iv.next214 = add nuw nsw i64 %indvars.iv213, 1
  %186 = load i32, ptr @deg, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %.not92.not = icmp slt i64 %indvars.iv213, %187
  br i1 %.not92.not, label %.lr.ph146, label %._crit_edge147, !llvm.loop !32

._crit_edge152:                                   ; preds = %._crit_edge150.us, %._crit_edge147
  %188 = ashr i32 %125, 1
  store i32 %188, ptr @n, align 4, !tbaa !5
  %189 = tail call noundef i32 @_Z7mat_detv()
  %190 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %189)
  br label %.backedge

._crit_edge158:                                   ; preds = %.backedge, %0
  ret i32 0
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z8poly_modv() local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z8mat_nextv() local_unnamed_addr #2

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

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

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


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