; LLVM IR from microsoft/Multiverso :: src/controller.ll (ZN10multiverso10ControllerD2Ev)

; 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::Controller" = type { %"class.multiverso::Actor", ptr, ptr }
%"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 }

@_ZTVN10multiverso10ControllerE = external dso_local unnamed_addr constant { [5 x ptr] }, align 8

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #0

; Function Attrs: nounwind
declare void @_ZN10multiverso5ActorD2Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN10multiverso10ControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %0) unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr] }, ptr @_ZTVN10multiverso10ControllerE, i32 0, i32 0, i32 2), ptr %3, align 8, !tbaa !9
  %4 = getelementptr inbounds %"class.multiverso::Controller", ptr %3, i32 0, i32 2
  %5 = load ptr, ptr %4, align 8, !tbaa !11
  %6 = icmp eq ptr %5, null
  br i1 %6, label %8, label %7

7:                                                ; preds = %1
  call void @_ZN10multiverso10Controller17BarrierControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  call void @_ZdlPvm(ptr noundef %5, i64 noundef 32) #5
  br label %8

8:                                                ; preds = %7, %1
  %9 = getelementptr inbounds %"class.multiverso::Controller", ptr %3, i32 0, i32 1
  %10 = load ptr, ptr %9, align 8, !tbaa !35
  %11 = icmp eq ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %8
  call void @_ZN10multiverso10Controller18RegisterControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #4
  call void @_ZdlPvm(ptr noundef %10, i64 noundef 48) #5
  br label %13

13:                                               ; preds = %12, %8
  call void @_ZN10multiverso5ActorD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %3) #4
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10multiverso10Controller17BarrierControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10multiverso10Controller18RegisterControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

attributes #0 = { nobuiltin nounwind "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 = { nounwind "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 = { 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 #4 = { nounwind }
attributes #5 = { builtin 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 128}
!12 = !{!"_ZTSN10multiverso10ControllerE", !13, i64 0, !6, i64 120, !6, i64 128}
!13 = !{!"_ZTSN10multiverso5ActorE", !14, i64 8, !20, i64 16, !26, i64 72, !27, i64 80, !29, i64 112}
!14 = !{!"_ZTSSt10unique_ptrIN10multiverso7MtQueueIS_INS0_7MessageESt14default_deleteIS2_EEEES3_IS6_EE", !15, i64 0}
!15 = !{!"_ZTSSt15__uniq_ptr_dataIN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_ELb1ELb1EE", !16, i64 0}
!16 = !{!"_ZTSSt15__uniq_ptr_implIN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EE", !17, i64 0}
!17 = !{!"_ZTSSt5tupleIJPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EEE", !18, i64 0}
!18 = !{!"_ZTSSt11_Tuple_implILm0EJPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EEE", !19, i64 0}
!19 = !{!"_ZTSSt10_Head_baseILm0EPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEELb0EE", !6, i64 0}
!20 = !{!"_ZTSSt13unordered_mapIiSt8functionIFvRSt10unique_ptrIN10multiverso7MessageESt14default_deleteIS3_EEEESt4hashIiESt8equal_toIiESaISt4pairIKiS9_EEE", !21, i64 0}
!21 = !{!"_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, !22, i64 8, !23, i64 16, !22, i64 24, !24, i64 32, !6, i64 48}
!22 = !{!"long", !7, i64 0}
!23 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!24 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !25, i64 0, !22, i64 8}
!25 = !{!"float", !7, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !28, i64 0, !22, i64 8, !7, i64 16}
!28 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !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 = !{!12, !6, i64 120}


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

@_ZTVN10multiverso10ControllerE = external dso_local unnamed_addr constant { [5 x ptr] }, align 8

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN10multiverso5ActorD2Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN10multiverso10ControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %0) unnamed_addr #2 align 2 {
  store ptr getelementptr inbounds inrange(-16, 24) (i8, ptr @_ZTVN10multiverso10ControllerE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 128
  %3 = load ptr, ptr %2, align 8, !tbaa !8
  %4 = icmp eq ptr %3, null
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  tail call void @_ZN10multiverso10Controller17BarrierControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #4
  tail call void @_ZdlPvm(ptr noundef nonnull %3, i64 noundef 32) #5
  br label %6

6:                                                ; preds = %5, %1
  %7 = getelementptr inbounds i8, ptr %0, i64 120
  %8 = load ptr, ptr %7, align 8, !tbaa !34
  %9 = icmp eq ptr %8, null
  br i1 %9, label %11, label %10

10:                                               ; preds = %6
  tail call void @_ZN10multiverso10Controller18RegisterControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #4
  tail call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 48) #5
  br label %11

11:                                               ; preds = %10, %6
  tail call void @_ZN10multiverso5ActorD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %0) #4
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10multiverso10Controller17BarrierControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10multiverso10Controller18RegisterControllerD2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

attributes #0 = { nobuiltin nounwind "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 = { nounwind "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 = { 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 #4 = { nounwind }
attributes #5 = { builtin 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !17, i64 128}
!9 = !{!"_ZTSN10multiverso10ControllerE", !10, i64 0, !17, i64 120, !17, i64 128}
!10 = !{!"_ZTSN10multiverso5ActorE", !11, i64 8, !19, i64 16, !25, i64 72, !26, i64 80, !28, i64 112}
!11 = !{!"_ZTSSt10unique_ptrIN10multiverso7MtQueueIS_INS0_7MessageESt14default_deleteIS2_EEEES3_IS6_EE", !12, i64 0}
!12 = !{!"_ZTSSt15__uniq_ptr_dataIN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_ELb1ELb1EE", !13, i64 0}
!13 = !{!"_ZTSSt15__uniq_ptr_implIN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EE", !14, i64 0}
!14 = !{!"_ZTSSt5tupleIJPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EEE", !15, i64 0}
!15 = !{!"_ZTSSt11_Tuple_implILm0EJPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEES4_IS7_EEE", !16, i64 0}
!16 = !{!"_ZTSSt10_Head_baseILm0EPN10multiverso7MtQueueISt10unique_ptrINS0_7MessageESt14default_deleteIS3_EEEELb0EE", !17, i64 0}
!17 = !{!"any pointer", !18, i64 0}
!18 = !{!"omnipotent char", !7, 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", !17, i64 0, !21, i64 8, !22, i64 16, !21, i64 24, !23, i64 32, !17, i64 48}
!21 = !{!"long", !18, i64 0}
!22 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !17, i64 0}
!23 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !24, i64 0, !21, i64 8}
!24 = !{!"float", !18, i64 0}
!25 = !{!"bool", !18, i64 0}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !27, i64 0, !21, i64 8, !18, i64 16}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !17, 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", !17, i64 0}
!34 = !{!9, !17, i64 120}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InstCombinePass,SROAPass,TailCallElimPass