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

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

@n = external dso_local global i32, align 4
@sqn = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@prime = external dso_local global [1000010 x i32], align 16
@d = external dso_local global [1000010 x i32], align 16
@dk = external dso_local global [1000010 x i32], align 16
@e = external dso_local global [1000010 x i32], align 16
@f = external dso_local global [1000010 x i32], align 16
@g = external dso_local global [1000010 x i32], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z6calc_gi(i32 noundef) #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = call noundef double @_ZSt3powIidEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %10, double noundef 0x3FE5555555555555)
  %12 = call double @llvm.ceil.f64(double %11)
  %13 = fptosi double %12 to i32
  store i32 %13, ptr @sqn, align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([1000010 x i32], ptr @g, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([1000010 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %205, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr @sqn, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %208

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [1000010 x i32], ptr @d, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %48, label %25

25:                                               ; preds = %19
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %28
  store i32 %26, ptr %29, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1000010 x i32], ptr @d, i64 0, i64 %31
  store i32 %26, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr @tot, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr @tot, align 4, !tbaa !5
  %35 = sext i32 %33 to i64
  %36 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %35
  store i32 %26, ptr %36, align 4, !tbaa !5
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %38
  store i32 1, ptr %39, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %41
  call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %42, i32 noundef 1)
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %46
  store i32 %44, ptr %47, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %25, %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  br label %49

49:                                               ; preds = %180, %48
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = mul nsw i32 %50, %54
  store i32 %55, ptr %5, align 4, !tbaa !5
  %56 = load i32, ptr @sqn, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %49
  store i32 5, ptr %3, align 4
  br label %183

59:                                               ; preds = %49
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1000010 x i32], ptr @d, i64 0, i64 %65
  store i32 %63, ptr %66, align 4, !tbaa !5
  %67 = load i32, ptr %2, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000010 x i32], ptr @d, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp eq i32 %70, %74
  br i1 %75, label %76, label %143

76:                                               ; preds = %59
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = mul nsw i32 %80, %84
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %87
  store i32 %85, ptr %88, align 4, !tbaa !5
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %94
  store i32 %92, ptr %95, align 4, !tbaa !5
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %97
  store i32 0, ptr %98, align 4, !tbaa !5
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp eq i32 %102, 1
  br i1 %103, label %104, label %118

104:                                              ; preds = %76
  %105 = load i32, ptr %2, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = mul nsw i64 %109, %114
  %116 = add nsw i64 %115, 1
  %117 = srem i64 %116, 1000000007
  br label %137

118:                                              ; preds = %76
  %119 = load i32, ptr %5, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = mul nsw i64 %126, %134
  %136 = srem i64 %135, 1000000007
  br label %137

137:                                              ; preds = %118, %104
  %138 = phi i64 [ %117, %104 ], [ %136, %118 ]
  %139 = trunc i64 %138 to i32
  %140 = load i32, ptr %5, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %141
  store i32 %139, ptr %142, align 4, !tbaa !5
  store i32 5, ptr %3, align 4
  br label %183

143:                                              ; preds = %59
  %144 = load i32, ptr %4, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = load i32, ptr %5, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %149
  store i32 %147, ptr %150, align 4, !tbaa !5
  %151 = load i32, ptr %2, align 4, !tbaa !5
  %152 = load i32, ptr %5, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %153
  store i32 %151, ptr %154, align 4, !tbaa !5
  %155 = load i32, ptr %5, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %156
  %158 = load i32, ptr %2, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %157, i32 noundef %161)
  %162 = load i32, ptr %2, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = load i32, ptr %4, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  %172 = sext i32 %171 to i64
  %173 = mul nsw i64 %166, %172
  %174 = srem i64 %173, 1000000007
  %175 = trunc i64 %174 to i32
  %176 = load i32, ptr %5, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %177
  store i32 %175, ptr %178, align 4, !tbaa !5
  br label %179

179:                                              ; preds = %143
  br label %180

180:                                              ; preds = %179
  %181 = load i32, ptr %4, align 4, !tbaa !5
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %4, align 4, !tbaa !5
  br label %49, !llvm.loop !9

183:                                              ; preds = %137, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %2, align 4, !tbaa !5
  %186 = sub nsw i32 %185, 1
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = load i32, ptr %2, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = load i32, ptr %2, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %194
  %196 = load i32, ptr %195, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = mul nsw i64 %192, %197
  %199 = add nsw i64 %190, %198
  %200 = srem i64 %199, 1000000007
  %201 = trunc i64 %200 to i32
  %202 = load i32, ptr %2, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %203
  store i32 %201, ptr %204, align 4, !tbaa !5
  br label %205

205:                                              ; preds = %184
  %206 = load i32, ptr %2, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !11

208:                                              ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 2, ptr %6, align 4, !tbaa !5
  br label %209

209:                                              ; preds = %223, %208
  %210 = load i32, ptr %6, align 4, !tbaa !5
  %211 = load i32, ptr @sqn, align 4, !tbaa !5
  %212 = icmp sle i32 %210, %211
  br i1 %212, label %214, label %213

213:                                              ; preds = %209
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %226

214:                                              ; preds = %209
  %215 = load i32, ptr %6, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %216
  %218 = load i32, ptr %6, align 4, !tbaa !5
  %219 = sub nsw i32 %218, 1
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %217, i32 noundef %222)
  br label %223

223:                                              ; preds = %214
  %224 = load i32, ptr %6, align 4, !tbaa !5
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %6, align 4, !tbaa !5
  br label %209, !llvm.loop !12

226:                                              ; preds = %213
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  br label %227

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

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

232:                                              ; preds = %227
  %233 = load i32, ptr @n, align 4, !tbaa !5
  %234 = load i32, ptr @n, align 4, !tbaa !5
  %235 = load i32, ptr %7, align 4, !tbaa !5
  %236 = sdiv i32 %234, %235
  %237 = sdiv i32 %233, %236
  store i32 %237, ptr %8, align 4, !tbaa !5
  %238 = load i32, ptr %7, align 4, !tbaa !5
  %239 = load i32, ptr %8, align 4, !tbaa !5
  %240 = call noundef i32 @_Z8calc_imuii(i32 noundef %238, i32 noundef %239)
  %241 = sext i32 %240 to i64
  %242 = load i32, ptr @n, align 4, !tbaa !5
  %243 = load i32, ptr %7, align 4, !tbaa !5
  %244 = sdiv i32 %242, %243
  %245 = call noundef i32 @_Z6calc_gi(i32 noundef %244)
  %246 = call noundef i32 @_Z3sqri(i32 noundef %245)
  %247 = sext i32 %246 to i64
  %248 = mul nsw i64 %241, %247
  %249 = srem i64 %248, 1000000007
  %250 = trunc i64 %249 to i32
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %250)
  br label %251

251:                                              ; preds = %232
  %252 = load i32, ptr %8, align 4, !tbaa !5
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %7, align 4, !tbaa !5
  br label %227, !llvm.loop !13

254:                                              ; preds = %231
  %255 = load i32, ptr @ans, align 4, !tbaa !5
  %256 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %255)
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIidEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, double noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sqri(i32 noundef) #1

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

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

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

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

@n = external dso_local global i32, align 4
@sqn = external dso_local local_unnamed_addr global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [1000010 x i32], align 16
@d = external dso_local local_unnamed_addr global [1000010 x i32], align 16
@dk = external dso_local local_unnamed_addr global [1000010 x i32], align 16
@e = external dso_local local_unnamed_addr global [1000010 x i32], align 16
@f = external dso_local global [1000010 x i32], align 16
@g = external dso_local global [1000010 x i32], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z6calc_gi(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = tail call noundef double @_ZSt3powIidEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %2, double noundef 0x3FE5555555555555)
  %4 = tail call double @llvm.ceil.f64(double %3)
  %5 = fptosi double %4 to i32
  store i32 %5, ptr @sqn, align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @g, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %.not67 = icmp slt i32 %5, 2
  br i1 %.not67, label %.preheader, label %.lr.ph69

.preheader62:                                     ; preds = %.loopexit
  %6 = icmp slt i32 %86, 2
  br i1 %6, label %.preheader, label %.lr.ph72

.lr.ph69:                                         ; preds = %0, %.loopexit
  %7 = phi i32 [ %86, %.loopexit ], [ %5, %0 ]
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %.loopexit ], [ 2, %0 ]
  %8 = getelementptr inbounds [1000010 x i32], ptr @d, i64 0, i64 %indvars.iv80
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %.not60 = icmp eq i32 %9, 0
  br i1 %.not60, label %10, label %.lr.ph69._crit_edge

.lr.ph69._crit_edge:                              ; preds = %.lr.ph69
  %.pre86 = trunc nuw nsw i64 %indvars.iv80 to i32
  br label %22

10:                                               ; preds = %.lr.ph69
  %11 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %indvars.iv80
  %12 = trunc nuw nsw i64 %indvars.iv80 to i32
  store i32 %12, ptr %11, align 4, !tbaa !5
  store i32 %12, ptr %8, align 4, !tbaa !5
  %13 = load i32, ptr @tot, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr @tot, align 4, !tbaa !5
  %15 = sext i32 %13 to i64
  %16 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %15
  store i32 %12, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %indvars.iv80
  store i32 1, ptr %17, align 4, !tbaa !5
  %18 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %indvars.iv80
  tail call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %18, i32 noundef 1)
  %19 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %indvars.iv80
  %20 = trunc i64 %indvars.iv80 to i32
  %21 = add i32 %20, 1
  store i32 %21, ptr %19, align 4, !tbaa !5
  %.pre = load i32, ptr @sqn, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %.lr.ph69._crit_edge, %10
  %.pre-phi = phi i32 [ %.pre86, %.lr.ph69._crit_edge ], [ %12, %10 ]
  %23 = phi i32 [ %7, %.lr.ph69._crit_edge ], [ %.pre, %10 ]
  %24 = load i32, ptr @prime, align 16, !tbaa !5
  %25 = mul nsw i32 %24, %.pre-phi
  %.not6165 = icmp sgt i32 %25, %23
  br i1 %.not6165, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %22
  %26 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %indvars.iv80
  %27 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %indvars.iv80
  %28 = sext i32 %25 to i64
  %29 = getelementptr inbounds [1000010 x i32], ptr @d, i64 0, i64 %28
  store i32 %24, ptr %29, align 4, !tbaa !5
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = icmp eq i32 %30, %24
  br i1 %31, label %._crit_edge104, label %.lr.ph103

32:                                               ; preds = %.lr.ph103
  %33 = sext i32 %84 to i64
  %34 = getelementptr inbounds [1000010 x i32], ptr @d, i64 0, i64 %33
  store i32 %83, ptr %34, align 4, !tbaa !5
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = icmp eq i32 %35, %83
  br i1 %36, label %._crit_edge104, label %.lr.ph103, !llvm.loop !9

._crit_edge104:                                   ; preds = %32, %.lr.ph
  %.lcssa98 = phi i32 [ %23, %.lr.ph ], [ %85, %32 ]
  %.lcssa96 = phi i32 [ %24, %.lr.ph ], [ %83, %32 ]
  %.lcssa = phi i64 [ %28, %.lr.ph ], [ %33, %32 ]
  %37 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %indvars.iv80
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = mul nsw i32 %38, %.lcssa96
  %40 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %.lcssa
  store i32 %39, ptr %40, align 4, !tbaa !5
  %41 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %indvars.iv80
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %.lcssa
  store i32 %42, ptr %43, align 4, !tbaa !5
  %44 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %.lcssa
  store i32 0, ptr %44, align 4, !tbaa !5
  %45 = icmp eq i32 %42, 1
  br i1 %45, label %46, label %52

46:                                               ; preds = %._crit_edge104
  %47 = load i32, ptr %27, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = sext i32 %.lcssa96 to i64
  %50 = mul nsw i64 %48, %49
  %51 = add nsw i64 %50, 1
  br label %62

52:                                               ; preds = %._crit_edge104
  %53 = sext i32 %39 to i64
  %54 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = sext i32 %42 to i64
  %58 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = mul nsw i64 %60, %56
  br label %62

62:                                               ; preds = %52, %46
  %.in = phi i64 [ %51, %46 ], [ %61, %52 ]
  %63 = srem i64 %.in, 1000000007
  %64 = trunc nsw i64 %63 to i32
  %65 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %.lcssa
  store i32 %64, ptr %65, align 4, !tbaa !5
  br label %.loopexit

.lr.ph103:                                        ; preds = %.lr.ph, %32
  %66 = phi i64 [ %33, %32 ], [ %28, %.lr.ph ]
  %67 = phi ptr [ %82, %32 ], [ @prime, %.lr.ph ]
  %68 = phi i32 [ %83, %32 ], [ %24, %.lr.ph ]
  %indvars.iv102 = phi i64 [ %indvars.iv.next, %32 ], [ 0, %.lr.ph ]
  %69 = getelementptr inbounds [1000010 x i32], ptr @dk, i64 0, i64 %66
  store i32 %68, ptr %69, align 4, !tbaa !5
  %70 = getelementptr inbounds [1000010 x i32], ptr @e, i64 0, i64 %66
  store i32 %.pre-phi, ptr %70, align 4, !tbaa !5
  %71 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %66
  %72 = load i32, ptr %26, align 4, !tbaa !5
  tail call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %71, i32 noundef %72)
  %73 = load i32, ptr %27, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = load i32, ptr %67, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = mul nsw i64 %77, %74
  %79 = srem i64 %78, 1000000007
  %80 = trunc nsw i64 %79 to i32
  %81 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %66
  store i32 %80, ptr %81, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv102, 1
  %82 = getelementptr inbounds [1000010 x i32], ptr @prime, i64 0, i64 %indvars.iv.next
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = mul nsw i32 %83, %.pre-phi
  %85 = load i32, ptr @sqn, align 4, !tbaa !5
  %.not61 = icmp sgt i32 %84, %85
  br i1 %.not61, label %.loopexit, label %32, !llvm.loop !9

.loopexit:                                        ; preds = %.lr.ph103, %22, %62
  %86 = phi i32 [ %23, %22 ], [ %.lcssa98, %62 ], [ %85, %.lr.ph103 ]
  %87 = add nsw i64 %indvars.iv80, -1
  %88 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1000010 x i32], ptr @f, i64 0, i64 %indvars.iv80
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = mul nsw i64 %indvars.iv80, %93
  %95 = add nsw i64 %94, %90
  %96 = srem i64 %95, 1000000007
  %97 = trunc nsw i64 %96 to i32
  store i32 %97, ptr %91, align 4, !tbaa !5
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %98 = sext i32 %86 to i64
  %.not.not = icmp slt i64 %indvars.iv80, %98
  br i1 %.not.not, label %.lr.ph69, label %.preheader62, !llvm.loop !11

.preheader:                                       ; preds = %.lr.ph72, %0, %.preheader62
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %.not5973 = icmp slt i32 %99, 1
  br i1 %.not5973, label %._crit_edge, label %.lr.ph75

.lr.ph72:                                         ; preds = %.preheader62, %.lr.ph72
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %.lr.ph72 ], [ 2, %.preheader62 ]
  %100 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %indvars.iv83
  %101 = add nsw i64 %indvars.iv83, -1
  %102 = getelementptr inbounds [1000010 x i32], ptr @g, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  tail call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %100, i32 noundef %103)
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %104 = load i32, ptr @sqn, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %.not58.not = icmp slt i64 %indvars.iv83, %105
  br i1 %.not58.not, label %.lr.ph72, label %.preheader, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph75, %.preheader
  %106 = load i32, ptr @ans, align 4, !tbaa !5
  %107 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %106)
  ret i32 0

.lr.ph75:                                         ; preds = %.preheader, %.lr.ph75
  %108 = phi i32 [ %122, %.lr.ph75 ], [ %99, %.preheader ]
  %.05274 = phi i32 [ %121, %.lr.ph75 ], [ 1, %.preheader ]
  %109 = udiv i32 %108, %.05274
  %110 = sdiv i32 %108, %109
  %111 = tail call noundef i32 @_Z8calc_imuii(i32 noundef %.05274, i32 noundef %110)
  %112 = sext i32 %111 to i64
  %113 = load i32, ptr @n, align 4, !tbaa !5
  %114 = sdiv i32 %113, %.05274
  %115 = tail call noundef i32 @_Z6calc_gi(i32 noundef %114)
  %116 = tail call noundef i32 @_Z3sqri(i32 noundef %115)
  %117 = sext i32 %116 to i64
  %118 = mul nsw i64 %117, %112
  %119 = srem i64 %118, 1000000007
  %120 = trunc nsw i64 %119 to i32
  tail call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %120)
  %121 = add nuw nsw i32 %110, 1
  %122 = load i32, ptr @n, align 4, !tbaa !5
  %.not59.not = icmp slt i32 %110, %122
  br i1 %.not59.not, label %.lr.ph75, label %._crit_edge, !llvm.loop !13
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIidEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sqri(i32 noundef) local_unnamed_addr #0

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

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

!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}


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