; LLVM IR from yinqiwen/ardb :: src/common/coro/coro_channel.ll (ZN4ardb15CoroRedisClient14FillErrorReplyEv)

; 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.ardb::CoroRedisClient" = type { %"class.ardb::CoroChannel", %"class.ardb::ChannelUpstreamHandler.33", i64, %"class.std::vector.35", %"class.ardb::codec::RedisReplyDecoder", %"class.ardb::codec::RedisCommandEncoder", %"struct.ardb::codec::RedisReply" }
%"class.ardb::CoroChannel" = type { %"class.ardb::ChannelUpstreamHandler", %"class.ardb::Runnable", ptr, ptr, ptr, ptr, i8, ptr, i8, i32 }
%"class.ardb::ChannelUpstreamHandler" = type { %"class.ardb::AbstractChannelHandler" }
%"class.ardb::AbstractChannelHandler" = type { %"class.ardb::ChannelHandler" }
%"class.ardb::ChannelHandler" = type { ptr }
%"class.ardb::Runnable" = type { ptr }
%"class.ardb::ChannelUpstreamHandler.33" = type { %"class.ardb::AbstractChannelHandler.34" }
%"class.ardb::AbstractChannelHandler.34" = type { %"class.ardb::ChannelHandler" }
%"class.std::vector.35" = type { %"struct.std::_Vector_base.36" }
%"struct.std::_Vector_base.36" = type { %"struct.std::_Vector_base<ardb::codec::RedisReply *, std::allocator<ardb::codec::RedisReply *>>::_Vector_impl" }
%"struct.std::_Vector_base<ardb::codec::RedisReply *, std::allocator<ardb::codec::RedisReply *>>::_Vector_impl" = type { %"struct.std::_Vector_base<ardb::codec::RedisReply *, std::allocator<ardb::codec::RedisReply *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ardb::codec::RedisReply *, std::allocator<ardb::codec::RedisReply *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.ardb::codec::RedisReplyDecoder" = type { %"class.ardb::codec::StackFrameDecoder" }
%"class.ardb::codec::StackFrameDecoder" = type { %"class.ardb::ChannelUpstreamHandler", %"class.ardb::Buffer" }
%"class.ardb::Buffer" = type <{ ptr, i64, i64, i64, i8, [7 x i8] }>
%"class.ardb::codec::RedisCommandEncoder" = type { %"class.ardb::ChannelDownstreamHandler" }
%"class.ardb::ChannelDownstreamHandler" = type { %"class.ardb::AbstractChannelHandler.40" }
%"class.ardb::AbstractChannelHandler.40" = type { %"class.ardb::ChannelHandler" }
%"struct.ardb::codec::RedisReply" = type { ptr, i32, %"class.std::__cxx11::basic_string", i64, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; 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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4ardb15CoroRedisClient14FillErrorReplyEv(ptr noundef nonnull align 8 dereferenceable(240) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  br label %5

5:                                                ; preds = %11, %1
  %6 = getelementptr inbounds %"class.ardb::CoroRedisClient", ptr %4, i32 0, i32 3
  %7 = call noundef i64 @_ZNKSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  %8 = getelementptr inbounds %"class.ardb::CoroRedisClient", ptr %4, i32 0, i32 2
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = icmp ult i64 %7, %9
  br i1 %10, label %11, label %14

11:                                               ; preds = %5
  %12 = getelementptr inbounds %"class.ardb::CoroRedisClient", ptr %4, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %13 = getelementptr inbounds %"class.ardb::CoroRedisClient", ptr %4, i32 0, i32 6
  store ptr %13, ptr %3, align 8, !tbaa !5
  call void @_ZNSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE9push_backEOS3_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %5, !llvm.loop !34

14:                                               ; preds = %5
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE9push_backEOS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #2 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 = { 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, !20, i64 80}
!10 = !{!"_ZTSN4ardb15CoroRedisClientE", !11, i64 0, !18, i64 72, !20, i64 80, !21, i64 88, !25, i64 112, !28, i64 160, !31, i64 168}
!11 = !{!"_ZTSN4ardb11CoroChannelE", !12, i64 0, !15, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !16, i64 48, !6, i64 56, !16, i64 64, !17, i64 68}
!12 = !{!"_ZTSN4ardb22ChannelUpstreamHandlerINS_6BufferEEE", !13, i64 0}
!13 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_6BufferEEE", !14, i64 0}
!14 = !{!"_ZTSN4ardb14ChannelHandlerE"}
!15 = !{!"_ZTSN4ardb8RunnableE"}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSN4ardb22ChannelUpstreamHandlerINS_5codec10RedisReplyEEE", !19, i64 0}
!19 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_5codec10RedisReplyEEE", !14, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIPN4ardb5codec10RedisReplyESaIS3_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIPN4ardb5codec10RedisReplyESaIS3_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIPN4ardb5codec10RedisReplyESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTSN4ardb5codec17RedisReplyDecoderE", !26, i64 0}
!26 = !{!"_ZTSN4ardb5codec17StackFrameDecoderINS0_10RedisReplyEEE", !12, i64 0, !27, i64 8}
!27 = !{!"_ZTSN4ardb6BufferE", !6, i64 0, !20, i64 8, !20, i64 16, !20, i64 24, !16, i64 32}
!28 = !{!"_ZTSN4ardb5codec19RedisCommandEncoderE", !29, i64 0}
!29 = !{!"_ZTSN4ardb24ChannelDownstreamHandlerINS_5codec17RedisCommandFrameEEE", !30, i64 0}
!30 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_5codec17RedisCommandFrameEEE", !14, i64 0}
!31 = !{!"_ZTSN4ardb5codec10RedisReplyE", !17, i64 8, !32, i64 16, !20, i64 48, !6, i64 56, !6, i64 64}
!32 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !33, i64 0, !20, i64 8, !7, i64 16}
!33 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"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"

; 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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4ardb15CoroRedisClient14FillErrorReplyEv(ptr noundef nonnull align 8 dereferenceable(240) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 88
  %4 = tail call noundef i64 @_ZNKSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 80
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = icmp ult i64 %4, %6
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %8 = getelementptr inbounds i8, ptr %0, i64 168
  br label %9

9:                                                ; preds = %.lr.ph, %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  store ptr %8, ptr %2, align 8, !tbaa !33
  call void @_ZNSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE9push_backEOS3_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  %10 = call noundef i64 @_ZNKSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %11 = load i64, ptr %5, align 8, !tbaa !5
  %12 = icmp ult i64 %10, %11
  br i1 %12, label %9, label %._crit_edge, !llvm.loop !34

._crit_edge:                                      ; preds = %9, %1
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE9push_backEOS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 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 = { 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, !19, i64 80}
!6 = !{!"_ZTSN4ardb15CoroRedisClientE", !7, i64 0, !17, i64 72, !19, i64 80, !20, i64 88, !24, i64 112, !27, i64 160, !30, i64 168}
!7 = !{!"_ZTSN4ardb11CoroChannelE", !8, i64 0, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !15, i64 48, !12, i64 56, !15, i64 64, !16, i64 68}
!8 = !{!"_ZTSN4ardb22ChannelUpstreamHandlerINS_6BufferEEE", !9, i64 0}
!9 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_6BufferEEE", !10, i64 0}
!10 = !{!"_ZTSN4ardb14ChannelHandlerE"}
!11 = !{!"_ZTSN4ardb8RunnableE"}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"bool", !13, i64 0}
!16 = !{!"int", !13, i64 0}
!17 = !{!"_ZTSN4ardb22ChannelUpstreamHandlerINS_5codec10RedisReplyEEE", !18, i64 0}
!18 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_5codec10RedisReplyEEE", !10, i64 0}
!19 = !{!"long", !13, i64 0}
!20 = !{!"_ZTSSt6vectorIPN4ardb5codec10RedisReplyESaIS3_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIPN4ardb5codec10RedisReplyESaIS3_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIPN4ardb5codec10RedisReplyESaIS3_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIPN4ardb5codec10RedisReplyESaIS3_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!24 = !{!"_ZTSN4ardb5codec17RedisReplyDecoderE", !25, i64 0}
!25 = !{!"_ZTSN4ardb5codec17StackFrameDecoderINS0_10RedisReplyEEE", !8, i64 0, !26, i64 8}
!26 = !{!"_ZTSN4ardb6BufferE", !12, i64 0, !19, i64 8, !19, i64 16, !19, i64 24, !15, i64 32}
!27 = !{!"_ZTSN4ardb5codec19RedisCommandEncoderE", !28, i64 0}
!28 = !{!"_ZTSN4ardb24ChannelDownstreamHandlerINS_5codec17RedisCommandFrameEEE", !29, i64 0}
!29 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_5codec17RedisCommandFrameEEE", !10, i64 0}
!30 = !{!"_ZTSN4ardb5codec10RedisReplyE", !16, i64 8, !31, i64 16, !19, i64 48, !12, i64 56, !12, i64 64}
!31 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !32, i64 0, !19, i64 8, !13, i64 16}
!32 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!33 = !{!12, !12, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


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