; LLVM IR from mncoppola/rpef :: utilities_src/squashfs2.1/lzma/C/7zip/Compress/LZMA (LZMADecoder)

; 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::NLZMA::CDecoder::CDecoderFlusher" = type <{ ptr, i8, [7 x i8] }>
%"class.NCompress::NLZMA::CDecoder" = type <{ %struct.ICompressCoder, %struct.ICompressSetDecoderProperties2, %class.CMyUnknownImp, [4 x i8], %class.CLZOutWindow, %"class.NCompress::NRangeCoder::CDecoder", [12 x [16 x %"class.NCompress::NRangeCoder::CBitDecoder"]], [12 x %"class.NCompress::NRangeCoder::CBitDecoder"], [12 x %"class.NCompress::NRangeCoder::CBitDecoder"], [12 x %"class.NCompress::NRangeCoder::CBitDecoder"], [12 x %"class.NCompress::NRangeCoder::CBitDecoder"], [12 x [16 x %"class.NCompress::NRangeCoder::CBitDecoder"]], [4 x %"class.NCompress::NRangeCoder::CBitTreeDecoder"], [114 x %"class.NCompress::NRangeCoder::CBitDecoder"], %"class.NCompress::NRangeCoder::CBitTreeDecoder.1", %"class.NCompress::NLZMA::NLength::CDecoder", %"class.NCompress::NLZMA::NLength::CDecoder", %"class.NCompress::NLZMA::CLiteralDecoder", i32, [4 x i32], %"class.NCompress::NLZMA::CState", [3 x i8], i32, [4 x i8], i64, i8, [7 x i8] }>
%struct.ICompressCoder = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%struct.ICompressSetDecoderProperties2 = type { %struct.IUnknown }
%class.CMyUnknownImp = type { i32 }
%class.CLZOutWindow = type { %class.COutBuffer.base, [7 x i8] }
%class.COutBuffer.base = type <{ ptr, i32, i32, i32, i32, %class.CMyComPtr, i64, ptr, i8 }>
%class.CMyComPtr = type { ptr }
%"class.NCompress::NRangeCoder::CDecoder" = type { %class.CInBuffer, i32, i32 }
%class.CInBuffer = type <{ ptr, ptr, ptr, %class.CMyComPtr.0, i64, i32, i8, [3 x i8] }>
%class.CMyComPtr.0 = type { ptr }
%"class.NCompress::NRangeCoder::CBitDecoder" = type { %"class.NCompress::NRangeCoder::CBitModel" }
%"class.NCompress::NRangeCoder::CBitModel" = type { i32 }
%"class.NCompress::NRangeCoder::CBitTreeDecoder" = type { [64 x %"class.NCompress::NRangeCoder::CBitDecoder"] }
%"class.NCompress::NRangeCoder::CBitTreeDecoder.1" = type { [16 x %"class.NCompress::NRangeCoder::CBitDecoder"] }
%"class.NCompress::NLZMA::NLength::CDecoder" = type { %"class.NCompress::NRangeCoder::CBitDecoder", %"class.NCompress::NRangeCoder::CBitDecoder", [16 x %"class.NCompress::NRangeCoder::CBitTreeDecoder.2"], [16 x %"class.NCompress::NRangeCoder::CBitTreeDecoder.2"], %"class.NCompress::NRangeCoder::CBitTreeDecoder.3" }
%"class.NCompress::NRangeCoder::CBitTreeDecoder.2" = type { [8 x %"class.NCompress::NRangeCoder::CBitDecoder"] }
%"class.NCompress::NRangeCoder::CBitTreeDecoder.3" = type { [256 x %"class.NCompress::NRangeCoder::CBitDecoder"] }
%"class.NCompress::NLZMA::CLiteralDecoder" = type <{ ptr, i32, i32, i32, [4 x i8] }>
%"class.NCompress::NLZMA::CState" = type { i8 }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

declare noundef i64 @_ZNK10COutBuffer16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(49)) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(7585) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %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 %"class.NCompress::NLZMA::CDecoder::CDecoderFlusher", align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = 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
  %23 = load ptr, ptr %8, align 8
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = load ptr, ptr %23, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 8
  %27 = load ptr, ptr %26, align 8
  %28 = call noundef i32 %27(ptr noundef nonnull align 8 dereferenceable(7585) %23, ptr noundef %24)
  %29 = getelementptr inbounds %"class.NCompress::NLZMA::CDecoder", ptr %23, i32 0, i32 4
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN10COutBuffer9SetStreamEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(49) %29, ptr noundef %30)
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = load ptr, ptr %23, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i64 10
  %34 = load ptr, ptr %33, align 8
  %35 = call noundef i32 %34(ptr noundef nonnull align 8 dereferenceable(7585) %23, ptr noundef %31)
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #4
  call void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherC2EPS1_(ptr noundef nonnull align 8 dereferenceable(9) %14, ptr noundef %23)
  br label %36

36:                                               ; preds = %118, %6
  br label %37

37:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 262144, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %38 = load i32, ptr %15, align 4, !tbaa !11
  %39 = invoke noundef i32 @_ZN9NCompress5NLZMA8CDecoder8CodeSpecEj(ptr noundef nonnull align 8 dereferenceable(7585) %23, i32 noundef %38)
          to label %40 unwind label %45

40:                                               ; preds = %37
  store i32 %39, ptr %16, align 4, !tbaa !11
  %41 = load i32, ptr %16, align 4, !tbaa !11
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %49

43:                                               ; preds = %40
  %44 = load i32, ptr %16, align 4, !tbaa !11
  store i32 %44, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %50

45:                                               ; preds = %37
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %17, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %119

49:                                               ; preds = %40
  store i32 0, ptr %19, align 4
  br label %50

50:                                               ; preds = %49, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  %51 = load i32, ptr %19, align 4
  switch i32 %51, label %116 [
    i32 0, label %52
  ]

52:                                               ; preds = %50
  %53 = getelementptr inbounds %"class.NCompress::NLZMA::CDecoder", ptr %23, i32 0, i32 22
  %54 = load i32, ptr %53, align 8, !tbaa !13
  %55 = icmp eq i32 %54, -1
  br i1 %55, label %56, label %57

56:                                               ; preds = %52
  store i32 3, ptr %19, align 4
  br label %116

57:                                               ; preds = %52
  %58 = load ptr, ptr %13, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %98

60:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %61 = getelementptr inbounds %"class.NCompress::NLZMA::CDecoder", ptr %23, i32 0, i32 5
  %62 = invoke noundef i64 @_ZN9NCompress11NRangeCoder8CDecoder16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(56) %61)
          to label %63 unwind label %77

63:                                               ; preds = %60
  store i64 %62, ptr %20, align 8, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %64 = getelementptr inbounds %"class.NCompress::NLZMA::CDecoder", ptr %23, i32 0, i32 4
  %65 = invoke noundef i64 @_ZNK10COutBuffer16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(49) %64)
          to label %66 unwind label %81

66:                                               ; preds = %63
  store i64 %65, ptr %21, align 8, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  %69 = getelementptr inbounds ptr, ptr %68, i64 3
  %70 = load ptr, ptr %69, align 8
  %71 = invoke noundef i32 %70(ptr noundef nonnull align 8 dereferenceable(8) %67, ptr noundef %20, ptr noundef %21)
          to label %72 unwind label %85

72:                                               ; preds = %66
  store i32 %71, ptr %22, align 4, !tbaa !11
  %73 = load i32, ptr %22, align 4, !tbaa !11
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %89

75:                                               ; preds = %72
  %76 = load i32, ptr %22, align 4, !tbaa !11
  store i32 %76, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %90

77:                                               ; preds = %60
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %17, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %18, align 4
  br label %97

81:                                               ; preds = %63
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %17, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %18, align 4
  br label %96

85:                                               ; preds = %66
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %17, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %96

89:                                               ; preds = %72
  store i32 0, ptr %19, align 4
  br label %90

90:                                               ; preds = %89, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  %91 = load i32, ptr %19, align 4
  switch i32 %91, label %93 [
    i32 0, label %92
  ]

92:                                               ; preds = %90
  store i32 0, ptr %19, align 4
  br label %93

93:                                               ; preds = %92, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  %94 = load i32, ptr %19, align 4
  switch i32 %94, label %116 [
    i32 0, label %95
  ]

95:                                               ; preds = %93
  br label %98

96:                                               ; preds = %85, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  br label %97

97:                                               ; preds = %96, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  br label %119

98:                                               ; preds = %95, %57
  %99 = getelementptr inbounds %"class.NCompress::NLZMA::CDecoder", ptr %23, i32 0, i32 25
  %100 = load i8, ptr %99, align 8, !tbaa !35, !range !36, !noundef !37
  %101 = trunc i8 %100 to i1
  br i1 %101, label %102, label %115

102:                                              ; preds = %98
  %103 = getelementptr inbounds %"class.NCompress::NLZMA::CDecoder", ptr %23, i32 0, i32 4
  %104 = invoke noundef i64 @_ZNK10COutBuffer16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(49) %103)
          to label %105 unwind label %110

105:                                              ; preds = %102
  %106 = getelementptr inbounds %"class.NCompress::NLZMA::CDecoder", ptr %23, i32 0, i32 24
  %107 = load i64, ptr %106, align 8, !tbaa !38
  %108 = icmp uge i64 %104, %107
  br i1 %108, label %109, label %114

109:                                              ; preds = %105
  store i32 3, ptr %19, align 4
  br label %116

110:                                              ; preds = %102
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %17, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %18, align 4
  br label %119

114:                                              ; preds = %105
  br label %115

115:                                              ; preds = %114, %98
  store i32 0, ptr %19, align 4
  br label %116

116:                                              ; preds = %115, %109, %93, %56, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %117 = load i32, ptr %19, align 4
  switch i32 %117, label %128 [
    i32 0, label %118
    i32 3, label %120
  ]

118:                                              ; preds = %116
  br label %36, !llvm.loop !39

119:                                              ; preds = %110, %97, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %130

120:                                              ; preds = %116
  %121 = getelementptr inbounds %"class.NCompress::NLZMA::CDecoder::CDecoderFlusher", ptr %14, i32 0, i32 1
  store i8 0, ptr %121, align 8, !tbaa !41
  %122 = invoke noundef i32 @_ZN9NCompress5NLZMA8CDecoder5FlushEv(ptr noundef nonnull align 8 dereferenceable(7585) %23)
          to label %123 unwind label %124

123:                                              ; preds = %120
  store i32 %122, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %128

124:                                              ; preds = %120
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %17, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %18, align 4
  br label %130

128:                                              ; preds = %123, %116
  call void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %14) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #4
  %129 = load i32, ptr %7, align 4
  ret i32 %129

130:                                              ; preds = %124, %119
  call void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %14) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #4
  br label %131

131:                                              ; preds = %130
  %132 = load ptr, ptr %17, align 8
  %133 = load i32, ptr %18, align 4
  %134 = insertvalue { ptr, i32 } poison, ptr %132, 0
  %135 = insertvalue { ptr, i32 } %134, i32 %133, 1
  resume { ptr, i32 } %135
}

declare void @_ZN10COutBuffer9SetStreamEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(49), ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherC2EPS1_(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherD2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #3 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 = { 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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 7568}
!14 = !{!"_ZTSN9NCompress5NLZMA8CDecoderE", !15, i64 0, !17, i64 8, !18, i64 16, !19, i64 24, !24, i64 80, !7, i64 136, !7, i64 904, !7, i64 952, !7, i64 1000, !7, i64 1048, !7, i64 1096, !7, i64 1864, !7, i64 2888, !27, i64 3344, !28, i64 3408, !28, i64 5464, !32, i64 7520, !12, i64 7544, !7, i64 7548, !33, i64 7564, !12, i64 7568, !22, i64 7576, !23, i64 7584}
!15 = !{!"_ZTS14ICompressCoder", !16, i64 0}
!16 = !{!"_ZTS8IUnknown"}
!17 = !{!"_ZTS30ICompressSetDecoderProperties2", !16, i64 0}
!18 = !{!"_ZTS13CMyUnknownImp", !12, i64 0}
!19 = !{!"_ZTS12CLZOutWindow", !20, i64 0}
!20 = !{!"_ZTS10COutBuffer", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !21, i64 24, !22, i64 32, !6, i64 40, !23, i64 48}
!21 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !6, i64 0}
!22 = !{!"long long", !7, i64 0}
!23 = !{!"bool", !7, i64 0}
!24 = !{!"_ZTSN9NCompress11NRangeCoder8CDecoderE", !25, i64 0, !12, i64 48, !12, i64 52}
!25 = !{!"_ZTS9CInBuffer", !6, i64 0, !6, i64 8, !6, i64 16, !26, i64 24, !22, i64 32, !12, i64 40, !23, i64 44}
!26 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !6, i64 0}
!27 = !{!"_ZTSN9NCompress11NRangeCoder15CBitTreeDecoderILi5ELi4EEE", !7, i64 0}
!28 = !{!"_ZTSN9NCompress5NLZMA7NLength8CDecoderE", !29, i64 0, !29, i64 4, !7, i64 8, !7, i64 520, !31, i64 1032}
!29 = !{!"_ZTSN9NCompress11NRangeCoder11CBitDecoderILi5EEE", !30, i64 0}
!30 = !{!"_ZTSN9NCompress11NRangeCoder9CBitModelILi5EEE", !12, i64 0}
!31 = !{!"_ZTSN9NCompress11NRangeCoder15CBitTreeDecoderILi5ELi8EEE", !7, i64 0}
!32 = !{!"_ZTSN9NCompress5NLZMA15CLiteralDecoderE", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!33 = !{!"_ZTSN9NCompress5NLZMA6CStateE", !7, i64 0}
!34 = !{!22, !22, i64 0}
!35 = !{!14, !23, i64 7584}
!36 = !{i8 0, i8 2}
!37 = !{}
!38 = !{!14, !22, i64 7576}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}
!41 = !{!42, !23, i64 8}
!42 = !{!"_ZTSN9NCompress5NLZMA8CDecoder15CDecoderFlusherE", !6, i64 0, !23, i64 8}


; 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.NCompress::NLZMA::CDecoder::CDecoderFlusher" = type <{ ptr, i8, [7 x i8] }>

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

declare noundef i64 @_ZNK10COutBuffer16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(49)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(7585) %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readnone %3, ptr noundef %4, ptr noundef %5) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.NCompress::NLZMA::CDecoder::CDecoderFlusher", align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = load ptr, ptr %0, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %10, i64 64
  %12 = load ptr, ptr %11, align 8
  %13 = tail call noundef i32 %12(ptr noundef nonnull align 8 dereferenceable(7585) %0, ptr noundef %1)
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN10COutBuffer9SetStreamEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(49) %14, ptr noundef %2)
  %15 = load ptr, ptr %0, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 80
  %17 = load ptr, ptr %16, align 8
  %18 = tail call noundef i32 %17(ptr noundef nonnull align 8 dereferenceable(7585) %0, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  call void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherC2EPS1_(ptr noundef nonnull align 8 dereferenceable(9) %7, ptr noundef nonnull %0)
  %19 = getelementptr inbounds i8, ptr %0, i64 7568
  %.not33 = icmp eq ptr %5, null
  %20 = getelementptr inbounds i8, ptr %0, i64 80
  %21 = getelementptr inbounds i8, ptr %0, i64 7584
  %22 = getelementptr inbounds i8, ptr %0, i64 7576
  br i1 %.not33, label %.split.us, label %.split

.split.us:                                        ; preds = %6, %.split.us.backedge
  %23 = invoke noundef i32 @_ZN9NCompress5NLZMA8CDecoder8CodeSpecEj(ptr noundef nonnull align 8 dereferenceable(7585) %0, i32 noundef 262144)
          to label %24 unwind label %.split50.us

24:                                               ; preds = %.split.us
  %.not.us = icmp eq i32 %23, 0
  br i1 %.not.us, label %25, label %.thread

25:                                               ; preds = %24
  %26 = load i32, ptr %19, align 8, !tbaa !8
  %27 = icmp eq i32 %26, -1
  br i1 %27, label %.split53.us, label %28

28:                                               ; preds = %25
  %29 = load i8, ptr %21, align 8, !tbaa !32, !range !33, !noundef !34
  %30 = trunc nuw i8 %29 to i1
  br i1 %30, label %31, label %.split.us.backedge

31:                                               ; preds = %28
  %32 = invoke noundef i64 @_ZNK10COutBuffer16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(49) %14)
          to label %33 unwind label %.split55.us

33:                                               ; preds = %31
  %34 = load i64, ptr %22, align 8, !tbaa !35
  %.not39.us = icmp ult i64 %32, %34
  br i1 %.not39.us, label %.split.us.backedge, label %.split53.us

.split.us.backedge:                               ; preds = %33, %28
  br label %.split.us

.split50.us:                                      ; preds = %.split.us
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %73

.split55.us:                                      ; preds = %31
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %73

.split:                                           ; preds = %6, %.split.backedge
  %37 = invoke noundef i32 @_ZN9NCompress5NLZMA8CDecoder8CodeSpecEj(ptr noundef nonnull align 8 dereferenceable(7585) %0, i32 noundef 262144)
          to label %38 unwind label %.split50

38:                                               ; preds = %.split
  %.not = icmp eq i32 %37, 0
  br i1 %.not, label %40, label %.thread

.split50:                                         ; preds = %.split
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %73

40:                                               ; preds = %38
  %41 = load i32, ptr %19, align 8, !tbaa !8
  %42 = icmp eq i32 %41, -1
  br i1 %42, label %.split53.us, label %43

43:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %44 = invoke noundef i64 @_ZN9NCompress11NRangeCoder8CDecoder16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(56) %20)
          to label %45 unwind label %53

45:                                               ; preds = %43
  store i64 %44, ptr %8, align 8, !tbaa !36
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %46 = invoke noundef i64 @_ZNK10COutBuffer16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(49) %14)
          to label %47 unwind label %55

47:                                               ; preds = %45
  store i64 %46, ptr %9, align 8, !tbaa !36
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 24
  %50 = load ptr, ptr %49, align 8
  %51 = invoke noundef i32 %50(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull %8, ptr noundef nonnull %9)
          to label %52 unwind label %57

52:                                               ; preds = %47
  %.not36 = icmp eq i32 %51, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br i1 %.not36, label %61, label %.thread

53:                                               ; preds = %43
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %60

55:                                               ; preds = %45
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %59

57:                                               ; preds = %47
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %59

59:                                               ; preds = %57, %55
  %.pn = phi { ptr, i32 } [ %58, %57 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %60

60:                                               ; preds = %59, %53
  %.pn.pn = phi { ptr, i32 } [ %.pn, %59 ], [ %54, %53 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %73

61:                                               ; preds = %52
  %62 = load i8, ptr %21, align 8, !tbaa !32, !range !33, !noundef !34
  %63 = trunc nuw i8 %62 to i1
  br i1 %63, label %64, label %.split.backedge

.split.backedge:                                  ; preds = %61, %66
  br label %.split

64:                                               ; preds = %61
  %65 = invoke noundef i64 @_ZNK10COutBuffer16GetProcessedSizeEv(ptr noundef nonnull align 8 dereferenceable(49) %14)
          to label %66 unwind label %.split55

66:                                               ; preds = %64
  %67 = load i64, ptr %22, align 8, !tbaa !35
  %.not39 = icmp ult i64 %65, %67
  br i1 %.not39, label %.split.backedge, label %.split53.us

.split55:                                         ; preds = %64
  %68 = landingpad { ptr, i32 }
          cleanup
  br label %73

.split53.us:                                      ; preds = %66, %40, %25, %33
  %69 = getelementptr inbounds i8, ptr %7, i64 8
  store i8 0, ptr %69, align 8, !tbaa !37
  %70 = invoke noundef i32 @_ZN9NCompress5NLZMA8CDecoder5FlushEv(ptr noundef nonnull align 8 dereferenceable(7585) %0)
          to label %.thread unwind label %71

71:                                               ; preds = %.split53.us
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %73

.thread:                                          ; preds = %52, %38, %24, %.split53.us
  %.5 = phi i32 [ %70, %.split53.us ], [ %23, %24 ], [ %51, %52 ], [ %37, %38 ]
  call void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  ret i32 %.5

73:                                               ; preds = %.split55, %.split55.us, %.split50, %.split50.us, %60, %71
  %.pn40 = phi { ptr, i32 } [ %72, %71 ], [ %.pn.pn, %60 ], [ %39, %.split50 ], [ %35, %.split50.us ], [ %68, %.split55 ], [ %36, %.split55.us ]
  call void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  resume { ptr, i32 } %.pn40
}

declare void @_ZN10COutBuffer9SetStreamEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(49), ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherC2EPS1_(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9NCompress5NLZMA8CDecoder15CDecoderFlusherD2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #3 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 = { 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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !14, i64 7568}
!9 = !{!"_ZTSN9NCompress5NLZMA8CDecoderE", !10, i64 0, !12, i64 8, !13, i64 16, !16, i64 24, !22, i64 80, !15, i64 136, !15, i64 904, !15, i64 952, !15, i64 1000, !15, i64 1048, !15, i64 1096, !15, i64 1864, !15, i64 2888, !25, i64 3344, !26, i64 3408, !26, i64 5464, !30, i64 7520, !14, i64 7544, !15, i64 7548, !31, i64 7564, !14, i64 7568, !20, i64 7576, !21, i64 7584}
!10 = !{!"_ZTS14ICompressCoder", !11, i64 0}
!11 = !{!"_ZTS8IUnknown"}
!12 = !{!"_ZTS30ICompressSetDecoderProperties2", !11, i64 0}
!13 = !{!"_ZTS13CMyUnknownImp", !14, i64 0}
!14 = !{!"int", !15, i64 0}
!15 = !{!"omnipotent char", !7, i64 0}
!16 = !{!"_ZTS12CLZOutWindow", !17, i64 0}
!17 = !{!"_ZTS10COutBuffer", !18, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !19, i64 24, !20, i64 32, !18, i64 40, !21, i64 48}
!18 = !{!"any pointer", !15, i64 0}
!19 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !18, i64 0}
!20 = !{!"long long", !15, i64 0}
!21 = !{!"bool", !15, i64 0}
!22 = !{!"_ZTSN9NCompress11NRangeCoder8CDecoderE", !23, i64 0, !14, i64 48, !14, i64 52}
!23 = !{!"_ZTS9CInBuffer", !18, i64 0, !18, i64 8, !18, i64 16, !24, i64 24, !20, i64 32, !14, i64 40, !21, i64 44}
!24 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !18, i64 0}
!25 = !{!"_ZTSN9NCompress11NRangeCoder15CBitTreeDecoderILi5ELi4EEE", !15, i64 0}
!26 = !{!"_ZTSN9NCompress5NLZMA7NLength8CDecoderE", !27, i64 0, !27, i64 4, !15, i64 8, !15, i64 520, !29, i64 1032}
!27 = !{!"_ZTSN9NCompress11NRangeCoder11CBitDecoderILi5EEE", !28, i64 0}
!28 = !{!"_ZTSN9NCompress11NRangeCoder9CBitModelILi5EEE", !14, i64 0}
!29 = !{!"_ZTSN9NCompress11NRangeCoder15CBitTreeDecoderILi5ELi8EEE", !15, i64 0}
!30 = !{!"_ZTSN9NCompress5NLZMA15CLiteralDecoderE", !18, i64 0, !14, i64 8, !14, i64 12, !14, i64 16}
!31 = !{!"_ZTSN9NCompress5NLZMA6CStateE", !15, i64 0}
!32 = !{!9, !21, i64 7584}
!33 = !{i8 0, i8 2}
!34 = !{}
!35 = !{!9, !20, i64 7576}
!36 = !{!20, !20, i64 0}
!37 = !{!38, !21, i64 8}
!38 = !{!"_ZTSN9NCompress5NLZMA8CDecoder15CDecoderFlusherE", !18, i64 0, !21, i64 8}


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