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

12:                                               ; preds = %60, %3
  %13 = load i64, ptr %8, align 8, !tbaa !9
  %14 = getelementptr inbounds %"class.DynexCN::WalletUserTransactionsCache", ptr %11, i32 0, i32 0
  %15 = call noundef i64 @_ZNKSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #3
  %16 = icmp ult i64 %13, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %63

18:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  %19 = getelementptr inbounds %"class.DynexCN::WalletUserTransactionsCache", ptr %11, i32 0, i32 0
  %20 = load i64, ptr %8, align 8, !tbaa !9
  %21 = call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %20) #3
  %22 = getelementptr inbounds %"struct.DynexCN::WalletLegacyTransaction", ptr %21, i32 0, i32 13
  %23 = load i8, ptr %22, align 8, !tbaa !11
  %24 = icmp ne i8 %23, 3
  br i1 %24, label %25, label %32

25:                                               ; preds = %18
  %26 = getelementptr inbounds %"class.DynexCN::WalletUserTransactionsCache", ptr %11, i32 0, i32 0
  %27 = load i64, ptr %8, align 8, !tbaa !9
  %28 = call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %27) #3
  %29 = getelementptr inbounds %"struct.DynexCN::WalletLegacyTransaction", ptr %28, i32 0, i32 13
  %30 = load i8, ptr %29, align 8, !tbaa !11
  %31 = icmp ne i8 %30, 4
  br label %32

32:                                               ; preds = %25, %18
  %33 = phi i1 [ false, %18 ], [ %31, %25 ]
  %34 = zext i1 %33 to i8
  store i8 %34, ptr %9, align 1, !tbaa !22
  %35 = load i8, ptr %9, align 1, !tbaa !22, !range !23, !noundef !24
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %42

37:                                               ; preds = %32
  %38 = load i64, ptr %8, align 8, !tbaa !9
  %39 = load i64, ptr %7, align 8, !tbaa !9
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN7DynexCN27WalletUserTransactionsCache18getGoodTransactionEmmRSt6vectorINS_23WalletLegacyTransactionESaIS2_EERS1_INS_20WalletLegacyTransferESaIS6_EE(ptr noundef nonnull align 8 dereferenceable(224) %11, i64 noundef %38, i64 noundef %39, ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 8 dereferenceable(24) %41)
  br label %59

42:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %43 = getelementptr inbounds %"class.DynexCN::WalletUserTransactionsCache", ptr %11, i32 0, i32 0
  %44 = load i64, ptr %8, align 8, !tbaa !9
  %45 = call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %43, i64 noundef %44) #3
  store ptr %45, ptr %10, align 8, !tbaa !5
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.DynexCN::WalletLegacyTransaction", ptr %46, i32 0, i32 0
  %48 = load i64, ptr %47, align 8, !tbaa !25
  %49 = icmp ne i64 %48, -1
  br i1 %49, label %50, label %54

50:                                               ; preds = %42
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.DynexCN::WalletLegacyTransaction", ptr %51, i32 0, i32 1
  %53 = load i64, ptr %52, align 8, !tbaa !26
  br label %55

54:                                               ; preds = %42
  br label %55

55:                                               ; preds = %54, %50
  %56 = phi i64 [ %53, %50 ], [ 0, %54 ]
  %57 = load i64, ptr %7, align 8, !tbaa !9
  %58 = add i64 %57, %56
  store i64 %58, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %59

59:                                               ; preds = %55, %37
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  br label %60

60:                                               ; preds = %59
  %61 = load i64, ptr %8, align 8, !tbaa !9
  %62 = add i64 %61, 1
  store i64 %62, ptr %8, align 8, !tbaa !9
  br label %12, !llvm.loop !27

63:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  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

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

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 = { 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, !21, i64 160}
!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 = !{!16, !16, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!12, !10, i64 0}
!26 = !{!12, !10, i64 8}
!27 = distinct !{!27, !28}
!28 = !{!"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 @_ZN7DynexCN27WalletUserTransactionsCache12getGoodItemsERSt6vectorINS_23WalletLegacyTransactionESaIS2_EERS1_INS_20WalletLegacyTransferESaIS6_EE(ptr noundef nonnull align 8 dereferenceable(224) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #0 align 2 {
  %4 = tail call noundef i64 @_ZNKSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  %.not19 = icmp eq i64 %4, 0
  br i1 %.not19, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %19, %3
  ret void

.lr.ph:                                           ; preds = %3, %19
  %.018 = phi i64 [ %.1, %19 ], [ 0, %3 ]
  %.01316 = phi i64 [ %20, %19 ], [ 0, %3 ]
  %5 = tail call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.01316) #2
  %6 = getelementptr inbounds i8, ptr %5, i64 160
  %7 = load i8, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i8 %7, 3
  br i1 %.not, label %.critedge, label %8

8:                                                ; preds = %.lr.ph
  %9 = tail call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.01316) #2
  %10 = getelementptr inbounds i8, ptr %9, i64 160
  %11 = load i8, ptr %10, align 8, !tbaa !5
  %.not15 = icmp eq i8 %11, 4
  br i1 %.not15, label %.critedge, label %12

12:                                               ; preds = %8
  tail call void @_ZN7DynexCN27WalletUserTransactionsCache18getGoodTransactionEmmRSt6vectorINS_23WalletLegacyTransactionESaIS2_EERS1_INS_20WalletLegacyTransferESaIS6_EE(ptr noundef nonnull align 8 dereferenceable(224) %0, i64 noundef %.01316, i64 noundef %.018, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2)
  br label %19

.critedge:                                        ; preds = %.lr.ph, %8
  %13 = tail call noundef nonnull align 8 dereferenceable(161) ptr @_ZNSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.01316) #2
  %14 = load i64, ptr %13, align 8, !tbaa !20
  %.not14 = icmp eq i64 %14, -1
  %15 = getelementptr inbounds i8, ptr %13, i64 8
  %16 = load i64, ptr %15, align 8
  %17 = select i1 %.not14, i64 0, i64 %16
  %18 = add i64 %17, %.018
  br label %19

19:                                               ; preds = %.critedge, %12
  %.1 = phi i64 [ %.018, %12 ], [ %18, %.critedge ]
  %20 = add nuw i64 %.01316, 1
  %21 = tail call noundef i64 @_ZNKSt6vectorIN7DynexCN23WalletLegacyTransactionESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  %22 = icmp ult i64 %20, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !21
}

; 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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7DynexCN27WalletUserTransactionsCache18getGoodTransactionEmmRSt6vectorINS_23WalletLegacyTransactionESaIS2_EERS1_INS_20WalletLegacyTransferESaIS6_EE(ptr noundef nonnull align 8 dereferenceable(224), i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 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 = { 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, !19, i64 160}
!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 = !{!6, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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