; LLVM IR from dynexcoin/Dynex :: src/WalletLegacy (WalletUserTransactionsCache)

; 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.DynexCN::WalletUserTransactionsCache" = type { %"class.std::vector", %"class.std::vector.4", %"class.DynexCN::WalletUnconfirmedTransactions", %"class.std::unordered_map.31" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<DynexCN::WalletLegacyTransaction, std::allocator<DynexCN::WalletLegacyTransaction>>::_Vector_impl" }
%"struct.std::_Vector_base<DynexCN::WalletLegacyTransaction, std::allocator<DynexCN::WalletLegacyTransaction>>::_Vector_impl" = type { %"struct.std::_Vector_base<DynexCN::WalletLegacyTransaction, std::allocator<DynexCN::WalletLegacyTransaction>>::_Vector_impl_data" }
%"struct.std::_Vector_base<DynexCN::WalletLegacyTransaction, std::allocator<DynexCN::WalletLegacyTransaction>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = type { %"struct.std::_Vector_base<DynexCN::WalletLegacyTransfer, std::allocator<DynexCN::WalletLegacyTransfer>>::_Vector_impl" }
%"struct.std::_Vector_base<DynexCN::WalletLegacyTransfer, std::allocator<DynexCN::WalletLegacyTransfer>>::_Vector_impl" = type { %"struct.std::_Vector_base<DynexCN::WalletLegacyTransfer, std::allocator<DynexCN::WalletLegacyTransfer>>::_Vector_impl_data" }
%"struct.std::_Vector_base<DynexCN::WalletLegacyTransfer, std::allocator<DynexCN::WalletLegacyTransfer>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.DynexCN::WalletUnconfirmedTransactions" = type { %"class.std::unordered_map", %"class.std::unordered_set", i64 }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.std::unordered_set" = type { %"class.std::_Hashtable.14" }
%"class.std::_Hashtable.14" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::unordered_map.31" = type { %"class.std::_Hashtable.32" }
%"class.std::_Hashtable.32" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.DynexCN::WalletLegacyTransaction" = type <{ i64, i64, i64, i64, i64, i64, %"struct.Crypto::Hash", %"class.boost::optional", i8, [2 x i8], i32, i64, %"class.std::__cxx11::basic_string", i8, [7 x i8] }>
%"struct.Crypto::Hash" = type { [32 x i8] }
%"class.boost::optional" = type { %"class.boost::optional_detail::optional_base" }
%"class.boost::optional_detail::optional_base" = type { i8, %"class.boost::optional_detail::aligned_storage" }
%"class.boost::optional_detail::aligned_storage" = type { %"union.boost::optional_detail::aligned_storage<Crypto::SecretKey>::dummy_u" }
%"union.boost::optional_detail::aligned_storage<Crypto::SecretKey>::dummy_u" = type { [32 x i8] }
%"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] }

; 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 @_ZN7DynexCN27WalletUserTransactionsCache29updateUnconfirmedTransactionsEv(ptr noundef nonnull align 8 dereferenceable(224) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %5

5:                                                ; preds = %26, %1
  %6 = load i64, ptr %3, align 8, !tbaa !9
  %7 = getelementptr inbounds %"class.DynexCN::WalletUserTransactionsCache", ptr %4, i32 0, i32 0
  %8 = call noundef i64 @_ZNKSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  %9 = icmp ult i64 %6, %8
  br i1 %9, label %11, label %10

10:                                               ; preds = %5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %29

11:                                               ; preds = %5
  %12 = getelementptr inbounds %"class.DynexCN::WalletUserTransactionsCache", ptr %4, i32 0, i32 0
  %13 = load i64, ptr %3, align 8, !tbaa !9
  %14 = call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %13) #4
  %15 = getelementptr inbounds %"struct.DynexCN::WalletLegacyTransaction", ptr %14, i32 0, i32 10
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = icmp eq i32 %16, -1
  br i1 %17, label %18, label %25

18:                                               ; preds = %11
  %19 = getelementptr inbounds %"class.DynexCN::WalletUserTransactionsCache", ptr %4, i32 0, i32 2
  %20 = getelementptr inbounds %"class.DynexCN::WalletUserTransactionsCache", ptr %4, i32 0, i32 0
  %21 = load i64, ptr %3, align 8, !tbaa !9
  %22 = call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %21) #4
  %23 = getelementptr inbounds %"struct.DynexCN::WalletLegacyTransaction", ptr %22, i32 0, i32 6
  %24 = load i64, ptr %3, align 8, !tbaa !9
  call void @_ZN7DynexCN29WalletUnconfirmedTransactions19updateTransactionIdERKN6Crypto4HashEm(ptr noundef nonnull align 8 dereferenceable(120) %19, ptr noundef nonnull align 1 dereferenceable(32) %23, i64 noundef %24)
  br label %25

25:                                               ; preds = %18, %11
  br label %26

26:                                               ; preds = %25
  %27 = load i64, ptr %3, align 8, !tbaa !9
  %28 = add i64 %27, 1
  store i64 %28, ptr %3, align 8, !tbaa !9
  br label %5, !llvm.loop !22

29:                                               ; preds = %10
  ret void
}

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

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

declare void @_ZN7DynexCN29WalletUnconfirmedTransactions19updateTransactionIdERKN6Crypto4HashEm(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 1 dereferenceable(32), i64 noundef) #3

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 = { 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 = { "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 = !{!"long", !7, i64 0}
!11 = !{!12, !18, i64 116}
!12 = !{!"_ZTSN7DynexCN23WalletLegacyTransactionE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !13, i64 48, !14, i64 80, !16, i64 113, !18, i64 116, !10, i64 120, !19, i64 128, !21, i64 160}
!13 = !{!"_ZTSN6Crypto4HashE", !7, i64 0}
!14 = !{!"_ZTSN5boost8optionalIN6Crypto9SecretKeyEEE", !15, i64 0}
!15 = !{!"_ZTSN5boost15optional_detail13optional_baseIN6Crypto9SecretKeyEEE", !16, i64 0, !17, i64 1}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSN5boost15optional_detail15aligned_storageIN6Crypto9SecretKeyEEE", !7, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !10, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!"_ZTSN7DynexCN28WalletLegacyTransactionStateE", !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; 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 @_ZN7DynexCN27WalletUserTransactionsCache29updateUnconfirmedTransactionsEv(ptr noundef nonnull align 8 dereferenceable(224) %0) local_unnamed_addr #0 align 2 {
  %2 = tail call noundef i64 @_ZNKSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %.not = icmp eq i64 %2, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 48
  br label %4

._crit_edge:                                      ; preds = %12, %1
  ret void

4:                                                ; preds = %.lr.ph, %12
  %.05 = phi i64 [ 0, %.lr.ph ], [ %13, %12 ]
  %5 = tail call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.05) #3
  %6 = getelementptr inbounds i8, ptr %5, i64 116
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = icmp eq i32 %7, -1
  br i1 %8, label %9, label %12

9:                                                ; preds = %4
  %10 = tail call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.05) #3
  %11 = getelementptr inbounds i8, ptr %10, i64 48
  tail call void @_ZN7DynexCN29WalletUnconfirmedTransactions19updateTransactionIdERKN6Crypto4HashEm(ptr noundef nonnull align 8 dereferenceable(120) %3, ptr noundef nonnull align 1 dereferenceable(32) %11, i64 noundef %.05)
  br label %12

12:                                               ; preds = %4, %9
  %13 = add nuw i64 %.05, 1
  %14 = tail call noundef i64 @_ZNKSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %15 = icmp ult i64 %13, %14
  br i1 %15, label %4, label %._crit_edge, !llvm.loop !20
}

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

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

declare void @_ZN7DynexCN29WalletUnconfirmedTransactions19updateTransactionIdERKN6Crypto4HashEm(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 1 dereferenceable(32), i64 noundef) local_unnamed_addr #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 = { 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 = { "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, !15, i64 116}
!6 = !{!"_ZTSN7DynexCN23WalletLegacyTransactionE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !11, i64 80, !13, i64 113, !15, i64 116, !7, i64 120, !16, i64 128, !19, i64 160}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN6Crypto4HashE", !8, i64 0}
!11 = !{!"_ZTSN5boost8optionalIN6Crypto9SecretKeyEEE", !12, i64 0}
!12 = !{!"_ZTSN5boost15optional_detail13optional_baseIN6Crypto9SecretKeyEEE", !13, i64 0, !14, i64 1}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"_ZTSN5boost15optional_detail15aligned_storageIN6Crypto9SecretKeyEEE", !8, i64 0}
!15 = !{!"int", !8, i64 0}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !7, i64 8, !8, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !18, i64 0}
!18 = !{!"any pointer", !8, i64 0}
!19 = !{!"_ZTSN7DynexCN28WalletLegacyTransactionStateE", !8, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass