; LLVM IR from ShahjalalShohag/code-library :: Number Theory/Min_25 Sieve.ll (Z5sievei)

; 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.modint = type { i32 }
%"class.std::vector" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::allocator.0" = type { i8 }
%"struct.std::_Bit_reference" = type { ptr, i64 }

@primes = external dso_local global [200009 x i32], align 16
@p = external dso_local global i32, align 4
@deg = external dso_local global i32, align 4
@pref = external dso_local global [3 x [200009 x %struct.modint]], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5sievei(i32 noundef %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca i8, align 1
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::_Bit_reference", align 8
  %11 = alloca %struct.modint, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.modint, align 4
  %14 = alloca %struct.modint, align 4
  %15 = alloca %struct.modint, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::_Bit_reference", align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %3) #6
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  %20 = sext i32 %19 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #6
  store i8 0, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  call void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %20, ptr noundef nonnull align 1 dereferenceable(1) %4, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %21 unwind label %27

21:                                               ; preds = %1
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #6
  store i32 0, ptr @p, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 2, ptr %8, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %151, %21
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %31, label %26

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

27:                                               ; preds = %1
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %6, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #6
  br label %156

31:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %32 = load i32, ptr %8, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %33)
          to label %35 unwind label %54

35:                                               ; preds = %31
  %36 = getelementptr inbounds { ptr, i64 }, ptr %10, i32 0, i32 0
  %37 = extractvalue { ptr, i64 } %34, 0
  store ptr %37, ptr %36, align 8
  %38 = getelementptr inbounds { ptr, i64 }, ptr %10, i32 0, i32 1
  %39 = extractvalue { ptr, i64 } %34, 1
  store i64 %39, ptr %38, align 8
  %40 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  %41 = xor i1 %40, true
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  br i1 %41, label %42, label %101

42:                                               ; preds = %35
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = load i32, ptr @p, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr @p, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [200009 x i32], ptr @primes, i64 0, i64 %46
  store i32 %43, ptr %47, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  invoke void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %11, i32 noundef 1)
          to label %48 unwind label %58

48:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %87, %48
  %50 = load i32, ptr %12, align 4, !tbaa !5
  %51 = load i32, ptr @deg, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %62, label %53

53:                                               ; preds = %49
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %99

54:                                               ; preds = %31
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %6, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  br label %154

58:                                               ; preds = %42
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %6, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %7, align 4
  br label %100

62:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %63 = load i32, ptr %12, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [3 x [200009 x %struct.modint]], ptr @pref, i64 0, i64 %64
  %66 = load i32, ptr @p, align 4, !tbaa !5
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [200009 x %struct.modint], ptr %65, i64 0, i64 %68
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %11, i64 4, i1 false), !tbaa.struct !11
  %70 = getelementptr inbounds %struct.modint, ptr %14, i32 0, i32 0
  %71 = load i32, ptr %70, align 4
  %72 = invoke i32 @_ZNK6modintILi1000000007EEplES0_(ptr noundef nonnull align 4 dereferenceable(4) %69, i32 %71)
          to label %73 unwind label %90

73:                                               ; preds = %62
  %74 = getelementptr inbounds %struct.modint, ptr %13, i32 0, i32 0
  store i32 %72, ptr %74, align 4
  %75 = load i32, ptr %12, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [3 x [200009 x %struct.modint]], ptr @pref, i64 0, i64 %76
  %78 = load i32, ptr @p, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [200009 x %struct.modint], ptr %77, i64 0, i64 %79
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %80, ptr align 4 %13, i64 4, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %81 = load i32, ptr %8, align 4, !tbaa !5
  invoke void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %15, i32 noundef %81)
          to label %82 unwind label %94

82:                                               ; preds = %73
  %83 = getelementptr inbounds %struct.modint, ptr %15, i32 0, i32 0
  %84 = load i32, ptr %83, align 4
  %85 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEmLES0_(ptr noundef nonnull align 4 dereferenceable(4) %11, i32 %84)
          to label %86 unwind label %94

86:                                               ; preds = %82
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %12, align 4, !tbaa !5
  br label %49, !llvm.loop !12

90:                                               ; preds = %62
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %6, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %98

94:                                               ; preds = %82, %73
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %6, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %7, align 4
  br label %98

98:                                               ; preds = %94, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %100

99:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %101

100:                                              ; preds = %98, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %154

101:                                              ; preds = %99, %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %146, %101
  %103 = load i32, ptr %16, align 4, !tbaa !5
  %104 = load i32, ptr @p, align 4, !tbaa !5
  %105 = icmp sle i32 %103, %104
  br i1 %105, label %106, label %115

106:                                              ; preds = %102
  %107 = load i32, ptr %16, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [200009 x i32], ptr @primes, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = mul nsw i32 %110, %111
  %113 = load i32, ptr %2, align 4, !tbaa !5
  %114 = icmp sle i32 %112, %113
  br label %115

115:                                              ; preds = %106, %102
  %116 = phi i1 [ false, %102 ], [ %114, %106 ]
  br i1 %116, label %118, label %117

117:                                              ; preds = %115
  store i32 8, ptr %9, align 4
  br label %149

118:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #6
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = load i32, ptr %16, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200009 x i32], ptr @primes, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = mul nsw i32 %119, %123
  %125 = sext i32 %124 to i64
  %126 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %125)
          to label %127 unwind label %141

127:                                              ; preds = %118
  %128 = getelementptr inbounds { ptr, i64 }, ptr %17, i32 0, i32 0
  %129 = extractvalue { ptr, i64 } %126, 0
  store ptr %129, ptr %128, align 8
  %130 = getelementptr inbounds { ptr, i64 }, ptr %17, i32 0, i32 1
  %131 = extractvalue { ptr, i64 } %126, 1
  store i64 %131, ptr %130, align 8
  %132 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %17, i1 noundef zeroext true) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #6
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = load i32, ptr %16, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [200009 x i32], ptr @primes, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = srem i32 %133, %137
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %140, label %145

140:                                              ; preds = %127
  store i32 8, ptr %9, align 4
  br label %149

141:                                              ; preds = %118
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %6, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %154

145:                                              ; preds = %127
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %16, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %16, align 4, !tbaa !5
  br label %102, !llvm.loop !14

149:                                              ; preds = %140, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %150

150:                                              ; preds = %149
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %8, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %8, align 4, !tbaa !5
  br label %22, !llvm.loop !15

154:                                              ; preds = %141, %100, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #6
  br label %156

155:                                              ; preds = %26
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %3) #6
  ret void

156:                                              ; preds = %154, %27
  call void @llvm.lifetime.end.p0(i64 40, ptr %3) #6
  br label %157

157:                                              ; preds = %156
  %158 = load ptr, ptr %6, align 8
  %159 = load i32, ptr %7, align 4
  %160 = insertvalue { ptr, i32 } poison, ptr %158, 0
  %161 = insertvalue { ptr, i32 } %160, i32 %159, 1
  resume { ptr, i32 } %161
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6modintILi1000000007EEplES0_(ptr noundef nonnull align 4 dereferenceable(4), i32) #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEmLES0_(ptr noundef nonnull align 4 dereferenceable(4), i32) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #2 align 2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nocallback nofree 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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i64 0, i64 4, !5}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


; 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.modint = type { i32 }
%"class.std::vector" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::allocator.0" = type { i8 }
%"struct.std::_Bit_reference" = type { ptr, i64 }

@primes = external dso_local local_unnamed_addr global [200009 x i32], align 16
@p = external dso_local local_unnamed_addr global i32, align 4
@deg = external dso_local local_unnamed_addr global i32, align 4
@pref = external dso_local global [3 x [200009 x %struct.modint]], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5sievei(i32 noundef %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca i8, align 1
  %4 = alloca %"class.std::allocator.0", align 1
  %5 = alloca %"struct.std::_Bit_reference", align 8
  %6 = alloca %struct.modint, align 4
  %7 = alloca %struct.modint, align 4
  %8 = alloca %"struct.std::_Bit_reference", align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %2) #5
  %9 = add i32 %0, 1
  %10 = sext i32 %9 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  store i8 0, ptr %3, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  call void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  invoke void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40) %2, i64 noundef %10, ptr noundef nonnull align 1 dereferenceable(1) %3, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %11 unwind label %14

11:                                               ; preds = %1
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  store i32 0, ptr @p, align 4, !tbaa !9
  %.not39 = icmp slt i32 %0, 2
  br i1 %.not39, label %._crit_edge44, label %.lr.ph43

.lr.ph43:                                         ; preds = %11
  %12 = getelementptr inbounds i8, ptr %5, i64 8
  %13 = getelementptr inbounds i8, ptr %8, i64 8
  %wide.trip.count = zext i32 %9 to i64
  br label %16

._crit_edge44:                                    ; preds = %.critedge, %11
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %2) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #5
  ret void

14:                                               ; preds = %1
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  br label %69

16:                                               ; preds = %.lr.ph43, %.critedge
  %indvars.iv49 = phi i64 [ 2, %.lr.ph43 ], [ %indvars.iv.next50, %.critedge ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %17 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %2, i64 noundef %indvars.iv49)
          to label %18 unwind label %30

18:                                               ; preds = %16
  %19 = extractvalue { ptr, i64 } %17, 0
  store ptr %19, ptr %5, align 8
  %20 = extractvalue { ptr, i64 } %17, 1
  store i64 %20, ptr %12, align 8
  %21 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br i1 %21, label %48, label %22

22:                                               ; preds = %18
  %23 = load i32, ptr @p, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @p, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [200009 x i32], ptr @primes, i64 0, i64 %25
  %27 = trunc nuw nsw i64 %indvars.iv49 to i32
  store i32 %27, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  call void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %6, i32 noundef 1)
  %28 = load i32, ptr @deg, align 4, !tbaa !9
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %37, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br label %48

30:                                               ; preds = %16
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %68

.lr.ph:                                           ; preds = %22, %37
  %indvars.iv = phi i64 [ %indvars.iv.next, %37 ], [ 0, %22 ]
  %32 = load i32, ptr @p, align 4, !tbaa !9
  %33 = add nsw i32 %32, -1
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [3 x [200009 x %struct.modint]], ptr @pref, i64 0, i64 %indvars.iv, i64 %34
  %.sroa.0.0.copyload = load i32, ptr %6, align 4, !tbaa !9
  %36 = invoke i32 @_ZNK6modintILi1000000007EEplES0_(ptr noundef nonnull align 4 dereferenceable(4) %35, i32 %.sroa.0.0.copyload)
          to label %37 unwind label %46

37:                                               ; preds = %.lr.ph
  %38 = load i32, ptr @p, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [3 x [200009 x %struct.modint]], ptr @pref, i64 0, i64 %indvars.iv, i64 %39
  store i32 %36, ptr %40, align 4, !tbaa !9
  call void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %27)
  %41 = load i32, ptr %7, align 4
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6modintILi1000000007EEmLES0_(ptr noundef nonnull align 4 dereferenceable(4) %6, i32 %41)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = load i32, ptr @deg, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next, %44
  br i1 %45, label %.lr.ph, label %._crit_edge, !llvm.loop !11

46:                                               ; preds = %.lr.ph
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br label %68

48:                                               ; preds = %._crit_edge, %18
  %49 = load i32, ptr @p, align 4, !tbaa !9
  %.not2833 = icmp slt i32 %49, 1
  br i1 %.not2833, label %.critedge, label %.lr.ph36.preheader

.lr.ph36.preheader:                               ; preds = %48
  %50 = trunc nuw nsw i64 %indvars.iv49 to i32
  br label %.lr.ph36

.lr.ph36:                                         ; preds = %.lr.ph36.preheader, %57
  %indvars.iv46 = phi i64 [ 1, %.lr.ph36.preheader ], [ %indvars.iv.next47, %57 ]
  %51 = getelementptr inbounds [200009 x i32], ptr @primes, i64 0, i64 %indvars.iv46
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = mul nsw i32 %52, %50
  %.not29 = icmp sgt i32 %53, %0
  br i1 %.not29, label %.critedge, label %54

54:                                               ; preds = %.lr.ph36
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  %55 = sext i32 %53 to i64
  %56 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %2, i64 noundef %55)
          to label %57 unwind label %66

57:                                               ; preds = %54
  %58 = extractvalue { ptr, i64 } %56, 0
  store ptr %58, ptr %8, align 8
  %59 = extractvalue { ptr, i64 } %56, 1
  store i64 %59, ptr %13, align 8
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %8, i1 noundef zeroext true) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  %61 = load i32, ptr %51, align 4, !tbaa !9
  %62 = srem i32 %50, %61
  %63 = icmp eq i32 %62, 0
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %64 = load i32, ptr @p, align 4
  %65 = sext i32 %64 to i64
  %.not28 = icmp sge i64 %indvars.iv46, %65
  %or.cond = select i1 %63, i1 true, i1 %.not28
  br i1 %or.cond, label %.critedge, label %.lr.ph36, !llvm.loop !13

66:                                               ; preds = %54
  %67 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  br label %68

.critedge:                                        ; preds = %.lr.ph36, %57, %48
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge44, label %16, !llvm.loop !14

68:                                               ; preds = %66, %46, %30
  %.pn = phi { ptr, i32 } [ %47, %46 ], [ %67, %66 ], [ %31, %30 ]
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %2) #5
  br label %69

69:                                               ; preds = %68, %14
  %.pn.pn = phi { ptr, i32 } [ %.pn, %68 ], [ %15, %14 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn.pn
}

; 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 nounwind uwtable
declare dso_local void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6modintILi1000000007EEplES0_(ptr noundef nonnull align 4 dereferenceable(4), i32) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) local_unnamed_addr #2 align 2

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 #5 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass