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

; 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 [78499 x i32], align 16
@d = external dso_local global [1000001 x i32], align 16
@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 [78499 x i64], align 16
@ans = external dso_local global [300001 x i64], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = 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
  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 %8

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

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

12:                                               ; preds = %8
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %27, label %18

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

27:                                               ; preds = %18, %12
  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 %28

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

36:                                               ; preds = %28
  store i32 5, ptr %3, align 4
  br label %59

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

54:                                               ; preds = %37
  store i32 5, ptr %3, align 4
  br label %59

55:                                               ; preds = %37
  br label %56

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

59:                                               ; preds = %54, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %60

60:                                               ; preds = %59
  br label %61

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

64:                                               ; preds = %11
  %65 = load i32, ptr @tot, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [78499 x i32], ptr @pr, i64 0, i64 %66
  store i32 2147483647, ptr %67, align 4, !tbaa !5
  %68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %69 = load i64, ptr @n, align 8, !tbaa !12
  %70 = and i64 %69, 1
  %71 = icmp ne i64 %70, 0
  br i1 %71, label %72, label %78

72:                                               ; preds = %64
  %73 = load i64, ptr @n, align 8, !tbaa !12
  %74 = icmp eq i64 %73, 1
  %75 = zext i1 %74 to i64
  %76 = select i1 %74, ptr @.str.1, ptr @.str.2
  %77 = call i32 @puts(ptr noundef %76)
  store i32 0, ptr %1, align 4
  br label %165

78:                                               ; preds = %64
  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 %79

79:                                               ; preds = %105, %78
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = load i32, ptr @tot, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %84, label %83

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

84:                                               ; preds = %79
  %85 = load i64, ptr @n, align 8, !tbaa !12
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [78499 x i32], ptr @pr, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sub nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = srem i64 %85, %91
  %93 = icmp eq i64 %92, 0
  br i1 %93, label %94, label %104

94:                                               ; preds = %84
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [78499 x i32], ptr @pr, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = load i32, ptr @cnt, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr @cnt, align 4, !tbaa !5
  %102 = sext i32 %100 to i64
  %103 = getelementptr inbounds [78499 x i64], ptr @pp, i64 0, i64 %102
  store i64 %99, ptr %103, align 8, !tbaa !12
  br label %104

104:                                              ; preds = %94, %84
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %6, align 4, !tbaa !5
  br label %79, !llvm.loop !14

108:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %109 = load i64, ptr @n, align 8, !tbaa !12
  %110 = sdiv i64 %109, 1000001
  %111 = trunc i64 %110 to i32
  store i32 %111, ptr %7, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %140, %108
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = icmp sge i32 %113, 1
  br i1 %114, label %116, label %115

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

116:                                              ; preds = %112
  %117 = load i64, ptr @n, align 8, !tbaa !12
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = srem i64 %117, %119
  %121 = icmp eq i64 %120, 0
  br i1 %121, label %122, label %139

122:                                              ; preds = %116
  %123 = load i64, ptr @n, align 8, !tbaa !12
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = sdiv i64 %123, %125
  %127 = add nsw i64 %126, 1
  %128 = call noundef zeroext i1 @_Z7isprimex(i64 noundef %127)
  br i1 %128, label %129, label %139

129:                                              ; preds = %122
  %130 = load i64, ptr @n, align 8, !tbaa !12
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = sdiv i64 %130, %132
  %134 = add nsw i64 %133, 1
  %135 = load i32, ptr @cnt, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr @cnt, align 4, !tbaa !5
  %137 = sext i32 %135 to i64
  %138 = getelementptr inbounds [78499 x i64], ptr @pp, i64 0, i64 %137
  store i64 %134, ptr %138, align 8, !tbaa !12
  br label %139

139:                                              ; preds = %129, %122, %116
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = add nsw i32 %141, -1
  store i32 %142, ptr %7, align 4, !tbaa !5
  br label %112, !llvm.loop !15

143:                                              ; preds = %115
  %144 = load i64, ptr @n, align 8, !tbaa !12
  %145 = add nsw i64 %144, 2
  %146 = load i32, ptr @cnt, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [78499 x i64], ptr @pp, i64 0, i64 %147
  store i64 %145, ptr %148, align 8, !tbaa !12
  store i32 0, ptr @sz, align 4, !tbaa !5
  %149 = load i64, ptr @n, align 8, !tbaa !12
  call void @_Z3dfsixx(i32 noundef 0, i64 noundef 1, i64 noundef %149)
  %150 = load i32, ptr @sz, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds i64, ptr @ans, i64 %151
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @ans, ptr noundef %152)
  %153 = load i32, ptr @sz, align 4, !tbaa !5
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %161

155:                                              ; preds = %143
  %156 = load i64, ptr @ans, align 16, !tbaa !12
  %157 = icmp slt i64 %156, 2147483648
  br i1 %157, label %158, label %161

158:                                              ; preds = %155
  %159 = load i64, ptr @ans, align 16, !tbaa !12
  %160 = trunc i64 %159 to i32
  br label %162

161:                                              ; preds = %155, %143
  br label %162

162:                                              ; preds = %161, %158
  %163 = phi i32 [ %160, %158 ], [ -1, %161 ]
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %163)
  store i32 0, ptr %1, align 4
  br label %165

165:                                              ; preds = %162, %72
  %166 = load i32, ptr %1, align 4
  ret i32 %166
}

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

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}


; 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 [78499 x i32], align 16
@d = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@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 [78499 x i64], align 16
@ans = external dso_local global [300001 x i64], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = 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 [78499 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 @n)
  %5 = load i64, ptr @n, align 8, !tbaa !9
  %6 = and i64 %5, 1
  %.not = icmp eq i64 %6, 0
  br i1 %.not, label %35, label %31

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

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 [78499 x i32], ptr @pr, i64 0, i64 %14
  store i32 %11, ptr %15, align 4, !tbaa !5
  br label %._crit_edge53

._crit_edge53:                                    ; 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, 1000001
  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 [78499 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, 1000001
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.lr.ph:                                           ; preds = %._crit_edge53, %20
  %indvars.iv = phi i64 [ %indvars.iv.next, %20 ], [ 0, %._crit_edge53 ]
  %25 = phi i32 [ %23, %20 ], [ %18, %._crit_edge53 ]
  %26 = phi i32 [ %22, %20 ], [ %17, %._crit_edge53 ]
  %27 = sext i32 %25 to i64
  %28 = getelementptr inbounds [1000001 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_edge53
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next42, 1000001
  br i1 %exitcond.not, label %1, label %7, !llvm.loop !13

31:                                               ; preds = %1
  %32 = icmp eq i64 %5, 1
  %33 = select i1 %32, ptr @.str.1, ptr @.str.2
  %34 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %33)
  br label %89

35:                                               ; preds = %1
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %36 = load i32, ptr @tot, align 4, !tbaa !5
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph34.preheader, label %._crit_edge35

.lr.ph34.preheader:                               ; preds = %35
  %wide.trip.count = zext nneg i32 %36 to i64
  br label %.lr.ph34

._crit_edge35:                                    ; preds = %55, %35
  %38 = phi i32 [ 0, %35 ], [ %56, %55 ]
  %39 = sdiv i64 %5, 1000001
  %40 = trunc i64 %39 to i32
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %.lr.ph38.preheader, label %._crit_edge39

.lr.ph38.preheader:                               ; preds = %._crit_edge35
  %42 = and i64 %39, 2147483647
  br label %.lr.ph38

.lr.ph34:                                         ; preds = %.lr.ph34.preheader, %55
  %indvars.iv44 = phi i64 [ 0, %.lr.ph34.preheader ], [ %indvars.iv.next45, %55 ]
  %43 = phi i32 [ 0, %.lr.ph34.preheader ], [ %56, %55 ]
  %44 = getelementptr inbounds [78499 x i32], ptr @pr, i64 0, i64 %indvars.iv44
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  %47 = sext i32 %46 to i64
  %48 = srem i64 %5, %47
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %50, label %55

50:                                               ; preds = %.lr.ph34
  %51 = sext i32 %45 to i64
  %52 = add nsw i32 %43, 1
  store i32 %52, ptr @cnt, align 4, !tbaa !5
  %53 = sext i32 %43 to i64
  %54 = getelementptr inbounds [78499 x i64], ptr @pp, i64 0, i64 %53
  store i64 %51, ptr %54, align 8, !tbaa !9
  br label %55

55:                                               ; preds = %.lr.ph34, %50
  %56 = phi i32 [ %43, %.lr.ph34 ], [ %52, %50 ]
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %exitcond47.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count
  br i1 %exitcond47.not, label %._crit_edge35, label %.lr.ph34, !llvm.loop !14

._crit_edge39.loopexit:                           ; preds = %86
  %.pre52 = load i32, ptr @cnt, align 4, !tbaa !5
  br label %._crit_edge39

._crit_edge39:                                    ; preds = %._crit_edge39.loopexit, %._crit_edge35
  %57 = phi i32 [ %.pre52, %._crit_edge39.loopexit ], [ %38, %._crit_edge35 ]
  %58 = phi i64 [ %87, %._crit_edge39.loopexit ], [ %5, %._crit_edge35 ]
  %59 = add nsw i64 %58, 2
  %60 = sext i32 %57 to i64
  %61 = getelementptr inbounds [78499 x i64], ptr @pp, i64 0, i64 %60
  store i64 %59, ptr %61, align 8, !tbaa !9
  store i32 0, ptr @sz, align 4, !tbaa !5
  tail call void @_Z3dfsixx(i32 noundef 0, i64 noundef 1, i64 noundef %58)
  %62 = load i32, ptr @sz, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i64, ptr @ans, i64 %63
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @ans, ptr noundef nonnull %64)
  %65 = load i32, ptr @sz, align 4, !tbaa !5
  %66 = icmp ne i32 %65, 0
  %67 = load i64, ptr @ans, align 16
  %68 = icmp slt i64 %67, 2147483648
  %or.cond = select i1 %66, i1 %68, i1 false
  %69 = trunc i64 %67 to i32
  %70 = select i1 %or.cond, i32 %69, i32 -1
  %71 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %70)
  br label %89

.lr.ph38:                                         ; preds = %.lr.ph38.preheader, %86
  %72 = phi i64 [ %5, %.lr.ph38.preheader ], [ %87, %86 ]
  %indvars.iv48 = phi i64 [ %42, %.lr.ph38.preheader ], [ %indvars.iv.next49, %86 ]
  %73 = srem i64 %72, %indvars.iv48
  %74 = sdiv i64 %72, %indvars.iv48
  %75 = icmp eq i64 %73, 0
  br i1 %75, label %76, label %86

76:                                               ; preds = %.lr.ph38
  %77 = add nsw i64 %74, 1
  %78 = tail call noundef zeroext i1 @_Z7isprimex(i64 noundef %77)
  %.pre = load i64, ptr @n, align 8, !tbaa !9
  br i1 %78, label %79, label %86

79:                                               ; preds = %76
  %80 = sdiv i64 %.pre, %indvars.iv48
  %81 = add nsw i64 %80, 1
  %82 = load i32, ptr @cnt, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr @cnt, align 4, !tbaa !5
  %84 = sext i32 %82 to i64
  %85 = getelementptr inbounds [78499 x i64], ptr @pp, i64 0, i64 %84
  store i64 %81, ptr %85, align 8, !tbaa !9
  br label %86

86:                                               ; preds = %.lr.ph38, %76, %79
  %87 = phi i64 [ %72, %.lr.ph38 ], [ %.pre, %76 ], [ %.pre, %79 ]
  %indvars.iv.next49 = add nsw i64 %indvars.iv48, -1
  %88 = icmp sgt i64 %indvars.iv48, 1
  br i1 %88, label %.lr.ph38, label %._crit_edge39.loopexit, !llvm.loop !15

89:                                               ; preds = %._crit_edge39, %31
  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

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" }

!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}
!15 = distinct !{!15, !12}


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