; LLVM IR from kimwalisch/primesieve :: src (PrimeGenerator)

; 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::PrimeGenerator" = type { %"class.primesieve::Erat", i8, i64, i64, i64, %"class.primesieve::MemoryPool", %"class.primesieve::SievingPrimes" }
%"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 }
%"class.primesieve::SievingPrimes" = type { %"class.primesieve::Erat", i64, i64, i64, i64, i64, %"class.primesieve::Array", %"class.primesieve::Vector.4" }
%"class.primesieve::Array" = type { [128 x i64] }
%"class.primesieve::Vector.4" = type { ptr, ptr, ptr }

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN10primesieve14PrimeGenerator15sieveNextPrimesERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10primesieve14PrimeGenerator22fillNextPrimes_defaultERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  store i64 0, ptr %16, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %126, %3
  %18 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %15, i32 0, i32 4
  %19 = load i64, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds %"class.primesieve::Erat", ptr %15, i32 0, i32 4
  %21 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #6
  %22 = icmp uge i64 %19, %21
  br i1 %22, label %23, label %29

23:                                               ; preds = %17
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = call noundef zeroext i1 @_ZN10primesieve14PrimeGenerator15sieveNextPrimesERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720) %15, ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef %25)
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  br label %130

28:                                               ; preds = %23
  br label %29

29:                                               ; preds = %28, %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load i64, ptr %30, align 8, !tbaa !9
  store i64 %31, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call noundef i64 @_ZNK10primesieve6VectorImSaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #6
  store i64 %33, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %34 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %15, i32 0, i32 2
  %35 = load i64, ptr %34, align 8, !tbaa !28
  store i64 %35, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %36 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %15, i32 0, i32 4
  %37 = load i64, ptr %36, align 8, !tbaa !11
  store i64 %37, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %38 = getelementptr inbounds %"class.primesieve::Erat", ptr %15, i32 0, i32 4
  %39 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #6
  store i64 %39, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %40 = getelementptr inbounds %"class.primesieve::Erat", ptr %15, i32 0, i32 4
  %41 = call noundef ptr @_ZN10primesieve6VectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %40) #6
  store ptr %41, ptr %12, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %117, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = load i64, ptr %10, align 8, !tbaa !9
  %45 = getelementptr inbounds i8, ptr %43, i64 %44
  %46 = call noundef i64 @_ZN12_GLOBAL__N_117littleendian_castImEET_PKh(ptr noundef %45)
  store i64 %46, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %47 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %47, ptr %14, align 8, !tbaa !9
  %48 = load i64, ptr %13, align 8, !tbaa !9
  %49 = call noundef i64 @_ZN12_GLOBAL__N_18popcnt64Em(i64 noundef %48)
  %50 = load i64, ptr %7, align 8, !tbaa !9
  %51 = add i64 %50, %49
  store i64 %51, ptr %7, align 8, !tbaa !9
  br label %52

52:                                               ; preds = %99, %42
  %53 = load i64, ptr %13, align 8, !tbaa !9
  %54 = load i64, ptr %9, align 8, !tbaa !9
  %55 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %53, i64 noundef %54)
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = load i64, ptr %14, align 8, !tbaa !9
  %58 = add i64 %57, 0
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %56, i64 noundef %58) #6
  store i64 %55, ptr %59, align 8, !tbaa !9
  %60 = load i64, ptr %13, align 8, !tbaa !9
  %61 = sub i64 %60, 1
  %62 = load i64, ptr %13, align 8, !tbaa !9
  %63 = and i64 %62, %61
  store i64 %63, ptr %13, align 8, !tbaa !9
  %64 = load i64, ptr %13, align 8, !tbaa !9
  %65 = load i64, ptr %9, align 8, !tbaa !9
  %66 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %64, i64 noundef %65)
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = load i64, ptr %14, align 8, !tbaa !9
  %69 = add i64 %68, 1
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %67, i64 noundef %69) #6
  store i64 %66, ptr %70, align 8, !tbaa !9
  %71 = load i64, ptr %13, align 8, !tbaa !9
  %72 = sub i64 %71, 1
  %73 = load i64, ptr %13, align 8, !tbaa !9
  %74 = and i64 %73, %72
  store i64 %74, ptr %13, align 8, !tbaa !9
  %75 = load i64, ptr %13, align 8, !tbaa !9
  %76 = load i64, ptr %9, align 8, !tbaa !9
  %77 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %75, i64 noundef %76)
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = load i64, ptr %14, align 8, !tbaa !9
  %80 = add i64 %79, 2
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %78, i64 noundef %80) #6
  store i64 %77, ptr %81, align 8, !tbaa !9
  %82 = load i64, ptr %13, align 8, !tbaa !9
  %83 = sub i64 %82, 1
  %84 = load i64, ptr %13, align 8, !tbaa !9
  %85 = and i64 %84, %83
  store i64 %85, ptr %13, align 8, !tbaa !9
  %86 = load i64, ptr %13, align 8, !tbaa !9
  %87 = load i64, ptr %9, align 8, !tbaa !9
  %88 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %86, i64 noundef %87)
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = load i64, ptr %14, align 8, !tbaa !9
  %91 = add i64 %90, 3
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %89, i64 noundef %91) #6
  store i64 %88, ptr %92, align 8, !tbaa !9
  %93 = load i64, ptr %13, align 8, !tbaa !9
  %94 = sub i64 %93, 1
  %95 = load i64, ptr %13, align 8, !tbaa !9
  %96 = and i64 %95, %94
  store i64 %96, ptr %13, align 8, !tbaa !9
  %97 = load i64, ptr %14, align 8, !tbaa !9
  %98 = add i64 %97, 4
  store i64 %98, ptr %14, align 8, !tbaa !9
  br label %99

99:                                               ; preds = %52
  %100 = load i64, ptr %14, align 8, !tbaa !9
  %101 = load i64, ptr %7, align 8, !tbaa !9
  %102 = icmp ult i64 %100, %101
  br i1 %102, label %52, label %103, !llvm.loop !29

103:                                              ; preds = %99
  %104 = load i64, ptr %9, align 8, !tbaa !9
  %105 = add i64 %104, 240
  store i64 %105, ptr %9, align 8, !tbaa !9
  %106 = load i64, ptr %10, align 8, !tbaa !9
  %107 = add i64 %106, 8
  store i64 %107, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %108

108:                                              ; preds = %103
  %109 = load i64, ptr %7, align 8, !tbaa !9
  %110 = load i64, ptr %8, align 8, !tbaa !9
  %111 = sub i64 %110, 64
  %112 = icmp ule i64 %109, %111
  br i1 %112, label %113, label %117

113:                                              ; preds = %108
  %114 = load i64, ptr %10, align 8, !tbaa !9
  %115 = load i64, ptr %11, align 8, !tbaa !9
  %116 = icmp ult i64 %114, %115
  br label %117

117:                                              ; preds = %113, %108
  %118 = phi i1 [ false, %108 ], [ %116, %113 ]
  br i1 %118, label %42, label %119, !llvm.loop !31

119:                                              ; preds = %117
  %120 = load i64, ptr %9, align 8, !tbaa !9
  %121 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %15, i32 0, i32 2
  store i64 %120, ptr %121, align 8, !tbaa !28
  %122 = load i64, ptr %10, align 8, !tbaa !9
  %123 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %15, i32 0, i32 4
  store i64 %122, ptr %123, align 8, !tbaa !11
  %124 = load i64, ptr %7, align 8, !tbaa !9
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  store i64 %124, ptr %125, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %126

126:                                              ; preds = %119
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = load i64, ptr %127, align 8, !tbaa !9
  %129 = icmp eq i64 %128, 0
  br i1 %129, label %17, label %130, !llvm.loop !32

130:                                              ; preds = %126, %27
  ret void
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_117littleendian_castImEET_PKh(ptr noundef) #3

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { alwaysinline 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 = { 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 #6 = { nounwind }

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

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


; 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"

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN10primesieve14PrimeGenerator15sieveNextPrimesERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10primesieve14PrimeGenerator22fillNextPrimes_defaultERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  store i64 0, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 304
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = getelementptr inbounds i8, ptr %0, i64 288
  br label %7

7:                                                ; preds = %53, %3
  %8 = load i64, ptr %4, align 8, !tbaa !9
  %9 = tail call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  %.not = icmp ult i64 %8, %9
  br i1 %.not, label %12, label %10

10:                                               ; preds = %7
  %11 = tail call noundef zeroext i1 @_ZN10primesieve14PrimeGenerator15sieveNextPrimesERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull %2)
  br i1 %11, label %12, label %55

12:                                               ; preds = %10, %7
  %13 = load i64, ptr %2, align 8, !tbaa !5
  %14 = tail call noundef i64 @_ZNK10primesieve6VectorImSaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  %15 = load i64, ptr %6, align 8, !tbaa !27
  %16 = load i64, ptr %4, align 8, !tbaa !9
  %17 = tail call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  %18 = tail call noundef ptr @_ZN10primesieve6VectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  %19 = add i64 %14, -64
  br label %20

20:                                               ; preds = %47, %12
  %.051 = phi i64 [ %16, %12 ], [ %49, %47 ]
  %.050 = phi i64 [ %15, %12 ], [ %48, %47 ]
  %.049 = phi i64 [ %13, %12 ], [ %24, %47 ]
  %21 = getelementptr inbounds i8, ptr %18, i64 %.051
  %22 = tail call noundef i64 @_ZN12_GLOBAL__N_117littleendian_castImEET_PKh(ptr noundef %21)
  %23 = tail call noundef i64 @_ZN12_GLOBAL__N_18popcnt64Em(i64 noundef %22)
  %24 = add i64 %23, %.049
  br label %25

25:                                               ; preds = %25, %20
  %.048 = phi i64 [ %22, %20 ], [ %44, %25 ]
  %.0 = phi i64 [ %.049, %20 ], [ %45, %25 ]
  %26 = tail call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %.048, i64 noundef %.050)
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.0) #5
  store i64 %26, ptr %27, align 8, !tbaa !5
  %28 = add i64 %.048, -1
  %29 = and i64 %28, %.048
  %30 = tail call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %29, i64 noundef %.050)
  %31 = add i64 %.0, 1
  %32 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %31) #5
  store i64 %30, ptr %32, align 8, !tbaa !5
  %33 = add i64 %29, -1
  %34 = and i64 %33, %29
  %35 = tail call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %34, i64 noundef %.050)
  %36 = add i64 %.0, 2
  %37 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %36) #5
  store i64 %35, ptr %37, align 8, !tbaa !5
  %38 = add i64 %34, -1
  %39 = and i64 %38, %34
  %40 = tail call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %39, i64 noundef %.050)
  %41 = add i64 %.0, 3
  %42 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %41) #5
  store i64 %40, ptr %42, align 8, !tbaa !5
  %43 = add i64 %39, -1
  %44 = and i64 %43, %39
  %45 = add i64 %.0, 4
  %46 = icmp ult i64 %45, %24
  br i1 %46, label %25, label %47, !llvm.loop !28

47:                                               ; preds = %25
  %48 = add i64 %.050, 240
  %49 = add i64 %.051, 8
  %50 = icmp ule i64 %24, %19
  %51 = icmp ult i64 %49, %17
  %52 = and i1 %51, %50
  br i1 %52, label %20, label %53, !llvm.loop !30

53:                                               ; preds = %47
  store i64 %48, ptr %6, align 8, !tbaa !27
  store i64 %49, ptr %4, align 8, !tbaa !9
  store i64 %24, ptr %2, align 8, !tbaa !5
  %54 = icmp eq i64 %24, 0
  br i1 %54, label %7, label %55, !llvm.loop !31

55:                                               ; preds = %10, %53
  ret void
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_117littleendian_castImEET_PKh(ptr noundef) local_unnamed_addr #2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_18popcnt64Em(i64 noundef) local_unnamed_addr #3

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

attributes #0 = { 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 #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 = { 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 #3 = { alwaysinline 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 #4 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 304}
!10 = !{!"_ZTSN10primesieve14PrimeGeneratorE", !11, i64 0, !21, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !22, i64 312, !24, i64 352}
!11 = !{!"_ZTSN10primesieve4EratE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !6, i64 56, !6, i64 64, !14, i64 72, !17, i64 128, !20, i64 200}
!12 = !{!"_ZTSN10primesieve6VectorIhSaIhEEE", !13, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"_ZTSN10primesieve9EratSmallE", !15, i64 0, !6, i64 16, !6, i64 24, !16, i64 32}
!15 = !{!"_ZTSN10primesieve5WheelILi30ELi8ELi6EXadsoKNS_9WheelInitEL_ZNS_11wheel30InitEEEEEE", !6, i64 8}
!16 = !{!"_ZTSN10primesieve6VectorINS_12SievingPrimeESaIS1_EEE", !13, i64 0, !13, i64 8, !13, i64 16}
!17 = !{!"_ZTSN10primesieve7EratBigE", !18, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !19, i64 48}
!18 = !{!"_ZTSN10primesieve5WheelILi210ELi48ELi10EXadsoKNS_9WheelInitEL_ZNS_12wheel210InitEEEEEE", !6, i64 8}
!19 = !{!"_ZTSN10primesieve6VectorIPNS_12SievingPrimeESaIS2_EEE", !13, i64 0, !13, i64 8, !13, i64 16}
!20 = !{!"_ZTSN10primesieve10EratMediumE", !15, i64 0, !6, i64 16, !13, i64 24, !19, i64 32, !19, i64 56}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSN10primesieve10MemoryPoolE", !13, i64 0, !6, i64 8, !23, i64 16}
!23 = !{!"_ZTSN10primesieve6VectorINS0_IcSaIcEEESaIS2_EEE", !13, i64 0, !13, i64 8, !13, i64 16}
!24 = !{!"_ZTSN10primesieve13SievingPrimesE", !11, i64 0, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !25, i64 320, !26, i64 1344}
!25 = !{!"_ZTSN10primesieve5ArrayImLm128EEE", !7, i64 0}
!26 = !{!"_ZTSN10primesieve6VectorIbSaIbEEE", !13, i64 0, !13, i64 8, !13, i64 16}
!27 = !{!10, !6, i64 288}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}
!31 = distinct !{!31, !29}


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