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

; 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 [1000001 x i64], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 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
  %10 = alloca i32, align 4
  %11 = 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 %12

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

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

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

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

31:                                               ; preds = %22, %16
  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 %32

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

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

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

58:                                               ; preds = %41
  store i32 5, ptr %3, align 4
  br label %63

59:                                               ; preds = %41
  br label %60

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

63:                                               ; preds = %58, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %64

64:                                               ; preds = %63
  br label %65

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

68:                                               ; preds = %15
  %69 = load i32, ptr @tot, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %70
  store i32 2147483647, ptr %71, align 4, !tbaa !5
  %72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @t)
  %73 = load i64, ptr @n, align 8, !tbaa !12
  %74 = and i64 %73, 1
  %75 = icmp ne i64 %74, 0
  br i1 %75, label %76, label %118

76:                                               ; preds = %68
  store i32 0, ptr @sz, align 4, !tbaa !5
  %77 = load i64, ptr @n, align 8, !tbaa !12
  %78 = icmp eq i64 %77, 1
  br i1 %78, label %79, label %88

79:                                               ; preds = %76
  %80 = load i32, ptr @sz, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr @sz, align 4, !tbaa !5
  %82 = sext i32 %80 to i64
  %83 = getelementptr inbounds [1000001 x i64], ptr @ans, i64 0, i64 %82
  store i64 1, ptr %83, align 8, !tbaa !12
  %84 = load i32, ptr @sz, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr @sz, align 4, !tbaa !5
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [1000001 x i64], ptr @ans, i64 0, i64 %86
  store i64 2, ptr %87, align 8, !tbaa !12
  br label %88

88:                                               ; preds = %79, %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %89

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

93:                                               ; preds = %89
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = load i32, ptr @sz, align 4, !tbaa !5
  %96 = icmp slt i32 %94, %95
  br label %97

97:                                               ; preds = %93, %89
  %98 = phi i1 [ false, %89 ], [ %96, %93 ]
  br i1 %98, label %100, label %99

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

100:                                              ; preds = %97
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %105

103:                                              ; preds = %100
  %104 = call i32 @putchar(i32 noundef 32)
  br label %106

105:                                              ; preds = %100
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %105, %103
  %107 = phi i32 [ %104, %103 ], [ 1, %105 ]
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1000001 x i64], ptr @ans, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !12
  %112 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %111)
  br label %113

113:                                              ; preds = %106
  %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 %89, !llvm.loop !14

116:                                              ; preds = %99
  %117 = call i32 @putchar(i32 noundef 10)
  store i32 0, ptr %1, align 4
  br label %222

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

119:                                              ; preds = %145, %118
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = load i32, ptr @tot, align 4, !tbaa !5
  %122 = icmp slt i32 %120, %121
  br i1 %122, label %124, label %123

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

124:                                              ; preds = %119
  %125 = load i64, ptr @n, align 8, !tbaa !12
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = sub nsw i32 %129, 1
  %131 = sext i32 %130 to i64
  %132 = srem i64 %125, %131
  %133 = icmp eq i64 %132, 0
  br i1 %133, label %134, label %144

134:                                              ; preds = %124
  %135 = load i32, ptr %8, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = load i32, ptr @cnt, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr @cnt, align 4, !tbaa !5
  %142 = sext i32 %140 to i64
  %143 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %142
  store i64 %139, ptr %143, align 8, !tbaa !12
  br label %144

144:                                              ; preds = %134, %124
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %8, align 4, !tbaa !5
  br label %119, !llvm.loop !15

148:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %149 = load i64, ptr @n, align 8, !tbaa !12
  %150 = sdiv i64 %149, 10000001
  %151 = trunc i64 %150 to i32
  store i32 %151, ptr %9, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %180, %148
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = icmp sge i32 %153, 1
  br i1 %154, label %156, label %155

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

156:                                              ; preds = %152
  %157 = load i64, ptr @n, align 8, !tbaa !12
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = srem i64 %157, %159
  %161 = icmp eq i64 %160, 0
  br i1 %161, label %162, label %179

162:                                              ; preds = %156
  %163 = load i64, ptr @n, align 8, !tbaa !12
  %164 = load i32, ptr %9, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = sdiv i64 %163, %165
  %167 = add nsw i64 %166, 1
  %168 = call noundef zeroext i1 @_Z7isprimex(i64 noundef %167)
  br i1 %168, label %169, label %179

169:                                              ; preds = %162
  %170 = load i64, ptr @n, align 8, !tbaa !12
  %171 = load i32, ptr %9, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = sdiv i64 %170, %172
  %174 = add nsw i64 %173, 1
  %175 = load i32, ptr @cnt, align 4, !tbaa !5
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr @cnt, align 4, !tbaa !5
  %177 = sext i32 %175 to i64
  %178 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %177
  store i64 %174, ptr %178, align 8, !tbaa !12
  br label %179

179:                                              ; preds = %169, %162, %156
  br label %180

180:                                              ; preds = %179
  %181 = load i32, ptr %9, align 4, !tbaa !5
  %182 = add nsw i32 %181, -1
  store i32 %182, ptr %9, align 4, !tbaa !5
  br label %152, !llvm.loop !16

183:                                              ; preds = %155
  %184 = load i64, ptr @n, align 8, !tbaa !12
  %185 = add nsw i64 %184, 2
  %186 = load i32, ptr @cnt, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %187
  store i64 %185, ptr %188, align 8, !tbaa !12
  store i32 0, ptr @sz, align 4, !tbaa !5
  %189 = load i64, ptr @n, align 8, !tbaa !12
  call void @_Z3dfsixx(i32 noundef 0, i64 noundef 1, i64 noundef %189)
  %190 = load i32, ptr @sz, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds i64, ptr @ans, i64 %191
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @ans, ptr noundef %192)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %193

193:                                              ; preds = %217, %183
  %194 = load i32, ptr %10, align 4, !tbaa !5
  %195 = load i32, ptr @t, align 4, !tbaa !5
  %196 = icmp slt i32 %194, %195
  br i1 %196, label %197, label %201

197:                                              ; preds = %193
  %198 = load i32, ptr %10, align 4, !tbaa !5
  %199 = load i32, ptr @sz, align 4, !tbaa !5
  %200 = icmp slt i32 %198, %199
  br label %201

201:                                              ; preds = %197, %193
  %202 = phi i1 [ false, %193 ], [ %200, %197 ]
  br i1 %202, label %204, label %203

203:                                              ; preds = %201
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %220

204:                                              ; preds = %201
  %205 = load i32, ptr %11, align 4, !tbaa !5
  %206 = icmp ne i32 %205, 0
  br i1 %206, label %207, label %209

207:                                              ; preds = %204
  %208 = call i32 @putchar(i32 noundef 32)
  br label %210

209:                                              ; preds = %204
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %210

210:                                              ; preds = %209, %207
  %211 = phi i32 [ %208, %207 ], [ 1, %209 ]
  %212 = load i32, ptr %10, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1000001 x i64], ptr @ans, i64 0, i64 %213
  %215 = load i64, ptr %214, align 8, !tbaa !12
  %216 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %215)
  br label %217

217:                                              ; preds = %210
  %218 = load i32, ptr %10, align 4, !tbaa !5
  %219 = add nsw i32 %218, 1
  store i32 %219, ptr %10, align 4, !tbaa !5
  br label %193, !llvm.loop !17

220:                                              ; preds = %203
  %221 = call i32 @putchar(i32 noundef 10)
  store i32 0, ptr %1, align 4
  br label %222

222:                                              ; preds = %220, %116
  %223 = load i32, ptr %1, align 4
  ret i32 %223
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr 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 [1000001 x i64], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 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 @n, ptr noundef nonnull @t)
  %5 = load i64, ptr @n, align 8, !tbaa !9
  %6 = and i64 %5, 1
  %.not = icmp eq i64 %6, 0
  br i1 %.not, label %54, label %31

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

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_edge87

._crit_edge87:                                    ; 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 !11

.lr.ph:                                           ; preds = %._crit_edge87, %20
  %indvars.iv = phi i64 [ %indvars.iv.next, %20 ], [ 0, %._crit_edge87 ]
  %25 = phi i32 [ %23, %20 ], [ %18, %._crit_edge87 ]
  %26 = phi i32 [ %22, %20 ], [ %17, %._crit_edge87 ]
  %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_edge87
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next68, 10000001
  br i1 %exitcond.not, label %1, label %7, !llvm.loop !13

31:                                               ; preds = %1
  store i32 0, ptr @sz, align 4, !tbaa !5
  %32 = icmp eq i64 %5, 1
  br i1 %32, label %33, label %._crit_edge52

33:                                               ; preds = %31
  store i64 1, ptr @ans, align 16, !tbaa !9
  store i32 2, ptr @sz, align 4, !tbaa !5
  store i64 2, ptr getelementptr inbounds (i8, ptr @ans, i64 8), align 8, !tbaa !9
  %34 = load i32, ptr @t, align 4, !tbaa !5
  %35 = icmp sgt i32 %34, 0
  %36 = and i1 %35, %32
  br i1 %36, label %.lr.ph51.preheader._crit_edge, label %._crit_edge52

.lr.ph51.preheader._crit_edge:                    ; preds = %33
  %.pre = load i64, ptr @ans, align 16, !tbaa !9
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.pre)
  %38 = load i32, ptr @t, align 4, !tbaa !5
  %39 = icmp sgt i32 %38, 1
  %40 = load i32, ptr @sz, align 4
  %41 = icmp sgt i32 %40, 1
  %42 = select i1 %39, i1 %41, i1 false
  br i1 %42, label %.lr.ph51.peel.next, label %._crit_edge52

.lr.ph51.peel.next:                               ; preds = %.lr.ph51.preheader._crit_edge, %.lr.ph51.peel.next
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %.lr.ph51.peel.next ], [ 1, %.lr.ph51.preheader._crit_edge ]
  %43 = tail call i32 @putchar(i32 noundef 32)
  %44 = getelementptr inbounds [1000001 x i64], ptr @ans, i64 0, i64 %indvars.iv70
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %45)
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %47 = load i32, ptr @t, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %indvars.iv.next71, %48
  %50 = load i32, ptr @sz, align 4
  %51 = sext i32 %50 to i64
  %52 = icmp slt i64 %indvars.iv.next71, %51
  %53 = select i1 %49, i1 %52, i1 false
  br i1 %53, label %.lr.ph51.peel.next, label %._crit_edge52, !llvm.loop !14

54:                                               ; preds = %1
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %55 = load i32, ptr @tot, align 4, !tbaa !5
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph55.preheader, label %._crit_edge56

.lr.ph55.preheader:                               ; preds = %54
  %wide.trip.count = zext nneg i32 %55 to i64
  br label %.lr.ph55

._crit_edge56:                                    ; preds = %74, %54
  %57 = phi i32 [ 0, %54 ], [ %75, %74 ]
  %58 = sdiv i64 %5, 10000001
  %59 = trunc i64 %58 to i32
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %.lr.ph59.preheader, label %._crit_edge60

.lr.ph59.preheader:                               ; preds = %._crit_edge56
  %61 = and i64 %58, 2147483647
  br label %.lr.ph59

.lr.ph55:                                         ; preds = %.lr.ph55.preheader, %74
  %indvars.iv73 = phi i64 [ 0, %.lr.ph55.preheader ], [ %indvars.iv.next74, %74 ]
  %62 = phi i32 [ 0, %.lr.ph55.preheader ], [ %75, %74 ]
  %63 = getelementptr inbounds [664579 x i32], ptr @pr, i64 0, i64 %indvars.iv73
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = add nsw i32 %64, -1
  %66 = sext i32 %65 to i64
  %67 = srem i64 %5, %66
  %68 = icmp eq i64 %67, 0
  br i1 %68, label %69, label %74

69:                                               ; preds = %.lr.ph55
  %70 = sext i32 %64 to i64
  %71 = add nsw i32 %62, 1
  store i32 %71, ptr @cnt, align 4, !tbaa !5
  %72 = sext i32 %62 to i64
  %73 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %72
  store i64 %70, ptr %73, align 8, !tbaa !9
  br label %74

74:                                               ; preds = %.lr.ph55, %69
  %75 = phi i32 [ %62, %.lr.ph55 ], [ %71, %69 ]
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count
  br i1 %exitcond76.not, label %._crit_edge56, label %.lr.ph55, !llvm.loop !16

._crit_edge60.loopexit:                           ; preds = %109
  %.pre85 = load i32, ptr @cnt, align 4, !tbaa !5
  br label %._crit_edge60

._crit_edge60:                                    ; preds = %._crit_edge60.loopexit, %._crit_edge56
  %76 = phi i32 [ %.pre85, %._crit_edge60.loopexit ], [ %57, %._crit_edge56 ]
  %77 = phi i64 [ %110, %._crit_edge60.loopexit ], [ %5, %._crit_edge56 ]
  %78 = add nsw i64 %77, 2
  %79 = sext i32 %76 to i64
  %80 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %79
  store i64 %78, ptr %80, 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 %77)
  %81 = load i32, ptr @sz, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i64, ptr @ans, i64 %82
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @ans, ptr noundef nonnull %83)
  %84 = load i32, ptr @t, align 4, !tbaa !5
  %85 = icmp sgt i32 %84, 0
  %86 = load i32, ptr @sz, align 4
  %87 = icmp sgt i32 %86, 0
  %88 = select i1 %85, i1 %87, i1 false
  br i1 %88, label %.lr.ph64.preheader._crit_edge, label %._crit_edge52

.lr.ph64.preheader._crit_edge:                    ; preds = %._crit_edge60
  %.pre86 = load i64, ptr @ans, align 16, !tbaa !9
  %89 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.pre86)
  %90 = load i32, ptr @t, align 4, !tbaa !5
  %91 = icmp sgt i32 %90, 1
  %92 = load i32, ptr @sz, align 4
  %93 = icmp sgt i32 %92, 1
  %94 = select i1 %91, i1 %93, i1 false
  br i1 %94, label %.lr.ph64.peel.next, label %._crit_edge52

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %109
  %95 = phi i64 [ %5, %.lr.ph59.preheader ], [ %110, %109 ]
  %indvars.iv77 = phi i64 [ %61, %.lr.ph59.preheader ], [ %indvars.iv.next78, %109 ]
  %96 = srem i64 %95, %indvars.iv77
  %97 = sdiv i64 %95, %indvars.iv77
  %98 = icmp eq i64 %96, 0
  br i1 %98, label %99, label %109

99:                                               ; preds = %.lr.ph59
  %100 = add nsw i64 %97, 1
  %101 = tail call noundef zeroext i1 @_Z7isprimex(i64 noundef %100)
  %.pre83 = load i64, ptr @n, align 8, !tbaa !9
  br i1 %101, label %102, label %109

102:                                              ; preds = %99
  %103 = sdiv i64 %.pre83, %indvars.iv77
  %104 = add nsw i64 %103, 1
  %105 = load i32, ptr @cnt, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr @cnt, align 4, !tbaa !5
  %107 = sext i32 %105 to i64
  %108 = getelementptr inbounds [664579 x i64], ptr @pp, i64 0, i64 %107
  store i64 %104, ptr %108, align 8, !tbaa !9
  br label %109

109:                                              ; preds = %.lr.ph59, %99, %102
  %110 = phi i64 [ %95, %.lr.ph59 ], [ %.pre83, %99 ], [ %.pre83, %102 ]
  %indvars.iv.next78 = add nsw i64 %indvars.iv77, -1
  %111 = icmp sgt i64 %indvars.iv77, 1
  br i1 %111, label %.lr.ph59, label %._crit_edge60.loopexit, !llvm.loop !17

.lr.ph64.peel.next:                               ; preds = %.lr.ph64.preheader._crit_edge, %.lr.ph64.peel.next
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %.lr.ph64.peel.next ], [ 1, %.lr.ph64.preheader._crit_edge ]
  %112 = tail call i32 @putchar(i32 noundef 32)
  %113 = getelementptr inbounds [1000001 x i64], ptr @ans, i64 0, i64 %indvars.iv80
  %114 = load i64, ptr %113, align 8, !tbaa !9
  %115 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %114)
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %116 = load i32, ptr @t, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = icmp slt i64 %indvars.iv.next81, %117
  %119 = load i32, ptr @sz, align 4
  %120 = sext i32 %119 to i64
  %121 = icmp slt i64 %indvars.iv.next81, %120
  %122 = select i1 %118, i1 %121, i1 false
  br i1 %122, label %.lr.ph64.peel.next, label %._crit_edge52, !llvm.loop !18

._crit_edge52:                                    ; preds = %.lr.ph51.peel.next, %.lr.ph64.peel.next, %._crit_edge60, %.lr.ph64.preheader._crit_edge, %33, %.lr.ph51.preheader._crit_edge, %31
  %123 = tail call i32 @putchar(i32 noundef 10)
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 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 uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr 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 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" }
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" }

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


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