; LLVM IR from yinqiwen/ardb :: src/common/channel/codec (delimiter_frame_decoder)

; 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.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.ardb::APIException" = type <{ %"class.ardb::Exception", i32, [4 x i8] }>
%"class.ardb::Exception" = type { %"class.std::exception", %"class.std::__cxx11::basic_string" }
%"class.std::exception" = type { 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] }
%"class.std::allocator.0" = type { i8 }
%"class.ardb::codec::DelimiterBasedFrameDecoder" = type <{ %"class.ardb::codec::StackFrameDecoder", %"class.std::vector", i32, i8, i8, [2 x i8] }>
%"class.ardb::codec::StackFrameDecoder" = type { %"class.ardb::ChannelUpstreamHandler", %"class.ardb::Buffer" }
%"class.ardb::ChannelUpstreamHandler" = type { %"class.ardb::AbstractChannelHandler" }
%"class.ardb::AbstractChannelHandler" = type { %"class.ardb::ChannelHandler" }
%"class.ardb::ChannelHandler" = type { ptr }
%"class.ardb::Buffer" = type <{ ptr, i64, i64, i64, i8, [7 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.9 = external hidden unnamed_addr constant [28 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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #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
define dso_local noundef zeroext i1 @_ZN4ardb5codec26DelimiterBasedFrameDecoder6DecodeERNS_21ChannelHandlerContextEPNS_7ChannelERNS_6BufferES7_(ptr noundef nonnull align 8 dereferenceable(78) %0, ptr noundef nonnull align 8 dereferenceable(66) %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(33) %3, ptr noundef nonnull align 8 dereferenceable(33) %4) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  %20 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %21 = alloca %"class.ardb::APIException", align 8
  %22 = alloca %"class.std::__cxx11::basic_string", align 8
  %23 = alloca %"class.std::allocator.0", align 1
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca %"class.ardb::APIException", align 8
  %28 = alloca %"class.std::__cxx11::basic_string", align 8
  %29 = alloca %"class.std::allocator.0", align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %31 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 1
  %32 = call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %31) #6
  %33 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %32, ptr %33, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 -1, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %65, %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %35 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 1
  %36 = call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %35) #6
  %37 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %36, ptr %37, align 8
  %38 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br i1 %38, label %39, label %68

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %40 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %41 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %40) #6
  store ptr %41, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = call noundef i64 @_ZNK4ardb6Buffer12GetReadIndexEv(ptr noundef nonnull align 8 dereferenceable(33) %42)
  store i64 %43, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = load ptr, ptr %17, align 8, !tbaa !5
  %46 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %47 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %46) #6
  %48 = call noundef i32 @_ZN4ardb6Buffer7IndexOfEPKvm(ptr noundef nonnull align 8 dereferenceable(33) %44, ptr noundef %45, i64 noundef %47)
  store i32 %48, ptr %19, align 4, !tbaa !9
  %49 = load i32, ptr %19, align 4, !tbaa !9
  %50 = icmp sge i32 %49, 0
  br i1 %50, label %51, label %65

51:                                               ; preds = %39
  %52 = load i32, ptr %19, align 4, !tbaa !9
  %53 = load i32, ptr %14, align 4, !tbaa !9
  %54 = icmp ult i32 %52, %53
  br i1 %54, label %55, label %65

55:                                               ; preds = %51
  %56 = load i32, ptr %19, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = load i64, ptr %18, align 8, !tbaa !11
  %59 = sub i64 %57, %58
  %60 = trunc i64 %59 to i32
  store i32 %60, ptr %14, align 4, !tbaa !9
  %61 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %61, ptr %12, align 8, !tbaa !5
  %62 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %63 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %62) #6
  %64 = trunc i64 %63 to i32
  store i32 %64, ptr %15, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %55, %51, %39
  %66 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %13, i32 noundef 0) #6
  %67 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %20, i32 0, i32 0
  store ptr %66, ptr %67, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %34, !llvm.loop !13

68:                                               ; preds = %34
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %167

71:                                               ; preds = %68
  %72 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 4
  %73 = load i8, ptr %72, align 1, !tbaa !15, !range !27, !noundef !28
  %74 = trunc i8 %73 to i1
  br i1 %74, label %75, label %101

75:                                               ; preds = %71
  %76 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 4
  store i8 0, ptr %76, align 1, !tbaa !15
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = load i32, ptr %14, align 4, !tbaa !9
  %79 = load i32, ptr %15, align 4, !tbaa !9
  %80 = add i32 %78, %79
  %81 = zext i32 %80 to i64
  call void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33) %77, i64 noundef %81)
  call void @llvm.lifetime.start.p0(i64 48, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %22) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %23) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %22, ptr noundef @.str.9, ptr noundef nonnull align 1 dereferenceable(1) %23)
          to label %82 unwind label %87

82:                                               ; preds = %75
  invoke void @_ZN4ardb12APIExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(44) %21, ptr noundef nonnull align 8 dereferenceable(32) %22)
          to label %83 unwind label %91

83:                                               ; preds = %82
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %23) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #6
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = invoke noundef zeroext i1 @_ZN4ardb21fire_exception_caughtEPNS_7ChannelERKNS_12APIExceptionE(ptr noundef %84, ptr noundef nonnull align 8 dereferenceable(44) %21)
          to label %86 unwind label %96

86:                                               ; preds = %83
  store i1 false, ptr %6, align 1
  store i32 1, ptr %26, align 4
  call void @_ZN4ardb9ExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(44) %21) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %21) #6
  br label %185

87:                                               ; preds = %75
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %24, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %25, align 4
  br label %95

91:                                               ; preds = %82
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %24, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %25, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #6
  br label %95

95:                                               ; preds = %91, %87
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %23) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #6
  br label %100

96:                                               ; preds = %83
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %24, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %25, align 4
  call void @_ZN4ardb9ExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(44) %21) #6
  br label %100

100:                                              ; preds = %96, %95
  call void @llvm.lifetime.end.p0(i64 48, ptr %21) #6
  br label %187

101:                                              ; preds = %71
  %102 = load i32, ptr %14, align 4, !tbaa !9
  %103 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 2
  %104 = load i32, ptr %103, align 8, !tbaa !29
  %105 = icmp ugt i32 %102, %104
  br i1 %105, label %106, label %131

106:                                              ; preds = %101
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load i32, ptr %14, align 4, !tbaa !9
  %109 = load i32, ptr %15, align 4, !tbaa !9
  %110 = add i32 %108, %109
  %111 = zext i32 %110 to i64
  call void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33) %107, i64 noundef %111)
  call void @llvm.lifetime.start.p0(i64 48, ptr %27) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %28) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %29) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %28, ptr noundef @.str.9, ptr noundef nonnull align 1 dereferenceable(1) %29)
          to label %112 unwind label %117

112:                                              ; preds = %106
  invoke void @_ZN4ardb12APIExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(44) %27, ptr noundef nonnull align 8 dereferenceable(32) %28)
          to label %113 unwind label %121

113:                                              ; preds = %112
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %28) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %29) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %28) #6
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = invoke noundef zeroext i1 @_ZN4ardb21fire_exception_caughtEPNS_7ChannelERKNS_12APIExceptionE(ptr noundef %114, ptr noundef nonnull align 8 dereferenceable(44) %27)
          to label %116 unwind label %126

116:                                              ; preds = %113
  store i1 false, ptr %6, align 1
  store i32 1, ptr %26, align 4
  call void @_ZN4ardb9ExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(44) %27) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %27) #6
  br label %185

117:                                              ; preds = %106
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %24, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %25, align 4
  br label %125

121:                                              ; preds = %112
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %24, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %25, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %28) #6
  br label %125

125:                                              ; preds = %121, %117
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %29) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %28) #6
  br label %130

126:                                              ; preds = %113
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %24, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %25, align 4
  call void @_ZN4ardb9ExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(44) %27) #6
  br label %130

130:                                              ; preds = %126, %125
  call void @llvm.lifetime.end.p0(i64 48, ptr %27) #6
  br label %187

131:                                              ; preds = %101
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 3
  %134 = load i8, ptr %133, align 4, !tbaa !30, !range !27, !noundef !28
  %135 = trunc i8 %134 to i1
  br i1 %135, label %136, label %138

136:                                              ; preds = %131
  %137 = load i32, ptr %14, align 4, !tbaa !9
  br label %142

138:                                              ; preds = %131
  %139 = load i32, ptr %14, align 4, !tbaa !9
  %140 = load i32, ptr %15, align 4, !tbaa !9
  %141 = add i32 %139, %140
  br label %142

142:                                              ; preds = %138, %136
  %143 = phi i32 [ %137, %136 ], [ %141, %138 ]
  %144 = zext i32 %143 to i64
  %145 = call noundef zeroext i1 @_ZN4ardb6Buffer19EnsureWritableBytesEmb(ptr noundef nonnull align 8 dereferenceable(33) %132, i64 noundef %144, i1 noundef zeroext false)
  %146 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 3
  %147 = load i8, ptr %146, align 4, !tbaa !30, !range !27, !noundef !28
  %148 = trunc i8 %147 to i1
  br i1 %148, label %149, label %158

149:                                              ; preds = %142
  %150 = load ptr, ptr %11, align 8, !tbaa !5
  %151 = load ptr, ptr %10, align 8, !tbaa !5
  %152 = load i32, ptr %14, align 4, !tbaa !9
  %153 = zext i32 %152 to i64
  %154 = call noundef i32 @_ZN4ardb6Buffer5WriteEPS0_m(ptr noundef nonnull align 8 dereferenceable(33) %150, ptr noundef %151, i64 noundef %153)
  %155 = load ptr, ptr %10, align 8, !tbaa !5
  %156 = load i32, ptr %15, align 4, !tbaa !9
  %157 = zext i32 %156 to i64
  call void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33) %155, i64 noundef %157)
  br label %166

158:                                              ; preds = %142
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = load ptr, ptr %10, align 8, !tbaa !5
  %161 = load i32, ptr %14, align 4, !tbaa !9
  %162 = load i32, ptr %15, align 4, !tbaa !9
  %163 = add i32 %161, %162
  %164 = zext i32 %163 to i64
  %165 = call noundef i32 @_ZN4ardb6Buffer5WriteEPS0_m(ptr noundef nonnull align 8 dereferenceable(33) %159, ptr noundef %160, i64 noundef %164)
  br label %166

166:                                              ; preds = %158, %149
  store i1 true, ptr %6, align 1
  store i32 1, ptr %26, align 4
  br label %185

167:                                              ; preds = %68
  %168 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 4
  %169 = load i8, ptr %168, align 1, !tbaa !15, !range !27, !noundef !28
  %170 = trunc i8 %169 to i1
  br i1 %170, label %182, label %171

171:                                              ; preds = %167
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  %173 = call noundef i64 @_ZNK4ardb6Buffer13ReadableBytesEv(ptr noundef nonnull align 8 dereferenceable(33) %172)
  %174 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 2
  %175 = load i32, ptr %174, align 8, !tbaa !29
  %176 = zext i32 %175 to i64
  %177 = icmp ugt i64 %173, %176
  br i1 %177, label %178, label %181

178:                                              ; preds = %171
  %179 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN4ardb6Buffer5ClearEv(ptr noundef nonnull align 8 dereferenceable(33) %179)
  %180 = getelementptr inbounds %"class.ardb::codec::DelimiterBasedFrameDecoder", ptr %30, i32 0, i32 4
  store i8 1, ptr %180, align 1, !tbaa !15
  br label %181

181:                                              ; preds = %178, %171
  br label %184

182:                                              ; preds = %167
  %183 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN4ardb6Buffer5ClearEv(ptr noundef nonnull align 8 dereferenceable(33) %183)
  br label %184

184:                                              ; preds = %182, %181
  store i1 false, ptr %6, align 1
  store i32 1, ptr %26, align 4
  br label %185

185:                                              ; preds = %184, %166, %116, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %186 = load i1, ptr %6, align 1
  ret i1 %186

187:                                              ; preds = %130, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %188

188:                                              ; preds = %187
  %189 = load ptr, ptr %24, align 8
  %190 = load i32, ptr %25, align 4
  %191 = insertvalue { ptr, i32 } poison, ptr %189, 0
  %192 = insertvalue { ptr, i32 } %191, i32 %190, 1
  resume { ptr, i32 } %192
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4ardb6Buffer12GetReadIndexEv(ptr noundef nonnull align 8 dereferenceable(33)) #3 align 2

declare noundef i32 @_ZN4ardb6Buffer7IndexOfEPKvm(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, i64 noundef) #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) #5 align 2

declare void @_ZN4ardb12APIExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(44), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4

declare noundef zeroext i1 @_ZN4ardb21fire_exception_caughtEPNS_7ChannelERKNS_12APIExceptionE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(44)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4ardb6Buffer19EnsureWritableBytesEmb(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef, i1 noundef zeroext) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN4ardb6Buffer5WriteEPS0_m(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, i64 noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK4ardb6Buffer13ReadableBytesEv(ptr noundef nonnull align 8 dereferenceable(33)) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4ardb6Buffer5ClearEv(ptr noundef nonnull align 8 dereferenceable(33)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) 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 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 = { "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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !22, i64 77}
!16 = !{!"_ZTSN4ardb5codec26DelimiterBasedFrameDecoderE", !17, i64 0, !23, i64 48, !10, i64 72, !22, i64 76, !22, i64 77}
!17 = !{!"_ZTSN4ardb5codec17StackFrameDecoderINS_6BufferEEE", !18, i64 0, !21, i64 8}
!18 = !{!"_ZTSN4ardb22ChannelUpstreamHandlerINS_6BufferEEE", !19, i64 0}
!19 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_6BufferEEE", !20, i64 0}
!20 = !{!"_ZTSN4ardb14ChannelHandlerE"}
!21 = !{!"_ZTSN4ardb6BufferE", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !22, i64 32}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!16, !10, i64 72}
!30 = !{!16, !22, i64 76}


; 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.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.ardb::APIException" = type <{ %"class.ardb::Exception", i32, [4 x i8] }>
%"class.ardb::Exception" = type { %"class.std::exception", %"class.std::__cxx11::basic_string" }
%"class.std::exception" = type { 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] }
%"class.std::allocator.0" = type { i8 }

@.str.9 = external hidden unnamed_addr constant [28 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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) 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
define dso_local noundef zeroext i1 @_ZN4ardb5codec26DelimiterBasedFrameDecoder6DecodeERNS_21ChannelHandlerContextEPNS_7ChannelERNS_6BufferES7_(ptr noundef nonnull align 8 dereferenceable(78) %0, ptr nocapture noundef nonnull readnone align 8 dereferenceable(66) %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(33) %3, ptr noundef nonnull align 8 dereferenceable(33) %4) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.ardb::APIException", align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.std::allocator.0", align 1
  %11 = alloca %"class.ardb::APIException", align 8
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::allocator.0", align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %14 = getelementptr inbounds i8, ptr %0, i64 48
  %15 = tail call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  store ptr %15, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %16 = tail call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  store ptr %16, ptr %7, align 8
  %17 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br i1 %17, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %5, %32
  %.04461 = phi ptr [ %.145, %32 ], [ null, %5 ]
  %.04660 = phi i32 [ %.147, %32 ], [ -1, %5 ]
  %.04859 = phi i32 [ %.149, %32 ], [ 0, %5 ]
  %18 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %19 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %18) #6
  %20 = call noundef i64 @_ZNK4ardb6Buffer12GetReadIndexEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  %21 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %22 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %21) #6
  %23 = call noundef i32 @_ZN4ardb6Buffer7IndexOfEPKvm(ptr noundef nonnull align 8 dereferenceable(33) %3, ptr noundef %19, i64 noundef %22)
  %24 = icmp sgt i32 %23, -1
  %25 = icmp ult i32 %23, %.04660
  %or.cond = select i1 %24, i1 %25, i1 false
  br i1 %or.cond, label %26, label %32

26:                                               ; preds = %.lr.ph
  %27 = trunc i64 %20 to i32
  %28 = sub i32 %23, %27
  %29 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %30 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %29) #6
  %31 = trunc i64 %30 to i32
  br label %32

32:                                               ; preds = %26, %.lr.ph
  %.149 = phi i32 [ %31, %26 ], [ %.04859, %.lr.ph ]
  %.147 = phi i32 [ %28, %26 ], [ %.04660, %.lr.ph ]
  %.145 = phi ptr [ %19, %26 ], [ %.04461, %.lr.ph ]
  %33 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %34 = call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  store ptr %34, ptr %7, align 8
  %35 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %32
  %36 = icmp eq ptr %.145, null
  br i1 %36, label %._crit_edge.thread, label %37

37:                                               ; preds = %._crit_edge
  %38 = getelementptr inbounds i8, ptr %0, i64 77
  %39 = load i8, ptr %38, align 1, !tbaa !7, !range !24, !noundef !25
  %40 = trunc nuw i8 %39 to i1
  br i1 %40, label %41, label %56

41:                                               ; preds = %37
  store i8 0, ptr %38, align 1, !tbaa !7
  %42 = add i32 %.147, %.149
  %43 = zext i32 %42 to i64
  call void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33) %3, i64 noundef %43)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull @.str.9, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %44 unwind label %48

44:                                               ; preds = %41
  invoke void @_ZN4ardb12APIExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(44) %8, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %45 unwind label %50

45:                                               ; preds = %44
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  %46 = invoke noundef zeroext i1 @_ZN4ardb21fire_exception_caughtEPNS_7ChannelERKNS_12APIExceptionE(ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(44) %8)
          to label %47 unwind label %53

47:                                               ; preds = %45
  call void @_ZN4ardb9ExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(44) %8) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %8) #6
  br label %103

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

50:                                               ; preds = %44
  %51 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  br label %52

52:                                               ; preds = %50, %48
  %.pn54 = phi { ptr, i32 } [ %51, %50 ], [ %49, %48 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  br label %55

53:                                               ; preds = %45
  %54 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4ardb9ExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(44) %8) #6
  br label %55

55:                                               ; preds = %53, %52
  %.pn56 = phi { ptr, i32 } [ %54, %53 ], [ %.pn54, %52 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %8) #6
  br label %104

56:                                               ; preds = %37
  %57 = getelementptr inbounds i8, ptr %0, i64 72
  %58 = load i32, ptr %57, align 8, !tbaa !26
  %59 = icmp ugt i32 %.147, %58
  br i1 %59, label %60, label %75

60:                                               ; preds = %56
  %61 = add i32 %.147, %.149
  %62 = zext i32 %61 to i64
  call void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33) %3, i64 noundef %62)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %13) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull @.str.9, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %63 unwind label %67

63:                                               ; preds = %60
  invoke void @_ZN4ardb12APIExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(44) %11, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %64 unwind label %69

64:                                               ; preds = %63
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #6
  %65 = invoke noundef zeroext i1 @_ZN4ardb21fire_exception_caughtEPNS_7ChannelERKNS_12APIExceptionE(ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(44) %11)
          to label %66 unwind label %72

66:                                               ; preds = %64
  call void @_ZN4ardb9ExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(44) %11) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %11) #6
  br label %103

67:                                               ; preds = %60
  %68 = landingpad { ptr, i32 }
          cleanup
  br label %71

69:                                               ; preds = %63
  %70 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  br label %71

71:                                               ; preds = %69, %67
  %.pn = phi { ptr, i32 } [ %70, %69 ], [ %68, %67 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #6
  br label %74

72:                                               ; preds = %64
  %73 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4ardb9ExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(44) %11) #6
  br label %74

74:                                               ; preds = %72, %71
  %.pn52 = phi { ptr, i32 } [ %73, %72 ], [ %.pn, %71 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %11) #6
  br label %104

75:                                               ; preds = %56
  %76 = getelementptr inbounds i8, ptr %0, i64 76
  %77 = load i8, ptr %76, align 4, !tbaa !27, !range !24, !noundef !25
  %78 = trunc nuw i8 %77 to i1
  %79 = add i32 %.147, %.149
  %80 = select i1 %78, i32 %.147, i32 %79
  %81 = zext i32 %80 to i64
  %82 = call noundef zeroext i1 @_ZN4ardb6Buffer19EnsureWritableBytesEmb(ptr noundef nonnull align 8 dereferenceable(33) %4, i64 noundef %81, i1 noundef zeroext false)
  %83 = load i8, ptr %76, align 4, !tbaa !27, !range !24, !noundef !25
  %84 = trunc nuw i8 %83 to i1
  br i1 %84, label %85, label %89

85:                                               ; preds = %75
  %86 = zext i32 %.147 to i64
  %87 = call noundef i32 @_ZN4ardb6Buffer5WriteEPS0_m(ptr noundef nonnull align 8 dereferenceable(33) %4, ptr noundef nonnull %3, i64 noundef %86)
  %88 = zext i32 %.149 to i64
  call void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33) %3, i64 noundef %88)
  br label %103

89:                                               ; preds = %75
  %90 = zext i32 %79 to i64
  %91 = call noundef i32 @_ZN4ardb6Buffer5WriteEPS0_m(ptr noundef nonnull align 8 dereferenceable(33) %4, ptr noundef nonnull %3, i64 noundef %90)
  br label %103

._crit_edge.thread:                               ; preds = %5, %._crit_edge
  %92 = getelementptr inbounds i8, ptr %0, i64 77
  %93 = load i8, ptr %92, align 1, !tbaa !7, !range !24, !noundef !25
  %94 = trunc nuw i8 %93 to i1
  br i1 %94, label %102, label %95

95:                                               ; preds = %._crit_edge.thread
  %96 = call noundef i64 @_ZNK4ardb6Buffer13ReadableBytesEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  %97 = getelementptr inbounds i8, ptr %0, i64 72
  %98 = load i32, ptr %97, align 8, !tbaa !26
  %99 = zext i32 %98 to i64
  %100 = icmp ugt i64 %96, %99
  br i1 %100, label %101, label %103

101:                                              ; preds = %95
  call void @_ZN4ardb6Buffer5ClearEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  store i8 1, ptr %92, align 1, !tbaa !7
  br label %103

102:                                              ; preds = %._crit_edge.thread
  call void @_ZN4ardb6Buffer5ClearEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  br label %103

103:                                              ; preds = %102, %101, %95, %85, %89, %66, %47
  %.043 = phi i1 [ false, %47 ], [ false, %66 ], [ true, %89 ], [ true, %85 ], [ false, %95 ], [ false, %101 ], [ false, %102 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  ret i1 %.043

104:                                              ; preds = %74, %55
  %.pn56.pn = phi { ptr, i32 } [ %.pn56, %55 ], [ %.pn52, %74 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  resume { ptr, i32 } %.pn56.pn
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4ardb6Buffer12GetReadIndexEv(ptr noundef nonnull align 8 dereferenceable(33)) local_unnamed_addr #3 align 2

declare noundef i32 @_ZN4ardb6Buffer7IndexOfEPKvm(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, i64 noundef) local_unnamed_addr #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) local_unnamed_addr #5 align 2

declare void @_ZN4ardb12APIExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(44), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4

declare noundef zeroext i1 @_ZN4ardb21fire_exception_caughtEPNS_7ChannelERKNS_12APIExceptionE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4ardb6Buffer19EnsureWritableBytesEmb(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef, i1 noundef zeroext) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN4ardb6Buffer5WriteEPS0_m(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, i64 noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK4ardb6Buffer13ReadableBytesEv(ptr noundef nonnull align 8 dereferenceable(33)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4ardb6Buffer5ClearEv(ptr noundef nonnull align 8 dereferenceable(33)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) 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 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 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !18, i64 77}
!8 = !{!"_ZTSN4ardb5codec26DelimiterBasedFrameDecoderE", !9, i64 0, !19, i64 48, !23, i64 72, !18, i64 76, !18, i64 77}
!9 = !{!"_ZTSN4ardb5codec17StackFrameDecoderINS_6BufferEEE", !10, i64 0, !13, i64 8}
!10 = !{!"_ZTSN4ardb22ChannelUpstreamHandlerINS_6BufferEEE", !11, i64 0}
!11 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_6BufferEEE", !12, i64 0}
!12 = !{!"_ZTSN4ardb14ChannelHandlerE"}
!13 = !{!"_ZTSN4ardb6BufferE", !14, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !18, i64 32}
!14 = !{!"any pointer", !15, i64 0}
!15 = !{!"omnipotent char", !16, i64 0}
!16 = !{!"Simple C++ TBAA"}
!17 = !{!"long", !15, i64 0}
!18 = !{!"bool", !15, i64 0}
!19 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!23 = !{!"int", !15, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!8, !23, i64 72}
!27 = !{!8, !18, i64 76}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass