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

; 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
@m = external dso_local global i32, align 4
@pw = external dso_local global [500001 x i32], align 16
@s = external dso_local global [500001 x i32], align 16
@mu = external dso_local global [500001 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 norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = icmp sgt i32 %14, %15
  br i1 %16, label %17, label %18

17:                                               ; preds = %0
  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) #4
  br label %18

18:                                               ; preds = %17, %0
  store i32 1, ptr getelementptr inbounds ([500001 x i32], ptr @mu, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %48, %18
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %51

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %25, %26
  store i32 %27, ptr %4, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %43, %24
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = icmp sle i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %47

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [500001 x i32], ptr @mu, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [500001 x i32], ptr @mu, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sub nsw i32 %41, %37
  store i32 %42, ptr %40, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %33
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = add nsw i32 %45, %44
  store i32 %46, ptr %4, align 4, !tbaa !5
  br label %28, !llvm.loop !9

47:                                               ; preds = %32
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !11

51:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %52

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

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

57:                                               ; preds = %52
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %59
  store i32 1, ptr %60, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %57
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %5, align 4, !tbaa !5
  br label %52, !llvm.loop !12

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

65:                                               ; preds = %190, %64
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %68 = icmp sle i32 %66, %67
  br i1 %68, label %70, label %69

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

70:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %71 = load i32, ptr @n, align 4, !tbaa !5
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = sdiv i32 %71, %72
  store i32 %73, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %74 = load i32, ptr @m, align 4, !tbaa !5
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = sdiv i32 %74, %75
  store i32 %76, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %117, %70
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = load i32, ptr %9, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %120

82:                                               ; preds = %77
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = load i32, ptr %11, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = mul nsw i64 %87, %89
  %91 = srem i64 %90, 1000000007
  %92 = trunc i64 %91 to i32
  %93 = load i32, ptr %11, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %94
  store i32 %92, ptr %95, align 4, !tbaa !5
  %96 = load i32, ptr %11, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = load i32, ptr %11, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add nsw i32 %100, %104
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %107
  store i32 %105, ptr %108, align 4, !tbaa !5
  %109 = icmp sge i32 %105, 1000000007
  br i1 %109, label %110, label %116

110:                                              ; preds = %82
  %111 = load i32, ptr %11, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sub nsw i32 %114, 1000000007
  store i32 %115, ptr %113, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %110, %82
  br label %117

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

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

121:                                              ; preds = %174, %120
  %122 = load i32, ptr %12, align 4, !tbaa !5
  %123 = load i32, ptr %8, align 4, !tbaa !5
  %124 = icmp sle i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %177

126:                                              ; preds = %121
  %127 = load i32, ptr %12, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [500001 x i32], ptr @mu, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %173

132:                                              ; preds = %126
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = load i32, ptr %12, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = load i32, ptr %12, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = mul nsw i64 %139, %144
  %146 = srem i64 %145, 1000000007
  %147 = load i32, ptr %8, align 4, !tbaa !5
  %148 = load i32, ptr %12, align 4, !tbaa !5
  %149 = sdiv i32 %147, %148
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = mul nsw i64 %146, %153
  %155 = srem i64 %154, 1000000007
  %156 = load i32, ptr %9, align 4, !tbaa !5
  %157 = load i32, ptr %12, align 4, !tbaa !5
  %158 = sdiv i32 %156, %157
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = mul nsw i64 %155, %162
  %164 = load i32, ptr %12, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [500001 x i32], ptr @mu, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = mul nsw i64 %163, %168
  %170 = add nsw i64 %134, %169
  %171 = srem i64 %170, 1000000007
  %172 = trunc i64 %171 to i32
  store i32 %172, ptr %10, align 4, !tbaa !5
  br label %173

173:                                              ; preds = %132, %126
  br label %174

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

177:                                              ; preds = %125
  %178 = load i32, ptr %6, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = load i32, ptr %7, align 4, !tbaa !5
  %181 = load i32, ptr %7, align 4, !tbaa !5
  %182 = call noundef i32 @_Z7mod_powii(i32 noundef %180, i32 noundef %181)
  %183 = sext i32 %182 to i64
  %184 = load i32, ptr %10, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = mul nsw i64 %183, %185
  %187 = add nsw i64 %179, %186
  %188 = srem i64 %187, 1000000007
  %189 = trunc i64 %188 to i32
  store i32 %189, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %190

190:                                              ; preds = %177
  %191 = load i32, ptr %7, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %7, align 4, !tbaa !5
  br label %65, !llvm.loop !15

193:                                              ; preds = %69
  %194 = load i32, ptr %6, align 4, !tbaa !5
  %195 = icmp slt i32 %194, 0
  br i1 %195, label %196, label %199

196:                                              ; preds = %193
  %197 = load i32, ptr %6, align 4, !tbaa !5
  %198 = add nsw i32 %197, 1000000007
  store i32 %198, ptr %6, align 4, !tbaa !5
  br label %199

199:                                              ; preds = %196, %193
  %200 = load i32, ptr %6, align 4, !tbaa !5
  %201 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %200)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %202 = load i32, ptr %1, align 4
  ret i32 %202
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) #2

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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}
!15 = distinct !{!15, !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
@m = external dso_local global i32, align 4
@pw = external dso_local local_unnamed_addr global [500001 x i32], align 16
@s = external dso_local local_unnamed_addr global [500001 x i32], align 16
@mu = external dso_local local_unnamed_addr global [500001 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 norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = load i32, ptr @m, align 4, !tbaa !5
  %4 = icmp sgt i32 %2, %3
  br i1 %4, label %5, label %6

5:                                                ; preds = %0
  tail 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) #3
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %5, %0
  %7 = phi i32 [ %.pre, %5 ], [ %2, %0 ]
  store i32 1, ptr getelementptr inbounds (i8, ptr @mu, i64 4), align 4, !tbaa !5
  %.not70 = icmp slt i32 %7, 1
  br i1 %.not70, label %.preheader67, label %.lr.ph73.preheader

.lr.ph73.preheader:                               ; preds = %6
  %8 = zext nneg i32 %7 to i64
  %9 = add nuw i32 %7, 1
  %wide.trip.count = zext i32 %9 to i64
  br label %.lr.ph73

.preheader67:                                     ; preds = %._crit_edge, %6
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %.not5974 = icmp slt i32 %10, 1
  br i1 %.not5974, label %.preheader66, label %.lr.ph76.preheader

.lr.ph76.preheader:                               ; preds = %.preheader67
  %11 = add nuw i32 %10, 1
  %wide.trip.count101 = zext i32 %11 to i64
  %12 = zext nneg i32 %10 to i64
  %min.iters.check = icmp ult i32 %10, 8
  br i1 %min.iters.check, label %.lr.ph76.preheader118, label %vector.ph

.lr.ph76.preheader118:                            ; preds = %middle.block, %.lr.ph76.preheader
  %indvars.iv98.ph = phi i64 [ 1, %.lr.ph76.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph76

vector.ph:                                        ; preds = %.lr.ph76.preheader
  %n.vec = and i64 %12, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %13 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %offset.idx
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %13, align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %14, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %15 = icmp eq i64 %index.next, %n.vec
  br i1 %15, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %12
  br i1 %cmp.n, label %.preheader66, label %.lr.ph76.preheader118

.lr.ph73:                                         ; preds = %.lr.ph73.preheader, %._crit_edge
  %indvars.iv92 = phi i64 [ 1, %.lr.ph73.preheader ], [ %indvars.iv.next93, %._crit_edge ]
  %indvars.iv = phi i64 [ 2, %.lr.ph73.preheader ], [ %indvars.iv.next, %._crit_edge ]
  %16 = shl nuw nsw i64 %indvars.iv92, 1
  %.not6468 = icmp ugt i64 %16, %8
  br i1 %.not6468, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph73
  %17 = getelementptr inbounds [500001 x i32], ptr @mu, i64 0, i64 %indvars.iv92
  br label %18

._crit_edge:                                      ; preds = %18, %.lr.ph73
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count
  br i1 %exitcond.not, label %.preheader67, label %.lr.ph73, !llvm.loop !13

18:                                               ; preds = %.lr.ph, %18
  %indvars.iv94 = phi i64 [ %indvars.iv, %.lr.ph ], [ %indvars.iv.next95, %18 ]
  %19 = load i32, ptr %17, align 4, !tbaa !5
  %20 = getelementptr inbounds [500001 x i32], ptr @mu, i64 0, i64 %indvars.iv94
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = sub nsw i32 %21, %19
  store i32 %22, ptr %20, align 4, !tbaa !5
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, %indvars.iv92
  %23 = trunc nuw i64 %indvars.iv.next95 to i32
  %.not64 = icmp slt i32 %7, %23
  br i1 %.not64, label %._crit_edge, label %18, !llvm.loop !14

.preheader66:                                     ; preds = %.lr.ph76, %middle.block, %.preheader67
  br i1 %.not70, label %._crit_edge90.thread, label %.lr.ph89

.lr.ph76:                                         ; preds = %.lr.ph76.preheader118, %.lr.ph76
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %.lr.ph76 ], [ %indvars.iv98.ph, %.lr.ph76.preheader118 ]
  %24 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %indvars.iv98
  store i32 1, ptr %24, align 4, !tbaa !5
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %exitcond102.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count101
  br i1 %exitcond102.not, label %.preheader66, label %.lr.ph76, !llvm.loop !15

._crit_edge90:                                    ; preds = %._crit_edge85
  %25 = trunc nsw i64 %52 to i32
  %26 = icmp slt i64 %52, 0
  %27 = add nsw i32 %25, 1000000007
  %spec.select = select i1 %26, i32 %27, i32 %25
  br label %._crit_edge90.thread

._crit_edge90.thread:                             ; preds = %._crit_edge90, %.preheader66
  %28 = phi i32 [ 0, %.preheader66 ], [ %spec.select, %._crit_edge90 ]
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %28)
  ret i32 0

.lr.ph89:                                         ; preds = %.preheader66, %._crit_edge85
  %30 = phi i32 [ %54, %._crit_edge85 ], [ %7, %.preheader66 ]
  %.04988 = phi i32 [ %53, %._crit_edge85 ], [ 1, %.preheader66 ]
  %.05087 = phi i64 [ %52, %._crit_edge85 ], [ 0, %.preheader66 ]
  %31 = sdiv i32 %30, %.04988
  %32 = load i32, ptr @m, align 4, !tbaa !5
  %33 = sdiv i32 %32, %.04988
  %.not6177 = icmp slt i32 %33, 1
  br i1 %.not6177, label %.preheader, label %.lr.ph80.preheader

.lr.ph80.preheader:                               ; preds = %.lr.ph89
  %34 = add nuw i32 %33, 1
  %wide.trip.count106 = zext i32 %34 to i64
  %.pre113 = load i32, ptr @s, align 16, !tbaa !5
  br label %.lr.ph80

.preheader:                                       ; preds = %.lr.ph80, %.lr.ph89
  %.not6281 = icmp slt i32 %31, 1
  br i1 %.not6281, label %._crit_edge85, label %.lr.ph84.preheader

.lr.ph84.preheader:                               ; preds = %.preheader
  %35 = add nuw i32 %31, 1
  %wide.trip.count111 = zext i32 %35 to i64
  br label %.lr.ph84

.lr.ph80:                                         ; preds = %.lr.ph80.preheader, %.lr.ph80
  %36 = phi i32 [ %.pre113, %.lr.ph80.preheader ], [ %spec.select65, %.lr.ph80 ]
  %indvars.iv103 = phi i64 [ 1, %.lr.ph80.preheader ], [ %indvars.iv.next104, %.lr.ph80 ]
  %37 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %indvars.iv103
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = mul nsw i64 %indvars.iv103, %39
  %41 = srem i64 %40, 1000000007
  %42 = trunc nsw i64 %41 to i32
  store i32 %42, ptr %37, align 4, !tbaa !5
  %43 = add nsw i32 %36, %42
  %44 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %indvars.iv103
  %45 = icmp sgt i32 %43, 1000000006
  %46 = add nsw i32 %43, -1000000007
  %spec.select65 = select i1 %45, i32 %46, i32 %43
  store i32 %spec.select65, ptr %44, align 4, !tbaa !5
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %exitcond107.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count106
  br i1 %exitcond107.not, label %.preheader, label %.lr.ph80, !llvm.loop !16

._crit_edge85:                                    ; preds = %83, %.preheader
  %.047.lcssa = phi i32 [ 0, %.preheader ], [ %.1, %83 ]
  %47 = tail call noundef i32 @_Z7mod_powii(i32 noundef %.04988, i32 noundef %.04988)
  %48 = sext i32 %47 to i64
  %.047.lcssa.fr = freeze i32 %.047.lcssa
  %49 = sext i32 %.047.lcssa.fr to i64
  %50 = mul nsw i64 %48, %49
  %51 = add i64 %50, %.05087
  %52 = srem i64 %51, 1000000007
  %53 = add nuw nsw i32 %.04988, 1
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %.not60.not = icmp slt i32 %.04988, %54
  br i1 %.not60.not, label %.lr.ph89, label %._crit_edge90, !llvm.loop !17

.lr.ph84:                                         ; preds = %.lr.ph84.preheader, %83
  %indvars.iv108 = phi i64 [ 1, %.lr.ph84.preheader ], [ %indvars.iv.next109, %83 ]
  %.04782 = phi i32 [ 0, %.lr.ph84.preheader ], [ %.1, %83 ]
  %55 = getelementptr inbounds [500001 x i32], ptr @mu, i64 0, i64 %indvars.iv108
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %.not63 = icmp eq i32 %56, 0
  br i1 %.not63, label %83, label %57

57:                                               ; preds = %.lr.ph84
  %58 = sext i32 %.04782 to i64
  %59 = getelementptr inbounds [500001 x i32], ptr @pw, i64 0, i64 %indvars.iv108
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = mul nsw i64 %61, %61
  %63 = urem i64 %62, 1000000007
  %64 = trunc nuw nsw i64 %indvars.iv108 to i32
  %65 = udiv i32 %31, %64
  %66 = zext nneg i32 %65 to i64
  %67 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = mul nsw i64 %63, %69
  %71 = srem i64 %70, 1000000007
  %72 = sdiv i32 %33, %64
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = sext i32 %56 to i64
  %78 = mul nsw i64 %76, %77
  %79 = mul i64 %78, %71
  %80 = add nsw i64 %79, %58
  %81 = srem i64 %80, 1000000007
  %82 = trunc nsw i64 %81 to i32
  br label %83

83:                                               ; preds = %.lr.ph84, %57
  %.1 = phi i32 [ %82, %57 ], [ %.04782, %.lr.ph84 ]
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %exitcond112.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count111
  br i1 %exitcond112.not, label %._crit_edge85, label %.lr.ph84, !llvm.loop !18
}

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

; 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 #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress norecurse nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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