; LLVM IR from tangjz/acm-icpc :: self_training/2015-02-09 (C)

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

%struct.BigInt = type { i32, [150 x i32] }

@Ans = external dso_local global %struct.BigInt, align 4
@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@prime = external dso_local global [200001 x i32], align 16
@vis = external dso_local global [200001 x i32], align 16
@ptot = external dso_local global i32, align 4
@pnum = external dso_local global [200001 x i32], 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

; 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 %struct.BigInt, 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
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %struct.BigInt, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %96, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 200001
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %35, label %25

25:                                               ; preds = %19
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %28
  store i32 %26, ptr %29, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = load i32, ptr @tot, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr @tot, align 4, !tbaa !5
  %33 = sext i32 %31 to i64
  %34 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %33
  store i32 %30, ptr %34, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %25, %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %36

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

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

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

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

51:                                               ; preds = %48
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = mul nsw i32 %56, %60
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %62
  store i32 %55, ptr %63, align 4, !tbaa !5
  %64 = load i32, ptr %2, align 4, !tbaa !5
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = srem i32 %64, %68
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %51
  store i32 5, ptr %3, align 4
  br label %94

72:                                               ; preds = %51
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = load i32, ptr %2, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = icmp eq i32 %73, %77
  br i1 %78, label %79, label %90

79:                                               ; preds = %72
  %80 = load i32, ptr %2, align 4, !tbaa !5
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = mul nsw i32 %80, %84
  %86 = load i32, ptr @ptot, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr @ptot, align 4, !tbaa !5
  %88 = sext i32 %86 to i64
  %89 = getelementptr inbounds [200001 x i32], ptr @pnum, i64 0, i64 %88
  store i32 %85, ptr %89, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %79, %72
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %4, align 4, !tbaa !5
  br label %36, !llvm.loop !9

94:                                               ; preds = %71, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %95

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %2, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !11

99:                                               ; preds = %18
  %100 = load i32, ptr @ptot, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i32, ptr @pnum, i64 %101
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @pnum, ptr noundef %102)
  br label %103

103:                                              ; preds = %200, %99
  %104 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @k)
  %105 = icmp eq i32 %104, 2
  br i1 %105, label %106, label %201

106:                                              ; preds = %103
  %107 = load i32, ptr @k, align 4, !tbaa !5
  %108 = icmp eq i32 %107, 1
  br i1 %108, label %109, label %111

109:                                              ; preds = %106
  %110 = call i32 @puts(ptr noundef @.str.1)
  br label %200

111:                                              ; preds = %106
  %112 = load i32, ptr @k, align 4, !tbaa !5
  %113 = load i32, ptr @k, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = icmp eq i32 %112, %116
  br i1 %117, label %118, label %137

118:                                              ; preds = %111
  %119 = load i32, ptr @n, align 4, !tbaa !5
  %120 = add nsw i32 %119, -1
  store i32 %120, ptr @n, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  call void @_ZN6BigInt4readEi(ptr noundef nonnull align 4 dereferenceable(604) @Ans, i32 noundef %123)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %133, %118
  %125 = load i32, ptr %5, align 4, !tbaa !5
  %126 = load i32, ptr @k, align 4, !tbaa !5
  %127 = icmp slt i32 %125, %126
  br i1 %127, label %129, label %128

128:                                              ; preds = %124
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %136

129:                                              ; preds = %124
  %130 = load i32, ptr @n, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %131
  call void @llvm.lifetime.start.p0(i64 604, ptr %6) #7
  call void @_ZN6BigIntmLERKi(ptr dead_on_unwind writable sret(%struct.BigInt) align 4 %6, ptr noundef nonnull align 4 dereferenceable(604) @Ans, ptr noundef nonnull align 4 dereferenceable(4) %132)
  call void @llvm.lifetime.end.p0(i64 604, ptr %6) #7
  br label %133

133:                                              ; preds = %129
  %134 = load i32, ptr %5, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %5, align 4, !tbaa !5
  br label %124, !llvm.loop !12

136:                                              ; preds = %128
  call void @_ZN6BigInt5writeEv(ptr noundef nonnull align 4 dereferenceable(604) @Ans)
  br label %199

137:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %138 = load i32, ptr @k, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  store i32 %141, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %184, %137
  %143 = load i32, ptr %12, align 4, !tbaa !5
  %144 = load i32, ptr @n, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %187

147:                                              ; preds = %142
  %148 = load i32, ptr @k, align 4, !tbaa !5
  %149 = sub nsw i32 %148, 1
  %150 = sitofp i32 %149 to double
  %151 = load i32, ptr %10, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = call noundef double @_ZSt3logIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %154)
  %156 = fmul double %150, %155
  %157 = load i32, ptr %7, align 4, !tbaa !5
  %158 = sub nsw i32 %157, 1
  %159 = sitofp i32 %158 to double
  %160 = load i32, ptr %11, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [200001 x i32], ptr @pnum, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = call noundef double @_ZSt3logIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %163)
  %165 = fmul double %159, %164
  %166 = fcmp olt double %156, %165
  br i1 %166, label %167, label %175

167:                                              ; preds = %147
  %168 = load i32, ptr @k, align 4, !tbaa !5
  %169 = sub nsw i32 %168, 1
  store i32 %169, ptr %9, align 4, !tbaa !5
  %170 = load i32, ptr %10, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %10, align 4, !tbaa !5
  %172 = sext i32 %170 to i64
  %173 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  store i32 %174, ptr %8, align 4, !tbaa !5
  br label %183

175:                                              ; preds = %147
  %176 = load i32, ptr %7, align 4, !tbaa !5
  %177 = sub nsw i32 %176, 1
  store i32 %177, ptr %9, align 4, !tbaa !5
  %178 = load i32, ptr %11, align 4, !tbaa !5
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %11, align 4, !tbaa !5
  %180 = sext i32 %178 to i64
  %181 = getelementptr inbounds [200001 x i32], ptr @pnum, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !5
  store i32 %182, ptr %8, align 4, !tbaa !5
  br label %183

183:                                              ; preds = %175, %167
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %12, align 4, !tbaa !5
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %12, align 4, !tbaa !5
  br label %142, !llvm.loop !13

187:                                              ; preds = %146
  %188 = load i32, ptr %8, align 4, !tbaa !5
  call void @_ZN6BigInt4readEi(ptr noundef nonnull align 4 dereferenceable(604) @Ans, i32 noundef %188)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %195, %187
  %190 = load i32, ptr %13, align 4, !tbaa !5
  %191 = load i32, ptr %9, align 4, !tbaa !5
  %192 = icmp slt i32 %190, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %189
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %198

194:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 604, ptr %14) #7
  call void @_ZN6BigIntmLERKi(ptr dead_on_unwind writable sret(%struct.BigInt) align 4 %14, ptr noundef nonnull align 4 dereferenceable(604) @Ans, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 604, ptr %14) #7
  br label %195

195:                                              ; preds = %194
  %196 = load i32, ptr %13, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %13, align 4, !tbaa !5
  br label %189, !llvm.loop !14

198:                                              ; preds = %193
  call void @_ZN6BigInt5writeEv(ptr noundef nonnull align 4 dereferenceable(604) @Ans)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %199

199:                                              ; preds = %198, %136
  br label %200

200:                                              ; preds = %199, %109
  br label %103, !llvm.loop !15

201:                                              ; preds = %103
  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

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

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

declare i32 @puts(ptr noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6BigIntmLERKi(ptr dead_on_unwind noalias writable sret(%struct.BigInt) align 4, ptr noundef nonnull align 4 dereferenceable(604), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6BigInt5writeEv(ptr noundef nonnull align 4 dereferenceable(604)) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3logIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) #6

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 = { 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 #3 = { "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 = { 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 = { 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 = { 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 #7 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!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"

%struct.BigInt = type { i32, [150 x i32] }

@Ans = external dso_local global %struct.BigInt, align 4
@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local global [200001 x i32], align 16
@vis = external dso_local local_unnamed_addr global [200001 x i32], align 16
@ptot = external dso_local local_unnamed_addr global i32, align 4
@pnum = external dso_local global [200001 x i32], 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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.BigInt, align 4
  %2 = alloca i32, align 4
  %3 = alloca %struct.BigInt, align 4
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  %ptot.promoted47 = load i32, ptr @ptot, align 4, !tbaa !5
  br label %9

4:                                                ; preds = %.critedge
  %5 = sext i32 %44 to i64
  %6 = getelementptr inbounds i32, ptr @pnum, i64 %5
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @pnum, ptr noundef nonnull %6)
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %8 = icmp eq i32 %7, 2
  br i1 %8, label %.lr.ph70, label %._crit_edge71

9:                                                ; preds = %0, %.critedge
  %indvars.iv73 = phi i64 [ 2, %0 ], [ %indvars.iv.next74, %.critedge ]
  %10 = phi i32 [ %tot.promoted, %0 ], [ %19, %.critedge ]
  %ptot.promoted5154 = phi i32 [ %ptot.promoted47, %0 ], [ %44, %.critedge ]
  %11 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %indvars.iv73
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %13, label %18

13:                                               ; preds = %9
  %14 = trunc nuw nsw i64 %indvars.iv73 to i32
  store i32 %14, ptr %11, align 4, !tbaa !5
  %15 = add nsw i32 %10, 1
  store i32 %15, ptr @tot, align 4, !tbaa !5
  %16 = sext i32 %10 to i64
  %17 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %16
  store i32 %14, ptr %17, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %13, %9
  %19 = phi i32 [ %15, %13 ], [ %10, %9 ]
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %18
  %21 = trunc nuw nsw i64 %indvars.iv73 to i32
  %22 = udiv i32 200001, %21
  %wide.trip.count = zext nneg i32 %19 to i64
  br label %23

23:                                               ; preds = %.lr.ph, %42
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %42 ]
  %ptot.promoted50 = phi i32 [ %ptot.promoted5154, %.lr.ph ], [ %ptot.promoted49, %42 ]
  %24 = phi i32 [ %ptot.promoted5154, %.lr.ph ], [ %43, %42 ]
  %25 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %indvars.iv
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp slt i32 %26, %22
  br i1 %27, label %28, label %.critedge

28:                                               ; preds = %23
  %29 = mul nsw i32 %26, %21
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %30
  store i32 %26, ptr %31, align 4, !tbaa !5
  %32 = srem i32 %21, %26
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %.critedge, label %34

34:                                               ; preds = %28
  %35 = load i32, ptr %11, align 4, !tbaa !5
  %36 = zext i32 %35 to i64
  %37 = icmp eq i64 %indvars.iv73, %36
  br i1 %37, label %38, label %42

38:                                               ; preds = %34
  %39 = add nsw i32 %24, 1
  store i32 %39, ptr @ptot, align 4, !tbaa !5
  %40 = sext i32 %24 to i64
  %41 = getelementptr inbounds [200001 x i32], ptr @pnum, i64 0, i64 %40
  store i32 %29, ptr %41, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %34, %38
  %ptot.promoted49 = phi i32 [ %ptot.promoted50, %34 ], [ %39, %38 ]
  %43 = phi i32 [ %24, %34 ], [ %39, %38 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %23, !llvm.loop !9

.critedge:                                        ; preds = %42, %23, %28, %18
  %44 = phi i32 [ %ptot.promoted5154, %18 ], [ %ptot.promoted50, %28 ], [ %ptot.promoted50, %23 ], [ %ptot.promoted49, %42 ]
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next74, 200001
  br i1 %exitcond76.not, label %4, label %9, !llvm.loop !11

.lr.ph70:                                         ; preds = %4, %99
  %.03668 = phi i32 [ %.3, %99 ], [ undef, %4 ]
  %45 = load i32, ptr @k, align 4, !tbaa !5
  %46 = icmp eq i32 %45, 1
  br i1 %46, label %47, label %49

47:                                               ; preds = %.lr.ph70
  %48 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %99

49:                                               ; preds = %.lr.ph70
  %50 = sext i32 %45 to i64
  %51 = getelementptr inbounds [200001 x i32], ptr @vis, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp eq i32 %45, %52
  br i1 %53, label %54, label %.lr.ph59

54:                                               ; preds = %49
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = add nsw i32 %55, -1
  store i32 %56, ptr @n, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  call void @_ZN6BigInt4readEi(ptr noundef nonnull align 4 dereferenceable(604) @Ans, i32 noundef %59)
  %60 = load i32, ptr @k, align 4, !tbaa !5
  %61 = icmp sgt i32 %60, 2
  br i1 %61, label %.lr.ph66, label %._crit_edge67

._crit_edge67:                                    ; preds = %.lr.ph66, %54
  call void @_ZN6BigInt5writeEv(ptr noundef nonnull align 4 dereferenceable(604) @Ans)
  br label %99

.lr.ph66:                                         ; preds = %54, %.lr.ph66
  %.03964 = phi i32 [ %65, %.lr.ph66 ], [ 2, %54 ]
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %63
  call void @llvm.lifetime.start.p0(i64 604, ptr nonnull %1) #8
  call void @_ZN6BigIntmLERKi(ptr dead_on_unwind nonnull writable sret(%struct.BigInt) align 4 %1, ptr noundef nonnull align 4 dereferenceable(604) @Ans, ptr noundef nonnull align 4 dereferenceable(4) %64)
  call void @llvm.lifetime.end.p0(i64 604, ptr nonnull %1) #8
  %65 = add nuw nsw i32 %.03964, 1
  %66 = load i32, ptr @k, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %.lr.ph66, label %._crit_edge67, !llvm.loop !12

.lr.ph59:                                         ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = icmp sgt i32 %68, 0
  call void @llvm.assume(i1 %69)
  %70 = add nsw i32 %52, -1
  %71 = sitofp i32 %70 to double
  br label %73

._crit_edge:                                      ; preds = %94
  call void @_ZN6BigInt4readEi(ptr noundef nonnull align 4 dereferenceable(604) @Ans, i32 noundef %storemerge)
  %72 = icmp sgt i32 %.2, 1
  br i1 %72, label %.lr.ph62, label %._crit_edge63

73:                                               ; preds = %.lr.ph59, %94
  %.03258 = phi i32 [ 0, %.lr.ph59 ], [ %95, %94 ]
  %.03357 = phi i32 [ 0, %.lr.ph59 ], [ %.1, %94 ]
  %.03456 = phi i32 [ 0, %.lr.ph59 ], [ %.135, %94 ]
  %74 = load i32, ptr @k, align 4, !tbaa !5
  %75 = add nsw i32 %74, -1
  %76 = sitofp i32 %75 to double
  %77 = sext i32 %.03456 to i64
  %78 = getelementptr inbounds [200001 x i32], ptr @prime, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = call noundef double @_ZSt3logIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %79)
  %81 = fmul double %80, %76
  %82 = sext i32 %.03357 to i64
  %83 = getelementptr inbounds [200001 x i32], ptr @pnum, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = call noundef double @_ZSt3logIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %84)
  %86 = fmul double %85, %71
  %87 = fcmp olt double %81, %86
  br i1 %87, label %88, label %92

88:                                               ; preds = %73
  %89 = load i32, ptr @k, align 4, !tbaa !5
  %90 = add nsw i32 %89, -1
  %91 = add nsw i32 %.03456, 1
  br label %94

92:                                               ; preds = %73
  %93 = add nsw i32 %.03357, 1
  br label %94

94:                                               ; preds = %88, %92
  %storemerge.in = phi ptr [ %83, %92 ], [ %78, %88 ]
  %.2 = phi i32 [ %70, %92 ], [ %90, %88 ]
  %.135 = phi i32 [ %.03456, %92 ], [ %91, %88 ]
  %.1 = phi i32 [ %93, %92 ], [ %.03357, %88 ]
  %storemerge = load i32, ptr %storemerge.in, align 4, !tbaa !5
  store i32 %storemerge, ptr %2, align 4, !tbaa !5
  %95 = add nuw nsw i32 %.03258, 1
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %73, label %._crit_edge, !llvm.loop !13

._crit_edge63:                                    ; preds = %.lr.ph62, %._crit_edge
  call void @_ZN6BigInt5writeEv(ptr noundef nonnull align 4 dereferenceable(604) @Ans)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  br label %99

.lr.ph62:                                         ; preds = %._crit_edge, %.lr.ph62
  %.060 = phi i32 [ %98, %.lr.ph62 ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 604, ptr nonnull %3) #8
  call void @_ZN6BigIntmLERKi(ptr dead_on_unwind nonnull writable sret(%struct.BigInt) align 4 %3, ptr noundef nonnull align 4 dereferenceable(604) @Ans, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 604, ptr nonnull %3) #8
  %98 = add nuw nsw i32 %.060, 1
  %exitcond77.not = icmp eq i32 %98, %.2
  br i1 %exitcond77.not, label %._crit_edge63, label %.lr.ph62, !llvm.loop !14

99:                                               ; preds = %._crit_edge67, %._crit_edge63, %47
  %.3 = phi i32 [ %.03668, %47 ], [ %.03668, %._crit_edge67 ], [ %.2, %._crit_edge63 ]
  %100 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %101 = icmp eq i32 %100, 2
  br i1 %101, label %.lr.ph70, label %._crit_edge71, !llvm.loop !15

._crit_edge71:                                    ; preds = %99, %4
  ret i32 0
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6BigIntmLERKi(ptr dead_on_unwind noalias writable sret(%struct.BigInt) align 4, ptr noundef nonnull align 4 dereferenceable(604), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6BigInt5writeEv(ptr noundef nonnull align 4 dereferenceable(604)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3logIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) local_unnamed_addr #6

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #7

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 = { 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 = { 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 #7 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #8 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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