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

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

%struct.ISzAlloc = type { ptr, ptr }
%struct.CLzma2DecMtProps = type { i64, i64, i32, i64, i64, i64 }
%struct.CSeqInStreamWrap = type { %struct.ISeqInStream, ptr, i32, i64 }
%struct.ISeqInStream = type { ptr }
%struct.CSeqOutStreamWrap = type { %struct.ISeqOutStream, ptr, i32, i64 }
%struct.ISeqOutStream = type { ptr }
%struct.CCompressProgressWrap = type { %struct.ICompressProgress, ptr, i32 }
%struct.ICompressProgress = type { ptr }
%"class.NCompress::NLzma2::CDecoder" = type { %struct.ICompressCoder, %struct.ICompressSetDecoderProperties2, %struct.ICompressSetFinishMode, %struct.ICompressGetInStreamProcessedSize, %struct.ICompressSetBufSize, %struct.ICompressSetInStream, %struct.ICompressSetOutStreamSize, %struct.ISequentialInStream, %struct.ICompressSetCoderMt, %struct.ICompressSetMemLimit, %class.CMyUnknownImp, ptr, i64, i8, i32, i32, i32, i32, i32, i64, %class.CMyComPtr, %struct.CSeqInStreamWrap }
%struct.ICompressCoder = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%struct.ICompressSetDecoderProperties2 = type { %struct.IUnknown }
%struct.ICompressSetFinishMode = type { %struct.IUnknown }
%struct.ICompressGetInStreamProcessedSize = type { %struct.IUnknown }
%struct.ICompressSetBufSize = type { %struct.IUnknown }
%struct.ICompressSetInStream = type { %struct.IUnknown }
%struct.ICompressSetOutStreamSize = type { %struct.IUnknown }
%struct.ISequentialInStream = type { %struct.IUnknown }
%struct.ICompressSetCoderMt = type { %struct.IUnknown }
%struct.ICompressSetMemLimit = type { %struct.IUnknown }
%class.CMyUnknownImp = type { i32 }
%class.CMyComPtr = type { ptr }

@g_Alloc = external global %struct.ISzAlloc, align 8
@g_MidAlloc = external global %struct.ISzAlloc, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9NCompress6NLzma28CDecoder4CodeEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) unnamed_addr #0 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 %struct.CLzma2DecMtProps, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca %struct.CSeqInStreamWrap, align 8
  %24 = alloca %struct.CSeqOutStreamWrap, align 8
  %25 = alloca %struct.CCompressProgressWrap, align 8
  %26 = alloca i32, align 4
  %27 = alloca i64, align 8
  %28 = alloca i32, align 4
  %29 = 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
  %30 = load ptr, ptr %8, align 8
  %31 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 12
  store i64 0, ptr %31, align 8, !tbaa !9
  %32 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 11
  %33 = load ptr, ptr %32, align 8, !tbaa !28
  %34 = icmp ne ptr %33, null
  br i1 %34, label %43, label %35

35:                                               ; preds = %6
  %36 = call ptr @Lzma2DecMt_Create(ptr noundef @g_Alloc, ptr noundef @g_MidAlloc)
  %37 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 11
  store ptr %36, ptr %37, align 8, !tbaa !28
  %38 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 11
  %39 = load ptr, ptr %38, align 8, !tbaa !28
  %40 = icmp ne ptr %39, null
  br i1 %40, label %42, label %41

41:                                               ; preds = %35
  store i32 -2147024882, ptr %7, align 4
  br label %215

42:                                               ; preds = %35
  br label %43

43:                                               ; preds = %42, %6
  call void @llvm.lifetime.start.p0(i64 48, ptr %14) #5
  call void @Lzma2DecMtProps_Init(ptr noundef %14)
  %44 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 15
  %45 = load i32, ptr %44, align 8, !tbaa !29
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 0
  store i64 %46, ptr %47, align 8, !tbaa !30
  %48 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 16
  %49 = load i32, ptr %48, align 4, !tbaa !33
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 1
  store i64 %50, ptr %51, align 8, !tbaa !34
  %52 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 2
  store i32 1, ptr %52, align 8, !tbaa !35
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %53 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 18
  %54 = load i32, ptr %53, align 4, !tbaa !36
  store i32 %54, ptr %15, align 4, !tbaa !37
  %55 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 17
  %56 = load i32, ptr %55, align 8, !tbaa !38
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %129

58:                                               ; preds = %43
  %59 = load i32, ptr %15, align 4, !tbaa !37
  %60 = icmp uge i32 %59, 1
  br i1 %60, label %61, label %129

61:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %62 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 19
  %63 = load i64, ptr %62, align 8, !tbaa !39
  store i64 %63, ptr %16, align 8, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %64 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 13
  %65 = load i8, ptr %64, align 8, !tbaa !41
  %66 = zext i8 %65 to i32
  %67 = icmp eq i32 %66, 40
  br i1 %67, label %68, label %69

68:                                               ; preds = %61
  br label %81

69:                                               ; preds = %61
  %70 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 13
  %71 = load i8, ptr %70, align 8, !tbaa !41
  %72 = zext i8 %71 to i32
  %73 = and i32 %72, 1
  %74 = or i32 2, %73
  %75 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 13
  %76 = load i8, ptr %75, align 8, !tbaa !41
  %77 = zext i8 %76 to i32
  %78 = sdiv i32 %77, 2
  %79 = add nsw i32 %78, 11
  %80 = shl i32 %74, %79
  br label %81

81:                                               ; preds = %69, %68
  %82 = phi i32 [ -1, %68 ], [ %80, %69 ]
  store i32 %82, ptr %17, align 4, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %83 = load i32, ptr %17, align 4, !tbaa !37
  %84 = call noundef i64 @_ZN9NCompress6NLzma2L31Get_ExpectedBlockSize_From_DictEj(i32 noundef %83)
  store i64 %84, ptr %18, align 8, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %85 = load i64, ptr %18, align 8, !tbaa !40
  store i64 %85, ptr %19, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %86 = load i64, ptr %19, align 8, !tbaa !42
  %87 = load i64, ptr %19, align 8, !tbaa !42
  %88 = udiv i64 %87, 16
  %89 = add i64 %86, %88
  store i64 %89, ptr %20, align 8, !tbaa !42
  %90 = load i64, ptr %19, align 8, !tbaa !42
  %91 = load i64, ptr %18, align 8, !tbaa !40
  %92 = icmp eq i64 %90, %91
  br i1 %92, label %93, label %128

93:                                               ; preds = %81
  %94 = load i64, ptr %20, align 8, !tbaa !42
  %95 = load i64, ptr %19, align 8, !tbaa !42
  %96 = icmp uge i64 %94, %95
  br i1 %96, label %97, label %128

97:                                               ; preds = %93
  %98 = load i64, ptr %19, align 8, !tbaa !42
  %99 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 4
  store i64 %98, ptr %99, align 8, !tbaa !43
  %100 = load i64, ptr %20, align 8, !tbaa !42
  %101 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 5
  store i64 %100, ptr %101, align 8, !tbaa !44
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %102 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 3
  %103 = load i64, ptr %102, align 8, !tbaa !45
  %104 = add i64 %103, 65536
  store i64 %104, ptr %21, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %105 = load i64, ptr %16, align 8, !tbaa !40
  %106 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 4
  %107 = load i64, ptr %106, align 8, !tbaa !43
  %108 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 5
  %109 = load i64, ptr %108, align 8, !tbaa !44
  %110 = add i64 %107, %109
  %111 = load i64, ptr %21, align 8, !tbaa !42
  %112 = add i64 %110, %111
  %113 = udiv i64 %105, %112
  store i64 %113, ptr %22, align 8, !tbaa !40
  %114 = load i32, ptr %15, align 4, !tbaa !37
  %115 = zext i32 %114 to i64
  %116 = load i64, ptr %22, align 8, !tbaa !40
  %117 = icmp ugt i64 %115, %116
  br i1 %117, label %118, label %121

118:                                              ; preds = %97
  %119 = load i64, ptr %22, align 8, !tbaa !40
  %120 = trunc i64 %119 to i32
  store i32 %120, ptr %15, align 4, !tbaa !37
  br label %121

121:                                              ; preds = %118, %97
  %122 = load i32, ptr %15, align 4, !tbaa !37
  %123 = icmp eq i32 %122, 0
  br i1 %123, label %124, label %125

124:                                              ; preds = %121
  store i32 1, ptr %15, align 4, !tbaa !37
  br label %125

125:                                              ; preds = %124, %121
  %126 = load i32, ptr %15, align 4, !tbaa !37
  %127 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 2
  store i32 %126, ptr %127, align 8, !tbaa !35
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %128

128:                                              ; preds = %125, %93, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %129

129:                                              ; preds = %128, %58, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %25) #5
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN16CSeqInStreamWrap4InitEP19ISequentialInStream(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef %130) #5
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN17CSeqOutStreamWrap4InitEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef %131) #5
  %132 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZN21CCompressProgressWrap4InitEP21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(24) %25, ptr noundef %132) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  store i64 0, ptr %27, align 8, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  store i32 0, ptr %28, align 4, !tbaa !37
  %133 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 17
  %134 = load i32, ptr %133, align 8, !tbaa !38
  store i32 %134, ptr %28, align 4, !tbaa !37
  %135 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 11
  %136 = load ptr, ptr %135, align 8, !tbaa !28
  %137 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 13
  %138 = load i8, ptr %137, align 8, !tbaa !41
  %139 = getelementptr inbounds %struct.CSeqOutStreamWrap, ptr %24, i32 0, i32 0
  %140 = load ptr, ptr %12, align 8, !tbaa !5
  %141 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 14
  %142 = load i32, ptr %141, align 4, !tbaa !46
  %143 = getelementptr inbounds %struct.CSeqInStreamWrap, ptr %23, i32 0, i32 0
  %144 = load ptr, ptr %13, align 8, !tbaa !5
  %145 = icmp ne ptr %144, null
  br i1 %145, label %146, label %148

146:                                              ; preds = %129
  %147 = getelementptr inbounds %struct.CCompressProgressWrap, ptr %25, i32 0, i32 0
  br label %149

148:                                              ; preds = %129
  br label %149

149:                                              ; preds = %148, %146
  %150 = phi ptr [ %147, %146 ], [ null, %148 ]
  %151 = call i32 @Lzma2DecMt_Decode(ptr noundef %136, i8 noundef zeroext %138, ptr noundef %14, ptr noundef %139, ptr noundef %140, i32 noundef %142, ptr noundef %143, ptr noundef %27, ptr noundef %28, ptr noundef %150)
  store i32 %151, ptr %26, align 4, !tbaa !37
  %152 = getelementptr inbounds %struct.CLzma2DecMtProps, ptr %14, i32 0, i32 2
  %153 = load i32, ptr %152, align 8, !tbaa !35
  %154 = icmp ugt i32 %153, 1
  br i1 %154, label %155, label %158

155:                                              ; preds = %149
  %156 = load i32, ptr %28, align 4, !tbaa !37
  %157 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 17
  store i32 %156, ptr %157, align 8, !tbaa !38
  br label %158

158:                                              ; preds = %155, %149
  %159 = load i64, ptr %27, align 8, !tbaa !40
  %160 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 12
  store i64 %159, ptr %160, align 8, !tbaa !9
  %161 = getelementptr inbounds %struct.CCompressProgressWrap, ptr %25, i32 0, i32 2
  %162 = load i32, ptr %161, align 8, !tbaa !47
  %163 = icmp ne i32 %162, 0
  br i1 %163, label %164, label %167

164:                                              ; preds = %158
  %165 = getelementptr inbounds %struct.CCompressProgressWrap, ptr %25, i32 0, i32 2
  %166 = load i32, ptr %165, align 8, !tbaa !47
  store i32 %166, ptr %7, align 4
  store i32 1, ptr %29, align 4
  br label %214

167:                                              ; preds = %158
  %168 = getelementptr inbounds %struct.CSeqOutStreamWrap, ptr %24, i32 0, i32 2
  %169 = load i32, ptr %168, align 8, !tbaa !50
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %171, label %174

171:                                              ; preds = %167
  %172 = getelementptr inbounds %struct.CSeqOutStreamWrap, ptr %24, i32 0, i32 2
  %173 = load i32, ptr %172, align 8, !tbaa !50
  store i32 %173, ptr %7, align 4
  store i32 1, ptr %29, align 4
  br label %214

174:                                              ; preds = %167
  %175 = getelementptr inbounds %struct.CSeqInStreamWrap, ptr %23, i32 0, i32 2
  %176 = load i32, ptr %175, align 8, !tbaa !53
  %177 = icmp ne i32 %176, 0
  br i1 %177, label %178, label %184

178:                                              ; preds = %174
  %179 = load i32, ptr %26, align 4, !tbaa !37
  %180 = icmp eq i32 %179, 8
  br i1 %180, label %181, label %184

181:                                              ; preds = %178
  %182 = getelementptr inbounds %struct.CSeqInStreamWrap, ptr %23, i32 0, i32 2
  %183 = load i32, ptr %182, align 8, !tbaa !53
  store i32 %183, ptr %7, align 4
  store i32 1, ptr %29, align 4
  br label %214

184:                                              ; preds = %178, %174
  %185 = load i32, ptr %26, align 4, !tbaa !37
  %186 = icmp eq i32 %185, 0
  br i1 %186, label %187, label %211

187:                                              ; preds = %184
  %188 = getelementptr inbounds %"class.NCompress::NLzma2::CDecoder", ptr %30, i32 0, i32 14
  %189 = load i32, ptr %188, align 4, !tbaa !46
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %191, label %211

191:                                              ; preds = %187
  %192 = load ptr, ptr %11, align 8, !tbaa !5
  %193 = icmp ne ptr %192, null
  br i1 %193, label %194, label %200

194:                                              ; preds = %191
  %195 = load ptr, ptr %11, align 8, !tbaa !5
  %196 = load i64, ptr %195, align 8, !tbaa !40
  %197 = load i64, ptr %27, align 8, !tbaa !40
  %198 = icmp ne i64 %196, %197
  br i1 %198, label %199, label %200

199:                                              ; preds = %194
  store i32 1, ptr %26, align 4, !tbaa !37
  br label %200

200:                                              ; preds = %199, %194, %191
  %201 = load ptr, ptr %12, align 8, !tbaa !5
  %202 = icmp ne ptr %201, null
  br i1 %202, label %203, label %210

203:                                              ; preds = %200
  %204 = load ptr, ptr %12, align 8, !tbaa !5
  %205 = load i64, ptr %204, align 8, !tbaa !40
  %206 = getelementptr inbounds %struct.CSeqOutStreamWrap, ptr %24, i32 0, i32 3
  %207 = load i64, ptr %206, align 8, !tbaa !54
  %208 = icmp ne i64 %205, %207
  br i1 %208, label %209, label %210

209:                                              ; preds = %203
  store i32 1, ptr %26, align 4, !tbaa !37
  br label %210

210:                                              ; preds = %209, %203, %200
  br label %211

211:                                              ; preds = %210, %187, %184
  %212 = load i32, ptr %26, align 4, !tbaa !37
  %213 = call noundef i32 @_Z13SResToHRESULTi(i32 noundef %212) #5
  store i32 %213, ptr %7, align 4
  store i32 1, ptr %29, align 4
  br label %214

214:                                              ; preds = %211, %181, %171, %164
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #5
  br label %215

215:                                              ; preds = %214, %41
  %216 = load i32, ptr %7, align 4
  ret i32 %216
}

declare ptr @Lzma2DecMt_Create(ptr noundef, ptr noundef) #1

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

declare void @Lzma2DecMtProps_Init(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN9NCompress6NLzma2L31Get_ExpectedBlockSize_From_DictEj(i32 noundef) #3

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

; Function Attrs: nounwind
declare void @_ZN16CSeqInStreamWrap4InitEP19ISequentialInStream(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #4

; Function Attrs: nounwind
declare void @_ZN17CSeqOutStreamWrap4InitEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #4

; Function Attrs: nounwind
declare void @_ZN21CCompressProgressWrap4InitEP21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #4

declare i32 @Lzma2DecMt_Decode(ptr noundef, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare noundef i32 @_Z13SResToHRESULTi(i32 noundef) #4

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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, !24, i64 96}
!10 = !{!"_ZTSN9NCompress6NLzma28CDecoderE", !11, i64 0, !13, i64 8, !14, i64 16, !15, i64 24, !16, i64 32, !17, i64 40, !18, i64 48, !19, i64 56, !20, i64 64, !21, i64 72, !22, i64 80, !6, i64 88, !24, i64 96, !7, i64 104, !23, i64 108, !23, i64 112, !23, i64 116, !23, i64 120, !23, i64 124, !24, i64 128, !25, i64 136, !26, i64 144}
!11 = !{!"_ZTS14ICompressCoder", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS30ICompressSetDecoderProperties2", !12, i64 0}
!14 = !{!"_ZTS22ICompressSetFinishMode", !12, i64 0}
!15 = !{!"_ZTS33ICompressGetInStreamProcessedSize", !12, i64 0}
!16 = !{!"_ZTS19ICompressSetBufSize", !12, i64 0}
!17 = !{!"_ZTS20ICompressSetInStream", !12, i64 0}
!18 = !{!"_ZTS25ICompressSetOutStreamSize", !12, i64 0}
!19 = !{!"_ZTS19ISequentialInStream", !12, i64 0}
!20 = !{!"_ZTS19ICompressSetCoderMt", !12, i64 0}
!21 = !{!"_ZTS20ICompressSetMemLimit", !12, i64 0}
!22 = !{!"_ZTS13CMyUnknownImp", !23, i64 0}
!23 = !{!"int", !7, i64 0}
!24 = !{!"long long", !7, i64 0}
!25 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !6, i64 0}
!26 = !{!"_ZTS16CSeqInStreamWrap", !27, i64 0, !6, i64 8, !23, i64 16, !24, i64 24}
!27 = !{!"_ZTS12ISeqInStream", !6, i64 0}
!28 = !{!10, !6, i64 88}
!29 = !{!10, !23, i64 112}
!30 = !{!31, !32, i64 0}
!31 = !{!"_ZTS16CLzma2DecMtProps", !32, i64 0, !32, i64 8, !23, i64 16, !32, i64 24, !32, i64 32, !32, i64 40}
!32 = !{!"long", !7, i64 0}
!33 = !{!10, !23, i64 116}
!34 = !{!31, !32, i64 8}
!35 = !{!31, !23, i64 16}
!36 = !{!10, !23, i64 124}
!37 = !{!23, !23, i64 0}
!38 = !{!10, !23, i64 120}
!39 = !{!10, !24, i64 128}
!40 = !{!24, !24, i64 0}
!41 = !{!10, !7, i64 104}
!42 = !{!32, !32, i64 0}
!43 = !{!31, !32, i64 32}
!44 = !{!31, !32, i64 40}
!45 = !{!31, !32, i64 24}
!46 = !{!10, !23, i64 108}
!47 = !{!48, !23, i64 16}
!48 = !{!"_ZTS21CCompressProgressWrap", !49, i64 0, !6, i64 8, !23, i64 16}
!49 = !{!"_ZTS17ICompressProgress", !6, i64 0}
!50 = !{!51, !23, i64 16}
!51 = !{!"_ZTS17CSeqOutStreamWrap", !52, i64 0, !6, i64 8, !23, i64 16, !24, i64 24}
!52 = !{!"_ZTS13ISeqOutStream", !6, i64 0}
!53 = !{!26, !23, i64 16}
!54 = !{!51, !24, i64 24}


; 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.ISzAlloc = type { ptr, ptr }
%struct.CLzma2DecMtProps = type { i64, i64, i32, i64, i64, i64 }
%struct.CSeqInStreamWrap = type { %struct.ISeqInStream, ptr, i32, i64 }
%struct.ISeqInStream = type { ptr }
%struct.CSeqOutStreamWrap = type { %struct.ISeqOutStream, ptr, i32, i64 }
%struct.ISeqOutStream = type { ptr }
%struct.CCompressProgressWrap = type { %struct.ICompressProgress, ptr, i32 }
%struct.ICompressProgress = type { ptr }

@g_Alloc = external global %struct.ISzAlloc, align 8
@g_MidAlloc = external global %struct.ISzAlloc, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9NCompress6NLzma28CDecoder4CodeEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr nocapture noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1, ptr noundef %2, ptr noundef readonly %3, ptr noundef %4, ptr noundef %5) unnamed_addr #0 align 2 {
  %7 = alloca %struct.CLzma2DecMtProps, align 16
  %8 = alloca %struct.CSeqInStreamWrap, align 8
  %9 = alloca %struct.CSeqOutStreamWrap, align 8
  %10 = alloca %struct.CCompressProgressWrap, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = getelementptr inbounds i8, ptr %0, i64 96
  store i64 0, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 88
  %15 = load ptr, ptr %14, align 8, !tbaa !27
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %16, label %18

16:                                               ; preds = %6
  %17 = tail call ptr @Lzma2DecMt_Create(ptr noundef nonnull @g_Alloc, ptr noundef nonnull @g_MidAlloc)
  store ptr %17, ptr %14, align 8, !tbaa !27
  %.not49 = icmp eq ptr %17, null
  br i1 %.not49, label %99, label %18

18:                                               ; preds = %16, %6
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #6
  call void @Lzma2DecMtProps_Init(ptr noundef nonnull %7)
  %19 = getelementptr inbounds i8, ptr %0, i64 112
  %20 = load <2 x i32>, ptr %19, align 8, !tbaa !28
  %21 = zext <2 x i32> %20 to <2 x i64>
  store <2 x i64> %21, ptr %7, align 16, !tbaa !29
  %22 = getelementptr inbounds i8, ptr %7, i64 16
  store i32 1, ptr %22, align 16, !tbaa !31
  %23 = getelementptr inbounds i8, ptr %0, i64 124
  %24 = load i32, ptr %23, align 4, !tbaa !33
  %25 = getelementptr inbounds i8, ptr %0, i64 120
  %26 = load i32, ptr %25, align 8, !tbaa !34
  %27 = icmp ne i32 %26, 0
  %28 = icmp ne i32 %24, 0
  %or.cond = select i1 %27, i1 %28, i1 false
  br i1 %or.cond, label %29, label %59

29:                                               ; preds = %18
  %30 = getelementptr inbounds i8, ptr %0, i64 128
  %31 = load i64, ptr %30, align 8, !tbaa !35
  %32 = getelementptr inbounds i8, ptr %0, i64 104
  %33 = load i8, ptr %32, align 8, !tbaa !36
  %34 = icmp eq i8 %33, 40
  br i1 %34, label %42, label %35

35:                                               ; preds = %29
  %36 = zext i8 %33 to i32
  %37 = and i32 %36, 1
  %38 = or disjoint i32 %37, 2
  %39 = lshr i32 %36, 1
  %40 = add nuw nsw i32 %39, 11
  %41 = shl i32 %38, %40
  br label %42

42:                                               ; preds = %29, %35
  %43 = phi i32 [ %41, %35 ], [ -1, %29 ]
  %44 = call noundef i64 @_ZN9NCompress6NLzma2L31Get_ExpectedBlockSize_From_DictEj(i32 noundef %43)
  %45 = lshr i64 %44, 4
  %46 = add i64 %45, %44
  %.not50 = icmp ult i64 %46, %44
  br i1 %.not50, label %59, label %47

47:                                               ; preds = %42
  %48 = getelementptr inbounds i8, ptr %7, i64 32
  store i64 %44, ptr %48, align 16, !tbaa !37
  %49 = getelementptr inbounds i8, ptr %7, i64 40
  store i64 %46, ptr %49, align 8, !tbaa !38
  %50 = getelementptr inbounds i8, ptr %7, i64 24
  %51 = load i64, ptr %50, align 8, !tbaa !39
  %52 = add i64 %44, 65536
  %53 = add i64 %52, %46
  %54 = add i64 %53, %51
  %55 = udiv i64 %31, %54
  %56 = zext i32 %24 to i64
  %57 = icmp ult i64 %55, %56
  %58 = trunc nuw i64 %55 to i32
  %spec.select = select i1 %57, i32 %58, i32 %24
  %spec.store.select = call i32 @llvm.umax.i32(i32 %spec.select, i32 1)
  store i32 %spec.store.select, ptr %22, align 16, !tbaa !31
  br label %59

59:                                               ; preds = %42, %47, %18
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #6
  call void @_ZN16CSeqInStreamWrap4InitEP19ISequentialInStream(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef %1) #6
  call void @_ZN17CSeqOutStreamWrap4InitEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef %2) #6
  call void @_ZN21CCompressProgressWrap4InitEP21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  store i64 0, ptr %11, align 8, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  %60 = load i32, ptr %25, align 8, !tbaa !34
  store i32 %60, ptr %12, align 4, !tbaa !28
  %61 = load ptr, ptr %14, align 8, !tbaa !27
  %62 = getelementptr inbounds i8, ptr %0, i64 104
  %63 = load i8, ptr %62, align 8, !tbaa !36
  %64 = getelementptr inbounds i8, ptr %0, i64 108
  %65 = load i32, ptr %64, align 4, !tbaa !41
  %.not51 = icmp eq ptr %5, null
  %66 = select i1 %.not51, ptr null, ptr %10
  %67 = call i32 @Lzma2DecMt_Decode(ptr noundef %61, i8 noundef zeroext %63, ptr noundef nonnull %7, ptr noundef nonnull %9, ptr noundef %4, i32 noundef %65, ptr noundef nonnull %8, ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef %66)
  %68 = load i32, ptr %22, align 16, !tbaa !31
  %69 = icmp ugt i32 %68, 1
  br i1 %69, label %70, label %72

70:                                               ; preds = %59
  %71 = load i32, ptr %12, align 4, !tbaa !28
  store i32 %71, ptr %25, align 8, !tbaa !34
  br label %72

72:                                               ; preds = %70, %59
  %73 = load i64, ptr %11, align 8, !tbaa !40
  store i64 %73, ptr %13, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %10, i64 16
  %75 = load i32, ptr %74, align 8, !tbaa !42
  %.not52 = icmp eq i32 %75, 0
  br i1 %.not52, label %76, label %98

76:                                               ; preds = %72
  %77 = getelementptr inbounds i8, ptr %9, i64 16
  %78 = load i32, ptr %77, align 8, !tbaa !45
  %.not53 = icmp eq i32 %78, 0
  br i1 %.not53, label %79, label %98

79:                                               ; preds = %76
  %80 = getelementptr inbounds i8, ptr %8, i64 16
  %81 = load i32, ptr %80, align 8, !tbaa !48
  %82 = icmp ne i32 %81, 0
  %83 = icmp eq i32 %67, 8
  %or.cond3 = select i1 %82, i1 %83, i1 false
  br i1 %or.cond3, label %98, label %84

84:                                               ; preds = %79
  %85 = icmp eq i32 %67, 0
  br i1 %85, label %86, label %96

86:                                               ; preds = %84
  %87 = load i32, ptr %64, align 4, !tbaa !41
  %.not54 = icmp eq i32 %87, 0
  br i1 %.not54, label %96, label %88

88:                                               ; preds = %86
  %.not55 = icmp eq ptr %3, null
  br i1 %.not55, label %91, label %89

89:                                               ; preds = %88
  %90 = load i64, ptr %3, align 8, !tbaa !40
  %.not56 = icmp ne i64 %90, %73
  %spec.select59 = zext i1 %.not56 to i32
  br label %91

91:                                               ; preds = %89, %88
  %.0 = phi i32 [ 0, %88 ], [ %spec.select59, %89 ]
  %.not57 = icmp eq ptr %4, null
  br i1 %.not57, label %96, label %92

92:                                               ; preds = %91
  %93 = load i64, ptr %4, align 8, !tbaa !40
  %94 = getelementptr inbounds i8, ptr %9, i64 24
  %95 = load i64, ptr %94, align 8, !tbaa !49
  %.not58 = icmp eq i64 %93, %95
  %spec.select60 = select i1 %.not58, i32 %.0, i32 1
  br label %96

96:                                               ; preds = %92, %91, %86, %84
  %.1 = phi i32 [ %.0, %91 ], [ 0, %86 ], [ %67, %84 ], [ %spec.select60, %92 ]
  %97 = call noundef i32 @_Z13SResToHRESULTi(i32 noundef %.1) #6
  br label %98

98:                                               ; preds = %79, %76, %72, %96
  %.034 = phi i32 [ %97, %96 ], [ %75, %72 ], [ %78, %76 ], [ %81, %79 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #6
  br label %99

99:                                               ; preds = %16, %98
  %.135 = phi i32 [ %.034, %98 ], [ -2147024882, %16 ]
  ret i32 %.135
}

declare ptr @Lzma2DecMt_Create(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @Lzma2DecMtProps_Init(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN9NCompress6NLzma2L31Get_ExpectedBlockSize_From_DictEj(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind
declare void @_ZN16CSeqInStreamWrap4InitEP19ISequentialInStream(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare void @_ZN17CSeqOutStreamWrap4InitEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare void @_ZN21CCompressProgressWrap4InitEP21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #4

declare i32 @Lzma2DecMt_Decode(ptr noundef, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare noundef i32 @_Z13SResToHRESULTi(i32 noundef) local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #5

attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !23, i64 96}
!6 = !{!"_ZTSN9NCompress6NLzma28CDecoderE", !7, i64 0, !9, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !13, i64 40, !14, i64 48, !15, i64 56, !16, i64 64, !17, i64 72, !18, i64 80, !22, i64 88, !23, i64 96, !20, i64 104, !19, i64 108, !19, i64 112, !19, i64 116, !19, i64 120, !19, i64 124, !23, i64 128, !24, i64 136, !25, i64 144}
!7 = !{!"_ZTS14ICompressCoder", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS30ICompressSetDecoderProperties2", !8, i64 0}
!10 = !{!"_ZTS22ICompressSetFinishMode", !8, i64 0}
!11 = !{!"_ZTS33ICompressGetInStreamProcessedSize", !8, i64 0}
!12 = !{!"_ZTS19ICompressSetBufSize", !8, i64 0}
!13 = !{!"_ZTS20ICompressSetInStream", !8, i64 0}
!14 = !{!"_ZTS25ICompressSetOutStreamSize", !8, i64 0}
!15 = !{!"_ZTS19ISequentialInStream", !8, i64 0}
!16 = !{!"_ZTS19ICompressSetCoderMt", !8, i64 0}
!17 = !{!"_ZTS20ICompressSetMemLimit", !8, i64 0}
!18 = !{!"_ZTS13CMyUnknownImp", !19, i64 0}
!19 = !{!"int", !20, i64 0}
!20 = !{!"omnipotent char", !21, i64 0}
!21 = !{!"Simple C++ TBAA"}
!22 = !{!"any pointer", !20, i64 0}
!23 = !{!"long long", !20, i64 0}
!24 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !22, i64 0}
!25 = !{!"_ZTS16CSeqInStreamWrap", !26, i64 0, !22, i64 8, !19, i64 16, !23, i64 24}
!26 = !{!"_ZTS12ISeqInStream", !22, i64 0}
!27 = !{!6, !22, i64 88}
!28 = !{!19, !19, i64 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"long", !20, i64 0}
!31 = !{!32, !19, i64 16}
!32 = !{!"_ZTS16CLzma2DecMtProps", !30, i64 0, !30, i64 8, !19, i64 16, !30, i64 24, !30, i64 32, !30, i64 40}
!33 = !{!6, !19, i64 124}
!34 = !{!6, !19, i64 120}
!35 = !{!6, !23, i64 128}
!36 = !{!6, !20, i64 104}
!37 = !{!32, !30, i64 32}
!38 = !{!32, !30, i64 40}
!39 = !{!32, !30, i64 24}
!40 = !{!23, !23, i64 0}
!41 = !{!6, !19, i64 108}
!42 = !{!43, !19, i64 16}
!43 = !{!"_ZTS21CCompressProgressWrap", !44, i64 0, !22, i64 8, !19, i64 16}
!44 = !{!"_ZTS17ICompressProgress", !22, i64 0}
!45 = !{!46, !19, i64 16}
!46 = !{!"_ZTS17CSeqOutStreamWrap", !47, i64 0, !22, i64 8, !19, i64 16, !23, i64 24}
!47 = !{!"_ZTS13ISeqOutStream", !22, i64 0}
!48 = !{!25, !19, i64 16}
!49 = !{!46, !23, i64 24}


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