; LLVM IR from tangjz/acm-icpc :: spoj (GCDEX2)

; 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
@pr = external dso_local global [14649 x i32], align 16
@d = external dso_local global [60000001 x i32], align 16
@t = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@n = external dso_local global i64, align 8
@fct = external dso_local global [20001 x i64], align 16
@f = external dso_local global [60000001 x i64], align 16
@ans = external dso_local global i64, align 8
@vis = external dso_local global [20001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 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 i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  store i64 1, ptr getelementptr inbounds ([60000001 x i64], ptr @f, i64 0, i64 1), align 8, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60000001 x i32], ptr @d, i64 0, i64 1), align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %110, %0
  %15 = load i32, ptr %2, align 4, !tbaa !9
  %16 = icmp slt i32 %15, 60000001
  br i1 %16, label %18, label %17

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

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

24:                                               ; preds = %18
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [60000001 x i32], ptr @d, i64 0, i64 %27
  store i32 %25, ptr %28, align 4, !tbaa !9
  %29 = load i32, ptr @tot, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr @tot, align 4, !tbaa !9
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds [14649 x i32], ptr @pr, i64 0, i64 %31
  store i32 %25, ptr %32, align 4, !tbaa !9
  %33 = load i32, ptr %2, align 4, !tbaa !9
  %34 = sub nsw i32 %33, 1
  %35 = sext i32 %34 to i64
  %36 = load i32, ptr %2, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %37
  store i64 %35, ptr %38, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %24, %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  br label %40

40:                                               ; preds = %95, %39
  %41 = load i32, ptr %2, align 4, !tbaa !9
  %42 = load i32, ptr %4, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [14649 x i32], ptr @pr, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = mul nsw i32 %41, %45
  store i32 %46, ptr %5, align 4, !tbaa !9
  %47 = icmp slt i32 %46, 60000001
  br i1 %47, label %49, label %48

48:                                               ; preds = %40
  store i32 5, ptr %3, align 4
  br label %98

49:                                               ; preds = %40
  %50 = load i32, ptr %4, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [14649 x i32], ptr @pr, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = load i32, ptr %5, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [60000001 x i32], ptr @d, i64 0, i64 %55
  store i32 %53, ptr %56, align 4, !tbaa !9
  %57 = load i32, ptr %2, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [60000001 x i32], ptr @d, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = load i32, ptr %4, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [14649 x i32], ptr @pr, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = icmp eq i32 %60, %64
  br i1 %65, label %66, label %80

66:                                               ; preds = %49
  %67 = load i32, ptr %2, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = load i32, ptr %4, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [14649 x i32], ptr @pr, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = mul nsw i64 %70, %75
  %77 = load i32, ptr %5, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %78
  store i64 %76, ptr %79, align 8, !tbaa !5
  store i32 5, ptr %3, align 4
  br label %98

80:                                               ; preds = %49
  %81 = load i32, ptr %2, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !5
  %85 = load i32, ptr %4, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [14649 x i32], ptr @pr, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = sub nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = mul nsw i64 %84, %90
  %92 = load i32, ptr %5, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %93
  store i64 %91, ptr %94, align 8, !tbaa !5
  br label %95

95:                                               ; preds = %80
  %96 = load i32, ptr %4, align 4, !tbaa !9
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %4, align 4, !tbaa !9
  br label %40, !llvm.loop !11

98:                                               ; preds = %66, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %2, align 4, !tbaa !9
  %101 = sub nsw i32 %100, 1
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !5
  %105 = load i32, ptr %2, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %106
  %108 = load i64, ptr %107, align 8, !tbaa !5
  %109 = add nsw i64 %108, %104
  store i64 %109, ptr %107, align 8, !tbaa !5
  br label %110

110:                                              ; preds = %99
  %111 = load i32, ptr %2, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %2, align 4, !tbaa !9
  br label %14, !llvm.loop !13

113:                                              ; preds = %17
  %114 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %115

115:                                              ; preds = %174, %113
  %116 = load i32, ptr @t, align 4, !tbaa !9
  %117 = add nsw i32 %116, -1
  store i32 %117, ptr @t, align 4, !tbaa !9
  %118 = icmp ne i32 %116, 0
  br i1 %118, label %119, label %177

119:                                              ; preds = %115
  store i32 0, ptr @m, align 4, !tbaa !9
  %120 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 60000001, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  br label %121

121:                                              ; preds = %138, %119
  %122 = load i64, ptr %6, align 8, !tbaa !5
  %123 = load i64, ptr @n, align 8, !tbaa !5
  %124 = icmp sle i64 %122, %123
  br i1 %124, label %126, label %125

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

126:                                              ; preds = %121
  %127 = load i64, ptr @n, align 8, !tbaa !5
  %128 = load i64, ptr %6, align 8, !tbaa !5
  %129 = sdiv i64 %127, %128
  store i64 %129, ptr %8, align 8, !tbaa !5
  %130 = load i64, ptr @n, align 8, !tbaa !5
  %131 = load i64, ptr %8, align 8, !tbaa !5
  %132 = sdiv i64 %130, %131
  store i64 %132, ptr %7, align 8, !tbaa !5
  %133 = load i64, ptr %7, align 8, !tbaa !5
  %134 = load i32, ptr @m, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr @m, align 4, !tbaa !9
  %136 = sext i32 %134 to i64
  %137 = getelementptr inbounds [20001 x i64], ptr @fct, i64 0, i64 %136
  store i64 %133, ptr %137, align 8, !tbaa !5
  br label %138

138:                                              ; preds = %126
  %139 = load i64, ptr %7, align 8, !tbaa !5
  %140 = add nsw i64 %139, 1
  store i64 %140, ptr %6, align 8, !tbaa !5
  br label %121, !llvm.loop !14

141:                                              ; preds = %125
  %142 = load i32, ptr @m, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = mul i64 %143, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %144, i1 false)
  %145 = load i64, ptr @n, align 8, !tbaa !5
  %146 = call noundef i64 @_Z4sum2x(i64 noundef %145)
  %147 = sub nsw i64 0, %146
  store i64 %147, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 1, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  br label %148

148:                                              ; preds = %170, %141
  %149 = load i64, ptr %9, align 8, !tbaa !5
  %150 = load i64, ptr @n, align 8, !tbaa !5
  %151 = icmp sle i64 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %174

153:                                              ; preds = %148
  %154 = load i64, ptr @n, align 8, !tbaa !5
  %155 = load i64, ptr %9, align 8, !tbaa !5
  %156 = sdiv i64 %154, %155
  store i64 %156, ptr %11, align 8, !tbaa !5
  %157 = load i64, ptr @n, align 8, !tbaa !5
  %158 = load i64, ptr %11, align 8, !tbaa !5
  %159 = sdiv i64 %157, %158
  store i64 %159, ptr %10, align 8, !tbaa !5
  %160 = load i64, ptr %10, align 8, !tbaa !5
  %161 = call noundef i64 @_Z4sum2x(i64 noundef %160)
  store i64 %161, ptr %13, align 8, !tbaa !5
  %162 = load i64, ptr %13, align 8, !tbaa !5
  %163 = load i64, ptr %12, align 8, !tbaa !5
  %164 = sub nsw i64 %162, %163
  %165 = load i64, ptr %11, align 8, !tbaa !5
  %166 = call noundef i64 @_Z1Fx(i64 noundef %165)
  %167 = mul nsw i64 %164, %166
  %168 = load i64, ptr @ans, align 8, !tbaa !5
  %169 = add nsw i64 %168, %167
  store i64 %169, ptr @ans, align 8, !tbaa !5
  br label %170

170:                                              ; preds = %153
  %171 = load i64, ptr %10, align 8, !tbaa !5
  %172 = add nsw i64 %171, 1
  store i64 %172, ptr %9, align 8, !tbaa !5
  %173 = load i64, ptr %13, align 8, !tbaa !5
  store i64 %173, ptr %12, align 8, !tbaa !5
  br label %148, !llvm.loop !15

174:                                              ; preds = %152
  %175 = load i64, ptr @ans, align 8, !tbaa !5
  %176 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %175)
  br label %115, !llvm.loop !16

177:                                              ; preds = %115
  ret i32 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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4sum2x(i64 noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_Z1Fx(i64 noundef) #5

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 nounwind willreturn memory(argmem: write) }
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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


; 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
@pr = external dso_local local_unnamed_addr global [14649 x i32], align 16
@d = external dso_local local_unnamed_addr global [60000001 x i32], align 16
@t = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local global i64, align 8
@fct = external dso_local local_unnamed_addr global [20001 x i64], align 16
@f = external dso_local local_unnamed_addr global [60000001 x i64], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@vis = external dso_local local_unnamed_addr global [20001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

1:                                                ; preds = %.loopexit
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %3 = load i32, ptr @t, align 4, !tbaa !9
  %4 = add nsw i32 %3, -1
  store i32 %4, ptr @t, align 4, !tbaa !9
  %.not62 = icmp eq i32 %3, 0
  br i1 %.not62, label %._crit_edge65, label %.lr.ph64

5:                                                ; preds = %0, %.loopexit
  %indvars.iv71 = phi i64 [ 2, %0 ], [ %indvars.iv.next72, %.loopexit ]
  %6 = phi i32 [ %tot.promoted, %0 ], [ %16, %.loopexit ]
  %7 = getelementptr inbounds [60000001 x i32], ptr @d, i64 0, i64 %indvars.iv71
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %.not46 = icmp eq i32 %8, 0
  %9 = trunc nuw nsw i64 %indvars.iv71 to i32
  br i1 %.not46, label %10, label %._crit_edge77

10:                                               ; preds = %5
  store i32 %9, ptr %7, align 4, !tbaa !9
  %11 = add nsw i32 %6, 1
  store i32 %11, ptr @tot, align 4, !tbaa !9
  %12 = sext i32 %6 to i64
  %13 = getelementptr inbounds [14649 x i32], ptr @pr, i64 0, i64 %12
  store i32 %9, ptr %13, align 4, !tbaa !9
  %14 = add nsw i64 %indvars.iv71, -1
  %15 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %indvars.iv71
  store i64 %14, ptr %15, align 8, !tbaa !5
  br label %._crit_edge77

._crit_edge77:                                    ; preds = %5, %10
  %16 = phi i32 [ %11, %10 ], [ %6, %5 ]
  %17 = load i32, ptr @pr, align 16, !tbaa !9
  %18 = mul nsw i32 %17, %9
  %19 = icmp slt i32 %18, 60000001
  br i1 %19, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %._crit_edge77
  %20 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %indvars.iv71
  br label %21

21:                                               ; preds = %.lr.ph, %33
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %33 ]
  %22 = phi i32 [ %18, %.lr.ph ], [ %40, %33 ]
  %23 = phi i32 [ %17, %.lr.ph ], [ %39, %33 ]
  %24 = sext i32 %22 to i64
  %25 = getelementptr inbounds [60000001 x i32], ptr @d, i64 0, i64 %24
  store i32 %23, ptr %25, align 4, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp eq i32 %26, %23
  %28 = load i64, ptr %20, align 8, !tbaa !5
  br i1 %27, label %29, label %33

29:                                               ; preds = %21
  %30 = sext i32 %23 to i64
  %31 = mul nsw i64 %28, %30
  %32 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %24
  store i64 %31, ptr %32, align 8, !tbaa !5
  br label %.loopexit

33:                                               ; preds = %21
  %34 = add nsw i32 %23, -1
  %35 = sext i32 %34 to i64
  %36 = mul nsw i64 %28, %35
  %37 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %24
  store i64 %36, ptr %37, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = getelementptr inbounds [14649 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = mul nsw i32 %39, %9
  %41 = icmp slt i32 %40, 60000001
  br i1 %41, label %21, label %.loopexit, !llvm.loop !11

.loopexit:                                        ; preds = %33, %._crit_edge77, %29
  %42 = add nsw i64 %indvars.iv71, -1
  %43 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds [60000001 x i64], ptr @f, i64 0, i64 %indvars.iv71
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = add nsw i64 %46, %44
  store i64 %47, ptr %45, align 8, !tbaa !5
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next72, 60000001
  br i1 %exitcond.not, label %1, label %5, !llvm.loop !13

.lr.ph64:                                         ; preds = %1, %._crit_edge61
  store i32 0, ptr @m, align 4, !tbaa !9
  %48 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
  %49 = load i64, ptr @n, align 8, !tbaa !5
  %m.promoted = load i32, ptr @m, align 4, !tbaa !9
  %.not4452 = icmp slt i64 %49, 60000001
  br i1 %.not4452, label %52, label %.lr.ph54.preheader

.lr.ph54.preheader:                               ; preds = %.lr.ph64
  %50 = sext i32 %m.promoted to i64
  br label %.lr.ph54

._crit_edge:                                      ; preds = %.lr.ph54
  %51 = trunc nsw i64 %indvars.iv.next75 to i32
  store i32 %51, ptr @m, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %._crit_edge, %.lr.ph64
  %53 = phi i32 [ %51, %._crit_edge ], [ %m.promoted, %.lr.ph64 ]
  %54 = sext i32 %53 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %54, i1 false)
  %55 = tail call noundef i64 @_Z4sum2x(i64 noundef %49)
  %56 = sub nsw i64 0, %55
  store i64 %56, ptr @ans, align 8, !tbaa !5
  %57 = load i64, ptr @n, align 8, !tbaa !5
  %.not4556 = icmp slt i64 %57, 1
  br i1 %.not4556, label %._crit_edge61, label %.lr.ph60

.lr.ph54:                                         ; preds = %.lr.ph54.preheader, %.lr.ph54
  %indvars.iv74 = phi i64 [ %50, %.lr.ph54.preheader ], [ %indvars.iv.next75, %.lr.ph54 ]
  %.03953 = phi i64 [ 60000001, %.lr.ph54.preheader ], [ %61, %.lr.ph54 ]
  %58 = udiv i64 %49, %.03953
  %59 = udiv i64 %49, %58
  %indvars.iv.next75 = add nsw i64 %indvars.iv74, 1
  %60 = getelementptr inbounds [20001 x i64], ptr @fct, i64 0, i64 %indvars.iv74
  store i64 %59, ptr %60, align 8, !tbaa !5
  %61 = add nuw nsw i64 %59, 1
  %.not44.not = icmp slt i64 %59, %49
  br i1 %.not44.not, label %.lr.ph54, label %._crit_edge, !llvm.loop !14

._crit_edge61:                                    ; preds = %.lr.ph60, %52
  %62 = phi i64 [ %56, %52 ], [ %74, %.lr.ph60 ]
  %63 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %62)
  %64 = load i32, ptr @t, align 4, !tbaa !9
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr @t, align 4, !tbaa !9
  %.not = icmp eq i32 %64, 0
  br i1 %.not, label %._crit_edge65, label %.lr.ph64, !llvm.loop !15

.lr.ph60:                                         ; preds = %52, %.lr.ph60
  %66 = phi i64 [ %76, %.lr.ph60 ], [ %57, %52 ]
  %.03658 = phi i64 [ %69, %.lr.ph60 ], [ 0, %52 ]
  %.03857 = phi i64 [ %75, %.lr.ph60 ], [ 1, %52 ]
  %67 = udiv i64 %66, %.03857
  %68 = sdiv i64 %66, %67
  %69 = tail call noundef i64 @_Z4sum2x(i64 noundef %68)
  %70 = sub nsw i64 %69, %.03658
  %71 = tail call noundef i64 @_Z1Fx(i64 noundef %67)
  %72 = mul nsw i64 %70, %71
  %73 = load i64, ptr @ans, align 8, !tbaa !5
  %74 = add nsw i64 %73, %72
  store i64 %74, ptr @ans, align 8, !tbaa !5
  %75 = add nuw nsw i64 %68, 1
  %76 = load i64, ptr @n, align 8, !tbaa !5
  %.not45.not = icmp slt i64 %68, %76
  br i1 %.not45.not, label %.lr.ph60, label %._crit_edge61, !llvm.loop !16

._crit_edge65:                                    ; preds = %._crit_edge61, %1
  ret i32 0
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4sum2x(i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_Z1Fx(i64 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

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

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


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