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

; 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
@.str.25 = external hidden unnamed_addr constant [20 x i8], align 1
@__FUNCTION__._ZN3chw6Socket9send_addrEPcjP8sockaddri = external hidden unnamed_addr constant [10 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [27 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 i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 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, ...) #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3chw6Socket9send_addrEPcjP8sockaddri(ptr noundef nonnull align 8 dereferenceable(1072) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) #1 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::lock_guard", align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  %17 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #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) %12, 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 = %5
  %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__._ZN3chw6Socket9send_addrEPcjP8sockaddri, i32 noundef 1096, ptr noundef @.str.26)
          to label %24 unwind label %25

24:                                               ; preds = %23
  store i32 0, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %79

25:                                               ; preds = %76, %74, %23, %21
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %13, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %14, align 4
  br label %81

29:                                               ; preds = %5
  %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 %74

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

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

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 %48

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

44:                                               ; preds = %42
  %45 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %46 unwind label %48

46:                                               ; preds = %44
  invoke void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %45, i32 noundef 4, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket9send_addrEPcjP8sockaddri, i32 noundef 1106, ptr noundef @.str.27)
          to label %47 unwind label %48

47:                                               ; preds = %46
  store i32 0, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %71

48:                                               ; preds = %63, %56, %52, %46, %44, %38
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %13, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %81

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

56:                                               ; preds = %52
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = load i32, ptr %11, align 4, !tbaa !9
  %61 = invoke noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef %55, ptr noundef %57, i32 noundef %58, ptr noundef %59, i32 noundef %60)
          to label %62 unwind label %48

62:                                               ; preds = %56
  store i32 %61, ptr %16, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %16, align 4, !tbaa !9
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds %"class.chw::Socket", ptr %17, i32 0, i32 9
  %67 = invoke noundef nonnull align 8 dereferenceable(72) ptr @_ZN3chw10BytesSpeedpLEm(ptr noundef nonnull align 8 dereferenceable(72) %66, i64 noundef %65)
          to label %68 unwind label %48

68:                                               ; preds = %63
  %69 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %69, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %71

70:                                               ; preds = %35, %32
  store i32 0, ptr %15, align 4
  br label %71

71:                                               ; preds = %70, %68, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  %72 = load i32, ptr %15, align 4
  switch i32 %72, label %79 [
    i32 0, label %73
  ]

73:                                               ; preds = %71
  br label %78

74:                                               ; preds = %29
  %75 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %76 unwind label %25

76:                                               ; preds = %74
  invoke void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %75, i32 noundef 4, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN3chw6Socket9send_addrEPcjP8sockaddri, i32 noundef 1116, ptr noundef @.str.25)
          to label %77 unwind label %25

77:                                               ; preds = %76
  store i32 0, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %79

78:                                               ; preds = %73
  store i32 0, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %79

79:                                               ; preds = %78, %77, %71, %24
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %80 = load i32, ptr %6, align 4
  ret i32 %80

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

82:                                               ; preds = %81
  %83 = load ptr, ptr %13, align 8
  %84 = load i32, ptr %14, align 4
  %85 = insertvalue { ptr, i32 } poison, ptr %83, 0
  %86 = insertvalue { ptr, i32 } %85, i32 %84, 1
  resume { ptr, i32 } %86
}

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
@.str.25 = external hidden unnamed_addr constant [20 x i8], align 1
@__FUNCTION__._ZN3chw6Socket9send_addrEPcjP8sockaddri = external hidden unnamed_addr constant [10 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [27 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 i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 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 #3

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

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

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

12:                                               ; preds = %.invoke, %37, %10
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %43

14:                                               ; preds = %5
  %15 = getelementptr inbounds i8, ptr %0, i64 25
  %16 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %15) #4
  br i1 %16, label %17, label %37

17:                                               ; preds = %14
  %18 = icmp eq i32 %2, 0
  %19 = icmp eq ptr %1, null
  %or.cond.not = or i1 %19, %18
  br i1 %or.cond.not, label %42, label %20

20:                                               ; preds = %17
  %21 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  %22 = call noundef i32 @_ZN3chw6SockFD4typeEv(ptr noundef nonnull align 8 dereferenceable(32) %21)
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %29

24:                                               ; preds = %20
  %25 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %26 unwind label %27

26:                                               ; preds = %24
  invoke void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %25, i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw6Socket9send_addrEPcjP8sockaddri, i32 noundef 1106, ptr noundef nonnull @.str.27)
          to label %42 unwind label %27

27:                                               ; preds = %29, %26, %24
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %43

29:                                               ; preds = %20
  %30 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3chw6SockFDELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  %31 = call noundef i32 @_ZNK3chw6SockFD5rawFdEv(ptr noundef nonnull align 8 dereferenceable(32) %30)
  %32 = invoke noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef %31, ptr noundef nonnull %1, i32 noundef %2, ptr noundef %3, i32 noundef %4)
          to label %33 unwind label %27

33:                                               ; preds = %29
  %34 = zext i32 %32 to i64
  %35 = getelementptr inbounds i8, ptr %0, i64 120
  %36 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZN3chw10BytesSpeedpLEm(ptr noundef nonnull align 8 dereferenceable(72) %35, i64 noundef %34)
  br label %42

37:                                               ; preds = %14
  %38 = invoke noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
          to label %.invoke unwind label %12

.invoke:                                          ; preds = %10, %37
  %39 = phi ptr [ %38, %37 ], [ %11, %10 ]
  %40 = phi i32 [ 1116, %37 ], [ 1096, %10 ]
  %41 = phi ptr [ @.str.25, %37 ], [ @.str.26, %10 ]
  invoke void (ptr, i32, ptr, ptr, i32, ptr, ...) @_ZN3chw13LoggerWrapper8printLogERNS_6LoggerEiPKcS4_iS4_z(ptr noundef nonnull align 8 dereferenceable(144) %39, i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN3chw6Socket9send_addrEPcjP8sockaddri, i32 noundef %40, ptr noundef nonnull %41)
          to label %42 unwind label %12

42:                                               ; preds = %.invoke, %33, %26, %17
  %.1 = phi i32 [ %32, %33 ], [ 0, %26 ], [ 0, %17 ], [ 0, %.invoke ]
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  ret i32 %.1

43:                                               ; preds = %27, %12
  %.pn = phi { ptr, i32 } [ %28, %27 ], [ %13, %12 ]
  call void @_ZNSt10lock_guardIN3chw12MutexWrapperISt15recursive_mutexEEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  resume { ptr, i32 } %.pn
}

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