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

; 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::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 }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"class.chw::LogContextCapture" = type { %"class.std::shared_ptr.31", ptr }
%"class.std::shared_ptr.31" = type { %"class.std::__shared_ptr.32" }
%"class.std::__shared_ptr.32" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"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 }
%"struct.std::pair.74" = type { i64, %"class.std::shared_ptr.76" }
%"class.std::shared_ptr.76" = type { %"class.std::__shared_ptr.77" }
%"class.std::__shared_ptr.77" = type { ptr, %"class.std::__shared_count" }

@.str.2 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1
@_ZTISt9exception = external constant ptr
@__FUNCTION__._ZN3chw9EventLoop14flushDelayTaskEm = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [40 x i8], align 1

; 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 @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #1 align 2

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

declare ptr @__cxa_begin_catch(ptr)

declare void @__cxa_end_catch()

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

declare noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv() #3

declare void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA40_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(40)) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #6 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN3chw9EventLoop14flushDelayTaskEm(ptr noundef nonnull align 8 dereferenceable(432) %0, i64 noundef %1) #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.std::multimap", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.chw::LogContextCapture", align 8
  %16 = alloca ptr, align 8
  %17 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %18 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %19 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %20 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %21 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %23 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %24 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #8
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  %25 = getelementptr inbounds %"class.chw::EventLoop", ptr %24, i32 0, i32 12
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE4swapERSC_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(48) %25) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %26 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  %27 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %7, i32 0, i32 0
  store ptr %26, ptr %27, align 8
  br label %28

28:                                               ; preds = %94, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %29 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  %30 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %8, i32 0, i32 0
  store ptr %29, ptr %30, align 8
  %31 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEESB_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  br i1 %31, label %32, label %38

32:                                               ; preds = %28
  %33 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %34 = getelementptr inbounds %"struct.std::pair.74", ptr %33, i32 0, i32 0
  %35 = load i64, ptr %34, align 8, !tbaa !11
  %36 = load i64, ptr %5, align 8, !tbaa !9
  %37 = icmp ule i64 %35, %36
  br label %38

38:                                               ; preds = %32, %28
  %39 = phi i1 [ false, %28 ], [ %37, %32 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br i1 %39, label %41, label %40

40:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %121

41:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %42 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %43 = getelementptr inbounds %"struct.std::pair.74", ptr %42, i32 0, i32 1
  %44 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt19__shared_ptr_accessIN3chw17TaskCancelableImpIFmvEJEEELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1) %43) #8
  %45 = invoke noundef i64 @_ZNK3chw17TaskCancelableImpIFmvEJEEclEv(ptr noundef nonnull align 8 dereferenceable(40) %44)
          to label %46 unwind label %59

46:                                               ; preds = %41
  store i64 %45, ptr %9, align 8, !tbaa !9
  %47 = load i64, ptr %9, align 8, !tbaa !9
  %48 = icmp ne i64 %47, 0
  br i1 %48, label %49, label %67

49:                                               ; preds = %46
  %50 = getelementptr inbounds %"class.chw::EventLoop", ptr %24, i32 0, i32 12
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %51 = load i64, ptr %9, align 8, !tbaa !9
  %52 = load i64, ptr %5, align 8, !tbaa !9
  %53 = add i64 %51, %52
  store i64 %53, ptr %12, align 8, !tbaa !9
  %54 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %55 = getelementptr inbounds %"struct.std::pair.74", ptr %54, i32 0, i32 1
  %56 = invoke ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE7emplaceIJmS5_EEESt17_Rb_tree_iteratorISA_EDpOT_(ptr noundef nonnull align 8 dereferenceable(48) %50, ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(16) %55)
          to label %57 unwind label %63

57:                                               ; preds = %49
  %58 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %13, i32 0, i32 0
  store ptr %56, ptr %58, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %67

59:                                               ; preds = %41
  %60 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %10, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %11, align 4
  br label %68

63:                                               ; preds = %49
  %64 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %10, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %68

67:                                               ; preds = %57, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %89

68:                                               ; preds = %63, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %11, align 4
  %71 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #8
  %72 = icmp eq i32 %70, %71
  br i1 %72, label %73, label %120

73:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %74 = load ptr, ptr %10, align 8
  %75 = call ptr @__cxa_begin_catch(ptr %74) #8
  store ptr %75, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #8
  %76 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %77 unwind label %96

77:                                               ; preds = %73
  invoke void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(144) %76, i32 noundef 4, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw9EventLoop14flushDelayTaskEm, i32 noundef 524, ptr noundef @.str.3)
          to label %78 unwind label %96

78:                                               ; preds = %77
  %79 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA40_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 1 dereferenceable(40) @.str.6)
          to label %80 unwind label %100

80:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  %82 = load ptr, ptr %81, align 8, !tbaa !16
  %83 = getelementptr inbounds ptr, ptr %82, i64 2
  %84 = load ptr, ptr %83, align 8
  %85 = call noundef ptr %84(ptr noundef nonnull align 8 dereferenceable(8) %81) #8
  store ptr %85, ptr %16, align 8, !tbaa !5
  %86 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %79, ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %87 unwind label %104

87:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #8
  invoke void @__cxa_end_catch()
          to label %88 unwind label %110

88:                                               ; preds = %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %89

89:                                               ; preds = %88, %67
  br label %90

90:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %7, i64 8, i1 false), !tbaa.struct !18
  %91 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %18, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8
  %93 = invoke ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorISA_E(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr %92)
          to label %94 unwind label %116

94:                                               ; preds = %90
  %95 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %17, i32 0, i32 0
  store ptr %93, ptr %95, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %17, i64 8, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %28, !llvm.loop !19

96:                                               ; preds = %77, %73
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %10, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %11, align 4
  br label %109

100:                                              ; preds = %78
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %10, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %11, align 4
  br label %108

104:                                              ; preds = %80
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %10, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %108

108:                                              ; preds = %104, %100
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #8
  br label %109

109:                                              ; preds = %108, %96
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #8
  invoke void @__cxa_end_catch()
          to label %114 unwind label %160

110:                                              ; preds = %87
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %10, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %11, align 4
  br label %115

114:                                              ; preds = %109
  br label %115

115:                                              ; preds = %114, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %120

116:                                              ; preds = %90
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %10, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %120

120:                                              ; preds = %116, %115, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %154

121:                                              ; preds = %40
  %122 = getelementptr inbounds %"class.chw::EventLoop", ptr %24, i32 0, i32 12
  %123 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %122) #8
  %124 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %19, i32 0, i32 0
  store ptr %123, ptr %124, align 8
  %125 = getelementptr inbounds %"class.chw::EventLoop", ptr %24, i32 0, i32 12
  %126 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %125) #8
  %127 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %20, i32 0, i32 0
  store ptr %126, ptr %127, align 8
  %128 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %19, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8
  %130 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %20, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8
  invoke void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE6insertISt17_Rb_tree_iteratorISA_EEEvT_SG_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr %129, ptr %131)
          to label %132 unwind label %142

132:                                              ; preds = %121
  %133 = getelementptr inbounds %"class.chw::EventLoop", ptr %24, i32 0, i32 12
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE4swapERSC_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(48) %133) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %134 = getelementptr inbounds %"class.chw::EventLoop", ptr %24, i32 0, i32 12
  %135 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %134) #8
  %136 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %21, i32 0, i32 0
  store ptr %135, ptr %136, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %137 = getelementptr inbounds %"class.chw::EventLoop", ptr %24, i32 0, i32 12
  %138 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %137) #8
  %139 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %22, i32 0, i32 0
  store ptr %138, ptr %139, align 8
  %140 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEESB_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br i1 %140, label %141, label %146

141:                                              ; preds = %132
  store i64 0, ptr %3, align 8
  store i32 1, ptr %23, align 4
  br label %152

142:                                              ; preds = %121
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %10, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %11, align 4
  br label %154

146:                                              ; preds = %132
  %147 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  %148 = getelementptr inbounds %"struct.std::pair.74", ptr %147, i32 0, i32 0
  %149 = load i64, ptr %148, align 8, !tbaa !11
  %150 = load i64, ptr %5, align 8, !tbaa !9
  %151 = sub i64 %149, %150
  store i64 %151, ptr %3, align 8
  store i32 1, ptr %23, align 4
  br label %152

152:                                              ; preds = %146, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #8
  %153 = load i64, ptr %3, align 8
  ret i64 %153

154:                                              ; preds = %142, %120
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #8
  br label %155

155:                                              ; preds = %154
  %156 = load ptr, ptr %10, align 8
  %157 = load i32, ptr %11, align 4
  %158 = insertvalue { ptr, i32 } poison, ptr %156, 0
  %159 = insertvalue { ptr, i32 } %158, i32 %157, 1
  resume { ptr, i32 } %159

160:                                              ; preds = %109
  %161 = landingpad { ptr, i32 }
          catch ptr null
  %162 = extractvalue { ptr, i32 } %161, 0
  call void @__clang_call_terminate(ptr %162) #9
  unreachable
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK3chw17TaskCancelableImpIFmvEJEEclEv(ptr noundef nonnull align 8 dereferenceable(40)) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE7emplaceIJmS5_EEESt17_Rb_tree_iteratorISA_EDpOT_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorISA_E(ptr noundef nonnull align 8 dereferenceable(48), ptr) #6 align 2

; 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) #7

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE6insertISt17_Rb_tree_iteratorISA_EEEvT_SG_(ptr noundef nonnull align 8 dereferenceable(48), ptr, ptr) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

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 = { 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 #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 = { 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 #5 = { nounwind memory(none) }
attributes #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }
attributes #9 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSSt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEE", !10, i64 0, !13, i64 8}
!13 = !{!"_ZTSSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEE", !14, i64 0}
!14 = !{!"_ZTSSt12__shared_ptrIN3chw17TaskCancelableImpIFmvEJEEELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !15, i64 8}
!15 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !8, i64 0}
!18 = !{i64 0, i64 8, !5}
!19 = distinct !{!19, !20}
!20 = !{!"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.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 }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"class.chw::LogContextCapture" = type { %"class.std::shared_ptr.31", ptr }
%"class.std::shared_ptr.31" = type { %"class.std::__shared_ptr.32" }
%"class.std::__shared_ptr.32" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

@.str.2 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1
@_ZTISt9exception = external constant ptr
@__FUNCTION__._ZN3chw9EventLoop14flushDelayTaskEm = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [40 x i8], align 1

; 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 @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #1 align 2

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

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

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 #2

declare noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv() local_unnamed_addr #3

declare void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA40_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(40)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN3chw9EventLoop14flushDelayTaskEm(ptr noundef nonnull align 8 dereferenceable(432) %0, i64 noundef %1) local_unnamed_addr #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::multimap", align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.chw::LogContextCapture", align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #7
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  %11 = getelementptr inbounds i8, ptr %0, i64 384
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE4swapERSC_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(48) %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %12 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  br label %13

13:                                               ; preds = %53, %2
  %storemerge = phi ptr [ %12, %2 ], [ %54, %53 ]
  store ptr %storemerge, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %14 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %14, ptr %5, align 8
  %15 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEESB_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br i1 %15, label %16, label %.critedge

16:                                               ; preds = %13
  %17 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %18 = load i64, ptr %17, align 8, !tbaa !5
  %.not = icmp ugt i64 %18, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br i1 %.not, label %.loopexit, label %21

.critedge:                                        ; preds = %13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %.loopexit

.loopexit:                                        ; preds = %16, %.critedge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %19 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %11) #7
  %20 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %11) #7
  invoke void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE6insertISt17_Rb_tree_iteratorISA_EEEvT_SG_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr %19, ptr %20)
          to label %70 unwind label %74

21:                                               ; preds = %16
  %22 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt19__shared_ptr_accessIN3chw17TaskCancelableImpIFmvEJEEELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1) %23) #7
  %25 = invoke noundef i64 @_ZNK3chw17TaskCancelableImpIFmvEJEEclEv(ptr noundef nonnull align 8 dereferenceable(40) %24)
          to label %26 unwind label %33

26:                                               ; preds = %21
  %.not24 = icmp eq i64 %25, 0
  br i1 %.not24, label %53, label %27

27:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %28 = add i64 %25, %1
  store i64 %28, ptr %6, align 8, !tbaa !14
  %29 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %30 = getelementptr inbounds i8, ptr %29, i64 8
  %31 = invoke ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE7emplaceIJmS5_EEESt17_Rb_tree_iteratorISA_EDpOT_(ptr noundef nonnull align 8 dereferenceable(48) %11, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(16) %30)
          to label %32 unwind label %35

32:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %53

33:                                               ; preds = %21
  %34 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %37

35:                                               ; preds = %27
  %36 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %37

37:                                               ; preds = %35, %33
  %.pn = phi { ptr, i32 } [ %36, %35 ], [ %34, %33 ]
  %.015 = extractvalue { ptr, i32 } %.pn, 0
  %.016 = extractvalue { ptr, i32 } %.pn, 1
  %38 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #7
  %39 = icmp eq i32 %.016, %38
  br i1 %39, label %40, label %.loopexit31

40:                                               ; preds = %37
  %41 = call ptr @__cxa_begin_catch(ptr %.015) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  %42 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %43 unwind label %55

43:                                               ; preds = %40
  invoke void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(144) %42, i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw9EventLoop14flushDelayTaskEm, i32 noundef 524, ptr noundef nonnull @.str.3)
          to label %44 unwind label %55

44:                                               ; preds = %43
  %45 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA40_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 1 dereferenceable(40) @.str.6)
          to label %46 unwind label %57

46:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %47 = load ptr, ptr %41, align 8, !tbaa !15
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  %49 = load ptr, ptr %48, align 8
  %50 = call noundef ptr %49(ptr noundef nonnull align 8 dereferenceable(8) %41) #7
  store ptr %50, ptr %8, align 8, !tbaa !17
  %51 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %45, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %52 unwind label %59

52:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  invoke void @__cxa_end_catch()
          to label %53 unwind label %63

53:                                               ; preds = %52, %26, %32
  %.sroa.02.0.copyload = load ptr, ptr %4, align 8, !tbaa !17
  %54 = invoke ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorISA_E(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr %.sroa.02.0.copyload)
          to label %13 unwind label %66, !llvm.loop !18

55:                                               ; preds = %43, %40
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %62

57:                                               ; preds = %44
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %61

59:                                               ; preds = %46
  %60 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br label %61

61:                                               ; preds = %59, %57
  %.pn26 = phi { ptr, i32 } [ %60, %59 ], [ %58, %57 ]
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  br label %62

62:                                               ; preds = %61, %55
  %.pn26.pn = phi { ptr, i32 } [ %.pn26, %61 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  invoke void @__cxa_end_catch()
          to label %65 unwind label %86

63:                                               ; preds = %52
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %65

65:                                               ; preds = %62, %63
  %.pn29 = phi { ptr, i32 } [ %64, %63 ], [ %.pn26.pn, %62 ]
  %.3 = extractvalue { ptr, i32 } %.pn29, 0
  %.319 = extractvalue { ptr, i32 } %.pn29, 1
  br label %.loopexit31

66:                                               ; preds = %53
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  %69 = extractvalue { ptr, i32 } %67, 1
  br label %.loopexit31

.loopexit31:                                      ; preds = %37, %66, %65
  %.420 = phi i32 [ %69, %66 ], [ %.319, %65 ], [ %.016, %37 ]
  %.4 = phi ptr [ %68, %66 ], [ %.3, %65 ], [ %.015, %37 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %83

70:                                               ; preds = %.loopexit
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE4swapERSC_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(48) %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %71 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %11) #7
  store ptr %71, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %72 = call ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %11) #7
  store ptr %72, ptr %10, align 8
  %73 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEESB_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br i1 %73, label %82, label %78

74:                                               ; preds = %.loopexit
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  %77 = extractvalue { ptr, i32 } %75, 1
  br label %83

78:                                               ; preds = %70
  %79 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  %80 = load i64, ptr %79, align 8, !tbaa !5
  %81 = sub i64 %80, %1
  br label %82

82:                                               ; preds = %70, %78
  %.0 = phi i64 [ %81, %78 ], [ 0, %70 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #7
  ret i64 %.0

83:                                               ; preds = %74, %.loopexit31
  %.521 = phi i32 [ %.420, %.loopexit31 ], [ %77, %74 ]
  %.5 = phi ptr [ %.4, %.loopexit31 ], [ %76, %74 ]
  call void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #7
  %84 = insertvalue { ptr, i32 } poison, ptr %.5, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %.521, 1
  resume { ptr, i32 } %85

86:                                               ; preds = %62
  %87 = landingpad { ptr, i32 }
          catch ptr null
  %88 = extractvalue { ptr, i32 } %87, 0
  call void @__clang_call_terminate(ptr %88) #8
  unreachable
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK3chw17TaskCancelableImpIFmvEJEEclEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE7emplaceIJmS5_EEESt17_Rb_tree_iteratorISA_EDpOT_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorISA_E(ptr noundef nonnull align 8 dereferenceable(48), ptr) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt8multimapImSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEESt4lessImESaISt4pairIKmS5_EEE6insertISt17_Rb_tree_iteratorISA_EEEvT_SG_(ptr noundef nonnull align 8 dereferenceable(48), ptr, ptr) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEEESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

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 = { 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 #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 = { 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 #5 = { nofree nosync nounwind memory(none) }
attributes #6 = { 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 #7 = { 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, !7, i64 0}
!6 = !{!"_ZTSSt4pairIKmSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEEE", !7, i64 0, !10, i64 8}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt10shared_ptrIN3chw17TaskCancelableImpIFmvEJEEEE", !11, i64 0}
!11 = !{!"_ZTSSt12__shared_ptrIN3chw17TaskCancelableImpIFmvEJEEELN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !13, i64 8}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !9, i64 0}
!17 = !{!12, !12, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass