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

; 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::codec::RedisDumpFileChunkDecoder" = type { %"class.ardb::codec::StackFrameDecoder.3", i64, i64 }
%"class.ardb::codec::StackFrameDecoder.3" = 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] }>
%"struct.ardb::codec::RedisDumpFileChunk" = type { i64, i32, %"class.std::__cxx11::basic_string" }
%"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] }

@.str.14 = external hidden unnamed_addr constant [94 x i8], align 1
@_ZL5kCRLF = external hidden global ptr, align 8
@__FUNCTION__._ZN4ardb5codec25RedisDumpFileChunkDecoder6DecodeERNS_21ChannelHandlerContextEPNS_7ChannelERNS_6BufferERNS0_18RedisDumpFileChunkE = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [52 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef ptr @_ZN4ardb10ArdbLogger13GetLogCheckerEv() #1

declare noundef ptr @_ZN4ardb10ArdbLogger13GetLogHandlerEv() #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4ardb5codec25RedisDumpFileChunkDecoder6DecodeERNS_21ChannelHandlerContextEPNS_7ChannelERNS_6BufferERNS0_18RedisDumpFileChunkE(ptr noundef nonnull align 8 dereferenceable(64) %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(48) %4) unnamed_addr #3 align 2 {
  %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 i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i8, align 1
  %15 = alloca i64, align 8
  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
  %16 = load ptr, ptr %7, align 8
  %17 = getelementptr inbounds %"class.ardb::codec::RedisDumpFileChunkDecoder", ptr %16, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %20, label %99

20:                                               ; preds = %5
  br label %21

21:                                               ; preds = %33, %20
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = call noundef zeroext i1 @_ZNK4ardb6Buffer8ReadableEv(ptr noundef nonnull align 8 dereferenceable(33) %22)
  br i1 %23, label %24, label %31

24:                                               ; preds = %21
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = call noundef ptr @_ZNK4ardb6Buffer16GetRawReadBufferEv(ptr noundef nonnull align 8 dereferenceable(33) %25)
  %27 = getelementptr inbounds i8, ptr %26, i64 0
  %28 = load i8, ptr %27, align 1, !tbaa !18
  %29 = sext i8 %28 to i32
  %30 = icmp eq i32 %29, 10
  br label %31

31:                                               ; preds = %24, %21
  %32 = phi i1 [ false, %21 ], [ %30, %24 ]
  br i1 %32, label %33, label %35

33:                                               ; preds = %31
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN4ardb6Buffer16AdvanceReadIndexEi(ptr noundef nonnull align 8 dereferenceable(33) %34, i32 noundef 1)
  br label %21, !llvm.loop !19

35:                                               ; preds = %31
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = call noundef zeroext i1 @_ZNK4ardb6Buffer8ReadableEv(ptr noundef nonnull align 8 dereferenceable(33) %36)
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  store i1 false, ptr %6, align 1
  br label %141

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 -1, ptr %12, align 4, !tbaa !21
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = load ptr, ptr @_ZL5kCRLF, align 8, !tbaa !5
  %42 = call noundef i32 @_ZN4ardb6Buffer7IndexOfEPKvm(ptr noundef nonnull align 8 dereferenceable(33) %40, ptr noundef %41, i64 noundef 2)
  store i32 %42, ptr %12, align 4, !tbaa !21
  %43 = load i32, ptr %12, align 4, !tbaa !21
  %44 = icmp eq i32 -1, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %39
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %96

46:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #5
  store i8 0, ptr %14, align 1, !tbaa !18
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = call noundef zeroext i1 @_ZN4ardb6Buffer8ReadByteERc(ptr noundef nonnull align 8 dereferenceable(33) %47, ptr noundef nonnull align 1 dereferenceable(1) %14)
  %49 = load i8, ptr %14, align 1, !tbaa !18
  %50 = sext i8 %49 to i32
  %51 = icmp ne i32 %50, 36
  br i1 %51, label %52, label %63

52:                                               ; preds = %46
  br label %53

53:                                               ; preds = %52
  %54 = call noundef ptr @_ZN4ardb10ArdbLogger13GetLogCheckerEv()
  %55 = call noundef zeroext i1 %54(i32 noundef 2)
  br i1 %55, label %56, label %60

56:                                               ; preds = %53
  %57 = call noundef ptr @_ZN4ardb10ArdbLogger13GetLogHandlerEv()
  %58 = load i8, ptr %14, align 1, !tbaa !18
  %59 = sext i8 %58 to i32
  call void (i32, ptr, ptr, i32, ptr, ...) %57(i32 noundef 2, ptr noundef @.str.14, ptr noundef @__FUNCTION__._ZN4ardb5codec25RedisDumpFileChunkDecoder6DecodeERNS_21ChannelHandlerContextEPNS_7ChannelERNS_6BufferERNS0_18RedisDumpFileChunkE, i32 noundef 288, ptr noundef @.str.16, i32 noundef %59)
  br label %60

60:                                               ; preds = %56, %53
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62, %46
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = call noundef ptr @_ZNK4ardb6Buffer16GetRawReadBufferEv(ptr noundef nonnull align 8 dereferenceable(33) %64)
  %66 = load i32, ptr %12, align 4, !tbaa !21
  %67 = sext i32 %66 to i64
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = call noundef i64 @_ZNK4ardb6Buffer12GetReadIndexEv(ptr noundef nonnull align 8 dereferenceable(33) %68)
  %70 = sub i64 %67, %69
  %71 = trunc i64 %70 to i32
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %72, i32 0, i32 0
  %74 = call noundef zeroext i1 @_ZN4ardb11raw_toint64EPKvjRl(ptr noundef %65, i32 noundef %71, ptr noundef nonnull align 8 dereferenceable(8) %73)
  br i1 %74, label %76, label %75

75:                                               ; preds = %63
  store i1 true, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %95

76:                                               ; preds = %63
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = load i32, ptr %12, align 4, !tbaa !21
  %79 = add nsw i32 %78, 2
  %80 = sext i32 %79 to i64
  call void @_ZN4ardb6Buffer12SetReadIndexEm(ptr noundef nonnull align 8 dereferenceable(33) %77, i64 noundef %80)
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %81, i32 0, i32 0
  %83 = load i64, ptr %82, align 8, !tbaa !23
  %84 = getelementptr inbounds %"class.ardb::codec::RedisDumpFileChunkDecoder", ptr %16, i32 0, i32 2
  store i64 %83, ptr %84, align 8, !tbaa !27
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %85, i32 0, i32 0
  %87 = load i64, ptr %86, align 8, !tbaa !23
  %88 = getelementptr inbounds %"class.ardb::codec::RedisDumpFileChunkDecoder", ptr %16, i32 0, i32 1
  store i64 %87, ptr %88, align 8, !tbaa !9
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 8, !tbaa !28
  %92 = or i32 %91, 1
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %93, i32 0, i32 1
  store i32 %92, ptr %94, align 8, !tbaa !28
  store i32 0, ptr %13, align 4
  br label %95

95:                                               ; preds = %76, %75
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  br label %96

96:                                               ; preds = %95, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %97 = load i32, ptr %13, align 4
  switch i32 %97, label %143 [
    i32 0, label %98
    i32 1, label %141
  ]

98:                                               ; preds = %96
  br label %99

99:                                               ; preds = %98, %5
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = call noundef zeroext i1 @_ZNK4ardb6Buffer8ReadableEv(ptr noundef nonnull align 8 dereferenceable(33) %100)
  br i1 %101, label %102, label %140

102:                                              ; preds = %99
  %103 = getelementptr inbounds %"class.ardb::codec::RedisDumpFileChunkDecoder", ptr %16, i32 0, i32 2
  %104 = load i64, ptr %103, align 8, !tbaa !27
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %105, i32 0, i32 0
  store i64 %104, ptr %106, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %107 = getelementptr inbounds %"class.ardb::codec::RedisDumpFileChunkDecoder", ptr %16, i32 0, i32 1
  %108 = load i64, ptr %107, align 8, !tbaa !9
  store i64 %108, ptr %15, align 8, !tbaa !29
  %109 = load i64, ptr %15, align 8, !tbaa !29
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = call noundef i64 @_ZNK4ardb6Buffer13ReadableBytesEv(ptr noundef nonnull align 8 dereferenceable(33) %110)
  %112 = icmp ugt i64 %109, %111
  br i1 %112, label %113, label %116

113:                                              ; preds = %102
  %114 = load ptr, ptr %10, align 8, !tbaa !5
  %115 = call noundef i64 @_ZNK4ardb6Buffer13ReadableBytesEv(ptr noundef nonnull align 8 dereferenceable(33) %114)
  store i64 %115, ptr %15, align 8, !tbaa !29
  br label %116

116:                                              ; preds = %113, %102
  %117 = load ptr, ptr %11, align 8, !tbaa !5
  %118 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %117, i32 0, i32 2
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = call noundef ptr @_ZNK4ardb6Buffer16GetRawReadBufferEv(ptr noundef nonnull align 8 dereferenceable(33) %119)
  %121 = load i64, ptr %15, align 8, !tbaa !29
  %122 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %118, ptr noundef %120, i64 noundef %121)
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = load i64, ptr %15, align 8, !tbaa !29
  call void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33) %123, i64 noundef %124)
  %125 = load i64, ptr %15, align 8, !tbaa !29
  %126 = getelementptr inbounds %"class.ardb::codec::RedisDumpFileChunkDecoder", ptr %16, i32 0, i32 1
  %127 = load i64, ptr %126, align 8, !tbaa !9
  %128 = sub nsw i64 %127, %125
  store i64 %128, ptr %126, align 8, !tbaa !9
  %129 = getelementptr inbounds %"class.ardb::codec::RedisDumpFileChunkDecoder", ptr %16, i32 0, i32 1
  %130 = load i64, ptr %129, align 8, !tbaa !9
  %131 = icmp eq i64 %130, 0
  br i1 %131, label %132, label %139

132:                                              ; preds = %116
  %133 = load ptr, ptr %11, align 8, !tbaa !5
  %134 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %133, i32 0, i32 1
  %135 = load i32, ptr %134, align 8, !tbaa !28
  %136 = or i32 %135, 2
  %137 = load ptr, ptr %11, align 8, !tbaa !5
  %138 = getelementptr inbounds %"struct.ardb::codec::RedisDumpFileChunk", ptr %137, i32 0, i32 1
  store i32 %136, ptr %138, align 8, !tbaa !28
  br label %139

139:                                              ; preds = %132, %116
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %140

140:                                              ; preds = %139, %99
  store i1 true, ptr %6, align 1
  br label %141

141:                                              ; preds = %140, %96, %38
  %142 = load i1, ptr %6, align 1
  ret i1 %142

143:                                              ; preds = %96
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4ardb6Buffer8ReadableEv(ptr noundef nonnull align 8 dereferenceable(33)) #2 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef) #3 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { 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, !16, i64 48}
!10 = !{!"_ZTSN4ardb5codec25RedisDumpFileChunkDecoderE", !11, i64 0, !16, i64 48, !16, i64 56}
!11 = !{!"_ZTSN4ardb5codec17StackFrameDecoderINS0_18RedisDumpFileChunkEEE", !12, i64 0, !15, i64 8}
!12 = !{!"_ZTSN4ardb22ChannelUpstreamHandlerINS_6BufferEEE", !13, i64 0}
!13 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_6BufferEEE", !14, i64 0}
!14 = !{!"_ZTSN4ardb14ChannelHandlerE"}
!15 = !{!"_ZTSN4ardb6BufferE", !6, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !17, i64 32}
!16 = !{!"long", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!24, !16, i64 0}
!24 = !{!"_ZTSN4ardb5codec18RedisDumpFileChunkE", !16, i64 0, !22, i64 8, !25, i64 16}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !26, i64 0, !16, i64 8, !7, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!27 = !{!10, !16, i64 56}
!28 = !{!24, !22, i64 8}
!29 = !{!16, !16, i64 0}


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

@.str.14 = external hidden unnamed_addr constant [94 x i8], align 1
@_ZL5kCRLF = external hidden local_unnamed_addr global ptr, align 8
@__FUNCTION__._ZN4ardb5codec25RedisDumpFileChunkDecoder6DecodeERNS_21ChannelHandlerContextEPNS_7ChannelERNS_6BufferERNS0_18RedisDumpFileChunkE = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [52 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef ptr @_ZN4ardb10ArdbLogger13GetLogCheckerEv() local_unnamed_addr #1

declare noundef ptr @_ZN4ardb10ArdbLogger13GetLogHandlerEv() local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4ardb5codec25RedisDumpFileChunkDecoder6DecodeERNS_21ChannelHandlerContextEPNS_7ChannelERNS_6BufferERNS0_18RedisDumpFileChunkE(ptr nocapture noundef nonnull align 8 dereferenceable(64) %0, ptr nocapture noundef nonnull readnone align 8 dereferenceable(66) %1, ptr nocapture noundef readnone %2, ptr noundef nonnull align 8 dereferenceable(33) %3, ptr noundef nonnull align 8 dereferenceable(48) %4) unnamed_addr #3 align 2 {
  %6 = alloca i8, align 1
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = load i64, ptr %7, align 8, !tbaa !5
  %9 = icmp eq i64 %8, 0
  br i1 %9, label %.preheader, label %44

.preheader:                                       ; preds = %5
  %10 = tail call noundef zeroext i1 @_ZNK4ardb6Buffer8ReadableEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  br i1 %10, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %.preheader, %14
  %11 = tail call noundef ptr @_ZNK4ardb6Buffer16GetRawReadBufferEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  %12 = load i8, ptr %11, align 1, !tbaa !17
  %13 = icmp eq i8 %12, 10
  br i1 %13, label %14, label %.critedge

14:                                               ; preds = %.lr.ph
  tail call void @_ZN4ardb6Buffer16AdvanceReadIndexEi(ptr noundef nonnull align 8 dereferenceable(33) %3, i32 noundef 1)
  %15 = tail call noundef zeroext i1 @_ZNK4ardb6Buffer8ReadableEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  br i1 %15, label %.lr.ph, label %.critedge, !llvm.loop !18

.critedge:                                        ; preds = %.lr.ph, %14, %.preheader
  %16 = tail call noundef zeroext i1 @_ZNK4ardb6Buffer8ReadableEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  br i1 %16, label %17, label %.thread

17:                                               ; preds = %.critedge
  %18 = load ptr, ptr @_ZL5kCRLF, align 8, !tbaa !20
  %19 = tail call noundef i32 @_ZN4ardb6Buffer7IndexOfEPKvm(ptr noundef nonnull align 8 dereferenceable(33) %3, ptr noundef %18, i64 noundef 2)
  %.not42 = icmp eq i32 %19, -1
  br i1 %.not42, label %.thread, label %20

20:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #5
  store i8 0, ptr %6, align 1, !tbaa !17
  %21 = call noundef zeroext i1 @_ZN4ardb6Buffer8ReadByteERc(ptr noundef nonnull align 8 dereferenceable(33) %3, ptr noundef nonnull align 1 dereferenceable(1) %6)
  %22 = load i8, ptr %6, align 1, !tbaa !17
  %.not = icmp eq i8 %22, 36
  br i1 %.not, label %30, label %23

23:                                               ; preds = %20
  %24 = call noundef ptr @_ZN4ardb10ArdbLogger13GetLogCheckerEv()
  %25 = call noundef zeroext i1 %24(i32 noundef 2)
  br i1 %25, label %26, label %30

26:                                               ; preds = %23
  %27 = call noundef ptr @_ZN4ardb10ArdbLogger13GetLogHandlerEv()
  %28 = load i8, ptr %6, align 1, !tbaa !17
  %29 = sext i8 %28 to i32
  call void (i32, ptr, ptr, i32, ptr, ...) %27(i32 noundef 2, ptr noundef nonnull @.str.14, ptr noundef nonnull @__FUNCTION__._ZN4ardb5codec25RedisDumpFileChunkDecoder6DecodeERNS_21ChannelHandlerContextEPNS_7ChannelERNS_6BufferERNS0_18RedisDumpFileChunkE, i32 noundef 288, ptr noundef nonnull @.str.16, i32 noundef %29)
  br label %30

30:                                               ; preds = %23, %26, %20
  %31 = call noundef ptr @_ZNK4ardb6Buffer16GetRawReadBufferEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  %32 = call noundef i64 @_ZNK4ardb6Buffer12GetReadIndexEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  %33 = trunc i64 %32 to i32
  %34 = sub i32 %19, %33
  %35 = call noundef zeroext i1 @_ZN4ardb11raw_toint64EPKvjRl(ptr noundef %31, i32 noundef %34, ptr noundef nonnull align 8 dereferenceable(8) %4)
  br i1 %35, label %.thread39, label %43

.thread39:                                        ; preds = %30
  %36 = add nsw i32 %19, 2
  %37 = sext i32 %36 to i64
  call void @_ZN4ardb6Buffer12SetReadIndexEm(ptr noundef nonnull align 8 dereferenceable(33) %3, i64 noundef %37)
  %38 = load i64, ptr %4, align 8, !tbaa !21
  %39 = getelementptr inbounds i8, ptr %0, i64 56
  store i64 %38, ptr %39, align 8, !tbaa !26
  store i64 %38, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %4, i64 8
  %41 = load i32, ptr %40, align 8, !tbaa !27
  %42 = or i32 %41, 1
  store i32 %42, ptr %40, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  br label %44

43:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  br label %.thread

44:                                               ; preds = %.thread39, %5
  %45 = call noundef zeroext i1 @_ZNK4ardb6Buffer8ReadableEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  br i1 %45, label %46, label %.thread

46:                                               ; preds = %44
  %47 = getelementptr inbounds i8, ptr %0, i64 56
  %48 = load i64, ptr %47, align 8, !tbaa !26
  store i64 %48, ptr %4, align 8, !tbaa !21
  %49 = load i64, ptr %7, align 8, !tbaa !5
  %50 = call noundef i64 @_ZNK4ardb6Buffer13ReadableBytesEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  %51 = icmp ugt i64 %49, %50
  br i1 %51, label %52, label %54

52:                                               ; preds = %46
  %53 = call noundef i64 @_ZNK4ardb6Buffer13ReadableBytesEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  br label %54

54:                                               ; preds = %52, %46
  %.0 = phi i64 [ %53, %52 ], [ %49, %46 ]
  %55 = getelementptr inbounds i8, ptr %4, i64 16
  %56 = call noundef ptr @_ZNK4ardb6Buffer16GetRawReadBufferEv(ptr noundef nonnull align 8 dereferenceable(33) %3)
  %57 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %55, ptr noundef %56, i64 noundef %.0)
  call void @_ZN4ardb6Buffer9SkipBytesEm(ptr noundef nonnull align 8 dereferenceable(33) %3, i64 noundef %.0)
  %58 = load i64, ptr %7, align 8, !tbaa !5
  %59 = sub nsw i64 %58, %.0
  store i64 %59, ptr %7, align 8, !tbaa !5
  %60 = icmp eq i64 %58, %.0
  br i1 %60, label %61, label %.thread

61:                                               ; preds = %54
  %62 = getelementptr inbounds i8, ptr %4, i64 8
  %63 = load i32, ptr %62, align 8, !tbaa !27
  %64 = or i32 %63, 2
  store i32 %64, ptr %62, align 8, !tbaa !27
  br label %.thread

.thread:                                          ; preds = %17, %43, %44, %61, %54, %.critedge
  %.2 = phi i1 [ true, %43 ], [ false, %.critedge ], [ true, %54 ], [ true, %61 ], [ true, %44 ], [ false, %17 ]
  ret i1 %.2
}

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef) local_unnamed_addr #3 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { 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, !15, i64 48}
!6 = !{!"_ZTSN4ardb5codec25RedisDumpFileChunkDecoderE", !7, i64 0, !15, i64 48, !15, i64 56}
!7 = !{!"_ZTSN4ardb5codec17StackFrameDecoderINS0_18RedisDumpFileChunkEEE", !8, i64 0, !11, i64 8}
!8 = !{!"_ZTSN4ardb22ChannelUpstreamHandlerINS_6BufferEEE", !9, i64 0}
!9 = !{!"_ZTSN4ardb22AbstractChannelHandlerINS_6BufferEEE", !10, i64 0}
!10 = !{!"_ZTSN4ardb14ChannelHandlerE"}
!11 = !{!"_ZTSN4ardb6BufferE", !12, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !16, i64 32}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"long", !13, i64 0}
!16 = !{!"bool", !13, i64 0}
!17 = !{!13, !13, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!12, !12, i64 0}
!21 = !{!22, !15, i64 0}
!22 = !{!"_ZTSN4ardb5codec18RedisDumpFileChunkE", !15, i64 0, !23, i64 8, !24, i64 16}
!23 = !{!"int", !13, i64 0}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !25, i64 0, !15, i64 8, !13, i64 16}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!26 = !{!6, !15, i64 56}
!27 = !{!22, !23, i64 8}


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