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

; 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 [4641589 x i32], align 16
@f = external dso_local global [4641589 x i32], align 16
@g = external dso_local global [4641589 x i32], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; 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 i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([4641589 x i32], ptr @g, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([4641589 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 %9

9:                                                ; preds = %129, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp slt i32 %10, 4641589
  br i1 %11, label %13, label %12

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

13:                                               ; preds = %9
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %33, label %19

19:                                               ; preds = %13
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @tot, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr @tot, align 4, !tbaa !5
  %23 = sext i32 %21 to i64
  %24 = getelementptr inbounds [4641589 x i32], ptr @prime, i64 0, i64 %23
  store i32 %20, ptr %24, align 4, !tbaa !5
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %26
  call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %27, i32 noundef 1)
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sub nsw i32 %28, 1
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %31
  store i32 %29, ptr %32, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %19, %13
  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
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sdiv i32 4641588, %34
  store i32 %35, ptr %5, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %108, %33
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = load i32, ptr @tot, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %47

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

47:                                               ; preds = %40, %36
  %48 = phi i1 [ false, %36 ], [ %46, %40 ]
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %47
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [4641589 x i32], ptr @prime, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = srem i32 %51, %55
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %76

58:                                               ; preds = %50
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [4641589 x i32], ptr @prime, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = mul nsw i32 %62, %66
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [4641589 x i32], ptr @prime, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = mul nsw i32 %68, %72
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %74
  store i32 %67, ptr %75, align 4, !tbaa !5
  store i32 5, ptr %3, align 4
  br label %111

76:                                               ; preds = %50
  %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 [4641589 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 [4641589 x i32], ptr @f, i64 0, i64 %83
  %85 = load i32, ptr %2, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %84, i32 noundef %88)
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [4641589 x i32], ptr @prime, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = mul nsw i32 %92, %97
  %99 = load i32, ptr %2, align 4, !tbaa !5
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [4641589 x i32], ptr @prime, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = mul nsw i32 %99, %103
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %105
  store i32 %98, ptr %106, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %76
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %4, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %4, align 4, !tbaa !5
  br label %36, !llvm.loop !9

111:                                              ; preds = %58, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %2, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %114
  %116 = load i32, ptr %2, align 4, !tbaa !5
  %117 = sub nsw i32 %116, 1
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %115, i32 noundef %120)
  %121 = load i32, ptr %2, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %122
  %124 = load i32, ptr %2, align 4, !tbaa !5
  %125 = sub nsw i32 %124, 1
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %123, i32 noundef %128)
  br label %129

129:                                              ; preds = %112
  %130 = load i32, ptr %2, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !11

132:                                              ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %133 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 1, ptr %7, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  br label %134

134:                                              ; preds = %162, %132
  %135 = load i64, ptr %7, align 8, !tbaa !12
  %136 = load i64, ptr %6, align 8, !tbaa !12
  %137 = icmp sle i64 %135, %136
  br i1 %137, label %139, label %138

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

139:                                              ; preds = %134
  %140 = load i64, ptr %6, align 8, !tbaa !12
  %141 = load i64, ptr %6, align 8, !tbaa !12
  %142 = load i64, ptr %7, align 8, !tbaa !12
  %143 = sdiv i64 %141, %142
  %144 = sdiv i64 %140, %143
  store i64 %144, ptr %8, align 8, !tbaa !12
  %145 = load i64, ptr %6, align 8, !tbaa !12
  %146 = load i64, ptr %7, align 8, !tbaa !12
  %147 = sdiv i64 %145, %146
  %148 = srem i64 %147, 1000000007
  %149 = load i64, ptr %6, align 8, !tbaa !12
  %150 = load i64, ptr %7, align 8, !tbaa !12
  %151 = sdiv i64 %149, %150
  %152 = srem i64 %151, 1000000007
  %153 = mul nsw i64 %148, %152
  %154 = srem i64 %153, 1000000007
  %155 = load i64, ptr %7, align 8, !tbaa !12
  %156 = load i64, ptr %8, align 8, !tbaa !12
  %157 = call noundef i32 @_Z8calc_phixx(i64 noundef %155, i64 noundef %156)
  %158 = sext i32 %157 to i64
  %159 = mul nsw i64 %154, %158
  %160 = srem i64 %159, 1000000007
  %161 = trunc i64 %160 to i32
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %161)
  br label %162

162:                                              ; preds = %139
  %163 = load i64, ptr %8, align 8, !tbaa !12
  %164 = add nsw i64 %163, 1
  store i64 %164, ptr %7, align 8, !tbaa !12
  br label %134, !llvm.loop !14

165:                                              ; preds = %138
  %166 = load i32, ptr @ans, align 4, !tbaa !5
  %167 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %166)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %168 = load i32, ptr %1, align 4
  ret i32 %168
}

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

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

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 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 = { 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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!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"

@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [4641589 x i32], align 16
@f = external dso_local global [4641589 x i32], align 16
@g = external dso_local global [4641589 x i32], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4), 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 uwtable
declare dso_local noundef i32 @_Z8calc_phixx(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  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
  br label %5

2:                                                ; preds = %.critedge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %4 = load i64, ptr %1, align 8, !tbaa !9
  %.not46 = icmp slt i64 %4, 1
  br i1 %.not46, label %._crit_edge, label %.lr.ph48

5:                                                ; preds = %0, %.critedge
  %indvars.iv51 = phi i64 [ 2, %0 ], [ %indvars.iv.next52, %.critedge ]
  %6 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %indvars.iv51
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %.not41 = icmp eq i32 %7, 0
  br i1 %.not41, label %8, label %._crit_edge54

._crit_edge54:                                    ; preds = %5
  %.pre = trunc nuw nsw i64 %indvars.iv51 to i32
  br label %17

8:                                                ; preds = %5
  %9 = load i32, ptr @tot, align 4, !tbaa !5
  %10 = add nsw i32 %9, 1
  store i32 %10, ptr @tot, align 4, !tbaa !5
  %11 = sext i32 %9 to i64
  %12 = getelementptr inbounds [4641589 x i32], ptr @prime, i64 0, i64 %11
  %13 = trunc nuw nsw i64 %indvars.iv51 to i32
  store i32 %13, ptr %12, align 4, !tbaa !5
  %14 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %indvars.iv51
  tail call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %14, i32 noundef 1)
  %15 = trunc i64 %indvars.iv51 to i32
  %16 = add i32 %15, -1
  store i32 %16, ptr %6, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %._crit_edge54, %8
  %.pre-phi = phi i32 [ %.pre, %._crit_edge54 ], [ %13, %8 ]
  %18 = udiv i32 4641588, %.pre-phi
  %19 = load i32, ptr @tot, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %17
  %21 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %indvars.iv51
  br label %22

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

25:                                               ; preds = %22
  %26 = srem i32 %.pre-phi, %24
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %34

28:                                               ; preds = %25
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = mul nsw i32 %29, %24
  %31 = sext i32 %24 to i64
  %32 = mul nsw i64 %indvars.iv51, %31
  %33 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %32
  store i32 %30, ptr %33, align 4, !tbaa !5
  br label %.critedge

34:                                               ; preds = %25
  %35 = sext i32 %24 to i64
  %36 = mul nsw i64 %indvars.iv51, %35
  %37 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %36
  %38 = load i32, ptr %21, align 4, !tbaa !5
  tail call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %37, i32 noundef %38)
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = load i32, ptr %23, align 4, !tbaa !5
  %41 = add nsw i32 %40, -1
  %42 = mul nsw i32 %41, %39
  %43 = sext i32 %40 to i64
  %44 = mul nsw i64 %indvars.iv51, %43
  %45 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %44
  store i32 %42, ptr %45, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = load i32, ptr @tot, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = icmp slt i64 %indvars.iv.next, %47
  br i1 %48, label %22, label %.critedge, !llvm.loop !11

.critedge:                                        ; preds = %34, %22, %17, %28
  %49 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %indvars.iv51
  %50 = add nsw i64 %indvars.iv51, -1
  %51 = getelementptr inbounds [4641589 x i32], ptr @f, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  tail call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %49, i32 noundef %52)
  %53 = getelementptr inbounds [4641589 x i32], ptr @g, i64 0, i64 %50
  %54 = load i32, ptr %53, align 4, !tbaa !5
  tail call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %6, i32 noundef %54)
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next52, 4641589
  br i1 %exitcond.not, label %2, label %5, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph48, %2
  %55 = load i32, ptr @ans, align 4, !tbaa !5
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %55)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 0

.lr.ph48:                                         ; preds = %2, %.lr.ph48
  %57 = phi i64 [ %69, %.lr.ph48 ], [ %4, %2 ]
  %.047 = phi i64 [ %68, %.lr.ph48 ], [ 1, %2 ]
  %58 = udiv i64 %57, %.047
  %59 = sdiv i64 %57, %58
  %60 = srem i64 %58, 1000000007
  %61 = mul nuw nsw i64 %60, %60
  %62 = urem i64 %61, 1000000007
  %63 = call noundef i32 @_Z8calc_phixx(i64 noundef %.047, i64 noundef %59)
  %64 = sext i32 %63 to i64
  %65 = mul nsw i64 %62, %64
  %66 = srem i64 %65, 1000000007
  %67 = trunc nsw i64 %66 to i32
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %67)
  %68 = add nuw nsw i64 %59, 1
  %69 = load i64, ptr %1, align 8, !tbaa !9
  %.not.not = icmp slt i64 %59, %69
  br i1 %.not.not, label %.lr.ph48, label %._crit_edge, !llvm.loop !14
}

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

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

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 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 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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