; LLVM IR from dynexcoin/Dynex :: src/Transfers (TransfersSubscription)

; 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.std::vector.26" = type { %"struct.std::_Vector_base.27" }
%"struct.std::_Vector_base.27" = type { %"struct.std::_Vector_base<Crypto::Hash, std::allocator<Crypto::Hash>>::_Vector_impl" }
%"struct.std::_Vector_base<Crypto::Hash, std::allocator<Crypto::Hash>>::_Vector_impl" = type { %"struct.std::_Vector_base<Crypto::Hash, std::allocator<Crypto::Hash>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Crypto::Hash, std::allocator<Crypto::Hash>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::error_code" = type { i32, ptr }
%"class.DynexCN::TransfersSubscription" = type { %"class.DynexCN::IObservableImpl", %"class.Logging::LoggerRef", %"class.DynexCN::TransfersContainer", %"struct.DynexCN::AccountSubscription" }
%"class.DynexCN::IObservableImpl" = type { %"class.DynexCN::ITransfersSubscription", %"class.Tools::ObserverManager" }
%"class.DynexCN::ITransfersSubscription" = type { %"class.DynexCN::IObservable" }
%"class.DynexCN::IObservable" = type { ptr }
%"class.Tools::ObserverManager" = type { %"class.std::vector", %"class.std::mutex" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<DynexCN::ITransfersObserver *, std::allocator<DynexCN::ITransfersObserver *>>::_Vector_impl" }
%"struct.std::_Vector_base<DynexCN::ITransfersObserver *, std::allocator<DynexCN::ITransfersObserver *>>::_Vector_impl" = type { %"struct.std::_Vector_base<DynexCN::ITransfersObserver *, std::allocator<DynexCN::ITransfersObserver *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<DynexCN::ITransfersObserver *, std::allocator<DynexCN::ITransfersObserver *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.Logging::LoggerRef" = type { ptr, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.DynexCN::TransfersContainer" = type { %"class.DynexCN::ITransfersContainer", %"class.boost::multi_index::multi_index_container", %"class.boost::multi_index::multi_index_container.7", %"class.boost::multi_index::multi_index_container.7", %"class.boost::multi_index::multi_index_container.16", i32, i64, ptr, %"class.std::mutex", %"class.Logging::LoggerRef" }
%"class.DynexCN::ITransfersContainer" = type { %"class.DynexCN::IStreamSerializable" }
%"class.DynexCN::IStreamSerializable" = type { ptr }
%"class.boost::multi_index::multi_index_container" = type { [8 x i8], %"struct.boost::multi_index::detail::header_holder", %"class.boost::multi_index::detail::hashed_index", i64 }
%"struct.boost::multi_index::detail::header_holder" = type { ptr }
%"class.boost::multi_index::detail::hashed_index" = type { [8 x i8], %"class.boost::multi_index::detail::bucket_array", float, i64 }
%"class.boost::multi_index::detail::bucket_array" = type { i64, %"struct.boost::multi_index::detail::auto_space" }
%"struct.boost::multi_index::detail::auto_space" = type { [8 x i8], i64, ptr }
%"class.boost::multi_index::multi_index_container.7" = type { [8 x i8], %"struct.boost::multi_index::detail::header_holder.9", %"class.boost::multi_index::detail::hashed_index.10", i64 }
%"struct.boost::multi_index::detail::header_holder.9" = type { ptr }
%"class.boost::multi_index::detail::hashed_index.10" = type { %"class.boost::multi_index::detail::hashed_index.11", [8 x i8], %"class.boost::multi_index::detail::bucket_array.14", float, i64 }
%"class.boost::multi_index::detail::hashed_index.11" = type { [8 x i8], %"class.boost::multi_index::detail::bucket_array.14", float, i64 }
%"class.boost::multi_index::detail::bucket_array.14" = type { i64, %"struct.boost::multi_index::detail::auto_space.15" }
%"struct.boost::multi_index::detail::auto_space.15" = type { [8 x i8], i64, ptr }
%"class.boost::multi_index::multi_index_container.16" = type { [8 x i8], %"struct.boost::multi_index::detail::header_holder.18", %"class.boost::multi_index::detail::hashed_index.19", i64 }
%"struct.boost::multi_index::detail::header_holder.18" = type { ptr }
%"class.boost::multi_index::detail::hashed_index.19" = type { %"class.boost::multi_index::detail::hashed_index.20", [8 x i8], %"class.boost::multi_index::detail::bucket_array.24", float, i64 }
%"class.boost::multi_index::detail::hashed_index.20" = type { %"class.boost::multi_index::detail::hashed_index.21", [8 x i8], %"class.boost::multi_index::detail::bucket_array.24", float, i64 }
%"class.boost::multi_index::detail::hashed_index.21" = type { [8 x i8], %"class.boost::multi_index::detail::bucket_array.24", float, i64 }
%"class.boost::multi_index::detail::bucket_array.24" = type { i64, %"struct.boost::multi_index::detail::auto_space.25" }
%"struct.boost::multi_index::detail::auto_space.25" = type { [8 x i8], i64, ptr }
%"struct.DynexCN::AccountSubscription" = type { %"struct.DynexCN::AccountKeys", %"struct.DynexCN::SynchronizationStart", i64 }
%"struct.DynexCN::AccountKeys" = type { %"struct.DynexCN::AccountPublicAddress", %"struct.Crypto::SecretKey", %"struct.Crypto::SecretKey" }
%"struct.DynexCN::AccountPublicAddress" = type { %"struct.Crypto::PublicKey", %"struct.Crypto::PublicKey" }
%"struct.Crypto::PublicKey" = type { [32 x i8] }
%"struct.Crypto::SecretKey" = type { [32 x i8] }
%"struct.DynexCN::SynchronizationStart" = type { i64, i64 }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

declare void @_ZN7DynexCN18TransfersContainer6detachEj(ptr dead_on_unwind writable sret(%"class.std::vector.26") align 8, ptr noundef nonnull align 8 dereferenceable(656), i32 noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7DynexCN21TransfersSubscription7onErrorERKSt10error_codej(ptr noundef nonnull align 8 dereferenceable(920) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::vector.26", align 8
  %8 = alloca %"class.std::error_code", align 8
  %9 = alloca { i64, i64 }, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = icmp ne i32 %11, -1
  br i1 %12, label %13, label %16

13:                                               ; preds = %3
  %14 = getelementptr inbounds %"class.DynexCN::TransfersSubscription", ptr %10, i32 0, i32 2
  %15 = load i32, ptr %6, align 4, !tbaa !9
  call void @_ZN7DynexCN18TransfersContainer6detachEj(ptr dead_on_unwind writable sret(%"class.std::vector.26") align 8 %7, ptr noundef nonnull align 8 dereferenceable(656) %14, i32 noundef %15)
  call void @_ZNSt6vectorIN6Crypto4HashESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  br label %16

16:                                               ; preds = %13, %3
  %17 = getelementptr inbounds %"class.DynexCN::IObservableImpl", ptr %10, i32 0, i32 1
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %19, i64 16, i1 false), !tbaa.struct !11
  store { i64, i64 } { i64 1, i64 0 }, ptr %9, align 8, !tbaa !12
  %20 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 0
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 1
  %23 = load i64, ptr %22, align 8
  call void @_ZN5Tools15ObserverManagerIN7DynexCN18ITransfersObserverEE6notifyIMS2_FvPNS1_22ITransfersSubscriptionEjSt10error_codeEJPNS1_21TransfersSubscriptionEjS7_EEEvT_DpT0_(ptr noundef nonnull align 8 dereferenceable(64) %17, i64 %21, i64 %23, ptr noundef %10, i32 noundef %18, ptr noundef byval(%"class.std::error_code") align 8 %8)
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Tools15ObserverManagerIN7DynexCN18ITransfersObserverEE6notifyIMS2_FvPNS1_22ITransfersSubscriptionEjSt10error_codeEJPNS1_21TransfersSubscriptionEjS7_EEEvT_DpT0_(ptr noundef nonnull align 8 dereferenceable(64), i64, i64, ptr noundef, i32 noundef, ptr noundef byval(%"class.std::error_code") align 8) #3 align 2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 4, !9, i64 8, i64 8, !5}
!12 = !{!7, !7, 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"

%"class.std::vector.26" = type { %"struct.std::_Vector_base.27" }
%"struct.std::_Vector_base.27" = type { %"struct.std::_Vector_base<Crypto::Hash, std::allocator<Crypto::Hash>>::_Vector_impl" }
%"struct.std::_Vector_base<Crypto::Hash, std::allocator<Crypto::Hash>>::_Vector_impl" = type { %"struct.std::_Vector_base<Crypto::Hash, std::allocator<Crypto::Hash>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Crypto::Hash, std::allocator<Crypto::Hash>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::error_code" = type { i32, ptr }

declare void @_ZN7DynexCN18TransfersContainer6detachEj(ptr dead_on_unwind writable sret(%"class.std::vector.26") align 8, ptr noundef nonnull align 8 dereferenceable(656), i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7DynexCN21TransfersSubscription7onErrorERKSt10error_codej(ptr noundef nonnull align 8 dereferenceable(920) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %1, i32 noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %"class.std::vector.26", align 8
  %.not = icmp eq i32 %2, -1
  br i1 %.not, label %7, label %5

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 112
  call void @_ZN7DynexCN18TransfersContainer6detachEj(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.26") align 8 %4, ptr noundef nonnull align 8 dereferenceable(656) %6, i32 noundef %2)
  call void @_ZNSt6vectorIN6Crypto4HashESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  br label %7

7:                                                ; preds = %5, %3
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZN5Tools15ObserverManagerIN7DynexCN18ITransfersObserverEE6notifyIMS2_FvPNS1_22ITransfersSubscriptionEjSt10error_codeEJPNS1_21TransfersSubscriptionEjS7_EEEvT_DpT0_(ptr noundef nonnull align 8 dereferenceable(64) %8, i64 1, i64 0, ptr noundef nonnull %0, i32 noundef %2, ptr noundef nonnull byval(%"class.std::error_code") align 8 %1)
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Tools15ObserverManagerIN7DynexCN18ITransfersObserverEE6notifyIMS2_FvPNS1_22ITransfersSubscriptionEjSt10error_codeEJPNS1_21TransfersSubscriptionEjS7_EEEvT_DpT0_(ptr noundef nonnull align 8 dereferenceable(64), i64, i64, ptr noundef, i32 noundef, ptr noundef byval(%"class.std::error_code") align 8) local_unnamed_addr #2 align 2

attributes #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 = { 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)"}


; Effective O3 passes: DSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass