; LLVM IR from wichue/nethello :: src/net/Socket.ll (ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE)

; 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.chw::SockException" = type { %"class.std::exception", i32, i32, %"class.std::__cxx11::basic_string" }
%"class.std::exception" = 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.std::allocator" = type { i8 }
%"class.chw::LogContextCapture" = type { %"class.std::shared_ptr.8", ptr }
%"class.std::shared_ptr.8" = type { %"class.std::__shared_ptr.9" }
%"class.std::__shared_ptr.9" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::lock_guard" = type { ptr }
%"class.chw::Socket" = type { %"class.std::enable_shared_from_this", i32, i32, %"struct.std::atomic", %"struct.std::atomic", i8, i8, %"class.std::shared_ptr.5", %"class.chw::BytesSpeed", %"class.chw::BytesSpeed", %"class.std::shared_ptr.11", %"class.std::shared_ptr.14", %"class.chw::Ticker", %"class.std::shared_ptr.17", %"class.std::shared_ptr.0", %"class.chw::MutexWrapper", %"class.std::function", %"class.std::function.20", %"class.std::function.22", %"class.std::function.24", %"class.chw::MutexWrapper", %struct.sockaddr_storage, %struct.sockaddr_storage, i32, %"class.std::function.27", %"class.std::shared_ptr.29", i32, %"class.chw::Ticker", %"class.std::shared_ptr.11", i32, double, %"class.std::shared_ptr.29", %struct.sockaddr_storage }
%"class.std::enable_shared_from_this" = type { %"class.std::weak_ptr.3" }
%"class.std::weak_ptr.3" = type { %"class.std::__weak_ptr.4" }
%"class.std::__weak_ptr.4" = type { ptr, %"class.std::__weak_count" }
%"class.std::__weak_count" = type { ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i8 }
%"class.std::shared_ptr.5" = type { %"class.std::__shared_ptr.6" }
%"class.std::__shared_ptr.6" = type { ptr, %"class.std::__shared_count" }
%"class.chw::BytesSpeed" = type { i64, i64, i64, %"class.chw::Ticker" }
%"class.std::shared_ptr.14" = type { %"class.std::__shared_ptr.15" }
%"class.std::__shared_ptr.15" = type { ptr, %"class.std::__shared_count" }
%"class.std::shared_ptr.17" = type { %"class.std::__shared_ptr.18" }
%"class.std::__shared_ptr.18" = type { ptr, %"class.std::__shared_count" }
%"class.std::shared_ptr.0" = type { %"class.std::__shared_ptr.1" }
%"class.std::__shared_ptr.1" = type { ptr, %"class.std::__shared_count" }
%"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::function.20" = type { %"class.std::_Function_base", ptr }
%"class.std::function.22" = type { %"class.std::_Function_base", ptr }
%"class.std::function.24" = type { %"class.std::_Function_base", ptr }
%"class.chw::MutexWrapper" = type { i8, %"class.std::recursive_mutex" }
%"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::function.27" = type { %"class.std::_Function_base", ptr }
%"class.chw::Ticker" = type { i64, i64, i64, %"class.chw::LogContextCapture" }
%"class.std::shared_ptr.11" = type { %"class.std::__shared_ptr.12" }
%"class.std::__shared_ptr.12" = type { ptr, %"class.std::__shared_count" }
%"class.std::shared_ptr.29" = type { %"class.std::__shared_ptr.30" }
%"class.std::__shared_ptr.30" = type { ptr, %"class.std::__shared_count" }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }

@.str.1 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@__FUNCTION__._ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZTISt9exception = external constant ptr
@.str.13 = external hidden unnamed_addr constant [39 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

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

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

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

declare ptr @__cxa_begin_catch(ptr)

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"class.chw::SockException", align 8
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::allocator", align 1
  %12 = alloca %"class.chw::LogContextCapture", align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.chw::SockException", align 8
  %15 = alloca %"class.std::__cxx11::basic_string", align 8
  %16 = alloca %"class.std::allocator", align 1
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"class.chw::SockException", align 8
  %20 = alloca %"class.chw::LogContextCapture", align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca %"class.std::lock_guard", align 8
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca %"class.chw::LogContextCapture", align 8
  %29 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %163, %2
  %32 = getelementptr inbounds %"class.chw::Socket", ptr %30, i32 0, i32 3
  %33 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %32) #8
  br i1 %33, label %34, label %164

34:                                               ; preds = %31
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %35) #8
  %37 = invoke noundef i32 @_ZNK3chw7SockNum5rawFdEv(ptr noundef nonnull align 4 dereferenceable(8) %36)
          to label %38 unwind label %167

38:                                               ; preds = %34
  %39 = invoke noundef i64 @_ZN3chw6Socket14recvFromSocketEiRl(ptr noundef nonnull align 8 dereferenceable(1072) %30, i32 noundef %37, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %40 unwind label %167

40:                                               ; preds = %38
  store i64 %39, ptr %7, align 8, !tbaa !9
  %41 = load i64, ptr %7, align 8, !tbaa !9
  %42 = icmp eq i64 %41, 0
  br i1 %42, label %43, label %72

43:                                               ; preds = %40
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %44) #8
  %46 = invoke noundef i32 @_ZN3chw7SockNum4typeEv(ptr noundef nonnull align 4 dereferenceable(8) %45)
          to label %47 unwind label %167

47:                                               ; preds = %43
  %48 = icmp eq i32 %46, 0
  br i1 %48, label %49, label %53

49:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 48, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %50 unwind label %167

50:                                               ; preds = %49
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %9, i32 noundef 1, ptr noundef nonnull align 8 dereferenceable(32) %10, i32 noundef 0)
          to label %51 unwind label %167

51:                                               ; preds = %50
  %52 = call noundef zeroext i1 @_ZN3chw6Socket7emitErrERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %30, ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #8
  br label %70

53:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #8
  %54 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %55 unwind label %167

55:                                               ; preds = %53
  invoke void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(144) %54, i32 noundef 3, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE, i32 noundef 311, ptr noundef @.str.1)
          to label %56 unwind label %167

56:                                               ; preds = %55
  %57 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA24_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 1 dereferenceable(24) @.str.9)
          to label %58 unwind label %167

58:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %59) #8
  %61 = invoke noundef i32 @_ZNK3chw7SockNum5rawFdEv(ptr noundef nonnull align 4 dereferenceable(8) %60)
          to label %62 unwind label %167

62:                                               ; preds = %58
  store i32 %61, ptr %13, align 4, !tbaa !11
  %63 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %64 unwind label %167

64:                                               ; preds = %62
  %65 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA2_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %63, ptr noundef nonnull align 1 dereferenceable(2) @.str.10)
          to label %66 unwind label %167

66:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 48, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %16)
          to label %67 unwind label %167

67:                                               ; preds = %66
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %14, i32 noundef 1, ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 0)
          to label %68 unwind label %167

68:                                               ; preds = %67
  %69 = call noundef zeroext i1 @_ZN3chw6Socket7emitErrERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %30, ptr noundef nonnull align 8 dereferenceable(48) %14) #8
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #8
  br label %70

70:                                               ; preds = %68, %51
  %71 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %71, ptr %3, align 8
  store i32 1, ptr %17, align 4
  br label %165

72:                                               ; preds = %40
  %73 = load i64, ptr %7, align 8, !tbaa !9
  %74 = icmp eq i64 %73, -1
  br i1 %74, label %75, label %113

75:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %76 = invoke noundef i32 @_ZN3chw12get_uv_errorEb(i1 noundef zeroext true)
          to label %77 unwind label %167

77:                                               ; preds = %75
  store i32 %76, ptr %18, align 4, !tbaa !11
  %78 = load i32, ptr %18, align 4, !tbaa !11
  %79 = icmp ne i32 %78, -11
  br i1 %79, label %80, label %110

80:                                               ; preds = %77
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %81) #8
  %83 = invoke noundef i32 @_ZN3chw7SockNum4typeEv(ptr noundef nonnull align 4 dereferenceable(8) %82)
          to label %84 unwind label %167

84:                                               ; preds = %80
  %85 = icmp eq i32 %83, 0
  br i1 %85, label %86, label %90

86:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 48, ptr %19) #8
  %87 = load i32, ptr %18, align 4, !tbaa !11
  invoke void @_ZN3chwL15toSockExceptionEi(ptr dead_on_unwind writable sret(%"class.chw::SockException") align 8 %19, i32 noundef %87)
          to label %88 unwind label %167

88:                                               ; preds = %86
  %89 = call noundef zeroext i1 @_ZN3chw6Socket7emitErrERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %30, ptr noundef nonnull align 8 dereferenceable(48) %19) #8
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %19) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #8
  br label %109

90:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #8
  %91 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %92 unwind label %167

92:                                               ; preds = %90
  invoke void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 8 dereferenceable(144) %91, i32 noundef 3, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE, i32 noundef 323, ptr noundef @.str.1)
          to label %93 unwind label %167

93:                                               ; preds = %92
  %94 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA24_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 1 dereferenceable(24) @.str.11)
          to label %95 unwind label %167

95:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %96) #8
  %98 = invoke noundef i32 @_ZNK3chw7SockNum5rawFdEv(ptr noundef nonnull align 4 dereferenceable(8) %97)
          to label %99 unwind label %167

99:                                               ; preds = %95
  store i32 %98, ptr %21, align 4, !tbaa !11
  %100 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %94, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %101 unwind label %167

101:                                              ; preds = %99
  %102 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA4_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %100, ptr noundef nonnull align 1 dereferenceable(4) @.str.12)
          to label %103 unwind label %167

103:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %104 = load i32, ptr %18, align 4, !tbaa !11
  %105 = invoke noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef %104)
          to label %106 unwind label %167

106:                                              ; preds = %103
  store ptr %105, ptr %22, align 8, !tbaa !5
  %107 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %102, ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %108 unwind label %167

108:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #8
  br label %109

109:                                              ; preds = %108, %88
  br label %111

110:                                              ; preds = %77
  br label %111

111:                                              ; preds = %110, %109
  %112 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %112, ptr %3, align 8
  store i32 1, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %165

113:                                              ; preds = %72
  %114 = load i64, ptr %7, align 8, !tbaa !9
  %115 = load i64, ptr %6, align 8, !tbaa !9
  %116 = add nsw i64 %115, %114
  store i64 %116, ptr %6, align 8, !tbaa !9
  %117 = getelementptr inbounds %"class.chw::Socket", ptr %30, i32 0, i32 6
  %118 = load i8, ptr %117, align 1, !tbaa !13, !range !53, !noundef !54
  %119 = trunc i8 %118 to i1
  br i1 %119, label %120, label %125

120:                                              ; preds = %113
  %121 = load i64, ptr %7, align 8, !tbaa !9
  %122 = getelementptr inbounds %"class.chw::Socket", ptr %30, i32 0, i32 8
  %123 = invoke noundef nonnull align 8 dereferenceable(72) ptr @_ZN3chw10BytesSpeedpLEm(ptr noundef nonnull align 8 dereferenceable(72) %122, i64 noundef %121)
          to label %124 unwind label %167

124:                                              ; preds = %120
  br label %125

125:                                              ; preds = %124, %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %126 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZN3chw6Socket10getAddressEm(ptr noundef nonnull align 8 dereferenceable(1072) %30, i64 noundef 0)
          to label %127 unwind label %167

127:                                              ; preds = %125
  store ptr %126, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %128 = getelementptr inbounds %"class.chw::Socket", ptr %30, i32 0, i32 20
  invoke void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEEC2ERS3_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(48) %128)
          to label %129 unwind label %134

129:                                              ; preds = %127
  %130 = getelementptr inbounds %"class.chw::Socket", ptr %30, i32 0, i32 24
  %131 = getelementptr inbounds %"class.chw::Socket", ptr %30, i32 0, i32 31
  %132 = load ptr, ptr %23, align 8, !tbaa !5
  invoke void @_ZNKSt8functionIFvRSt10shared_ptrIN3chw6BufferEEP8sockaddriEEclES4_S6_i(ptr noundef nonnull align 8 dereferenceable(32) %130, ptr noundef nonnull align 8 dereferenceable(16) %131, ptr noundef %132, i32 noundef 128)
          to label %133 unwind label %138

133:                                              ; preds = %129
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %163

134:                                              ; preds = %127
  %135 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %25, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %26, align 4
  br label %142

138:                                              ; preds = %129
  %139 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %25, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %26, align 4
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #8
  br label %142

142:                                              ; preds = %138, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %26, align 4
  %145 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #8
  %146 = icmp eq i32 %144, %145
  br i1 %146, label %147, label %170

147:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %148 = load ptr, ptr %25, align 8
  %149 = call ptr @__cxa_begin_catch(ptr %148) #8
  store ptr %149, ptr %27, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %28) #8
  %150 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %151 unwind label %167

151:                                              ; preds = %147
  invoke void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 8 dereferenceable(144) %150, i32 noundef 4, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE, i32 noundef 351, ptr noundef @.str.1)
          to label %152 unwind label %167

152:                                              ; preds = %151
  %153 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA39_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 1 dereferenceable(39) @.str.13)
          to label %154 unwind label %167

154:                                              ; preds = %152
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #8
  %155 = load ptr, ptr %27, align 8, !tbaa !5
  %156 = load ptr, ptr %155, align 8, !tbaa !55
  %157 = getelementptr inbounds ptr, ptr %156, i64 2
  %158 = load ptr, ptr %157, align 8
  %159 = call noundef ptr %158(ptr noundef nonnull align 8 dereferenceable(8) %155) #8
  store ptr %159, ptr %29, align 8, !tbaa !5
  %160 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %153, ptr noundef nonnull align 8 dereferenceable(8) %29)
          to label %161 unwind label %167

161:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %28) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %28) #8
  invoke void @__cxa_end_catch()
          to label %162 unwind label %167

162:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  br label %163

163:                                              ; preds = %162, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %31, !llvm.loop !57

164:                                              ; preds = %31
  store i64 0, ptr %3, align 8
  store i32 1, ptr %17, align 4
  br label %165

165:                                              ; preds = %164, %111, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %166 = load i64, ptr %3, align 8
  ret i64 %166

167:                                              ; preds = %161, %154, %152, %151, %147, %125, %120, %106, %103, %101, %99, %95, %93, %92, %90, %86, %80, %75, %67, %66, %64, %62, %58, %56, %55, %53, %50, %49, %43, %38, %34
  %168 = landingpad { ptr, i32 }
          catch ptr null
  %169 = extractvalue { ptr, i32 } %168, 0
  call void @__clang_call_terminate(ptr %169) #9
  unreachable

170:                                              ; preds = %143
  %171 = load ptr, ptr %25, align 8
  call void @__clang_call_terminate(ptr %171) #9
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN3chw6Socket14recvFromSocketEiRl(ptr noundef nonnull align 8 dereferenceable(1072), i32 noundef, ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3chw6Socket7emitErrERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072), ptr noundef nonnull align 8 dereferenceable(48)) #5 align 2

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

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

declare noundef i32 @_ZN3chw12get_uv_errorEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3chwL15toSockExceptionEi(ptr dead_on_unwind noalias writable sret(%"class.chw::SockException") align 8, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA4_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(4)) #4 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)) #4 align 2

declare noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef) #1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA39_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(39)) #4 align 2

declare void @__cxa_end_catch()

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) 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 = { 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 #3 = { 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 #4 = { 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 #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 memory(none) }
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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !21, i64 27}
!14 = !{!"_ZTSN3chw6SocketE", !15, i64 0, !12, i64 16, !12, i64 20, !19, i64 24, !19, i64 25, !21, i64 26, !21, i64 27, !22, i64 32, !25, i64 48, !25, i64 120, !30, i64 192, !32, i64 208, !26, i64 224, !34, i64 272, !36, i64 288, !38, i64 304, !41, i64 352, !43, i64 384, !44, i64 416, !45, i64 448, !38, i64 480, !46, i64 528, !46, i64 656, !48, i64 784, !49, i64 792, !50, i64 824, !12, i64 840, !26, i64 848, !30, i64 896, !12, i64 912, !52, i64 920, !50, i64 928, !46, i64 944}
!15 = !{!"_ZTSSt23enable_shared_from_thisIN3chw6SocketEE", !16, i64 0}
!16 = !{!"_ZTSSt8weak_ptrIN3chw6SocketEE", !17, i64 0}
!17 = !{!"_ZTSSt10__weak_ptrIN3chw6SocketELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !18, i64 8}
!18 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!19 = !{!"_ZTSSt6atomicIbE", !20, i64 0}
!20 = !{!"_ZTSSt13__atomic_baseIbE", !21, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSSt10shared_ptrI16sockaddr_storageE", !23, i64 0}
!23 = !{!"_ZTSSt12__shared_ptrI16sockaddr_storageLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !24, i64 8}
!24 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!25 = !{!"_ZTSN3chw10BytesSpeedE", !10, i64 0, !10, i64 8, !10, i64 16, !26, i64 24}
!26 = !{!"_ZTSN3chw6TickerE", !10, i64 0, !10, i64 8, !10, i64 16, !27, i64 24}
!27 = !{!"_ZTSN3chw17LogContextCaptureE", !28, i64 0, !6, i64 16}
!28 = !{!"_ZTSSt10shared_ptrIN3chw10LogContextEE", !29, i64 0}
!29 = !{!"_ZTSSt12__shared_ptrIN3chw10LogContextELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !24, i64 8}
!30 = !{!"_ZTSSt10shared_ptrIN3chw5TimerEE", !31, i64 0}
!31 = !{!"_ZTSSt12__shared_ptrIN3chw5TimerELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !24, i64 8}
!32 = !{!"_ZTSSt10shared_ptrIvE", !33, i64 0}
!33 = !{!"_ZTSSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !24, i64 8}
!34 = !{!"_ZTSSt10shared_ptrIN3chw6SockFDEE", !35, i64 0}
!35 = !{!"_ZTSSt12__shared_ptrIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !24, i64 8}
!36 = !{!"_ZTSSt10shared_ptrIN3chw9EventLoopEE", !37, i64 0}
!37 = !{!"_ZTSSt12__shared_ptrIN3chw9EventLoopELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !24, i64 8}
!38 = !{!"_ZTSN3chw12MutexWrapperISt15recursive_mutexEE", !21, i64 0, !39, i64 8}
!39 = !{!"_ZTSSt15recursive_mutex", !40, i64 0}
!40 = !{!"_ZTSSt22__recursive_mutex_base", !7, i64 0}
!41 = !{!"_ZTSSt8functionIFvRKN3chw13SockExceptionEEE", !42, i64 0, !6, i64 24}
!42 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!43 = !{!"_ZTSSt8functionIFbvEE", !42, i64 0, !6, i64 24}
!44 = !{!"_ZTSSt8functionIFvRSt10shared_ptrIN3chw6SocketEERS0_IvEEE", !42, i64 0, !6, i64 24}
!45 = !{!"_ZTSSt8functionIFSt10shared_ptrIN3chw6SocketEERKS0_INS1_9EventLoopEEEE", !42, i64 0, !6, i64 24}
!46 = !{!"_ZTS16sockaddr_storage", !47, i64 0, !7, i64 2, !10, i64 120}
!47 = !{!"short", !7, i64 0}
!48 = !{!"_ZTSN3chw6Socket9SEND_TYPEE", !7, i64 0}
!49 = !{!"_ZTSSt8functionIFvRSt10shared_ptrIN3chw6BufferEEP8sockaddriEE", !42, i64 0, !6, i64 24}
!50 = !{!"_ZTSSt10shared_ptrIN3chw6BufferEE", !51, i64 0}
!51 = !{!"_ZTSSt12__shared_ptrIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !24, i64 8}
!52 = !{!"double", !7, i64 0}
!53 = !{i8 0, i8 2}
!54 = !{}
!55 = !{!56, !56, i64 0}
!56 = !{!"vtable pointer", !8, i64 0}
!57 = distinct !{!57, !58}
!58 = !{!"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.chw::SockException" = type { %"class.std::exception", i32, i32, %"class.std::__cxx11::basic_string" }
%"class.std::exception" = 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.std::allocator" = type { i8 }
%"class.chw::LogContextCapture" = type { %"class.std::shared_ptr.8", ptr }
%"class.std::shared_ptr.8" = type { %"class.std::__shared_ptr.9" }
%"class.std::__shared_ptr.9" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::lock_guard" = type { ptr }

@.str.1 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@__FUNCTION__._ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZTISt9exception = external constant ptr
@.str.13 = external hidden unnamed_addr constant [39 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

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

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

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

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca %"class.chw::SockException", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator", align 1
  %7 = alloca %"class.chw::LogContextCapture", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.chw::SockException", align 8
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::allocator", align 1
  %12 = alloca %"class.chw::SockException", align 8
  %13 = alloca %"class.chw::LogContextCapture", align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca %"class.std::lock_guard", align 8
  %17 = alloca %"class.chw::LogContextCapture", align 8
  %18 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store i64 0, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = tail call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %19) #8
  br i1 %20, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %2
  %21 = getelementptr inbounds i8, ptr %0, i64 27
  %22 = getelementptr inbounds i8, ptr %0, i64 48
  %23 = getelementptr inbounds i8, ptr %0, i64 480
  %24 = getelementptr inbounds i8, ptr %0, i64 792
  %25 = getelementptr inbounds i8, ptr %0, i64 928
  br label %26

26:                                               ; preds = %.lr.ph, %110
  %.02332 = phi i64 [ 0, %.lr.ph ], [ %81, %110 ]
  %27 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #8
  %28 = call noundef i32 @_ZNK3chw7SockNum5rawFdEv(ptr noundef nonnull align 4 dereferenceable(8) %27)
  %29 = invoke noundef i64 @_ZN3chw6Socket14recvFromSocketEiRl(ptr noundef nonnull align 8 dereferenceable(1072) %0, i32 noundef %28, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %30 unwind label %.loopexit27

30:                                               ; preds = %26
  switch i64 %29, label %80 [
    i64 0, label %31
    i64 -1, label %54
  ]

31:                                               ; preds = %30
  %32 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #8
  %33 = call noundef i32 @_ZN3chw7SockNum4typeEv(ptr noundef nonnull align 4 dereferenceable(8) %32)
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %36 unwind label %.loopexit.split-lp

36:                                               ; preds = %35
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %4, i32 noundef 1, ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef 0)
          to label %37 unwind label %.loopexit.split-lp

37:                                               ; preds = %36
  %38 = call noundef zeroext i1 @_ZN3chw6Socket7emitErrERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef nonnull align 8 dereferenceable(48) %4) #8
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #8
  br label %.loopexit

39:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #8
  %40 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %41 unwind label %.loopexit.split-lp

41:                                               ; preds = %39
  invoke void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(144) %40, i32 noundef 3, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE, i32 noundef 311, ptr noundef nonnull @.str.1)
          to label %42 unwind label %.loopexit.split-lp

42:                                               ; preds = %41
  %43 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA24_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 1 dereferenceable(24) @.str.9)
          to label %44 unwind label %.loopexit.split-lp

44:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  %45 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #8
  %46 = call noundef i32 @_ZNK3chw7SockNum5rawFdEv(ptr noundef nonnull align 4 dereferenceable(8) %45)
  store i32 %46, ptr %8, align 4, !tbaa !9
  %47 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %43, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %48 unwind label %.loopexit.split-lp

48:                                               ; preds = %44
  %49 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA2_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 1 dereferenceable(2) @.str.10)
          to label %50 unwind label %.loopexit.split-lp

50:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %51 unwind label %.loopexit.split-lp

51:                                               ; preds = %50
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %9, i32 noundef 1, ptr noundef nonnull align 8 dereferenceable(32) %10, i32 noundef 0)
          to label %52 unwind label %.loopexit.split-lp

52:                                               ; preds = %51
  %53 = call noundef zeroext i1 @_ZN3chw6Socket7emitErrERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #8
  br label %.loopexit

54:                                               ; preds = %30
  %55 = invoke noundef i32 @_ZN3chw12get_uv_errorEb(i1 noundef zeroext true)
          to label %56 unwind label %.loopexit.split-lp

56:                                               ; preds = %54
  %.not = icmp eq i32 %55, -11
  br i1 %.not, label %.loopexit, label %57

57:                                               ; preds = %56
  %58 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #8
  %59 = call noundef i32 @_ZN3chw7SockNum4typeEv(ptr noundef nonnull align 4 dereferenceable(8) %58)
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %64

61:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %12) #8
  invoke void @_ZN3chwL15toSockExceptionEi(ptr dead_on_unwind nonnull writable sret(%"class.chw::SockException") align 8 %12, i32 noundef %55)
          to label %62 unwind label %.loopexit.split-lp

62:                                               ; preds = %61
  %63 = call noundef zeroext i1 @_ZN3chw6Socket7emitErrERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef nonnull align 8 dereferenceable(48) %12) #8
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %12) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %12) #8
  br label %.loopexit

64:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %13) #8
  %65 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %66 unwind label %.loopexit.split-lp

66:                                               ; preds = %64
  invoke void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(144) %65, i32 noundef 3, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE, i32 noundef 323, ptr noundef nonnull @.str.1)
          to label %67 unwind label %.loopexit.split-lp

67:                                               ; preds = %66
  %68 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA24_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 1 dereferenceable(24) @.str.11)
          to label %69 unwind label %.loopexit.split-lp

69:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #8
  %70 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw7SockNumELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %1) #8
  %71 = call noundef i32 @_ZNK3chw7SockNum5rawFdEv(ptr noundef nonnull align 4 dereferenceable(8) %70)
  store i32 %71, ptr %14, align 4, !tbaa !9
  %72 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %73 unwind label %.loopexit.split-lp

73:                                               ; preds = %69
  %74 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA4_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %72, ptr noundef nonnull align 1 dereferenceable(4) @.str.12)
          to label %75 unwind label %.loopexit.split-lp

75:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #8
  %76 = invoke noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef %55)
          to label %77 unwind label %.loopexit.split-lp

77:                                               ; preds = %75
  store ptr %76, ptr %15, align 8, !tbaa !11
  %78 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %74, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %79 unwind label %.loopexit.split-lp

79:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #8
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #8
  br label %.loopexit

80:                                               ; preds = %30
  %81 = add nsw i64 %29, %.02332
  %82 = load i8, ptr %21, align 1, !tbaa !13, !range !53, !noundef !54
  %83 = trunc nuw i8 %82 to i1
  br i1 %83, label %84, label %86

84:                                               ; preds = %80
  %85 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZN3chw10BytesSpeedpLEm(ptr noundef nonnull align 8 dereferenceable(72) %22, i64 noundef %29)
  br label %86

86:                                               ; preds = %84, %80
  %87 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZN3chw6Socket10getAddressEm(ptr noundef nonnull align 8 dereferenceable(1072) %0, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #8
  invoke void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEEC2ERS3_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(48) %23)
          to label %88 unwind label %90

88:                                               ; preds = %86
  invoke void @_ZNKSt8functionIFvRSt10shared_ptrIN3chw6BufferEEP8sockaddriEEclES4_S6_i(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull %87, i32 noundef 128)
          to label %89 unwind label %92

89:                                               ; preds = %88
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #8
  br label %110

90:                                               ; preds = %86
  %91 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  br label %94

92:                                               ; preds = %88
  %93 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  br label %94

94:                                               ; preds = %92, %90
  %.pn = phi { ptr, i32 } [ %93, %92 ], [ %91, %90 ]
  %.021 = extractvalue { ptr, i32 } %.pn, 1
  %.022 = extractvalue { ptr, i32 } %.pn, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #8
  %95 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #8
  %96 = icmp eq i32 %.021, %95
  br i1 %96, label %97, label %114

97:                                               ; preds = %94
  %98 = call ptr @__cxa_begin_catch(ptr %.022) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #8
  %99 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %100 unwind label %.loopexit27

100:                                              ; preds = %97
  invoke void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(144) %99, i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw6Socket6onReadERKSt10shared_ptrINS_7SockNumEE, i32 noundef 351, ptr noundef nonnull @.str.1)
          to label %101 unwind label %.loopexit27

101:                                              ; preds = %100
  %102 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA39_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 1 dereferenceable(39) @.str.13)
          to label %103 unwind label %.loopexit27

103:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #8
  %104 = load ptr, ptr %98, align 8, !tbaa !55
  %105 = getelementptr inbounds i8, ptr %104, i64 16
  %106 = load ptr, ptr %105, align 8
  %107 = call noundef ptr %106(ptr noundef nonnull align 8 dereferenceable(8) %98) #8
  store ptr %107, ptr %18, align 8, !tbaa !11
  %108 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %102, ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %109 unwind label %.loopexit27

109:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #8
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #8
  invoke void @__cxa_end_catch()
          to label %110 unwind label %.loopexit27

110:                                              ; preds = %109, %89
  %111 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %19) #8
  br i1 %111, label %26, label %.loopexit, !llvm.loop !57

.loopexit:                                        ; preds = %110, %2, %79, %62, %56, %37, %52
  %.0 = phi i64 [ %.02332, %52 ], [ %.02332, %37 ], [ %.02332, %56 ], [ %.02332, %62 ], [ %.02332, %79 ], [ 0, %2 ], [ 0, %110 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  ret i64 %.0

.loopexit27:                                      ; preds = %26, %97, %100, %101, %103, %109
  %lpad.loopexit = landingpad { ptr, i32 }
          catch ptr null
  br label %112

.loopexit.split-lp:                               ; preds = %35, %36, %39, %41, %42, %44, %48, %50, %51, %54, %61, %64, %66, %67, %69, %73, %75, %77
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          catch ptr null
  br label %112

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

114:                                              ; preds = %94
  call void @__clang_call_terminate(ptr %.022) #9
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN3chw6Socket14recvFromSocketEiRl(ptr noundef nonnull align 8 dereferenceable(1072), i32 noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

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

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

declare noundef i32 @_ZN3chw12get_uv_errorEb(i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3chwL15toSockExceptionEi(ptr dead_on_unwind noalias writable sret(%"class.chw::SockException") align 8, i32 noundef) local_unnamed_addr #4

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

declare noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt8functionIFvRSt10shared_ptrIN3chw6BufferEEP8sockaddriEEclES4_S6_i(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i32 noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA39_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(39)) local_unnamed_addr #4 align 2

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) 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 = { 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 #3 = { 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 #4 = { 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 #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 = { nofree nosync nounwind memory(none) }
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 = !{!"long", !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 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !21, i64 27}
!14 = !{!"_ZTSN3chw6SocketE", !15, i64 0, !10, i64 16, !10, i64 20, !19, i64 24, !19, i64 25, !21, i64 26, !21, i64 27, !22, i64 32, !25, i64 48, !25, i64 120, !30, i64 192, !32, i64 208, !26, i64 224, !34, i64 272, !36, i64 288, !38, i64 304, !41, i64 352, !43, i64 384, !44, i64 416, !45, i64 448, !38, i64 480, !46, i64 528, !46, i64 656, !48, i64 784, !49, i64 792, !50, i64 824, !10, i64 840, !26, i64 848, !30, i64 896, !10, i64 912, !52, i64 920, !50, i64 928, !46, i64 944}
!15 = !{!"_ZTSSt23enable_shared_from_thisIN3chw6SocketEE", !16, i64 0}
!16 = !{!"_ZTSSt8weak_ptrIN3chw6SocketEE", !17, i64 0}
!17 = !{!"_ZTSSt10__weak_ptrIN3chw6SocketELN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !18, i64 8}
!18 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0}
!19 = !{!"_ZTSSt6atomicIbE", !20, i64 0}
!20 = !{!"_ZTSSt13__atomic_baseIbE", !21, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSSt10shared_ptrI16sockaddr_storageE", !23, i64 0}
!23 = !{!"_ZTSSt12__shared_ptrI16sockaddr_storageLN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !24, i64 8}
!24 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0}
!25 = !{!"_ZTSN3chw10BytesSpeedE", !6, i64 0, !6, i64 8, !6, i64 16, !26, i64 24}
!26 = !{!"_ZTSN3chw6TickerE", !6, i64 0, !6, i64 8, !6, i64 16, !27, i64 24}
!27 = !{!"_ZTSN3chw17LogContextCaptureE", !28, i64 0, !12, i64 16}
!28 = !{!"_ZTSSt10shared_ptrIN3chw10LogContextEE", !29, i64 0}
!29 = !{!"_ZTSSt12__shared_ptrIN3chw10LogContextELN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !24, i64 8}
!30 = !{!"_ZTSSt10shared_ptrIN3chw5TimerEE", !31, i64 0}
!31 = !{!"_ZTSSt12__shared_ptrIN3chw5TimerELN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !24, i64 8}
!32 = !{!"_ZTSSt10shared_ptrIvE", !33, i64 0}
!33 = !{!"_ZTSSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !24, i64 8}
!34 = !{!"_ZTSSt10shared_ptrIN3chw6SockFDEE", !35, i64 0}
!35 = !{!"_ZTSSt12__shared_ptrIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !24, i64 8}
!36 = !{!"_ZTSSt10shared_ptrIN3chw9EventLoopEE", !37, i64 0}
!37 = !{!"_ZTSSt12__shared_ptrIN3chw9EventLoopELN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !24, i64 8}
!38 = !{!"_ZTSN3chw12MutexWrapperISt15recursive_mutexEE", !21, i64 0, !39, i64 8}
!39 = !{!"_ZTSSt15recursive_mutex", !40, i64 0}
!40 = !{!"_ZTSSt22__recursive_mutex_base", !7, i64 0}
!41 = !{!"_ZTSSt8functionIFvRKN3chw13SockExceptionEEE", !42, i64 0, !12, i64 24}
!42 = !{!"_ZTSSt14_Function_base", !7, i64 0, !12, i64 16}
!43 = !{!"_ZTSSt8functionIFbvEE", !42, i64 0, !12, i64 24}
!44 = !{!"_ZTSSt8functionIFvRSt10shared_ptrIN3chw6SocketEERS0_IvEEE", !42, i64 0, !12, i64 24}
!45 = !{!"_ZTSSt8functionIFSt10shared_ptrIN3chw6SocketEERKS0_INS1_9EventLoopEEEE", !42, i64 0, !12, i64 24}
!46 = !{!"_ZTS16sockaddr_storage", !47, i64 0, !7, i64 2, !6, i64 120}
!47 = !{!"short", !7, i64 0}
!48 = !{!"_ZTSN3chw6Socket9SEND_TYPEE", !7, i64 0}
!49 = !{!"_ZTSSt8functionIFvRSt10shared_ptrIN3chw6BufferEEP8sockaddriEE", !42, i64 0, !12, i64 24}
!50 = !{!"_ZTSSt10shared_ptrIN3chw6BufferEE", !51, i64 0}
!51 = !{!"_ZTSSt12__shared_ptrIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !24, i64 8}
!52 = !{!"double", !7, i64 0}
!53 = !{i8 0, i8 2}
!54 = !{}
!55 = !{!56, !56, i64 0}
!56 = !{!"vtable pointer", !8, i64 0}
!57 = distinct !{!57, !58}
!58 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass