; LLVM IR from yinqiwen/ardb :: src/common/channel/channel_service.ll (ZN4ardb14ChannelServiceD2Ev)

; 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.43" = type { ptr }
%"class.ardb::ChannelService" = type { %"class.ardb::Runnable", %"struct.ardb::SoftSignalHandler", %"class.btree::btree_map", i32, ptr, ptr, ptr, ptr, %"class.std::__cxx11::list", %"class.ardb::MPSCQueue", i8, i32, %"class.std::vector", %"class.std::vector.6", i64, %"class.ardb::SPSCQueue", ptr, i32, ptr }
%"class.ardb::Runnable" = type { ptr }
%"struct.ardb::SoftSignalHandler" = type { ptr }
%"class.btree::btree_map" = type { %"class.btree::btree_map_container" }
%"class.btree::btree_map_container" = type { %"class.btree::btree_unique_container" }
%"class.btree::btree_unique_container" = type { %"class.btree::btree_container" }
%"class.btree::btree_container" = type { %"class.btree::btree" }
%"class.btree::btree" = type { %"struct.btree::btree<btree::btree_map_params<unsigned int, ardb::Channel *, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, ardb::Channel *>>, 256>>::empty_base_handle" }
%"struct.btree::btree<btree::btree_map_params<unsigned int, ardb::Channel *, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, ardb::Channel *>>, 256>>::empty_base_handle" = type { ptr }
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<unsigned int, std::allocator<unsigned int>>::_List_impl" }
%"struct.std::__cxx11::_List_base<unsigned int, std::allocator<unsigned int>>::_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.ardb::MPSCQueue" = type { ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ardb::ChannelService *, std::allocator<ardb::ChannelService *>>::_Vector_impl" }
%"struct.std::_Vector_base<ardb::ChannelService *, std::allocator<ardb::ChannelService *>>::_Vector_impl" = type { %"struct.std::_Vector_base<ardb::ChannelService *, std::allocator<ardb::ChannelService *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ardb::ChannelService *, std::allocator<ardb::ChannelService *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = type { %"struct.std::_Vector_base<ardb::Thread *, std::allocator<ardb::Thread *>>::_Vector_impl" }
%"struct.std::_Vector_base<ardb::Thread *, std::allocator<ardb::Thread *>>::_Vector_impl" = type { %"struct.std::_Vector_base<ardb::Thread *, std::allocator<ardb::Thread *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ardb::Thread *, std::allocator<ardb::Thread *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.ardb::SPSCQueue" = type { ptr, [64 x i8], ptr, ptr, ptr }

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

; 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 nounwind uwtable
declare dso_local void @_ZN4ardb9SPSCQueueIPNS_8RunnableEED2Ev(ptr noundef nonnull align 8 dereferenceable(96)) unnamed_addr #1 align 2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4ardb14ChannelService16CloseAllChannelsEb(ptr noundef nonnull align 8 dereferenceable(288), i1 noundef zeroext) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4ardb14ChannelServiceD2Ev(ptr noundef nonnull align 8 dereferenceable(288) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator.43", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator.43", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator.43", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 32) ({ [6 x ptr], [5 x ptr] }, ptr @_ZTVN4ardb14ChannelServiceE, i32 0, i32 0, i32 2), ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr getelementptr inbounds inrange(-16, 24) ({ [6 x ptr], [5 x ptr] }, ptr @_ZTVN4ardb14ChannelServiceE, i32 0, i32 1, i32 2), ptr %7, align 8, !tbaa !9
  invoke void @_ZN4ardb14ChannelService16CloseAllChannelsEb(ptr noundef nonnull align 8 dereferenceable(288) %6, i1 noundef zeroext false)
          to label %8 unwind label %42

8:                                                ; preds = %1
  %9 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 4
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  invoke void @aeDeleteEventLoop(ptr noundef %10)
          to label %11 unwind label %42

11:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %12 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 13
  %13 = call ptr @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  %14 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.43", ptr %3, i32 0, i32 0
  store ptr %13, ptr %14, align 8
  br label %15

15:                                               ; preds = %31, %11
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %16 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 13
  %17 = call ptr @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #6
  %18 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.43", ptr %4, i32 0, i32 0
  store ptr %17, ptr %18, align 8
  %19 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br i1 %19, label %20, label %34

20:                                               ; preds = %15
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  invoke void @_ZN4ardb6Thread4JoinEv(ptr noundef nonnull align 8 dereferenceable(28) %22)
          to label %23 unwind label %42

23:                                               ; preds = %20
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %31, label %27

27:                                               ; preds = %23
  %28 = load ptr, ptr %25, align 8, !tbaa !9
  %29 = getelementptr inbounds ptr, ptr %28, i64 2
  %30 = load ptr, ptr %29, align 8
  call void %30(ptr noundef nonnull align 8 dereferenceable(28) %25) #6
  br label %31

31:                                               ; preds = %27, %23
  %32 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 0) #6
  %33 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.43", ptr %5, i32 0, i32 0
  store ptr %32, ptr %33, align 8
  br label %15, !llvm.loop !39

34:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  %35 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 15
  call void @_ZN4ardb9SPSCQueueIPNS_8RunnableEED2Ev(ptr noundef nonnull align 8 dereferenceable(96) %35) #6
  %36 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 13
  call void @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %36) #6
  %37 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 12
  call void @_ZNSt6vectorIPN4ardb14ChannelServiceESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %37) #6
  %38 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 9
  call void @_ZN4ardb9MPSCQueueINS_21ChannelAsyncIOContextEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %38) #6
  %39 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 8
  call void @_ZNSt7__cxx1110_List_baseIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %39) #6
  %40 = getelementptr inbounds %"class.ardb::ChannelService", ptr %6, i32 0, i32 2
  call void @_ZN5btree15btree_containerINS_5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS5_EELi256EEEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %40) #6
  %41 = getelementptr inbounds i8, ptr %6, i64 8
  call void @_ZN4ardb17SoftSignalHandlerD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %41) #6
  call void @_ZN4ardb8RunnableD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  ret void

42:                                               ; preds = %20, %8, %1
  %43 = landingpad { ptr, i32 }
          catch ptr null
  %44 = extractvalue { ptr, i32 } %43, 0
  call void @__clang_call_terminate(ptr %44) #7
  unreachable
}

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

declare void @aeDeleteEventLoop(ptr noundef) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPPN4ardb6ThreadESt6vectorIS3_SaIS3_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 ptr @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

declare void @_ZN4ardb6Thread4JoinEv(ptr noundef nonnull align 8 dereferenceable(28)) #5

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

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

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

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 = { 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 #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 = { "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 = { 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"_ZTSN4ardb14ChannelServiceE", !13, i64 0, !14, i64 8, !15, i64 16, !21, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !22, i64 64, !28, i64 88, !29, i64 104, !21, i64 108, !30, i64 112, !34, i64 136, !27, i64 160, !38, i64 168, !6, i64 264, !21, i64 272, !6, i64 280}
!13 = !{!"_ZTSN4ardb8RunnableE"}
!14 = !{!"_ZTSN4ardb17SoftSignalHandlerE"}
!15 = !{!"_ZTSN5btree9btree_mapIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS3_EELi256EEE", !16, i64 0}
!16 = !{!"_ZTSN5btree19btree_map_containerINS_5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS5_EELi256EEEEEEE", !17, i64 0}
!17 = !{!"_ZTSN5btree22btree_unique_containerINS_5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS5_EELi256EEEEEEE", !18, i64 0}
!18 = !{!"_ZTSN5btree15btree_containerINS_5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS5_EELi256EEEEEEE", !19, i64 0}
!19 = !{!"_ZTSN5btree5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS4_EELi256EEEEE", !20, i64 0}
!20 = !{!"_ZTSN5btree5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS4_EELi256EEEE17empty_base_handleISaIcEPNS_10btree_nodeISB_EEEE", !6, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{!"_ZTSNSt7__cxx114listIjSaIjEEE", !23, i64 0}
!23 = !{!"_ZTSNSt7__cxx1110_List_baseIjSaIjEEE", !24, i64 0}
!24 = !{!"_ZTSNSt7__cxx1110_List_baseIjSaIjEE10_List_implE", !25, i64 0}
!25 = !{!"_ZTSNSt8__detail17_List_node_headerE", !26, i64 0, !27, i64 16}
!26 = !{!"_ZTSNSt8__detail15_List_node_baseE", !6, i64 0, !6, i64 8}
!27 = !{!"long", !7, i64 0}
!28 = !{!"_ZTSN4ardb9MPSCQueueINS_21ChannelAsyncIOContextEEE", !6, i64 0, !6, i64 8}
!29 = !{!"bool", !7, i64 0}
!30 = !{!"_ZTSSt6vectorIPN4ardb14ChannelServiceESaIS2_EE", !31, i64 0}
!31 = !{!"_ZTSSt12_Vector_baseIPN4ardb14ChannelServiceESaIS2_EE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIPN4ardb14ChannelServiceESaIS2_EE12_Vector_implE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseIPN4ardb14ChannelServiceESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!"_ZTSSt6vectorIPN4ardb6ThreadESaIS2_EE", !35, i64 0}
!35 = !{!"_ZTSSt12_Vector_baseIPN4ardb6ThreadESaIS2_EE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseIPN4ardb6ThreadESaIS2_EE12_Vector_implE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseIPN4ardb6ThreadESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!38 = !{!"_ZTSN4ardb9SPSCQueueIPNS_8RunnableEEE", !6, i64 0, !7, i64 8, !6, i64 72, !6, i64 80, !6, i64 88}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}


; 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.43" = type { ptr }

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

; 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 nounwind uwtable
declare dso_local void @_ZN4ardb9SPSCQueueIPNS_8RunnableEED2Ev(ptr noundef nonnull align 8 dereferenceable(96)) unnamed_addr #1 align 2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4ardb14ChannelService16CloseAllChannelsEb(ptr noundef nonnull align 8 dereferenceable(288), i1 noundef zeroext) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4ardb14ChannelServiceD2Ev(ptr noundef nonnull align 8 dereferenceable(288) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.__gnu_cxx::__normal_iterator.43", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator.43", align 8
  store ptr getelementptr inbounds inrange(-16, 32) (i8, ptr @_ZTVN4ardb14ChannelServiceE, i64 16), ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr getelementptr inbounds inrange(-16, 24) (i8, ptr @_ZTVN4ardb14ChannelServiceE, i64 64), ptr %4, align 8, !tbaa !5
  invoke void @_ZN4ardb14ChannelService16CloseAllChannelsEb(ptr noundef nonnull align 8 dereferenceable(288) %0, i1 noundef zeroext false)
          to label %5 unwind label %.loopexit.split-lp

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !8
  invoke void @aeDeleteEventLoop(ptr noundef %7)
          to label %8 unwind label %.loopexit.split-lp

8:                                                ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %9 = getelementptr inbounds i8, ptr %0, i64 136
  %10 = tail call ptr @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  store ptr %10, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %11 = tail call ptr @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  store ptr %11, ptr %3, align 8
  %12 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %8, %23
  %13 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %14 = load ptr, ptr %13, align 8, !tbaa !38
  invoke void @_ZN4ardb6Thread4JoinEv(ptr noundef nonnull align 8 dereferenceable(28) %14)
          to label %15 unwind label %.loopexit

15:                                               ; preds = %.lr.ph
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %17 = load ptr, ptr %16, align 8, !tbaa !38
  %18 = icmp eq ptr %17, null
  br i1 %18, label %23, label %19

19:                                               ; preds = %15
  %20 = load ptr, ptr %17, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  %22 = load ptr, ptr %21, align 8
  call void %22(ptr noundef nonnull align 8 dereferenceable(28) %17) #6
  br label %23

23:                                               ; preds = %19, %15
  %24 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %25 = call ptr @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  store ptr %25, ptr %3, align 8
  %26 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPPN4ardb6ThreadESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br i1 %26, label %.lr.ph, label %._crit_edge, !llvm.loop !39

._crit_edge:                                      ; preds = %23, %8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %27 = getelementptr inbounds i8, ptr %0, i64 168
  call void @_ZN4ardb9SPSCQueueIPNS_8RunnableEED2Ev(ptr noundef nonnull align 8 dereferenceable(96) %27) #6
  call void @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  %28 = getelementptr inbounds i8, ptr %0, i64 112
  call void @_ZNSt6vectorIPN4ardb14ChannelServiceESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %28) #6
  %29 = getelementptr inbounds i8, ptr %0, i64 88
  call void @_ZN4ardb9MPSCQueueINS_21ChannelAsyncIOContextEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %29) #6
  %30 = getelementptr inbounds i8, ptr %0, i64 64
  call void @_ZNSt7__cxx1110_List_baseIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %30) #6
  %31 = getelementptr inbounds i8, ptr %0, i64 16
  call void @_ZN5btree15btree_containerINS_5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS5_EELi256EEEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %31) #6
  call void @_ZN4ardb17SoftSignalHandlerD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @_ZN4ardb8RunnableD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  ret void

.loopexit:                                        ; preds = %.lr.ph
  %lpad.loopexit = landingpad { ptr, i32 }
          catch ptr null
  br label %32

.loopexit.split-lp:                               ; preds = %1, %5
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          catch ptr null
  br label %32

32:                                               ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  %33 = extractvalue { ptr, i32 } %lpad.phi, 0
  call void @__clang_call_terminate(ptr %33) #7
  unreachable
}

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

declare void @aeDeleteEventLoop(ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EE5beginEv(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_cxxneIPPN4ardb6ThreadESt6vectorIS3_SaIS3_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 ptr @_ZNSt6vectorIPN4ardb6ThreadESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

declare void @_ZN4ardb6Thread4JoinEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #5

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

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

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

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 = { 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 #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 = { "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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !18, i64 32}
!9 = !{!"_ZTSN4ardb14ChannelServiceE", !10, i64 0, !11, i64 8, !12, i64 16, !20, i64 24, !18, i64 32, !18, i64 40, !18, i64 48, !18, i64 56, !21, i64 64, !27, i64 88, !28, i64 104, !20, i64 108, !29, i64 112, !33, i64 136, !26, i64 160, !37, i64 168, !18, i64 264, !20, i64 272, !18, i64 280}
!10 = !{!"_ZTSN4ardb8RunnableE"}
!11 = !{!"_ZTSN4ardb17SoftSignalHandlerE"}
!12 = !{!"_ZTSN5btree9btree_mapIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS3_EELi256EEE", !13, i64 0}
!13 = !{!"_ZTSN5btree19btree_map_containerINS_5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS5_EELi256EEEEEEE", !14, i64 0}
!14 = !{!"_ZTSN5btree22btree_unique_containerINS_5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS5_EELi256EEEEEEE", !15, i64 0}
!15 = !{!"_ZTSN5btree15btree_containerINS_5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS5_EELi256EEEEEEE", !16, i64 0}
!16 = !{!"_ZTSN5btree5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS4_EELi256EEEEE", !17, i64 0}
!17 = !{!"_ZTSN5btree5btreeINS_16btree_map_paramsIjPN4ardb7ChannelESt4lessIjESaISt4pairIKjS4_EELi256EEEE17empty_base_handleISaIcEPNS_10btree_nodeISB_EEEE", !18, i64 0}
!18 = !{!"any pointer", !19, i64 0}
!19 = !{!"omnipotent char", !7, i64 0}
!20 = !{!"int", !19, i64 0}
!21 = !{!"_ZTSNSt7__cxx114listIjSaIjEEE", !22, i64 0}
!22 = !{!"_ZTSNSt7__cxx1110_List_baseIjSaIjEEE", !23, i64 0}
!23 = !{!"_ZTSNSt7__cxx1110_List_baseIjSaIjEE10_List_implE", !24, i64 0}
!24 = !{!"_ZTSNSt8__detail17_List_node_headerE", !25, i64 0, !26, i64 16}
!25 = !{!"_ZTSNSt8__detail15_List_node_baseE", !18, i64 0, !18, i64 8}
!26 = !{!"long", !19, i64 0}
!27 = !{!"_ZTSN4ardb9MPSCQueueINS_21ChannelAsyncIOContextEEE", !18, i64 0, !18, i64 8}
!28 = !{!"bool", !19, i64 0}
!29 = !{!"_ZTSSt6vectorIPN4ardb14ChannelServiceESaIS2_EE", !30, i64 0}
!30 = !{!"_ZTSSt12_Vector_baseIPN4ardb14ChannelServiceESaIS2_EE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIPN4ardb14ChannelServiceESaIS2_EE12_Vector_implE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIPN4ardb14ChannelServiceESaIS2_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!33 = !{!"_ZTSSt6vectorIPN4ardb6ThreadESaIS2_EE", !34, i64 0}
!34 = !{!"_ZTSSt12_Vector_baseIPN4ardb6ThreadESaIS2_EE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIPN4ardb6ThreadESaIS2_EE12_Vector_implE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseIPN4ardb6ThreadESaIS2_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!37 = !{!"_ZTSN4ardb9SPSCQueueIPNS_8RunnableEEE", !18, i64 0, !19, i64 8, !18, i64 72, !18, i64 80, !18, i64 88}
!38 = !{!18, !18, i64 0}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}


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