; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/326 Division 2/Problem B (B)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i64, align 8
@prime = external dso_local global [1001000 x i32], align 16
@p = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca i64, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store i32 0, ptr %1, align 4
  %14 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = load ptr, ptr @_ZSt4cerr, align 8, !tbaa !5
  %21 = getelementptr i8, ptr %20, i64 -24
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %22
  %24 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %23, ptr noundef null)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 2, ptr %2, align 4, !tbaa !8
  br label %26

26:                                               ; preds = %34, %0
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = icmp slt i32 %27, 1001000
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %37

30:                                               ; preds = %26
  %31 = load i32, ptr %2, align 4, !tbaa !8
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %32
  store i32 1, ptr %33, align 4, !tbaa !8
  br label %34

34:                                               ; preds = %30
  %35 = load i32, ptr %2, align 4, !tbaa !8
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %2, align 4, !tbaa !8
  br label %26, !llvm.loop !11

37:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 4, ptr %3, align 4, !tbaa !8
  br label %38

38:                                               ; preds = %46, %37
  %39 = load i32, ptr %3, align 4, !tbaa !8
  %40 = icmp slt i32 %39, 1001000
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %49

42:                                               ; preds = %38
  %43 = load i32, ptr %3, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %44
  store i32 0, ptr %45, align 4, !tbaa !8
  br label %46

46:                                               ; preds = %42
  %47 = load i32, ptr %3, align 4, !tbaa !8
  %48 = add nsw i32 %47, 2
  store i32 %48, ptr %3, align 4, !tbaa !8
  br label %38, !llvm.loop !13

49:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 3, ptr %4, align 4, !tbaa !8
  br label %50

50:                                               ; preds = %78, %49
  %51 = load i32, ptr %4, align 4, !tbaa !8
  %52 = icmp slt i32 %51, 1001000
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %50
  %55 = load i32, ptr %4, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !8
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %77

60:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %61 = load i32, ptr %4, align 4, !tbaa !8
  %62 = load i32, ptr %4, align 4, !tbaa !8
  %63 = add nsw i32 %61, %62
  store i32 %63, ptr %6, align 4, !tbaa !8
  br label %64

64:                                               ; preds = %72, %60
  %65 = load i32, ptr %6, align 4, !tbaa !8
  %66 = icmp slt i32 %65, 1001000
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %64
  %69 = load i32, ptr %6, align 4, !tbaa !8
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %70
  store i32 0, ptr %71, align 4, !tbaa !8
  br label %72

72:                                               ; preds = %68
  %73 = load i32, ptr %4, align 4, !tbaa !8
  %74 = load i32, ptr %6, align 4, !tbaa !8
  %75 = add nsw i32 %74, %73
  store i32 %75, ptr %6, align 4, !tbaa !8
  br label %64, !llvm.loop !14

76:                                               ; preds = %67
  br label %77

77:                                               ; preds = %76, %54
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %4, align 4, !tbaa !8
  %80 = add nsw i32 %79, 2
  store i32 %80, ptr %4, align 4, !tbaa !8
  br label %50, !llvm.loop !15

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

82:                                               ; preds = %96, %81
  %83 = load i32, ptr %7, align 4, !tbaa !8
  %84 = icmp slt i32 %83, 1001000
  br i1 %84, label %86, label %85

85:                                               ; preds = %82
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %99

86:                                               ; preds = %82
  %87 = load i32, ptr %7, align 4, !tbaa !8
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !8
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %95

92:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %93 = load i32, ptr %7, align 4, !tbaa !8
  %94 = sext i32 %93 to i64
  store i64 %94, ptr %8, align 8, !tbaa !16
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) @p, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %95

95:                                               ; preds = %92, %86
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %7, align 4, !tbaa !8
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %7, align 4, !tbaa !8
  br label %82, !llvm.loop !18

99:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 1, ptr %9, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %100 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #7
  %101 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %100, ptr %101, align 8
  br label %102

102:                                              ; preds = %137, %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %103 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #7
  %104 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %103, ptr %104, align 8
  %105 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 17, ptr %5, align 4
  br label %140

107:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %109 = load i64, ptr %108, align 8, !tbaa !16
  store i64 %109, ptr %12, align 8, !tbaa !16
  %110 = load i64, ptr %12, align 8, !tbaa !16
  %111 = load i64, ptr @n, align 8, !tbaa !16
  %112 = icmp sgt i64 %110, %111
  br i1 %112, label %113, label %114

113:                                              ; preds = %107
  store i32 17, ptr %5, align 4
  br label %134

114:                                              ; preds = %107
  %115 = load i64, ptr @n, align 8, !tbaa !16
  %116 = load i64, ptr %12, align 8, !tbaa !16
  %117 = srem i64 %115, %116
  %118 = icmp eq i64 %117, 0
  br i1 %118, label %119, label %133

119:                                              ; preds = %114
  %120 = load i64, ptr %12, align 8, !tbaa !16
  %121 = load i64, ptr %9, align 8, !tbaa !16
  %122 = mul nsw i64 %121, %120
  store i64 %122, ptr %9, align 8, !tbaa !16
  br label %123

123:                                              ; preds = %128, %119
  %124 = load i64, ptr @n, align 8, !tbaa !16
  %125 = load i64, ptr %12, align 8, !tbaa !16
  %126 = srem i64 %124, %125
  %127 = icmp eq i64 %126, 0
  br i1 %127, label %128, label %132

128:                                              ; preds = %123
  %129 = load i64, ptr %12, align 8, !tbaa !16
  %130 = load i64, ptr @n, align 8, !tbaa !16
  %131 = sdiv i64 %130, %129
  store i64 %131, ptr @n, align 8, !tbaa !16
  br label %123, !llvm.loop !19

132:                                              ; preds = %123
  br label %133

133:                                              ; preds = %132, %114
  store i32 0, ptr %5, align 4
  br label %134

134:                                              ; preds = %133, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %135 = load i32, ptr %5, align 4
  switch i32 %135, label %140 [
    i32 0, label %136
  ]

136:                                              ; preds = %134
  br label %137

137:                                              ; preds = %136
  %138 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %10, i32 noundef 0) #7
  %139 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %138, ptr %139, align 8
  br label %102, !llvm.loop !20

140:                                              ; preds = %134, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %141

141:                                              ; preds = %140
  %142 = load i64, ptr @n, align 8, !tbaa !16
  %143 = icmp sgt i64 %142, 1
  br i1 %143, label %144, label %148

144:                                              ; preds = %141
  %145 = load i64, ptr @n, align 8, !tbaa !16
  %146 = load i64, ptr %9, align 8, !tbaa !16
  %147 = mul nsw i64 %146, %145
  store i64 %147, ptr %9, align 8, !tbaa !16
  br label %148

148:                                              ; preds = %144, %141
  %149 = load i64, ptr %9, align 8, !tbaa !16
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %149)
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %150, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %152 = load i32, ptr %1, align 4
  ret i32 %152
}

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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 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 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = { 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 = !{!17, !17, i64 0}
!17 = !{!"long long", !10, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i64, align 8
@prime = external dso_local local_unnamed_addr global [1001000 x i32], align 16
@p = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
vector.ph:
  %0 = alloca i64, align 8
  %1 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %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)
  %9 = load ptr, ptr @_ZSt4cerr, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.3, %vector.body ]
  %offset.idx = or disjoint i64 %index, 2
  %15 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %offset.idx
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %15, align 8, !tbaa !8
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %16, align 8, !tbaa !8
  %offset.idx.1 = or disjoint i64 %index, 10
  %17 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %offset.idx.1
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %17, align 8, !tbaa !8
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %18, align 8, !tbaa !8
  %offset.idx.2 = or disjoint i64 %index, 18
  %19 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %offset.idx.2
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %19, align 8, !tbaa !8
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %20, align 8, !tbaa !8
  %offset.idx.3 = or disjoint i64 %index, 26
  %21 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %offset.idx.3
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %21, align 8, !tbaa !8
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %22, align 8, !tbaa !8
  %index.next.3 = add nuw nsw i64 %index, 32
  %23 = icmp eq i64 %index.next.3, 1000992
  br i1 %23, label %scalar.ph, label %vector.body, !llvm.loop !11

scalar.ph:                                        ; preds = %vector.body
  store i32 1, ptr getelementptr inbounds (i8, ptr @prime, i64 4003976), align 8, !tbaa !8
  store i32 1, ptr getelementptr inbounds (i8, ptr @prime, i64 4003980), align 4, !tbaa !8
  store i32 1, ptr getelementptr inbounds (i8, ptr @prime, i64 4003984), align 16, !tbaa !8
  store i32 1, ptr getelementptr inbounds (i8, ptr @prime, i64 4003988), align 4, !tbaa !8
  store i32 1, ptr getelementptr inbounds (i8, ptr @prime, i64 4003992), align 8, !tbaa !8
  store i32 1, ptr getelementptr inbounds (i8, ptr @prime, i64 4003996), align 4, !tbaa !8
  br label %.preheader45

.preheader45:                                     ; preds = %.preheader45, %scalar.ph
  %indvars.iv60 = phi i64 [ 4, %scalar.ph ], [ %indvars.iv.next61.1, %.preheader45 ]
  %24 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %indvars.iv60
  store i32 0, ptr %24, align 16, !tbaa !8
  %indvars.iv.next61 = or disjoint i64 %indvars.iv60, 2
  %25 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %indvars.iv.next61
  store i32 0, ptr %25, align 8, !tbaa !8
  %indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60, 4
  %26 = icmp ult i64 %indvars.iv.next61, 1000998
  br i1 %26, label %.preheader45, label %.preheader44, !llvm.loop !15

.preheader44:                                     ; preds = %.preheader45, %.loopexit
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %.loopexit ], [ 3, %.preheader45 ]
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %.loopexit ], [ 6, %.preheader45 ]
  %27 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %indvars.iv65
  %28 = load i32, ptr %27, align 4, !tbaa !8
  %.not39 = icmp ne i32 %28, 0
  %29 = icmp ult i64 %indvars.iv65, 500500
  %or.cond = and i1 %.not39, %29
  br i1 %or.cond, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader44, %.lr.ph
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph ], [ %indvars.iv63, %.preheader44 ]
  %30 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %indvars.iv67
  store i32 0, ptr %30, align 4, !tbaa !8
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, %indvars.iv65
  %31 = icmp ult i64 %indvars.iv.next68, 1001000
  br i1 %31, label %.lr.ph, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %.lr.ph, %.preheader44
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 2
  %32 = icmp ult i64 %indvars.iv65, 1000998
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 4
  br i1 %32, label %.preheader44, label %.preheader, !llvm.loop !17

33:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %34 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #8
  store ptr %34, ptr %1, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %35 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #8
  store ptr %35, ptr %2, align 8
  %36 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  br i1 %36, label %.lr.ph55, label %.thread

.preheader:                                       ; preds = %.loopexit, %40
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %40 ], [ 0, %.loopexit ]
  %37 = getelementptr inbounds [1001000 x i32], ptr @prime, i64 0, i64 %indvars.iv71
  %38 = load i32, ptr %37, align 4, !tbaa !8
  %.not38 = icmp eq i32 %38, 0
  br i1 %.not38, label %40, label %39

39:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %0) #8
  store i64 %indvars.iv71, ptr %0, align 8, !tbaa !18
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) @p, ptr noundef nonnull align 8 dereferenceable(8) %0)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %0) #8
  br label %40

40:                                               ; preds = %.preheader, %39
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond74.not = icmp eq i64 %indvars.iv.next72, 1001000
  br i1 %exitcond74.not, label %33, label %.preheader, !llvm.loop !20

.lr.ph55:                                         ; preds = %33, %.thread41
  %.02953 = phi i64 [ %.243, %.thread41 ], [ 1, %33 ]
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #8
  %42 = load i64, ptr %41, align 8, !tbaa !18
  %43 = load i64, ptr @n, align 8, !tbaa !18
  %.not = icmp sgt i64 %42, %43
  br i1 %.not, label %.thread, label %44

44:                                               ; preds = %.lr.ph55
  %45 = srem i64 %43, %42
  %46 = icmp eq i64 %45, 0
  br i1 %46, label %.lr.ph52.preheader, label %.thread41

.lr.ph52.preheader:                               ; preds = %44
  %47 = mul nsw i64 %42, %.02953
  br label %.lr.ph52

.lr.ph52:                                         ; preds = %.lr.ph52.preheader, %.lr.ph52
  %48 = phi i64 [ %49, %.lr.ph52 ], [ %43, %.lr.ph52.preheader ]
  %49 = sdiv i64 %48, %42
  %50 = srem i64 %49, %42
  %51 = icmp eq i64 %50, 0
  br i1 %51, label %.lr.ph52, label %._crit_edge, !llvm.loop !21

._crit_edge:                                      ; preds = %.lr.ph52
  store i64 %49, ptr @n, align 8, !tbaa !18
  br label %.thread41

.thread41:                                        ; preds = %._crit_edge, %44
  %.243 = phi i64 [ %.02953, %44 ], [ %47, %._crit_edge ]
  %52 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 0) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %53 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #8
  store ptr %53, ptr %2, align 8
  %54 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  br i1 %54, label %.lr.ph55, label %.thread, !llvm.loop !22

.thread:                                          ; preds = %.thread41, %.lr.ph55, %33
  %.3 = phi i64 [ 1, %33 ], [ %.02953, %.lr.ph55 ], [ %.243, %.thread41 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  %55 = load i64, ptr @n, align 8, !tbaa !18
  %56 = call i64 @llvm.smax.i64(i64 %55, i64 1)
  %spec.select = mul nsw i64 %56, %.3
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %spec.select)
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  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 uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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

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

; 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 #3 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 i64 @llvm.smax.i64(i64, i64) #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 = { "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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{!19, !19, i64 0}
!19 = !{!"long long", !10, i64 0}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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