; LLVM IR from manishbisht/Competitive-Programming :: Coding Blocks/Competitive Warriors Challenge 3.0 (Factorization Game)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@sieve = external dso_local global [1000002 x i32], align 16
@prime_fac = external dso_local global [1000002 x i32], align 16
@cnt = external dso_local global [1000002 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [141 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 2, ptr %2, align 4, !tbaa !8
  br label %15

15:                                               ; preds = %52, %0
  %16 = load i32, ptr %2, align 4, !tbaa !8
  %17 = icmp sle i32 %16, 1000000
  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) #8
  br label %55

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !8
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [1000002 x i32], ptr @sieve, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !8
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %51

25:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %26 = load i32, ptr %2, align 4, !tbaa !8
  store i32 %26, ptr %4, align 4, !tbaa !8
  br label %27

27:                                               ; preds = %46, %25
  %28 = load i32, ptr %4, align 4, !tbaa !8
  %29 = icmp sle i32 %28, 1000000
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %50

31:                                               ; preds = %27
  %32 = load i32, ptr %4, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1000002 x i32], ptr @sieve, i64 0, i64 %33
  store i32 1, ptr %34, align 4, !tbaa !8
  %35 = load i32, ptr %4, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1000002 x i32], ptr @prime_fac, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !8
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %45

40:                                               ; preds = %31
  %41 = load i32, ptr %2, align 4, !tbaa !8
  %42 = load i32, ptr %4, align 4, !tbaa !8
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1000002 x i32], ptr @prime_fac, i64 0, i64 %43
  store i32 %41, ptr %44, align 4, !tbaa !8
  br label %45

45:                                               ; preds = %40, %31
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %2, align 4, !tbaa !8
  %48 = load i32, ptr %4, align 4, !tbaa !8
  %49 = add nsw i32 %48, %47
  store i32 %49, ptr %4, align 4, !tbaa !8
  br label %27, !llvm.loop !11

50:                                               ; preds = %30
  br label %51

51:                                               ; preds = %50, %19
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %2, align 4, !tbaa !8
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %2, align 4, !tbaa !8
  br label %15, !llvm.loop !13

55:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %56 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %57 = load i32, ptr %5, align 4, !tbaa !8
  %58 = icmp sge i32 %57, 1
  br i1 %58, label %59, label %62

59:                                               ; preds = %55
  %60 = load i32, ptr %5, align 4, !tbaa !8
  %61 = icmp sle i32 %60, 20
  br label %62

62:                                               ; preds = %59, %55
  %63 = phi i1 [ false, %55 ], [ %61, %59 ]
  br i1 %63, label %64, label %65

64:                                               ; preds = %62
  br label %67

65:                                               ; preds = %62
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 19, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

66:                                               ; No predecessors!
  br label %67

67:                                               ; preds = %66, %64
  br label %68

68:                                               ; preds = %145, %67
  %69 = load i32, ptr %5, align 4, !tbaa !8
  %70 = add nsw i32 %69, -1
  store i32 %70, ptr %5, align 4, !tbaa !8
  %71 = icmp ne i32 %69, 0
  br i1 %71, label %72, label %146

72:                                               ; preds = %68
  %73 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %74 = load i32, ptr @n, align 4, !tbaa !8
  %75 = icmp sge i32 %74, 1
  br i1 %75, label %76, label %79

76:                                               ; preds = %72
  %77 = load i32, ptr @n, align 4, !tbaa !8
  %78 = icmp sle i32 %77, 10000
  br label %79

79:                                               ; preds = %76, %72
  %80 = phi i1 [ false, %72 ], [ %78, %76 ]
  br i1 %80, label %81, label %82

81:                                               ; preds = %79
  br label %84

82:                                               ; preds = %79
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 22, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

83:                                               ; No predecessors!
  br label %84

84:                                               ; preds = %83, %81
  call void @llvm.memset.p0.i64(ptr align 16 @cnt, i8 0, i64 4000008, i1 false)
  br label %85

85:                                               ; preds = %120, %84
  %86 = load i32, ptr @n, align 4, !tbaa !8
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr @n, align 4, !tbaa !8
  %88 = icmp ne i32 %86, 0
  br i1 %88, label %89, label %121

89:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %90 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %91 = load i32, ptr %6, align 4, !tbaa !8
  %92 = icmp sge i32 %91, 1
  br i1 %92, label %93, label %96

93:                                               ; preds = %89
  %94 = load i32, ptr %6, align 4, !tbaa !8
  %95 = icmp sle i32 %94, 1000000
  br label %96

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

98:                                               ; preds = %96
  br label %101

99:                                               ; preds = %96
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 27, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

100:                                              ; No predecessors!
  br label %101

101:                                              ; preds = %100, %98
  br label %102

102:                                              ; preds = %105, %101
  %103 = load i32, ptr %6, align 4, !tbaa !8
  %104 = icmp sgt i32 %103, 1
  br i1 %104, label %105, label %120

105:                                              ; preds = %102
  %106 = load i32, ptr %6, align 4, !tbaa !8
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1000002 x i32], ptr @prime_fac, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !8
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1000002 x i32], ptr @cnt, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !8
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %111, align 4, !tbaa !8
  %114 = load i32, ptr %6, align 4, !tbaa !8
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1000002 x i32], ptr @prime_fac, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !8
  %118 = load i32, ptr %6, align 4, !tbaa !8
  %119 = sdiv i32 %118, %117
  store i32 %119, ptr %6, align 4, !tbaa !8
  br label %102, !llvm.loop !14

120:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %85, !llvm.loop !15

121:                                              ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 1, ptr %8, align 4, !tbaa !8
  br label %122

122:                                              ; preds = %133, %121
  %123 = load i32, ptr %8, align 4, !tbaa !8
  %124 = icmp sle i32 %123, 1000000
  br i1 %124, label %126, label %125

125:                                              ; preds = %122
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %136

126:                                              ; preds = %122
  %127 = load i32, ptr %8, align 4, !tbaa !8
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1000002 x i32], ptr @cnt, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !8
  %131 = load i32, ptr %7, align 4, !tbaa !8
  %132 = xor i32 %131, %130
  store i32 %132, ptr %7, align 4, !tbaa !8
  br label %133

133:                                              ; preds = %126
  %134 = load i32, ptr %8, align 4, !tbaa !8
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %8, align 4, !tbaa !8
  br label %122, !llvm.loop !16

136:                                              ; preds = %125
  %137 = load i32, ptr %7, align 4, !tbaa !8
  %138 = icmp sgt i32 %137, 0
  br i1 %138, label %139, label %142

139:                                              ; preds = %136
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %140, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %145

142:                                              ; preds = %136
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.5)
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %143, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %145

145:                                              ; preds = %142, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %68, !llvm.loop !17

146:                                              ; preds = %68
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  %147 = load i32, ptr %1, align 4
  ret i32 %147
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { "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 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { noreturn 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { noreturn 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@sieve = external dso_local local_unnamed_addr global [1000002 x i32], align 16
@prime_fac = external dso_local local_unnamed_addr global [1000002 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [1000002 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [141 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %4 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %6
  %8 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef null)
  br label %14

9:                                                ; preds = %.loopexit
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %11 = load i32, ptr %1, align 4
  %12 = add i32 %11, -1
  %13 = icmp ult i32 %12, 20
  br i1 %13, label %.lr.ph36.preheader, label %26

.lr.ph36.preheader:                               ; preds = %9
  store i32 %12, ptr %1, align 4, !tbaa !8
  br label %.lr.ph36

14:                                               ; preds = %0, %.loopexit
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next, %.loopexit ]
  %15 = getelementptr inbounds [1000002 x i32], ptr @sieve, i64 0, i64 %indvars.iv
  %16 = load i32, ptr %15, align 4, !tbaa !8
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %14
  %18 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %24
  %indvars.iv39 = phi i64 [ %indvars.iv, %.lr.ph.preheader ], [ %indvars.iv.next40, %24 ]
  %19 = getelementptr inbounds [1000002 x i32], ptr @sieve, i64 0, i64 %indvars.iv39
  store i32 1, ptr %19, align 4, !tbaa !8
  %20 = getelementptr inbounds [1000002 x i32], ptr @prime_fac, i64 0, i64 %indvars.iv39
  %21 = load i32, ptr %20, align 4, !tbaa !8
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %.lr.ph
  store i32 %18, ptr %20, align 4, !tbaa !8
  br label %24

24:                                               ; preds = %.lr.ph, %23
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, %indvars.iv
  %25 = icmp ult i64 %indvars.iv.next40, 1000001
  br i1 %25, label %.lr.ph, label %.loopexit, !llvm.loop !11

.loopexit:                                        ; preds = %24, %14
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 1000001
  br i1 %exitcond.not, label %9, label %14, !llvm.loop !13

26:                                               ; preds = %9
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 19, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #10
  unreachable

.lr.ph36:                                         ; preds = %.lr.ph36.preheader, %middle.block
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %28 = load i32, ptr @n, align 4
  %29 = add i32 %28, -1
  %30 = icmp ult i32 %29, 10000
  br i1 %30, label %.lr.ph32.preheader, label %31

31:                                               ; preds = %.lr.ph36
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 22, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #10
  unreachable

.lr.ph32.preheader:                               ; preds = %.lr.ph36
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000008) @cnt, i8 0, i64 4000008, i1 false)
  store i32 %29, ptr @n, align 4, !tbaa !8
  br label %.lr.ph32

.lr.ph32:                                         ; preds = %.lr.ph32.preheader, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %33 = load i32, ptr %2, align 4
  %34 = add i32 %33, -1
  %35 = icmp ult i32 %34, 1000000
  br i1 %35, label %.preheader, label %37

.preheader:                                       ; preds = %.lr.ph32
  %36 = icmp ugt i32 %33, 1
  br i1 %36, label %.lr.ph29, label %._crit_edge

37:                                               ; preds = %.lr.ph32
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 27, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #10
  unreachable

.lr.ph29:                                         ; preds = %.preheader, %.lr.ph29
  %38 = phi i32 [ %46, %.lr.ph29 ], [ %33, %.preheader ]
  %39 = zext nneg i32 %38 to i64
  %40 = getelementptr inbounds [1000002 x i32], ptr @prime_fac, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !8
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1000002 x i32], ptr @cnt, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !8
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %43, align 4, !tbaa !8
  %46 = sdiv i32 %38, %41
  %47 = icmp sgt i32 %46, 1
  br i1 %47, label %.lr.ph29, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph29, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  %.pr22 = load i32, ptr @n, align 4, !tbaa !8
  %48 = add nsw i32 %.pr22, -1
  store i32 %48, ptr @n, align 4, !tbaa !8
  %.not21 = icmp eq i32 %.pr22, 0
  br i1 %.not21, label %vector.body, label %.lr.ph32, !llvm.loop !15

vector.body:                                      ; preds = %._crit_edge, %vector.body
  %index = phi i64 [ %index.next.3, %vector.body ], [ 0, %._crit_edge ]
  %vec.phi = phi <4 x i32> [ %63, %vector.body ], [ zeroinitializer, %._crit_edge ]
  %vec.phi47 = phi <4 x i32> [ %64, %vector.body ], [ zeroinitializer, %._crit_edge ]
  %offset.idx = or disjoint i64 %index, 1
  %49 = getelementptr inbounds [1000002 x i32], ptr @cnt, i64 0, i64 %offset.idx
  %50 = getelementptr inbounds i8, ptr %49, i64 16
  %wide.load = load <4 x i32>, ptr %49, align 4, !tbaa !8
  %wide.load48 = load <4 x i32>, ptr %50, align 4, !tbaa !8
  %51 = xor <4 x i32> %wide.load, %vec.phi
  %52 = xor <4 x i32> %wide.load48, %vec.phi47
  %offset.idx.1 = or disjoint i64 %index, 9
  %53 = getelementptr inbounds [1000002 x i32], ptr @cnt, i64 0, i64 %offset.idx.1
  %54 = getelementptr inbounds i8, ptr %53, i64 16
  %wide.load.1 = load <4 x i32>, ptr %53, align 4, !tbaa !8
  %wide.load48.1 = load <4 x i32>, ptr %54, align 4, !tbaa !8
  %55 = xor <4 x i32> %wide.load.1, %51
  %56 = xor <4 x i32> %wide.load48.1, %52
  %offset.idx.2 = or disjoint i64 %index, 17
  %57 = getelementptr inbounds [1000002 x i32], ptr @cnt, i64 0, i64 %offset.idx.2
  %58 = getelementptr inbounds i8, ptr %57, i64 16
  %wide.load.2 = load <4 x i32>, ptr %57, align 4, !tbaa !8
  %wide.load48.2 = load <4 x i32>, ptr %58, align 4, !tbaa !8
  %59 = xor <4 x i32> %wide.load.2, %55
  %60 = xor <4 x i32> %wide.load48.2, %56
  %offset.idx.3 = or disjoint i64 %index, 25
  %61 = getelementptr inbounds [1000002 x i32], ptr @cnt, i64 0, i64 %offset.idx.3
  %62 = getelementptr inbounds i8, ptr %61, i64 16
  %wide.load.3 = load <4 x i32>, ptr %61, align 4, !tbaa !8
  %wide.load48.3 = load <4 x i32>, ptr %62, align 4, !tbaa !8
  %63 = xor <4 x i32> %wide.load.3, %59
  %64 = xor <4 x i32> %wide.load48.3, %60
  %index.next.3 = add nuw nsw i64 %index, 32
  %65 = icmp eq i64 %index.next.3, 1000000
  br i1 %65, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %bin.rdx = xor <4 x i32> %64, %63
  %66 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> %bin.rdx)
  %67 = icmp sgt i32 %66, 0
  %.str.4..str.5 = select i1 %67, ptr @.str.4, ptr @.str.5
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.str.4..str.5)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %.pr = load i32, ptr %1, align 4, !tbaa !8
  %70 = add nsw i32 %.pr, -1
  store i32 %70, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %.pr, 0
  br i1 %.not, label %._crit_edge37, label %.lr.ph36, !llvm.loop !19

._crit_edge37:                                    ; preds = %middle.block
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #2 align 2

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.xor.v4i32(<4 x i32>) #8

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 = { "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 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { noreturn 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { noreturn 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !12}


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