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

; 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::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.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::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.23 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__._ZN3chw6Socket7flush_bEv = external hidden unnamed_addr constant [8 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [30 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: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 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 #5 align 2

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

; 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) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

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

declare void @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3chw6Socket7flush_bEv(ptr noundef nonnull align 8 dereferenceable(1072) %0) #4 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.chw::LogContextCapture", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %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 i32, align 4
  %13 = alloca %"class.chw::SockException", align 8
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca %"class.std::allocator", align 1
  %16 = alloca %"class.chw::SockException", align 8
  %17 = alloca %"class.std::__cxx11::basic_string", align 8
  %18 = alloca %"class.std::allocator", align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  %19 = load ptr, ptr %3, align 8
  %20 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %21 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %20) #6
  %22 = call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %21)
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %1
  %25 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 27
  call void @_ZN3chw6Ticker9resetTimeEv(ptr noundef nonnull align 8 dereferenceable(48) %25)
  store i32 1, ptr %2, align 4
  br label %148

26:                                               ; preds = %1
  %27 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 13
  %28 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %27) #6
  %29 = call noundef i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32) %28)
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %134

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %32 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 13
  %33 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %32) #6
  %34 = call noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %33)
  %35 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %36 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %35) #6
  %37 = call noundef ptr @_ZN3chw6Buffer4dataEv(ptr noundef nonnull align 8 dereferenceable(25) %36)
  %38 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %39 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %38) #6
  %40 = call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %39)
  %41 = trunc i64 %40 to i32
  %42 = call noundef i32 @_ZN3chw8SockUtil13send_once_tcpEiPcj(i32 noundef %34, ptr noundef %37, i32 noundef %41)
  store i32 %42, ptr %4, align 4, !tbaa !9
  %43 = load i32, ptr %4, align 4, !tbaa !9
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %45, label %113

45:                                               ; preds = %31
  %46 = load i32, ptr %4, align 4, !tbaa !9
  %47 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %48 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %47) #6
  %49 = call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %48)
  %50 = trunc i64 %49 to i32
  %51 = icmp eq i32 %46, %50
  br i1 %51, label %52, label %56

52:                                               ; preds = %45
  %53 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 27
  call void @_ZN3chw6Ticker9resetTimeEv(ptr noundef nonnull align 8 dereferenceable(48) %53)
  %54 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %55 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %54) #6
  call void @_ZN3chw6Buffer5ResetEv(ptr noundef nonnull align 8 dereferenceable(25) %55)
  br label %108

56:                                               ; preds = %45
  %57 = load i32, ptr %4, align 4, !tbaa !9
  %58 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %59 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %58) #6
  %60 = call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %59)
  %61 = trunc i64 %60 to i32
  %62 = icmp slt i32 %57, %61
  br i1 %62, label %63, label %73

63:                                               ; preds = %56
  %64 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 27
  call void @_ZN3chw6Ticker9resetTimeEv(ptr noundef nonnull align 8 dereferenceable(48) %64)
  %65 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %66 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %65) #6
  %67 = load i32, ptr %4, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %70 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %69) #6
  %71 = call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %70)
  %72 = call noundef i32 @_ZN3chw6Buffer5AlignEmm(ptr noundef nonnull align 8 dereferenceable(25) %66, i64 noundef %68, i64 noundef %71)
  br label %107

73:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #6
  %74 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
  call void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(144) %74, i32 noundef 4, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket7flush_bEv, i32 noundef 1222, ptr noundef @.str.1)
  %75 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA19_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 1 dereferenceable(19) @.str.30)
          to label %76 unwind label %89

76:                                               ; preds = %73
  %77 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %75, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %78 unwind label %89

78:                                               ; preds = %76
  %79 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA10_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %77, ptr noundef nonnull align 1 dereferenceable(10) @.str.31)
          to label %80 unwind label %89

80:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %81 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 25
  %82 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %81) #6
  %83 = invoke noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %82)
          to label %84 unwind label %93

84:                                               ; preds = %80
  store i64 %83, ptr %8, align 8, !tbaa !11
  %85 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsImEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %79, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %86 unwind label %93

86:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 48, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.23, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %87 unwind label %98

87:                                               ; preds = %86
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %9, i32 noundef 6, ptr noundef nonnull align 8 dereferenceable(32) %10, i32 noundef 0)
          to label %88 unwind label %102

88:                                               ; preds = %87
  call void @_ZN3chw6Socket8shutdownERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %19, ptr noundef nonnull align 8 dereferenceable(48) %9)
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #6
  br label %107

89:                                               ; preds = %78, %76, %73
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %6, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %7, align 4
  br label %97

93:                                               ; preds = %84, %80
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %6, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %97

97:                                               ; preds = %93, %89
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #6
  br label %133

98:                                               ; preds = %86
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %6, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %7, align 4
  br label %106

102:                                              ; preds = %87
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %6, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #6
  br label %106

106:                                              ; preds = %102, %98
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #6
  br label %133

107:                                              ; preds = %88, %63
  br label %108

108:                                              ; preds = %107, %52
  %109 = load i32, ptr %4, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds %"class.chw::Socket", ptr %19, i32 0, i32 9
  %112 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZN3chw10BytesSpeedpLEm(ptr noundef nonnull align 8 dereferenceable(72) %111, i64 noundef %110)
  br label %129

113:                                              ; preds = %31
  %114 = load i32, ptr %4, align 4, !tbaa !9
  %115 = icmp eq i32 %114, 0
  br i1 %115, label %116, label %117

116:                                              ; preds = %113
  store i32 0, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %130

117:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 48, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef @.str.23, ptr noundef nonnull align 1 dereferenceable(1) %15)
          to label %118 unwind label %120

118:                                              ; preds = %117
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %13, i32 noundef 6, ptr noundef nonnull align 8 dereferenceable(32) %14, i32 noundef 0)
          to label %119 unwind label %124

119:                                              ; preds = %118
  call void @_ZN3chw6Socket8shutdownERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %19, ptr noundef nonnull align 8 dereferenceable(48) %13)
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #6
  store i32 1, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %130

120:                                              ; preds = %117
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %6, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %7, align 4
  br label %128

124:                                              ; preds = %118
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %6, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #6
  br label %128

128:                                              ; preds = %124, %120
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #6
  br label %133

129:                                              ; preds = %108
  store i32 0, ptr %12, align 4
  br label %130

130:                                              ; preds = %129, %119, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %131 = load i32, ptr %12, align 4
  switch i32 %131, label %155 [
    i32 0, label %132
    i32 1, label %148
  ]

132:                                              ; preds = %130
  br label %147

133:                                              ; preds = %128, %106, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %150

134:                                              ; preds = %26
  %135 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
  call void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %135, i32 noundef 4, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket7flush_bEv, i32 noundef 1240, ptr noundef @.str.32)
  call void @llvm.lifetime.start.p0(i64 48, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef @.str.23, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %136 unwind label %138

136:                                              ; preds = %134
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %16, i32 noundef 6, ptr noundef nonnull align 8 dereferenceable(32) %17, i32 noundef 0)
          to label %137 unwind label %142

137:                                              ; preds = %136
  call void @_ZN3chw6Socket8shutdownERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %19, ptr noundef nonnull align 8 dereferenceable(48) %16)
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %16) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %16) #6
  store i32 1, ptr %2, align 4
  br label %148

138:                                              ; preds = %134
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %6, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %7, align 4
  br label %146

142:                                              ; preds = %136
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %6, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #6
  br label %146

146:                                              ; preds = %142, %138
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %16) #6
  br label %150

147:                                              ; preds = %132
  store i32 0, ptr %2, align 4
  br label %148

148:                                              ; preds = %147, %137, %130, %24
  %149 = load i32, ptr %2, align 4
  ret i32 %149

150:                                              ; preds = %146, %133
  %151 = load ptr, ptr %6, align 8
  %152 = load i32, ptr %7, align 4
  %153 = insertvalue { ptr, i32 } poison, ptr %151, 0
  %154 = insertvalue { ptr, i32 } %153, i32 %152, 1
  resume { ptr, i32 } %154

155:                                              ; preds = %130
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3chw6Buffer5ResetEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 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 = { 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 #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 = { 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 #6 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}


; 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::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.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 }

@.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.23 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__._ZN3chw6Socket7flush_bEv = external hidden unnamed_addr constant [8 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [30 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: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 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 #5 align 2

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

; 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 #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

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

declare void @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3chw6Socket7flush_bEv(ptr noundef nonnull align 8 dereferenceable(1072) %0) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.chw::LogContextCapture", align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.chw::SockException", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca %"class.chw::SockException", align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.std::allocator", align 1
  %11 = alloca %"class.chw::SockException", align 8
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::allocator", align 1
  %14 = getelementptr inbounds i8, ptr %0, i64 824
  %15 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  %16 = tail call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %15)
  %17 = icmp eq i64 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %1
  %19 = getelementptr inbounds i8, ptr %0, i64 848
  tail call void @_ZN3chw6Ticker9resetTimeEv(ptr noundef nonnull align 8 dereferenceable(48) %19)
  br label %105

20:                                               ; preds = %1
  %21 = getelementptr inbounds i8, ptr %0, i64 272
  %22 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %21) #6
  %23 = tail call noundef i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32) %22)
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %96

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %26 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %21) #6
  %27 = tail call noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %26)
  %28 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  %29 = tail call noundef ptr @_ZN3chw6Buffer4dataEv(ptr noundef nonnull align 8 dereferenceable(25) %28)
  %30 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  %31 = tail call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %30)
  %32 = trunc i64 %31 to i32
  %33 = tail call noundef i32 @_ZN3chw8SockUtil13send_once_tcpEiPcj(i32 noundef %27, ptr noundef %29, i32 noundef %32)
  store i32 %33, ptr %2, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %35, label %84

35:                                               ; preds = %25
  %36 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  %37 = tail call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %36)
  %38 = trunc i64 %37 to i32
  %39 = icmp eq i32 %33, %38
  br i1 %39, label %40, label %43

40:                                               ; preds = %35
  %41 = getelementptr inbounds i8, ptr %0, i64 848
  tail call void @_ZN3chw6Ticker9resetTimeEv(ptr noundef nonnull align 8 dereferenceable(48) %41)
  %42 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  tail call void @_ZN3chw6Buffer5ResetEv(ptr noundef nonnull align 8 dereferenceable(25) %42)
  br label %79

43:                                               ; preds = %35
  %44 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  %45 = tail call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %44)
  %46 = trunc i64 %45 to i32
  %47 = icmp slt i32 %33, %46
  br i1 %47, label %48, label %55

48:                                               ; preds = %43
  %49 = getelementptr inbounds i8, ptr %0, i64 848
  tail call void @_ZN3chw6Ticker9resetTimeEv(ptr noundef nonnull align 8 dereferenceable(48) %49)
  %50 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  %51 = zext nneg i32 %33 to i64
  %52 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  %53 = tail call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %52)
  %54 = tail call noundef i32 @_ZN3chw6Buffer5AlignEmm(ptr noundef nonnull align 8 dereferenceable(25) %50, i64 noundef %51, i64 noundef %53)
  br label %79

55:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  %56 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
  call void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(144) %56, i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw6Socket7flush_bEv, i32 noundef 1222, ptr noundef nonnull @.str.1)
  %57 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA19_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 1 dereferenceable(19) @.str.30)
          to label %58 unwind label %69

58:                                               ; preds = %55
  %59 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %60 unwind label %69

60:                                               ; preds = %58
  %61 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA10_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %59, ptr noundef nonnull align 1 dereferenceable(10) @.str.31)
          to label %62 unwind label %69

62:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %63 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  %64 = call noundef i64 @_ZN3chw6Buffer4SizeEv(ptr noundef nonnull align 8 dereferenceable(25) %63)
  store i64 %64, ptr %4, align 8, !tbaa !9
  %65 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsImEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %61, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %66 unwind label %71

66:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull @.str.23, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %67 unwind label %74

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

68:                                               ; preds = %67
  call void @_ZN3chw6Socket8shutdownERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef nonnull align 8 dereferenceable(48) %5)
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #6
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %79

69:                                               ; preds = %60, %58, %55
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %73

71:                                               ; preds = %62
  %72 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %73

73:                                               ; preds = %71, %69
  %.pn18 = phi { ptr, i32 } [ %72, %71 ], [ %70, %69 ]
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  br label %95

74:                                               ; preds = %66
  %75 = landingpad { ptr, i32 }
          cleanup
  br label %78

76:                                               ; preds = %67
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  br label %78

78:                                               ; preds = %76, %74
  %.pn20 = phi { ptr, i32 } [ %77, %76 ], [ %75, %74 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #6
  br label %95

79:                                               ; preds = %48, %68, %40
  %80 = phi i32 [ %33, %48 ], [ %.pre, %68 ], [ %33, %40 ]
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i8, ptr %0, i64 120
  %83 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZN3chw10BytesSpeedpLEm(ptr noundef nonnull align 8 dereferenceable(72) %82, i64 noundef %81)
  br label %94

84:                                               ; preds = %25
  %85 = icmp eq i32 %33, 0
  br i1 %85, label %94, label %86

86:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull @.str.23, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %87 unwind label %89

87:                                               ; preds = %86
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %8, i32 noundef 6, ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef 0)
          to label %88 unwind label %91

88:                                               ; preds = %87
  call void @_ZN3chw6Socket8shutdownERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef nonnull align 8 dereferenceable(48) %8)
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %8) #6
  br label %94

89:                                               ; preds = %86
  %90 = landingpad { ptr, i32 }
          cleanup
  br label %93

91:                                               ; preds = %87
  %92 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  br label %93

93:                                               ; preds = %91, %89
  %.pn16 = phi { ptr, i32 } [ %92, %91 ], [ %90, %89 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %8) #6
  br label %95

94:                                               ; preds = %84, %79, %88
  %spec.select = phi i32 [ 0, %79 ], [ 1, %88 ], [ 0, %84 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  br label %105

95:                                               ; preds = %93, %78, %73
  %.pn20.pn = phi { ptr, i32 } [ %.pn20, %78 ], [ %.pn18, %73 ], [ %.pn16, %93 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  br label %106

96:                                               ; preds = %20
  %97 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
  tail call void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %97, i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw6Socket7flush_bEv, i32 noundef 1240, ptr noundef nonnull @.str.32)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %13) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull @.str.23, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %98 unwind label %100

98:                                               ; preds = %96
  invoke void @_ZN3chw13SockExceptionC2ENS_7ErrCodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(48) %11, i32 noundef 6, ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef 0)
          to label %99 unwind label %102

99:                                               ; preds = %98
  call void @_ZN3chw6Socket8shutdownERKNS_13SockExceptionE(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef nonnull align 8 dereferenceable(48) %11)
  call void @_ZN3chw13SockExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %11) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %11) #6
  br label %105

100:                                              ; preds = %96
  %101 = landingpad { ptr, i32 }
          cleanup
  br label %104

102:                                              ; preds = %98
  %103 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  br label %104

104:                                              ; preds = %102, %100
  %.pn = phi { ptr, i32 } [ %103, %102 ], [ %101, %100 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %11) #6
  br label %106

105:                                              ; preds = %94, %99, %18
  %.112 = phi i32 [ 1, %18 ], [ 1, %99 ], [ %spec.select, %94 ]
  ret i32 %.112

106:                                              ; preds = %104, %95
  %.pn20.pn.pn = phi { ptr, i32 } [ %.pn20.pn, %95 ], [ %.pn, %104 ]
  resume { ptr, i32 } %.pn20.pn.pn
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3chw6Buffer5ResetEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 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 = { 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 #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 = { 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 #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass