; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/7zip/Compress (PpmdDecoder)

; 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.NCompress::NPpmd::CDecoder" = type { %struct.ICompressCoder, %struct.ICompressSetDecoderProperties2, %struct.ICompressGetInStreamProcessedSize, %struct.ICompressSetInStream, %struct.ICompressSetOutStreamSize, %struct.ISequentialInStream, %class.CMyUnknownImp, ptr, %struct.CPpmd7z_RangeDec, %struct.CByteInBufWrap, %struct.CPpmd7, i8, i8, i32, i64, i64, %class.CMyComPtr }
%struct.ICompressCoder = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%struct.ICompressSetDecoderProperties2 = type { %struct.IUnknown }
%struct.ICompressGetInStreamProcessedSize = type { %struct.IUnknown }
%struct.ICompressSetInStream = type { %struct.IUnknown }
%struct.ICompressSetOutStreamSize = type { %struct.IUnknown }
%struct.ISequentialInStream = type { %struct.IUnknown }
%class.CMyUnknownImp = type { i32 }
%struct.CPpmd7z_RangeDec = type { %struct.IPpmd7_RangeDec, i32, i32, ptr }
%struct.IPpmd7_RangeDec = type { ptr, ptr, ptr }
%struct.CByteInBufWrap = type { %struct.IByteIn, ptr, ptr, ptr, i32, ptr, i64, i8, i32 }
%struct.IByteIn = type { ptr }
%struct.CPpmd7 = type { ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, [38 x i8], [128 x i8], [38 x i32], [256 x i8], [256 x i8], [256 x i8], %struct.CPpmd_See, [25 x [16 x %struct.CPpmd_See]], [128 x [64 x i16]] }
%struct.CPpmd_See = type { i16, i8, i8 }
%class.CMyComPtr = type { ptr }

; 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 uwtable
declare dso_local noundef i32 @_ZN9NCompress5NPpmd8CDecoder8CodeSpecEPhj(ptr noundef nonnull align 8 dereferenceable(19384), ptr noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9NCompress5NPpmd8CDecoder4CodeEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(19384) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) unnamed_addr #1 align 2 {
  %7 = alloca i32, align 4
  %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 ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %22 = load ptr, ptr %8, align 8
  %23 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 7
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = icmp ne ptr %24, null
  br i1 %25, label %34, label %26

26:                                               ; preds = %6
  %27 = call ptr @MyAlloc(i64 noundef 1048576)
  %28 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 7
  store ptr %27, ptr %28, align 8, !tbaa !9
  %29 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 7
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = icmp ne ptr %30, null
  br i1 %31, label %33, label %32

32:                                               ; preds = %26
  store i32 -2147024882, ptr %7, align 4
  br label %119

33:                                               ; preds = %26
  br label %34

34:                                               ; preds = %33, %6
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 9
  %37 = getelementptr inbounds %struct.CByteInBufWrap, ptr %36, i32 0, i32 5
  store ptr %35, ptr %37, align 8, !tbaa !30
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = load ptr, ptr %22, align 8, !tbaa !31
  %40 = getelementptr inbounds ptr, ptr %39, i64 8
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef i32 %41(ptr noundef nonnull align 8 dereferenceable(19384) %22, ptr noundef %38)
  br label %43

43:                                               ; preds = %116, %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %44 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 15
  %45 = load i64, ptr %44, align 8, !tbaa !33
  store i64 %45, ptr %14, align 8, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %46 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 7
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = call noundef i32 @_ZN9NCompress5NPpmd8CDecoder8CodeSpecEPhj(ptr noundef nonnull align 8 dereferenceable(19384) %22, ptr noundef %47, i32 noundef 1048576)
  store i32 %48, ptr %15, align 4, !tbaa !35
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %49 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 15
  %50 = load i64, ptr %49, align 8, !tbaa !33
  %51 = load i64, ptr %14, align 8, !tbaa !34
  %52 = sub i64 %50, %51
  store i64 %52, ptr %16, align 8, !tbaa !36
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 7
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = load i64, ptr %16, align 8, !tbaa !36
  %57 = call noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef %53, ptr noundef %55, i64 noundef %56) #5
  store i32 %57, ptr %17, align 4, !tbaa !35
  %58 = load i32, ptr %17, align 4, !tbaa !35
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %43
  %61 = load i32, ptr %17, align 4, !tbaa !35
  store i32 %61, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %63

62:                                               ; preds = %43
  store i32 0, ptr %18, align 4
  br label %63

63:                                               ; preds = %62, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  %64 = load i32, ptr %18, align 4
  switch i32 %64, label %103 [
    i32 0, label %65
  ]

65:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %66 = load i32, ptr %15, align 4, !tbaa !35
  store i32 %66, ptr %19, align 4, !tbaa !35
  %67 = load i32, ptr %19, align 4, !tbaa !35
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %71

69:                                               ; preds = %65
  %70 = load i32, ptr %19, align 4, !tbaa !35
  store i32 %70, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %72

71:                                               ; preds = %65
  store i32 0, ptr %18, align 4
  br label %72

72:                                               ; preds = %71, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  %73 = load i32, ptr %18, align 4
  switch i32 %73, label %103 [
    i32 0, label %74
  ]

74:                                               ; preds = %72
  %75 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 13
  %76 = load i32, ptr %75, align 4, !tbaa !38
  %77 = icmp eq i32 %76, 2
  br i1 %77, label %78, label %79

78:                                               ; preds = %74
  store i32 2, ptr %18, align 4
  br label %103

79:                                               ; preds = %74
  %80 = load ptr, ptr %13, align 8, !tbaa !5
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %102

82:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %83 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 9
  %84 = call noundef i64 @_ZNK14CByteInBufWrap12GetProcessedEv(ptr noundef nonnull align 8 dereferenceable(64) %83)
  store i64 %84, ptr %20, align 8, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 15
  %87 = load ptr, ptr %85, align 8, !tbaa !31
  %88 = getelementptr inbounds ptr, ptr %87, i64 5
  %89 = load ptr, ptr %88, align 8
  %90 = call noundef i32 %89(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef %20, ptr noundef %86)
  store i32 %90, ptr %21, align 4, !tbaa !35
  %91 = load i32, ptr %21, align 4, !tbaa !35
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %95

93:                                               ; preds = %82
  %94 = load i32, ptr %21, align 4, !tbaa !35
  store i32 %94, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %96

95:                                               ; preds = %82
  store i32 0, ptr %18, align 4
  br label %96

96:                                               ; preds = %95, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  %97 = load i32, ptr %18, align 4
  switch i32 %97, label %99 [
    i32 0, label %98
  ]

98:                                               ; preds = %96
  store i32 0, ptr %18, align 4
  br label %99

99:                                               ; preds = %98, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  %100 = load i32, ptr %18, align 4
  switch i32 %100, label %103 [
    i32 0, label %101
  ]

101:                                              ; preds = %99
  br label %102

102:                                              ; preds = %101, %79
  store i32 0, ptr %18, align 4
  br label %103

103:                                              ; preds = %102, %99, %78, %72, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %104 = load i32, ptr %18, align 4
  switch i32 %104, label %121 [
    i32 0, label %105
    i32 1, label %119
    i32 2, label %118
  ]

105:                                              ; preds = %103
  br label %106

106:                                              ; preds = %105
  %107 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 12
  %108 = load i8, ptr %107, align 1, !tbaa !39, !range !40, !noundef !41
  %109 = trunc i8 %108 to i1
  br i1 %109, label %110, label %116

110:                                              ; preds = %106
  %111 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 15
  %112 = load i64, ptr %111, align 8, !tbaa !33
  %113 = getelementptr inbounds %"class.NCompress::NPpmd::CDecoder", ptr %22, i32 0, i32 14
  %114 = load i64, ptr %113, align 8, !tbaa !42
  %115 = icmp ult i64 %112, %114
  br label %116

116:                                              ; preds = %110, %106
  %117 = phi i1 [ true, %106 ], [ %115, %110 ]
  br i1 %117, label %43, label %118, !llvm.loop !43

118:                                              ; preds = %116, %103
  store i32 0, ptr %7, align 4
  br label %119

119:                                              ; preds = %118, %103, %32
  %120 = load i32, ptr %7, align 4
  ret i32 %120

121:                                              ; preds = %103
  unreachable
}

declare ptr @MyAlloc(i64 noundef) #2

; Function Attrs: nounwind
declare noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef, ptr noundef, i64 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK14CByteInBufWrap12GetProcessedEv(ptr noundef nonnull align 8 dereferenceable(64)) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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, !6, i64 56}
!10 = !{!"_ZTSN9NCompress5NPpmd8CDecoderE", !11, i64 0, !13, i64 8, !14, i64 16, !15, i64 24, !16, i64 32, !17, i64 40, !18, i64 48, !6, i64 56, !20, i64 64, !22, i64 104, !26, i64 168, !7, i64 19352, !25, i64 19353, !19, i64 19356, !24, i64 19360, !24, i64 19368, !29, i64 19376}
!11 = !{!"_ZTS14ICompressCoder", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS30ICompressSetDecoderProperties2", !12, i64 0}
!14 = !{!"_ZTS33ICompressGetInStreamProcessedSize", !12, i64 0}
!15 = !{!"_ZTS20ICompressSetInStream", !12, i64 0}
!16 = !{!"_ZTS25ICompressSetOutStreamSize", !12, i64 0}
!17 = !{!"_ZTS19ISequentialInStream", !12, i64 0}
!18 = !{!"_ZTS13CMyUnknownImp", !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!"_ZTS16CPpmd7z_RangeDec", !21, i64 0, !19, i64 24, !19, i64 28, !6, i64 32}
!21 = !{!"_ZTS15IPpmd7_RangeDec", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTS14CByteInBufWrap", !23, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !19, i64 32, !6, i64 40, !24, i64 48, !25, i64 56, !19, i64 60}
!23 = !{!"_ZTS7IByteIn", !6, i64 0}
!24 = !{!"long long", !7, i64 0}
!25 = !{!"bool", !7, i64 0}
!26 = !{!"_ZTS6CPpmd7", !6, i64 0, !6, i64 8, !6, i64 16, !19, i64 24, !19, i64 28, !19, i64 32, !19, i64 36, !19, i64 40, !19, i64 44, !19, i64 48, !19, i64 52, !19, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !19, i64 104, !7, i64 108, !7, i64 146, !7, i64 276, !7, i64 428, !7, i64 684, !7, i64 940, !27, i64 1196, !7, i64 1200, !7, i64 2800}
!27 = !{!"_ZTS9CPpmd_See", !28, i64 0, !7, i64 2, !7, i64 3}
!28 = !{!"short", !7, i64 0}
!29 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !6, i64 0}
!30 = !{!10, !6, i64 144}
!31 = !{!32, !32, i64 0}
!32 = !{!"vtable pointer", !8, i64 0}
!33 = !{!10, !24, i64 19368}
!34 = !{!24, !24, i64 0}
!35 = !{!19, !19, i64 0}
!36 = !{!37, !37, i64 0}
!37 = !{!"long", !7, i64 0}
!38 = !{!10, !19, i64 19356}
!39 = !{!10, !25, i64 19353}
!40 = !{i8 0, i8 2}
!41 = !{}
!42 = !{!10, !24, i64 19360}
!43 = distinct !{!43, !44}
!44 = !{!"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 uwtable
declare dso_local noundef i32 @_ZN9NCompress5NPpmd8CDecoder8CodeSpecEPhj(ptr noundef nonnull align 8 dereferenceable(19384), ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9NCompress5NPpmd8CDecoder4CodeEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(19384) %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readnone %3, ptr noundef %4, ptr noundef %5) unnamed_addr #1 align 2 {
  %7 = alloca i64, align 8
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %10, label %12

10:                                               ; preds = %6
  %11 = tail call ptr @MyAlloc(i64 noundef 1048576)
  store ptr %11, ptr %8, align 8, !tbaa !5
  %.not31 = icmp eq ptr %11, null
  br i1 %.not31, label %.thread, label %12

12:                                               ; preds = %10, %6
  %13 = getelementptr inbounds i8, ptr %0, i64 104
  %14 = getelementptr inbounds i8, ptr %0, i64 144
  store ptr %1, ptr %14, align 8, !tbaa !29
  %15 = load ptr, ptr %0, align 8, !tbaa !30
  %16 = getelementptr inbounds i8, ptr %15, i64 64
  %17 = load ptr, ptr %16, align 8
  %18 = tail call noundef i32 %17(ptr noundef nonnull align 8 dereferenceable(19384) %0, ptr noundef %4)
  %19 = getelementptr inbounds i8, ptr %0, i64 19356
  %20 = getelementptr inbounds i8, ptr %0, i64 19368
  %21 = load i64, ptr %20, align 8, !tbaa !32
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = tail call noundef i32 @_ZN9NCompress5NPpmd8CDecoder8CodeSpecEPhj(ptr noundef nonnull align 8 dereferenceable(19384) %0, ptr noundef %22, i32 noundef 1048576)
  %24 = load i64, ptr %20, align 8, !tbaa !32
  %25 = sub i64 %24, %21
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = tail call noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef %2, ptr noundef %26, i64 noundef %25) #5
  %.not3244 = icmp eq i32 %27, 0
  br i1 %.not3244, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %12
  %.not34 = icmp eq ptr %5, null
  %28 = getelementptr inbounds i8, ptr %0, i64 19353
  %29 = getelementptr inbounds i8, ptr %0, i64 19360
  br i1 %.not34, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.critedge.backedge.us
  %30 = phi i32 [ %39, %.critedge.backedge.us ], [ %23, %.lr.ph ]
  %.not33.us = icmp eq i32 %30, 0
  br i1 %.not33.us, label %31, label %.thread

31:                                               ; preds = %.lr.ph.split.us
  %32 = load i32, ptr %19, align 4, !tbaa !33
  %33 = icmp eq i32 %32, 2
  br i1 %33, label %.thread, label %select.unfold.us

select.unfold.us:                                 ; preds = %31
  %34 = load i8, ptr %28, align 1, !tbaa !34, !range !35, !noundef !36
  %35 = trunc nuw i8 %34 to i1
  %.pre57 = load i64, ptr %20, align 8, !tbaa !32
  %36 = load i64, ptr %29, align 8
  %37 = icmp uge i64 %.pre57, %36
  %or.cond.not = select i1 %35, i1 %37, i1 false
  br i1 %or.cond.not, label %.thread, label %.critedge.backedge.us

.critedge.backedge.us:                            ; preds = %select.unfold.us
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = tail call noundef i32 @_ZN9NCompress5NPpmd8CDecoder8CodeSpecEPhj(ptr noundef nonnull align 8 dereferenceable(19384) %0, ptr noundef %38, i32 noundef 1048576)
  %40 = load i64, ptr %20, align 8, !tbaa !32
  %41 = sub i64 %40, %.pre57
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = tail call noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef %2, ptr noundef %42, i64 noundef %41) #5
  %.not32.us = icmp eq i32 %43, 0
  br i1 %.not32.us, label %.lr.ph.split.us, label %.thread, !llvm.loop !37

.lr.ph.split:                                     ; preds = %.lr.ph, %.critedge.backedge
  %44 = phi i32 [ %59, %.critedge.backedge ], [ %23, %.lr.ph ]
  %.not33 = icmp eq i32 %44, 0
  br i1 %.not33, label %45, label %.thread

45:                                               ; preds = %.lr.ph.split
  %46 = load i32, ptr %19, align 4, !tbaa !33
  %47 = icmp eq i32 %46, 2
  br i1 %47, label %.thread, label %48

48:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %49 = call noundef i64 @_ZNK14CByteInBufWrap12GetProcessedEv(ptr noundef nonnull align 8 dereferenceable(64) %13)
  store i64 %49, ptr %7, align 8, !tbaa !39
  %50 = load ptr, ptr %5, align 8, !tbaa !30
  %51 = getelementptr inbounds i8, ptr %50, i64 40
  %52 = load ptr, ptr %51, align 8
  %53 = call noundef i32 %52(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull %7, ptr noundef nonnull %20)
  %.not35 = icmp eq i32 %53, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br i1 %.not35, label %select.unfold, label %.thread

select.unfold:                                    ; preds = %48
  %54 = load i8, ptr %28, align 1, !tbaa !34, !range !35, !noundef !36
  %55 = trunc nuw i8 %54 to i1
  %.pre = load i64, ptr %20, align 8, !tbaa !32
  %56 = load i64, ptr %29, align 8
  %57 = icmp uge i64 %.pre, %56
  %or.cond64.not = select i1 %55, i1 %57, i1 false
  br i1 %or.cond64.not, label %.thread, label %.critedge.backedge

.critedge.backedge:                               ; preds = %select.unfold
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = call noundef i32 @_ZN9NCompress5NPpmd8CDecoder8CodeSpecEPhj(ptr noundef nonnull align 8 dereferenceable(19384) %0, ptr noundef %58, i32 noundef 1048576)
  %60 = load i64, ptr %20, align 8, !tbaa !32
  %61 = sub i64 %60, %.pre
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = call noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef %2, ptr noundef %62, i64 noundef %61) #5
  %.not32 = icmp eq i32 %63, 0
  br i1 %.not32, label %.lr.ph.split, label %.thread, !llvm.loop !37

.thread:                                          ; preds = %45, %.lr.ph.split, %.critedge.backedge, %48, %select.unfold, %31, %.lr.ph.split.us, %.critedge.backedge.us, %select.unfold.us, %12, %10
  %.6 = phi i32 [ -2147024882, %10 ], [ %27, %12 ], [ 0, %31 ], [ %30, %.lr.ph.split.us ], [ %43, %.critedge.backedge.us ], [ 0, %select.unfold.us ], [ 0, %45 ], [ %44, %.lr.ph.split ], [ %63, %.critedge.backedge ], [ %53, %48 ], [ 0, %select.unfold ]
  ret i32 %.6
}

declare ptr @MyAlloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK14CByteInBufWrap12GetProcessedEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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, !18, i64 56}
!6 = !{!"_ZTSN9NCompress5NPpmd8CDecoderE", !7, i64 0, !9, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !13, i64 40, !14, i64 48, !18, i64 56, !19, i64 64, !21, i64 104, !25, i64 168, !16, i64 19352, !24, i64 19353, !15, i64 19356, !23, i64 19360, !23, i64 19368, !28, i64 19376}
!7 = !{!"_ZTS14ICompressCoder", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS30ICompressSetDecoderProperties2", !8, i64 0}
!10 = !{!"_ZTS33ICompressGetInStreamProcessedSize", !8, i64 0}
!11 = !{!"_ZTS20ICompressSetInStream", !8, i64 0}
!12 = !{!"_ZTS25ICompressSetOutStreamSize", !8, i64 0}
!13 = !{!"_ZTS19ISequentialInStream", !8, i64 0}
!14 = !{!"_ZTS13CMyUnknownImp", !15, i64 0}
!15 = !{!"int", !16, i64 0}
!16 = !{!"omnipotent char", !17, i64 0}
!17 = !{!"Simple C++ TBAA"}
!18 = !{!"any pointer", !16, i64 0}
!19 = !{!"_ZTS16CPpmd7z_RangeDec", !20, i64 0, !15, i64 24, !15, i64 28, !18, i64 32}
!20 = !{!"_ZTS15IPpmd7_RangeDec", !18, i64 0, !18, i64 8, !18, i64 16}
!21 = !{!"_ZTS14CByteInBufWrap", !22, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !15, i64 32, !18, i64 40, !23, i64 48, !24, i64 56, !15, i64 60}
!22 = !{!"_ZTS7IByteIn", !18, i64 0}
!23 = !{!"long long", !16, i64 0}
!24 = !{!"bool", !16, i64 0}
!25 = !{!"_ZTS6CPpmd7", !18, i64 0, !18, i64 8, !18, i64 16, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !15, i64 56, !18, i64 64, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96, !15, i64 104, !16, i64 108, !16, i64 146, !16, i64 276, !16, i64 428, !16, i64 684, !16, i64 940, !26, i64 1196, !16, i64 1200, !16, i64 2800}
!26 = !{!"_ZTS9CPpmd_See", !27, i64 0, !16, i64 2, !16, i64 3}
!27 = !{!"short", !16, i64 0}
!28 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !18, i64 0}
!29 = !{!6, !18, i64 144}
!30 = !{!31, !31, i64 0}
!31 = !{!"vtable pointer", !17, i64 0}
!32 = !{!6, !23, i64 19368}
!33 = !{!6, !15, i64 19356}
!34 = !{!6, !24, i64 19353}
!35 = !{i8 0, i8 2}
!36 = !{}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{!23, !23, i64 0}


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