; LLVM IR from chensoft/libsocket :: src/core/reactor.linux/ZN4chen7reactor6gatherENSt6chrono8durationIlSt5ratioILl1_431c2f7e (ZN4chen7reactor6gatherENSt6chrono8durationIlSt5ratioILl1ELl1000000000EEEE)

; 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::error_code" = type { i32, ptr }
%"class.std::chrono::duration" = type { i64 }
%"class.chen::reactor" = type { i32, %"class.std::unordered_set", %"class.chen::ev_event", i8, %"class.std::vector", %"class.std::vector.5", %"class.std::queue" }
%"class.std::unordered_set" = 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.chen::ev_event" = type { %"class.chen::ev_handle.base", i8, %"class.std::function" }
%"class.chen::ev_handle.base" = type <{ %"class.chen::ev_base", i32 }>
%"class.chen::ev_base" = type { ptr, ptr, i32, i32 }
%"class.std::function" = 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<chen::ev_timer *, std::allocator<chen::ev_timer *>>::_Vector_impl" }
%"struct.std::_Vector_base<chen::ev_timer *, std::allocator<chen::ev_timer *>>::_Vector_impl" = type { %"struct.std::_Vector_base<chen::ev_timer *, std::allocator<chen::ev_timer *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<chen::ev_timer *, std::allocator<chen::ev_timer *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<epoll_event, std::allocator<epoll_event>>::_Vector_impl" }
%"struct.std::_Vector_base<epoll_event, std::allocator<epoll_event>>::_Vector_impl" = type { %"struct.std::_Vector_base<epoll_event, std::allocator<epoll_event>>::_Vector_impl_data" }
%"struct.std::_Vector_base<epoll_event, std::allocator<epoll_event>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<chen::ev_base *, int>, std::allocator<std::pair<chen::ev_base *, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<chen::ev_base *, int>, std::allocator<std::pair<chen::ev_base *, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<chen::ev_base *, int>, std::allocator<std::pair<chen::ev_base *, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<chen::ev_base *, int>, std::allocator<std::pair<chen::ev_base *, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%struct.epoll_event = type <{ i32, %union.epoll_data }>
%union.epoll_data = type { ptr }

@_ZTISt12system_error = external constant ptr
@.str.3 = external hidden unnamed_addr constant [30 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

declare ptr @__cxa_allocate_exception(i64)

declare { i32, ptr } @_ZN4chen3sys5errorEv() #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt12system_errorC2ESt10error_codePKc(ptr noundef nonnull align 8 dereferenceable(32), i32, ptr, ptr noundef) unnamed_addr #2 align 2

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt12system_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #4

; Function Attrs: mustprogress uwtable
define dso_local { i32, ptr } @_ZN4chen7reactor6gatherENSt6chrono8durationIlSt5ratioILl1ELl1000000000EEEE(ptr noundef nonnull align 8 dereferenceable(264) %0, i64 %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::error_code", align 8
  %4 = alloca %"class.std::chrono::duration", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::chrono::duration", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::error_code", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = getelementptr inbounds %"class.std::chrono::duration", ptr %4, i32 0, i32 0
  store i64 %1, ptr %15, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %17 = getelementptr inbounds %"class.chen::reactor", ptr %16, i32 0, i32 0
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds %"class.chen::reactor", ptr %16, i32 0, i32 5
  %20 = call noundef ptr @_ZNSt6vectorI11epoll_eventSaIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #7
  %21 = getelementptr inbounds %"class.chen::reactor", ptr %16, i32 0, i32 5
  %22 = call noundef i64 @_ZNKSt6vectorI11epoll_eventSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %21) #7
  %23 = trunc i64 %22 to i32
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %24 = call i64 @_ZNSt6chrono8durationIlSt5ratioILl1ELl1000000000EEE4zeroEv() #7
  %25 = getelementptr inbounds %"class.std::chrono::duration", ptr %7, i32 0, i32 0
  store i64 %24, ptr %25, align 8
  %26 = call noundef zeroext i1 @_ZNSt6chronoltIlSt5ratioILl1ELl1000000000EElS2_EEbRKNS_8durationIT_T0_EERKNS3_IT1_T2_EE(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %7)
  br i1 %26, label %27, label %28

27:                                               ; preds = %2
  br label %32

28:                                               ; preds = %2
  %29 = call noundef i64 @_ZNKSt6chrono8durationIlSt5ratioILl1ELl1000000000EEE5countEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %30 = sdiv i64 %29, 1000000
  %31 = trunc i64 %30 to i32
  br label %32

32:                                               ; preds = %28, %27
  %33 = phi i32 [ -1, %27 ], [ %31, %28 ]
  %34 = call i32 @epoll_wait(i32 noundef %18, ptr noundef %20, i32 noundef %23, i32 noundef %33)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  store i32 %34, ptr %6, align 4, !tbaa !38
  %35 = load i32, ptr %6, align 4, !tbaa !38
  %36 = icmp sle i32 %35, 0
  br i1 %36, label %37, label %73

37:                                               ; preds = %32
  %38 = load i32, ptr %6, align 4, !tbaa !38
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %46, label %40

40:                                               ; preds = %37
  %41 = call { i32, ptr } @_ZSt15make_error_codeSt4errc(i32 noundef 110) #7
  %42 = getelementptr inbounds { i32, ptr }, ptr %3, i32 0, i32 0
  %43 = extractvalue { i32, ptr } %41, 0
  store i32 %43, ptr %42, align 8
  %44 = getelementptr inbounds { i32, ptr }, ptr %3, i32 0, i32 1
  %45 = extractvalue { i32, ptr } %41, 1
  store ptr %45, ptr %44, align 8
  store i32 1, ptr %8, align 4
  br label %116

46:                                               ; preds = %37
  %47 = call ptr @__errno_location() #8
  %48 = load i32, ptr %47, align 4, !tbaa !38
  %49 = icmp eq i32 %48, 4
  br i1 %49, label %50, label %56

50:                                               ; preds = %46
  %51 = call { i32, ptr } @_ZSt15make_error_codeSt4errc(i32 noundef 4) #7
  %52 = getelementptr inbounds { i32, ptr }, ptr %3, i32 0, i32 0
  %53 = extractvalue { i32, ptr } %51, 0
  store i32 %53, ptr %52, align 8
  %54 = getelementptr inbounds { i32, ptr }, ptr %3, i32 0, i32 1
  %55 = extractvalue { i32, ptr } %51, 1
  store ptr %55, ptr %54, align 8
  store i32 1, ptr %8, align 4
  br label %116

56:                                               ; preds = %46
  %57 = call ptr @__cxa_allocate_exception(i64 32) #7
  %58 = invoke { i32, ptr } @_ZN4chen3sys5errorEv()
          to label %59 unwind label %69

59:                                               ; preds = %56
  %60 = getelementptr inbounds { i32, ptr }, ptr %9, i32 0, i32 0
  %61 = extractvalue { i32, ptr } %58, 0
  store i32 %61, ptr %60, align 8
  %62 = getelementptr inbounds { i32, ptr }, ptr %9, i32 0, i32 1
  %63 = extractvalue { i32, ptr } %58, 1
  store ptr %63, ptr %62, align 8
  %64 = getelementptr inbounds { i32, ptr }, ptr %9, i32 0, i32 0
  %65 = load i32, ptr %64, align 8
  %66 = getelementptr inbounds { i32, ptr }, ptr %9, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8
  invoke void @_ZNSt12system_errorC2ESt10error_codePKc(ptr noundef nonnull align 8 dereferenceable(32) %57, i32 %65, ptr %67, ptr noundef @.str.3)
          to label %68 unwind label %69

68:                                               ; preds = %59
  call void @__cxa_throw(ptr %57, ptr @_ZTISt12system_error, ptr @_ZNSt12system_errorD1Ev) #9
  unreachable

69:                                               ; preds = %59, %56
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %10, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %11, align 4
  call void @__cxa_free_exception(ptr %57) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %118

73:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !38
  br label %74

74:                                               ; preds = %110, %73
  %75 = load i32, ptr %12, align 4, !tbaa !38
  %76 = load i32, ptr %6, align 4, !tbaa !38
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  store i32 2, ptr %8, align 4
  br label %113

79:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %80 = getelementptr inbounds %"class.chen::reactor", ptr %16, i32 0, i32 5
  %81 = load i32, ptr %12, align 4, !tbaa !38
  %82 = sext i32 %81 to i64
  %83 = call noundef nonnull align 1 dereferenceable(12) ptr @_ZNSt6vectorI11epoll_eventSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %80, i64 noundef %82) #7
  store ptr %83, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.epoll_event, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 1, !tbaa !39
  store ptr %86, ptr %14, align 8, !tbaa !5
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = getelementptr inbounds %"class.chen::reactor", ptr %16, i32 0, i32 2
  %89 = icmp eq ptr %87, %88
  br i1 %89, label %90, label %97

90:                                               ; preds = %79
  %91 = getelementptr inbounds %"class.chen::reactor", ptr %16, i32 0, i32 2
  call void @_ZN4chen8ev_event5resetEv(ptr noundef nonnull align 8 dereferenceable(64) %91)
  %92 = call { i32, ptr } @_ZSt15make_error_codeSt4errc(i32 noundef 125) #7
  %93 = getelementptr inbounds { i32, ptr }, ptr %3, i32 0, i32 0
  %94 = extractvalue { i32, ptr } %92, 0
  store i32 %94, ptr %93, align 8
  %95 = getelementptr inbounds { i32, ptr }, ptr %3, i32 0, i32 1
  %96 = extractvalue { i32, ptr } %92, 1
  store ptr %96, ptr %95, align 8
  store i32 1, ptr %8, align 4
  br label %107

97:                                               ; preds = %79
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  %99 = icmp ne ptr %98, null
  br i1 %99, label %100, label %106

100:                                              ; preds = %97
  %101 = load ptr, ptr %14, align 8, !tbaa !5
  %102 = load ptr, ptr %13, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.epoll_event, ptr %102, i32 0, i32 0
  %104 = load i32, ptr %103, align 1, !tbaa !40
  %105 = call noundef i32 @_ZN12_GLOBAL__N_17ep_typeEi(i32 noundef %104)
  call void @_ZN4chen7reactor4postEPNS_9ev_handleEi(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef %101, i32 noundef %105)
  br label %106

106:                                              ; preds = %100, %97
  store i32 0, ptr %8, align 4
  br label %107

107:                                              ; preds = %106, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %108 = load i32, ptr %8, align 4
  switch i32 %108, label %113 [
    i32 0, label %109
  ]

109:                                              ; preds = %107
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %12, align 4, !tbaa !38
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %12, align 4, !tbaa !38
  br label %74, !llvm.loop !42

113:                                              ; preds = %107, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %114 = load i32, ptr %8, align 4
  switch i32 %114, label %116 [
    i32 2, label %115
  ]

115:                                              ; preds = %113
  call void @_ZNSt10error_codeC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  store i32 1, ptr %8, align 4
  br label %116

116:                                              ; preds = %115, %113, %50, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %117 = load { i32, ptr }, ptr %3, align 8
  ret { i32, ptr } %117

118:                                              ; preds = %69
  %119 = load ptr, ptr %10, align 8
  %120 = load i32, ptr %11, align 4
  %121 = insertvalue { ptr, i32 } poison, ptr %119, 0
  %122 = insertvalue { ptr, i32 } %121, i32 %120, 1
  resume { ptr, i32 } %122
}

declare i32 @epoll_wait(i32 noundef, ptr noundef, i32 noundef, i32 noundef) #1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local i64 @_ZNSt6chrono8durationIlSt5ratioILl1ELl1000000000EEE4zeroEv() #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local { i32, ptr } @_ZSt15make_error_codeSt4errc(i32 noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(12) ptr @_ZNSt6vectorI11epoll_eventSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #5 align 2

declare void @_ZN4chen8ev_event5resetEv(ptr noundef nonnull align 8 dereferenceable(64)) #1

declare void @_ZN4chen7reactor4postEPNS_9ev_handleEi(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef, i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_17ep_typeEi(i32 noundef) #5

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = { 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 #4 = { nounwind willreturn memory(none) "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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { noreturn }

!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, !11, i64 0}
!10 = !{!"_ZTSN4chen7reactorE", !11, i64 0, !12, i64 8, !18, i64 64, !21, i64 128, !24, i64 136, !28, i64 160, !32, i64 184}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSSt10_HashtableIPN4chen9ev_handleES2_SaIS2_ENSt8__detail9_IdentityESt8equal_toIS2_ESt4hashIS2_ENS4_18_Mod_range_hashingENS4_20_Default_ranged_hashENS4_20_Prime_rehash_policyENS4_17_Hashtable_traitsILb0ELb1ELb1EEEE", !6, i64 0, !14, i64 8, !15, i64 16, !14, i64 24, !16, i64 32, !6, i64 48}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!16 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !17, i64 0, !14, i64 8}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSN4chen8ev_eventE", !19, i64 0, !21, i64 28, !22, i64 32}
!19 = !{!"_ZTSN4chen9ev_handleE", !20, i64 0, !11, i64 24}
!20 = !{!"_ZTSN4chen7ev_baseE", !6, i64 8, !11, i64 16, !11, i64 20}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSSt8functionIFvvEE", !23, i64 0, !6, i64 24}
!23 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!24 = !{!"_ZTSSt6vectorIPN4chen8ev_timerESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"_ZTSSt6vectorI11epoll_eventSaIS0_EE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseI11epoll_eventSaIS0_EE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseI11epoll_eventSaIS0_EE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseI11epoll_eventSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!32 = !{!"_ZTSSt5queueISt4pairIPN4chen7ev_baseEiESt5dequeIS4_SaIS4_EEE", !33, i64 0}
!33 = !{!"_ZTSSt5dequeISt4pairIPN4chen7ev_baseEiESaIS4_EE", !34, i64 0}
!34 = !{!"_ZTSSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE", !35, i64 0}
!35 = !{!"_ZTSNSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE11_Deque_implE", !36, i64 0}
!36 = !{!"_ZTSNSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE16_Deque_impl_dataE", !6, i64 0, !14, i64 8, !37, i64 16, !37, i64 48}
!37 = !{!"_ZTSSt15_Deque_iteratorISt4pairIPN4chen7ev_baseEiERS4_PS4_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!38 = !{!11, !11, i64 0}
!39 = !{!7, !7, i64 0}
!40 = !{!41, !11, i64 0}
!41 = !{!"_ZTS11epoll_event", !11, i64 0, !7, i64 4}
!42 = distinct !{!42, !43}
!43 = !{!"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::error_code" = type { i32, ptr }
%"class.std::chrono::duration" = type { i64 }

@_ZTISt12system_error = external constant ptr
@.str.3 = external hidden unnamed_addr constant [30 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare { i32, ptr } @_ZN4chen3sys5errorEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt12system_errorC2ESt10error_codePKc(ptr noundef nonnull align 8 dereferenceable(32), i32, ptr, ptr noundef) unnamed_addr #2 align 2

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt12system_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local { i32, ptr } @_ZN4chen7reactor6gatherENSt6chrono8durationIlSt5ratioILl1ELl1000000000EEEE(ptr noundef nonnull align 8 dereferenceable(264) %0, i64 %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::error_code", align 8
  %4 = alloca %"class.std::chrono::duration", align 8
  %5 = alloca %"class.std::chrono::duration", align 8
  store i64 %1, ptr %4, align 8
  %6 = load i32, ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 160
  %8 = tail call noundef ptr @_ZNSt6vectorI11epoll_eventSaIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %9 = tail call noundef i64 @_ZNKSt6vectorI11epoll_eventSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %10 = trunc i64 %9 to i32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %11 = tail call i64 @_ZNSt6chrono8durationIlSt5ratioILl1ELl1000000000EEE4zeroEv() #7
  store i64 %11, ptr %5, align 8
  %12 = call noundef zeroext i1 @_ZNSt6chronoltIlSt5ratioILl1ELl1000000000EElS2_EEbRKNS_8durationIT_T0_EERKNS3_IT1_T2_EE(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  br i1 %12, label %17, label %13

13:                                               ; preds = %2
  %14 = call noundef i64 @_ZNKSt6chrono8durationIlSt5ratioILl1ELl1000000000EEE5countEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %15 = sdiv i64 %14, 1000000
  %16 = trunc i64 %15 to i32
  br label %17

17:                                               ; preds = %2, %13
  %18 = phi i32 [ %16, %13 ], [ -1, %2 ]
  %19 = call i32 @epoll_wait(i32 noundef %6, ptr noundef %8, i32 noundef %10, i32 noundef %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %20 = icmp slt i32 %19, 1
  br i1 %20, label %22, label %.preheader

.preheader:                                       ; preds = %17
  %21 = getelementptr inbounds i8, ptr %0, i64 64
  %wide.trip.count = zext nneg i32 %19 to i64
  br label %44

22:                                               ; preds = %17
  %.not23 = icmp eq i32 %19, 0
  br i1 %.not23, label %23, label %27

23:                                               ; preds = %22
  %24 = call { i32, ptr } @_ZSt15make_error_codeSt4errc(i32 noundef 110) #7
  %25 = extractvalue { i32, ptr } %24, 0
  %26 = extractvalue { i32, ptr } %24, 1
  br label %57

27:                                               ; preds = %22
  %28 = tail call ptr @__errno_location() #8
  %29 = load i32, ptr %28, align 4, !tbaa !37
  %30 = icmp eq i32 %29, 4
  br i1 %30, label %31, label %35

31:                                               ; preds = %27
  %32 = call { i32, ptr } @_ZSt15make_error_codeSt4errc(i32 noundef 4) #7
  %33 = extractvalue { i32, ptr } %32, 0
  %34 = extractvalue { i32, ptr } %32, 1
  br label %57

35:                                               ; preds = %27
  %36 = call ptr @__cxa_allocate_exception(i64 32) #7
  %37 = invoke { i32, ptr } @_ZN4chen3sys5errorEv()
          to label %38 unwind label %42

38:                                               ; preds = %35
  %39 = extractvalue { i32, ptr } %37, 0
  %40 = extractvalue { i32, ptr } %37, 1
  invoke void @_ZNSt12system_errorC2ESt10error_codePKc(ptr noundef nonnull align 8 dereferenceable(32) %36, i32 %39, ptr %40, ptr noundef nonnull @.str.3)
          to label %41 unwind label %42

41:                                               ; preds = %38
  call void @__cxa_throw(ptr nonnull %36, ptr nonnull @_ZTISt12system_error, ptr nonnull @_ZNSt12system_errorD1Ev) #9
  unreachable

42:                                               ; preds = %38, %35
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %36) #7
  resume { ptr, i32 } %43

44:                                               ; preds = %.preheader, %52
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %52 ]
  %45 = call noundef nonnull align 1 dereferenceable(12) ptr @_ZNSt6vectorI11epoll_eventSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv) #7
  %46 = getelementptr inbounds i8, ptr %45, i64 4
  %47 = load ptr, ptr %46, align 1, !tbaa !38
  %.not21 = icmp eq ptr %47, %21
  br i1 %.not21, label %53, label %48

48:                                               ; preds = %44
  %.not = icmp eq ptr %47, null
  br i1 %.not, label %52, label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %45, align 1, !tbaa !39
  %51 = call noundef i32 @_ZN12_GLOBAL__N_17ep_typeEi(i32 noundef %50)
  call void @_ZN4chen7reactor4postEPNS_9ev_handleEi(ptr noundef nonnull align 8 dereferenceable(264) %0, ptr noundef nonnull %47, i32 noundef %51)
  br label %52

52:                                               ; preds = %48, %49
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %44, !llvm.loop !41

53:                                               ; preds = %44
  call void @_ZN4chen8ev_event5resetEv(ptr noundef nonnull align 8 dereferenceable(64) %21)
  %54 = call { i32, ptr } @_ZSt15make_error_codeSt4errc(i32 noundef 125) #7
  %55 = extractvalue { i32, ptr } %54, 0
  %56 = extractvalue { i32, ptr } %54, 1
  br label %57

.critedge:                                        ; preds = %52
  call void @_ZNSt10error_codeC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  %.fca.0.load.pre = load i32, ptr %3, align 8
  %.fca.1.gep.phi.trans.insert = getelementptr inbounds i8, ptr %3, i64 8
  %.fca.1.load.pre = load ptr, ptr %.fca.1.gep.phi.trans.insert, align 8
  br label %57

57:                                               ; preds = %53, %.critedge, %31, %23
  %.fca.1.load = phi ptr [ %56, %53 ], [ %.fca.1.load.pre, %.critedge ], [ %34, %31 ], [ %26, %23 ]
  %.fca.0.load = phi i32 [ %55, %53 ], [ %.fca.0.load.pre, %.critedge ], [ %33, %31 ], [ %25, %23 ]
  %.fca.0.insert = insertvalue { i32, ptr } poison, i32 %.fca.0.load, 0
  %.fca.1.insert = insertvalue { i32, ptr } %.fca.0.insert, ptr %.fca.1.load, 1
  ret { i32, ptr } %.fca.1.insert
}

declare i32 @epoll_wait(i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI11epoll_eventSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNSt6chronoltIlSt5ratioILl1ELl1000000000EElS2_EEbRKNS_8durationIT_T0_EERKNS3_IT1_T2_EE(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 i64 @_ZNSt6chrono8durationIlSt5ratioILl1ELl1000000000EEE4zeroEv() local_unnamed_addr #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local { i32, ptr } @_ZSt15make_error_codeSt4errc(i32 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(12) ptr @_ZNSt6vectorI11epoll_eventSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #5 align 2

declare void @_ZN4chen8ev_event5resetEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1

declare void @_ZN4chen7reactor4postEPNS_9ev_handleEi(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_17ep_typeEi(i32 noundef) local_unnamed_addr #5

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = { 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 #4 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { noreturn }

!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 = !{!"_ZTSN4chen7reactorE", !7, i64 0, !10, i64 8, !17, i64 64, !20, i64 128, !23, i64 136, !27, i64 160, !31, i64 184}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE", !11, i64 0}
!11 = !{!"_ZTSSt10_HashtableIPN4chen9ev_handleES2_SaIS2_ENSt8__detail9_IdentityESt8equal_toIS2_ESt4hashIS2_ENS4_18_Mod_range_hashingENS4_20_Default_ranged_hashENS4_20_Prime_rehash_policyENS4_17_Hashtable_traitsILb0ELb1ELb1EEEE", !12, i64 0, !13, i64 8, !14, i64 16, !13, i64 24, !15, i64 32, !12, i64 48}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !12, i64 0}
!15 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !16, i64 0, !13, i64 8}
!16 = !{!"float", !8, i64 0}
!17 = !{!"_ZTSN4chen8ev_eventE", !18, i64 0, !20, i64 28, !21, i64 32}
!18 = !{!"_ZTSN4chen9ev_handleE", !19, i64 0, !7, i64 24}
!19 = !{!"_ZTSN4chen7ev_baseE", !12, i64 8, !7, i64 16, !7, i64 20}
!20 = !{!"bool", !8, i64 0}
!21 = !{!"_ZTSSt8functionIFvvEE", !22, i64 0, !12, i64 24}
!22 = !{!"_ZTSSt14_Function_base", !8, i64 0, !12, i64 16}
!23 = !{!"_ZTSSt6vectorIPN4chen8ev_timerESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!27 = !{!"_ZTSSt6vectorI11epoll_eventSaIS0_EE", !28, i64 0}
!28 = !{!"_ZTSSt12_Vector_baseI11epoll_eventSaIS0_EE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseI11epoll_eventSaIS0_EE12_Vector_implE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseI11epoll_eventSaIS0_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!31 = !{!"_ZTSSt5queueISt4pairIPN4chen7ev_baseEiESt5dequeIS4_SaIS4_EEE", !32, i64 0}
!32 = !{!"_ZTSSt5dequeISt4pairIPN4chen7ev_baseEiESaIS4_EE", !33, i64 0}
!33 = !{!"_ZTSSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE", !34, i64 0}
!34 = !{!"_ZTSNSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE11_Deque_implE", !35, i64 0}
!35 = !{!"_ZTSNSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE16_Deque_impl_dataE", !12, i64 0, !13, i64 8, !36, i64 16, !36, i64 48}
!36 = !{!"_ZTSSt15_Deque_iteratorISt4pairIPN4chen7ev_baseEiERS4_PS4_E", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!37 = !{!7, !7, i64 0}
!38 = !{!8, !8, i64 0}
!39 = !{!40, !7, i64 0}
!40 = !{!"_ZTS11epoll_event", !7, i64 0, !8, i64 4}
!41 = distinct !{!41, !42}
!42 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass