; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src/ap.ll (ZN11alglib_impl20ae_shared_pool_clearEPv)

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

%"struct.alglib_impl::ae_shared_pool" = type { %"struct.alglib_impl::ae_lock", ptr, ptr, ptr, ptr, i64, ptr, ptr, ptr, %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_lock" = type { ptr, %"struct.alglib_impl::ae_dyn_block", i8 }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, 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 uwtable
define dso_local void @_ZN11alglib_impl20ae_shared_pool_clearEPv(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %4, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN11alglib_implL28ae_shared_pool_internalclearEPNS_14ae_shared_poolE(ptr noundef %5)
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %6, i32 0, i32 1
  store volatile ptr null, ptr %7, align 8, !tbaa !9
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %8, i32 0, i32 2
  store volatile ptr null, ptr %9, align 8, !tbaa !15
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %10, i32 0, i32 3
  store volatile ptr null, ptr %11, align 8, !tbaa !16
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %12, i32 0, i32 4
  store volatile ptr null, ptr %13, align 8, !tbaa !17
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %14, i32 0, i32 5
  store i64 0, ptr %15, align 8, !tbaa !18
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %16, i32 0, i32 6
  store ptr null, ptr %17, align 8, !tbaa !19
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %18, i32 0, i32 7
  store ptr null, ptr %19, align 8, !tbaa !20
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %20, i32 0, i32 8
  store ptr null, ptr %21, align 8, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL28ae_shared_pool_internalclearEPNS_14ae_shared_poolE(ptr noundef) #1

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 = { 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, !6, i64 48}
!10 = !{!"_ZTSN11alglib_impl14ae_shared_poolE", !11, i64 0, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !14, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !12, i64 112}
!11 = !{!"_ZTSN11alglib_impl7ae_lockE", !6, i64 0, !12, i64 8, !13, i64 40}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !6, i64 56}
!16 = !{!10, !6, i64 64}
!17 = !{!10, !6, i64 72}
!18 = !{!10, !14, i64 80}
!19 = !{!10, !6, i64 88}
!20 = !{!10, !6, i64 96}
!21 = !{!10, !6, i64 104}


; 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 uwtable
define dso_local void @_ZN11alglib_impl20ae_shared_pool_clearEPv(ptr noundef %0) local_unnamed_addr #0 {
  tail call void @_ZN11alglib_implL28ae_shared_pool_internalclearEPNS_14ae_shared_poolE(ptr noundef %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 48
  store volatile ptr null, ptr %2, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 56
  store volatile ptr null, ptr %3, align 8, !tbaa !14
  %4 = getelementptr inbounds i8, ptr %0, i64 64
  store volatile ptr null, ptr %4, align 8, !tbaa !15
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  store volatile ptr null, ptr %5, align 8, !tbaa !16
  %6 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %6, i8 0, i64 32, i1 false)
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL28ae_shared_pool_internalclearEPNS_14ae_shared_poolE(ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 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, !8, i64 48}
!6 = !{!"_ZTSN11alglib_impl14ae_shared_poolE", !7, i64 0, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !13, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !11, i64 112}
!7 = !{!"_ZTSN11alglib_impl7ae_lockE", !8, i64 0, !11, i64 8, !12, i64 40}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"long", !9, i64 0}
!14 = !{!6, !8, i64 56}
!15 = !{!6, !8, i64 64}
!16 = !{!6, !8, i64 72}


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