; LLVM IR from dynexcoin/Dynex :: src/DynexCNCore/Transaction.ll (ZNK7DynexCN15TransactionImpl18validateSignaturesEv)

; 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::TransactionImpl" = type { %"class.DynexCN::ITransaction", %"struct.DynexCN::Transaction", %"class.boost::optional", %"class.boost::optional.21", %"class.DynexCN::TransactionExtra" }
%"class.DynexCN::ITransaction" = type { %"class.DynexCN::ITransactionReader", %"class.DynexCN::ITransactionWriter" }
%"class.DynexCN::ITransactionReader" = type { ptr }
%"class.DynexCN::ITransactionWriter" = type { ptr }
%"struct.DynexCN::Transaction" = type { %"struct.DynexCN::TransactionPrefix", %"class.std::vector.16" }
%"struct.DynexCN::TransactionPrefix" = type { i8, i64, %"class.std::vector", %"class.std::vector.6", %"class.std::vector.11" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<boost::variant<DynexCN::BaseInput, DynexCN::KeyInput, DynexCN::MultisignatureInput>, std::allocator<boost::variant<DynexCN::BaseInput, DynexCN::KeyInput, DynexCN::MultisignatureInput>>>::_Vector_impl" }
%"struct.std::_Vector_base<boost::variant<DynexCN::BaseInput, DynexCN::KeyInput, DynexCN::MultisignatureInput>, std::allocator<boost::variant<DynexCN::BaseInput, DynexCN::KeyInput, DynexCN::MultisignatureInput>>>::_Vector_impl" = type { %"struct.std::_Vector_base<boost::variant<DynexCN::BaseInput, DynexCN::KeyInput, DynexCN::MultisignatureInput>, std::allocator<boost::variant<DynexCN::BaseInput, DynexCN::KeyInput, DynexCN::MultisignatureInput>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<boost::variant<DynexCN::BaseInput, DynexCN::KeyInput, DynexCN::MultisignatureInput>, std::allocator<boost::variant<DynexCN::BaseInput, DynexCN::KeyInput, DynexCN::MultisignatureInput>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = type { %"struct.std::_Vector_base<DynexCN::TransactionOutput, std::allocator<DynexCN::TransactionOutput>>::_Vector_impl" }
%"struct.std::_Vector_base<DynexCN::TransactionOutput, std::allocator<DynexCN::TransactionOutput>>::_Vector_impl" = type { %"struct.std::_Vector_base<DynexCN::TransactionOutput, std::allocator<DynexCN::TransactionOutput>>::_Vector_impl_data" }
%"struct.std::_Vector_base<DynexCN::TransactionOutput, std::allocator<DynexCN::TransactionOutput>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.11" = type { %"struct.std::_Vector_base.12" }
%"struct.std::_Vector_base.12" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.16" = type { %"struct.std::_Vector_base.17" }
%"struct.std::_Vector_base.17" = type { %"struct.std::_Vector_base<std::vector<Crypto::Signature>, std::allocator<std::vector<Crypto::Signature>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<Crypto::Signature>, std::allocator<std::vector<Crypto::Signature>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<Crypto::Signature>, std::allocator<std::vector<Crypto::Signature>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<Crypto::Signature>, std::allocator<std::vector<Crypto::Signature>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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.boost::optional.21" = type { %"class.boost::optional_detail::optional_base.22" }
%"class.boost::optional_detail::optional_base.22" = type { i8, %"class.boost::optional_detail::aligned_storage.23" }
%"class.boost::optional_detail::aligned_storage.23" = type { %"union.boost::optional_detail::aligned_storage<Crypto::Hash>::dummy_u" }
%"union.boost::optional_detail::aligned_storage<Crypto::Hash>::dummy_u" = type { [32 x i8] }
%"class.DynexCN::TransactionExtra" = type { %"class.std::vector.24" }
%"class.std::vector.24" = type { %"struct.std::_Vector_base.25" }
%"struct.std::_Vector_base.25" = type { %"struct.std::_Vector_base<boost::variant<DynexCN::TransactionExtraPadding, DynexCN::TransactionExtraPublicKey, DynexCN::TransactionExtraNonce, DynexCN::TransactionExtraMergeTag, DynexCN::TransactionExtraFromAddress, DynexCN::TransactionExtraToAddress, DynexCN::TransactionExtraAmount, DynexCN::TransactionExtraTxkey>, std::allocator<boost::variant<DynexCN::TransactionExtraPadding, DynexCN::TransactionExtraPublicKey, DynexCN::TransactionExtraNonce, DynexCN::TransactionExtraMergeTag, DynexCN::TransactionExtraFromAddress, DynexCN::TransactionExtraToAddress, DynexCN::TransactionExtraAmount, DynexCN::TransactionExtraTxkey>>>::_Vector_impl" }
%"struct.std::_Vector_base<boost::variant<DynexCN::TransactionExtraPadding, DynexCN::TransactionExtraPublicKey, DynexCN::TransactionExtraNonce, DynexCN::TransactionExtraMergeTag, DynexCN::TransactionExtraFromAddress, DynexCN::TransactionExtraToAddress, DynexCN::TransactionExtraAmount, DynexCN::TransactionExtraTxkey>, std::allocator<boost::variant<DynexCN::TransactionExtraPadding, DynexCN::TransactionExtraPublicKey, DynexCN::TransactionExtraNonce, DynexCN::TransactionExtraMergeTag, DynexCN::TransactionExtraFromAddress, DynexCN::TransactionExtraToAddress, DynexCN::TransactionExtraAmount, DynexCN::TransactionExtraTxkey>>>::_Vector_impl" = type { %"struct.std::_Vector_base<boost::variant<DynexCN::TransactionExtraPadding, DynexCN::TransactionExtraPublicKey, DynexCN::TransactionExtraNonce, DynexCN::TransactionExtraMergeTag, DynexCN::TransactionExtraFromAddress, DynexCN::TransactionExtraToAddress, DynexCN::TransactionExtraAmount, DynexCN::TransactionExtraTxkey>, std::allocator<boost::variant<DynexCN::TransactionExtraPadding, DynexCN::TransactionExtraPublicKey, DynexCN::TransactionExtraNonce, DynexCN::TransactionExtraMergeTag, DynexCN::TransactionExtraFromAddress, DynexCN::TransactionExtraToAddress, DynexCN::TransactionExtraAmount, DynexCN::TransactionExtraTxkey>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<boost::variant<DynexCN::TransactionExtraPadding, DynexCN::TransactionExtraPublicKey, DynexCN::TransactionExtraNonce, DynexCN::TransactionExtraMergeTag, DynexCN::TransactionExtraFromAddress, DynexCN::TransactionExtraToAddress, DynexCN::TransactionExtraAmount, DynexCN::TransactionExtraTxkey>, std::allocator<boost::variant<DynexCN::TransactionExtraPadding, DynexCN::TransactionExtraPublicKey, DynexCN::TransactionExtraNonce, DynexCN::TransactionExtraMergeTag, DynexCN::TransactionExtraFromAddress, DynexCN::TransactionExtraToAddress, DynexCN::TransactionExtraAmount, DynexCN::TransactionExtraTxkey>>>::_Vector_impl_data" = type { 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN5boost7variantIN7DynexCN9BaseInputEJNS2_8KeyInputENS2_19MultisignatureInputEEEESaIS6_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7DynexCN15TransactionImpl18validateSignaturesEv(ptr noundef nonnull align 8 dereferenceable(224) %0) unnamed_addr #2 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  %7 = getelementptr inbounds %"class.DynexCN::TransactionImpl", ptr %6, i32 0, i32 1
  %8 = getelementptr inbounds %"struct.DynexCN::Transaction", ptr %7, i32 0, i32 1
  %9 = call noundef i64 @_ZNKSt6vectorIS_IN6Crypto9SignatureESaIS1_EESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %10 = getelementptr inbounds %"class.DynexCN::TransactionImpl", ptr %6, i32 0, i32 1
  %11 = getelementptr inbounds %"struct.DynexCN::TransactionPrefix", ptr %10, i32 0, i32 2
  %12 = call noundef i64 @_ZNKSt6vectorIN5boost7variantIN7DynexCN9BaseInputEJNS2_8KeyInputENS2_19MultisignatureInputEEEESaIS6_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  %13 = icmp ult i64 %9, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  br label %43

15:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %16

16:                                               ; preds = %37, %15
  %17 = load i64, ptr %4, align 8, !tbaa !9
  %18 = getelementptr inbounds %"class.DynexCN::TransactionImpl", ptr %6, i32 0, i32 1
  %19 = getelementptr inbounds %"struct.DynexCN::TransactionPrefix", ptr %18, i32 0, i32 2
  %20 = call noundef i64 @_ZNKSt6vectorIN5boost7variantIN7DynexCN9BaseInputEJNS2_8KeyInputENS2_19MultisignatureInputEEEESaIS6_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #3
  %21 = icmp ult i64 %17, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %16
  store i32 2, ptr %5, align 4
  br label %40

23:                                               ; preds = %16
  %24 = load i64, ptr %4, align 8, !tbaa !9
  %25 = load ptr, ptr %6, align 8, !tbaa !11
  %26 = getelementptr inbounds ptr, ptr %25, i64 20
  %27 = load ptr, ptr %26, align 8
  %28 = call noundef i64 %27(ptr noundef nonnull align 8 dereferenceable(224) %6, i64 noundef %24)
  %29 = getelementptr inbounds %"class.DynexCN::TransactionImpl", ptr %6, i32 0, i32 1
  %30 = getelementptr inbounds %"struct.DynexCN::Transaction", ptr %29, i32 0, i32 1
  %31 = load i64, ptr %4, align 8, !tbaa !9
  %32 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN6Crypto9SignatureESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %31) #3
  %33 = call noundef i64 @_ZNKSt6vectorIN6Crypto9SignatureESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #3
  %34 = icmp ugt i64 %28, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %23
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %40

36:                                               ; preds = %23
  br label %37

37:                                               ; preds = %36
  %38 = load i64, ptr %4, align 8, !tbaa !9
  %39 = add i64 %38, 1
  store i64 %39, ptr %4, align 8, !tbaa !9
  br label %16, !llvm.loop !13

40:                                               ; preds = %35, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %41 = load i32, ptr %5, align 4
  switch i32 %41, label %45 [
    i32 2, label %42
    i32 1, label %43
  ]

42:                                               ; preds = %40
  store i1 true, ptr %2, align 1
  br label %43

43:                                               ; preds = %42, %40, %14
  %44 = load i1, ptr %2, align 1
  ret i1 %44

45:                                               ; preds = %40
  unreachable
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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)"}
!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, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN5boost7variantIN7DynexCN9BaseInputEJNS2_8KeyInputENS2_19MultisignatureInputEEEESaIS6_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7DynexCN15TransactionImpl18validateSignaturesEv(ptr noundef nonnull align 8 dereferenceable(224) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 104
  %3 = tail call noundef i64 @_ZNKSt6vectorIS_IN6Crypto9SignatureESaIS1_EESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = tail call noundef i64 @_ZNKSt6vectorIN5boost7variantIN7DynexCN9BaseInputEJNS2_8KeyInputENS2_19MultisignatureInputEEEESaIS6_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %6 = icmp ult i64 %3, %5
  br i1 %6, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %1
  %7 = tail call noundef i64 @_ZNKSt6vectorIN5boost7variantIN7DynexCN9BaseInputEJNS2_8KeyInputENS2_19MultisignatureInputEEEESaIS6_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %8 = icmp eq i64 %7, 0
  br i1 %8, label %.loopexit, label %.lr.ph

9:                                                ; preds = %.lr.ph
  %10 = add nuw i64 %.068, 1
  %11 = tail call noundef i64 @_ZNKSt6vectorIN5boost7variantIN7DynexCN9BaseInputEJNS2_8KeyInputENS2_19MultisignatureInputEEEESaIS6_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %.not = icmp ult i64 %10, %11
  br i1 %.not, label %.lr.ph, label %.loopexit, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %9
  %.068 = phi i64 [ %10, %9 ], [ 0, %.preheader ]
  %12 = load ptr, ptr %0, align 8, !tbaa !7
  %13 = getelementptr inbounds i8, ptr %12, i64 160
  %14 = load ptr, ptr %13, align 8
  %15 = tail call noundef i64 %14(ptr noundef nonnull align 8 dereferenceable(224) %0, i64 noundef %.068)
  %16 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN6Crypto9SignatureESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.068) #2
  %17 = tail call noundef i64 @_ZNKSt6vectorIN6Crypto9SignatureESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #2
  %.not11 = icmp ule i64 %15, %17
  br i1 %.not11, label %9, label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %9, %.preheader, %1
  %.1 = phi i1 [ false, %1 ], [ true, %.preheader ], [ %.not11, %9 ], [ %.not11, %.lr.ph ]
  ret i1 %.1
}

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

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

attributes #0 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"vtable pointer", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass