; LLVM IR from kimwalisch/primesieve :: src/CountPrintPrimes.ll (ZN10primesieve16CountPrintPrimes5sieveEv)

; 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.primesieve::SievingPrimes" = type { %"class.primesieve::Erat", i64, i64, i64, i64, i64, %"class.primesieve::Array.4", %"class.primesieve::Vector.5" }
%"class.primesieve::Erat" = type { i64, i64, i64, i64, %"class.primesieve::Vector", i64, i64, %"class.primesieve::EratSmall", %"class.primesieve::EratBig", %"class.primesieve::EratMedium" }
%"class.primesieve::Vector" = type { ptr, ptr, ptr }
%"class.primesieve::EratSmall" = type { %"class.primesieve::Wheel", i64, i64, %"class.primesieve::Vector.0" }
%"class.primesieve::Wheel" = type { ptr, i64 }
%"class.primesieve::Vector.0" = type { ptr, ptr, ptr }
%"class.primesieve::EratBig" = type { %"class.primesieve::Wheel.1", i64, i64, i64, ptr, %"class.primesieve::Vector.2" }
%"class.primesieve::Wheel.1" = type { ptr, i64 }
%"class.primesieve::Vector.2" = type { ptr, ptr, ptr }
%"class.primesieve::EratMedium" = type { %"class.primesieve::Wheel", i64, ptr, %"class.primesieve::Vector.2", %"class.primesieve::Vector.2" }
%"class.primesieve::Array.4" = type { [128 x i64] }
%"class.primesieve::Vector.5" = type { ptr, ptr, ptr }
%"class.primesieve::CountPrintPrimes" = type { %"class.primesieve::Erat", i64, [6 x %"class.primesieve::Vector"], ptr, ptr, %"class.primesieve::MemoryPool" }
%"class.primesieve::MemoryPool" = type { ptr, i64, %"class.primesieve::Vector.3" }
%"class.primesieve::Vector.3" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

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

declare noundef i32 @_ZNK10primesieve10PrimeSieve12getSieveSizeEv(ptr noundef nonnull align 8 dereferenceable(120)) #1

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

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve15isCountkTupletsEv(ptr noundef nonnull align 8 dereferenceable(120)) #1

; Function Attrs: mustprogress noinline uwtable
define dso_local void @_ZN10primesieve16CountPrintPrimes5sieveEv(ptr noundef nonnull align 8 dereferenceable(488) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"class.primesieve::SievingPrimes", align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %10 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 4
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = call noundef i32 @_ZNK10primesieve10PrimeSieve12getSieveSizeEv(ptr noundef nonnull align 8 dereferenceable(120) %11)
  %13 = sext i32 %12 to i64
  store i64 %13, ptr %3, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 1368, ptr %4) #7
  %14 = load i64, ptr %3, align 8, !tbaa !23
  %15 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 5
  call void @_ZN10primesieve13SievingPrimesC1EPNS_4EratEmRNS_10MemoryPoolE(ptr noundef nonnull align 8 dereferenceable(1368) %4, ptr noundef %9, i64 noundef %14, ptr noundef nonnull align 8 dereferenceable(40) %15)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %16 = invoke noundef i64 @_ZN10primesieve13SievingPrimes4nextEv(ptr noundef nonnull align 8 dereferenceable(1368) %4)
          to label %17 unwind label %39

17:                                               ; preds = %1
  store i64 %16, ptr %5, align 8, !tbaa !23
  br label %18

18:                                               ; preds = %88, %17
  %19 = invoke noundef zeroext i1 @_ZNK10primesieve4Erat14hasNextSegmentEv(ptr noundef nonnull align 8 dereferenceable(280) %9)
          to label %20 unwind label %39

20:                                               ; preds = %18
  br i1 %19, label %21, label %89

21:                                               ; preds = %20
  %22 = getelementptr inbounds %"class.primesieve::Erat", ptr %9, i32 0, i32 2
  %23 = load i64, ptr %22, align 8, !tbaa !24
  %24 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 1
  store i64 %23, ptr %24, align 8, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %25 = getelementptr inbounds %"class.primesieve::Erat", ptr %9, i32 0, i32 3
  %26 = load i64, ptr %25, align 8, !tbaa !26
  %27 = invoke noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef %26)
          to label %28 unwind label %43

28:                                               ; preds = %21
  store i64 %27, ptr %8, align 8, !tbaa !23
  br label %29

29:                                               ; preds = %38, %28
  %30 = load i64, ptr %5, align 8, !tbaa !23
  %31 = load i64, ptr %8, align 8, !tbaa !23
  %32 = icmp ule i64 %30, %31
  br i1 %32, label %33, label %47

33:                                               ; preds = %29
  %34 = load i64, ptr %5, align 8, !tbaa !23
  invoke void @_ZN10primesieve4Erat15addSievingPrimeEm(ptr noundef nonnull align 8 dereferenceable(280) %9, i64 noundef %34)
          to label %35 unwind label %43

35:                                               ; preds = %33
  br label %36

36:                                               ; preds = %35
  %37 = invoke noundef i64 @_ZN10primesieve13SievingPrimes4nextEv(ptr noundef nonnull align 8 dereferenceable(1368) %4)
          to label %38 unwind label %43

38:                                               ; preds = %36
  store i64 %37, ptr %5, align 8, !tbaa !23
  br label %29, !llvm.loop !27

39:                                               ; preds = %18, %1
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %6, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %7, align 4
  br label %90

43:                                               ; preds = %81, %76, %74, %69, %67, %62, %60, %55, %53, %48, %47, %36, %33, %21
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %6, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %90

47:                                               ; preds = %29
  invoke void @_ZN10primesieve4Erat12sieveSegmentEv(ptr noundef nonnull align 8 dereferenceable(280) %9)
          to label %48 unwind label %43

48:                                               ; preds = %47
  %49 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 4
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve13isCountPrimesEv(ptr noundef nonnull align 8 dereferenceable(120) %50)
          to label %52 unwind label %43

52:                                               ; preds = %48
  br i1 %51, label %53, label %55

53:                                               ; preds = %52
  invoke void @_ZN10primesieve16CountPrintPrimes11countPrimesEv(ptr noundef nonnull align 8 dereferenceable(488) %9)
          to label %54 unwind label %43

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54, %52
  %56 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 4
  %57 = load ptr, ptr %56, align 8, !tbaa !9
  %58 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve15isCountkTupletsEv(ptr noundef nonnull align 8 dereferenceable(120) %57)
          to label %59 unwind label %43

59:                                               ; preds = %55
  br i1 %58, label %60, label %62

60:                                               ; preds = %59
  invoke void @_ZN10primesieve16CountPrintPrimes13countkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488) %9)
          to label %61 unwind label %43

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61, %59
  %63 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 4
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve13isPrintPrimesEv(ptr noundef nonnull align 8 dereferenceable(120) %64)
          to label %66 unwind label %43

66:                                               ; preds = %62
  br i1 %65, label %67, label %69

67:                                               ; preds = %66
  invoke void @_ZNK10primesieve16CountPrintPrimes11printPrimesEv(ptr noundef nonnull align 8 dereferenceable(488) %9)
          to label %68 unwind label %43

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68, %66
  %70 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 4
  %71 = load ptr, ptr %70, align 8, !tbaa !9
  %72 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve15isPrintkTupletsEv(ptr noundef nonnull align 8 dereferenceable(120) %71)
          to label %73 unwind label %43

73:                                               ; preds = %69
  br i1 %72, label %74, label %76

74:                                               ; preds = %73
  invoke void @_ZNK10primesieve16CountPrintPrimes13printkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488) %9)
          to label %75 unwind label %43

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75, %73
  %77 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 4
  %78 = load ptr, ptr %77, align 8, !tbaa !9
  %79 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve8isStatusEv(ptr noundef nonnull align 8 dereferenceable(120) %78)
          to label %80 unwind label %43

80:                                               ; preds = %76
  br i1 %79, label %81, label %88

81:                                               ; preds = %80
  %82 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %9, i32 0, i32 4
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = getelementptr inbounds %"class.primesieve::Erat", ptr %9, i32 0, i32 4
  %85 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %84) #7
  %86 = mul i64 %85, 30
  invoke void @_ZN10primesieve10PrimeSieve12updateStatusEm(ptr noundef nonnull align 8 dereferenceable(120) %83, i64 noundef %86)
          to label %87 unwind label %43

87:                                               ; preds = %81
  br label %88

88:                                               ; preds = %87, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %18, !llvm.loop !29

89:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @_ZN10primesieve13SievingPrimesD2Ev(ptr noundef nonnull align 8 dereferenceable(1368) %4) #7
  call void @llvm.lifetime.end.p0(i64 1368, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  ret void

90:                                               ; preds = %43, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @_ZN10primesieve13SievingPrimesD2Ev(ptr noundef nonnull align 8 dereferenceable(1368) %4) #7
  call void @llvm.lifetime.end.p0(i64 1368, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %91

91:                                               ; preds = %90
  %92 = load ptr, ptr %6, align 8
  %93 = load i32, ptr %7, align 4
  %94 = insertvalue { ptr, i32 } poison, ptr %92, 0
  %95 = insertvalue { ptr, i32 } %94, i32 %93, 1
  resume { ptr, i32 } %95
}

declare void @_ZN10primesieve13SievingPrimesC1EPNS_4EratEmRNS_10MemoryPoolE(ptr noundef nonnull align 8 dereferenceable(1368), ptr noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve13SievingPrimes4nextEv(ptr noundef nonnull align 8 dereferenceable(1368)) #3 align 2

declare noundef zeroext i1 @_ZNK10primesieve4Erat14hasNextSegmentEv(ptr noundef nonnull align 8 dereferenceable(280)) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10primesieve4Erat15addSievingPrimeEm(ptr noundef nonnull align 8 dereferenceable(280), i64 noundef) #3 align 2

declare void @_ZN10primesieve4Erat12sieveSegmentEv(ptr noundef nonnull align 8 dereferenceable(280)) #1

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve13isCountPrimesEv(ptr noundef nonnull align 8 dereferenceable(120)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve16CountPrintPrimes11countPrimesEv(ptr noundef nonnull align 8 dereferenceable(488)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve16CountPrintPrimes13countkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488)) #5 align 2

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve13isPrintPrimesEv(ptr noundef nonnull align 8 dereferenceable(120)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK10primesieve16CountPrintPrimes11printPrimesEv(ptr noundef nonnull align 8 dereferenceable(488)) #5 align 2

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve15isPrintkTupletsEv(ptr noundef nonnull align 8 dereferenceable(120)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK10primesieve16CountPrintPrimes13printkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488)) #5 align 2

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve8isStatusEv(ptr noundef nonnull align 8 dereferenceable(120)) #1

declare void @_ZN10primesieve10PrimeSieve12updateStatusEm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10primesieve13SievingPrimesD2Ev(ptr noundef nonnull align 8 dereferenceable(1368)) unnamed_addr #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 noinline 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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 440}
!10 = !{!"_ZTSN10primesieve16CountPrintPrimesE", !11, i64 0, !12, i64 280, !7, i64 288, !6, i64 432, !6, i64 440, !21, i64 448}
!11 = !{!"_ZTSN10primesieve4EratE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32, !12, i64 56, !12, i64 64, !14, i64 72, !17, i64 128, !20, i64 200}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTSN10primesieve6VectorIhSaIhEEE", !6, i64 0, !6, i64 8, !6, i64 16}
!14 = !{!"_ZTSN10primesieve9EratSmallE", !15, i64 0, !12, i64 16, !12, i64 24, !16, i64 32}
!15 = !{!"_ZTSN10primesieve5WheelILi30ELi8ELi6EXadsoKNS_9WheelInitEL_ZNS_11wheel30InitEEEEEE", !12, i64 8}
!16 = !{!"_ZTSN10primesieve6VectorINS_12SievingPrimeESaIS1_EEE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"_ZTSN10primesieve7EratBigE", !18, i64 0, !12, i64 16, !12, i64 24, !12, i64 32, !6, i64 40, !19, i64 48}
!18 = !{!"_ZTSN10primesieve5WheelILi210ELi48ELi10EXadsoKNS_9WheelInitEL_ZNS_12wheel210InitEEEEEE", !12, i64 8}
!19 = !{!"_ZTSN10primesieve6VectorIPNS_12SievingPrimeESaIS2_EEE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_ZTSN10primesieve10EratMediumE", !15, i64 0, !12, i64 16, !6, i64 24, !19, i64 32, !19, i64 56}
!21 = !{!"_ZTSN10primesieve10MemoryPoolE", !6, i64 0, !12, i64 8, !22, i64 16}
!22 = !{!"_ZTSN10primesieve6VectorINS0_IcSaIcEEESaIS2_EEE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!12, !12, i64 0}
!24 = !{!11, !12, i64 16}
!25 = !{!10, !12, i64 280}
!26 = !{!11, !12, i64 24}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}


; 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.primesieve::SievingPrimes" = type { %"class.primesieve::Erat", i64, i64, i64, i64, i64, %"class.primesieve::Array.4", %"class.primesieve::Vector.5" }
%"class.primesieve::Erat" = type { i64, i64, i64, i64, %"class.primesieve::Vector", i64, i64, %"class.primesieve::EratSmall", %"class.primesieve::EratBig", %"class.primesieve::EratMedium" }
%"class.primesieve::Vector" = type { ptr, ptr, ptr }
%"class.primesieve::EratSmall" = type { %"class.primesieve::Wheel", i64, i64, %"class.primesieve::Vector.0" }
%"class.primesieve::Wheel" = type { ptr, i64 }
%"class.primesieve::Vector.0" = type { ptr, ptr, ptr }
%"class.primesieve::EratBig" = type { %"class.primesieve::Wheel.1", i64, i64, i64, ptr, %"class.primesieve::Vector.2" }
%"class.primesieve::Wheel.1" = type { ptr, i64 }
%"class.primesieve::Vector.2" = type { ptr, ptr, ptr }
%"class.primesieve::EratMedium" = type { %"class.primesieve::Wheel", i64, ptr, %"class.primesieve::Vector.2", %"class.primesieve::Vector.2" }
%"class.primesieve::Array.4" = type { [128 x i64] }
%"class.primesieve::Vector.5" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

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

declare noundef i32 @_ZNK10primesieve10PrimeSieve12getSieveSizeEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1

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

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve15isCountkTupletsEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1

; Function Attrs: mustprogress noinline uwtable
define dso_local void @_ZN10primesieve16CountPrintPrimes5sieveEv(ptr noundef nonnull align 8 dereferenceable(488) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.primesieve::SievingPrimes", align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 440
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call noundef i32 @_ZNK10primesieve10PrimeSieve12getSieveSizeEv(ptr noundef nonnull align 8 dereferenceable(120) %4)
  %6 = sext i32 %5 to i64
  call void @llvm.lifetime.start.p0(i64 1368, ptr nonnull %2) #7
  %7 = getelementptr inbounds i8, ptr %0, i64 448
  call void @_ZN10primesieve13SievingPrimesC1EPNS_4EratEmRNS_10MemoryPoolE(ptr noundef nonnull align 8 dereferenceable(1368) %2, ptr noundef nonnull %0, i64 noundef %6, ptr noundef nonnull align 8 dereferenceable(40) %7)
  %8 = invoke noundef i64 @_ZN10primesieve13SievingPrimes4nextEv(ptr noundef nonnull align 8 dereferenceable(1368) %2)
          to label %.preheader unwind label %.loopexit.split-lp10

.preheader:                                       ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = getelementptr inbounds i8, ptr %0, i64 280
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  br label %13

13:                                               ; preds = %.backedge, %.preheader
  %.0 = phi i64 [ %8, %.preheader ], [ %.1, %.backedge ]
  %14 = invoke noundef zeroext i1 @_ZNK10primesieve4Erat14hasNextSegmentEv(ptr noundef nonnull align 8 dereferenceable(280) %0)
          to label %15 unwind label %.loopexit9

15:                                               ; preds = %13
  br i1 %14, label %16, label %53

16:                                               ; preds = %15
  %17 = load i64, ptr %9, align 8, !tbaa !22
  store i64 %17, ptr %10, align 8, !tbaa !23
  %18 = load i64, ptr %11, align 8, !tbaa !24
  %19 = call noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef %18)
  br label %20

20:                                               ; preds = %22, %16
  %.1 = phi i64 [ %.0, %16 ], [ %23, %22 ]
  %.not = icmp ugt i64 %.1, %19
  br i1 %.not, label %24, label %21

21:                                               ; preds = %20
  invoke void @_ZN10primesieve4Erat15addSievingPrimeEm(ptr noundef nonnull align 8 dereferenceable(280) %0, i64 noundef %.1)
          to label %22 unwind label %.loopexit

22:                                               ; preds = %21
  %23 = invoke noundef i64 @_ZN10primesieve13SievingPrimes4nextEv(ptr noundef nonnull align 8 dereferenceable(1368) %2)
          to label %20 unwind label %.loopexit, !llvm.loop !25

.loopexit9:                                       ; preds = %13
  %lpad.loopexit11 = landingpad { ptr, i32 }
          cleanup
  br label %54

.loopexit.split-lp10:                             ; preds = %1
  %lpad.loopexit.split-lp12 = landingpad { ptr, i32 }
          cleanup
  br label %54

.loopexit:                                        ; preds = %21, %22
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %54

.loopexit.split-lp:                               ; preds = %24, %25, %29, %30, %34, %35, %39, %40, %44, %45, %49
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %54

24:                                               ; preds = %20
  invoke void @_ZN10primesieve4Erat12sieveSegmentEv(ptr noundef nonnull align 8 dereferenceable(280) %0)
          to label %25 unwind label %.loopexit.split-lp

25:                                               ; preds = %24
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve13isCountPrimesEv(ptr noundef nonnull align 8 dereferenceable(120) %26)
          to label %28 unwind label %.loopexit.split-lp

28:                                               ; preds = %25
  br i1 %27, label %29, label %30

29:                                               ; preds = %28
  invoke void @_ZN10primesieve16CountPrintPrimes11countPrimesEv(ptr noundef nonnull align 8 dereferenceable(488) %0)
          to label %30 unwind label %.loopexit.split-lp

30:                                               ; preds = %29, %28
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve15isCountkTupletsEv(ptr noundef nonnull align 8 dereferenceable(120) %31)
          to label %33 unwind label %.loopexit.split-lp

33:                                               ; preds = %30
  br i1 %32, label %34, label %35

34:                                               ; preds = %33
  invoke void @_ZN10primesieve16CountPrintPrimes13countkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488) %0)
          to label %35 unwind label %.loopexit.split-lp

35:                                               ; preds = %34, %33
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve13isPrintPrimesEv(ptr noundef nonnull align 8 dereferenceable(120) %36)
          to label %38 unwind label %.loopexit.split-lp

38:                                               ; preds = %35
  br i1 %37, label %39, label %40

39:                                               ; preds = %38
  invoke void @_ZNK10primesieve16CountPrintPrimes11printPrimesEv(ptr noundef nonnull align 8 dereferenceable(488) %0)
          to label %40 unwind label %.loopexit.split-lp

40:                                               ; preds = %39, %38
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve15isPrintkTupletsEv(ptr noundef nonnull align 8 dereferenceable(120) %41)
          to label %43 unwind label %.loopexit.split-lp

43:                                               ; preds = %40
  br i1 %42, label %44, label %45

44:                                               ; preds = %43
  invoke void @_ZNK10primesieve16CountPrintPrimes13printkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488) %0)
          to label %45 unwind label %.loopexit.split-lp

45:                                               ; preds = %44, %43
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve8isStatusEv(ptr noundef nonnull align 8 dereferenceable(120) %46)
          to label %48 unwind label %.loopexit.split-lp

48:                                               ; preds = %45
  br i1 %47, label %49, label %.backedge

49:                                               ; preds = %48
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %52 = mul i64 %51, 30
  invoke void @_ZN10primesieve10PrimeSieve12updateStatusEm(ptr noundef nonnull align 8 dereferenceable(120) %50, i64 noundef %52)
          to label %.backedge unwind label %.loopexit.split-lp

.backedge:                                        ; preds = %49, %48
  br label %13, !llvm.loop !27

53:                                               ; preds = %15
  call void @_ZN10primesieve13SievingPrimesD2Ev(ptr noundef nonnull align 8 dereferenceable(1368) %2) #7
  call void @llvm.lifetime.end.p0(i64 1368, ptr nonnull %2) #7
  ret void

54:                                               ; preds = %.loopexit, %.loopexit.split-lp, %.loopexit9, %.loopexit.split-lp10
  %.pn = phi { ptr, i32 } [ %lpad.loopexit11, %.loopexit9 ], [ %lpad.loopexit.split-lp12, %.loopexit.split-lp10 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN10primesieve13SievingPrimesD2Ev(ptr noundef nonnull align 8 dereferenceable(1368) %2) #7
  call void @llvm.lifetime.end.p0(i64 1368, ptr nonnull %2) #7
  resume { ptr, i32 } %.pn
}

declare void @_ZN10primesieve13SievingPrimesC1EPNS_4EratEmRNS_10MemoryPoolE(ptr noundef nonnull align 8 dereferenceable(1368), ptr noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve13SievingPrimes4nextEv(ptr noundef nonnull align 8 dereferenceable(1368)) local_unnamed_addr #3 align 2

declare noundef zeroext i1 @_ZNK10primesieve4Erat14hasNextSegmentEv(ptr noundef nonnull align 8 dereferenceable(280)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10primesieve4Erat15addSievingPrimeEm(ptr noundef nonnull align 8 dereferenceable(280), i64 noundef) local_unnamed_addr #3 align 2

declare void @_ZN10primesieve4Erat12sieveSegmentEv(ptr noundef nonnull align 8 dereferenceable(280)) local_unnamed_addr #1

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve13isCountPrimesEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve16CountPrintPrimes11countPrimesEv(ptr noundef nonnull align 8 dereferenceable(488)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve16CountPrintPrimes13countkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488)) local_unnamed_addr #5 align 2

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve13isPrintPrimesEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK10primesieve16CountPrintPrimes11printPrimesEv(ptr noundef nonnull align 8 dereferenceable(488)) local_unnamed_addr #5 align 2

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve15isPrintkTupletsEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK10primesieve16CountPrintPrimes13printkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488)) local_unnamed_addr #5 align 2

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve8isStatusEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1

declare void @_ZN10primesieve10PrimeSieve12updateStatusEm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10primesieve13SievingPrimesD2Ev(ptr noundef nonnull align 8 dereferenceable(1368)) unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 noinline 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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !12, i64 440}
!6 = !{!"_ZTSN10primesieve16CountPrintPrimesE", !7, i64 0, !8, i64 280, !9, i64 288, !12, i64 432, !12, i64 440, !20, i64 448}
!7 = !{!"_ZTSN10primesieve4EratE", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !11, i64 32, !8, i64 56, !8, i64 64, !13, i64 72, !16, i64 128, !19, i64 200}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN10primesieve6VectorIhSaIhEEE", !12, i64 0, !12, i64 8, !12, i64 16}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"_ZTSN10primesieve9EratSmallE", !14, i64 0, !8, i64 16, !8, i64 24, !15, i64 32}
!14 = !{!"_ZTSN10primesieve5WheelILi30ELi8ELi6EXadsoKNS_9WheelInitEL_ZNS_11wheel30InitEEEEEE", !8, i64 8}
!15 = !{!"_ZTSN10primesieve6VectorINS_12SievingPrimeESaIS1_EEE", !12, i64 0, !12, i64 8, !12, i64 16}
!16 = !{!"_ZTSN10primesieve7EratBigE", !17, i64 0, !8, i64 16, !8, i64 24, !8, i64 32, !12, i64 40, !18, i64 48}
!17 = !{!"_ZTSN10primesieve5WheelILi210ELi48ELi10EXadsoKNS_9WheelInitEL_ZNS_12wheel210InitEEEEEE", !8, i64 8}
!18 = !{!"_ZTSN10primesieve6VectorIPNS_12SievingPrimeESaIS2_EEE", !12, i64 0, !12, i64 8, !12, i64 16}
!19 = !{!"_ZTSN10primesieve10EratMediumE", !14, i64 0, !8, i64 16, !12, i64 24, !18, i64 32, !18, i64 56}
!20 = !{!"_ZTSN10primesieve10MemoryPoolE", !12, i64 0, !8, i64 8, !21, i64 16}
!21 = !{!"_ZTSN10primesieve6VectorINS0_IcSaIcEEESaIS2_EEE", !12, i64 0, !12, i64 8, !12, i64 16}
!22 = !{!7, !8, i64 16}
!23 = !{!6, !8, i64 280}
!24 = !{!7, !8, i64 24}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass