; LLVM IR from kimwalisch/primesieve :: src/SievingPrimes.ll (ZN10primesieve13SievingPrimes4fillEv)

; 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", %"class.primesieve::Vector.3" }
%"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" = type { [128 x i64] }
%"class.primesieve::Vector.3" = 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 noinline uwtable
define dso_local void @_ZN10primesieve13SievingPrimes4fillEv(ptr noundef nonnull align 8 dereferenceable(1368) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  %9 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 5
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds %"class.primesieve::Erat", ptr %8, i32 0, i32 4
  %12 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  %13 = icmp uge i64 %10, %12
  br i1 %13, label %14, label %18

14:                                               ; preds = %1
  %15 = call noundef zeroext i1 @_ZN10primesieve13SievingPrimes12sieveSegmentEv(ptr noundef nonnull align 8 dereferenceable(1368) %8)
  br i1 %15, label %17, label %16

16:                                               ; preds = %14
  br label %110

17:                                               ; preds = %14
  br label %18

18:                                               ; preds = %17, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %19 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 3
  %20 = load i64, ptr %19, align 8, !tbaa !24
  store i64 %20, ptr %4, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %21 = getelementptr inbounds %"class.primesieve::Erat", ptr %8, i32 0, i32 4
  %22 = call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %21) #7
  store i64 %22, ptr %5, align 8, !tbaa !23
  br label %23

23:                                               ; preds = %102, %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %24 = getelementptr inbounds %"class.primesieve::Erat", ptr %8, i32 0, i32 4
  %25 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 5
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN10primesieve6VectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %26) #7
  %28 = call noundef i64 @_ZN12_GLOBAL__N_117littleendian_castImEET_PKh(ptr noundef %27)
  store i64 %28, ptr %6, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %29 = load i64, ptr %3, align 8, !tbaa !23
  store i64 %29, ptr %7, align 8, !tbaa !23
  %30 = load i64, ptr %6, align 8, !tbaa !23
  %31 = call noundef i64 @_ZN12_GLOBAL__N_18popcnt64Em(i64 noundef %30)
  %32 = load i64, ptr %3, align 8, !tbaa !23
  %33 = add i64 %32, %31
  store i64 %33, ptr %3, align 8, !tbaa !23
  br label %34

34:                                               ; preds = %81, %23
  %35 = load i64, ptr %6, align 8, !tbaa !23
  %36 = load i64, ptr %4, align 8, !tbaa !23
  %37 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %35, i64 noundef %36)
  %38 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 6
  %39 = load i64, ptr %7, align 8, !tbaa !23
  %40 = add i64 %39, 0
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve5ArrayImLm128EEixEm(ptr noundef nonnull align 8 dereferenceable(1024) %38, i64 noundef %40) #7
  store i64 %37, ptr %41, align 8, !tbaa !23
  %42 = load i64, ptr %6, align 8, !tbaa !23
  %43 = sub i64 %42, 1
  %44 = load i64, ptr %6, align 8, !tbaa !23
  %45 = and i64 %44, %43
  store i64 %45, ptr %6, align 8, !tbaa !23
  %46 = load i64, ptr %6, align 8, !tbaa !23
  %47 = load i64, ptr %4, align 8, !tbaa !23
  %48 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %46, i64 noundef %47)
  %49 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 6
  %50 = load i64, ptr %7, align 8, !tbaa !23
  %51 = add i64 %50, 1
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve5ArrayImLm128EEixEm(ptr noundef nonnull align 8 dereferenceable(1024) %49, i64 noundef %51) #7
  store i64 %48, ptr %52, align 8, !tbaa !23
  %53 = load i64, ptr %6, align 8, !tbaa !23
  %54 = sub i64 %53, 1
  %55 = load i64, ptr %6, align 8, !tbaa !23
  %56 = and i64 %55, %54
  store i64 %56, ptr %6, align 8, !tbaa !23
  %57 = load i64, ptr %6, align 8, !tbaa !23
  %58 = load i64, ptr %4, align 8, !tbaa !23
  %59 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %57, i64 noundef %58)
  %60 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 6
  %61 = load i64, ptr %7, align 8, !tbaa !23
  %62 = add i64 %61, 2
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve5ArrayImLm128EEixEm(ptr noundef nonnull align 8 dereferenceable(1024) %60, i64 noundef %62) #7
  store i64 %59, ptr %63, align 8, !tbaa !23
  %64 = load i64, ptr %6, align 8, !tbaa !23
  %65 = sub i64 %64, 1
  %66 = load i64, ptr %6, align 8, !tbaa !23
  %67 = and i64 %66, %65
  store i64 %67, ptr %6, align 8, !tbaa !23
  %68 = load i64, ptr %6, align 8, !tbaa !23
  %69 = load i64, ptr %4, align 8, !tbaa !23
  %70 = call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %68, i64 noundef %69)
  %71 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 6
  %72 = load i64, ptr %7, align 8, !tbaa !23
  %73 = add i64 %72, 3
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve5ArrayImLm128EEixEm(ptr noundef nonnull align 8 dereferenceable(1024) %71, i64 noundef %73) #7
  store i64 %70, ptr %74, align 8, !tbaa !23
  %75 = load i64, ptr %6, align 8, !tbaa !23
  %76 = sub i64 %75, 1
  %77 = load i64, ptr %6, align 8, !tbaa !23
  %78 = and i64 %77, %76
  store i64 %78, ptr %6, align 8, !tbaa !23
  %79 = load i64, ptr %7, align 8, !tbaa !23
  %80 = add i64 %79, 4
  store i64 %80, ptr %7, align 8, !tbaa !23
  br label %81

81:                                               ; preds = %34
  %82 = load i64, ptr %7, align 8, !tbaa !23
  %83 = load i64, ptr %3, align 8, !tbaa !23
  %84 = icmp ult i64 %82, %83
  br i1 %84, label %34, label %85, !llvm.loop !25

85:                                               ; preds = %81
  %86 = load i64, ptr %4, align 8, !tbaa !23
  %87 = add i64 %86, 240
  store i64 %87, ptr %4, align 8, !tbaa !23
  %88 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 5
  %89 = load i64, ptr %88, align 8, !tbaa !9
  %90 = add i64 %89, 8
  store i64 %90, ptr %88, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %91

91:                                               ; preds = %85
  %92 = load i64, ptr %3, align 8, !tbaa !23
  %93 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 6
  %94 = call noundef i64 @_ZNK10primesieve5ArrayImLm128EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(1024) %93) #7
  %95 = sub i64 %94, 64
  %96 = icmp ule i64 %92, %95
  br i1 %96, label %97, label %102

97:                                               ; preds = %91
  %98 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 5
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = load i64, ptr %5, align 8, !tbaa !23
  %101 = icmp ult i64 %99, %100
  br label %102

102:                                              ; preds = %97, %91
  %103 = phi i1 [ false, %91 ], [ %101, %97 ]
  br i1 %103, label %23, label %104, !llvm.loop !27

104:                                              ; preds = %102
  %105 = load i64, ptr %4, align 8, !tbaa !23
  %106 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 3
  store i64 %105, ptr %106, align 8, !tbaa !24
  %107 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 1
  store i64 0, ptr %107, align 8, !tbaa !28
  %108 = load i64, ptr %3, align 8, !tbaa !23
  %109 = getelementptr inbounds %"class.primesieve::SievingPrimes", ptr %8, i32 0, i32 2
  store i64 %108, ptr %109, align 8, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %110

110:                                              ; preds = %104, %16
  ret void
}

; 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 dso_local noundef zeroext i1 @_ZN10primesieve13SievingPrimes12sieveSegmentEv(ptr noundef nonnull align 8 dereferenceable(1368)) #3 align 2

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { 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, !12, i64 312}
!10 = !{!"_ZTSN10primesieve13SievingPrimesE", !11, i64 0, !12, i64 280, !12, i64 288, !12, i64 296, !12, i64 304, !12, i64 312, !21, i64 320, !22, i64 1344}
!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 = !{!"_ZTSN10primesieve5ArrayImLm128EEE", !7, i64 0}
!22 = !{!"_ZTSN10primesieve6VectorIbSaIbEEE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!12, !12, i64 0}
!24 = !{!10, !12, i64 296}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}
!28 = !{!10, !12, i64 280}
!29 = !{!10, !12, i64 288}


; 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 noinline uwtable
define dso_local void @_ZN10primesieve13SievingPrimes4fillEv(ptr noundef nonnull align 8 dereferenceable(1368) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 312
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = tail call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %.not = icmp ult i64 %3, %5
  br i1 %.not, label %8, label %6

6:                                                ; preds = %1
  %7 = tail call noundef zeroext i1 @_ZN10primesieve13SievingPrimes12sieveSegmentEv(ptr noundef nonnull align 8 dereferenceable(1368) %0)
  br i1 %7, label %8, label %51

8:                                                ; preds = %6, %1
  %9 = getelementptr inbounds i8, ptr %0, i64 296
  %10 = load i64, ptr %9, align 8, !tbaa !22
  %11 = tail call noundef i64 @_ZNK10primesieve6VectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %12 = getelementptr inbounds i8, ptr %0, i64 320
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %41, %8
  %14 = phi i64 [ %.pre, %8 ], [ %47, %41 ]
  %.033 = phi i64 [ %10, %8 ], [ %42, %41 ]
  %.032 = phi i64 [ 0, %8 ], [ %18, %41 ]
  %15 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZN10primesieve6VectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %14) #6
  %16 = tail call noundef i64 @_ZN12_GLOBAL__N_117littleendian_castImEET_PKh(ptr noundef nonnull %15)
  %17 = tail call noundef i64 @_ZN12_GLOBAL__N_18popcnt64Em(i64 noundef %16)
  %18 = add i64 %17, %.032
  br label %19

19:                                               ; preds = %19, %13
  %.031 = phi i64 [ %16, %13 ], [ %38, %19 ]
  %.0 = phi i64 [ %.032, %13 ], [ %39, %19 ]
  %20 = tail call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %.031, i64 noundef %.033)
  %21 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve5ArrayImLm128EEixEm(ptr noundef nonnull align 8 dereferenceable(1024) %12, i64 noundef %.0) #6
  store i64 %20, ptr %21, align 8, !tbaa !23
  %22 = add i64 %.031, -1
  %23 = and i64 %22, %.031
  %24 = tail call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %23, i64 noundef %.033)
  %25 = add i64 %.0, 1
  %26 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve5ArrayImLm128EEixEm(ptr noundef nonnull align 8 dereferenceable(1024) %12, i64 noundef %25) #6
  store i64 %24, ptr %26, align 8, !tbaa !23
  %27 = add i64 %23, -1
  %28 = and i64 %27, %23
  %29 = tail call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %28, i64 noundef %.033)
  %30 = add i64 %.0, 2
  %31 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve5ArrayImLm128EEixEm(ptr noundef nonnull align 8 dereferenceable(1024) %12, i64 noundef %30) #6
  store i64 %29, ptr %31, align 8, !tbaa !23
  %32 = add i64 %28, -1
  %33 = and i64 %32, %28
  %34 = tail call noundef i64 @_ZN10primesieve4Erat9nextPrimeEmm(i64 noundef %33, i64 noundef %.033)
  %35 = add i64 %.0, 3
  %36 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10primesieve5ArrayImLm128EEixEm(ptr noundef nonnull align 8 dereferenceable(1024) %12, i64 noundef %35) #6
  store i64 %34, ptr %36, align 8, !tbaa !23
  %37 = add i64 %33, -1
  %38 = and i64 %37, %33
  %39 = add i64 %.0, 4
  %40 = icmp ult i64 %39, %18
  br i1 %40, label %19, label %41, !llvm.loop !24

41:                                               ; preds = %19
  %42 = add i64 %.033, 240
  %43 = load i64, ptr %2, align 8, !tbaa !5
  %44 = add i64 %43, 8
  store i64 %44, ptr %2, align 8, !tbaa !5
  %45 = tail call noundef i64 @_ZNK10primesieve5ArrayImLm128EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(1024) %12) #6
  %46 = add i64 %45, -64
  %.not35 = icmp ule i64 %18, %46
  %47 = load i64, ptr %2, align 8
  %48 = icmp ult i64 %47, %11
  %or.cond = select i1 %.not35, i1 %48, i1 false
  br i1 %or.cond, label %13, label %.critedge, !llvm.loop !26

.critedge:                                        ; preds = %41
  store i64 %42, ptr %9, align 8, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %0, i64 280
  store i64 0, ptr %49, align 8, !tbaa !27
  %50 = getelementptr inbounds i8, ptr %0, i64 288
  store i64 %18, ptr %50, align 8, !tbaa !28
  br label %51

51:                                               ; preds = %6, %.critedge
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN10primesieve13SievingPrimes12sieveSegmentEv(ptr noundef nonnull align 8 dereferenceable(1368)) local_unnamed_addr #2 align 2

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

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

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

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

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

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

attributes #0 = { 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 #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, !8, i64 312}
!6 = !{!"_ZTSN10primesieve13SievingPrimesE", !7, i64 0, !8, i64 280, !8, i64 288, !8, i64 296, !8, i64 304, !8, i64 312, !20, i64 320, !21, i64 1344}
!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 = !{!"_ZTSN10primesieve5ArrayImLm128EEE", !9, i64 0}
!21 = !{!"_ZTSN10primesieve6VectorIbSaIbEEE", !12, i64 0, !12, i64 8, !12, i64 16}
!22 = !{!6, !8, i64 296}
!23 = !{!8, !8, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = !{!6, !8, i64 280}
!28 = !{!6, !8, i64 288}


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