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

; 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
@ex = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@prime = external dso_local global [625000 x i32], align 16
@f = external dso_local global [5000001 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@.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 @_Z7mod_powii(i32 noundef, i32 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 i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t, ptr noundef @ex)
  store i32 1, ptr getelementptr inbounds ([5000001 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %117, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 5000001
  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) #5
  br label %120

16:                                               ; preds = %12
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %35, 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 [625000 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 = load i32, ptr @ex, align 4, !tbaa !5
  %30 = call noundef i32 @_Z7mod_powii(i32 noundef %28, i32 noundef %29)
  %31 = sub nsw i32 %30, 1
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %33
  store i32 %31, ptr %34, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %22, %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sdiv i32 5000000, %36
  store i32 %37, ptr %5, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %112, %35
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = load i32, ptr @tot, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %49

42:                                               ; preds = %38
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [625000 x i32], ptr @prime, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = icmp sle i32 %46, %47
  br label %49

49:                                               ; preds = %42, %38
  %50 = phi i1 [ false, %38 ], [ %48, %42 ]
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %49
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [625000 x i32], ptr @prime, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = srem i32 %53, %57
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %85

60:                                               ; preds = %52
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [625000 x i32], ptr @prime, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = mul nsw i64 %65, %73
  %75 = srem i64 %74, 1000000007
  %76 = trunc i64 %75 to i32
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [625000 x i32], ptr @prime, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = mul nsw i32 %77, %81
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %83
  store i32 %76, ptr %84, align 4, !tbaa !5
  br label %111

85:                                               ; preds = %52
  %86 = load i32, ptr %2, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [625000 x i32], ptr @prime, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = mul nsw i64 %90, %99
  %101 = srem i64 %100, 1000000007
  %102 = trunc i64 %101 to i32
  %103 = load i32, ptr %2, align 4, !tbaa !5
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [625000 x i32], ptr @prime, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = mul nsw i32 %103, %107
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %109
  store i32 %102, ptr %110, align 4, !tbaa !5
  store i32 5, ptr %3, align 4
  br label %115

111:                                              ; preds = %60
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %4, align 4, !tbaa !5
  br label %38, !llvm.loop !9

115:                                              ; preds = %85, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %2, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !11

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

121:                                              ; preds = %148, %120
  %122 = load i32, ptr %6, align 4, !tbaa !5
  %123 = icmp slt i32 %122, 5000001
  br i1 %123, label %125, label %124

124:                                              ; preds = %121
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %151

125:                                              ; preds = %121
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = sub nsw i32 %126, 1
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = add nsw i32 %134, %130
  store i32 %135, ptr %133, align 4, !tbaa !5
  %136 = load i32, ptr %6, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = icmp sge i32 %139, 1000000007
  br i1 %140, label %141, label %147

141:                                              ; preds = %125
  %142 = load i32, ptr %6, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = sub nsw i32 %145, 1000000007
  store i32 %146, ptr %144, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %141, %125
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %6, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %6, align 4, !tbaa !5
  br label %121, !llvm.loop !12

151:                                              ; preds = %124
  br label %152

152:                                              ; preds = %217, %151
  %153 = load i32, ptr @t, align 4, !tbaa !5
  %154 = add nsw i32 %153, -1
  store i32 %154, ptr @t, align 4, !tbaa !5
  %155 = icmp ne i32 %153, 0
  br i1 %155, label %156, label %220

156:                                              ; preds = %152
  %157 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %158 = load i32, ptr @n, align 4, !tbaa !5
  %159 = load i32, ptr @m, align 4, !tbaa !5
  %160 = icmp sgt i32 %158, %159
  br i1 %160, label %161, label %162

161:                                              ; preds = %156
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m) #5
  br label %162

162:                                              ; preds = %161, %156
  store i32 0, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  br label %163

163:                                              ; preds = %208, %162
  %164 = load i32, ptr %7, align 4, !tbaa !5
  %165 = load i32, ptr @n, align 4, !tbaa !5
  %166 = icmp sle i32 %164, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %163
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %211

168:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %169 = load i32, ptr @n, align 4, !tbaa !5
  %170 = load i32, ptr @n, align 4, !tbaa !5
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = sdiv i32 %170, %171
  %173 = sdiv i32 %169, %172
  store i32 %173, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %174 = load i32, ptr @m, align 4, !tbaa !5
  %175 = load i32, ptr @m, align 4, !tbaa !5
  %176 = load i32, ptr %7, align 4, !tbaa !5
  %177 = sdiv i32 %175, %176
  %178 = sdiv i32 %174, %177
  store i32 %178, ptr %10, align 4, !tbaa !5
  %179 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %180 = load i32, ptr %179, align 4, !tbaa !5
  store i32 %180, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %181 = load i32, ptr @ans, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = load i32, ptr %8, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = load i32, ptr %7, align 4, !tbaa !5
  %188 = sub nsw i32 %187, 1
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = sub nsw i32 %186, %191
  %193 = sext i32 %192 to i64
  %194 = load i32, ptr @n, align 4, !tbaa !5
  %195 = load i32, ptr %7, align 4, !tbaa !5
  %196 = sdiv i32 %194, %195
  %197 = sext i32 %196 to i64
  %198 = mul nsw i64 %193, %197
  %199 = srem i64 %198, 1000000007
  %200 = load i32, ptr @m, align 4, !tbaa !5
  %201 = load i32, ptr %7, align 4, !tbaa !5
  %202 = sdiv i32 %200, %201
  %203 = sext i32 %202 to i64
  %204 = mul nsw i64 %199, %203
  %205 = add nsw i64 %182, %204
  %206 = srem i64 %205, 1000000007
  %207 = trunc i64 %206 to i32
  store i32 %207, ptr @ans, align 4, !tbaa !5
  br label %208

208:                                              ; preds = %168
  %209 = load i32, ptr %8, align 4, !tbaa !5
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %7, align 4, !tbaa !5
  br label %163, !llvm.loop !13

211:                                              ; preds = %167
  %212 = load i32, ptr @ans, align 4, !tbaa !5
  %213 = icmp slt i32 %212, 0
  br i1 %213, label %214, label %217

214:                                              ; preds = %211
  %215 = load i32, ptr @ans, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1000000007
  store i32 %216, ptr @ans, align 4, !tbaa !5
  br label %217

217:                                              ; preds = %214, %211
  %218 = load i32, ptr @ans, align 4, !tbaa !5
  %219 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %218)
  br label %152, !llvm.loop !14

220:                                              ; preds = %152
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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)) #4

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 = { 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 #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 = distinct !{!14, !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"

@t = external dso_local global i32, align 4
@ex = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [625000 x i32], align 16
@f = external dso_local local_unnamed_addr global [5000001 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@.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 @_Z7mod_powii(i32 noundef, i32 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 i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t, ptr noundef nonnull @ex)
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %.pre67.pre = load i32, ptr @tot, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %0, %.critedge
  %.pre67 = phi i32 [ %.pre67.pre, %0 ], [ %.pre6771, %.critedge ]
  %indvars.iv59 = phi i64 [ 2, %0 ], [ %indvars.iv.next60, %.critedge ]
  %5 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %indvars.iv59
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %.not42 = icmp eq i32 %6, 0
  br i1 %.not42, label %7, label %._crit_edge73

._crit_edge73:                                    ; preds = %4
  %.pre74 = trunc nuw nsw i64 %indvars.iv59 to i32
  br label %15

7:                                                ; preds = %4
  %8 = add nsw i32 %.pre67, 1
  store i32 %8, ptr @tot, align 4, !tbaa !5
  %9 = sext i32 %.pre67 to i64
  %10 = getelementptr inbounds [625000 x i32], ptr @prime, i64 0, i64 %9
  %11 = trunc nuw nsw i64 %indvars.iv59 to i32
  store i32 %11, ptr %10, align 4, !tbaa !5
  %12 = load i32, ptr @ex, align 4, !tbaa !5
  %13 = tail call noundef i32 @_Z7mod_powii(i32 noundef %11, i32 noundef %12)
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr %5, align 4, !tbaa !5
  %.pre = load i32, ptr @tot, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %._crit_edge73, %7
  %.pre-phi = phi i32 [ %.pre74, %._crit_edge73 ], [ %11, %7 ]
  %.pre6771 = phi i32 [ %.pre67, %._crit_edge73 ], [ %.pre, %7 ]
  %16 = udiv i32 5000000, %.pre-phi
  %17 = icmp sgt i32 %.pre6771, 0
  br i1 %17, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %15
  %wide.trip.count = zext nneg i32 %.pre6771 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %27
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %27 ]
  %18 = getelementptr inbounds [625000 x i32], ptr @prime, i64 0, i64 %indvars.iv
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %.not43 = icmp sgt i32 %19, %16
  br i1 %.not43, label %.critedge, label %20

20:                                               ; preds = %.lr.ph
  %21 = srem i32 %.pre-phi, %19
  %.not44 = icmp eq i32 %21, 0
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = sext i32 %19 to i64
  %25 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  br i1 %.not44, label %35, label %27

27:                                               ; preds = %20
  %28 = sext i32 %26 to i64
  %29 = mul nsw i64 %28, %23
  %30 = srem i64 %29, 1000000007
  %31 = trunc nsw i64 %30 to i32
  %32 = mul nsw i32 %19, %.pre-phi
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %33
  store i32 %31, ptr %34, 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 %.lr.ph, !llvm.loop !9

35:                                               ; preds = %20
  %36 = add nsw i32 %26, 1
  %37 = sext i32 %36 to i64
  %38 = mul nsw i64 %37, %23
  %39 = srem i64 %38, 1000000007
  %40 = trunc nsw i64 %39 to i32
  %41 = mul nsw i32 %19, %.pre-phi
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %42
  store i32 %40, ptr %43, align 4, !tbaa !5
  br label %.critedge

.critedge:                                        ; preds = %27, %.lr.ph, %15, %35
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %exitcond62.not = icmp eq i64 %indvars.iv.next60, 5000001
  br i1 %exitcond62.not, label %.preheader45.preheader, label %4, !llvm.loop !11

.preheader45.preheader:                           ; preds = %.critedge
  %.pre68 = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  br label %.preheader45

.preheader:                                       ; preds = %.preheader45
  %44 = load i32, ptr @t, align 4, !tbaa !5
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr @t, align 4, !tbaa !5
  %.not54 = icmp eq i32 %44, 0
  br i1 %.not54, label %._crit_edge56, label %.lr.ph55

.preheader45:                                     ; preds = %.preheader45.1, %.preheader45.preheader
  %46 = phi i32 [ %.pre68, %.preheader45.preheader ], [ %spec.select.1, %.preheader45.1 ]
  %indvars.iv63 = phi i64 [ 2, %.preheader45.preheader ], [ %indvars.iv.next64.1, %.preheader45.1 ]
  %47 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %indvars.iv63
  %48 = load i32, ptr %47, align 8, !tbaa !5
  %49 = add nsw i32 %48, %46
  %50 = icmp sgt i32 %49, 1000000006
  %51 = add nsw i32 %49, -1000000007
  %spec.select = select i1 %50, i32 %51, i32 %49
  store i32 %spec.select, ptr %47, align 8, !tbaa !5
  %exitcond66.not = icmp eq i64 %indvars.iv63, 5000000
  br i1 %exitcond66.not, label %.preheader, label %.preheader45.1, !llvm.loop !12

.preheader45.1:                                   ; preds = %.preheader45
  %indvars.iv.next64 = or disjoint i64 %indvars.iv63, 1
  %52 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %indvars.iv.next64
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = add nsw i32 %53, %spec.select
  %55 = icmp sgt i32 %54, 1000000006
  %56 = add nsw i32 %54, -1000000007
  %spec.select.1 = select i1 %55, i32 %56, i32 %54
  store i32 %spec.select.1, ptr %52, align 4, !tbaa !5
  %indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv63, 2
  br label %.preheader45

.lr.ph55:                                         ; preds = %.preheader, %._crit_edge.thread
  %57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = load i32, ptr @m, align 4, !tbaa !5
  %60 = icmp sgt i32 %58, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %.lr.ph55
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m) #5
  %.pre69 = load i32, ptr @n, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %61, %.lr.ph55
  %63 = phi i32 [ %.pre69, %61 ], [ %58, %.lr.ph55 ]
  store i32 0, ptr @ans, align 4, !tbaa !5
  %.not4151 = icmp slt i32 %63, 1
  br i1 %.not4151, label %._crit_edge.thread, label %.lr.ph53.preheader

.lr.ph53.preheader:                               ; preds = %62
  %.pre70 = load i32, ptr @m, align 4, !tbaa !5
  br label %.lr.ph53

._crit_edge:                                      ; preds = %.lr.ph53
  %64 = icmp slt i64 %94, 0
  br i1 %64, label %97, label %._crit_edge.thread

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %.lr.ph53
  %65 = phi i32 [ %89, %.lr.ph53 ], [ %.pre70, %.lr.ph53.preheader ]
  %66 = phi i32 [ %84, %.lr.ph53 ], [ %63, %.lr.ph53.preheader ]
  %.03552 = phi i32 [ %96, %.lr.ph53 ], [ 1, %.lr.ph53.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %67 = sdiv i32 %66, %.03552
  %68 = sdiv i32 %66, %67
  store i32 %68, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %69 = sdiv i32 %65, %.03552
  %70 = sdiv i32 %65, %69
  store i32 %70, ptr %2, align 4, !tbaa !5
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %72 = load i32, ptr %71, align 4, !tbaa !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
  %73 = load i32, ptr @ans, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = sext i32 %72 to i64
  %76 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = add nsw i32 %.03552, -1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sub nsw i32 %77, %81
  %83 = sext i32 %82 to i64
  %84 = load i32, ptr @n, align 4, !tbaa !5
  %85 = sdiv i32 %84, %.03552
  %86 = sext i32 %85 to i64
  %87 = mul nsw i64 %86, %83
  %88 = srem i64 %87, 1000000007
  %89 = load i32, ptr @m, align 4, !tbaa !5
  %90 = sdiv i32 %89, %.03552
  %91 = sext i32 %90 to i64
  %92 = mul nsw i64 %88, %91
  %93 = add nsw i64 %92, %74
  %94 = srem i64 %93, 1000000007
  %95 = trunc nsw i64 %94 to i32
  store i32 %95, ptr @ans, align 4, !tbaa !5
  %96 = add nsw i32 %72, 1
  %.not41.not = icmp slt i32 %72, %84
  br i1 %.not41.not, label %.lr.ph53, label %._crit_edge, !llvm.loop !13

97:                                               ; preds = %._crit_edge
  %98 = add nsw i32 %95, 1000000007
  store i32 %98, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %62, %97, %._crit_edge
  %99 = phi i32 [ %98, %97 ], [ %95, %._crit_edge ], [ 0, %62 ]
  %100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %99)
  %101 = load i32, ptr @t, align 4, !tbaa !5
  %102 = add nsw i32 %101, -1
  store i32 %102, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %101, 0
  br i1 %.not, label %._crit_edge56, label %.lr.ph55, !llvm.loop !14

._crit_edge56:                                    ; preds = %._crit_edge.thread, %.preheader
  ret i32 0
}

; 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 void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #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 #4

; 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 = { 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 #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 = distinct !{!14, !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,TailCallElimPass