; LLVM IR from kimwalisch/primesieve :: src/PrimeSieveClass.ll (ZN10primesieve10PrimeSieveC2Ev)

; 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::PrimeSieve" = type { ptr, i64, i64, double, double, %"class.primesieve::Array", i64, i64, i32, i32, ptr }
%"class.primesieve::Array" = type { [6 x i64] }

@_ZTVN10primesieve10PrimeSieveE = external dso_local unnamed_addr constant { [5 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10primesieve10PrimeSieveC2Ev(ptr noundef nonnull align 8 dereferenceable(120) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr] }, ptr @_ZTVN10primesieve10PrimeSieveE, i32 0, i32 0, i32 2), ptr %4, align 8, !tbaa !9
  %5 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 1
  store i64 0, ptr %5, align 8, !tbaa !11
  %6 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 2
  store i64 0, ptr %6, align 8, !tbaa !17
  %7 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 3
  store double 0.000000e+00, ptr %7, align 8, !tbaa !18
  %8 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 4
  store double 0.000000e+00, ptr %8, align 8, !tbaa !19
  %9 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 5
  %10 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 6
  store i64 0, ptr %10, align 8, !tbaa !20
  %11 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 7
  store i64 0, ptr %11, align 8, !tbaa !21
  %12 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 8
  store i32 1, ptr %12, align 8, !tbaa !22
  %13 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 9
  store i32 0, ptr %13, align 4, !tbaa !23
  %14 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %4, i32 0, i32 10
  store ptr null, ptr %14, align 8, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %15 = call noundef i32 @_ZN10primesieve14get_sieve_sizeEv()
  store i32 %15, ptr %3, align 4, !tbaa !25
  %16 = load i32, ptr %3, align 4, !tbaa !25
  call void @_ZN10primesieve10PrimeSieve12setSieveSizeEi(ptr noundef nonnull align 8 dereferenceable(120) %4, i32 noundef %16)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

declare noundef i32 @_ZN10primesieve14get_sieve_sizeEv() #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve10PrimeSieve12setSieveSizeEi(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) #0 align 2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSN10primesieve10PrimeSieveE", !13, i64 8, !13, i64 16, !14, i64 24, !14, i64 32, !15, i64 40, !13, i64 88, !13, i64 96, !16, i64 104, !16, i64 108, !6, i64 112}
!13 = !{!"long", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTSN10primesieve5ArrayImLm6EEE", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!12, !13, i64 16}
!18 = !{!12, !14, i64 24}
!19 = !{!12, !14, i64 32}
!20 = !{!12, !13, i64 88}
!21 = !{!12, !13, i64 96}
!22 = !{!12, !16, i64 104}
!23 = !{!12, !16, i64 108}
!24 = !{!12, !6, i64 112}
!25 = !{!16, !16, i64 0}


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

@_ZTVN10primesieve10PrimeSieveE = external dso_local unnamed_addr constant { [5 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10primesieve10PrimeSieveC2Ev(ptr noundef nonnull align 8 dereferenceable(120) %0) unnamed_addr #0 align 2 {
  store ptr getelementptr inbounds inrange(-16, 24) (i8, ptr @_ZTVN10primesieve10PrimeSieveE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = getelementptr inbounds i8, ptr %0, i64 88
  %4 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %2, i8 0, i64 32, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, i8 0, i64 16, i1 false)
  store i32 1, ptr %4, align 8, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 0, ptr %5, align 4, !tbaa !16
  %6 = getelementptr inbounds i8, ptr %0, i64 112
  store ptr null, ptr %6, align 8, !tbaa !17
  %7 = tail call noundef i32 @_ZN10primesieve14get_sieve_sizeEv()
  tail call void @_ZN10primesieve10PrimeSieve12setSieveSizeEi(ptr noundef nonnull align 8 dereferenceable(120) %0, i32 noundef %7)
  ret void
}

declare noundef i32 @_ZN10primesieve14get_sieve_sizeEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve10PrimeSieve12setSieveSizeEi(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !14, i64 104}
!9 = !{!"_ZTSN10primesieve10PrimeSieveE", !10, i64 8, !10, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !10, i64 88, !10, i64 96, !14, i64 104, !14, i64 108, !15, i64 112}
!10 = !{!"long", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"double", !11, i64 0}
!13 = !{!"_ZTSN10primesieve5ArrayImLm6EEE", !11, i64 0}
!14 = !{!"int", !11, i64 0}
!15 = !{!"any pointer", !11, i64 0}
!16 = !{!9, !14, i64 108}
!17 = !{!9, !15, i64 112}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass