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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::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.std::__shared_count" = type { ptr }
%"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.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_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.2 = external hidden unnamed_addr constant [68 x i8], align 1
@__FUNCTION__._ZN3chw6Socket6send_iEPcj = external hidden unnamed_addr constant [7 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [20 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt12__shared_ptrIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 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)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1)) #2 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) #2 align 2

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

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

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

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

declare noundef i32 @_ZN3chw8SockUtil12get_sock_lenEPK8sockaddr(ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3chw6Socket6send_iEPcj(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef %1, i32 noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::lock_guard", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %17 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %18 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 15
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEEC2ERS3_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(48) %18)
  %19 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 13
  %20 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %19) #4
  br i1 %20, label %29, label %21

21:                                               ; preds = %3
  %22 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %23 unwind label %25

23:                                               ; preds = %21
  invoke void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %22, i32 noundef 4, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket6send_iEPcj, i32 noundef 1056, ptr noundef @.str.24)
          to label %24 unwind label %25

24:                                               ; preds = %23
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %117

25:                                               ; preds = %114, %112, %23, %21
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %9, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %10, align 4
  br label %119

29:                                               ; preds = %3
  %30 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 4
  %31 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %30) #4
  br i1 %31, label %32, label %112

32:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = icmp ugt i32 %33, 0
  br i1 %34, label %35, label %107

35:                                               ; preds = %32
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %107

38:                                               ; preds = %35
  %39 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 13
  %40 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %39) #4
  %41 = invoke noundef i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32) %40)
          to label %42 unwind label %53

42:                                               ; preds = %38
  %43 = icmp eq i32 %41, 0
  br i1 %43, label %44, label %57

44:                                               ; preds = %42
  %45 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 13
  %46 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %45) #4
  %47 = invoke noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %46)
          to label %48 unwind label %53

48:                                               ; preds = %44
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i32, ptr %7, align 4, !tbaa !9
  %51 = invoke noundef i32 @_ZN3chw8SockUtil13send_tcp_dataEiPcj(i32 noundef %47, ptr noundef %49, i32 noundef %50)
          to label %52 unwind label %53

52:                                               ; preds = %48
  store i32 %51, ptr %12, align 4, !tbaa !9
  br label %100

53:                                               ; preds = %100, %48, %44, %38
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %9, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %10, align 4
  br label %111

57:                                               ; preds = %42
  %58 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 7
  %59 = call noundef zeroext i1 @_ZNKSt12__shared_ptrI16sockaddr_storageLN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %58) #4
  br i1 %59, label %60, label %80

60:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %61 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 7
  %62 = call noundef ptr @_ZNKSt12__shared_ptrI16sockaddr_storageLN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16) %61) #4
  store ptr %62, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = invoke noundef i32 @_ZN3chw8SockUtil12get_sock_lenEPK8sockaddr(ptr noundef %63)
          to label %65 unwind label %76

65:                                               ; preds = %60
  store i32 %64, ptr %14, align 4, !tbaa !9
  %66 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 13
  %67 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %66) #4
  %68 = invoke noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %67)
          to label %69 unwind label %76

69:                                               ; preds = %65
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = load i32, ptr %7, align 4, !tbaa !9
  %72 = load ptr, ptr %13, align 8, !tbaa !5
  %73 = load i32, ptr %14, align 4, !tbaa !9
  %74 = invoke noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef %68, ptr noundef %70, i32 noundef %71, ptr noundef %72, i32 noundef %73)
          to label %75 unwind label %76

75:                                               ; preds = %69
  store i32 %74, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %99

76:                                               ; preds = %69, %65, %60
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %9, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %111

80:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %81 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 22
  store ptr %81, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %82 = load ptr, ptr %15, align 8, !tbaa !5
  %83 = invoke noundef i32 @_ZN3chw8SockUtil12get_sock_lenEPK8sockaddr(ptr noundef %82)
          to label %84 unwind label %95

84:                                               ; preds = %80
  store i32 %83, ptr %16, align 4, !tbaa !9
  %85 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 13
  %86 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %85) #4
  %87 = invoke noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %86)
          to label %88 unwind label %95

88:                                               ; preds = %84
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = load i32, ptr %7, align 4, !tbaa !9
  %91 = load ptr, ptr %15, align 8, !tbaa !5
  %92 = load i32, ptr %16, align 4, !tbaa !9
  %93 = invoke noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef %87, ptr noundef %89, i32 noundef %90, ptr noundef %91, i32 noundef %92)
          to label %94 unwind label %95

94:                                               ; preds = %88
  store i32 %93, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %99

95:                                               ; preds = %88, %84, %80
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %9, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %111

99:                                               ; preds = %94, %75
  br label %100

100:                                              ; preds = %99, %52
  %101 = load i32, ptr %12, align 4, !tbaa !9
  %102 = zext i32 %101 to i64
  %103 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 9
  %104 = invoke noundef nonnull align 8 dereferenceable(72) ptr @_ZN3chw10BytesSpeedpLEm(ptr noundef nonnull align 8 dereferenceable(72) %103, i64 noundef %102)
          to label %105 unwind label %53

105:                                              ; preds = %100
  %106 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %106, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %108

107:                                              ; preds = %35, %32
  store i32 0, ptr %11, align 4
  br label %108

108:                                              ; preds = %107, %105
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %109 = load i32, ptr %11, align 4
  switch i32 %109, label %117 [
    i32 0, label %110
  ]

110:                                              ; preds = %108
  br label %116

111:                                              ; preds = %95, %76, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %119

112:                                              ; preds = %29
  %113 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %114 unwind label %25

114:                                              ; preds = %112
  invoke void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %113, i32 noundef 4, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket6send_iEPcj, i32 noundef 1084, ptr noundef @.str.25)
          to label %115 unwind label %25

115:                                              ; preds = %114
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %117

116:                                              ; preds = %110
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %117

117:                                              ; preds = %116, %115, %108, %24
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %118 = load i32, ptr %4, align 4
  ret i32 %118

119:                                              ; preds = %111, %25
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %120

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

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

declare noundef i32 @_ZN3chw8SockUtil13send_tcp_dataEiPcj(i32 noundef, ptr noundef, i32 noundef) #3

declare noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::lock_guard" = type { ptr }

@.str.2 = external hidden unnamed_addr constant [68 x i8], align 1
@__FUNCTION__._ZN3chw6Socket6send_iEPcj = external hidden unnamed_addr constant [7 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [20 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt12__shared_ptrIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 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 #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 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 #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt12__shared_ptrI16sockaddr_storageLN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

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

declare noundef i32 @_ZN3chw8SockUtil12get_sock_lenEPK8sockaddr(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3chw6Socket6send_iEPcj(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::lock_guard", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 304
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEEC2ERS3_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(48) %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 272
  %7 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  br i1 %7, label %12, label %8

8:                                                ; preds = %3
  %9 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %.invoke unwind label %10

10:                                               ; preds = %.invoke, %53, %8
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %59

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %0, i64 25
  %14 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %13) #4
  br i1 %14, label %15, label %53

15:                                               ; preds = %12
  %16 = icmp eq i32 %2, 0
  %17 = icmp eq ptr %1, null
  %or.cond.not = or i1 %17, %16
  br i1 %or.cond.not, label %58, label %18

18:                                               ; preds = %15
  %19 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %6) #4
  %20 = call noundef i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32) %19)
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %28

22:                                               ; preds = %18
  %23 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %6) #4
  %24 = call noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %23)
  %25 = invoke noundef i32 @_ZN3chw8SockUtil13send_tcp_dataEiPcj(i32 noundef %24, ptr noundef nonnull %1, i32 noundef %2)
          to label %49 unwind label %26

26:                                               ; preds = %22
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %59

28:                                               ; preds = %18
  %29 = getelementptr inbounds i8, ptr %0, i64 32
  %30 = call noundef zeroext i1 @_ZNKSt12__shared_ptrI16sockaddr_storageLN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %29) #4
  br i1 %30, label %31, label %40

31:                                               ; preds = %28
  %32 = call noundef ptr @_ZNKSt12__shared_ptrI16sockaddr_storageLN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16) %29) #4
  %33 = invoke noundef i32 @_ZN3chw8SockUtil12get_sock_lenEPK8sockaddr(ptr noundef %32)
          to label %34 unwind label %38

34:                                               ; preds = %31
  %35 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %6) #4
  %36 = call noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %35)
  %37 = invoke noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef %36, ptr noundef nonnull %1, i32 noundef %2, ptr noundef %32, i32 noundef %33)
          to label %49 unwind label %38

38:                                               ; preds = %34, %31
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %59

40:                                               ; preds = %28
  %41 = getelementptr inbounds i8, ptr %0, i64 656
  %42 = invoke noundef i32 @_ZN3chw8SockUtil12get_sock_lenEPK8sockaddr(ptr noundef nonnull %41)
          to label %43 unwind label %47

43:                                               ; preds = %40
  %44 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %6) #4
  %45 = call noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %44)
  %46 = invoke noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef %45, ptr noundef nonnull %1, i32 noundef %2, ptr noundef nonnull %41, i32 noundef %42)
          to label %49 unwind label %47

47:                                               ; preds = %43, %40
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %59

49:                                               ; preds = %43, %34, %22
  %.026 = phi i32 [ %25, %22 ], [ %37, %34 ], [ %46, %43 ]
  %50 = zext i32 %.026 to i64
  %51 = getelementptr inbounds i8, ptr %0, i64 120
  %52 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZN3chw10BytesSpeedpLEm(ptr noundef nonnull align 8 dereferenceable(72) %51, i64 noundef %50)
  br label %58

53:                                               ; preds = %12
  %54 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %.invoke unwind label %10

.invoke:                                          ; preds = %8, %53
  %55 = phi ptr [ %54, %53 ], [ %9, %8 ]
  %56 = phi i32 [ 1084, %53 ], [ 1056, %8 ]
  %57 = phi ptr [ @.str.25, %53 ], [ @.str.24, %8 ]
  invoke void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %55, i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw6Socket6send_iEPcj, i32 noundef %56, ptr noundef nonnull %57)
          to label %58 unwind label %10

58:                                               ; preds = %.invoke, %49, %15
  %.1 = phi i32 [ %.026, %49 ], [ 0, %15 ], [ 0, %.invoke ]
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret i32 %.1

59:                                               ; preds = %26, %38, %47, %10
  %.pn.pn = phi { ptr, i32 } [ %11, %10 ], [ %27, %26 ], [ %39, %38 ], [ %48, %47 ]
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  resume { ptr, i32 } %.pn.pn
}

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

declare noundef i32 @_ZN3chw8SockUtil13send_tcp_dataEiPcj(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass