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

; 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::CEncoder" = type <{ %struct.ICompressCoder, %struct.ICompressSetOutStream, %struct.ICompressSetCoderProperties, %struct.ICompressWriteCoderProperties, %"class.NCompress::NLZMA::CBaseState", %class.CMyUnknownImp, [4096 x %"struct.NCompress::NLZMA::COptimal"], %class.CMyComPtr.5, %"class.NCompress::NRangeCoder::CEncoder", [12 x [16 x %"class.NCompress::NRangeCoder::CBitEncoder"]], [12 x %"class.NCompress::NRangeCoder::CBitEncoder"], [12 x %"class.NCompress::NRangeCoder::CBitEncoder"], [12 x %"class.NCompress::NRangeCoder::CBitEncoder"], [12 x %"class.NCompress::NRangeCoder::CBitEncoder"], [12 x [16 x %"class.NCompress::NRangeCoder::CBitEncoder"]], [4 x %"class.NCompress::NRangeCoder::CBitTreeEncoder.7"], [114 x %"class.NCompress::NRangeCoder::CBitEncoder"], %"class.NCompress::NRangeCoder::CBitTreeEncoder.8", %"class.NCompress::NLZMA::NLength::CPriceTableEncoder", %"class.NCompress::NLZMA::NLength::CPriceTableEncoder", %"class.NCompress::NLZMA::CLiteralEncoder", [274 x i32], i8, i8, [2 x i8], i32, i32, i32, i32, i32, i8, [3 x i8], [4 x [64 x i32]], [4 x [128 x i32]], [16 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i8, [7 x i8], ptr, i32, i8, i8, [2 x i8] }>
%struct.ICompressCoder = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%struct.ICompressSetOutStream = type { %struct.IUnknown }
%struct.ICompressSetCoderProperties = type { %struct.IUnknown }
%struct.ICompressWriteCoderProperties = type { %struct.IUnknown }
%"class.NCompress::NLZMA::CBaseState" = type { %"class.NCompress::NLZMA::CState", i8, [4 x i32] }
%"class.NCompress::NLZMA::CState" = type { i8 }
%class.CMyUnknownImp = type { i32 }
%"struct.NCompress::NLZMA::COptimal" = type { %"class.NCompress::NLZMA::CState", i8, i8, i32, i32, i32, i32, i32, [4 x i32] }
%class.CMyComPtr.5 = type { ptr }
%"class.NCompress::NRangeCoder::CEncoder" = type { i32, i8, i64, i32, [4 x i8], %class.COutBuffer }
%class.COutBuffer = type <{ ptr, i32, i32, i32, i32, %class.CMyComPtr.6, i64, ptr, i8, [7 x i8] }>
%class.CMyComPtr.6 = type { ptr }
%"class.NCompress::NRangeCoder::CBitEncoder" = type { %"class.NCompress::NRangeCoder::CBitModel" }
%"class.NCompress::NRangeCoder::CBitModel" = type { i32 }
%"class.NCompress::NRangeCoder::CBitTreeEncoder.7" = type { [64 x %"class.NCompress::NRangeCoder::CBitEncoder"] }
%"class.NCompress::NRangeCoder::CBitTreeEncoder.8" = type { [16 x %"class.NCompress::NRangeCoder::CBitEncoder"] }
%"class.NCompress::NLZMA::NLength::CPriceTableEncoder" = type { %"class.NCompress::NLZMA::NLength::CEncoder", [272 x [16 x i32]], i32, [16 x i32] }
%"class.NCompress::NLZMA::NLength::CEncoder" = type { %"class.NCompress::NRangeCoder::CBitEncoder", %"class.NCompress::NRangeCoder::CBitEncoder", [16 x %"class.NCompress::NRangeCoder::CBitTreeEncoder"], [16 x %"class.NCompress::NRangeCoder::CBitTreeEncoder"], %"class.NCompress::NRangeCoder::CBitTreeEncoder.4" }
%"class.NCompress::NRangeCoder::CBitTreeEncoder" = type { [8 x %"class.NCompress::NRangeCoder::CBitEncoder"] }
%"class.NCompress::NRangeCoder::CBitTreeEncoder.4" = type { [256 x %"class.NCompress::NRangeCoder::CBitEncoder"] }
%"class.NCompress::NLZMA::CLiteralEncoder" = type <{ ptr, i32, i32, i32, [4 x i8] }>

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9NCompress5NLZMA8CEncoder8BackwardERjj(ptr noundef nonnull align 8 dereferenceable(210678) %0, ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %11 = load ptr, ptr %4, align 8
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 28
  store i32 %12, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %14 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %14, i64 0, i64 %16
  %18 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %17, i32 0, i32 6
  %19 = load i32, ptr %18, align 8, !tbaa !34
  store i32 %19, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %20 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %20, i64 0, i64 %22
  %24 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %23, i32 0, i32 7
  %25 = load i32, ptr %24, align 4, !tbaa !36
  store i32 %25, ptr %8, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %113, %3
  %27 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %27, i64 0, i64 %29
  %31 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %30, i32 0, i32 1
  %32 = load i8, ptr %31, align 1, !tbaa !37, !range !38, !noundef !39
  %33 = trunc i8 %32 to i1
  br i1 %33, label %34, label %85

34:                                               ; preds = %26
  %35 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %35, i64 0, i64 %37
  call void @_ZN9NCompress5NLZMA8COptimal10MakeAsCharEv(ptr noundef nonnull align 4 dereferenceable(40) %38)
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = sub i32 %39, 1
  %41 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %41, i64 0, i64 %43
  %45 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %44, i32 0, i32 6
  store i32 %40, ptr %45, align 8, !tbaa !34
  %46 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %47 = load i32, ptr %6, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %46, i64 0, i64 %48
  %50 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %49, i32 0, i32 2
  %51 = load i8, ptr %50, align 2, !tbaa !40, !range !38, !noundef !39
  %52 = trunc i8 %51 to i1
  br i1 %52, label %53, label %84

53:                                               ; preds = %34
  %54 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %55 = load i32, ptr %7, align 4, !tbaa !9
  %56 = sub i32 %55, 1
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %54, i64 0, i64 %57
  %59 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %58, i32 0, i32 1
  store i8 0, ptr %59, align 1, !tbaa !37
  %60 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %60, i64 0, i64 %62
  %64 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %63, i32 0, i32 3
  %65 = load i32, ptr %64, align 4, !tbaa !41
  %66 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = sub i32 %67, 1
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %66, i64 0, i64 %69
  %71 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %70, i32 0, i32 6
  store i32 %65, ptr %71, align 8, !tbaa !34
  %72 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %73 = load i32, ptr %6, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %72, i64 0, i64 %74
  %76 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %75, i32 0, i32 4
  %77 = load i32, ptr %76, align 8, !tbaa !42
  %78 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = sub i32 %79, 1
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %78, i64 0, i64 %81
  %83 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %82, i32 0, i32 7
  store i32 %77, ptr %83, align 4, !tbaa !36
  br label %84

84:                                               ; preds = %53, %34
  br label %85

85:                                               ; preds = %84, %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %86 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %86, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %87 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %87, ptr %10, align 4, !tbaa !9
  %88 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %89 = load i32, ptr %9, align 4, !tbaa !9
  %90 = zext i32 %89 to i64
  %91 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %88, i64 0, i64 %90
  %92 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %91, i32 0, i32 7
  %93 = load i32, ptr %92, align 4, !tbaa !36
  store i32 %93, ptr %8, align 4, !tbaa !9
  %94 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = zext i32 %95 to i64
  %97 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %94, i64 0, i64 %96
  %98 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %97, i32 0, i32 6
  %99 = load i32, ptr %98, align 8, !tbaa !34
  store i32 %99, ptr %7, align 4, !tbaa !9
  %100 = load i32, ptr %10, align 4, !tbaa !9
  %101 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %101, i64 0, i64 %103
  %105 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %104, i32 0, i32 7
  store i32 %100, ptr %105, align 4, !tbaa !36
  %106 = load i32, ptr %6, align 4, !tbaa !9
  %107 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %108 = load i32, ptr %9, align 4, !tbaa !9
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %107, i64 0, i64 %109
  %111 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %110, i32 0, i32 6
  store i32 %106, ptr %111, align 8, !tbaa !34
  %112 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %112, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %113

113:                                              ; preds = %85
  %114 = load i32, ptr %6, align 4, !tbaa !9
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %26, label %116, !llvm.loop !43

116:                                              ; preds = %113
  %117 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %118 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %117, i64 0, i64 0
  %119 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %118, i32 0, i32 7
  %120 = load i32, ptr %119, align 4, !tbaa !36
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 %120, ptr %121, align 4, !tbaa !9
  %122 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 6
  %123 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %122, i64 0, i64 0
  %124 = getelementptr inbounds %"struct.NCompress::NLZMA::COptimal", ptr %123, i32 0, i32 6
  %125 = load i32, ptr %124, align 8, !tbaa !34
  %126 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 29
  store i32 %125, ptr %126, align 4, !tbaa !45
  %127 = getelementptr inbounds %"class.NCompress::NLZMA::CEncoder", ptr %11, i32 0, i32 29
  %128 = load i32, ptr %127, align 4, !tbaa !45
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 %128
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9NCompress5NLZMA8COptimal10MakeAsCharEv(ptr noundef nonnull align 4 dereferenceable(40)) #2 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 = { 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 = { 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, !10, i64 207456}
!12 = !{!"_ZTSN9NCompress5NLZMA8CEncoderE", !13, i64 0, !15, i64 8, !16, i64 16, !17, i64 24, !18, i64 32, !20, i64 52, !7, i64 56, !21, i64 163896, !22, i64 163904, !7, i64 163984, !7, i64 164752, !7, i64 164800, !7, i64 164848, !7, i64 164896, !7, i64 164944, !7, i64 165712, !7, i64 166736, !27, i64 167192, !28, i64 167256, !28, i64 186788, !33, i64 206320, !7, i64 206344, !26, i64 207440, !26, i64 207441, !10, i64 207444, !10, i64 207448, !10, i64 207452, !10, i64 207456, !10, i64 207460, !26, i64 207464, !7, i64 207468, !7, i64 208492, !7, i64 210540, !10, i64 210604, !10, i64 210608, !10, i64 210612, !10, i64 210616, !10, i64 210620, !10, i64 210624, !10, i64 210628, !10, i64 210632, !10, i64 210636, !23, i64 210640, !23, i64 210648, !26, i64 210656, !6, i64 210664, !10, i64 210672, !26, i64 210676, !26, i64 210677}
!13 = !{!"_ZTS14ICompressCoder", !14, i64 0}
!14 = !{!"_ZTS8IUnknown"}
!15 = !{!"_ZTS21ICompressSetOutStream", !14, i64 0}
!16 = !{!"_ZTS27ICompressSetCoderProperties", !14, i64 0}
!17 = !{!"_ZTS29ICompressWriteCoderProperties", !14, i64 0}
!18 = !{!"_ZTSN9NCompress5NLZMA10CBaseStateE", !19, i64 0, !7, i64 1, !7, i64 4}
!19 = !{!"_ZTSN9NCompress5NLZMA6CStateE", !7, i64 0}
!20 = !{!"_ZTS13CMyUnknownImp", !10, i64 0}
!21 = !{!"_ZTS9CMyComPtrI12IMatchFinderE", !6, i64 0}
!22 = !{!"_ZTSN9NCompress11NRangeCoder8CEncoderE", !10, i64 0, !7, i64 4, !23, i64 8, !10, i64 16, !24, i64 24}
!23 = !{!"long long", !7, i64 0}
!24 = !{!"_ZTS10COutBuffer", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !25, i64 24, !23, i64 32, !6, i64 40, !26, i64 48}
!25 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !6, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{!"_ZTSN9NCompress11NRangeCoder15CBitTreeEncoderILi5ELi4EEE", !7, i64 0}
!28 = !{!"_ZTSN9NCompress5NLZMA7NLength18CPriceTableEncoderE", !29, i64 0, !7, i64 2056, !10, i64 19464, !7, i64 19468}
!29 = !{!"_ZTSN9NCompress5NLZMA7NLength8CEncoderE", !30, i64 0, !30, i64 4, !7, i64 8, !7, i64 520, !32, i64 1032}
!30 = !{!"_ZTSN9NCompress11NRangeCoder11CBitEncoderILi5EEE", !31, i64 0}
!31 = !{!"_ZTSN9NCompress11NRangeCoder9CBitModelILi5EEE", !10, i64 0}
!32 = !{!"_ZTSN9NCompress11NRangeCoder15CBitTreeEncoderILi5ELi8EEE", !7, i64 0}
!33 = !{!"_ZTSN9NCompress5NLZMA15CLiteralEncoderE", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!34 = !{!35, !10, i64 16}
!35 = !{!"_ZTSN9NCompress5NLZMA8COptimalE", !19, i64 0, !26, i64 1, !26, i64 2, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !7, i64 24}
!36 = !{!35, !10, i64 20}
!37 = !{!35, !26, i64 1}
!38 = !{i8 0, i8 2}
!39 = !{}
!40 = !{!35, !26, i64 2}
!41 = !{!35, !10, i64 4}
!42 = !{!35, !10, i64 8}
!43 = distinct !{!43, !44}
!44 = !{!"llvm.loop.mustprogress"}
!45 = !{!12, !10, i64 207460}


; 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"

%"struct.NCompress::NLZMA::COptimal" = type { %"class.NCompress::NLZMA::CState", i8, i8, i32, i32, i32, i32, i32, [4 x i32] }
%"class.NCompress::NLZMA::CState" = type { i8 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN9NCompress5NLZMA8CEncoder8BackwardERjj(ptr noundef nonnull align 8 dereferenceable(210678) %0, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 207456
  store i32 %2, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = zext i32 %2 to i64
  %7 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %5, i64 0, i64 %6
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  %9 = load i32, ptr %8, align 8, !tbaa !32
  %10 = getelementptr inbounds i8, ptr %7, i64 20
  %11 = load i32, ptr %10, align 4, !tbaa !34
  br label %12

12:                                               ; preds = %33, %3
  %.025 = phi i32 [ %11, %3 ], [ %37, %33 ]
  %.024 = phi i32 [ %9, %3 ], [ %34, %33 ]
  %.0 = phi i32 [ %2, %3 ], [ %.024, %33 ]
  %13 = zext i32 %.0 to i64
  %14 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %5, i64 0, i64 %13
  %15 = getelementptr inbounds i8, ptr %14, i64 1
  %16 = load i8, ptr %15, align 1, !tbaa !35, !range !36, !noundef !37
  %17 = trunc nuw i8 %16 to i1
  %18 = zext i32 %.024 to i64
  br i1 %17, label %19, label %._crit_edge

._crit_edge:                                      ; preds = %12
  %.phi.trans.insert27 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %5, i64 0, i64 %18, i32 6
  %.pre = load i32, ptr %.phi.trans.insert27, align 8, !tbaa !32
  br label %33

19:                                               ; preds = %12
  %20 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %5, i64 0, i64 %18
  tail call void @_ZN9NCompress5NLZMA8COptimal10MakeAsCharEv(ptr noundef nonnull align 4 dereferenceable(40) %20)
  %21 = add i32 %.024, -1
  %22 = getelementptr inbounds i8, ptr %20, i64 16
  store i32 %21, ptr %22, align 8, !tbaa !32
  %23 = getelementptr inbounds i8, ptr %14, i64 2
  %24 = load i8, ptr %23, align 2, !tbaa !38, !range !36, !noundef !37
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %26, label %33

26:                                               ; preds = %19
  %27 = zext i32 %21 to i64
  %28 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %5, i64 0, i64 %27
  %29 = getelementptr inbounds i8, ptr %28, i64 1
  store i8 0, ptr %29, align 1, !tbaa !35
  %30 = getelementptr inbounds i8, ptr %14, i64 4
  %31 = getelementptr inbounds i8, ptr %28, i64 16
  %32 = load <2 x i32>, ptr %30, align 4, !tbaa !39
  store <2 x i32> %32, ptr %31, align 8, !tbaa !39
  br label %33

33:                                               ; preds = %._crit_edge, %19, %26
  %34 = phi i32 [ %.pre, %._crit_edge ], [ %21, %19 ], [ %21, %26 ]
  %35 = getelementptr inbounds [4096 x %"struct.NCompress::NLZMA::COptimal"], ptr %5, i64 0, i64 %18
  %36 = getelementptr inbounds i8, ptr %35, i64 20
  %37 = load i32, ptr %36, align 4, !tbaa !34
  %38 = getelementptr inbounds i8, ptr %35, i64 16
  store i32 %.025, ptr %36, align 4, !tbaa !34
  store i32 %.0, ptr %38, align 8, !tbaa !32
  %.not = icmp eq i32 %.024, 0
  br i1 %.not, label %39, label %12, !llvm.loop !40

39:                                               ; preds = %33
  %40 = getelementptr inbounds i8, ptr %0, i64 76
  %41 = load i32, ptr %40, align 4, !tbaa !34
  store i32 %41, ptr %1, align 4, !tbaa !39
  %42 = getelementptr inbounds i8, ptr %0, i64 72
  %43 = load i32, ptr %42, align 8, !tbaa !32
  %44 = getelementptr inbounds i8, ptr %0, i64 207460
  store i32 %43, ptr %44, align 4, !tbaa !42
  ret i32 %43
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9NCompress5NLZMA8COptimal10MakeAsCharEv(ptr noundef nonnull align 4 dereferenceable(40)) local_unnamed_addr #0 align 2

attributes #0 = { 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" }

!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, !17, i64 207456}
!6 = !{!"_ZTSN9NCompress5NLZMA8CEncoderE", !7, i64 0, !9, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !16, i64 52, !14, i64 56, !18, i64 163896, !20, i64 163904, !14, i64 163984, !14, i64 164752, !14, i64 164800, !14, i64 164848, !14, i64 164896, !14, i64 164944, !14, i64 165712, !14, i64 166736, !25, i64 167192, !26, i64 167256, !26, i64 186788, !31, i64 206320, !14, i64 206344, !24, i64 207440, !24, i64 207441, !17, i64 207444, !17, i64 207448, !17, i64 207452, !17, i64 207456, !17, i64 207460, !24, i64 207464, !14, i64 207468, !14, i64 208492, !14, i64 210540, !17, i64 210604, !17, i64 210608, !17, i64 210612, !17, i64 210616, !17, i64 210620, !17, i64 210624, !17, i64 210628, !17, i64 210632, !17, i64 210636, !21, i64 210640, !21, i64 210648, !24, i64 210656, !19, i64 210664, !17, i64 210672, !24, i64 210676, !24, i64 210677}
!7 = !{!"_ZTS14ICompressCoder", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS21ICompressSetOutStream", !8, i64 0}
!10 = !{!"_ZTS27ICompressSetCoderProperties", !8, i64 0}
!11 = !{!"_ZTS29ICompressWriteCoderProperties", !8, i64 0}
!12 = !{!"_ZTSN9NCompress5NLZMA10CBaseStateE", !13, i64 0, !14, i64 1, !14, i64 4}
!13 = !{!"_ZTSN9NCompress5NLZMA6CStateE", !14, i64 0}
!14 = !{!"omnipotent char", !15, i64 0}
!15 = !{!"Simple C++ TBAA"}
!16 = !{!"_ZTS13CMyUnknownImp", !17, i64 0}
!17 = !{!"int", !14, i64 0}
!18 = !{!"_ZTS9CMyComPtrI12IMatchFinderE", !19, i64 0}
!19 = !{!"any pointer", !14, i64 0}
!20 = !{!"_ZTSN9NCompress11NRangeCoder8CEncoderE", !17, i64 0, !14, i64 4, !21, i64 8, !17, i64 16, !22, i64 24}
!21 = !{!"long long", !14, i64 0}
!22 = !{!"_ZTS10COutBuffer", !19, i64 0, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !23, i64 24, !21, i64 32, !19, i64 40, !24, i64 48}
!23 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !19, i64 0}
!24 = !{!"bool", !14, i64 0}
!25 = !{!"_ZTSN9NCompress11NRangeCoder15CBitTreeEncoderILi5ELi4EEE", !14, i64 0}
!26 = !{!"_ZTSN9NCompress5NLZMA7NLength18CPriceTableEncoderE", !27, i64 0, !14, i64 2056, !17, i64 19464, !14, i64 19468}
!27 = !{!"_ZTSN9NCompress5NLZMA7NLength8CEncoderE", !28, i64 0, !28, i64 4, !14, i64 8, !14, i64 520, !30, i64 1032}
!28 = !{!"_ZTSN9NCompress11NRangeCoder11CBitEncoderILi5EEE", !29, i64 0}
!29 = !{!"_ZTSN9NCompress11NRangeCoder9CBitModelILi5EEE", !17, i64 0}
!30 = !{!"_ZTSN9NCompress11NRangeCoder15CBitTreeEncoderILi5ELi8EEE", !14, i64 0}
!31 = !{!"_ZTSN9NCompress5NLZMA15CLiteralEncoderE", !19, i64 0, !17, i64 8, !17, i64 12, !17, i64 16}
!32 = !{!33, !17, i64 16}
!33 = !{!"_ZTSN9NCompress5NLZMA8COptimalE", !13, i64 0, !24, i64 1, !24, i64 2, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !14, i64 24}
!34 = !{!33, !17, i64 20}
!35 = !{!33, !24, i64 1}
!36 = !{i8 0, i8 2}
!37 = !{}
!38 = !{!33, !24, i64 2}
!39 = !{!17, !17, i64 0}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}
!42 = !{!6, !17, i64 207460}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass