; LLVM IR from dynexcoin/Dynex :: src/InProcessNode (InProcessNode)

; 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"

%"struct.Crypto::Hash" = type { [32 x i8] }
%"class.DynexCN::InProcessNode" = type { %"class.DynexCN::INode", %"class.DynexCN::IDynexCNProtocolObserver", %"class.DynexCN::ICoreObserver", i32, ptr, ptr, %"class.Tools::ObserverManager", %"struct.DynexCN::BlockHeaderInfo", %"class.boost::asio::io_context", %"class.std::unique_ptr", %"class.std::unique_ptr.10", %"class.DynexCN::BlockchainExplorerDataBuilder", %"class.std::mutex" }
%"class.DynexCN::INode" = type { ptr }
%"class.DynexCN::IDynexCNProtocolObserver" = type { ptr }
%"class.DynexCN::ICoreObserver" = 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::INodeObserver *, std::allocator<DynexCN::INodeObserver *>>::_Vector_impl" }
%"struct.std::_Vector_base<DynexCN::INodeObserver *, std::allocator<DynexCN::INodeObserver *>>::_Vector_impl" = type { %"struct.std::_Vector_base<DynexCN::INodeObserver *, std::allocator<DynexCN::INodeObserver *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<DynexCN::INodeObserver *, std::allocator<DynexCN::INodeObserver *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.DynexCN::BlockHeaderInfo" = type { i32, i8, i8, i64, %"struct.Crypto::Hash", %"struct.Crypto::Hash", i32, i8, i32, i64, i64 }
%"class.boost::asio::io_context" = type { %"class.boost::asio::execution_context", ptr }
%"class.boost::asio::execution_context" = type { ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.9" }
%"struct.std::_Head_base.9" = type { ptr }
%"class.std::unique_ptr.10" = type { %"struct.std::__uniq_ptr_data.11" }
%"struct.std::__uniq_ptr_data.11" = type { %"class.std::__uniq_ptr_impl.12" }
%"class.std::__uniq_ptr_impl.12" = type { %"class.std::tuple.13" }
%"class.std::tuple.13" = type { %"struct.std::_Tuple_impl.14" }
%"struct.std::_Tuple_impl.14" = type { %"struct.std::_Head_base.17" }
%"struct.std::_Head_base.17" = type { ptr }
%"class.DynexCN::BlockchainExplorerDataBuilder" = type { 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 }

@_ZN7DynexCNL9NULL_HASHE = external hidden global %"struct.Crypto::Hash", align 1

; 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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7DynexCN13InProcessNode29resetLastLocalBlockHeaderInfoEv(ptr noundef nonnull align 8 dereferenceable(312) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %5 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %4, i32 0, i32 0
  store i32 0, ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %7 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %6, i32 0, i32 1
  store i8 0, ptr %7, align 4, !tbaa !42
  %8 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %9 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %8, i32 0, i32 2
  store i8 0, ptr %9, align 1, !tbaa !43
  %10 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %11 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %10, i32 0, i32 3
  store i64 0, ptr %11, align 8, !tbaa !44
  %12 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %13 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %12, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 1 @_ZN7DynexCNL9NULL_HASHE, i64 32, i1 false), !tbaa.struct !45
  %14 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %15 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %14, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 1 @_ZN7DynexCNL9NULL_HASHE, i64 32, i1 false), !tbaa.struct !45
  %16 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %17 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %16, i32 0, i32 6
  store i32 0, ptr %17, align 8, !tbaa !47
  %18 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %19 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %18, i32 0, i32 7
  store i8 0, ptr %19, align 4, !tbaa !48
  %20 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %21 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %20, i32 0, i32 8
  store i32 0, ptr %21, align 8, !tbaa !49
  %22 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %23 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %22, i32 0, i32 9
  store i64 0, ptr %23, align 8, !tbaa !50
  %24 = getelementptr inbounds %"class.DynexCN::InProcessNode", ptr %3, i32 0, i32 7
  %25 = getelementptr inbounds %"struct.DynexCN::BlockHeaderInfo", ptr %24, i32 0, i32 10
  store i64 0, ptr %25, align 8, !tbaa !51
  ret void
}

attributes #0 = { nocallback nofree 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" }

!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, !23, i64 112}
!10 = !{!"_ZTSN7DynexCN13InProcessNodeE", !11, i64 0, !12, i64 8, !13, i64 16, !14, i64 24, !6, i64 32, !6, i64 40, !15, i64 48, !22, i64 112, !27, i64 224, !29, i64 240, !35, i64 248, !41, i64 256, !20, i64 272}
!11 = !{!"_ZTSN7DynexCN5INodeE"}
!12 = !{!"_ZTSN7DynexCN24IDynexCNProtocolObserverE"}
!13 = !{!"_ZTSN7DynexCN13ICoreObserverE"}
!14 = !{!"_ZTSN7DynexCN13InProcessNode5StateE", !7, i64 0}
!15 = !{!"_ZTSN5Tools15ObserverManagerIN7DynexCN13INodeObserverEEE", !16, i64 0, !20, i64 24}
!16 = !{!"_ZTSSt6vectorIPN7DynexCN13INodeObserverESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIPN7DynexCN13INodeObserverESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPN7DynexCN13INodeObserverESaIS2_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIPN7DynexCN13INodeObserverESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_ZTSSt5mutex", !21, i64 0}
!21 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!22 = !{!"_ZTSN7DynexCN15BlockHeaderInfoE", !23, i64 0, !7, i64 4, !7, i64 5, !24, i64 8, !25, i64 16, !25, i64 48, !23, i64 80, !26, i64 84, !23, i64 88, !24, i64 96, !24, i64 104}
!23 = !{!"int", !7, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!"_ZTSN6Crypto4HashE", !7, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{!"_ZTSN5boost4asio10io_contextE", !28, i64 0, !6, i64 8}
!28 = !{!"_ZTSN5boost4asio17execution_contextE", !6, i64 0}
!29 = !{!"_ZTSSt10unique_ptrISt6threadSt14default_deleteIS0_EE", !30, i64 0}
!30 = !{!"_ZTSSt15__uniq_ptr_dataISt6threadSt14default_deleteIS0_ELb1ELb1EE", !31, i64 0}
!31 = !{!"_ZTSSt15__uniq_ptr_implISt6threadSt14default_deleteIS0_EE", !32, i64 0}
!32 = !{!"_ZTSSt5tupleIJPSt6threadSt14default_deleteIS0_EEE", !33, i64 0}
!33 = !{!"_ZTSSt11_Tuple_implILm0EJPSt6threadSt14default_deleteIS0_EEE", !34, i64 0}
!34 = !{!"_ZTSSt10_Head_baseILm0EPSt6threadLb0EE", !6, i64 0}
!35 = !{!"_ZTSSt10unique_ptrIN5boost4asio10io_context4workESt14default_deleteIS3_EE", !36, i64 0}
!36 = !{!"_ZTSSt15__uniq_ptr_dataIN5boost4asio10io_context4workESt14default_deleteIS3_ELb1ELb1EE", !37, i64 0}
!37 = !{!"_ZTSSt15__uniq_ptr_implIN5boost4asio10io_context4workESt14default_deleteIS3_EE", !38, i64 0}
!38 = !{!"_ZTSSt5tupleIJPN5boost4asio10io_context4workESt14default_deleteIS3_EEE", !39, i64 0}
!39 = !{!"_ZTSSt11_Tuple_implILm0EJPN5boost4asio10io_context4workESt14default_deleteIS3_EEE", !40, i64 0}
!40 = !{!"_ZTSSt10_Head_baseILm0EPN5boost4asio10io_context4workELb0EE", !6, i64 0}
!41 = !{!"_ZTSN7DynexCN29BlockchainExplorerDataBuilderE", !6, i64 0, !6, i64 8}
!42 = !{!10, !7, i64 116}
!43 = !{!10, !7, i64 117}
!44 = !{!10, !24, i64 120}
!45 = !{i64 0, i64 32, !46}
!46 = !{!7, !7, i64 0}
!47 = !{!10, !23, i64 192}
!48 = !{!10, !26, i64 196}
!49 = !{!10, !23, i64 200}
!50 = !{!10, !24, i64 208}
!51 = !{!10, !24, i64 216}


; 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"

%"struct.Crypto::Hash" = type { [32 x i8] }

@_ZN7DynexCNL9NULL_HASHE = external hidden local_unnamed_addr global %"struct.Crypto::Hash", align 1

; Function Attrs: mustprogress 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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @_ZN7DynexCN13InProcessNode29resetLastLocalBlockHeaderInfoEv(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(312) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 0, ptr %2, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 116
  store i8 0, ptr %3, align 4, !tbaa !41
  %4 = getelementptr inbounds i8, ptr %0, i64 117
  store i8 0, ptr %4, align 1, !tbaa !42
  %5 = getelementptr inbounds i8, ptr %0, i64 120
  store i64 0, ptr %5, align 8, !tbaa !43
  %6 = getelementptr inbounds i8, ptr %0, i64 128
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 1 dereferenceable(32) @_ZN7DynexCNL9NULL_HASHE, i64 32, i1 false), !tbaa.struct !44
  %7 = getelementptr inbounds i8, ptr %0, i64 160
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 1 dereferenceable(32) @_ZN7DynexCNL9NULL_HASHE, i64 32, i1 false), !tbaa.struct !44
  %8 = getelementptr inbounds i8, ptr %0, i64 192
  store i32 0, ptr %8, align 8, !tbaa !46
  %9 = getelementptr inbounds i8, ptr %0, i64 196
  store i8 0, ptr %9, align 4, !tbaa !47
  %10 = getelementptr inbounds i8, ptr %0, i64 200
  store i32 0, ptr %10, align 8, !tbaa !48
  %11 = getelementptr inbounds i8, ptr %0, i64 208
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %11, i8 0, i64 16, i1 false)
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !22, i64 112}
!6 = !{!"_ZTSN7DynexCN13InProcessNodeE", !7, i64 0, !8, i64 8, !9, i64 16, !10, i64 24, !13, i64 32, !13, i64 40, !14, i64 48, !21, i64 112, !26, i64 224, !28, i64 240, !34, i64 248, !40, i64 256, !19, i64 272}
!7 = !{!"_ZTSN7DynexCN5INodeE"}
!8 = !{!"_ZTSN7DynexCN24IDynexCNProtocolObserverE"}
!9 = !{!"_ZTSN7DynexCN13ICoreObserverE"}
!10 = !{!"_ZTSN7DynexCN13InProcessNode5StateE", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"any pointer", !11, i64 0}
!14 = !{!"_ZTSN5Tools15ObserverManagerIN7DynexCN13INodeObserverEEE", !15, i64 0, !19, i64 24}
!15 = !{!"_ZTSSt6vectorIPN7DynexCN13INodeObserverESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIPN7DynexCN13INodeObserverESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPN7DynexCN13INodeObserverESaIS2_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPN7DynexCN13INodeObserverESaIS2_EE17_Vector_impl_dataE", !13, i64 0, !13, i64 8, !13, i64 16}
!19 = !{!"_ZTSSt5mutex", !20, i64 0}
!20 = !{!"_ZTSSt12__mutex_base", !11, i64 0}
!21 = !{!"_ZTSN7DynexCN15BlockHeaderInfoE", !22, i64 0, !11, i64 4, !11, i64 5, !23, i64 8, !24, i64 16, !24, i64 48, !22, i64 80, !25, i64 84, !22, i64 88, !23, i64 96, !23, i64 104}
!22 = !{!"int", !11, i64 0}
!23 = !{!"long", !11, i64 0}
!24 = !{!"_ZTSN6Crypto4HashE", !11, i64 0}
!25 = !{!"bool", !11, i64 0}
!26 = !{!"_ZTSN5boost4asio10io_contextE", !27, i64 0, !13, i64 8}
!27 = !{!"_ZTSN5boost4asio17execution_contextE", !13, i64 0}
!28 = !{!"_ZTSSt10unique_ptrISt6threadSt14default_deleteIS0_EE", !29, i64 0}
!29 = !{!"_ZTSSt15__uniq_ptr_dataISt6threadSt14default_deleteIS0_ELb1ELb1EE", !30, i64 0}
!30 = !{!"_ZTSSt15__uniq_ptr_implISt6threadSt14default_deleteIS0_EE", !31, i64 0}
!31 = !{!"_ZTSSt5tupleIJPSt6threadSt14default_deleteIS0_EEE", !32, i64 0}
!32 = !{!"_ZTSSt11_Tuple_implILm0EJPSt6threadSt14default_deleteIS0_EEE", !33, i64 0}
!33 = !{!"_ZTSSt10_Head_baseILm0EPSt6threadLb0EE", !13, i64 0}
!34 = !{!"_ZTSSt10unique_ptrIN5boost4asio10io_context4workESt14default_deleteIS3_EE", !35, i64 0}
!35 = !{!"_ZTSSt15__uniq_ptr_dataIN5boost4asio10io_context4workESt14default_deleteIS3_ELb1ELb1EE", !36, i64 0}
!36 = !{!"_ZTSSt15__uniq_ptr_implIN5boost4asio10io_context4workESt14default_deleteIS3_EE", !37, i64 0}
!37 = !{!"_ZTSSt5tupleIJPN5boost4asio10io_context4workESt14default_deleteIS3_EEE", !38, i64 0}
!38 = !{!"_ZTSSt11_Tuple_implILm0EJPN5boost4asio10io_context4workESt14default_deleteIS3_EEE", !39, i64 0}
!39 = !{!"_ZTSSt10_Head_baseILm0EPN5boost4asio10io_context4workELb0EE", !13, i64 0}
!40 = !{!"_ZTSN7DynexCN29BlockchainExplorerDataBuilderE", !13, i64 0, !13, i64 8}
!41 = !{!6, !11, i64 116}
!42 = !{!6, !11, i64 117}
!43 = !{!6, !23, i64 120}
!44 = !{i64 0, i64 32, !45}
!45 = !{!11, !11, i64 0}
!46 = !{!6, !22, i64 192}
!47 = !{!6, !25, i64 196}
!48 = !{!6, !22, i64 200}


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