; LLVM IR from dynexcoin/Dynex :: src/DynexCNCore (DynexCNFormatUtils)

; 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.__gnu_cxx::__normal_iterator.24" = type { ptr }
%"struct.DynexCN::TransactionPrefix" = type { i8, i64, %"class.std::vector", %"class.std::vector.4", %"class.std::vector.9" }
%"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.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = 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.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = 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 }
%"struct.DynexCN::TransactionOutput" = type { i64, %"class.boost::variant.25" }
%"class.boost::variant.25" = type { i32, [4 x i8], %"class.boost::aligned_storage.26" }
%"class.boost::aligned_storage.26" = type { %"struct.boost::detail::aligned_storage::aligned_storage_imp.27" }
%"struct.boost::detail::aligned_storage::aligned_storage_imp.27" = type { %"union.boost::detail::aligned_storage::aligned_storage_imp<32, 8>::data_t" }
%"union.boost::detail::aligned_storage::aligned_storage_imp<32, 8>::data_t" = type { [32 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 nounwind uwtable
declare dso_local ptr @_ZNKSt6vectorIN7DynexCN17TransactionOutputESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN7DynexCN19check_outs_overflowERKNS_17TransactionPrefixE(ptr noundef nonnull align 8 dereferenceable(88) %0) #1 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator.24", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.24", align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 0, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.DynexCN::TransactionPrefix", ptr %10, i32 0, i32 3
  store ptr %11, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = call ptr @_ZNKSt6vectorIN7DynexCN17TransactionOutputESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #3
  %14 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.24", ptr %6, i32 0, i32 0
  store ptr %13, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = call ptr @_ZNKSt6vectorIN7DynexCN17TransactionOutputESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  %17 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.24", ptr %7, i32 0, i32 0
  store ptr %16, ptr %17, align 8
  br label %18

18:                                               ; preds = %40, %1
  %19 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #3
  br i1 %19, label %21, label %20

20:                                               ; preds = %18
  store i32 2, ptr %8, align 4
  br label %42

21:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %22 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  store ptr %22, ptr %9, align 8, !tbaa !5
  %23 = load i64, ptr %4, align 8, !tbaa !9
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.DynexCN::TransactionOutput", ptr %24, i32 0, i32 0
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = load i64, ptr %4, align 8, !tbaa !9
  %28 = add i64 %26, %27
  %29 = icmp ugt i64 %23, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %21
  store i1 false, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %37

31:                                               ; preds = %21
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.DynexCN::TransactionOutput", ptr %32, i32 0, i32 0
  %34 = load i64, ptr %33, align 8, !tbaa !11
  %35 = load i64, ptr %4, align 8, !tbaa !9
  %36 = add i64 %35, %34
  store i64 %36, ptr %4, align 8, !tbaa !9
  store i32 0, ptr %8, align 4
  br label %37

37:                                               ; preds = %31, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %38 = load i32, ptr %8, align 4
  switch i32 %38, label %42 [
    i32 0, label %39
  ]

39:                                               ; preds = %37
  br label %40

40:                                               ; preds = %39
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  br label %18

42:                                               ; preds = %37, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  %43 = load i32, ptr %8, align 4
  switch i32 %43, label %45 [
    i32 2, label %44
  ]

44:                                               ; preds = %42
  store i1 true, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %45

45:                                               ; preds = %44, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %46 = load i1, ptr %2, align 1
  ret i1 %46
}

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 = { inlinehint 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, !10, i64 0}
!12 = !{!"_ZTSN7DynexCN17TransactionOutputE", !10, i64 0, !13, i64 8}
!13 = !{!"_ZTSN5boost7variantIN7DynexCN9KeyOutputEJNS1_20MultisignatureOutputEEEE", !14, i64 0, !15, i64 8}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN5boost15aligned_storageILm32ELm8EEE", !16, i64 0}
!16 = !{!"_ZTSN5boost6detail15aligned_storage19aligned_storage_impILm32ELm8EEE", !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.__gnu_cxx::__normal_iterator.24" = type { ptr }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress 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 ptr @_ZNKSt6vectorIN7DynexCN17TransactionOutputESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN7DynexCN19check_outs_overflowERKNS_17TransactionPrefixE(ptr noundef nonnull align 8 dereferenceable(88) %0) local_unnamed_addr #1 {
  %2 = alloca %"class.__gnu_cxx::__normal_iterator.24", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator.24", align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %5 = tail call ptr @_ZNKSt6vectorIN7DynexCN17TransactionOutputESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  store ptr %5, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %6 = tail call ptr @_ZNKSt6vectorIN7DynexCN17TransactionOutputESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  store ptr %6, ptr %3, align 8
  %7 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  br i1 %7, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %1, %11
  %.01317 = phi i64 [ %10, %11 ], [ 0, %1 ]
  %8 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  %9 = load i64, ptr %8, align 8, !tbaa !5
  %10 = add i64 %9, %.01317
  %.not = icmp ugt i64 %.01317, %10
  br i1 %.not, label %14, label %11

11:                                               ; preds = %.lr.ph
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  %13 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKN7DynexCN17TransactionOutputESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  br i1 %13, label %.lr.ph, label %.critedge

14:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  br label %15

.critedge:                                        ; preds = %11, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  br label %15

15:                                               ; preds = %14, %.critedge
  %.3 = phi i1 [ false, %14 ], [ true, %.critedge ]
  ret i1 %.3
}

attributes #0 = { mustprogress 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 = { inlinehint 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, !7, i64 0}
!6 = !{!"_ZTSN7DynexCN17TransactionOutputE", !7, i64 0, !10, i64 8}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN5boost7variantIN7DynexCN9KeyOutputEJNS1_20MultisignatureOutputEEEE", !11, i64 0, !12, i64 8}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_ZTSN5boost15aligned_storageILm32ELm8EEE", !13, i64 0}
!13 = !{!"_ZTSN5boost6detail15aligned_storage19aligned_storage_impILm32ELm8EEE", !8, i64 0}


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