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

; 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, [12003 x i32] }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [166667 x i32], align 16
@tot = external dso_local global i32, align 4
@c = external dso_local global [6001 x i32], align 16
@w = external dso_local global [6001 x i32], align 16
@f = external dso_local global [166667 x i32], align 16
@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 [5 x i8], align 1
@.str.2 = 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 %struct.Poly, align 4
  %7 = alloca %struct.Poly, align 4
  %8 = alloca %struct.Poly, align 4
  %9 = alloca %struct.Poly, align 4
  %10 = alloca %struct.Poly, align 4
  %11 = alloca %struct.Poly, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr @a, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %15

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

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

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sub nsw i32 %20, 1
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = shl i32 %24, 1
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %27
  store i32 %25, ptr %28, align 4, !tbaa !5
  %29 = icmp sge i32 %25, 1000000007
  br i1 %29, label %30, label %37

30:                                               ; preds = %19
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sub nsw i32 %34, 1000000007
  store i32 %35, ptr %33, align 4, !tbaa !5
  %36 = icmp ne i32 %35, 0
  br label %37

37:                                               ; preds = %30, %19
  %38 = phi i1 [ false, %19 ], [ %36, %30 ]
  br label %39

39:                                               ; preds = %37
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

42:                                               ; preds = %18
  store i32 1, ptr getelementptr inbounds ([166667 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds ([166667 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %44

44:                                               ; preds = %277, %42
  %45 = load i32, ptr @t, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr @t, align 4, !tbaa !5
  %47 = icmp ne i32 %45, 0
  br i1 %47, label %48, label %278

48:                                               ; preds = %44
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  store i32 0, ptr @tot, 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 %50

50:                                               ; preds = %113, %48
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = mul nsw i32 %51, %52
  %54 = load i32, ptr @m, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %50
  %58 = load i32, ptr @m, align 4, !tbaa !5
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = srem i32 %58, %59
  %61 = icmp sgt i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %57
  br label %113

63:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %64 = load i32, ptr @m, align 4, !tbaa !5
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = sdiv i32 %64, %65
  store i32 %66, ptr %4, align 4, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %70, label %87

70:                                               ; preds = %63
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = and i32 %71, 1
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %87

74:                                               ; preds = %70
  %75 = load i32, ptr %3, align 4, !tbaa !5
  %76 = load i32, ptr @tot, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %77
  store i32 %75, ptr %78, align 4, !tbaa !5
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = load i32, ptr @tot, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr @tot, align 4, !tbaa !5
  %85 = sext i32 %83 to i64
  %86 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %85
  store i32 %82, ptr %86, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %74, %70, %63
  %88 = load i32, ptr %3, align 4, !tbaa !5
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %91, label %112

91:                                               ; preds = %87
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = icmp sle i32 %92, %93
  br i1 %94, label %95, label %112

95:                                               ; preds = %91
  %96 = load i32, ptr %3, align 4, !tbaa !5
  %97 = and i32 %96, 1
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %112

99:                                               ; preds = %95
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = load i32, ptr @tot, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %102
  store i32 %100, ptr %103, align 4, !tbaa !5
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = load i32, ptr @tot, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr @tot, align 4, !tbaa !5
  %110 = sext i32 %108 to i64
  %111 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %110
  store i32 %107, ptr %111, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %99, %95, %91, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %113

113:                                              ; preds = %112, %62
  %114 = load i32, ptr %3, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %3, align 4, !tbaa !5
  br label %50, !llvm.loop !11

116:                                              ; preds = %56
  %117 = load i32, ptr @n, align 4, !tbaa !5
  %118 = icmp sge i32 %117, 4
  br i1 %118, label %119, label %138

119:                                              ; preds = %116
  %120 = load i32, ptr @m, align 4, !tbaa !5
  %121 = and i32 %120, 3
  %122 = icmp eq i32 %121, 2
  br i1 %122, label %123, label %138

123:                                              ; preds = %119
  %124 = load i32, ptr @tot, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %125
  store i32 4, ptr %126, align 4, !tbaa !5
  %127 = load i32, ptr getelementptr inbounds ([166667 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
  %128 = shl i32 %127, 1
  %129 = load i32, ptr @tot, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr @tot, align 4, !tbaa !5
  %131 = sext i32 %129 to i64
  %132 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %131
  store i32 %128, ptr %132, align 4, !tbaa !5
  %133 = load i32, ptr @m, align 4, !tbaa !5
  %134 = icmp eq i32 %133, 2
  br i1 %134, label %135, label %136

135:                                              ; preds = %123
  store i32 4, ptr @m, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %135, %123
  %137 = phi i1 [ false, %123 ], [ true, %135 ]
  br label %138

138:                                              ; preds = %136, %119, %116
  %139 = load i32, ptr @m, align 4, !tbaa !5
  %140 = icmp slt i32 %139, 6001
  br i1 %140, label %141, label %224

141:                                              ; preds = %138
  %142 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %142, ptr @M, align 4, !tbaa !12
  %143 = load i32, ptr @m, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (%struct.Poly, ptr @M, i32 0, i32 1), i64 0, i64 %144
  store i32 1, ptr %145, align 4, !tbaa !5
  %146 = load i32, ptr @m, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = mul i64 %147, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (%struct.Poly, ptr @M, i32 0, i32 1), i8 0, i64 %148, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %184, %141
  %150 = load i32, ptr %5, align 4, !tbaa !5
  %151 = load i32, ptr @tot, align 4, !tbaa !5
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %154, label %153

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

154:                                              ; preds = %149
  %155 = load i32, ptr %5, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = load i32, ptr @m, align 4, !tbaa !5
  %160 = load i32, ptr %5, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = sub nsw i32 %159, %163
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (%struct.Poly, ptr @M, i32 0, i32 1), i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sub nsw i32 %167, %158
  store i32 %168, ptr %166, align 4, !tbaa !5
  %169 = icmp slt i32 %168, 0
  br i1 %169, label %170, label %182

170:                                              ; preds = %154
  %171 = load i32, ptr @m, align 4, !tbaa !5
  %172 = load i32, ptr %5, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !5
  %176 = sub nsw i32 %171, %175
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (%struct.Poly, ptr @M, i32 0, i32 1), i64 0, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1000000007
  store i32 %180, ptr %178, align 4, !tbaa !5
  %181 = icmp ne i32 %180, 0
  br label %182

182:                                              ; preds = %170, %154
  %183 = phi i1 [ false, %154 ], [ %181, %170 ]
  br label %184

184:                                              ; preds = %182
  %185 = load i32, ptr %5, align 4, !tbaa !5
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %5, align 4, !tbaa !5
  br label %149, !llvm.loop !14

187:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 48016, ptr %6) #7
  call void @llvm.memset.p0.i64(ptr align 4 %6, i8 0, i64 48016, i1 false)
  %188 = getelementptr inbounds %struct.Poly, ptr %6, i32 0, i32 0
  %189 = getelementptr inbounds %struct.Poly, ptr %6, i32 0, i32 1
  store i32 1, ptr %189, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @A, ptr align 4 %6, i64 48016, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 48016, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 48016, ptr %7) #7
  call void @llvm.memset.p0.i64(ptr align 4 %7, i8 0, i64 48016, i1 false)
  %190 = getelementptr inbounds %struct.Poly, ptr %7, i32 0, i32 0
  store i32 1, ptr %190, align 4, !tbaa !12
  %191 = getelementptr inbounds %struct.Poly, ptr %7, i32 0, i32 1
  %192 = getelementptr inbounds i32, ptr %191, i64 1
  store i32 1, ptr %192, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @B, ptr align 4 %7, i64 48016, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 48016, ptr %7) #7
  %193 = load i32, ptr @m, align 4, !tbaa !5
  %194 = sub nsw i32 %193, 1
  %195 = load i32, ptr @n, align 4, !tbaa !5
  %196 = add nsw i32 %195, %194
  store i32 %196, ptr @n, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %206, %187
  %198 = load i32, ptr @n, align 4, !tbaa !5
  %199 = icmp sgt i32 %198, 0
  br i1 %199, label %200, label %209

200:                                              ; preds = %197
  %201 = load i32, ptr @n, align 4, !tbaa !5
  %202 = and i32 %201, 1
  %203 = icmp ne i32 %202, 0
  br i1 %203, label %204, label %205

204:                                              ; preds = %200
  call void @llvm.lifetime.start.p0(i64 48016, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 48016, ptr %9) #7
  call void @_ZNK4PolymlERKS_(ptr dead_on_unwind writable sret(%struct.Poly) align 4 %9, ptr noundef nonnull align 4 dereferenceable(48016) @A, ptr noundef nonnull align 4 dereferenceable(48016) @B)
  call void @_ZNK4PolyrmERKS_(ptr dead_on_unwind writable sret(%struct.Poly) align 4 %8, ptr noundef nonnull align 4 dereferenceable(48016) %9, ptr noundef nonnull align 4 dereferenceable(48016) @M)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @A, ptr align 4 %8, i64 48016, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 48016, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 48016, ptr %8) #7
  br label %205

205:                                              ; preds = %204, %200
  br label %206

206:                                              ; preds = %205
  %207 = load i32, ptr @n, align 4, !tbaa !5
  %208 = ashr i32 %207, 1
  store i32 %208, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48016, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 48016, ptr %11) #7
  call void @_ZNK4PolymlERKS_(ptr dead_on_unwind writable sret(%struct.Poly) align 4 %11, ptr noundef nonnull align 4 dereferenceable(48016) @B, ptr noundef nonnull align 4 dereferenceable(48016) @B)
  call void @_ZNK4PolyrmERKS_(ptr dead_on_unwind writable sret(%struct.Poly) align 4 %10, ptr noundef nonnull align 4 dereferenceable(48016) %11, ptr noundef nonnull align 4 dereferenceable(48016) @M)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @B, ptr align 4 %10, i64 48016, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 48016, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 48016, ptr %10) #7
  br label %197, !llvm.loop !17

209:                                              ; preds = %197
  %210 = load i32, ptr @A, align 4, !tbaa !12
  %211 = load i32, ptr @m, align 4, !tbaa !5
  %212 = sub nsw i32 %211, 1
  %213 = icmp eq i32 %210, %212
  br i1 %213, label %214, label %220

214:                                              ; preds = %209
  %215 = load i32, ptr @m, align 4, !tbaa !5
  %216 = sub nsw i32 %215, 1
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (%struct.Poly, ptr @A, i32 0, i32 1), i64 0, i64 %217
  %219 = load i32, ptr %218, align 4, !tbaa !5
  br label %221

220:                                              ; preds = %209
  br label %221

221:                                              ; preds = %220, %214
  %222 = phi i32 [ %219, %214 ], [ 0, %220 ]
  %223 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %222)
  br label %277

224:                                              ; preds = %138
  store i32 1, ptr @f, align 16, !tbaa !5
  %225 = load i32, ptr @n, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = mul i64 %226, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @f, i64 1), i8 0, i64 %227, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %228

228:                                              ; preds = %268, %224
  %229 = load i32, ptr %12, align 4, !tbaa !5
  %230 = load i32, ptr @n, align 4, !tbaa !5
  %231 = icmp sle i32 %229, %230
  br i1 %231, label %233, label %232

232:                                              ; preds = %228
  store i32 16, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %271

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

234:                                              ; preds = %264, %233
  %235 = load i32, ptr %14, align 4, !tbaa !5
  %236 = load i32, ptr @tot, align 4, !tbaa !5
  %237 = icmp slt i32 %235, %236
  br i1 %237, label %239, label %238

238:                                              ; preds = %234
  store i32 19, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %267

239:                                              ; preds = %234
  %240 = load i32, ptr %12, align 4, !tbaa !5
  %241 = load i32, ptr %14, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %242
  %244 = load i32, ptr %243, align 4, !tbaa !5
  %245 = icmp sge i32 %240, %244
  br i1 %245, label %246, label %263

246:                                              ; preds = %239
  %247 = load i32, ptr %12, align 4, !tbaa !5
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [166667 x i32], ptr @f, i64 0, i64 %248
  %250 = load i32, ptr %12, align 4, !tbaa !5
  %251 = load i32, ptr %14, align 4, !tbaa !5
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %252
  %254 = load i32, ptr %253, align 4, !tbaa !5
  %255 = sub nsw i32 %250, %254
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [166667 x i32], ptr @f, i64 0, i64 %256
  %258 = load i32, ptr %257, align 4, !tbaa !5
  %259 = load i32, ptr %14, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %260
  %262 = load i32, ptr %261, align 4, !tbaa !5
  call void @_Z11mod_inc_mulRiii(ptr noundef nonnull align 4 dereferenceable(4) %249, i32 noundef %258, i32 noundef %262)
  br label %263

263:                                              ; preds = %246, %239
  br label %264

264:                                              ; preds = %263
  %265 = load i32, ptr %14, align 4, !tbaa !5
  %266 = add nsw i32 %265, 1
  store i32 %266, ptr %14, align 4, !tbaa !5
  br label %234, !llvm.loop !18

267:                                              ; preds = %238
  br label %268

268:                                              ; preds = %267
  %269 = load i32, ptr %12, align 4, !tbaa !5
  %270 = add nsw i32 %269, 1
  store i32 %270, ptr %12, align 4, !tbaa !5
  br label %228, !llvm.loop !19

271:                                              ; preds = %232
  %272 = load i32, ptr @n, align 4, !tbaa !5
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds [166667 x i32], ptr @f, i64 0, i64 %273
  %275 = load i32, ptr %274, align 4, !tbaa !5
  %276 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %275)
  br label %277

277:                                              ; preds = %271, %221
  br label %44, !llvm.loop !20

278:                                              ; preds = %44
  ret i32 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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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: mustprogress uwtable
declare dso_local void @_ZNK4PolymlERKS_(ptr dead_on_unwind noalias writable sret(%struct.Poly) align 4, ptr noundef nonnull align 4 dereferenceable(48016), ptr noundef nonnull align 4 dereferenceable(48016)) #5 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(48016), ptr noundef nonnull align 4 dereferenceable(48016)) #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z11mod_inc_mulRiii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { 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 #7 = { nounwind }

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

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


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

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global [166667 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@c = external dso_local local_unnamed_addr global [6001 x i32], align 16
@w = external dso_local local_unnamed_addr global [6001 x i32], align 16
@f = external dso_local global [166667 x i32], align 16
@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 [5 x i8], align 1
@.str.2 = 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 = 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 1, ptr @a, align 16, !tbaa !5
  br label %9

5:                                                ; preds = %9
  store i32 1, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 8, !tbaa !5
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %7 = load i32, ptr @t, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @t, align 4, !tbaa !5
  %.not82 = icmp eq i32 %7, 0
  br i1 %.not82, label %._crit_edge85, label %.lr.ph84

9:                                                ; preds = %9, %0
  %10 = phi i32 [ 1, %0 ], [ %spec.select.1, %9 ]
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.1, %9 ]
  %11 = shl i32 %10, 1
  %12 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %indvars.iv
  %13 = icmp sgt i32 %11, 1000000006
  %14 = add nsw i32 %11, -1000000007
  %spec.select = select i1 %13, i32 %14, i32 %11
  store i32 %spec.select, ptr %12, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = shl i32 %spec.select, 1
  %16 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %indvars.iv.next
  %17 = icmp sgt i32 %15, 1000000006
  %18 = add nsw i32 %15, -1000000007
  %spec.select.1 = select i1 %17, i32 %18, i32 %15
  store i32 %spec.select.1, ptr %16, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 166667
  br i1 %exitcond.not.1, label %5, label %9, !llvm.loop !9

.lr.ph84:                                         ; preds = %5, %158
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store i32 0, ptr @tot, align 4, !tbaa !5
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %.not5066 = icmp slt i32 %20, 1
  %.pre = load i32, ptr @n, align 4
  br i1 %.not5066, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph84
  %21 = sext i32 %.pre to i64
  br label %26

._crit_edge:                                      ; preds = %53, %.lr.ph84
  %22 = phi i32 [ 0, %.lr.ph84 ], [ %54, %53 ]
  %23 = icmp sgt i32 %.pre, 3
  %24 = and i32 %20, 3
  %25 = icmp eq i32 %24, 2
  %or.cond61 = and i1 %25, %23
  br i1 %or.cond61, label %57, label %65

26:                                               ; preds = %.lr.ph, %53
  %indvars.iv89 = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next90, %53 ]
  %27 = phi i32 [ 0, %.lr.ph ], [ %54, %53 ]
  %28 = trunc nuw nsw i64 %indvars.iv89 to i32
  %29 = urem i32 %20, %28
  %30 = udiv i32 %20, %28
  %.not86 = icmp eq i32 %29, 0
  br i1 %.not86, label %31, label %53

31:                                               ; preds = %26
  %.not54 = icmp sgt i64 %indvars.iv89, %21
  %32 = and i32 %30, 1
  %.not55 = icmp eq i32 %32, 0
  %or.cond = or i1 %.not54, %.not55
  br i1 %or.cond, label %40, label %33

33:                                               ; preds = %31
  %34 = sext i32 %27 to i64
  %35 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %34
  store i32 %28, ptr %35, align 4, !tbaa !5
  %36 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %indvars.iv89
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = add nsw i32 %27, 1
  store i32 %38, ptr @tot, align 4, !tbaa !5
  %39 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %34
  store i32 %37, ptr %39, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %33, %31
  %41 = phi i32 [ %38, %33 ], [ %27, %31 ]
  %42 = zext nneg i32 %30 to i64
  %43 = icmp uge i64 %indvars.iv89, %42
  %.not56 = icmp sgt i32 %30, %.pre
  %or.cond58 = or i1 %43, %.not56
  %44 = and i32 %28, 1
  %.not57 = icmp eq i32 %44, 0
  %or.cond59 = or i1 %.not57, %or.cond58
  br i1 %or.cond59, label %53, label %45

45:                                               ; preds = %40
  %46 = sext i32 %41 to i64
  %47 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %46
  store i32 %30, ptr %47, align 4, !tbaa !5
  %48 = zext nneg i32 %30 to i64
  %49 = getelementptr inbounds [166667 x i32], ptr @a, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %41, 1
  store i32 %51, ptr @tot, align 4, !tbaa !5
  %52 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %46
  store i32 %50, ptr %52, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %40, %45, %26
  %54 = phi i32 [ %41, %40 ], [ %51, %45 ], [ %27, %26 ]
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %55 = mul nuw nsw i64 %indvars.iv.next90, %indvars.iv.next90
  %56 = trunc nuw i64 %55 to i32
  %.not50 = icmp slt i32 %20, %56
  br i1 %.not50, label %._crit_edge, label %26, !llvm.loop !11

57:                                               ; preds = %._crit_edge
  %58 = sext i32 %22 to i64
  %59 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %58
  store i32 4, ptr %59, align 4, !tbaa !5
  %60 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 8, !tbaa !5
  %61 = shl i32 %60, 1
  %62 = add nsw i32 %22, 1
  store i32 %62, ptr @tot, align 4, !tbaa !5
  %63 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %58
  store i32 %61, ptr %63, align 4, !tbaa !5
  %64 = icmp eq i32 %20, 2
  br i1 %64, label %.thread, label %65

.thread:                                          ; preds = %57
  store i32 4, ptr @m, align 4, !tbaa !5
  br label %68

65:                                               ; preds = %57, %._crit_edge
  %66 = phi i32 [ %62, %57 ], [ %22, %._crit_edge ]
  %67 = icmp slt i32 %20, 6001
  br i1 %67, label %68, label %126

68:                                               ; preds = %.thread, %65
  %69 = phi i32 [ %62, %.thread ], [ %66, %65 ]
  %70 = phi i32 [ 4, %.thread ], [ %20, %65 ]
  store i32 %70, ptr @M, align 4, !tbaa !12
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (i8, ptr @M, i64 4), i64 0, i64 %71
  store i32 1, ptr %72, align 4, !tbaa !5
  %73 = shl nsw i64 %71, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @M, i64 4), i8 0, i64 %73, i1 false)
  %74 = icmp sgt i32 %69, 0
  br i1 %74, label %.lr.ph77.preheader, label %._crit_edge78

.lr.ph77.preheader:                               ; preds = %68
  %wide.trip.count = zext nneg i32 %69 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %75 = icmp eq i32 %69, 1
  br i1 %75, label %._crit_edge78.loopexit.unr-lcssa, label %.lr.ph77.preheader.new

.lr.ph77.preheader.new:                           ; preds = %.lr.ph77.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph77

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

.lr.ph77.epil:                                    ; preds = %._crit_edge78.loopexit.unr-lcssa
  %76 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %indvars.iv98.unr
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %indvars.iv98.unr
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sub nsw i32 %70, %79
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (i8, ptr @M, i64 4), i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sub nsw i32 %83, %77
  %85 = icmp slt i32 %84, 0
  %86 = add nsw i32 %84, 1000000007
  %spec.select63.epil = select i1 %85, i32 %86, i32 %84
  store i32 %spec.select63.epil, ptr %82, align 4, !tbaa !5
  br label %._crit_edge78

._crit_edge78:                                    ; preds = %.lr.ph77.epil, %._crit_edge78.loopexit.unr-lcssa, %68
  store i32 0, 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(48008) getelementptr inbounds (i8, ptr @A, i64 8), i8 0, i64 48008, i1 false)
  store i32 1, 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(48004) getelementptr inbounds (i8, ptr @B, i64 12), i8 0, i64 48004, i1 false)
  %87 = add i32 %.pre, -1
  %88 = add i32 %87, %70
  store i32 %88, ptr @n, align 4, !tbaa !5
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph80, label %._crit_edge81

.lr.ph77:                                         ; preds = %.lr.ph77, %.lr.ph77.preheader.new
  %indvars.iv98 = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %indvars.iv.next99.1, %.lr.ph77 ]
  %niter = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %niter.next.1, %.lr.ph77 ]
  %90 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %indvars.iv98
  %91 = load i32, ptr %90, align 8, !tbaa !5
  %92 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %indvars.iv98
  %93 = load i32, ptr %92, align 8, !tbaa !5
  %94 = sub nsw i32 %70, %93
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (i8, ptr @M, i64 4), i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = sub nsw i32 %97, %91
  %99 = icmp slt i32 %98, 0
  %100 = add nsw i32 %98, 1000000007
  %spec.select63 = select i1 %99, i32 %100, i32 %98
  store i32 %spec.select63, ptr %96, align 4, !tbaa !5
  %indvars.iv.next99 = or disjoint i64 %indvars.iv98, 1
  %101 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %indvars.iv.next99
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %indvars.iv.next99
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sub nsw i32 %70, %104
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (i8, ptr @M, i64 4), i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sub nsw i32 %108, %102
  %110 = icmp slt i32 %109, 0
  %111 = add nsw i32 %109, 1000000007
  %spec.select63.1 = select i1 %110, i32 %111, i32 %109
  store i32 %spec.select63.1, ptr %107, align 4, !tbaa !5
  %indvars.iv.next99.1 = add nuw nsw i64 %indvars.iv98, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge78.loopexit.unr-lcssa, label %.lr.ph77, !llvm.loop !14

.lr.ph80:                                         ; preds = %._crit_edge78, %115
  %112 = phi i32 [ %.pr62, %115 ], [ %88, %._crit_edge78 ]
  %113 = and i32 %112, 1
  %.not53 = icmp eq i32 %113, 0
  br i1 %.not53, label %115, label %114

114:                                              ; preds = %.lr.ph80
  call void @llvm.lifetime.start.p0(i64 48016, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 48016, ptr nonnull %2) #7
  call void @_ZNK4PolymlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Poly) align 4 %2, ptr noundef nonnull align 4 dereferenceable(48016) @A, ptr noundef nonnull align 4 dereferenceable(48016) @B)
  call void @_ZNK4PolyrmERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Poly) align 4 %1, ptr noundef nonnull align 4 dereferenceable(48016) %2, ptr noundef nonnull align 4 dereferenceable(48016) @M)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(48016) @A, ptr noundef nonnull align 4 dereferenceable(48016) %1, i64 48016, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 48016, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 48016, ptr nonnull %1) #7
  %.pre104 = load i32, ptr @n, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %.lr.ph80, %114
  %116 = phi i32 [ %112, %.lr.ph80 ], [ %.pre104, %114 ]
  %117 = ashr i32 %116, 1
  store i32 %117, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48016, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 48016, ptr nonnull %4) #7
  call void @_ZNK4PolymlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Poly) align 4 %4, ptr noundef nonnull align 4 dereferenceable(48016) @B, ptr noundef nonnull align 4 dereferenceable(48016) @B)
  call void @_ZNK4PolyrmERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Poly) align 4 %3, ptr noundef nonnull align 4 dereferenceable(48016) %4, ptr noundef nonnull align 4 dereferenceable(48016) @M)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(48016) @B, ptr noundef nonnull align 4 dereferenceable(48016) %3, i64 48016, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 48016, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 48016, ptr nonnull %3) #7
  %.pr62 = load i32, ptr @n, align 4, !tbaa !5
  %118 = icmp sgt i32 %.pr62, 0
  br i1 %118, label %.lr.ph80, label %._crit_edge81.loopexit, !llvm.loop !17

._crit_edge81.loopexit:                           ; preds = %115
  %.pre105 = load i32, ptr @A, align 4, !tbaa !12
  %.pre106 = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge81

._crit_edge81:                                    ; preds = %._crit_edge81.loopexit, %._crit_edge78
  %119 = phi i32 [ %.pre106, %._crit_edge81.loopexit ], [ %70, %._crit_edge78 ]
  %120 = phi i32 [ %.pre105, %._crit_edge81.loopexit ], [ 0, %._crit_edge78 ]
  %121 = add nsw i32 %119, -1
  %122 = icmp eq i32 %120, %121
  br i1 %122, label %123, label %158

123:                                              ; preds = %._crit_edge81
  %124 = sext i32 %120 to i64
  %125 = getelementptr inbounds [12003 x i32], ptr getelementptr inbounds (i8, ptr @A, i64 4), i64 0, i64 %124
  br label %.sink.split

126:                                              ; preds = %65
  store i32 1, ptr @f, align 16, !tbaa !5
  %127 = sext i32 %.pre to i64
  %128 = shl nsw i64 %127, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @f, i64 4), i8 0, i64 %128, i1 false)
  %.not5171 = icmp sgt i32 %.pre, 0
  %129 = icmp sgt i32 %66, 0
  %or.cond109 = select i1 %.not5171, i1 %129, i1 false
  br i1 %or.cond109, label %.preheader, label %._crit_edge73

.preheader:                                       ; preds = %126, %._crit_edge70
  %130 = phi i32 [ %137, %._crit_edge70 ], [ %.pre, %126 ]
  %131 = phi i32 [ %138, %._crit_edge70 ], [ %66, %126 ]
  %132 = phi i32 [ %139, %._crit_edge70 ], [ %66, %126 ]
  %indvars.iv95 = phi i64 [ %indvars.iv.next96, %._crit_edge70 ], [ 1, %126 ]
  %133 = icmp sgt i32 %132, 0
  br i1 %133, label %.lr.ph69, label %._crit_edge70

.lr.ph69:                                         ; preds = %.preheader
  %134 = getelementptr inbounds [166667 x i32], ptr @f, i64 0, i64 %indvars.iv95
  %135 = trunc nuw nsw i64 %indvars.iv95 to i32
  br label %141

._crit_edge73:                                    ; preds = %._crit_edge70, %126
  %.pre-phi = phi i64 [ %127, %126 ], [ %140, %._crit_edge70 ]
  %136 = getelementptr inbounds [166667 x i32], ptr @f, i64 0, i64 %.pre-phi
  br label %.sink.split

._crit_edge70.loopexit:                           ; preds = %153
  %.pre103 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge70

._crit_edge70:                                    ; preds = %._crit_edge70.loopexit, %.preheader
  %137 = phi i32 [ %.pre103, %._crit_edge70.loopexit ], [ %130, %.preheader ]
  %138 = phi i32 [ %154, %._crit_edge70.loopexit ], [ %131, %.preheader ]
  %139 = phi i32 [ %154, %._crit_edge70.loopexit ], [ %132, %.preheader ]
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %140 = sext i32 %137 to i64
  %.not51.not = icmp slt i64 %indvars.iv95, %140
  br i1 %.not51.not, label %.preheader, label %._crit_edge73, !llvm.loop !18

141:                                              ; preds = %.lr.ph69, %153
  %142 = phi i32 [ %131, %.lr.ph69 ], [ %154, %153 ]
  %indvars.iv92 = phi i64 [ 0, %.lr.ph69 ], [ %indvars.iv.next93, %153 ]
  %143 = getelementptr inbounds [6001 x i32], ptr @c, i64 0, i64 %indvars.iv92
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %.not52 = icmp slt i64 %indvars.iv95, %145
  br i1 %.not52, label %153, label %146

146:                                              ; preds = %141
  %147 = sub nsw i32 %135, %144
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [166667 x i32], ptr @f, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = getelementptr inbounds [6001 x i32], ptr @w, i64 0, i64 %indvars.iv92
  %152 = load i32, ptr %151, align 4, !tbaa !5
  call void @_Z11mod_inc_mulRiii(ptr noundef nonnull align 4 dereferenceable(4) %134, i32 noundef %150, i32 noundef %152)
  %.pre102 = load i32, ptr @tot, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %141, %146
  %154 = phi i32 [ %142, %141 ], [ %.pre102, %146 ]
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %155 = sext i32 %154 to i64
  %156 = icmp slt i64 %indvars.iv.next93, %155
  br i1 %156, label %141, label %._crit_edge70.loopexit, !llvm.loop !20

.sink.split:                                      ; preds = %._crit_edge73, %123
  %.sink110 = phi ptr [ %125, %123 ], [ %136, %._crit_edge73 ]
  %157 = load i32, ptr %.sink110, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %.sink.split, %._crit_edge81
  %.sink = phi i32 [ 0, %._crit_edge81 ], [ %157, %.sink.split ]
  %159 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.sink)
  %160 = load i32, ptr @t, align 4, !tbaa !5
  %161 = add nsw i32 %160, -1
  store i32 %161, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %160, 0
  br i1 %.not, label %._crit_edge85, label %.lr.ph84, !llvm.loop !21

._crit_edge85:                                    ; preds = %158, %5
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4PolymlERKS_(ptr dead_on_unwind noalias writable sret(%struct.Poly) align 4, ptr noundef nonnull align 4 dereferenceable(48016), ptr noundef nonnull align 4 dereferenceable(48016)) local_unnamed_addr #5 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(48016), ptr noundef nonnull align 4 dereferenceable(48016)) local_unnamed_addr #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z11mod_inc_mulRiii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef) local_unnamed_addr #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { 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 #7 = { nounwind }

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

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


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