; LLVM IR from chensoft/libsocket :: src/core/reactor.linux.ll (ZN4chen7reactor3setEPNS_9ev_handleEii)

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

%struct.epoll_event = type <{ i32, %union.epoll_data }>
%union.epoll_data = type { ptr }
%"class.std::error_code" = type { i32, ptr }
%"struct.std::__detail::_Node_iterator" = type { %"struct.std::__detail::_Node_iterator_base" }
%"struct.std::__detail::_Node_iterator_base" = type { ptr }
%"struct.std::pair" = type <{ %"struct.std::__detail::_Node_iterator", i8, [7 x i8] }>
%"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 }

@_ZTISt12system_error = external constant ptr
@_ZN4chen7reactor8ModeReadE = external constant i32, align 4
@_ZN4chen7reactor9ModeWriteE = external constant i32, align 4
@.str.1 = external hidden unnamed_addr constant [29 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: mustprogress uwtable
define dso_local void @_ZN4chen7reactor3setEPNS_9ev_handleEii(ptr noundef nonnull align 8 dereferenceable(264) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.epoll_event, align 1
  %11 = alloca %"class.std::error_code", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::__detail::_Node_iterator", align 8
  %15 = alloca %"struct.std::__detail::_Node_iterator", align 8
  %16 = alloca %"struct.std::pair", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %17 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds ptr, ptr %19, i64 5
  %21 = load ptr, ptr %20, align 8
  %22 = call noundef i32 %21(ptr noundef nonnull align 8 dereferenceable(28) %18)
  store i32 %22, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #7
  call void @llvm.memset.p0.i64(ptr align 1 %10, i8 0, i64 12, i1 false)
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = load i32, ptr @_ZN4chen7reactor8ModeReadE, align 4, !tbaa !9
  %25 = and i32 %23, %24
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %31

27:                                               ; preds = %4
  %28 = getelementptr inbounds %struct.epoll_event, ptr %10, i32 0, i32 0
  %29 = load i32, ptr %28, align 1, !tbaa !13
  %30 = or i32 %29, 1
  store i32 %30, ptr %28, align 1, !tbaa !13
  br label %31

31:                                               ; preds = %27, %4
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = load i32, ptr @_ZN4chen7reactor9ModeWriteE, align 4, !tbaa !9
  %34 = and i32 %32, %33
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %40

36:                                               ; preds = %31
  %37 = getelementptr inbounds %struct.epoll_event, ptr %10, i32 0, i32 0
  %38 = load i32, ptr %37, align 1, !tbaa !13
  %39 = or i32 %38, 4
  store i32 %39, ptr %37, align 1, !tbaa !13
  br label %40

40:                                               ; preds = %36, %31
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = or i32 %41, 8192
  %43 = getelementptr inbounds %struct.epoll_event, ptr %10, i32 0, i32 0
  %44 = load i32, ptr %43, align 1, !tbaa !13
  %45 = or i32 %44, %42
  store i32 %45, ptr %43, align 1, !tbaa !13
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.epoll_event, ptr %10, i32 0, i32 1
  store ptr %46, ptr %47, align 1, !tbaa !15
  %48 = getelementptr inbounds %"class.chen::reactor", ptr %17, i32 0, i32 0
  %49 = load i32, ptr %48, align 8, !tbaa !16
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = call i32 @epoll_ctl(i32 noundef %49, i32 noundef 3, i32 noundef %50, ptr noundef %10) #7
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %81

53:                                               ; preds = %40
  %54 = call ptr @__errno_location() #8
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = icmp ne i32 %55, 2
  br i1 %56, label %63, label %57

57:                                               ; preds = %53
  %58 = getelementptr inbounds %"class.chen::reactor", ptr %17, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !16
  %60 = load i32, ptr %9, align 4, !tbaa !9
  %61 = call i32 @epoll_ctl(i32 noundef %59, i32 noundef 1, i32 noundef %60, ptr noundef %10) #7
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %80

63:                                               ; preds = %57, %53
  %64 = call ptr @__cxa_allocate_exception(i64 32) #7
  %65 = invoke { i32, ptr } @_ZN4chen3sys5errorEv()
          to label %66 unwind label %76

66:                                               ; preds = %63
  %67 = getelementptr inbounds { i32, ptr }, ptr %11, i32 0, i32 0
  %68 = extractvalue { i32, ptr } %65, 0
  store i32 %68, ptr %67, align 8
  %69 = getelementptr inbounds { i32, ptr }, ptr %11, i32 0, i32 1
  %70 = extractvalue { i32, ptr } %65, 1
  store ptr %70, ptr %69, align 8
  %71 = getelementptr inbounds { i32, ptr }, ptr %11, i32 0, i32 0
  %72 = load i32, ptr %71, align 8
  %73 = getelementptr inbounds { i32, ptr }, ptr %11, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8
  invoke void @_ZNSt12system_errorC2ESt10error_codePKc(ptr noundef nonnull align 8 dereferenceable(32) %64, i32 %72, ptr %74, ptr noundef @.str.1)
          to label %75 unwind label %76

75:                                               ; preds = %66
  call void @__cxa_throw(ptr %64, ptr @_ZTISt12system_error, ptr @_ZNSt12system_errorD1Ev) #9
  unreachable

76:                                               ; preds = %66, %63
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %12, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %13, align 4
  call void @__cxa_free_exception(ptr %64) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %105

80:                                               ; preds = %57
  br label %81

81:                                               ; preds = %80, %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %82 = getelementptr inbounds %"class.chen::reactor", ptr %17, i32 0, i32 1
  %83 = call ptr @_ZNSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(56) %82, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %84 = getelementptr inbounds %"struct.std::__detail::_Node_iterator", ptr %14, i32 0, i32 0
  %85 = getelementptr inbounds %"struct.std::__detail::_Node_iterator_base", ptr %84, i32 0, i32 0
  store ptr %83, ptr %85, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %86 = getelementptr inbounds %"class.chen::reactor", ptr %17, i32 0, i32 1
  %87 = call ptr @_ZNSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(56) %86) #7
  %88 = getelementptr inbounds %"struct.std::__detail::_Node_iterator", ptr %15, i32 0, i32 0
  %89 = getelementptr inbounds %"struct.std::__detail::_Node_iterator_base", ptr %88, i32 0, i32 0
  store ptr %87, ptr %89, align 8
  %90 = call noundef zeroext i1 @_ZNSt8__detaileqERKNS_19_Node_iterator_baseIPN4chen9ev_handleELb0EEES6_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br i1 %90, label %91, label %104

91:                                               ; preds = %81
  %92 = getelementptr inbounds %"class.chen::reactor", ptr %17, i32 0, i32 1
  %93 = call { ptr, i8 } @_ZNSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(56) %92, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %94 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 0
  %95 = extractvalue { ptr, i8 } %93, 0
  store ptr %95, ptr %94, align 8
  %96 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 1
  %97 = extractvalue { ptr, i8 } %93, 1
  store i8 %97, ptr %96, align 8
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = load i32, ptr %7, align 4, !tbaa !9
  %100 = load i32, ptr %8, align 4, !tbaa !9
  %101 = load ptr, ptr %98, align 8, !tbaa !11
  %102 = getelementptr inbounds ptr, ptr %101, i64 2
  %103 = load ptr, ptr %102, align 8
  call void %103(ptr noundef nonnull align 8 dereferenceable(28) %98, ptr noundef %17, i32 noundef %99, i32 noundef %100)
  br label %104

104:                                              ; preds = %91, %81
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  ret void

105:                                              ; preds = %76
  %106 = load ptr, ptr %12, align 8
  %107 = load i32, ptr %13, align 4
  %108 = insertvalue { ptr, i32 } poison, ptr %106, 0
  %109 = insertvalue { ptr, i32 } %108, i32 %107, 1
  resume { ptr, i32 } %109
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nounwind
declare i32 @epoll_ctl(i32 noundef, i32 noundef, i32 noundef, ptr noundef) #3

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(8)) #2 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS11epoll_event", !10, i64 0, !7, i64 4}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !10, i64 0}
!17 = !{!"_ZTSN4chen7reactorE", !10, i64 0, !18, i64 8, !24, i64 64, !27, i64 128, !30, i64 136, !34, i64 160, !38, i64 184}
!18 = !{!"_ZTSSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE", !19, i64 0}
!19 = !{!"_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, !20, i64 8, !21, i64 16, !20, i64 24, !22, i64 32, !6, i64 48}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!22 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !23, i64 0, !20, i64 8}
!23 = !{!"float", !7, i64 0}
!24 = !{!"_ZTSN4chen8ev_eventE", !25, i64 0, !27, i64 28, !28, i64 32}
!25 = !{!"_ZTSN4chen9ev_handleE", !26, i64 0, !10, i64 24}
!26 = !{!"_ZTSN4chen7ev_baseE", !6, i64 8, !10, i64 16, !10, i64 20}
!27 = !{!"bool", !7, i64 0}
!28 = !{!"_ZTSSt8functionIFvvEE", !29, i64 0, !6, i64 24}
!29 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!30 = !{!"_ZTSSt6vectorIPN4chen8ev_timerESaIS2_EE", !31, i64 0}
!31 = !{!"_ZTSSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE12_Vector_implE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!"_ZTSSt6vectorI11epoll_eventSaIS0_EE", !35, i64 0}
!35 = !{!"_ZTSSt12_Vector_baseI11epoll_eventSaIS0_EE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseI11epoll_eventSaIS0_EE12_Vector_implE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseI11epoll_eventSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!38 = !{!"_ZTSSt5queueISt4pairIPN4chen7ev_baseEiESt5dequeIS4_SaIS4_EEE", !39, i64 0}
!39 = !{!"_ZTSSt5dequeISt4pairIPN4chen7ev_baseEiESaIS4_EE", !40, i64 0}
!40 = !{!"_ZTSSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE", !41, i64 0}
!41 = !{!"_ZTSNSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE11_Deque_implE", !42, i64 0}
!42 = !{!"_ZTSNSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE16_Deque_impl_dataE", !6, i64 0, !20, i64 8, !43, i64 16, !43, i64 48}
!43 = !{!"_ZTSSt15_Deque_iteratorISt4pairIPN4chen7ev_baseEiERS4_PS4_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}


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

%struct.epoll_event = type <{ i32, %union.epoll_data }>
%union.epoll_data = type { ptr }
%"struct.std::__detail::_Node_iterator" = type { %"struct.std::__detail::_Node_iterator_base" }
%"struct.std::__detail::_Node_iterator_base" = type { ptr }

@_ZTISt12system_error = external constant ptr
@_ZN4chen7reactor8ModeReadE = external local_unnamed_addr constant i32, align 4
@_ZN4chen7reactor9ModeWriteE = external local_unnamed_addr constant i32, align 4
@.str.1 = external hidden unnamed_addr constant [29 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 uwtable
define dso_local void @_ZN4chen7reactor3setEPNS_9ev_handleEii(ptr noundef nonnull align 8 dereferenceable(264) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca %struct.epoll_event, align 4
  %7 = alloca %"struct.std::__detail::_Node_iterator", align 8
  %8 = alloca %"struct.std::__detail::_Node_iterator", align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %1, align 8, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %9, i64 40
  %11 = load ptr, ptr %10, align 8
  %12 = tail call noundef i32 %11(ptr noundef nonnull align 8 dereferenceable(28) %1)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #6
  %13 = load i32, ptr @_ZN4chen7reactor8ModeReadE, align 4, !tbaa !11
  %14 = and i32 %13, %2
  %.not = icmp ne i32 %14, 0
  %spec.select = zext i1 %.not to i32
  %15 = load i32, ptr @_ZN4chen7reactor9ModeWriteE, align 4, !tbaa !11
  %16 = and i32 %15, %2
  %.not10 = icmp eq i32 %16, 0
  %17 = or disjoint i32 %spec.select, 4
  %18 = select i1 %.not10, i32 %spec.select, i32 %17
  %19 = or i32 %18, %3
  %20 = or i32 %19, 8192
  store i32 %20, ptr %6, align 4, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %6, i64 4
  store ptr %1, ptr %21, align 4, !tbaa !15
  %22 = load i32, ptr %0, align 8, !tbaa !16
  %23 = call i32 @epoll_ctl(i32 noundef %22, i32 noundef 3, i32 noundef %12, ptr noundef nonnull %6) #6
  %.not11 = icmp eq i32 %23, 0
  br i1 %.not11, label %39, label %24

24:                                               ; preds = %4
  %25 = tail call ptr @__errno_location() #7
  %26 = load i32, ptr %25, align 4, !tbaa !11
  %.not12 = icmp eq i32 %26, 2
  br i1 %.not12, label %27, label %30

27:                                               ; preds = %24
  %28 = load i32, ptr %0, align 8, !tbaa !16
  %29 = call i32 @epoll_ctl(i32 noundef %28, i32 noundef 1, i32 noundef %12, ptr noundef nonnull %6) #6
  %.not13 = icmp eq i32 %29, 0
  br i1 %.not13, label %39, label %30

30:                                               ; preds = %27, %24
  %31 = call ptr @__cxa_allocate_exception(i64 32) #6
  %32 = invoke { i32, ptr } @_ZN4chen3sys5errorEv()
          to label %33 unwind label %37

33:                                               ; preds = %30
  %34 = extractvalue { i32, ptr } %32, 0
  %35 = extractvalue { i32, ptr } %32, 1
  invoke void @_ZNSt12system_errorC2ESt10error_codePKc(ptr noundef nonnull align 8 dereferenceable(32) %31, i32 %34, ptr %35, ptr noundef nonnull @.str.1)
          to label %36 unwind label %37

36:                                               ; preds = %33
  call void @__cxa_throw(ptr nonnull %31, ptr nonnull @_ZTISt12system_error, ptr nonnull @_ZNSt12system_errorD1Ev) #8
  unreachable

37:                                               ; preds = %33, %30
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %31) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #6
  resume { ptr, i32 } %38

39:                                               ; preds = %27, %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %40 = getelementptr inbounds i8, ptr %0, i64 8
  %41 = call ptr @_ZNSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(56) %40, ptr noundef nonnull align 8 dereferenceable(8) %5)
  store ptr %41, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %42 = call ptr @_ZNSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(56) %40) #6
  store ptr %42, ptr %8, align 8
  %43 = call noundef zeroext i1 @_ZNSt8__detaileqERKNS_19_Node_iterator_baseIPN4chen9ev_handleELb0EEES6_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br i1 %43, label %44, label %50

44:                                               ; preds = %39
  %45 = call { ptr, i8 } @_ZNSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(56) %40, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  %49 = load ptr, ptr %48, align 8
  call void %49(ptr noundef nonnull align 8 dereferenceable(28) %46, ptr noundef nonnull %0, i32 noundef %2, i32 noundef %3)
  br label %50

50:                                               ; preds = %44, %39
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #6
  ret void
}

; Function Attrs: nounwind
declare i32 @epoll_ctl(i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 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 = { nounwind }
attributes #7 = { nounwind willreturn memory(none) }
attributes #8 = { 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTS11epoll_event", !12, i64 0, !7, i64 4}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !12, i64 0}
!17 = !{!"_ZTSN4chen7reactorE", !12, i64 0, !18, i64 8, !24, i64 64, !27, i64 128, !30, i64 136, !34, i64 160, !38, i64 184}
!18 = !{!"_ZTSSt13unordered_setIPN4chen9ev_handleESt4hashIS2_ESt8equal_toIS2_ESaIS2_EE", !19, i64 0}
!19 = !{!"_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, !20, i64 8, !21, i64 16, !20, i64 24, !22, i64 32, !6, i64 48}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!22 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !23, i64 0, !20, i64 8}
!23 = !{!"float", !7, i64 0}
!24 = !{!"_ZTSN4chen8ev_eventE", !25, i64 0, !27, i64 28, !28, i64 32}
!25 = !{!"_ZTSN4chen9ev_handleE", !26, i64 0, !12, i64 24}
!26 = !{!"_ZTSN4chen7ev_baseE", !6, i64 8, !12, i64 16, !12, i64 20}
!27 = !{!"bool", !7, i64 0}
!28 = !{!"_ZTSSt8functionIFvvEE", !29, i64 0, !6, i64 24}
!29 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!30 = !{!"_ZTSSt6vectorIPN4chen8ev_timerESaIS2_EE", !31, i64 0}
!31 = !{!"_ZTSSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE12_Vector_implE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseIPN4chen8ev_timerESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!"_ZTSSt6vectorI11epoll_eventSaIS0_EE", !35, i64 0}
!35 = !{!"_ZTSSt12_Vector_baseI11epoll_eventSaIS0_EE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseI11epoll_eventSaIS0_EE12_Vector_implE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseI11epoll_eventSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!38 = !{!"_ZTSSt5queueISt4pairIPN4chen7ev_baseEiESt5dequeIS4_SaIS4_EEE", !39, i64 0}
!39 = !{!"_ZTSSt5dequeISt4pairIPN4chen7ev_baseEiESaIS4_EE", !40, i64 0}
!40 = !{!"_ZTSSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE", !41, i64 0}
!41 = !{!"_ZTSNSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE11_Deque_implE", !42, i64 0}
!42 = !{!"_ZTSNSt11_Deque_baseISt4pairIPN4chen7ev_baseEiESaIS4_EE16_Deque_impl_dataE", !6, i64 0, !20, i64 8, !43, i64 16, !43, i64 48}
!43 = !{!"_ZTSSt15_Deque_iteratorISt4pairIPN4chen7ev_baseEiERS4_PS4_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass