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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_ostringstream" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.primesieve::CountPrintPrimes" = type { %"class.primesieve::Erat", i64, [6 x %"class.primesieve::Vector"], ptr, ptr, %"class.primesieve::MemoryPool" }
%"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::MemoryPool" = type { ptr, i64, %"class.primesieve::Vector.3" }
%"class.primesieve::Vector.3" = type { ptr, ptr, ptr }

@_ZN12_GLOBAL__N_18bitmasksE = external hidden constant [6 x [5 x i64]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10primesieve16CountPrintPrimes13printkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::__cxx11::basic_ostringstream", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i8, align 1
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %15 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %14, i32 0, i32 1
  %16 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %16, ptr %4, align 8, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 376, ptr %5) #5
  call void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev(ptr noundef nonnull align 8 dereferenceable(112) %5)
  br label %17

17:                                               ; preds = %24, %1
  %18 = getelementptr inbounds %"class.primesieve::CountPrintPrimes", ptr %14, i32 0, i32 4
  %19 = load ptr, ptr %18, align 8, !tbaa !26
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve7isPrintEi(ptr noundef nonnull align 8 dereferenceable(120) %19, i32 noundef %20)
          to label %22 unwind label %27

22:                                               ; preds = %17
  %23 = xor i1 %21, true
  br i1 %23, label %24, label %31

24:                                               ; preds = %22
  %25 = load i32, ptr %3, align 4, !tbaa !9
  %26 = add i32 %25, 1
  store i32 %26, ptr %3, align 4, !tbaa !9
  br label %17, !llvm.loop !27

27:                                               ; preds = %17
  %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
  br label %138

31:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !25
  br label %32

32:                                               ; preds = %120, %31
  %33 = load i64, ptr %8, align 8, !tbaa !25
  %34 = getelementptr inbounds %"class.primesieve::Erat", ptr %14, i32 0, i32 4
  %35 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #5
  %36 = icmp ult i64 %33, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %125

38:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %39 = load i32, ptr %3, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [6 x [5 x i64]], ptr @_ZN12_GLOBAL__N_18bitmasksE, i64 0, i64 %40
  %42 = getelementptr inbounds [5 x i64], ptr %41, i64 0, i64 0
  store ptr %42, ptr %10, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %115, %38
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = load i64, ptr %44, align 8, !tbaa !25
  %46 = getelementptr inbounds %"class.primesieve::Erat", ptr %14, i32 0, i32 4
  %47 = load i64, ptr %8, align 8, !tbaa !25
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK10primesieve6VectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #5
  %49 = load i8, ptr %48, align 1, !tbaa !29
  %50 = zext i8 %49 to i64
  %51 = icmp ule i64 %45, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %43
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %119

53:                                               ; preds = %43
  %54 = getelementptr inbounds %"class.primesieve::Erat", ptr %14, i32 0, i32 4
  %55 = load i64, ptr %8, align 8, !tbaa !25
  %56 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK10primesieve6VectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef %55) #5
  %57 = load i8, ptr %56, align 1, !tbaa !29
  %58 = zext i8 %57 to i64
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = load i64, ptr %59, align 8, !tbaa !25
  %61 = and i64 %58, %60
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = load i64, ptr %62, align 8, !tbaa !25
  %64 = icmp eq i64 %61, %63
  br i1 %64, label %65, label %114

65:                                               ; preds = %53
  %66 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef @.str)
          to label %67 unwind label %100

67:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = load i64, ptr %68, align 8, !tbaa !25
  store i64 %69, ptr %11, align 8, !tbaa !25
  br label %70

70:                                               ; preds = %95, %67
  %71 = load i64, ptr %11, align 8, !tbaa !25
  %72 = icmp ne i64 %71, 0
  br i1 %72, label %73, label %112

73:                                               ; preds = %70
  %74 = load i64, ptr %11, align 8, !tbaa !25
  %75 = load i64, ptr %4, align 8, !tbaa !25
  %76 = invoke noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %74, i64 noundef %75)
          to label %77 unwind label %104

77:                                               ; preds = %73
  %78 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %5, i64 noundef %76)
          to label %79 unwind label %104

79:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #5
  %80 = load i64, ptr %11, align 8, !tbaa !25
  %81 = load i64, ptr %11, align 8, !tbaa !25
  %82 = sub i64 %81, 1
  %83 = and i64 %80, %82
  %84 = icmp ne i64 %83, 0
  %85 = zext i1 %84 to i8
  store i8 %85, ptr %12, align 1, !tbaa !30
  %86 = load i8, ptr %12, align 1, !tbaa !30, !range !32, !noundef !33
  %87 = trunc i8 %86 to i1
  br i1 %87, label %88, label %89

88:                                               ; preds = %79
  br label %90

89:                                               ; preds = %79
  br label %90

90:                                               ; preds = %89, %88
  %91 = phi ptr [ @.str.1, %88 ], [ @.str.2, %89 ]
  %92 = getelementptr inbounds [3 x i8], ptr %91, i64 0, i64 0
  %93 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %92)
          to label %94 unwind label %108

94:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #5
  br label %95

95:                                               ; preds = %94
  %96 = load i64, ptr %11, align 8, !tbaa !25
  %97 = sub i64 %96, 1
  %98 = load i64, ptr %11, align 8, !tbaa !25
  %99 = and i64 %98, %97
  store i64 %99, ptr %11, align 8, !tbaa !25
  br label %70, !llvm.loop !34

100:                                              ; preds = %65
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %6, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %7, align 4
  br label %118

104:                                              ; preds = %77, %73
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %6, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %7, align 4
  br label %113

108:                                              ; preds = %90
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %6, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #5
  br label %113

112:                                              ; preds = %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %114

113:                                              ; preds = %108, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %118

114:                                              ; preds = %112, %53
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = getelementptr inbounds i64, ptr %116, i32 1
  store ptr %117, ptr %10, align 8, !tbaa !5
  br label %43, !llvm.loop !35

118:                                              ; preds = %113, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %138

119:                                              ; preds = %52
  br label %120

120:                                              ; preds = %119
  %121 = load i64, ptr %8, align 8, !tbaa !25
  %122 = add i64 %121, 1
  store i64 %122, ptr %8, align 8, !tbaa !25
  %123 = load i64, ptr %4, align 8, !tbaa !25
  %124 = add i64 %123, 30
  store i64 %124, ptr %4, align 8, !tbaa !25
  br label %32, !llvm.loop !36

125:                                              ; preds = %37
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #5
  invoke void @_ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %13, ptr noundef nonnull align 8 dereferenceable(112) %5)
          to label %126 unwind label %129

126:                                              ; preds = %125
  %127 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %128 unwind label %133

128:                                              ; preds = %126
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  call void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(112) %5) #5
  call void @llvm.lifetime.end.p0(i64 376, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret void

129:                                              ; preds = %125
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %6, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %7, align 4
  br label %137

133:                                              ; preds = %126
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %6, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #5
  br label %137

137:                                              ; preds = %133, %129
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  br label %138

138:                                              ; preds = %137, %118, %27
  call void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(112) %5) #5
  call void @llvm.lifetime.end.p0(i64 376, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %139

139:                                              ; preds = %138
  %140 = load ptr, ptr %6, align 8
  %141 = load i32, ptr %7, align 4
  %142 = insertvalue { ptr, i32 } poison, ptr %140, 0
  %143 = insertvalue { ptr, i32 } %142, i32 %141, 1
  resume { ptr, i32 } %143
}

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev(ptr noundef nonnull align 8 dereferenceable(112)) unnamed_addr #1 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef, i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #3

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(112)) #1 align 2

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

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

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve7isPrintEi(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !14, i64 280}
!12 = !{!"_ZTSN10primesieve16CountPrintPrimesE", !13, i64 0, !14, i64 280, !7, i64 288, !6, i64 432, !6, i64 440, !23, i64 448}
!13 = !{!"_ZTSN10primesieve4EratE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !15, i64 32, !14, i64 56, !14, i64 64, !16, i64 72, !19, i64 128, !22, i64 200}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN10primesieve6VectorIhSaIhEEE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"_ZTSN10primesieve9EratSmallE", !17, i64 0, !14, i64 16, !14, i64 24, !18, i64 32}
!17 = !{!"_ZTSN10primesieve5WheelILi30ELi8ELi6EXadsoKNS_9WheelInitEL_ZNS_11wheel30InitEEEEEE", !14, i64 8}
!18 = !{!"_ZTSN10primesieve6VectorINS_12SievingPrimeESaIS1_EEE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSN10primesieve7EratBigE", !20, i64 0, !14, i64 16, !14, i64 24, !14, i64 32, !6, i64 40, !21, i64 48}
!20 = !{!"_ZTSN10primesieve5WheelILi210ELi48ELi10EXadsoKNS_9WheelInitEL_ZNS_12wheel210InitEEEEEE", !14, i64 8}
!21 = !{!"_ZTSN10primesieve6VectorIPNS_12SievingPrimeESaIS2_EEE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSN10primesieve10EratMediumE", !17, i64 0, !14, i64 16, !6, i64 24, !21, i64 32, !21, i64 56}
!23 = !{!"_ZTSN10primesieve10MemoryPoolE", !6, i64 0, !14, i64 8, !24, i64 16}
!24 = !{!"_ZTSN10primesieve6VectorINS0_IcSaIcEEESaIS2_EEE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!14, !14, i64 0}
!26 = !{!12, !6, i64 440}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!7, !7, i64 0}
!30 = !{!31, !31, i64 0}
!31 = !{!"bool", !7, i64 0}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = distinct !{!34, !28}
!35 = distinct !{!35, !28}
!36 = distinct !{!36, !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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_ostringstream" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@_ZN12_GLOBAL__N_18bitmasksE = external hidden local_unnamed_addr constant [6 x [5 x i64]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10primesieve16CountPrintPrimes13printkTupletsEv(ptr noundef nonnull align 8 dereferenceable(488) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::__cxx11::basic_ostringstream", align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 280
  %5 = load i64, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 376, ptr nonnull %2) #5
  call void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev(ptr noundef nonnull align 8 dereferenceable(112) %2)
  %6 = getelementptr inbounds i8, ptr %0, i64 440
  br label %7

7:                                                ; preds = %16, %1
  %.0 = phi i32 [ 1, %1 ], [ %17, %16 ]
  %8 = load ptr, ptr %6, align 8, !tbaa !22
  %9 = invoke noundef zeroext i1 @_ZNK10primesieve10PrimeSieve7isPrintEi(ptr noundef nonnull align 8 dereferenceable(120) %8, i32 noundef %.0)
          to label %10 unwind label %18

10:                                               ; preds = %7
  br i1 %9, label %.preheader39, label %16

.preheader39:                                     ; preds = %10
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  %.not47 = icmp eq i64 %12, 0
  br i1 %.not47, label %._crit_edge46, label %.lr.ph45

.lr.ph45:                                         ; preds = %.preheader39
  %13 = zext i32 %.0 to i64
  %14 = getelementptr inbounds [6 x [5 x i64]], ptr @_ZN12_GLOBAL__N_18bitmasksE, i64 0, i64 %13
  %15 = load i64, ptr %14, align 8, !tbaa !23
  br label %20

16:                                               ; preds = %10
  %17 = add i32 %.0, 1
  br label %7, !llvm.loop !24

18:                                               ; preds = %7
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %63

._crit_edge46:                                    ; preds = %._crit_edge, %.preheader39
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  invoke void @_ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %3, ptr noundef nonnull align 8 dereferenceable(112) %2)
          to label %55 unwind label %58

20:                                               ; preds = %.lr.ph45, %._crit_edge
  %.02544 = phi i64 [ 0, %.lr.ph45 ], [ %24, %._crit_edge ]
  %.03143 = phi i64 [ %5, %.lr.ph45 ], [ %25, %._crit_edge ]
  %21 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK10primesieve6VectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %.02544) #5
  %22 = load i8, ptr %21, align 1, !tbaa !26
  %23 = zext i8 %22 to i64
  %.not41 = icmp ugt i64 %15, %23
  br i1 %.not41, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.loopexit, %20
  %24 = add nuw i64 %.02544, 1
  %25 = add i64 %.03143, 30
  %26 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  %27 = icmp ult i64 %24, %26
  br i1 %27, label %20, label %._crit_edge46, !llvm.loop !27

.lr.ph:                                           ; preds = %20, %.loopexit
  %28 = phi i64 [ %51, %.loopexit ], [ %15, %20 ]
  %.02442 = phi ptr [ %50, %.loopexit ], [ %14, %20 ]
  %29 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK10primesieve6VectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %.02544) #5
  %30 = load i8, ptr %29, align 1, !tbaa !26
  %31 = zext i8 %30 to i64
  %32 = and i64 %28, %31
  %33 = icmp eq i64 %32, %28
  br i1 %33, label %34, label %.loopexit

34:                                               ; preds = %.lr.ph
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull @.str)
          to label %.preheader unwind label %44

.preheader:                                       ; preds = %34, %40
  %.023 = phi i64 [ %42, %40 ], [ %28, %34 ]
  %.not33 = icmp eq i64 %.023, 0
  br i1 %.not33, label %.loopexit, label %36

36:                                               ; preds = %.preheader
  %37 = invoke noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %.023, i64 noundef %.03143)
          to label %38 unwind label %46

38:                                               ; preds = %36
  %39 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %2, i64 noundef %37)
          to label %40 unwind label %46

40:                                               ; preds = %38
  %41 = add i64 %.023, -1
  %42 = and i64 %41, %.023
  %.not34 = icmp eq i64 %42, 0
  %.str.1..str.2 = select i1 %.not34, ptr @.str.2, ptr @.str.1
  %43 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull %.str.1..str.2)
          to label %.preheader unwind label %48, !llvm.loop !28

44:                                               ; preds = %34
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %63

46:                                               ; preds = %38, %36
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %63

48:                                               ; preds = %40
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %63

.loopexit:                                        ; preds = %.preheader, %.lr.ph
  %50 = getelementptr inbounds i8, ptr %.02442, i64 8
  %51 = load i64, ptr %50, align 8, !tbaa !23
  %52 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK10primesieve6VectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %.02544) #5
  %53 = load i8, ptr %52, align 1, !tbaa !26
  %54 = zext i8 %53 to i64
  %.not = icmp ugt i64 %51, %54
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !29

55:                                               ; preds = %._crit_edge46
  %56 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %57 unwind label %60

57:                                               ; preds = %55
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  call void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(112) %2) #5
  call void @llvm.lifetime.end.p0(i64 376, ptr nonnull %2) #5
  ret void

58:                                               ; preds = %._crit_edge46
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %62

60:                                               ; preds = %55
  %61 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  br label %62

62:                                               ; preds = %60, %58
  %.pn = phi { ptr, i32 } [ %61, %60 ], [ %59, %58 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  br label %63

63:                                               ; preds = %44, %48, %46, %62, %18
  %.pn35.pn.pn = phi { ptr, i32 } [ %.pn, %62 ], [ %19, %18 ], [ %45, %44 ], [ %49, %48 ], [ %47, %46 ]
  call void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(112) %2) #5
  call void @llvm.lifetime.end.p0(i64 376, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn35.pn.pn
}

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev(ptr noundef nonnull align 8 dereferenceable(112)) unnamed_addr #1 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef, i64 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #1 align 2

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

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

declare noundef zeroext i1 @_ZNK10primesieve10PrimeSieve7isPrintEi(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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, !8, i64 280}
!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 = !{!6, !12, i64 440}
!23 = !{!8, !8, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!9, !9, i64 0}
!27 = distinct !{!27, !25}
!28 = distinct !{!28, !25}
!29 = distinct !{!29, !25}


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