; LLVM IR from newbiediver/rioring :: examples/chatserver (receiver)

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { 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 }
%"struct.std::array.19" = type { [1024 x i8] }
%"class.std::basic_string_view" = type { i64, ptr }
%struct.scheme = type <{ i8, i16 }>
%struct.request_chat = type <{ %struct.scheme, i32 }>

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [25 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14event_receiver10on_receiveERSt10shared_ptrIN7rioring13socket_objectEEPNS1_9io_bufferEP8sockaddr(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1, ptr noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.std::shared_ptr", align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::array.19", align 1
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.std::basic_string_view", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #7
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN7rioring17to_tcp_socket_ptrERKSt10shared_ptrINS_13socket_objectEE(ptr dead_on_unwind writable sret(%"class.std::shared_ptr") align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %16)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %17 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  %18 = invoke noundef ptr @_ZNK7rioring13socket_object13get_user_dataEv(ptr noundef nonnull align 8 dereferenceable(66088) %17)
          to label %19 unwind label %31

19:                                               ; preds = %3
  store ptr %18, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %11) #7
  call void @llvm.memset.p0.i64(ptr align 1 %11, i8 0, i64 1024, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %20 = call noundef ptr @_ZSt4dataISt5arrayIhLm1024EEEDTcldtfp_4dataEERT_(ptr noundef nonnull align 1 dereferenceable(1024) %11) #7
  store ptr %20, ptr %12, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %94, %19
  br label %22

22:                                               ; preds = %21
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5arrayIhLm1024EEixEm(ptr noundef nonnull align 1 dereferenceable(1024) %11, i64 noundef 0) #7
  %25 = load ptr, ptr %23, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 0
  %27 = load ptr, ptr %26, align 8
  %28 = invoke noundef zeroext i1 %27(ptr noundef nonnull align 8 dereferenceable(40) %23, ptr noundef %24, i64 noundef 3)
          to label %29 unwind label %35

29:                                               ; preds = %22
  br i1 %28, label %39, label %30

30:                                               ; preds = %29
  br label %95

31:                                               ; preds = %3
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %9, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %10, align 4
  br label %97

35:                                               ; preds = %71, %69, %67, %52, %39, %22
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %9, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %10, align 4
  br label %96

39:                                               ; preds = %29
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5arrayIhLm1024EEixEm(ptr noundef nonnull align 1 dereferenceable(1024) %11, i64 noundef 0) #7
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.scheme, ptr %42, i32 0, i32 1
  %44 = load i16, ptr %43, align 1, !tbaa !11
  %45 = zext i16 %44 to i64
  %46 = load ptr, ptr %40, align 8, !tbaa !9
  %47 = getelementptr inbounds ptr, ptr %46, i64 0
  %48 = load ptr, ptr %47, align 8
  %49 = invoke noundef zeroext i1 %48(ptr noundef nonnull align 8 dereferenceable(40) %40, ptr noundef %41, i64 noundef %45)
          to label %50 unwind label %35

50:                                               ; preds = %39
  br i1 %49, label %52, label %51

51:                                               ; preds = %50
  br label %95

52:                                               ; preds = %50
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.scheme, ptr %54, i32 0, i32 1
  %56 = load i16, ptr %55, align 1, !tbaa !11
  %57 = zext i16 %56 to i64
  %58 = load ptr, ptr %53, align 8, !tbaa !9
  %59 = getelementptr inbounds ptr, ptr %58, i64 1
  %60 = load ptr, ptr %59, align 8
  invoke void %60(ptr noundef nonnull align 8 dereferenceable(40) %53, i64 noundef %57)
          to label %61 unwind label %35

61:                                               ; preds = %52
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.scheme, ptr %62, i32 0, i32 0
  %64 = load i8, ptr %63, align 1, !tbaa !14
  %65 = zext i8 %64 to i32
  %66 = icmp ne i32 %65, 1
  br i1 %66, label %67, label %74

67:                                               ; preds = %61
  %68 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str)
          to label %69 unwind label %35

69:                                               ; preds = %67
  %70 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %71 unwind label %35

71:                                               ; preds = %69
  %72 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  invoke void @_ZN7rioring13socket_object5closeENS0_10close_typeE(ptr noundef nonnull align 8 dereferenceable(66088) %72, i32 noundef 1)
          to label %73 unwind label %35

73:                                               ; preds = %71
  br label %95

74:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %75, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.request_chat, ptr %76, i64 1
  store ptr %77, ptr %14, align 8, !tbaa !5
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.request_chat, ptr %78, i32 0, i32 1
  %80 = load i32, ptr %79, align 1, !tbaa !15
  %81 = icmp sgt i32 %80, 0
  br i1 %81, label %82, label %94

82:                                               ; preds = %74
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZNSt17basic_string_viewIcSt11char_traitsIcEEC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef %84) #7
  %85 = getelementptr inbounds { i64, ptr }, ptr %15, i32 0, i32 0
  %86 = load i64, ptr %85, align 8
  %87 = getelementptr inbounds { i64, ptr }, ptr %15, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8
  invoke void @_ZN6client4chatESt17basic_string_viewIcSt11char_traitsIcEE(ptr noundef nonnull align 8 dereferenceable(48) %83, i64 %86, ptr %88)
          to label %89 unwind label %90

89:                                               ; preds = %82
  br label %94

90:                                               ; preds = %82
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %9, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %96

94:                                               ; preds = %89, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %21, !llvm.loop !18

95:                                               ; preds = %73, %51, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @_ZNSt12__shared_ptrIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #7
  ret void

96:                                               ; preds = %90, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr %11) #7
  br label %97

97:                                               ; preds = %96, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @_ZNSt12__shared_ptrIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #7
  br label %98

98:                                               ; preds = %97
  %99 = load ptr, ptr %9, align 8
  %100 = load i32, ptr %10, align 4
  %101 = insertvalue { ptr, i32 } poison, ptr %99, 0
  %102 = insertvalue { ptr, i32 } %101, i32 %100, 1
  resume { ptr, i32 } %102
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZSt4dataISt5arrayIhLm1024EEEDTcldtfp_4dataEERT_(ptr noundef nonnull align 1 dereferenceable(1024)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5arrayIhLm1024EEixEm(ptr noundef nonnull align 1 dereferenceable(1024), i64 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

declare void @_ZN7rioring13socket_object5closeENS0_10close_typeE(ptr noundef nonnull align 8 dereferenceable(66088), i32 noundef) #6

declare void @_ZN6client4chatESt17basic_string_viewIcSt11char_traitsIcEE(ptr noundef nonnull align 8 dereferenceable(48), i64, ptr) #6

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { "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 #7 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 1}
!12 = !{!"_ZTS6scheme", !7, i64 0, !13, i64 1}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !7, i64 0}
!15 = !{!16, !17, i64 3}
!16 = !{!"_ZTS12request_chat", !12, i64 0, !17, i64 3}
!17 = !{!"int", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { 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 }
%"struct.std::array.19" = type { [1024 x i8] }
%"class.std::basic_string_view" = type { i64, ptr }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [25 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 nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1 align 2

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14event_receiver10on_receiveERSt10shared_ptrIN7rioring13socket_objectEEPNS1_9io_bufferEP8sockaddr(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1, ptr nocapture noundef readnone %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::shared_ptr", align 8
  %5 = alloca %"struct.std::array.19", align 1
  %6 = alloca %"class.std::basic_string_view", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  call void @_ZN7rioring17to_tcp_socket_ptrERKSt10shared_ptrINS_13socket_objectEE(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %0)
  %7 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  %8 = call noundef ptr @_ZNK7rioring13socket_object13get_user_dataEv(ptr noundef nonnull align 8 dereferenceable(66088) %7)
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1024) %5, i8 0, i64 1024, i1 false)
  %9 = call noundef ptr @_ZSt4dataISt5arrayIhLm1024EEEDTcldtfp_4dataEERT_(ptr noundef nonnull align 1 dereferenceable(1024) %5) #7
  %10 = getelementptr inbounds i8, ptr %9, i64 1
  %11 = getelementptr inbounds i8, ptr %9, i64 3
  %12 = getelementptr inbounds i8, ptr %9, i64 7
  %13 = getelementptr inbounds i8, ptr %6, i64 8
  br label %14

14:                                               ; preds = %.backedge, %3
  %15 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5arrayIhLm1024EEixEm(ptr noundef nonnull align 1 dereferenceable(1024) %5, i64 noundef 0) #7
  %16 = load ptr, ptr %1, align 8, !tbaa !5
  %17 = load ptr, ptr %16, align 8
  %18 = invoke noundef zeroext i1 %17(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull %15, i64 noundef 3)
          to label %19 unwind label %.loopexit

19:                                               ; preds = %14
  br i1 %18, label %20, label %.loopexit15

.loopexit:                                        ; preds = %14, %20, %28
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %50

.loopexit.split-lp:                               ; preds = %36, %38, %40
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %50

20:                                               ; preds = %19
  %21 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5arrayIhLm1024EEixEm(ptr noundef nonnull align 1 dereferenceable(1024) %5, i64 noundef 0) #7
  %22 = load i16, ptr %10, align 1, !tbaa !8
  %23 = zext i16 %22 to i64
  %24 = load ptr, ptr %1, align 8, !tbaa !5
  %25 = load ptr, ptr %24, align 8
  %26 = invoke noundef zeroext i1 %25(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull %21, i64 noundef %23)
          to label %27 unwind label %.loopexit

27:                                               ; preds = %20
  br i1 %26, label %28, label %.loopexit15

28:                                               ; preds = %27
  %29 = load i16, ptr %10, align 1, !tbaa !8
  %30 = zext i16 %29 to i64
  %31 = load ptr, ptr %1, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  %33 = load ptr, ptr %32, align 8
  invoke void %33(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 noundef %30)
          to label %34 unwind label %.loopexit

34:                                               ; preds = %28
  %35 = load i8, ptr %9, align 1, !tbaa !12
  %.not = icmp eq i8 %35, 1
  br i1 %.not, label %42, label %36

36:                                               ; preds = %34
  %37 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str)
          to label %38 unwind label %.loopexit.split-lp

38:                                               ; preds = %36
  %39 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %37, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %40 unwind label %.loopexit.split-lp

40:                                               ; preds = %38
  %41 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  invoke void @_ZN7rioring13socket_object5closeENS0_10close_typeE(ptr noundef nonnull align 8 dereferenceable(66088) %41, i32 noundef 1)
          to label %.loopexit15 unwind label %.loopexit.split-lp

42:                                               ; preds = %34
  %43 = load i32, ptr %11, align 1, !tbaa !13
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %45, label %.backedge

45:                                               ; preds = %42
  call void @_ZNSt17basic_string_viewIcSt11char_traitsIcEEC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef %12) #7
  %46 = load i64, ptr %6, align 8
  %47 = load ptr, ptr %13, align 8
  invoke void @_ZN6client4chatESt17basic_string_viewIcSt11char_traitsIcEE(ptr noundef nonnull align 8 dereferenceable(48) %8, i64 %46, ptr %47)
          to label %.backedge unwind label %48

.backedge:                                        ; preds = %45, %42
  br label %14, !llvm.loop !16

48:                                               ; preds = %45
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %50

.loopexit15:                                      ; preds = %27, %19, %40
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #7
  call void @_ZNSt12__shared_ptrIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  ret void

50:                                               ; preds = %.loopexit, %.loopexit.split-lp, %48
  %.pn = phi { ptr, i32 } [ %49, %48 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #7
  call void @_ZNSt12__shared_ptrIN7rioring10tcp_socketELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn
}

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5arrayIhLm1024EEixEm(ptr noundef nonnull align 1 dereferenceable(1024), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3

declare void @_ZN7rioring13socket_object5closeENS0_10close_typeE(ptr noundef nonnull align 8 dereferenceable(66088), i32 noundef) local_unnamed_addr #6

declare void @_ZN6client4chatESt17basic_string_viewIcSt11char_traitsIcEE(ptr noundef nonnull align 8 dereferenceable(48), i64, ptr) local_unnamed_addr #6

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { "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 #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !11, i64 1}
!9 = !{!"_ZTS6scheme", !10, i64 0, !11, i64 1}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!"short", !10, i64 0}
!12 = !{!9, !10, i64 0}
!13 = !{!14, !15, i64 3}
!14 = !{!"_ZTS12request_chat", !9, i64 0, !15, i64 3}
!15 = !{!"int", !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass