; LLVM IR from wichue/nethello :: src/net/SocketBase.ll (ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri)

; 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", ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

@.str = external hidden unnamed_addr constant [1 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [19 x i8], align 1
@__FUNCTION__._ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri = external hidden unnamed_addr constant [14 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [10 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

declare i32 @usleep(i32 noundef) #1

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

declare noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef) #1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.chw::LogContextCapture", align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca %"class.chw::LogContextCapture", align 8
  %22 = alloca ptr, align 8
  store i32 %0, ptr %7, align 4, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %81, %5
  %24 = load i32, ptr %12, align 4, !tbaa !5
  %25 = icmp sle i32 %24, 0
  br i1 %25, label %26, label %115

26:                                               ; preds = %23
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !9
  %29 = load i32, ptr %9, align 4, !tbaa !5
  %30 = zext i32 %29 to i64
  %31 = load ptr, ptr %10, align 8, !tbaa !9
  %32 = load i32, ptr %11, align 4, !tbaa !5
  %33 = call i64 @sendto(i32 noundef %27, ptr noundef %28, i64 noundef %30, i32 noundef 0, ptr noundef %31, i32 noundef %32)
  %34 = trunc i64 %33 to i32
  store i32 %34, ptr %12, align 4, !tbaa !5
  %35 = load i32, ptr %12, align 4, !tbaa !5
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %37, label %83

37:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %38 = call noundef i32 @_ZN3chw12get_uv_errorEb(i1 noundef zeroext true)
  store i32 %38, ptr %14, align 4, !tbaa !5
  %39 = load i32, ptr %14, align 4, !tbaa !5
  %40 = icmp eq i32 %39, -11
  br i1 %40, label %41, label %47

41:                                               ; preds = %37
  %42 = load i32, ptr %13, align 4, !tbaa !5
  %43 = add i32 %42, 1
  store i32 %43, ptr %13, align 4, !tbaa !5
  %44 = icmp ult i32 %42, 10000
  br i1 %44, label %45, label %47

45:                                               ; preds = %41
  %46 = call i32 @usleep(i32 noundef 1000)
  store i32 2, ptr %15, align 4
  br label %81, !llvm.loop !11

47:                                               ; preds = %41, %37
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #4
  %48 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
  call void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(144) %48, i32 noundef 4, ptr noundef @.str.1, ptr noundef @__FUNCTION__._ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri, i32 noundef 1311, ptr noundef @.str)
  %49 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA17_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 1 dereferenceable(17) @.str.36)
          to label %50 unwind label %72

50:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %51 = load i32, ptr %14, align 4, !tbaa !5
  %52 = invoke noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef %51)
          to label %53 unwind label %76

53:                                               ; preds = %50
  store ptr %52, ptr %19, align 8, !tbaa !9
  %54 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %49, ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %55 unwind label %76

55:                                               ; preds = %53
  %56 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA14_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %54, ptr noundef nonnull align 1 dereferenceable(14) @.str.37)
          to label %57 unwind label %76

57:                                               ; preds = %55
  %58 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRjEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %56, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %59 unwind label %76

59:                                               ; preds = %57
  %60 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA6_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %58, ptr noundef nonnull align 1 dereferenceable(6) @.str.38)
          to label %61 unwind label %76

61:                                               ; preds = %59
  %62 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRjEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %60, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %63 unwind label %76

63:                                               ; preds = %61
  %64 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA10_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %62, ptr noundef nonnull align 1 dereferenceable(10) @.str.42)
          to label %65 unwind label %76

65:                                               ; preds = %63
  %66 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %64, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %67 unwind label %76

67:                                               ; preds = %65
  %68 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA5_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %66, ptr noundef nonnull align 1 dereferenceable(5) @.str.40)
          to label %69 unwind label %76

69:                                               ; preds = %67
  %70 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %71 unwind label %76

71:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #4
  store i32 0, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %81

72:                                               ; preds = %47
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %17, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %18, align 4
  br label %80

76:                                               ; preds = %69, %67, %65, %63, %61, %59, %57, %55, %53, %50
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %17, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %80

80:                                               ; preds = %76, %72
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %118

81:                                               ; preds = %71, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %82 = load i32, ptr %15, align 4
  switch i32 %82, label %116 [
    i32 2, label %23
  ]

83:                                               ; preds = %26
  %84 = load i32, ptr %12, align 4, !tbaa !5
  %85 = icmp sgt i32 %84, 0
  br i1 %85, label %86, label %88

86:                                               ; preds = %83
  %87 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %87, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %116

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %89 = call noundef i32 @_ZN3chw12get_uv_errorEb(i1 noundef zeroext true)
  store i32 %89, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #4
  %90 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
  call void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 8 dereferenceable(144) %90, i32 noundef 4, ptr noundef @.str.1, ptr noundef @__FUNCTION__._ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri, i32 noundef 1317, ptr noundef @.str)
  %91 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA19_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 1 dereferenceable(19) @.str.41)
          to label %92 unwind label %106

92:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %93 = load i32, ptr %20, align 4, !tbaa !5
  %94 = invoke noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef %93)
          to label %95 unwind label %110

95:                                               ; preds = %92
  store ptr %94, ptr %22, align 8, !tbaa !9
  %96 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %91, ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %97 unwind label %110

97:                                               ; preds = %95
  %98 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA6_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %96, ptr noundef nonnull align 1 dereferenceable(6) @.str.38)
          to label %99 unwind label %110

99:                                               ; preds = %97
  %100 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRjEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %98, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %101 unwind label %110

101:                                              ; preds = %99
  %102 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA5_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %100, ptr noundef nonnull align 1 dereferenceable(5) @.str.40)
          to label %103 unwind label %110

103:                                              ; preds = %101
  %104 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %102, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %105 unwind label %110

105:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %21) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #4
  store i32 0, ptr %6, align 4
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %116

106:                                              ; preds = %88
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %17, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %18, align 4
  br label %114

110:                                              ; preds = %103, %101, %99, %97, %95, %92
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %17, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  br label %114

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

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

116:                                              ; preds = %115, %105, %86, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %117 = load i32, ptr %6, align 4
  ret i32 %117

118:                                              ; preds = %114, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %119

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

declare i64 @sendto(i32 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef) #1

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 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 = { 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 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

%"class.chw::LogContextCapture" = type { %"class.std::shared_ptr", ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

@.str = external hidden unnamed_addr constant [1 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [19 x i8], align 1
@__FUNCTION__._ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri = external hidden unnamed_addr constant [14 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [10 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

declare i32 @usleep(i32 noundef) local_unnamed_addr #1

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.chw::LogContextCapture", align 8
  %11 = alloca ptr, align 8
  %12 = alloca %"class.chw::LogContextCapture", align 8
  %13 = alloca ptr, align 8
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #4
  %14 = zext i32 %2 to i64
  %15 = tail call i64 @sendto(i32 noundef %0, ptr noundef %1, i64 noundef %14, i32 noundef 0, ptr noundef %3, i32 noundef %4)
  %16 = trunc i64 %15 to i32
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5, %.critedge
  %18 = phi i32 [ %26, %.critedge ], [ %16, %5 ]
  %19 = phi i32 [ %23, %.critedge ], [ 0, %5 ]
  %20 = tail call noundef i32 @_ZN3chw12get_uv_errorEb(i1 noundef zeroext true)
  %21 = icmp eq i32 %20, -11
  br i1 %21, label %22, label %28

22:                                               ; preds = %.lr.ph
  %exitcond.not = icmp eq i32 %19, 10000
  br i1 %exitcond.not, label %28, label %.critedge

.critedge:                                        ; preds = %22
  %23 = add nuw nsw i32 %19, 1
  %24 = tail call i32 @usleep(i32 noundef 1000)
  %25 = tail call i64 @sendto(i32 noundef %0, ptr noundef %1, i64 noundef %14, i32 noundef 0, ptr noundef %3, i32 noundef %4)
  %26 = trunc i64 %25 to i32
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

28:                                               ; preds = %22, %.lr.ph
  %29 = phi i32 [ 10001, %22 ], [ %19, %.lr.ph ]
  store i32 %18, ptr %8, align 4, !tbaa !5
  store i32 %29, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #4
  %30 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
  call void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(144) %30, i32 noundef 4, ptr noundef nonnull @.str.1, ptr noundef nonnull @__FUNCTION__._ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri, i32 noundef 1311, ptr noundef nonnull @.str)
  %31 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA17_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 1 dereferenceable(17) @.str.36)
          to label %32 unwind label %53

32:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  %33 = invoke noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef %20)
          to label %34 unwind label %55

34:                                               ; preds = %32
  store ptr %33, ptr %11, align 8, !tbaa !9
  %35 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %31, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %36 unwind label %55

36:                                               ; preds = %34
  %37 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA14_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 1 dereferenceable(14) @.str.37)
          to label %38 unwind label %55

38:                                               ; preds = %36
  %39 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRjEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %40 unwind label %55

40:                                               ; preds = %38
  %41 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA6_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 1 dereferenceable(6) @.str.38)
          to label %42 unwind label %55

42:                                               ; preds = %40
  %43 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRjEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %41, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %44 unwind label %55

44:                                               ; preds = %42
  %45 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA10_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %43, ptr noundef nonnull align 1 dereferenceable(10) @.str.42)
          to label %46 unwind label %55

46:                                               ; preds = %44
  %47 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %45, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %48 unwind label %55

48:                                               ; preds = %46
  %49 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA5_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 1 dereferenceable(5) @.str.40)
          to label %50 unwind label %55

50:                                               ; preds = %48
  %51 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %49, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %52 unwind label %55

52:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #4
  br label %80

53:                                               ; preds = %28
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %57

55:                                               ; preds = %50, %48, %46, %44, %42, %40, %38, %36, %34, %32
  %56 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  br label %57

57:                                               ; preds = %55, %53
  %.pn18 = phi { ptr, i32 } [ %56, %55 ], [ %54, %53 ]
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #4
  br label %81

._crit_edge:                                      ; preds = %.critedge, %5
  %.lcssa = phi i32 [ %16, %5 ], [ %26, %.critedge ]
  %.not = icmp eq i32 %.lcssa, 0
  br i1 %.not, label %58, label %80

58:                                               ; preds = %._crit_edge
  %59 = tail call noundef i32 @_ZN3chw12get_uv_errorEb(i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #4
  %60 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZN3chw9getLoggerEv()
  call void @_ZN3chw17LogContextCaptureC1ERNS_6LoggerENS_8LogLevelEPKcS5_iS5_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(144) %60, i32 noundef 4, ptr noundef nonnull @.str.1, ptr noundef nonnull @__FUNCTION__._ZN3chw8SockUtil13send_udp_dataEiPcjP8sockaddri, i32 noundef 1317, ptr noundef nonnull @.str)
  %61 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA19_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 1 dereferenceable(19) @.str.41)
          to label %62 unwind label %75

62:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #4
  %63 = invoke noundef ptr @_ZN3chw11uv_strerrorEi(i32 noundef %59)
          to label %64 unwind label %77

64:                                               ; preds = %62
  store ptr %63, ptr %13, align 8, !tbaa !9
  %65 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIPKcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %61, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %66 unwind label %77

66:                                               ; preds = %64
  %67 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA6_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %65, ptr noundef nonnull align 1 dereferenceable(6) @.str.38)
          to label %68 unwind label %77

68:                                               ; preds = %66
  %69 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRjEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %67, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %70 unwind label %77

70:                                               ; preds = %68
  %71 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRA5_KcEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %69, ptr noundef nonnull align 1 dereferenceable(5) @.str.40)
          to label %72 unwind label %77

72:                                               ; preds = %70
  %73 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3chw17LogContextCapturelsIRiEERS0_OT_(ptr noundef nonnull align 8 dereferenceable(24) %71, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %74 unwind label %77

74:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #4
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #4
  br label %80

75:                                               ; preds = %58
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %79

77:                                               ; preds = %72, %70, %68, %66, %64, %62
  %78 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #4
  br label %79

79:                                               ; preds = %77, %75
  %.pn = phi { ptr, i32 } [ %78, %77 ], [ %76, %75 ]
  call void @_ZN3chw17LogContextCaptureD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #4
  br label %81

80:                                               ; preds = %._crit_edge, %52, %74
  %.2 = phi i32 [ 0, %52 ], [ 0, %74 ], [ %.lcssa, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  ret i32 %.2

81:                                               ; preds = %79, %57
  %.pn18.pn = phi { ptr, i32 } [ %.pn18, %57 ], [ %.pn, %79 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  resume { ptr, i32 } %.pn18.pn
}

declare i64 @sendto(i32 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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 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 = { 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 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass