; LLVM IR from wichue/nethello :: src/core/raw/KcpClient.ll (ZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_)

; 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::weak_ptr" = type { %"class.std::__weak_ptr" }
%"class.std::__weak_ptr" = type { ptr, %"class.std::__weak_count" }
%"class.std::__weak_count" = type { ptr }
%"class.std::shared_ptr.6" = type { %"class.std::__shared_ptr.7" }
%"class.std::__shared_ptr.7" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::shared_ptr.3" = type { %"class.std::__shared_ptr.4" }
%"class.std::__shared_ptr.4" = type { ptr, %"class.std::__shared_count" }
%class.anon = type { %"class.std::weak_ptr" }
%"class.chw::KcpClient" = type { ptr, %"class.std::enable_shared_from_this", ptr, %"class.std::shared_ptr", %"class.std::shared_ptr.0", %"class.std::shared_ptr.3", %"class.std::function", %"class.std::mutex" }
%"class.std::enable_shared_from_this" = type { %"class.std::weak_ptr" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = 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::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__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 }
%struct.IKCPCB = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.IQUEUEHEAD, %struct.IQUEUEHEAD, %struct.IQUEUEHEAD, %struct.IQUEUEHEAD, ptr, i32, i32, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr }
%struct.IQUEUEHEAD = type { ptr, ptr }

; 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
define dso_local void @_ZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_(ptr noundef nonnull align 8 dereferenceable(152) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #1 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::weak_ptr", align 8
  %11 = alloca %"class.std::shared_ptr.6", align 8
  %12 = alloca %"class.std::shared_ptr.6", align 8
  %13 = alloca %"class.std::shared_ptr.3", align 8
  %14 = alloca double, align 8
  %15 = alloca %class.anon, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %18 = load ptr, ptr %5, align 8
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = call ptr @ikcp_create(i32 noundef %19, ptr noundef %20)
  %22 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 2
  store ptr %21, ptr %22, align 8, !tbaa !11
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 2
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = getelementptr inbounds %struct.IKCPCB, ptr %25, i32 0, i32 47
  store ptr %23, ptr %26, align 8, !tbaa !28
  %27 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = call i32 @ikcp_wndsize(ptr noundef %28, i32 noundef 128, i32 noundef 128)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 2, ptr %9, align 4, !tbaa !9
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %36

32:                                               ; preds = %4
  %33 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = call i32 @ikcp_nodelay(ptr noundef %34, i32 noundef 0, i32 noundef 10, i32 noundef 0, i32 noundef 0)
  br label %54

36:                                               ; preds = %4
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = icmp eq i32 %37, 1
  br i1 %38, label %39, label %43

39:                                               ; preds = %36
  %40 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 2
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  %42 = call i32 @ikcp_nodelay(ptr noundef %41, i32 noundef 0, i32 noundef 10, i32 noundef 0, i32 noundef 1)
  br label %53

43:                                               ; preds = %36
  %44 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 2
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  %46 = call i32 @ikcp_nodelay(ptr noundef %45, i32 noundef 2, i32 noundef 10, i32 noundef 2, i32 noundef 1)
  %47 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = getelementptr inbounds %struct.IKCPCB, ptr %48, i32 0, i32 13
  store i32 10, ptr %49, align 4, !tbaa !31
  %50 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 2
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = getelementptr inbounds %struct.IKCPCB, ptr %51, i32 0, i32 42
  store i32 1, ptr %52, align 8, !tbaa !32
  br label %53

53:                                               ; preds = %43, %39
  br label %54

54:                                               ; preds = %53, %32
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  %55 = getelementptr inbounds i8, ptr %18, i64 8
  call void @_ZNSt23enable_shared_from_thisIN3chw9KcpClientEE16shared_from_thisEv(ptr dead_on_unwind writable sret(%"class.std::shared_ptr.6") align 8 %12, ptr noundef nonnull align 8 dereferenceable(16) %55)
  call void @_ZSt19static_pointer_castIN3chw9KcpClientES1_ESt10shared_ptrIT_ERKS2_IT0_E(ptr dead_on_unwind writable sret(%"class.std::shared_ptr.6") align 8 %11, ptr noundef nonnull align 8 dereferenceable(16) %12) #6
  call void @_ZNSt8weak_ptrIN3chw9KcpClientEEC2IS1_vEERKSt10shared_ptrIT_E(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %11) #6
  call void @_ZNSt12__shared_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #6
  call void @_ZNSt12__shared_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store double 1.000000e-03, ptr %14, align 8, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #6
  %56 = getelementptr inbounds %class.anon, ptr %15, i32 0, i32 0
  call void @_ZNSt8weak_ptrIN3chw9KcpClientEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  %57 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 4
  invoke void @"_ZSt11make_sharedIN3chw5TimerEJdZNS0_9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES7_E3$_0RSt10shared_ptrINS0_9EventLoopEEEESB_INSt9enable_ifIXntsr8is_arrayIT_EE5valueESG_E4typeEEDpOT0_"(ptr dead_on_unwind writable sret(%"class.std::shared_ptr.3") align 8 %13, ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %57)
          to label %58 unwind label %61

58:                                               ; preds = %54
  %59 = getelementptr inbounds %"class.chw::KcpClient", ptr %18, i32 0, i32 5
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3chw5TimerEEaSEOS2_(ptr noundef nonnull align 8 dereferenceable(16) %59, ptr noundef nonnull align 8 dereferenceable(16) %13) #6
  call void @_ZNSt12__shared_ptrIN3chw5TimerELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #6
  call void @"_ZZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_EN3$_0D2Ev"(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  call void @_ZNSt10__weak_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  ret void

61:                                               ; preds = %54
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %16, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %17, align 4
  call void @"_ZZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_EN3$_0D2Ev"(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  call void @_ZNSt10__weak_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %65

65:                                               ; preds = %61
  %66 = load ptr, ptr %16, align 8
  %67 = load i32, ptr %17, align 4
  %68 = insertvalue { ptr, i32 } poison, ptr %66, 0
  %69 = insertvalue { ptr, i32 } %68, i32 %67, 1
  resume { ptr, i32 } %69
}

declare ptr @ikcp_create(i32 noundef, ptr noundef) #2

declare i32 @ikcp_wndsize(ptr noundef, i32 noundef, i32 noundef) #2

declare i32 @ikcp_nodelay(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt19static_pointer_castIN3chw9KcpClientES1_ESt10shared_ptrIT_ERKS2_IT0_E(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.6") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt23enable_shared_from_thisIN3chw9KcpClientEE16shared_from_thisEv(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.6") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt11make_sharedIN3chw5TimerEJdZNS0_9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES7_E3$_0RSt10shared_ptrINS0_9EventLoopEEEESB_INSt9enable_ifIXntsr8is_arrayIT_EE5valueESG_E4typeEEDpOT0_"(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.3") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #5

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @"_ZZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_EN3$_0D2Ev"(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

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

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

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 = { "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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { inlinehint 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 24}
!12 = !{!"_ZTSN3chw9KcpClientE", !13, i64 8, !6, i64 24, !17, i64 32, !20, i64 48, !22, i64 64, !24, i64 80, !26, i64 112}
!13 = !{!"_ZTSSt23enable_shared_from_thisIN3chw9KcpClientEE", !14, i64 0}
!14 = !{!"_ZTSSt8weak_ptrIN3chw9KcpClientEE", !15, i64 0}
!15 = !{!"_ZTSSt10__weak_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !16, i64 8}
!16 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!17 = !{!"_ZTSSt10shared_ptrIN3chw6BufferEE", !18, i64 0}
!18 = !{!"_ZTSSt12__shared_ptrIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !19, i64 8}
!19 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!20 = !{!"_ZTSSt10shared_ptrIN3chw9EventLoopEE", !21, i64 0}
!21 = !{!"_ZTSSt12__shared_ptrIN3chw9EventLoopELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !19, i64 8}
!22 = !{!"_ZTSSt10shared_ptrIN3chw5TimerEE", !23, i64 0}
!23 = !{!"_ZTSSt12__shared_ptrIN3chw5TimerELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !19, i64 8}
!24 = !{!"_ZTSSt8functionIFvRKSt10shared_ptrIN3chw6BufferEEEE", !25, i64 0, !6, i64 24}
!25 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!26 = !{!"_ZTSSt5mutex", !27, i64 0}
!27 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!28 = !{!29, !6, i64 256}
!29 = !{!"_ZTS6IKCPCB", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !30, i64 136, !30, i64 152, !30, i64 168, !30, i64 184, !6, i64 200, !10, i64 208, !10, i64 212, !6, i64 216, !6, i64 224, !10, i64 232, !10, i64 236, !10, i64 240, !10, i64 244, !10, i64 248, !6, i64 256, !6, i64 264}
!30 = !{!"_ZTS10IQUEUEHEAD", !6, i64 0, !6, i64 8}
!31 = !{!29, !10, i64 52}
!32 = !{!29, !10, i64 232}
!33 = !{!34, !34, i64 0}
!34 = !{!"double", !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::weak_ptr" = type { %"class.std::__weak_ptr" }
%"class.std::__weak_ptr" = type { ptr, %"class.std::__weak_count" }
%"class.std::__weak_count" = type { ptr }
%"class.std::shared_ptr.6" = type { %"class.std::__shared_ptr.7" }
%"class.std::__shared_ptr.7" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::shared_ptr.3" = type { %"class.std::__shared_ptr.4" }
%"class.std::__shared_ptr.4" = type { ptr, %"class.std::__shared_count" }
%class.anon = type { %"class.std::weak_ptr" }

; 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
define dso_local void @_ZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_(ptr noundef nonnull align 8 dereferenceable(152) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::weak_ptr", align 8
  %6 = alloca %"class.std::shared_ptr.6", align 8
  %7 = alloca %"class.std::shared_ptr.6", align 8
  %8 = alloca %"class.std::shared_ptr.3", align 8
  %9 = alloca double, align 8
  %10 = alloca %class.anon, align 8
  %11 = tail call ptr @ikcp_create(i32 noundef %1, ptr noundef %3)
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %11, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %11, i64 256
  store ptr %2, ptr %13, align 8, !tbaa !25
  %14 = tail call i32 @ikcp_wndsize(ptr noundef %11, i32 noundef 128, i32 noundef 128)
  %15 = load ptr, ptr %12, align 8, !tbaa !5
  %16 = tail call i32 @ikcp_nodelay(ptr noundef %15, i32 noundef 2, i32 noundef 10, i32 noundef 2, i32 noundef 1)
  %17 = load ptr, ptr %12, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 52
  store i32 10, ptr %18, align 4, !tbaa !29
  %19 = getelementptr inbounds i8, ptr %17, i64 232
  store i32 1, ptr %19, align 8, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZNSt23enable_shared_from_thisIN3chw9KcpClientEE16shared_from_thisEv(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr.6") align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %20)
  call void @_ZSt19static_pointer_castIN3chw9KcpClientES1_ESt10shared_ptrIT_ERKS2_IT0_E(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr.6") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  call void @_ZNSt8weak_ptrIN3chw9KcpClientEEC2IS1_vEERKSt10shared_ptrIT_E(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @_ZNSt12__shared_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @_ZNSt12__shared_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  store double 1.000000e-03, ptr %9, align 8, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #6
  call void @_ZNSt8weak_ptrIN3chw9KcpClientEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  %21 = getelementptr inbounds i8, ptr %0, i64 48
  invoke void @"_ZSt11make_sharedIN3chw5TimerEJdZNS0_9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES7_E3$_0RSt10shared_ptrINS0_9EventLoopEEEESB_INSt9enable_ifIXntsr8is_arrayIT_EE5valueESG_E4typeEEDpOT0_"(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr.3") align 8 %8, ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %21)
          to label %22 unwind label %25

22:                                               ; preds = %4
  %23 = getelementptr inbounds i8, ptr %0, i64 64
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3chw5TimerEEaSEOS2_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  call void @_ZNSt12__shared_ptrIN3chw5TimerELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  call void @"_ZZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_EN3$_0D2Ev"(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  call void @_ZNSt10__weak_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  ret void

25:                                               ; preds = %4
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @"_ZZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_EN3$_0D2Ev"(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  call void @_ZNSt10__weak_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  resume { ptr, i32 } %26
}

declare ptr @ikcp_create(i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ikcp_wndsize(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare i32 @ikcp_nodelay(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt19static_pointer_castIN3chw9KcpClientES1_ESt10shared_ptrIT_ERKS2_IT0_E(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.6") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt23enable_shared_from_thisIN3chw9KcpClientEE16shared_from_thisEv(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.6") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt11make_sharedIN3chw5TimerEJdZNS0_9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES7_E3$_0RSt10shared_ptrINS0_9EventLoopEEEESB_INSt9enable_ifIXntsr8is_arrayIT_EE5valueESG_E4typeEEDpOT0_"(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.3") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @"_ZZN3chw9KcpClient9CreateKcpEjPFiPKciP6IKCPCBPvES5_EN3$_0D2Ev"(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

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

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

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 = { "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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { inlinehint 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 24}
!6 = !{!"_ZTSN3chw9KcpClientE", !7, i64 8, !10, i64 24, !14, i64 32, !17, i64 48, !19, i64 64, !21, i64 80, !23, i64 112}
!7 = !{!"_ZTSSt23enable_shared_from_thisIN3chw9KcpClientEE", !8, i64 0}
!8 = !{!"_ZTSSt8weak_ptrIN3chw9KcpClientEE", !9, i64 0}
!9 = !{!"_ZTSSt10__weak_ptrIN3chw9KcpClientELN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !13, i64 8}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0}
!14 = !{!"_ZTSSt10shared_ptrIN3chw6BufferEE", !15, i64 0}
!15 = !{!"_ZTSSt12__shared_ptrIN3chw6BufferELN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !16, i64 8}
!16 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0}
!17 = !{!"_ZTSSt10shared_ptrIN3chw9EventLoopEE", !18, i64 0}
!18 = !{!"_ZTSSt12__shared_ptrIN3chw9EventLoopELN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !16, i64 8}
!19 = !{!"_ZTSSt10shared_ptrIN3chw5TimerEE", !20, i64 0}
!20 = !{!"_ZTSSt12__shared_ptrIN3chw5TimerELN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !16, i64 8}
!21 = !{!"_ZTSSt8functionIFvRKSt10shared_ptrIN3chw6BufferEEEE", !22, i64 0, !10, i64 24}
!22 = !{!"_ZTSSt14_Function_base", !11, i64 0, !10, i64 16}
!23 = !{!"_ZTSSt5mutex", !24, i64 0}
!24 = !{!"_ZTSSt12__mutex_base", !11, i64 0}
!25 = !{!26, !10, i64 256}
!26 = !{!"_ZTS6IKCPCB", !27, i64 0, !27, i64 4, !27, i64 8, !27, i64 12, !27, i64 16, !27, i64 20, !27, i64 24, !27, i64 28, !27, i64 32, !27, i64 36, !27, i64 40, !27, i64 44, !27, i64 48, !27, i64 52, !27, i64 56, !27, i64 60, !27, i64 64, !27, i64 68, !27, i64 72, !27, i64 76, !27, i64 80, !27, i64 84, !27, i64 88, !27, i64 92, !27, i64 96, !27, i64 100, !27, i64 104, !27, i64 108, !27, i64 112, !27, i64 116, !27, i64 120, !27, i64 124, !27, i64 128, !28, i64 136, !28, i64 152, !28, i64 168, !28, i64 184, !10, i64 200, !27, i64 208, !27, i64 212, !10, i64 216, !10, i64 224, !27, i64 232, !27, i64 236, !27, i64 240, !27, i64 244, !27, i64 248, !10, i64 256, !10, i64 264}
!27 = !{!"int", !11, i64 0}
!28 = !{!"_ZTS10IQUEUEHEAD", !10, i64 0, !10, i64 8}
!29 = !{!26, !27, i64 52}
!30 = !{!26, !27, i64 232}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !11, i64 0}


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