; LLVM IR from sgtlaugh/algovault :: code_library/fast_prime_sums.ll (Z5sievev)

; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::bitset<20000010>::reference" = type { ptr, i64 }

@pi = external dso_local global [20000010 x i32], align 16
@pi_sum = external dso_local global [20000010 x i64], align 16
@primes = external dso_local global %"class.std::vector", align 8
@is_prime = external dso_local global { [312501 x i64] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5sievev() #0 {
  %1 = alloca %"class.std::bitset<20000010>::reference", align 8
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::bitset<20000010>::reference", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::bitset<20000010>::reference", align 8
  %8 = alloca %"class.std::bitset<20000010>::reference", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::bitset<20000010>::reference", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %1) #3
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<20000010>::reference") align 8 %1, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef 2)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20000010EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %1, i1 noundef zeroext true) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %1) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 3, ptr %2, align 4, !tbaa !5
  br label %13

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

16:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  br label %24

17:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #3
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<20000010>::reference") align 8 %3, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %19)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20000010EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %3, i1 noundef zeroext true) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #3
  br label %21

21:                                               ; preds = %17
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %22, 2
  store i32 %23, ptr %2, align 4, !tbaa !5
  br label %13, !llvm.loop !9

24:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 3, ptr %4, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %55, %24
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = mul nsw i32 %26, %27
  %29 = icmp slt i32 %28, 20000010
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = mul nsw i32 %32, %33
  store i32 %34, ptr %6, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %49, %31
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<20000010>::reference") align 8 %7, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %37)
  %38 = call noundef zeroext i1 @_ZNKSt6bitsetILm20000010EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %7) #3
  br i1 %38, label %39, label %42

39:                                               ; preds = %35
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = icmp slt i32 %40, 20000010
  br label %42

42:                                               ; preds = %39, %35
  %43 = phi i1 [ false, %35 ], [ %41, %39 ]
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #3
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<20000010>::reference") align 8 %8, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %47)
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20000010EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %8, i1 noundef zeroext false) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #3
  br label %49

49:                                               ; preds = %45
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = shl i32 %50, 1
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = add nsw i32 %52, %51
  store i32 %53, ptr %6, align 4, !tbaa !5
  br label %35, !llvm.loop !11

54:                                               ; preds = %44
  br label %55

55:                                               ; preds = %54
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = add nsw i32 %56, 2
  store i32 %57, ptr %4, align 4, !tbaa !5
  br label %25, !llvm.loop !12

58:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 -1, ptr %9, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %97, %58
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = icmp slt i32 %60, 20000010
  br i1 %61, label %63, label %62

62:                                               ; preds = %59
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %100

63:                                               ; preds = %59
  %64 = load i32, ptr %10, align 4, !tbaa !5
  %65 = sub nsw i32 %64, 1
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %70
  store i32 %68, ptr %71, align 4, !tbaa !5
  %72 = load i32, ptr %10, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [20000010 x i64], ptr @pi_sum, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !13
  %77 = load i32, ptr %10, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [20000010 x i64], ptr @pi_sum, i64 0, i64 %78
  store i64 %76, ptr %79, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #3
  %80 = load i32, ptr %10, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<20000010>::reference") align 8 %11, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %81)
  %82 = call noundef zeroext i1 @_ZNKSt6bitsetILm20000010EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %11) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #3
  br i1 %82, label %83, label %96

83:                                               ; preds = %63
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %84 = load i32, ptr %10, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %86, align 4, !tbaa !5
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = load i32, ptr %10, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [20000010 x i64], ptr @pi_sum, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !13
  %95 = add i64 %94, %90
  store i64 %95, ptr %93, align 8, !tbaa !13
  br label %96

96:                                               ; preds = %83, %63
  br label %97

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

100:                                              ; preds = %62
  ret void
}

; 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 @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<20000010>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(2500008), i64 noundef) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm20000010EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !10}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::bitset<20000010>::reference" = type { ptr, i64 }

@pi = external dso_local local_unnamed_addr global [20000010 x i32], align 16
@pi_sum = external dso_local local_unnamed_addr global [20000010 x i64], align 16
@primes = external dso_local global %"class.std::vector", align 8
@is_prime = external dso_local global { [312501 x i64] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5sievev() local_unnamed_addr #0 {
  %1 = alloca %"class.std::bitset<20000010>::reference", align 8
  %2 = alloca %"class.std::bitset<20000010>::reference", align 8
  %3 = alloca %"class.std::bitset<20000010>::reference", align 8
  %4 = alloca %"class.std::bitset<20000010>::reference", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::bitset<20000010>::reference", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #3
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<20000010>::reference") align 8 %1, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef 2)
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20000010EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %1, i1 noundef zeroext true) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %1) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #3
  br label %9

9:                                                ; preds = %0, %9
  %indvars.iv = phi i64 [ 3, %0 ], [ %indvars.iv.next, %9 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<20000010>::reference") align 8 %2, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %indvars.iv)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20000010EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext true) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %11 = icmp ult i64 %indvars.iv, 20000008
  br i1 %11, label %9, label %.preheader, !llvm.loop !5

.preheader:                                       ; preds = %9, %._crit_edge
  %indvars.iv28 = phi i64 [ %indvars.iv.next29, %._crit_edge ], [ 3, %9 ]
  %indvars.iv23 = phi i64 [ %indvars.iv.next24, %._crit_edge ], [ 6, %9 ]
  %12 = phi i64 [ %15, %._crit_edge ], [ 9, %9 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<20000010>::reference") align 8 %3, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %indvars.iv28)
  %13 = call noundef zeroext i1 @_ZNKSt6bitsetILm20000010EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  br i1 %13, label %.lr.ph, label %._crit_edge

14:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  store i32 -1, ptr %5, align 4, !tbaa !7
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  store i32 1, ptr %6, align 4, !tbaa !7
  br label %22

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 2
  %15 = mul nuw nsw i64 %indvars.iv.next29, %indvars.iv.next29
  %16 = icmp ult i64 %15, 20000010
  %indvars.iv.next24 = add nuw nsw i64 %indvars.iv23, 4
  br i1 %16, label %.preheader, label %14, !llvm.loop !11

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv25 = phi i64 [ %indvars.iv.next26, %.lr.ph ], [ %12, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<20000010>::reference") align 8 %4, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %indvars.iv25)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20000010EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %4, i1 noundef zeroext false) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, %indvars.iv23
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<20000010>::reference") align 8 %3, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %indvars.iv28)
  %18 = call noundef zeroext i1 @_ZNKSt6bitsetILm20000010EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #3
  %19 = icmp ult i64 %indvars.iv.next26, 20000010
  %20 = select i1 %18, i1 %19, i1 false
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !12

21:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  ret void

22:                                               ; preds = %14, %42
  %storemerge21 = phi i32 [ 1, %14 ], [ %44, %42 ]
  %23 = add nsw i32 %storemerge21, -1
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !7
  %27 = sext i32 %storemerge21 to i64
  %28 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %27
  store i32 %26, ptr %28, align 4, !tbaa !7
  %29 = getelementptr inbounds [20000010 x i64], ptr @pi_sum, i64 0, i64 %24
  %30 = load i64, ptr %29, align 8, !tbaa !13
  %31 = getelementptr inbounds [20000010 x i64], ptr @pi_sum, i64 0, i64 %27
  store i64 %30, ptr %31, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #3
  call void @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<20000010>::reference") align 8 %7, ptr noundef nonnull align 8 dereferenceable(2500008) @is_prime, i64 noundef %27)
  %32 = call noundef zeroext i1 @_ZNKSt6bitsetILm20000010EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %7) #3
  call void @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #3
  br i1 %32, label %33, label %._crit_edge31

._crit_edge31:                                    ; preds = %22
  %.pre = load i32, ptr %6, align 4, !tbaa !7
  br label %42

33:                                               ; preds = %22
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %34 = load i32, ptr %6, align 4, !tbaa !7
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !7
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %36, align 4, !tbaa !7
  %39 = getelementptr inbounds [20000010 x i64], ptr @pi_sum, i64 0, i64 %35
  %40 = load i64, ptr %39, align 8, !tbaa !13
  %41 = add i64 %40, %35
  store i64 %41, ptr %39, align 8, !tbaa !13
  br label %42

42:                                               ; preds = %._crit_edge31, %33
  %43 = phi i32 [ %.pre, %._crit_edge31 ], [ %34, %33 ]
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %6, align 4, !tbaa !7
  %45 = icmp slt i32 %43, 20000009
  br i1 %45, label %22, label %21, !llvm.loop !15
}

; 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 @_ZNSt6bitsetILm20000010EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<20000010>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(2500008), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20000010EE9referenceaSEb(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 @_ZNSt6bitsetILm20000010EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm20000010EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !9, i64 0}
!15 = distinct !{!15, !6}


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