; LLVM IR from tangjz/acm-icpc :: lydsy (4815)

; 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
@sqn = external dso_local global i32, align 4
@f = external dso_local global [4000001 x i32], align 16
@a = external dso_local global [4000001 x i32], align 16
@b = external dso_local global [4000001 x i32], align 16
@id = external dso_local global [4000001 x i32], align 16
@dt = external dso_local global [2001 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 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 ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %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 i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store ptr @sqn, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store ptr @id, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store ptr @b, ptr %4, align 8, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([4000001 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !9
  store i32 1, ptr getelementptr inbounds ([4000001 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 2, ptr %5, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %160, %0
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = load i32, ptr @n, align 4, !tbaa !9
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %163

36:                                               ; preds = %31
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %37, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %59, label %43

43:                                               ; preds = %36
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = sub nsw i32 %44, 1
  %46 = load i32, ptr %5, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %47
  store i32 %45, ptr %48, align 4, !tbaa !9
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr %50, i64 %52
  store i32 %49, ptr %53, align 4, !tbaa !9
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = load i32, ptr @sqn, align 4, !tbaa !9
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr @sqn, align 4, !tbaa !9
  %57 = sext i32 %55 to i64
  %58 = getelementptr inbounds i32, ptr %54, i64 %57
  store i32 %49, ptr %58, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %43, %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  br label %60

60:                                               ; preds = %122, %59
  %61 = load i32, ptr %5, align 4, !tbaa !9
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %62, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !9
  %67 = mul nsw i32 %61, %66
  store i32 %67, ptr %8, align 4, !tbaa !9
  %68 = load i32, ptr @n, align 4, !tbaa !9
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %60
  store i32 5, ptr %6, align 4
  br label %125

71:                                               ; preds = %60
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = load i32, ptr %7, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds i32, ptr %72, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i32, ptr %77, i64 %79
  store i32 %76, ptr %80, align 4, !tbaa !9
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = load i32, ptr %5, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i32, ptr %81, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !9
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = load i32, ptr %7, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr %86, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = icmp eq i32 %85, %90
  br i1 %91, label %92, label %106

92:                                               ; preds = %71
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !9
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = load i32, ptr %7, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds i32, ptr %97, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !9
  %102 = mul nsw i32 %96, %101
  %103 = load i32, ptr %8, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %104
  store i32 %102, ptr %105, align 4, !tbaa !9
  store i32 5, ptr %6, align 4
  br label %125

106:                                              ; preds = %71
  %107 = load i32, ptr %5, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !9
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = load i32, ptr %7, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i32, ptr %111, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = sub nsw i32 %115, 1
  %117 = mul nsw i32 %110, %116
  %118 = load i32, ptr %8, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %119
  store i32 %117, ptr %120, align 4, !tbaa !9
  br label %121

121:                                              ; preds = %106
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %7, align 4, !tbaa !9
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %7, align 4, !tbaa !9
  br label %60, !llvm.loop !11

125:                                              ; preds = %92, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %5, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = load i32, ptr %5, align 4, !tbaa !9
  %130 = sext i32 %129 to i64
  %131 = mul nsw i64 %128, %130
  %132 = srem i64 %131, 1000000007
  %133 = trunc i64 %132 to i32
  %134 = load i32, ptr %5, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %135
  store i32 %133, ptr %136, align 4, !tbaa !9
  %137 = load i32, ptr %5, align 4, !tbaa !9
  %138 = sub nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = load i32, ptr %5, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !9
  %147 = sext i32 %146 to i64
  %148 = load i32, ptr %5, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !9
  %152 = sext i32 %151 to i64
  %153 = mul nsw i64 %147, %152
  %154 = add nsw i64 %142, %153
  %155 = srem i64 %154, 1000000007
  %156 = trunc i64 %155 to i32
  %157 = load i32, ptr %5, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %158
  store i32 %156, ptr %159, align 4, !tbaa !9
  br label %160

160:                                              ; preds = %126
  %161 = load i32, ptr %5, align 4, !tbaa !9
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %5, align 4, !tbaa !9
  br label %31, !llvm.loop !13

163:                                              ; preds = %35
  store i32 1, ptr @sqn, align 4, !tbaa !9
  br label %164

164:                                              ; preds = %171, %163
  %165 = load i32, ptr @sqn, align 4, !tbaa !9
  %166 = load i32, ptr @sqn, align 4, !tbaa !9
  %167 = mul nsw i32 %165, %166
  %168 = load i32, ptr @n, align 4, !tbaa !9
  %169 = icmp slt i32 %167, %168
  br i1 %169, label %170, label %174

170:                                              ; preds = %164
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr @sqn, align 4, !tbaa !9
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr @sqn, align 4, !tbaa !9
  br label %164, !llvm.loop !14

174:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %175

175:                                              ; preds = %207, %174
  %176 = load i32, ptr %9, align 4, !tbaa !9
  %177 = load i32, ptr @n, align 4, !tbaa !9
  %178 = icmp sle i32 %176, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %175
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %209

180:                                              ; preds = %175
  %181 = load i32, ptr %9, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !9
  %185 = load i32, ptr %9, align 4, !tbaa !9
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [4000001 x i32], ptr @b, i64 0, i64 %186
  store i32 %184, ptr %187, align 4, !tbaa !9
  %188 = load i32, ptr %9, align 4, !tbaa !9
  %189 = sub nsw i32 %188, 1
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [4000001 x i32], ptr @b, i64 0, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !9
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %187, i32 noundef %192)
  %193 = load i32, ptr %10, align 4, !tbaa !9
  %194 = load i32, ptr %9, align 4, !tbaa !9
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %195
  store i32 %193, ptr %196, align 4, !tbaa !9
  br label %197

197:                                              ; preds = %180
  %198 = load i32, ptr %9, align 4, !tbaa !9
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %9, align 4, !tbaa !9
  %200 = load i32, ptr %11, align 4, !tbaa !9
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %11, align 4, !tbaa !9
  %202 = load i32, ptr @sqn, align 4, !tbaa !9
  %203 = icmp eq i32 %201, %202
  br i1 %203, label %204, label %207

204:                                              ; preds = %197
  %205 = load i32, ptr %10, align 4, !tbaa !9
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %207

207:                                              ; preds = %204, %197
  %208 = phi i1 [ false, %197 ], [ false, %204 ]
  br label %175, !llvm.loop !15

209:                                              ; preds = %179
  br label %210

210:                                              ; preds = %356, %209
  %211 = load i32, ptr @t, align 4, !tbaa !9
  %212 = add nsw i32 %211, -1
  store i32 %212, ptr @t, align 4, !tbaa !9
  %213 = icmp ne i32 %211, 0
  br i1 %213, label %214, label %359

214:                                              ; preds = %210
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %215 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %12, ptr noundef %13, ptr noundef %15, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %216 = load i32, ptr %12, align 4, !tbaa !9
  %217 = load i32, ptr %13, align 4, !tbaa !9
  %218 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %216, i32 noundef %217)
  store i32 %218, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %219 = load i64, ptr %15, align 8, !tbaa !16
  %220 = load i32, ptr %12, align 4, !tbaa !9
  %221 = load i32, ptr %16, align 4, !tbaa !9
  %222 = sdiv i32 %220, %221
  %223 = sext i32 %222 to i64
  %224 = sdiv i64 %219, %223
  %225 = load i32, ptr %13, align 4, !tbaa !9
  %226 = load i32, ptr %16, align 4, !tbaa !9
  %227 = sdiv i32 %225, %226
  %228 = sext i32 %227 to i64
  %229 = sdiv i64 %224, %228
  %230 = srem i64 %229, 1000000007
  %231 = trunc i64 %230 to i32
  store i32 %231, ptr %17, align 4, !tbaa !9
  %232 = load i32, ptr %16, align 4, !tbaa !9
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !9
  %236 = load i32, ptr %17, align 4, !tbaa !9
  %237 = icmp ne i32 %235, %236
  br i1 %237, label %238, label %302

238:                                              ; preds = %214
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %239 = load i32, ptr %17, align 4, !tbaa !9
  %240 = load i32, ptr %16, align 4, !tbaa !9
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %241
  %243 = load i32, ptr %242, align 4, !tbaa !9
  %244 = sub nsw i32 %239, %243
  store i32 %244, ptr %18, align 4, !tbaa !9
  %245 = load i32, ptr %18, align 4, !tbaa !9
  %246 = icmp slt i32 %245, 0
  br i1 %246, label %247, label %250

247:                                              ; preds = %238
  %248 = load i32, ptr %18, align 4, !tbaa !9
  %249 = add nsw i32 %248, 1000000007
  store i32 %249, ptr %18, align 4, !tbaa !9
  br label %250

250:                                              ; preds = %247, %238
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %251 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %251, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %252 = load i32, ptr %16, align 4, !tbaa !9
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !9
  %256 = add nsw i32 %255, 1
  %257 = load i32, ptr @sqn, align 4, !tbaa !9
  %258 = mul nsw i32 %256, %257
  store i32 %258, ptr %21, align 4, !tbaa !9
  %259 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %260 = load i32, ptr %259, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  store i32 %260, ptr %20, align 4, !tbaa !9
  br label %261

261:                                              ; preds = %271, %250
  %262 = load i32, ptr %19, align 4, !tbaa !9
  %263 = load i32, ptr %20, align 4, !tbaa !9
  %264 = icmp sle i32 %262, %263
  br i1 %264, label %266, label %265

265:                                              ; preds = %261
  store i32 16, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %274

266:                                              ; preds = %261
  %267 = load i32, ptr %19, align 4, !tbaa !9
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [4000001 x i32], ptr @b, i64 0, i64 %268
  %270 = load i32, ptr %18, align 4, !tbaa !9
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %269, i32 noundef %270)
  br label %271

271:                                              ; preds = %266
  %272 = load i32, ptr %19, align 4, !tbaa !9
  %273 = add nsw i32 %272, 1
  store i32 %273, ptr %19, align 4, !tbaa !9
  br label %261, !llvm.loop !18

274:                                              ; preds = %265
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %275 = load i32, ptr %16, align 4, !tbaa !9
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %276
  %278 = load i32, ptr %277, align 4, !tbaa !9
  %279 = add nsw i32 %278, 1
  store i32 %279, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %280 = load i32, ptr @n, align 4, !tbaa !9
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %281
  %283 = load i32, ptr %282, align 4, !tbaa !9
  store i32 %283, ptr %23, align 4, !tbaa !9
  br label %284

284:                                              ; preds = %294, %274
  %285 = load i32, ptr %22, align 4, !tbaa !9
  %286 = load i32, ptr %23, align 4, !tbaa !9
  %287 = icmp sle i32 %285, %286
  br i1 %287, label %289, label %288

288:                                              ; preds = %284
  store i32 19, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %297

289:                                              ; preds = %284
  %290 = load i32, ptr %22, align 4, !tbaa !9
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [2001 x i32], ptr @dt, i64 0, i64 %291
  %293 = load i32, ptr %18, align 4, !tbaa !9
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %292, i32 noundef %293)
  br label %294

294:                                              ; preds = %289
  %295 = load i32, ptr %22, align 4, !tbaa !9
  %296 = add nsw i32 %295, 1
  store i32 %296, ptr %22, align 4, !tbaa !9
  br label %284, !llvm.loop !19

297:                                              ; preds = %288
  %298 = load i32, ptr %17, align 4, !tbaa !9
  %299 = load i32, ptr %16, align 4, !tbaa !9
  %300 = sext i32 %299 to i64
  %301 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %300
  store i32 %298, ptr %301, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %302

302:                                              ; preds = %297, %214
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 0, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  store i32 1, ptr %27, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #5
  br label %303

303:                                              ; preds = %347, %302
  %304 = load i32, ptr %27, align 4, !tbaa !9
  %305 = load i32, ptr %14, align 4, !tbaa !9
  %306 = icmp sle i32 %304, %305
  br i1 %306, label %308, label %307

307:                                              ; preds = %303
  store i32 22, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  br label %350

308:                                              ; preds = %303
  %309 = load i32, ptr %14, align 4, !tbaa !9
  %310 = load i32, ptr %27, align 4, !tbaa !9
  %311 = sdiv i32 %309, %310
  store i32 %311, ptr %29, align 4, !tbaa !9
  %312 = load i32, ptr %14, align 4, !tbaa !9
  %313 = load i32, ptr %29, align 4, !tbaa !9
  %314 = sdiv i32 %312, %313
  store i32 %314, ptr %28, align 4, !tbaa !9
  %315 = load i32, ptr %28, align 4, !tbaa !9
  %316 = sext i32 %315 to i64
  %317 = getelementptr inbounds [4000001 x i32], ptr @b, i64 0, i64 %316
  %318 = load i32, ptr %317, align 4, !tbaa !9
  store i32 %318, ptr %25, align 4, !tbaa !9
  %319 = load i32, ptr %28, align 4, !tbaa !9
  %320 = sext i32 %319 to i64
  %321 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %320
  %322 = load i32, ptr %321, align 4, !tbaa !9
  %323 = sext i32 %322 to i64
  %324 = getelementptr inbounds [2001 x i32], ptr @dt, i64 0, i64 %323
  %325 = load i32, ptr %324, align 4, !tbaa !9
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %25, i32 noundef %325)
  %326 = load i32, ptr %24, align 4, !tbaa !9
  %327 = load i32, ptr %25, align 4, !tbaa !9
  %328 = icmp eq i32 %326, %327
  br i1 %328, label %329, label %330

329:                                              ; preds = %308
  br label %347

330:                                              ; preds = %308
  %331 = load i32, ptr %26, align 4, !tbaa !9
  %332 = sext i32 %331 to i64
  %333 = load i32, ptr %25, align 4, !tbaa !9
  %334 = load i32, ptr %24, align 4, !tbaa !9
  %335 = sub nsw i32 %333, %334
  %336 = sext i32 %335 to i64
  %337 = load i32, ptr %29, align 4, !tbaa !9
  %338 = sext i32 %337 to i64
  %339 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %338
  %340 = load i32, ptr %339, align 4, !tbaa !9
  %341 = sext i32 %340 to i64
  %342 = mul nsw i64 %336, %341
  %343 = add nsw i64 %332, %342
  %344 = srem i64 %343, 1000000007
  %345 = trunc i64 %344 to i32
  store i32 %345, ptr %26, align 4, !tbaa !9
  %346 = load i32, ptr %25, align 4, !tbaa !9
  store i32 %346, ptr %24, align 4, !tbaa !9
  br label %347

347:                                              ; preds = %330, %329
  %348 = load i32, ptr %28, align 4, !tbaa !9
  %349 = add nsw i32 %348, 1
  store i32 %349, ptr %27, align 4, !tbaa !9
  br label %303, !llvm.loop !20

350:                                              ; preds = %307
  %351 = load i32, ptr %26, align 4, !tbaa !9
  %352 = icmp slt i32 %351, 0
  br i1 %352, label %353, label %356

353:                                              ; preds = %350
  %354 = load i32, ptr %26, align 4, !tbaa !9
  %355 = add nsw i32 %354, 1000000007
  store i32 %355, ptr %26, align 4, !tbaa !9
  br label %356

356:                                              ; preds = %353, %350
  %357 = load i32, ptr %26, align 4, !tbaa !9
  %358 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %357)
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %210, !llvm.loop !21

359:                                              ; preds = %210
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %360 = load i32, ptr %1, align 4
  ret i32 %360
}

declare i32 @__isoc99_scanf(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 @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #3

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

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

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

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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !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
@sqn = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local local_unnamed_addr global [4000001 x i32], align 16
@a = external dso_local local_unnamed_addr global [4000001 x i32], align 16
@b = external dso_local global [4000001 x i32], align 16
@id = external dso_local local_unnamed_addr global [4000001 x i32], align 16
@dt = external dso_local global [2001 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t, ptr noundef nonnull @n)
  store i32 1, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %.not122 = icmp slt i32 %8, 2
  br i1 %.not122, label %.preheader117.preheader, label %.lr.ph124.preheader

.lr.ph124.preheader:                              ; preds = %0
  %sqn.promoted = load i32, ptr @sqn, align 4, !tbaa !5
  %9 = add nuw i32 %8, 1
  %wide.trip.count = zext i32 %9 to i64
  br label %.lr.ph124

.lr.ph124:                                        ; preds = %.lr.ph124.preheader, %.loopexit
  %indvars.iv153 = phi i64 [ 2, %.lr.ph124.preheader ], [ %indvars.iv.next154, %.loopexit ]
  %10 = phi i32 [ %sqn.promoted, %.lr.ph124.preheader ], [ %22, %.loopexit ]
  %11 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv153
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %.not111 = icmp eq i32 %12, 0
  br i1 %.not111, label %13, label %.lr.ph124._crit_edge

.lr.ph124._crit_edge:                             ; preds = %.lr.ph124
  %.pre = trunc nuw nsw i64 %indvars.iv153 to i32
  br label %21

13:                                               ; preds = %.lr.ph124
  %14 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %indvars.iv153
  %15 = trunc i64 %indvars.iv153 to i32
  %16 = add i32 %15, -1
  store i32 %16, ptr %14, align 4, !tbaa !5
  %17 = trunc nuw nsw i64 %indvars.iv153 to i32
  store i32 %17, ptr %11, align 4, !tbaa !5
  %18 = add nsw i32 %10, 1
  %19 = sext i32 %10 to i64
  %20 = getelementptr inbounds i32, ptr @id, i64 %19
  store i32 %17, ptr %20, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %.lr.ph124._crit_edge, %13
  %.pre-phi = phi i32 [ %.pre, %.lr.ph124._crit_edge ], [ %17, %13 ]
  %22 = phi i32 [ %10, %.lr.ph124._crit_edge ], [ %18, %13 ]
  %23 = load i32, ptr @id, align 16, !tbaa !5
  %24 = mul nsw i32 %23, %.pre-phi
  %.not112120 = icmp sgt i32 %24, %8
  br i1 %.not112120, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %21
  %25 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %indvars.iv153
  br label %26

26:                                               ; preds = %.lr.ph, %37
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %37 ]
  %27 = phi i32 [ %24, %.lr.ph ], [ %43, %37 ]
  %28 = phi i32 [ %23, %.lr.ph ], [ %42, %37 ]
  %29 = sext i32 %27 to i64
  %30 = getelementptr inbounds i32, ptr @b, i64 %29
  store i32 %28, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %11, align 4, !tbaa !5
  %32 = icmp eq i32 %31, %28
  %33 = load i32, ptr %25, align 4, !tbaa !5
  br i1 %32, label %34, label %37

34:                                               ; preds = %26
  %35 = mul nsw i32 %33, %28
  %36 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %29
  store i32 %35, ptr %36, align 4, !tbaa !5
  br label %.loopexit

37:                                               ; preds = %26
  %38 = add nsw i32 %28, -1
  %39 = mul nsw i32 %33, %38
  %40 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %29
  store i32 %39, ptr %40, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %41 = getelementptr inbounds i32, ptr @id, i64 %indvars.iv.next
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = mul nsw i32 %42, %.pre-phi
  %.not112 = icmp sgt i32 %43, %8
  br i1 %.not112, label %.loopexit, label %26, !llvm.loop !9

.loopexit:                                        ; preds = %37, %21, %34
  %44 = mul nuw nsw i64 %indvars.iv153, %indvars.iv153
  %45 = urem i64 %44, 1000000007
  %46 = trunc nuw nsw i64 %45 to i32
  %47 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %indvars.iv153
  store i32 %46, ptr %47, align 4, !tbaa !5
  %48 = add nsw i64 %indvars.iv153, -1
  %49 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %indvars.iv153
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = mul nsw i64 %45, %54
  %56 = add nsw i64 %55, %51
  %57 = srem i64 %56, 1000000007
  %58 = trunc nsw i64 %57 to i32
  store i32 %58, ptr %52, align 4, !tbaa !5
  %indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next154, %wide.trip.count
  br i1 %exitcond.not, label %.preheader117.preheader, label %.lr.ph124, !llvm.loop !11

.preheader117.preheader:                          ; preds = %.loopexit, %0
  br label %.preheader117

.preheader117:                                    ; preds = %.preheader117.preheader, %.preheader117
  %storemerge = phi i32 [ %61, %.preheader117 ], [ 1, %.preheader117.preheader ]
  %59 = mul nuw nsw i32 %storemerge, %storemerge
  %60 = icmp slt i32 %59, %8
  %61 = add nuw nsw i32 %storemerge, 1
  br i1 %60, label %.preheader117, label %.preheader116, !llvm.loop !12

.preheader116:                                    ; preds = %.preheader117
  store i32 %storemerge, ptr @sqn, align 4, !tbaa !5
  %.not105125 = icmp slt i32 %8, 1
  br i1 %.not105125, label %.preheader, label %.lr.ph129

.preheader:                                       ; preds = %.lr.ph129, %.preheader116
  %62 = load i32, ptr @t, align 4, !tbaa !5
  %63 = add nsw i32 %62, -1
  store i32 %63, ptr @t, align 4, !tbaa !5
  %.not106146 = icmp eq i32 %62, 0
  br i1 %.not106146, label %._crit_edge148, label %.lr.ph147

.lr.ph129:                                        ; preds = %.preheader116, %.lr.ph129
  %indvars.iv156 = phi i64 [ %indvars.iv.next157, %.lr.ph129 ], [ 1, %.preheader116 ]
  %.091127 = phi i32 [ %spec.select113, %.lr.ph129 ], [ 0, %.preheader116 ]
  %.093126 = phi i32 [ %spec.select, %.lr.ph129 ], [ 0, %.preheader116 ]
  %64 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %indvars.iv156
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = getelementptr inbounds [4000001 x i32], ptr @b, i64 0, i64 %indvars.iv156
  store i32 %65, ptr %66, align 4, !tbaa !5
  %67 = add nsw i64 %indvars.iv156, -1
  %68 = getelementptr inbounds [4000001 x i32], ptr @b, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %66, i32 noundef %69)
  %70 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %indvars.iv156
  store i32 %.091127, ptr %70, align 4, !tbaa !5
  %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
  %71 = add nsw i32 %.093126, 1
  %72 = load i32, ptr @sqn, align 4, !tbaa !5
  %73 = icmp eq i32 %71, %72
  %spec.select = select i1 %73, i32 0, i32 %71
  %74 = zext i1 %73 to i32
  %spec.select113 = add nuw nsw i32 %.091127, %74
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %.not105.not = icmp slt i64 %indvars.iv156, %76
  br i1 %.not105.not, label %.lr.ph129, label %.preheader, !llvm.loop !13

.lr.ph147:                                        ; preds = %.preheader, %._crit_edge144.thread
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %77 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %4, ptr noundef nonnull %3)
  %78 = load i32, ptr %1, align 4, !tbaa !5
  %79 = load i32, ptr %2, align 4, !tbaa !5
  %80 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %78, i32 noundef %79)
  %81 = load i64, ptr %4, align 8, !tbaa !14
  %82 = load i32, ptr %1, align 4, !tbaa !5
  %83 = sdiv i32 %82, %80
  %84 = sext i32 %83 to i64
  %85 = sdiv i64 %81, %84
  %86 = load i32, ptr %2, align 4, !tbaa !5
  %87 = sdiv i32 %86, %80
  %88 = sext i32 %87 to i64
  %89 = sdiv i64 %85, %88
  %90 = srem i64 %89, 1000000007
  %91 = trunc nsw i64 %90 to i32
  %92 = sext i32 %80 to i64
  %93 = getelementptr inbounds [4000001 x i32], ptr @a, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %.not107 = icmp eq i32 %94, %91
  br i1 %.not107, label %115, label %95

95:                                               ; preds = %.lr.ph147
  %96 = sub nsw i32 %91, %94
  %97 = icmp slt i32 %96, 0
  %98 = add nsw i32 %96, 1000000007
  %spec.select114 = select i1 %97, i32 %98, i32 %96
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %99 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %92
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  %102 = load i32, ptr @sqn, align 4, !tbaa !5
  %103 = mul nsw i32 %101, %102
  store i32 %103, ptr %5, align 4, !tbaa !5
  %104 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %105 = load i32, ptr %104, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %.not108130 = icmp sgt i32 %80, %105
  br i1 %.not108130, label %._crit_edge, label %.lr.ph132.preheader

.lr.ph132.preheader:                              ; preds = %95
  %106 = add i32 %105, 1
  br label %.lr.ph132

._crit_edge:                                      ; preds = %.lr.ph132, %95
  %107 = load i32, ptr %99, align 4, !tbaa !5
  %108 = load i32, ptr @n, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %.not109.not133 = icmp slt i32 %107, %111
  br i1 %.not109.not133, label %.lr.ph136.preheader, label %._crit_edge137

.lr.ph136.preheader:                              ; preds = %._crit_edge
  %112 = sext i32 %107 to i64
  %wide.trip.count166 = sext i32 %111 to i64
  br label %.lr.ph136

.lr.ph132:                                        ; preds = %.lr.ph132.preheader, %.lr.ph132
  %indvars.iv159 = phi i64 [ %92, %.lr.ph132.preheader ], [ %indvars.iv.next160, %.lr.ph132 ]
  %113 = getelementptr inbounds [4000001 x i32], ptr @b, i64 0, i64 %indvars.iv159
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %113, i32 noundef %spec.select114)
  %indvars.iv.next160 = add nsw i64 %indvars.iv159, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next160 to i32
  %exitcond162.not = icmp eq i32 %106, %lftr.wideiv
  br i1 %exitcond162.not, label %._crit_edge, label %.lr.ph132, !llvm.loop !16

._crit_edge137:                                   ; preds = %.lr.ph136, %._crit_edge
  store i32 %91, ptr %93, align 4, !tbaa !5
  br label %115

.lr.ph136:                                        ; preds = %.lr.ph136.preheader, %.lr.ph136
  %indvars.iv163 = phi i64 [ %112, %.lr.ph136.preheader ], [ %indvars.iv.next164, %.lr.ph136 ]
  %indvars.iv.next164 = add nsw i64 %indvars.iv163, 1
  %114 = getelementptr inbounds [2001 x i32], ptr @dt, i64 0, i64 %indvars.iv.next164
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %114, i32 noundef %spec.select114)
  %exitcond167.not = icmp eq i64 %indvars.iv.next164, %wide.trip.count166
  br i1 %exitcond167.not, label %._crit_edge137, label %.lr.ph136, !llvm.loop !17

115:                                              ; preds = %._crit_edge137, %.lr.ph147
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %.not110138 = icmp slt i32 %116, 1
  br i1 %.not110138, label %._crit_edge144.thread, label %.lr.ph143

._crit_edge144:                                   ; preds = %148
  %117 = icmp slt i32 %.1.fr, 0
  %118 = add nsw i32 %.1.fr, 1000000007
  %spec.select173 = select i1 %117, i32 %118, i32 %.1.fr
  br label %._crit_edge144.thread

._crit_edge144.thread:                            ; preds = %._crit_edge144, %115
  %119 = phi i32 [ 0, %115 ], [ %spec.select173, %._crit_edge144 ]
  %120 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %119)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %121 = load i32, ptr @t, align 4, !tbaa !5
  %122 = add nsw i32 %121, -1
  store i32 %122, ptr @t, align 4, !tbaa !5
  %.not106 = icmp eq i32 %121, 0
  br i1 %.not106, label %._crit_edge148, label %.lr.ph147, !llvm.loop !18

.lr.ph143:                                        ; preds = %115, %148
  %123 = phi i32 [ %150, %148 ], [ %116, %115 ]
  %.082141 = phi i32 [ %149, %148 ], [ 1, %115 ]
  %.083140 = phi i32 [ %.1.fr, %148 ], [ 0, %115 ]
  %.084139 = phi i32 [ %.185, %148 ], [ 0, %115 ]
  %124 = udiv i32 %123, %.082141
  %125 = sdiv i32 %123, %124
  %126 = zext nneg i32 %125 to i64
  %127 = getelementptr inbounds [4000001 x i32], ptr @b, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  store i32 %128, ptr %6, align 4, !tbaa !5
  %129 = getelementptr inbounds [4000001 x i32], ptr @id, i64 0, i64 %126
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [2001 x i32], ptr @dt, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %6, i32 noundef %133)
  %134 = load i32, ptr %6, align 4, !tbaa !5
  %135 = icmp eq i32 %.084139, %134
  br i1 %135, label %148, label %136

136:                                              ; preds = %.lr.ph143
  %137 = sext i32 %.083140 to i64
  %138 = sub nsw i32 %134, %.084139
  %139 = sext i32 %138 to i64
  %140 = sext i32 %124 to i64
  %141 = getelementptr inbounds [4000001 x i32], ptr @f, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = mul nsw i64 %143, %139
  %145 = add nsw i64 %144, %137
  %146 = srem i64 %145, 1000000007
  %147 = trunc nsw i64 %146 to i32
  br label %148

148:                                              ; preds = %.lr.ph143, %136
  %.185 = phi i32 [ %.084139, %.lr.ph143 ], [ %134, %136 ]
  %.1 = phi i32 [ %.083140, %.lr.ph143 ], [ %147, %136 ]
  %.1.fr = freeze i32 %.1
  %149 = add nuw nsw i32 %125, 1
  %150 = load i32, ptr %3, align 4, !tbaa !5
  %.not110.not = icmp slt i32 %125, %150
  br i1 %.not110.not, label %.lr.ph143, label %._crit_edge144, !llvm.loop !19

._crit_edge148:                                   ; preds = %._crit_edge144.thread, %.preheader
  ret i32 0
}

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

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

; Function Attrs: mustprogress 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 @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #3

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

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

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

attributes #0 = { mustprogress norecurse nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { mustprogress 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

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


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