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

; 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 [664579 x i32], align 16
@d = external dso_local global [10000001 x i32], align 16
@t = external dso_local global i32, align 4
@sz = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@n = external dso_local global i64, align 8
@pp = external dso_local global [664579 x i64], align 16
@ans = external dso_local global [300001 x i64], 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
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7isprimex(i64 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsixx(i32 noundef, 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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %10

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

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

14:                                               ; preds = %10
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %29, label %20

20:                                               ; preds = %14
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %23
  store i32 %21, ptr %24, align 4, !tbaa !5
  %25 = load i32, ptr @tot, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @tot, align 4, !tbaa !5
  %27 = sext i32 %25 to i64
  %28 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %27
  store i32 %21, ptr %28, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %20, %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  br label %30

30:                                               ; preds = %58, %29
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = mul nsw i32 %31, %35
  store i32 %36, ptr %5, align 4, !tbaa !5
  %37 = icmp slt i32 %36, 10000001
  br i1 %37, label %39, label %38

38:                                               ; preds = %30
  store i32 5, ptr %3, align 4
  br label %61

39:                                               ; preds = %30
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %45
  store i32 %43, ptr %46, align 4, !tbaa !5
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp eq i32 %50, %54
  br i1 %55, label %56, label %57

56:                                               ; preds = %39
  store i32 5, ptr %3, align 4
  br label %61

57:                                               ; preds = %39
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %4, align 4, !tbaa !5
  br label %30, !llvm.loop !9

61:                                               ; preds = %56, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %2, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !11

66:                                               ; preds = %13
  %67 = load i32, ptr @tot, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %68
  store i32 2147483647, ptr %69, align 4, !tbaa !5
  %70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %71

71:                                               ; preds = %184, %80, %66
  %72 = load i32, ptr @t, align 4, !tbaa !5
  %73 = add nsw i32 %72, -1
  store i32 %73, ptr @t, align 4, !tbaa !5
  %74 = icmp ne i32 %72, 0
  br i1 %74, label %75, label %186

75:                                               ; preds = %71
  %76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n)
  %77 = load i64, ptr @n, align 8, !tbaa !12
  %78 = and i64 %77, 1
  %79 = icmp ne i64 %78, 0
  br i1 %79, label %80, label %86

80:                                               ; preds = %75
  %81 = load i64, ptr @n, align 8, !tbaa !12
  %82 = icmp eq i64 %81, 1
  %83 = zext i1 %82 to i64
  %84 = select i1 %82, ptr @.str.2, ptr @.str.3
  %85 = call i32 @puts(ptr noundef %84)
  br label %71, !llvm.loop !14

86:                                               ; preds = %75
  store i32 0, ptr @cnt, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %113, %86
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = load i32, ptr @tot, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %116

92:                                               ; preds = %87
  %93 = load i64, ptr @n, align 8, !tbaa !12
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = sub nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = srem i64 %93, %99
  %101 = icmp eq i64 %100, 0
  br i1 %101, label %102, label %112

102:                                              ; preds = %92
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = load i32, ptr @cnt, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr @cnt, align 4, !tbaa !5
  %110 = sext i32 %108 to i64
  %111 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %110
  store i64 %107, ptr %111, align 8, !tbaa !12
  br label %112

112:                                              ; preds = %102, %92
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %6, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %6, align 4, !tbaa !5
  br label %87, !llvm.loop !15

116:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %117 = load i64, ptr @n, align 8, !tbaa !12
  %118 = sdiv i64 %117, 10000001
  %119 = trunc i64 %118 to i32
  store i32 %119, ptr %7, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %148, %116
  %121 = load i32, ptr %7, align 4, !tbaa !5
  %122 = icmp sge i32 %121, 1
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %151

124:                                              ; preds = %120
  %125 = load i64, ptr @n, align 8, !tbaa !12
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = srem i64 %125, %127
  %129 = icmp eq i64 %128, 0
  br i1 %129, label %130, label %147

130:                                              ; preds = %124
  %131 = load i64, ptr @n, align 8, !tbaa !12
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = sdiv i64 %131, %133
  %135 = add nsw i64 %134, 1
  %136 = call noundef zeroext i1 @_Z7isprimex(i64 noundef %135)
  br i1 %136, label %137, label %147

137:                                              ; preds = %130
  %138 = load i64, ptr @n, align 8, !tbaa !12
  %139 = load i32, ptr %7, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = sdiv i64 %138, %140
  %142 = add nsw i64 %141, 1
  %143 = load i32, ptr @cnt, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr @cnt, align 4, !tbaa !5
  %145 = sext i32 %143 to i64
  %146 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %145
  store i64 %142, ptr %146, align 8, !tbaa !12
  br label %147

147:                                              ; preds = %137, %130, %124
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %7, align 4, !tbaa !5
  %150 = add nsw i32 %149, -1
  store i32 %150, ptr %7, align 4, !tbaa !5
  br label %120, !llvm.loop !16

151:                                              ; preds = %123
  %152 = load i64, ptr @n, align 8, !tbaa !12
  %153 = add nsw i64 %152, 2
  %154 = load i32, ptr @cnt, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %155
  store i64 %153, ptr %156, align 8, !tbaa !12
  store i32 0, ptr @sz, align 4, !tbaa !5
  %157 = load i64, ptr @n, align 8, !tbaa !12
  call void @_Z3dfsixx(i32 noundef 0, i64 noundef 1, i64 noundef %157)
  %158 = load i32, ptr @sz, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i64, ptr @ans, i64 %159
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @ans, ptr noundef %160)
  %161 = load i32, ptr @sz, align 4, !tbaa !5
  %162 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %161)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %181, %151
  %164 = load i32, ptr %8, align 4, !tbaa !5
  %165 = load i32, ptr @sz, align 4, !tbaa !5
  %166 = icmp slt i32 %164, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %163
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %184

168:                                              ; preds = %163
  %169 = load i32, ptr %9, align 4, !tbaa !5
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %171, label %173

171:                                              ; preds = %168
  %172 = call i32 @putchar(i32 noundef 32)
  br label %174

173:                                              ; preds = %168
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %173, %171
  %175 = phi i32 [ %172, %171 ], [ 1, %173 ]
  %176 = load i32, ptr %8, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [300001 x i64], ptr @ans, i64 0, i64 %177
  %179 = load i64, ptr %178, align 8, !tbaa !12
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %179)
  br label %181

181:                                              ; preds = %174
  %182 = load i32, ptr %8, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %8, align 4, !tbaa !5
  br label %163, !llvm.loop !17

184:                                              ; preds = %167
  %185 = call i32 @putchar(i32 noundef 10)
  br label %71, !llvm.loop !14

186:                                              ; preds = %71
  ret i32 0
}

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

declare i32 @puts(ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #5

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 = { 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 = !{!"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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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
@pr = external dso_local local_unnamed_addr global [664579 x i32], align 16
@d = external dso_local local_unnamed_addr global [10000001 x i32], align 16
@t = external dso_local global i32, align 4
@sz = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local global i64, align 8
@pp = external dso_local local_unnamed_addr global [664579 x i64], align 16
@ans = external dso_local global [300001 x i64], 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
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7isprimex(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsixx(i32 noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %7

1:                                                ; preds = %._crit_edge
  %2 = sext i32 %16 to i64
  %3 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %2
  store i32 2147483647, ptr %3, align 4, !tbaa !5
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %5 = load i32, ptr @t, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @t, align 4, !tbaa !5
  %.not50 = icmp eq i32 %5, 0
  br i1 %.not50, label %._crit_edge53, label %.lr.ph52

7:                                                ; preds = %0, %._crit_edge
  %indvars.iv55 = phi i64 [ 2, %0 ], [ %indvars.iv.next56, %._crit_edge ]
  %8 = phi i32 [ %tot.promoted, %0 ], [ %16, %._crit_edge ]
  %9 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %indvars.iv55
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %.not33 = icmp eq i32 %10, 0
  %11 = trunc nuw nsw i64 %indvars.iv55 to i32
  br i1 %.not33, label %12, label %._crit_edge71

12:                                               ; preds = %7
  store i32 %11, ptr %9, align 4, !tbaa !5
  %13 = add nsw i32 %8, 1
  store i32 %13, ptr @tot, align 4, !tbaa !5
  %14 = sext i32 %8 to i64
  %15 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %14
  store i32 %11, ptr %15, align 4, !tbaa !5
  br label %._crit_edge71

._crit_edge71:                                    ; preds = %7, %12
  %16 = phi i32 [ %13, %12 ], [ %8, %7 ]
  %17 = load i32, ptr @pr, align 16, !tbaa !5
  %18 = mul nsw i32 %17, %11
  %19 = icmp slt i32 %18, 10000001
  br i1 %19, label %.lr.ph, label %._crit_edge

20:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = mul nsw i32 %22, %11
  %24 = icmp slt i32 %23, 10000001
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !9

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

._crit_edge:                                      ; preds = %20, %.lr.ph, %._crit_edge71
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next56, 10000001
  br i1 %exitcond.not, label %1, label %7, !llvm.loop !11

.lr.ph52:                                         ; preds = %1, %.backedge
  %31 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
  %32 = load i64, ptr @n, align 8, !tbaa !12
  %33 = and i64 %32, 1
  %.not31 = icmp eq i64 %33, 0
  br i1 %.not31, label %40, label %34

34:                                               ; preds = %.lr.ph52
  %35 = icmp eq i64 %32, 1
  %36 = select i1 %35, ptr @.str.2, ptr @.str.3
  %37 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %36)
  br label %.backedge

.backedge:                                        ; preds = %34, %._crit_edge49
  %38 = load i32, ptr @t, align 4, !tbaa !5
  %39 = add nsw i32 %38, -1
  store i32 %39, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %38, 0
  br i1 %.not, label %._crit_edge53, label %.lr.ph52, !llvm.loop !14

40:                                               ; preds = %.lr.ph52
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %41 = load i32, ptr @tot, align 4, !tbaa !5
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %.lr.ph39.preheader, label %._crit_edge40

.lr.ph39.preheader:                               ; preds = %40
  %wide.trip.count = zext nneg i32 %41 to i64
  br label %.lr.ph39

._crit_edge40:                                    ; preds = %60, %40
  %43 = phi i32 [ 0, %40 ], [ %61, %60 ]
  %44 = sdiv i64 %32, 10000001
  %45 = trunc i64 %44 to i32
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph43.preheader, label %._crit_edge44

.lr.ph43.preheader:                               ; preds = %._crit_edge40
  %47 = and i64 %44, 2147483647
  br label %.lr.ph43

.lr.ph39:                                         ; preds = %.lr.ph39.preheader, %60
  %indvars.iv58 = phi i64 [ 0, %.lr.ph39.preheader ], [ %indvars.iv.next59, %60 ]
  %48 = phi i32 [ 0, %.lr.ph39.preheader ], [ %61, %60 ]
  %49 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %indvars.iv58
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, -1
  %52 = sext i32 %51 to i64
  %53 = srem i64 %32, %52
  %54 = icmp eq i64 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %.lr.ph39
  %56 = sext i32 %50 to i64
  %57 = add nsw i32 %48, 1
  store i32 %57, ptr @cnt, align 4, !tbaa !5
  %58 = sext i32 %48 to i64
  %59 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %58
  store i64 %56, ptr %59, align 8, !tbaa !12
  br label %60

60:                                               ; preds = %.lr.ph39, %55
  %61 = phi i32 [ %48, %.lr.ph39 ], [ %57, %55 ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond61.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count
  br i1 %exitcond61.not, label %._crit_edge40, label %.lr.ph39, !llvm.loop !15

._crit_edge44.loopexit:                           ; preds = %91
  %.pre69 = load i32, ptr @cnt, align 4, !tbaa !5
  br label %._crit_edge44

._crit_edge44:                                    ; preds = %._crit_edge44.loopexit, %._crit_edge40
  %62 = phi i32 [ %.pre69, %._crit_edge44.loopexit ], [ %43, %._crit_edge40 ]
  %63 = phi i64 [ %92, %._crit_edge44.loopexit ], [ %32, %._crit_edge40 ]
  %64 = add nsw i64 %63, 2
  %65 = sext i32 %62 to i64
  %66 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %65
  store i64 %64, ptr %66, align 8, !tbaa !12
  store i32 0, ptr @sz, align 4, !tbaa !5
  tail call void @_Z3dfsixx(i32 noundef 0, i64 noundef 1, i64 noundef %63)
  %67 = load i32, ptr @sz, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i64, ptr @ans, i64 %68
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @ans, ptr noundef nonnull %69)
  %70 = load i32, ptr @sz, align 4, !tbaa !5
  %71 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %70)
  %72 = load i32, ptr @sz, align 4, !tbaa !5
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph48.preheader._crit_edge, label %._crit_edge49

.lr.ph48.preheader._crit_edge:                    ; preds = %._crit_edge44
  %.pre70 = load i64, ptr @ans, align 16, !tbaa !12
  %74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.pre70)
  %75 = load i32, ptr @sz, align 4, !tbaa !5
  %76 = icmp sgt i32 %75, 1
  br i1 %76, label %.lr.ph48.peel.next, label %._crit_edge49

.lr.ph43:                                         ; preds = %.lr.ph43.preheader, %91
  %77 = phi i64 [ %32, %.lr.ph43.preheader ], [ %92, %91 ]
  %indvars.iv62 = phi i64 [ %47, %.lr.ph43.preheader ], [ %indvars.iv.next63, %91 ]
  %78 = srem i64 %77, %indvars.iv62
  %79 = sdiv i64 %77, %indvars.iv62
  %80 = icmp eq i64 %78, 0
  br i1 %80, label %81, label %91

81:                                               ; preds = %.lr.ph43
  %82 = add nsw i64 %79, 1
  %83 = tail call noundef zeroext i1 @_Z7isprimex(i64 noundef %82)
  %.pre = load i64, ptr @n, align 8, !tbaa !12
  br i1 %83, label %84, label %91

84:                                               ; preds = %81
  %85 = sdiv i64 %.pre, %indvars.iv62
  %86 = add nsw i64 %85, 1
  %87 = load i32, ptr @cnt, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr @cnt, align 4, !tbaa !5
  %89 = sext i32 %87 to i64
  %90 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %89
  store i64 %86, ptr %90, align 8, !tbaa !12
  br label %91

91:                                               ; preds = %.lr.ph43, %81, %84
  %92 = phi i64 [ %77, %.lr.ph43 ], [ %.pre, %81 ], [ %.pre, %84 ]
  %indvars.iv.next63 = add nsw i64 %indvars.iv62, -1
  %93 = icmp sgt i64 %indvars.iv62, 1
  br i1 %93, label %.lr.ph43, label %._crit_edge44.loopexit, !llvm.loop !16

._crit_edge49:                                    ; preds = %.lr.ph48.peel.next, %.lr.ph48.preheader._crit_edge, %._crit_edge44
  %94 = tail call i32 @putchar(i32 noundef 10)
  br label %.backedge

.lr.ph48.peel.next:                               ; preds = %.lr.ph48.preheader._crit_edge, %.lr.ph48.peel.next
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %.lr.ph48.peel.next ], [ 1, %.lr.ph48.preheader._crit_edge ]
  %95 = tail call i32 @putchar(i32 noundef 32)
  %96 = getelementptr inbounds [300001 x i64], ptr @ans, i64 0, i64 %indvars.iv65
  %97 = load i64, ptr %96, align 8, !tbaa !12
  %98 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %97)
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %99 = load i32, ptr @sz, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = icmp slt i64 %indvars.iv.next66, %100
  br i1 %101, label %.lr.ph48.peel.next, label %._crit_edge49, !llvm.loop !17

._crit_edge53:                                    ; preds = %.backedge, %1
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5

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 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 #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 = { 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 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 nofree 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" }

!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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}


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