; LLVM IR from microsoft/Multiverso :: src/actor.ll (ZN10multiverso5Actor4StopEv)

; 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.multiverso::Actor" = type { ptr, %"class.std::unique_ptr", %"class.std::unordered_map", i8, %"class.std::__cxx11::basic_string", %"class.std::unique_ptr.7" }
%"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.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"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::__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] }
%"class.std::unique_ptr.7" = type { %"struct.std::__uniq_ptr_data.8" }
%"struct.std::__uniq_ptr_data.8" = type { %"class.std::__uniq_ptr_impl.9" }
%"class.std::__uniq_ptr_impl.9" = type { %"class.std::tuple.10" }
%"class.std::tuple.10" = type { %"struct.std::_Tuple_impl.11" }
%"struct.std::_Tuple_impl.11" = type { %"struct.std::_Head_base.14" }
%"struct.std::_Head_base.14" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10multiverso5Actor4StopEv(ptr noundef nonnull align 8 dereferenceable(120) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  br label %4

4:                                                ; preds = %9, %1
  %5 = getelementptr inbounds %"class.multiverso::Actor", ptr %3, i32 0, i32 1
  %6 = call noundef ptr @_ZNKSt10unique_ptrIN10multiverso7MtQueueIS_INS0_7MessageESt14default_deleteIS2_EEEES3_IS6_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %7 = call noundef zeroext i1 @_ZNK10multiverso7MtQueueISt10unique_ptrINS_7MessageESt14default_deleteIS2_EEE5EmptyEv(ptr noundef nonnull align 8 dereferenceable(169) %6)
  %8 = xor i1 %7, true
  br i1 %8, label %9, label %10

9:                                                ; preds = %4
  br label %4, !llvm.loop !9

10:                                               ; preds = %4
  %11 = getelementptr inbounds %"class.multiverso::Actor", ptr %3, i32 0, i32 3
  store i8 0, ptr %11, align 8, !tbaa !11
  %12 = getelementptr inbounds %"class.multiverso::Actor", ptr %3, i32 0, i32 1
  %13 = call noundef ptr @_ZNKSt10unique_ptrIN10multiverso7MtQueueIS_INS0_7MessageESt14default_deleteIS2_EEEES3_IS6_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #3
  call void @_ZN10multiverso7MtQueueISt10unique_ptrINS_7MessageESt14default_deleteIS2_EEE4ExitEv(ptr noundef nonnull align 8 dereferenceable(169) %13)
  %14 = getelementptr inbounds %"class.multiverso::Actor", ptr %3, i32 0, i32 5
  %15 = call noundef ptr @_ZNKSt10unique_ptrISt6threadSt14default_deleteIS0_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #3
  call void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK10multiverso7MtQueueISt10unique_ptrINS_7MessageESt14default_deleteIS2_EEE5EmptyEv(ptr noundef nonnull align 8 dereferenceable(169)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10multiverso7MtQueueISt10unique_ptrINS_7MessageESt14default_deleteIS2_EEE4ExitEv(ptr noundef nonnull align 8 dereferenceable(169)) #0 align 2

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

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !25, i64 72}
!12 = !{!"_ZTSN10multiverso5ActorE", !13, i64 8, !19, i64 16, !25, i64 72, !26, i64 80, !28, i64 112}
!13 = !{!"_ZTSSt10unique_ptrIN10multiverso7MtQueueIS_INS0_7MessageESt14default_deleteIS2_EEEES3_IS6_EE", !14, i64 0}
!14 = !{!"_ZTSSt15__uniq_ptr_dataIN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_ELb1ELb1EE", !15, i64 0}
!15 = !{!"_ZTSSt15__uniq_ptr_implIN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EE", !16, i64 0}
!16 = !{!"_ZTSSt5tupleIJPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EEE", !17, i64 0}
!17 = !{!"_ZTSSt11_Tuple_implILm0EJPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EEE", !18, i64 0}
!18 = !{!"_ZTSSt10_Head_baseILm0EPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEELb0EE", !6, i64 0}
!19 = !{!"_ZTSSt13unordered_mapIiSt8functionIFvRSt10unique_ptrIN10multiverso7MessageESt14default_deleteIS3_EEEESt4hashIiESt8equal_toIiESaISt4pairIKiS9_EEE", !20, i64 0}
!20 = !{!"_ZTSSt10_HashtableIiSt4pairIKiSt8functionIFvRSt10unique_ptrIN10multiverso7MessageESt14default_deleteIS5_EEEEESaISC_ENSt8__detail10_Select1stESt8equal_toIiESt4hashIiENSE_18_Mod_range_hashingENSE_20_Default_ranged_hashENSE_20_Prime_rehash_policyENSE_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !21, i64 8, !22, i64 16, !21, i64 24, !23, i64 32, !6, i64 48}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!23 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !24, i64 0, !21, i64 8}
!24 = !{!"float", !7, i64 0}
!25 = !{!"bool", !7, i64 0}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !27, i64 0, !21, i64 8, !7, i64 16}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, 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", !6, 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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10multiverso5Actor4StopEv(ptr noundef nonnull align 8 dereferenceable(120) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  br label %3

3:                                                ; preds = %3, %1
  %4 = tail call noundef ptr @_ZNKSt10unique_ptrIN10multiverso7MtQueueIS_INS0_7MessageESt14default_deleteIS2_EEEES3_IS6_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  %5 = tail call noundef zeroext i1 @_ZNK10multiverso7MtQueueISt10unique_ptrINS_7MessageESt14default_deleteIS2_EEE5EmptyEv(ptr noundef nonnull align 8 dereferenceable(169) %4)
  br i1 %5, label %6, label %3, !llvm.loop !5

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  store i8 0, ptr %7, align 8, !tbaa !7
  %8 = tail call noundef ptr @_ZNKSt10unique_ptrIN10multiverso7MtQueueIS_INS0_7MessageESt14default_deleteIS2_EEEES3_IS6_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  tail call void @_ZN10multiverso7MtQueueISt10unique_ptrINS_7MessageESt14default_deleteIS2_EEE4ExitEv(ptr noundef nonnull align 8 dereferenceable(169) %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 112
  %10 = tail call noundef ptr @_ZNKSt10unique_ptrISt6threadSt14default_deleteIS0_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  tail call void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK10multiverso7MtQueueISt10unique_ptrINS_7MessageESt14default_deleteIS2_EEE5EmptyEv(ptr noundef nonnull align 8 dereferenceable(169)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10multiverso7MtQueueISt10unique_ptrINS_7MessageESt14default_deleteIS2_EEE4ExitEv(ptr noundef nonnull align 8 dereferenceable(169)) local_unnamed_addr #0 align 2

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

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !24, i64 72}
!8 = !{!"_ZTSN10multiverso5ActorE", !9, i64 8, !18, i64 16, !24, i64 72, !25, i64 80, !27, i64 112}
!9 = !{!"_ZTSSt10unique_ptrIN10multiverso7MtQueueIS_INS0_7MessageESt14default_deleteIS2_EEEES3_IS6_EE", !10, i64 0}
!10 = !{!"_ZTSSt15__uniq_ptr_dataIN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_ELb1ELb1EE", !11, i64 0}
!11 = !{!"_ZTSSt15__uniq_ptr_implIN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EE", !12, i64 0}
!12 = !{!"_ZTSSt5tupleIJPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EEE", !13, i64 0}
!13 = !{!"_ZTSSt11_Tuple_implILm0EJPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EEE", !14, i64 0}
!14 = !{!"_ZTSSt10_Head_baseILm0EPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEELb0EE", !15, i64 0}
!15 = !{!"any pointer", !16, i64 0}
!16 = !{!"omnipotent char", !17, i64 0}
!17 = !{!"Simple C++ TBAA"}
!18 = !{!"_ZTSSt13unordered_mapIiSt8functionIFvRSt10unique_ptrIN10multiverso7MessageESt14default_deleteIS3_EEEESt4hashIiESt8equal_toIiESaISt4pairIKiS9_EEE", !19, i64 0}
!19 = !{!"_ZTSSt10_HashtableIiSt4pairIKiSt8functionIFvRSt10unique_ptrIN10multiverso7MessageESt14default_deleteIS5_EEEEESaISC_ENSt8__detail10_Select1stESt8equal_toIiESt4hashIiENSE_18_Mod_range_hashingENSE_20_Default_ranged_hashENSE_20_Prime_rehash_policyENSE_17_Hashtable_traitsILb0ELb0ELb1EEEE", !15, i64 0, !20, i64 8, !21, i64 16, !20, i64 24, !22, i64 32, !15, i64 48}
!20 = !{!"long", !16, i64 0}
!21 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !15, i64 0}
!22 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !23, i64 0, !20, i64 8}
!23 = !{!"float", !16, i64 0}
!24 = !{!"bool", !16, i64 0}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !26, i64 0, !20, i64 8, !16, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !15, i64 0}
!27 = !{!"_ZTSSt10unique_ptrISt6threadSt14default_deleteIS0_EE", !28, i64 0}
!28 = !{!"_ZTSSt15__uniq_ptr_dataISt6threadSt14default_deleteIS0_ELb1ELb1EE", !29, i64 0}
!29 = !{!"_ZTSSt15__uniq_ptr_implISt6threadSt14default_deleteIS0_EE", !30, i64 0}
!30 = !{!"_ZTSSt5tupleIJPSt6threadSt14default_deleteIS0_EEE", !31, i64 0}
!31 = !{!"_ZTSSt11_Tuple_implILm0EJPSt6threadSt14default_deleteIS0_EEE", !32, i64 0}
!32 = !{!"_ZTSSt10_Head_baseILm0EPSt6threadLb0EE", !15, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,LCSSAPass,LICMPass,SROAPass,SimplifyCFGPass,TailCallElimPass