; 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 @_ZN10primesieve14PrimeGenerator15sievePrevPrimesERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

; 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) #4

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10primesieve14PrimeGenerator22fillPrevPrimes_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 ptr, align 8
  %12 = alloca i64, align 8
  %13 = 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
  %14 = load ptr, ptr %4, align 8
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %16

16:                                               ; preds = %116, %3
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = call noundef zeroext i1 @_ZN10primesieve14PrimeGenerator15sievePrevPrimesERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720) %14, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef %18)
  br i1 %19, label %20, label %123

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load i64, ptr %21, align 8, !tbaa !9
  store i64 %22, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %23 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %14, i32 0, i32 2
  %24 = load i64, ptr %23, align 8, !tbaa !11
  store i64 %24, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %25 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %14, i32 0, i32 4
  %26 = load i64, ptr %25, align 8, !tbaa !28
  store i64 %26, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %27 = getelementptr inbounds %"class.primesieve::Erat", ptr %14, i32 0, i32 4
  %28 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #7
  store i64 %28, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %29 = getelementptr inbounds %"class.primesieve::Erat", ptr %14, i32 0, i32 4
  %30 = call noundef ptr @_ZN10primesieve6VectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #7
  store ptr %30, ptr %11, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %111, %20
  %32 = load i64, ptr %9, align 8, !tbaa !9
  %33 = load i64, ptr %10, align 8, !tbaa !9
  %34 = icmp ult i64 %32, %33
  br i1 %34, label %35, label %116

35:                                               ; preds = %31
  %36 = load i64, ptr %7, align 8, !tbaa !9
  %37 = add i64 %36, 64
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = call noundef i64 @_ZNK10primesieve6VectorImSaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #7
  %40 = icmp ugt i64 %37, %39
  %41 = xor i1 %40, true
  %42 = xor i1 %41, true
  %43 = zext i1 %42 to i64
  %44 = call i64 @llvm.expect.i64(i64 %43, i64 0)
  %45 = icmp ne i64 %44, 0
  br i1 %45, label %46, label %50

46:                                               ; preds = %35
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load i64, ptr %7, align 8, !tbaa !9
  %49 = add i64 %48, 64
  call void @_ZN10primesieve6VectorImSaImEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef %49)
  br label %50

50:                                               ; preds = %46, %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = load i64, ptr %9, align 8, !tbaa !9
  %53 = getelementptr inbounds i8, ptr %51, i64 %52
  %54 = call noundef i64 @_ZN12_GLOBAL__N_117littleendian_castImEET_PKh(ptr noundef %53)
  store i64 %54, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %55 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %55, ptr %13, align 8, !tbaa !9
  %56 = load i64, ptr %12, align 8, !tbaa !9
  %57 = call noundef i64 @_ZN12_GLOBAL__N_18popcnt64Em(i64 noundef %56)
  %58 = load i64, ptr %7, align 8, !tbaa !9
  %59 = add i64 %58, %57
  store i64 %59, ptr %7, align 8, !tbaa !9
  br label %60

60:                                               ; preds = %107, %50
  %61 = load i64, ptr %12, align 8, !tbaa !9
  %62 = load i64, ptr %8, align 8, !tbaa !9
  %63 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %61, i64 noundef %62)
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = load i64, ptr %13, align 8, !tbaa !9
  %66 = add i64 %65, 0
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %66) #7
  store i64 %63, ptr %67, align 8, !tbaa !9
  %68 = load i64, ptr %12, align 8, !tbaa !9
  %69 = sub i64 %68, 1
  %70 = load i64, ptr %12, align 8, !tbaa !9
  %71 = and i64 %70, %69
  store i64 %71, ptr %12, align 8, !tbaa !9
  %72 = load i64, ptr %12, align 8, !tbaa !9
  %73 = load i64, ptr %8, align 8, !tbaa !9
  %74 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %72, i64 noundef %73)
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = load i64, ptr %13, align 8, !tbaa !9
  %77 = add i64 %76, 1
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %75, i64 noundef %77) #7
  store i64 %74, ptr %78, align 8, !tbaa !9
  %79 = load i64, ptr %12, align 8, !tbaa !9
  %80 = sub i64 %79, 1
  %81 = load i64, ptr %12, align 8, !tbaa !9
  %82 = and i64 %81, %80
  store i64 %82, ptr %12, align 8, !tbaa !9
  %83 = load i64, ptr %12, align 8, !tbaa !9
  %84 = load i64, ptr %8, align 8, !tbaa !9
  %85 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %83, i64 noundef %84)
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = load i64, ptr %13, align 8, !tbaa !9
  %88 = add i64 %87, 2
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef %88) #7
  store i64 %85, ptr %89, align 8, !tbaa !9
  %90 = load i64, ptr %12, align 8, !tbaa !9
  %91 = sub i64 %90, 1
  %92 = load i64, ptr %12, align 8, !tbaa !9
  %93 = and i64 %92, %91
  store i64 %93, ptr %12, align 8, !tbaa !9
  %94 = load i64, ptr %12, align 8, !tbaa !9
  %95 = load i64, ptr %8, align 8, !tbaa !9
  %96 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %94, i64 noundef %95)
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = load i64, ptr %13, align 8, !tbaa !9
  %99 = add i64 %98, 3
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve6VectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %97, i64 noundef %99) #7
  store i64 %96, ptr %100, align 8, !tbaa !9
  %101 = load i64, ptr %12, align 8, !tbaa !9
  %102 = sub i64 %101, 1
  %103 = load i64, ptr %12, align 8, !tbaa !9
  %104 = and i64 %103, %102
  store i64 %104, ptr %12, align 8, !tbaa !9
  %105 = load i64, ptr %13, align 8, !tbaa !9
  %106 = add i64 %105, 4
  store i64 %106, ptr %13, align 8, !tbaa !9
  br label %107

107:                                              ; preds = %60
  %108 = load i64, ptr %13, align 8, !tbaa !9
  %109 = load i64, ptr %7, align 8, !tbaa !9
  %110 = icmp ult i64 %108, %109
  br i1 %110, label %60, label %111, !llvm.loop !29

111:                                              ; preds = %107
  %112 = load i64, ptr %8, align 8, !tbaa !9
  %113 = add i64 %112, 240
  store i64 %113, ptr %8, align 8, !tbaa !9
  %114 = load i64, ptr %9, align 8, !tbaa !9
  %115 = add i64 %114, 8
  store i64 %115, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %31, !llvm.loop !31

116:                                              ; preds = %31
  %117 = load i64, ptr %8, align 8, !tbaa !9
  %118 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %14, i32 0, i32 2
  store i64 %117, ptr %118, align 8, !tbaa !11
  %119 = load i64, ptr %9, align 8, !tbaa !9
  %120 = getelementptr inbounds %"class.primesieve::PrimeGenerator", ptr %14, i32 0, i32 4
  store i64 %119, ptr %120, align 8, !tbaa !28
  %121 = load i64, ptr %7, align 8, !tbaa !9
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  store i64 %121, ptr %122, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %16, !llvm.loop !32

123:                                              ; preds = %16
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve6VectorImSaImEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 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 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { 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 #6 = { 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 #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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 288}
!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 304}
!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 @_ZN10primesieve14PrimeGenerator15sievePrevPrimesERNS_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 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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10primesieve14PrimeGenerator22fillPrevPrimes_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 = tail call noundef zeroext i1 @_ZN10primesieve14PrimeGenerator15sievePrevPrimesERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull %2)
  br i1 %4, label %.lr.ph60, label %._crit_edge61

.lr.ph60:                                         ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 288
  %6 = getelementptr inbounds i8, ptr %0, i64 304
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  br label %8

8:                                                ; preds = %.lr.ph60, %._crit_edge
  %9 = load i64, ptr %2, align 8, !tbaa !5
  %10 = load i64, ptr %5, align 8, !tbaa !9
  %11 = load i64, ptr %6, align 8, !tbaa !27
  %12 = tail call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %13 = tail call noundef ptr @_ZN10primesieve6VectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %14 = icmp ult i64 %11, %12
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %8, %46
  %.04956 = phi i64 [ %23, %46 ], [ %9, %8 ]
  %.05055 = phi i64 [ %47, %46 ], [ %10, %8 ]
  %.05154 = phi i64 [ %48, %46 ], [ %11, %8 ]
  %15 = add i64 %.04956, 64
  %16 = tail call noundef i64 @_ZNK10primesieve6VectorImSaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  %17 = icmp ugt i64 %15, %16
  br i1 %17, label %18, label %19, !prof !28

18:                                               ; preds = %.lr.ph
  tail call void @_ZN10primesieve6VectorImSaImEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %15)
  br label %19

19:                                               ; preds = %18, %.lr.ph
  %20 = getelementptr inbounds i8, ptr %13, i64 %.05154
  %21 = tail call noundef i64 @_ZN12_GLOBAL__N_117littleendian_castImEET_PKh(ptr noundef %20)
  %22 = tail call noundef i64 @_ZN12_GLOBAL__N_18popcnt64Em(i64 noundef %21)
  %23 = add i64 %22, %.04956
  br label %24

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

46:                                               ; preds = %24
  %47 = add i64 %.05055, 240
  %48 = add i64 %.05154, 8
  %49 = icmp ult i64 %48, %12
  br i1 %49, label %.lr.ph, label %._crit_edge, !llvm.loop !31

._crit_edge:                                      ; preds = %46, %8
  %.051.lcssa = phi i64 [ %11, %8 ], [ %48, %46 ]
  %.050.lcssa = phi i64 [ %10, %8 ], [ %47, %46 ]
  %.049.lcssa = phi i64 [ %9, %8 ], [ %23, %46 ]
  store i64 %.050.lcssa, ptr %5, align 8, !tbaa !9
  store i64 %.051.lcssa, ptr %6, align 8, !tbaa !27
  store i64 %.049.lcssa, ptr %2, align 8, !tbaa !5
  %50 = tail call noundef zeroext i1 @_ZN10primesieve14PrimeGenerator15sievePrevPrimesERNS_6VectorImSaImEEEPm(ptr noundef nonnull align 8 dereferenceable(1720) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull %2)
  br i1 %50, label %8, label %._crit_edge61, !llvm.loop !32

._crit_edge61:                                    ; preds = %._crit_edge, %3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve6VectorImSaImEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 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 288}
!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 304}
!28 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}
!32 = distinct !{!32, !30}


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