; LLVM IR from tangjz/acm-icpc :: zoj (3881)

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

@tot = external dso_local global i32, align 4
@prime = external dso_local global [125000 x i32], align 16
@d = external dso_local global [1000001 x i32], align 16
@c = external dso_local global [1000001 x i32], align 16
@f = external dso_local global [1000001 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z1sx(i64 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @c, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %143, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 1000001
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %146

16:                                               ; preds = %12
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %41, label %22

22:                                               ; preds = %16
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = load i32, ptr @tot, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr @tot, align 4, !tbaa !5
  %26 = sext i32 %24 to i64
  %27 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %26
  store i32 %23, ptr %27, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %29
  store i32 1, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %34
  store i32 %32, ptr %35, align 4, !tbaa !5
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sub nsw i32 0, %36
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %39
  store i32 %37, ptr %40, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %22, %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sdiv i32 1000000, %42
  store i32 %43, ptr %5, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %138, %41
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = load i32, ptr @tot, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %48, label %55

48:                                               ; preds = %44
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br label %55

55:                                               ; preds = %48, %44
  %56 = phi i1 [ false, %44 ], [ %54, %48 ]
  br i1 %56, label %58, label %57

57:                                               ; preds = %55
  store i32 5, ptr %3, align 4
  br label %141

58:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = mul nsw i32 %59, %63
  store i32 %64, ptr %6, align 4, !tbaa !5
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = srem i32 %65, %69
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %103

72:                                               ; preds = %58
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %75
  store i32 %73, ptr %76, align 4, !tbaa !5
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1000001 x i32], ptr @c, 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 [125000 x i32], ptr @prime, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  %86 = mul nsw i32 %80, %85
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !5
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = sub nsw i32 0, %97
  %99 = mul nsw i32 %93, %98
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %101
  store i32 %99, ptr %102, align 4, !tbaa !5
  br label %134

103:                                              ; preds = %58
  %104 = load i32, ptr %2, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %109
  store i32 %107, ptr %110, align 4, !tbaa !5
  %111 = load i32, ptr %2, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = mul nsw i32 %114, %118
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = add nsw i32 %119, %126
  %128 = load i32, ptr %6, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %129
  store i32 %127, ptr %130, align 4, !tbaa !5
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %132
  store i32 0, ptr %133, align 4, !tbaa !5
  store i32 5, ptr %3, align 4
  br label %135

134:                                              ; preds = %72
  store i32 0, ptr %3, align 4
  br label %135

135:                                              ; preds = %134, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %136 = load i32, ptr %3, align 4
  switch i32 %136, label %141 [
    i32 0, label %137
  ]

137:                                              ; preds = %135
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %4, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %4, align 4, !tbaa !5
  br label %44, !llvm.loop !9

141:                                              ; preds = %135, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %2, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !11

146:                                              ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %174, %146
  %148 = load i32, ptr %7, align 4, !tbaa !5
  %149 = icmp slt i32 %148, 1000001
  br i1 %149, label %151, label %150

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

151:                                              ; preds = %147
  %152 = load i32, ptr %7, align 4, !tbaa !5
  %153 = sub nsw i32 %152, 1
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = load i32, ptr %7, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = add nsw i32 %160, %156
  store i32 %161, ptr %159, align 4, !tbaa !5
  %162 = load i32, ptr %7, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = icmp sge i32 %165, 1000000009
  br i1 %166, label %167, label %173

167:                                              ; preds = %151
  %168 = load i32, ptr %7, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = sub nsw i32 %171, 1000000009
  store i32 %172, ptr %170, align 4, !tbaa !5
  br label %173

173:                                              ; preds = %167, %151
  br label %174

174:                                              ; preds = %173
  %175 = load i32, ptr %7, align 4, !tbaa !5
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %7, align 4, !tbaa !5
  br label %147, !llvm.loop !12

177:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  br label %178

178:                                              ; preds = %230, %177
  %179 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %8)
  %180 = icmp eq i32 %179, 1
  br i1 %180, label %182, label %181

181:                                              ; preds = %178
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %233

182:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %183 = load i64, ptr %8, align 8, !tbaa !13
  %184 = sitofp i64 %183 to double
  %185 = call double @sqrt(double noundef %184) #6
  %186 = call double @llvm.ceil.f64(double %185)
  %187 = fptosi double %186 to i32
  store i32 %187, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %188

188:                                              ; preds = %221, %182
  %189 = load i32, ptr %11, align 4, !tbaa !5
  %190 = load i32, ptr %10, align 4, !tbaa !5
  %191 = icmp sle i32 %189, %190
  br i1 %191, label %193, label %192

192:                                              ; preds = %188
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %224

193:                                              ; preds = %188
  %194 = load i32, ptr %11, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = icmp ne i32 %197, 0
  br i1 %198, label %199, label %220

199:                                              ; preds = %193
  %200 = load i32, ptr %9, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = load i32, ptr %11, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %203
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = load i64, ptr %8, align 8, !tbaa !13
  %208 = load i32, ptr %11, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = sdiv i64 %207, %209
  %211 = load i32, ptr %11, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = sdiv i64 %210, %212
  %214 = call noundef i32 @_Z1sx(i64 noundef %213)
  %215 = sext i32 %214 to i64
  %216 = mul nsw i64 %206, %215
  %217 = add nsw i64 %201, %216
  %218 = srem i64 %217, 1000000009
  %219 = trunc i64 %218 to i32
  store i32 %219, ptr %9, align 4, !tbaa !5
  br label %220

220:                                              ; preds = %199, %193
  br label %221

221:                                              ; preds = %220
  %222 = load i32, ptr %11, align 4, !tbaa !5
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %11, align 4, !tbaa !5
  br label %188, !llvm.loop !15

224:                                              ; preds = %192
  %225 = load i32, ptr %9, align 4, !tbaa !5
  %226 = icmp slt i32 %225, 0
  br i1 %226, label %227, label %230

227:                                              ; preds = %224
  %228 = load i32, ptr %9, align 4, !tbaa !5
  %229 = add nsw i32 %228, 1000000009
  store i32 %229, ptr %9, align 4, !tbaa !5
  br label %230

230:                                              ; preds = %227, %224
  %231 = load i32, ptr %9, align 4, !tbaa !5
  %232 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %231)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %178, !llvm.loop !16

233:                                              ; preds = %181
  ret i32 0
}

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

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

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

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

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

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

@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [125000 x i32], align 16
@d = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@c = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@f = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %2

2:                                                ; preds = %0, %.critedge
  %indvars.iv80 = phi i64 [ 2, %0 ], [ %indvars.iv.next81, %.critedge ]
  %3 = phi i32 [ %tot.promoted, %0 ], [ %18, %.critedge ]
  %4 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %indvars.iv80
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %.not60 = icmp eq i32 %5, 0
  br i1 %.not60, label %6, label %._crit_edge93

._crit_edge93:                                    ; preds = %2
  %.pre94 = trunc nuw nsw i64 %indvars.iv80 to i32
  br label %17

6:                                                ; preds = %2
  %7 = add nsw i32 %3, 1
  store i32 %7, ptr @tot, align 4, !tbaa !5
  %8 = sext i32 %3 to i64
  %9 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %8
  %10 = trunc nuw nsw i64 %indvars.iv80 to i32
  store i32 %10, ptr %9, align 4, !tbaa !5
  %11 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %indvars.iv80
  store i32 1, ptr %11, align 4, !tbaa !5
  %12 = trunc i64 %indvars.iv80 to i32
  %13 = add i32 %12, 1
  store i32 %13, ptr %4, align 4, !tbaa !5
  %14 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv80
  %15 = trunc i64 %indvars.iv80 to i32
  %16 = sub i32 0, %15
  store i32 %16, ptr %14, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %._crit_edge93, %6
  %.pre-phi = phi i32 [ %.pre94, %._crit_edge93 ], [ %10, %6 ]
  %18 = phi i32 [ %3, %._crit_edge93 ], [ %7, %6 ]
  %19 = udiv i32 1000000, %.pre-phi
  %20 = icmp sgt i32 %18, 0
  br i1 %20, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %17
  %21 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv80
  %wide.trip.count = zext nneg i32 %18 to i64
  br label %22

22:                                               ; preds = %.lr.ph, %40
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %40 ]
  %23 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %indvars.iv
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %.not61 = icmp sgt i32 %24, %19
  br i1 %.not61, label %.critedge, label %25

25:                                               ; preds = %22
  %26 = mul nsw i32 %24, %.pre-phi
  %27 = srem i32 %.pre-phi, %24
  %.not62.not = icmp eq i32 %27, 0
  br i1 %.not62.not, label %.thread, label %40

.thread:                                          ; preds = %25
  %28 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %indvars.iv80
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sext i32 %26 to i64
  %31 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %30
  store i32 %29, ptr %31, align 4, !tbaa !5
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = mul nsw i32 %32, %24
  %34 = sext i32 %29 to i64
  %35 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = add nsw i32 %33, %36
  %38 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %30
  store i32 %37, ptr %38, align 4, !tbaa !5
  %39 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %30
  store i32 0, ptr %39, align 4, !tbaa !5
  br label %.critedge

40:                                               ; preds = %25
  %41 = sext i32 %26 to i64
  %42 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %41
  store i32 %.pre-phi, ptr %42, align 4, !tbaa !5
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = add nsw i32 %24, 1
  %45 = mul nsw i32 %43, %44
  %46 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %41
  store i32 %45, ptr %46, align 4, !tbaa !5
  %47 = load i32, ptr %21, align 4, !tbaa !5
  %48 = mul i32 %24, %47
  %49 = sub i32 0, %48
  %50 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %41
  store i32 %49, ptr %50, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %22, !llvm.loop !9

.critedge:                                        ; preds = %40, %22, %17, %.thread
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %exitcond83.not = icmp eq i64 %indvars.iv.next81, 1000001
  br i1 %exitcond83.not, label %.preheader.preheader, label %2, !llvm.loop !11

.preheader.preheader:                             ; preds = %.critedge
  %.pre = load i32, ptr @c, align 16, !tbaa !5
  br label %.preheader

51:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %.lr.ph75, label %._crit_edge76

.preheader:                                       ; preds = %.preheader, %.preheader.preheader
  %54 = phi i32 [ %.pre, %.preheader.preheader ], [ %spec.select.1, %.preheader ]
  %indvars.iv84 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next85.1, %.preheader ]
  %55 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %indvars.iv84
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %56, %54
  %58 = icmp sgt i32 %57, 1000000008
  %59 = add nsw i32 %57, -1000000009
  %spec.select = select i1 %58, i32 %59, i32 %57
  store i32 %spec.select, ptr %55, align 4, !tbaa !5
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %60 = getelementptr inbounds [1000001 x i32], ptr @c, i64 0, i64 %indvars.iv.next85
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, %spec.select
  %63 = icmp sgt i32 %62, 1000000008
  %64 = add nsw i32 %62, -1000000009
  %spec.select.1 = select i1 %63, i32 %64, i32 %62
  store i32 %spec.select.1, ptr %60, align 4, !tbaa !5
  %indvars.iv.next85.1 = add nuw nsw i64 %indvars.iv84, 2
  %exitcond87.not.1 = icmp eq i64 %indvars.iv.next85.1, 1000001
  br i1 %exitcond87.not.1, label %51, label %.preheader, !llvm.loop !12

._crit_edge76:                                    ; preds = %._crit_edge.thread, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

.lr.ph75:                                         ; preds = %51, %._crit_edge.thread
  %65 = load i64, ptr %1, align 8, !tbaa !13
  %66 = sitofp i64 %65 to double
  %67 = call double @sqrt(double noundef %66) #6
  %68 = call double @llvm.ceil.f64(double %67)
  %69 = fptosi double %68 to i32
  %.not70 = icmp slt i32 %69, 1
  br i1 %.not70, label %._crit_edge.thread, label %.lr.ph73.preheader

.lr.ph73.preheader:                               ; preds = %.lr.ph75
  %70 = add nuw i32 %69, 1
  %wide.trip.count91 = zext i32 %70 to i64
  br label %.lr.ph73

._crit_edge:                                      ; preds = %91
  %71 = icmp slt i32 %.1.fr, 0
  %72 = add nsw i32 %.1.fr, 1000000009
  %spec.select99 = select i1 %71, i32 %72, i32 %.1.fr
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %._crit_edge, %.lr.ph75
  %73 = phi i32 [ 0, %.lr.ph75 ], [ %spec.select99, %._crit_edge ]
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %73)
  %75 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %76 = icmp eq i32 %75, 1
  br i1 %76, label %.lr.ph75, label %._crit_edge76, !llvm.loop !15

.lr.ph73:                                         ; preds = %.lr.ph73.preheader, %91
  %indvars.iv88 = phi i64 [ 1, %.lr.ph73.preheader ], [ %indvars.iv.next89, %91 ]
  %.05271 = phi i32 [ 0, %.lr.ph73.preheader ], [ %.1.fr, %91 ]
  %77 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv88
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %.not59 = icmp eq i32 %78, 0
  br i1 %.not59, label %91, label %79

79:                                               ; preds = %.lr.ph73
  %80 = sext i32 %.05271 to i64
  %81 = sext i32 %78 to i64
  %82 = load i64, ptr %1, align 8, !tbaa !13
  %83 = sdiv i64 %82, %indvars.iv88
  %84 = sdiv i64 %83, %indvars.iv88
  %85 = call noundef i32 @_Z1sx(i64 noundef %84)
  %86 = sext i32 %85 to i64
  %87 = mul nsw i64 %86, %81
  %88 = add nsw i64 %87, %80
  %89 = srem i64 %88, 1000000009
  %90 = trunc nsw i64 %89 to i32
  br label %91

91:                                               ; preds = %.lr.ph73, %79
  %.1 = phi i32 [ %90, %79 ], [ %.05271, %.lr.ph73 ]
  %.1.fr = freeze i32 %.1
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %exitcond92.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count91
  br i1 %exitcond92.not, label %._crit_edge, label %.lr.ph73, !llvm.loop !16
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4

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

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

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

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

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


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