; LLVM IR from wichue/nethello :: src/event/EventLoop.ll (ZN3chw9EventLoop8shutdownEv)

; 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.std::shared_ptr.45" = type { %"class.std::__shared_ptr.46" }
%"class.std::__shared_ptr.46" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::function.48" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.50 = type { i8 }
%"class.chw::EventLoop" = type { %"class.std::enable_shared_from_this", i8, %"class.std::__cxx11::basic_string", ptr, %"class.chw::Semaphore", %"class.chw::PipeWrap", %"class.std::mutex", %"class.chw::List", %"class.std::shared_ptr.3", i32, %"class.std::unordered_map", %"class.std::unordered_set", %"class.std::multimap" }
%"class.std::enable_shared_from_this" = type { %"class.std::weak_ptr" }
%"class.std::weak_ptr" = type { %"class.std::__weak_ptr" }
%"class.std::__weak_ptr" = type { ptr, %"class.std::__weak_count" }
%"class.std::__weak_count" = type { ptr }
%"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.chw::Semaphore" = type { i64, %"class.std::recursive_mutex", %"class.std::_V2::condition_variable_any" }
%"class.std::recursive_mutex" = type { %"class.std::__recursive_mutex_base" }
%"class.std::__recursive_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 }
%"class.std::_V2::condition_variable_any" = type { %"class.std::condition_variable", %"class.std::shared_ptr" }
%"class.std::condition_variable" = type { %"class.std::__condvar" }
%"class.std::__condvar" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.chw::PipeWrap" = type { [2 x i32] }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%"class.chw::List" = type { %"class.std::__cxx11::list" }
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<std::shared_ptr<chw::TaskCancelableImp<void ()>>, std::allocator<std::shared_ptr<chw::TaskCancelableImp<void ()>>>>::_List_impl" }
%"struct.std::__cxx11::_List_base<std::shared_ptr<chw::TaskCancelableImp<void ()>>, std::allocator<std::shared_ptr<chw::TaskCancelableImp<void ()>>>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"class.std::shared_ptr.3" = type { %"class.std::__shared_ptr.4" }
%"class.std::__shared_ptr.4" = type { ptr, %"class.std::__shared_count" }
%"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::unordered_set" = type { %"class.std::_Hashtable.11" }
%"class.std::_Hashtable.11" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::multimap" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, std::shared_ptr<chw::TaskCancelableImp<unsigned long ()>>>, std::_Select1st<std::pair<const unsigned long, std::shared_ptr<chw::TaskCancelableImp<unsigned long ()>>>>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, std::shared_ptr<chw::TaskCancelableImp<unsigned long ()>>>, std::_Select1st<std::pair<const unsigned long, std::shared_ptr<chw::TaskCancelableImp<unsigned long ()>>>>, std::less<unsigned long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3chw9EventLoop8shutdownEv(ptr noundef nonnull align 8 dereferenceable(432) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.std::shared_ptr.45", align 8
  %4 = alloca %"class.std::function.48", align 8
  %5 = alloca %class.anon.50, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  call void @"_ZNSt8functionIFvvEEC2IZN3chw9EventLoop8shutdownEvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZN3chw9EventLoop7async_lESt8functionIFvvEEbb(ptr dead_on_unwind writable sret(%"class.std::shared_ptr.45") align 8 %3, ptr noundef nonnull align 8 dereferenceable(432) %8, ptr noundef %4, i1 noundef zeroext false, i1 noundef zeroext true)
          to label %9 unwind label %17

9:                                                ; preds = %1
  call void @_ZNSt12__shared_ptrIN3chw17TaskCancelableImpIFvvEJEEELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #6
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  %10 = getelementptr inbounds %"class.chw::EventLoop", ptr %8, i32 0, i32 3
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %43

13:                                               ; preds = %9
  %14 = getelementptr inbounds %"class.chw::EventLoop", ptr %8, i32 0, i32 3
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  invoke void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %16 unwind label %21

16:                                               ; preds = %13
  br label %31

17:                                               ; preds = %1
  %18 = landingpad { ptr, i32 }
          cleanup
  %19 = extractvalue { ptr, i32 } %18, 0
  store ptr %19, ptr %6, align 8
  %20 = extractvalue { ptr, i32 } %18, 1
  store i32 %20, ptr %7, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  br label %44

21:                                               ; preds = %13
  %22 = landingpad { ptr, i32 }
          catch ptr null
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %6, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %7, align 4
  br label %25

25:                                               ; preds = %21
  %26 = load ptr, ptr %6, align 8
  %27 = call ptr @__cxa_begin_catch(ptr %26) #6
  %28 = getelementptr inbounds %"class.chw::EventLoop", ptr %8, i32 0, i32 3
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  invoke void @_ZNSt6thread6detachEv(ptr noundef nonnull align 8 dereferenceable(8) %29)
          to label %30 unwind label %38

30:                                               ; preds = %25
  call void @__cxa_end_catch()
  br label %31

31:                                               ; preds = %30, %16
  %32 = getelementptr inbounds %"class.chw::EventLoop", ptr %8, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = icmp eq ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %33) #6
  call void @_ZdlPvm(ptr noundef %33, i64 noundef 8) #7
  br label %36

36:                                               ; preds = %35, %31
  %37 = getelementptr inbounds %"class.chw::EventLoop", ptr %8, i32 0, i32 3
  store ptr null, ptr %37, align 8, !tbaa !9
  br label %43

38:                                               ; preds = %25
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %6, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %7, align 4
  invoke void @__cxa_end_catch()
          to label %42 unwind label %49

42:                                               ; preds = %38
  br label %44

43:                                               ; preds = %36, %9
  ret void

44:                                               ; preds = %42, %17
  %45 = load ptr, ptr %6, align 8
  %46 = load i32, ptr %7, align 4
  %47 = insertvalue { ptr, i32 } poison, ptr %45, 0
  %48 = insertvalue { ptr, i32 } %47, i32 %46, 1
  resume { ptr, i32 } %48

49:                                               ; preds = %38
  %50 = landingpad { ptr, i32 }
          catch ptr null
  %51 = extractvalue { ptr, i32 } %50, 0
  call void @__clang_call_terminate(ptr %51) #8
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3chw9EventLoop7async_lESt8functionIFvvEEbb(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.45") align 8, ptr noundef nonnull align 8 dereferenceable(432), ptr noundef, i1 noundef zeroext, i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvvEEC2IZN3chw9EventLoop8shutdownEvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrIN3chw17TaskCancelableImpIFvvEJEEELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) #3

declare ptr @__cxa_begin_catch(ptr)

declare void @_ZNSt6thread6detachEv(ptr noundef nonnull align 8 dereferenceable(8)) #3

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #4

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 = { noinline noreturn nounwind uwtable "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 #5 = { 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 #6 = { nounwind }
attributes #7 = { builtin nounwind }
attributes #8 = { noreturn 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, !6, i64 56}
!10 = !{!"_ZTSN3chw9EventLoopE", !11, i64 0, !15, i64 16, !16, i64 24, !6, i64 56, !19, i64 64, !28, i64 176, !29, i64 184, !31, i64 224, !37, i64 248, !39, i64 264, !40, i64 272, !45, i64 328, !47, i64 384}
!11 = !{!"_ZTSSt23enable_shared_from_thisIN3chw9EventLoopEE", !12, i64 0}
!12 = !{!"_ZTSSt8weak_ptrIN3chw9EventLoopEE", !13, i64 0}
!13 = !{!"_ZTSSt10__weak_ptrIN3chw9EventLoopELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !14, i64 8}
!14 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTSN3chw9SemaphoreE", !18, i64 0, !20, i64 8, !22, i64 48}
!20 = !{!"_ZTSSt15recursive_mutex", !21, i64 0}
!21 = !{!"_ZTSSt22__recursive_mutex_base", !7, i64 0}
!22 = !{!"_ZTSNSt3_V222condition_variable_anyE", !23, i64 0, !25, i64 48}
!23 = !{!"_ZTSSt18condition_variable", !24, i64 0}
!24 = !{!"_ZTSSt9__condvar", !7, i64 0}
!25 = !{!"_ZTSSt10shared_ptrISt5mutexE", !26, i64 0}
!26 = !{!"_ZTSSt12__shared_ptrISt5mutexLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !27, i64 8}
!27 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!28 = !{!"_ZTSN3chw8PipeWrapE", !7, i64 0}
!29 = !{!"_ZTSSt5mutex", !30, i64 0}
!30 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!31 = !{!"_ZTSN3chw4ListISt10shared_ptrINS_17TaskCancelableImpIFvvEJEEEEEE", !32, i64 0}
!32 = !{!"_ZTSNSt7__cxx114listISt10shared_ptrIN3chw17TaskCancelableImpIFvvEJEEEESaIS6_EEE", !33, i64 0}
!33 = !{!"_ZTSNSt7__cxx1110_List_baseISt10shared_ptrIN3chw17TaskCancelableImpIFvvEJEEEESaIS6_EEE", !34, i64 0}
!34 = !{!"_ZTSNSt7__cxx1110_List_baseISt10shared_ptrIN3chw17TaskCancelableImpIFvvEJEEEESaIS6_EE10_List_implE", !35, i64 0}
!35 = !{!"_ZTSNSt8__detail17_List_node_headerE", !36, i64 0, !18, i64 16}
!36 = !{!"_ZTSNSt8__detail15_List_node_baseE", !6, i64 0, !6, i64 8}
!37 = !{!"_ZTSSt10shared_ptrIN3chw6LoggerEE", !38, i64 0}
!38 = !{!"_ZTSSt12__shared_ptrIN3chw6LoggerELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !27, i64 8}
!39 = !{!"int", !7, i64 0}
!40 = !{!"_ZTSSt13unordered_mapIiSt10shared_ptrISt8functionIFviEEESt4hashIiESt8equal_toIiESaISt4pairIKiS4_EEE", !41, i64 0}
!41 = !{!"_ZTSSt10_HashtableIiSt4pairIKiSt10shared_ptrISt8functionIFviEEEESaIS7_ENSt8__detail10_Select1stESt8equal_toIiESt4hashIiENS9_18_Mod_range_hashingENS9_20_Default_ranged_hashENS9_20_Prime_rehash_policyENS9_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !18, i64 8, !42, i64 16, !18, i64 24, !43, i64 32, !6, i64 48}
!42 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!43 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !44, i64 0, !18, i64 8}
!44 = !{!"float", !7, i64 0}
!45 = !{!"_ZTSSt13unordered_setIiSt4hashIiESt8equal_toIiESaIiEE", !46, i64 0}
!46 = !{!"_ZTSSt10_HashtableIiiSaIiENSt8__detail9_IdentityESt8equal_toIiESt4hashIiENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb0ELb1ELb1EEEE", !6, i64 0, !18, i64 8, !42, i64 16, !18, i64 24, !43, i64 32, !6, i64 48}
!47 = !{!"_ZTSSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE", !48, i64 0}
!48 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEESt10_Select1stIS8_ESt4lessImESaIS8_EE", !49, i64 0}
!49 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEESt10_Select1stIS8_ESt4lessImESaIS8_EE13_Rb_tree_implISC_Lb1EEE", !50, i64 0, !52, i64 8}
!50 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !51, i64 0}
!51 = !{!"_ZTSSt4lessImE"}
!52 = !{!"_ZTSSt15_Rb_tree_header", !53, i64 0, !18, i64 32}
!53 = !{!"_ZTSSt18_Rb_tree_node_base", !54, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!54 = !{!"_ZTSSt14_Rb_tree_color", !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.std::shared_ptr.45" = type { %"class.std::__shared_ptr.46" }
%"class.std::__shared_ptr.46" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::function.48" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.50 = type { i8 }

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

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
define dso_local void @_ZN3chw9EventLoop8shutdownEv(ptr noundef nonnull align 8 dereferenceable(432) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::shared_ptr.45", align 8
  %3 = alloca %"class.std::function.48", align 8
  %4 = alloca %class.anon.50, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @"_ZNSt8functionIFvvEEC2IZN3chw9EventLoop8shutdownEvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZN3chw9EventLoop7async_lESt8functionIFvvEEbb(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr.45") align 8 %2, ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull %3, i1 noundef zeroext false, i1 noundef zeroext true)
          to label %5 unwind label %9

5:                                                ; preds = %1
  call void @_ZNSt12__shared_ptrIN3chw17TaskCancelableImpIFvvEJEEELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %24, label %8

8:                                                ; preds = %5
  invoke void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %17 unwind label %11

9:                                                ; preds = %1
  %10 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  br label %25

11:                                               ; preds = %8
  %12 = landingpad { ptr, i32 }
          catch ptr null
  %13 = extractvalue { ptr, i32 } %12, 0
  %14 = call ptr @__cxa_begin_catch(ptr %13) #6
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNSt6thread6detachEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %16 unwind label %22

16:                                               ; preds = %11
  call void @__cxa_end_catch()
  br label %17

17:                                               ; preds = %8, %16
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %18) #6
  call void @_ZdlPvm(ptr noundef nonnull %18, i64 noundef 8) #7
  br label %21

21:                                               ; preds = %20, %17
  store ptr null, ptr %6, align 8, !tbaa !5
  br label %24

22:                                               ; preds = %11
  %23 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %25 unwind label %26

24:                                               ; preds = %21, %5
  ret void

25:                                               ; preds = %22, %9
  %.pn = phi { ptr, i32 } [ %23, %22 ], [ %10, %9 ]
  resume { ptr, i32 } %.pn

26:                                               ; preds = %22
  %27 = landingpad { ptr, i32 }
          catch ptr null
  %28 = extractvalue { ptr, i32 } %27, 0
  call void @__clang_call_terminate(ptr %28) #8
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3chw9EventLoop7async_lESt8functionIFvvEEbb(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.45") align 8, ptr noundef nonnull align 8 dereferenceable(432), ptr noundef, i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvvEEC2IZN3chw9EventLoop8shutdownEvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrIN3chw17TaskCancelableImpIFvvEJEEELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare void @_ZNSt6thread6detachEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #4

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 = { noinline noreturn nounwind uwtable "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 #5 = { 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 #6 = { nounwind }
attributes #7 = { builtin nounwind }
attributes #8 = { noreturn 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, !10, i64 56}
!6 = !{!"_ZTSN3chw9EventLoopE", !7, i64 0, !14, i64 16, !15, i64 24, !10, i64 56, !18, i64 64, !27, i64 176, !28, i64 184, !30, i64 224, !36, i64 248, !38, i64 264, !39, i64 272, !44, i64 328, !46, i64 384}
!7 = !{!"_ZTSSt23enable_shared_from_thisIN3chw9EventLoopEE", !8, i64 0}
!8 = !{!"_ZTSSt8weak_ptrIN3chw9EventLoopEE", !9, i64 0}
!9 = !{!"_ZTSSt10__weak_ptrIN3chw9EventLoopELN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !13, i64 8}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0}
!14 = !{!"bool", !11, i64 0}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !17, i64 8, !11, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!17 = !{!"long", !11, i64 0}
!18 = !{!"_ZTSN3chw9SemaphoreE", !17, i64 0, !19, i64 8, !21, i64 48}
!19 = !{!"_ZTSSt15recursive_mutex", !20, i64 0}
!20 = !{!"_ZTSSt22__recursive_mutex_base", !11, i64 0}
!21 = !{!"_ZTSNSt3_V222condition_variable_anyE", !22, i64 0, !24, i64 48}
!22 = !{!"_ZTSSt18condition_variable", !23, i64 0}
!23 = !{!"_ZTSSt9__condvar", !11, i64 0}
!24 = !{!"_ZTSSt10shared_ptrISt5mutexE", !25, i64 0}
!25 = !{!"_ZTSSt12__shared_ptrISt5mutexLN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !26, i64 8}
!26 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0}
!27 = !{!"_ZTSN3chw8PipeWrapE", !11, i64 0}
!28 = !{!"_ZTSSt5mutex", !29, i64 0}
!29 = !{!"_ZTSSt12__mutex_base", !11, i64 0}
!30 = !{!"_ZTSN3chw4ListISt10shared_ptrINS_17TaskCancelableImpIFvvEJEEEEEE", !31, i64 0}
!31 = !{!"_ZTSNSt7__cxx114listISt10shared_ptrIN3chw17TaskCancelableImpIFvvEJEEEESaIS6_EEE", !32, i64 0}
!32 = !{!"_ZTSNSt7__cxx1110_List_baseISt10shared_ptrIN3chw17TaskCancelableImpIFvvEJEEEESaIS6_EEE", !33, i64 0}
!33 = !{!"_ZTSNSt7__cxx1110_List_baseISt10shared_ptrIN3chw17TaskCancelableImpIFvvEJEEEESaIS6_EE10_List_implE", !34, i64 0}
!34 = !{!"_ZTSNSt8__detail17_List_node_headerE", !35, i64 0, !17, i64 16}
!35 = !{!"_ZTSNSt8__detail15_List_node_baseE", !10, i64 0, !10, i64 8}
!36 = !{!"_ZTSSt10shared_ptrIN3chw6LoggerEE", !37, i64 0}
!37 = !{!"_ZTSSt12__shared_ptrIN3chw6LoggerELN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !26, i64 8}
!38 = !{!"int", !11, i64 0}
!39 = !{!"_ZTSSt13unordered_mapIiSt10shared_ptrISt8functionIFviEEESt4hashIiESt8equal_toIiESaISt4pairIKiS4_EEE", !40, i64 0}
!40 = !{!"_ZTSSt10_HashtableIiSt4pairIKiSt10shared_ptrISt8functionIFviEEEESaIS7_ENSt8__detail10_Select1stESt8equal_toIiESt4hashIiENS9_18_Mod_range_hashingENS9_20_Default_ranged_hashENS9_20_Prime_rehash_policyENS9_17_Hashtable_traitsILb0ELb0ELb1EEEE", !10, i64 0, !17, i64 8, !41, i64 16, !17, i64 24, !42, i64 32, !10, i64 48}
!41 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !10, i64 0}
!42 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !43, i64 0, !17, i64 8}
!43 = !{!"float", !11, i64 0}
!44 = !{!"_ZTSSt13unordered_setIiSt4hashIiESt8equal_toIiESaIiEE", !45, i64 0}
!45 = !{!"_ZTSSt10_HashtableIiiSaIiENSt8__detail9_IdentityESt8equal_toIiESt4hashIiENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb0ELb1ELb1EEEE", !10, i64 0, !17, i64 8, !41, i64 16, !17, i64 24, !42, i64 32, !10, i64 48}
!46 = !{!"_ZTSSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE", !47, i64 0}
!47 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEESt10_Select1stIS8_ESt4lessImESaIS8_EE", !48, i64 0}
!48 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEESt10_Select1stIS8_ESt4lessImESaIS8_EE13_Rb_tree_implISC_Lb1EEE", !49, i64 0, !51, i64 8}
!49 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !50, i64 0}
!50 = !{!"_ZTSSt4lessImE"}
!51 = !{!"_ZTSSt15_Rb_tree_header", !52, i64 0, !17, i64 32}
!52 = !{!"_ZTSSt18_Rb_tree_node_base", !53, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!53 = !{!"_ZTSSt14_Rb_tree_color", !11, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass