; LLVM IR from mncoppola/rpef :: utilities_src/squashfs4.2/lzma465/CPP/7zip/Compress (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" = type <{ %struct.ICompressCoder, %struct.ICompressSetDecoderProperties2, %struct.ICompressGetInStreamProcessedSize, %struct.ICompressSetInStream, %struct.ICompressSetOutStreamSize, %struct.ISequentialInStream, %class.CMyUnknownImp, [4 x i8], %class.CMyComPtr, ptr, i32, i32, %struct.CLzmaDec, i8, [7 x i8], i64, i64, i64, i8, [7 x i8] }>
%struct.ICompressCoder = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%struct.ICompressSetDecoderProperties2 = type { %struct.IUnknown }
%struct.ICompressGetInStreamProcessedSize = type { %struct.IUnknown }
%struct.ICompressSetInStream = type { %struct.IUnknown }
%struct.ICompressSetOutStreamSize = type { %struct.IUnknown }
%struct.ISequentialInStream = type { %struct.IUnknown }
%class.CMyUnknownImp = type { i32 }
%class.CMyComPtr = type { ptr }
%struct.CLzmaDec = type { %struct._CLzmaProps, ptr, ptr, ptr, i32, i32, i64, i64, i32, i32, i32, [4 x i32], i32, i32, i32, i32, i32, [20 x i8] }
%struct._CLzmaProps = type { i32, i32, i32, i32 }

; 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 @_ZN9NCompress5NLzma8CDecoder4CodeEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(249) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) unnamed_addr #1 align 2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, 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
  %23 = alloca i32, align 4
  %24 = alloca i64, align 8
  %25 = alloca i8, align 1
  %26 = alloca i8, align 1
  %27 = alloca i32, align 4
  %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::NLzma::CDecoder", ptr %30, i32 0, i32 9
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %6
  store i32 1, ptr %7, align 4
  br label %243

35:                                               ; preds = %6
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = load ptr, ptr %30, align 8, !tbaa !26
  %38 = getelementptr inbounds ptr, ptr %37, i64 10
  %39 = load ptr, ptr %38, align 8
  %40 = call noundef i32 %39(ptr noundef nonnull align 8 dereferenceable(249) %30, ptr noundef %36)
  br label %41

41:                                               ; preds = %242, %35
  %42 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 10
  %43 = load i32, ptr %42, align 8, !tbaa !28
  %44 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 11
  %45 = load i32, ptr %44, align 4, !tbaa !29
  %46 = icmp eq i32 %43, %45
  br i1 %46, label %47, label %66

47:                                               ; preds = %41
  %48 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 11
  store i32 0, ptr %48, align 4, !tbaa !29
  %49 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 10
  store i32 0, ptr %49, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 9
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 11
  %54 = load ptr, ptr %50, align 8, !tbaa !26
  %55 = getelementptr inbounds ptr, ptr %54, i64 5
  %56 = load ptr, ptr %55, align 8
  %57 = call noundef i32 %56(ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef %52, i32 noundef 1048576, ptr noundef %53)
  store i32 %57, ptr %14, align 4, !tbaa !30
  %58 = load i32, ptr %14, align 4, !tbaa !30
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %47
  %61 = load i32, ptr %14, align 4, !tbaa !30
  store i32 %61, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %63

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

63:                                               ; preds = %62, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %64 = load i32, ptr %15, align 4
  switch i32 %64, label %245 [
    i32 0, label %65
    i32 1, label %243
  ]

65:                                               ; preds = %63
  br label %66

66:                                               ; preds = %65, %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %67 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %68 = getelementptr inbounds %struct.CLzmaDec, ptr %67, i32 0, i32 6
  %69 = load i64, ptr %68, align 8, !tbaa !31
  store i64 %69, ptr %16, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %70 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %71 = getelementptr inbounds %struct.CLzmaDec, ptr %70, i32 0, i32 7
  %72 = load i64, ptr %71, align 8, !tbaa !33
  %73 = load i64, ptr %16, align 8, !tbaa !32
  %74 = sub i64 %72, %73
  store i64 %74, ptr %17, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  store i32 4194304, ptr %18, align 4, !tbaa !30
  %75 = load i64, ptr %17, align 8, !tbaa !32
  %76 = icmp ugt i64 %75, 4194304
  br i1 %76, label %77, label %78

77:                                               ; preds = %66
  store i64 4194304, ptr %17, align 8, !tbaa !32
  br label %78

78:                                               ; preds = %77, %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  store i32 0, ptr %19, align 4, !tbaa !34
  %79 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 13
  %80 = load i8, ptr %79, align 8, !tbaa !36, !range !37, !noundef !38
  %81 = trunc i8 %80 to i1
  br i1 %81, label %82, label %99

82:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %83 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 15
  %84 = load i64, ptr %83, align 8, !tbaa !39
  %85 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 17
  %86 = load i64, ptr %85, align 8, !tbaa !40
  %87 = sub i64 %84, %86
  store i64 %87, ptr %20, align 8, !tbaa !41
  %88 = load i64, ptr %20, align 8, !tbaa !41
  %89 = load i64, ptr %17, align 8, !tbaa !32
  %90 = icmp ult i64 %88, %89
  br i1 %90, label %91, label %98

91:                                               ; preds = %82
  %92 = load i64, ptr %20, align 8, !tbaa !41
  store i64 %92, ptr %17, align 8, !tbaa !32
  %93 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 18
  %94 = load i8, ptr %93, align 8, !tbaa !42, !range !37, !noundef !38
  %95 = trunc i8 %94 to i1
  br i1 %95, label %96, label %97

96:                                               ; preds = %91
  store i32 1, ptr %19, align 4, !tbaa !34
  br label %97

97:                                               ; preds = %96, %91
  br label %98

98:                                               ; preds = %97, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  br label %99

99:                                               ; preds = %98, %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %100 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 11
  %101 = load i32, ptr %100, align 4, !tbaa !29
  %102 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 10
  %103 = load i32, ptr %102, align 8, !tbaa !28
  %104 = sub i32 %101, %103
  %105 = zext i32 %104 to i64
  store i64 %105, ptr %21, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %106 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %107 = load i64, ptr %16, align 8, !tbaa !32
  %108 = load i64, ptr %17, align 8, !tbaa !32
  %109 = add i64 %107, %108
  %110 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 9
  %111 = load ptr, ptr %110, align 8, !tbaa !9
  %112 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 10
  %113 = load i32, ptr %112, align 8, !tbaa !28
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds i8, ptr %111, i64 %114
  %116 = load i32, ptr %19, align 4, !tbaa !34
  %117 = call i32 @LzmaDec_DecodeToDic(ptr noundef %106, i64 noundef %109, ptr noundef %115, ptr noundef %21, i32 noundef %116, ptr noundef %22)
  store i32 %117, ptr %23, align 4, !tbaa !30
  %118 = load i64, ptr %21, align 8, !tbaa !32
  %119 = trunc i64 %118 to i32
  %120 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 10
  %121 = load i32, ptr %120, align 8, !tbaa !28
  %122 = add i32 %121, %119
  store i32 %122, ptr %120, align 8, !tbaa !28
  %123 = load i64, ptr %21, align 8, !tbaa !32
  %124 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 16
  %125 = load i64, ptr %124, align 8, !tbaa !43
  %126 = add i64 %125, %123
  store i64 %126, ptr %124, align 8, !tbaa !43
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #3
  %127 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %128 = getelementptr inbounds %struct.CLzmaDec, ptr %127, i32 0, i32 6
  %129 = load i64, ptr %128, align 8, !tbaa !31
  %130 = load i64, ptr %16, align 8, !tbaa !32
  %131 = sub i64 %129, %130
  store i64 %131, ptr %24, align 8, !tbaa !32
  %132 = load i64, ptr %24, align 8, !tbaa !32
  %133 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 17
  %134 = load i64, ptr %133, align 8, !tbaa !40
  %135 = add i64 %134, %132
  store i64 %135, ptr %133, align 8, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 1, ptr %25) #3
  %136 = load i64, ptr %21, align 8, !tbaa !32
  %137 = icmp eq i64 %136, 0
  br i1 %137, label %138, label %141

138:                                              ; preds = %99
  %139 = load i64, ptr %24, align 8, !tbaa !32
  %140 = icmp eq i64 %139, 0
  br label %141

141:                                              ; preds = %138, %99
  %142 = phi i1 [ false, %99 ], [ %140, %138 ]
  %143 = zext i1 %142 to i8
  store i8 %143, ptr %25, align 1, !tbaa !44
  call void @llvm.lifetime.start.p0(i64 1, ptr %26) #3
  %144 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 13
  %145 = load i8, ptr %144, align 8, !tbaa !36, !range !37, !noundef !38
  %146 = trunc i8 %145 to i1
  br i1 %146, label %147, label %153

147:                                              ; preds = %141
  %148 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 17
  %149 = load i64, ptr %148, align 8, !tbaa !40
  %150 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 15
  %151 = load i64, ptr %150, align 8, !tbaa !39
  %152 = icmp uge i64 %149, %151
  br label %153

153:                                              ; preds = %147, %141
  %154 = phi i1 [ false, %141 ], [ %152, %147 ]
  %155 = zext i1 %154 to i8
  store i8 %155, ptr %26, align 1, !tbaa !44
  %156 = load i32, ptr %23, align 4, !tbaa !30
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %172, label %158

158:                                              ; preds = %153
  %159 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %160 = getelementptr inbounds %struct.CLzmaDec, ptr %159, i32 0, i32 6
  %161 = load i64, ptr %160, align 8, !tbaa !31
  %162 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %163 = getelementptr inbounds %struct.CLzmaDec, ptr %162, i32 0, i32 7
  %164 = load i64, ptr %163, align 8, !tbaa !33
  %165 = icmp eq i64 %161, %164
  br i1 %165, label %172, label %166

166:                                              ; preds = %158
  %167 = load i8, ptr %25, align 1, !tbaa !44, !range !37, !noundef !38
  %168 = trunc i8 %167 to i1
  br i1 %168, label %172, label %169

169:                                              ; preds = %166
  %170 = load i8, ptr %26, align 1, !tbaa !44, !range !37, !noundef !38
  %171 = trunc i8 %170 to i1
  br i1 %171, label %172, label %209

172:                                              ; preds = %169, %166, %158, %153
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #3
  %173 = load ptr, ptr %10, align 8, !tbaa !5
  %174 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %175 = getelementptr inbounds %struct.CLzmaDec, ptr %174, i32 0, i32 2
  %176 = load ptr, ptr %175, align 8, !tbaa !45
  %177 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %178 = getelementptr inbounds %struct.CLzmaDec, ptr %177, i32 0, i32 6
  %179 = load i64, ptr %178, align 8, !tbaa !31
  %180 = call noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef %173, ptr noundef %176, i64 noundef %179)
  store i32 %180, ptr %27, align 4, !tbaa !30
  %181 = load i32, ptr %23, align 4, !tbaa !30
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %183, label %184

183:                                              ; preds = %172
  store i32 1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %206

184:                                              ; preds = %172
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #3
  %185 = load i32, ptr %27, align 4, !tbaa !30
  store i32 %185, ptr %28, align 4, !tbaa !30
  %186 = load i32, ptr %28, align 4, !tbaa !30
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %190

188:                                              ; preds = %184
  %189 = load i32, ptr %28, align 4, !tbaa !30
  store i32 %189, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %191

190:                                              ; preds = %184
  store i32 0, ptr %15, align 4
  br label %191

191:                                              ; preds = %190, %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #3
  %192 = load i32, ptr %15, align 4
  switch i32 %192, label %206 [
    i32 0, label %193
  ]

193:                                              ; preds = %191
  %194 = load i8, ptr %26, align 1, !tbaa !44, !range !37, !noundef !38
  %195 = trunc i8 %194 to i1
  br i1 %195, label %196, label %197

196:                                              ; preds = %193
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %206

197:                                              ; preds = %193
  %198 = load i8, ptr %25, align 1, !tbaa !44, !range !37, !noundef !38
  %199 = trunc i8 %198 to i1
  br i1 %199, label %200, label %205

200:                                              ; preds = %197
  %201 = load i32, ptr %22, align 4, !tbaa !46
  %202 = icmp eq i32 %201, 1
  %203 = zext i1 %202 to i64
  %204 = select i1 %202, i32 0, i32 1
  store i32 %204, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %206

205:                                              ; preds = %197
  store i32 0, ptr %15, align 4
  br label %206

206:                                              ; preds = %205, %200, %196, %191, %183
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #3
  %207 = load i32, ptr %15, align 4
  switch i32 %207, label %240 [
    i32 0, label %208
  ]

208:                                              ; preds = %206
  br label %209

209:                                              ; preds = %208, %169
  %210 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %211 = getelementptr inbounds %struct.CLzmaDec, ptr %210, i32 0, i32 6
  %212 = load i64, ptr %211, align 8, !tbaa !31
  %213 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %214 = getelementptr inbounds %struct.CLzmaDec, ptr %213, i32 0, i32 7
  %215 = load i64, ptr %214, align 8, !tbaa !33
  %216 = icmp eq i64 %212, %215
  br i1 %216, label %217, label %220

217:                                              ; preds = %209
  %218 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 12
  %219 = getelementptr inbounds %struct.CLzmaDec, ptr %218, i32 0, i32 6
  store i64 0, ptr %219, align 8, !tbaa !31
  br label %220

220:                                              ; preds = %217, %209
  %221 = load ptr, ptr %13, align 8, !tbaa !5
  %222 = icmp ne ptr %221, null
  br i1 %222, label %223, label %239

223:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #3
  %224 = load ptr, ptr %13, align 8, !tbaa !5
  %225 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 16
  %226 = getelementptr inbounds %"class.NCompress::NLzma::CDecoder", ptr %30, i32 0, i32 17
  %227 = load ptr, ptr %224, align 8, !tbaa !26
  %228 = getelementptr inbounds ptr, ptr %227, i64 5
  %229 = load ptr, ptr %228, align 8
  %230 = call noundef i32 %229(ptr noundef nonnull align 8 dereferenceable(8) %224, ptr noundef %225, ptr noundef %226)
  store i32 %230, ptr %29, align 4, !tbaa !30
  %231 = load i32, ptr %29, align 4, !tbaa !30
  %232 = icmp ne i32 %231, 0
  br i1 %232, label %233, label %235

233:                                              ; preds = %223
  %234 = load i32, ptr %29, align 4, !tbaa !30
  store i32 %234, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %236

235:                                              ; preds = %223
  store i32 0, ptr %15, align 4
  br label %236

236:                                              ; preds = %235, %233
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #3
  %237 = load i32, ptr %15, align 4
  switch i32 %237, label %240 [
    i32 0, label %238
  ]

238:                                              ; preds = %236
  br label %239

239:                                              ; preds = %238, %220
  store i32 0, ptr %15, align 4
  br label %240

240:                                              ; preds = %239, %236, %206
  call void @llvm.lifetime.end.p0(i64 1, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  %241 = load i32, ptr %15, align 4
  switch i32 %241, label %245 [
    i32 0, label %242
    i32 1, label %243
  ]

242:                                              ; preds = %240
  br label %41, !llvm.loop !48

243:                                              ; preds = %240, %63, %34
  %244 = load i32, ptr %7, align 4
  ret i32 %244

245:                                              ; preds = %240, %63
  unreachable
}

declare i32 @LzmaDec_DecodeToDic(ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

declare noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef, ptr noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 64}
!10 = !{!"_ZTSN9NCompress5NLzma8CDecoderE", !11, i64 0, !13, i64 8, !14, i64 16, !15, i64 24, !16, i64 32, !17, i64 40, !18, i64 48, !20, i64 56, !6, i64 64, !19, i64 72, !19, i64 76, !21, i64 80, !24, i64 216, !25, i64 224, !25, i64 232, !25, i64 240, !24, i64 248}
!11 = !{!"_ZTS14ICompressCoder", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS30ICompressSetDecoderProperties2", !12, i64 0}
!14 = !{!"_ZTS33ICompressGetInStreamProcessedSize", !12, i64 0}
!15 = !{!"_ZTS20ICompressSetInStream", !12, i64 0}
!16 = !{!"_ZTS25ICompressSetOutStreamSize", !12, i64 0}
!17 = !{!"_ZTS19ISequentialInStream", !12, i64 0}
!18 = !{!"_ZTS13CMyUnknownImp", !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !6, i64 0}
!21 = !{!"_ZTS8CLzmaDec", !22, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !19, i64 40, !19, i64 44, !23, i64 48, !23, i64 56, !19, i64 64, !19, i64 68, !19, i64 72, !7, i64 76, !19, i64 92, !19, i64 96, !19, i64 100, !19, i64 104, !19, i64 108, !7, i64 112}
!22 = !{!"_ZTS11_CLzmaProps", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12}
!23 = !{!"long", !7, i64 0}
!24 = !{!"bool", !7, i64 0}
!25 = !{!"long long", !7, i64 0}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !8, i64 0}
!28 = !{!10, !19, i64 72}
!29 = !{!10, !19, i64 76}
!30 = !{!19, !19, i64 0}
!31 = !{!10, !23, i64 128}
!32 = !{!23, !23, i64 0}
!33 = !{!10, !23, i64 136}
!34 = !{!35, !35, i64 0}
!35 = !{!"_ZTS15ELzmaFinishMode", !7, i64 0}
!36 = !{!10, !24, i64 216}
!37 = !{i8 0, i8 2}
!38 = !{}
!39 = !{!10, !25, i64 224}
!40 = !{!10, !25, i64 240}
!41 = !{!25, !25, i64 0}
!42 = !{!10, !24, i64 248}
!43 = !{!10, !25, i64 232}
!44 = !{!24, !24, i64 0}
!45 = !{!10, !6, i64 104}
!46 = !{!47, !47, i64 0}
!47 = !{!"_ZTS11ELzmaStatus", !7, i64 0}
!48 = distinct !{!48, !49}
!49 = !{!"llvm.loop.mustprogress"}


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

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

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

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

12:                                               ; preds = %6
  %13 = load ptr, ptr %0, align 8, !tbaa !25
  %14 = getelementptr inbounds i8, ptr %13, i64 80
  %15 = load ptr, ptr %14, align 8
  %16 = tail call noundef i32 %15(ptr noundef nonnull align 8 dereferenceable(249) %0, ptr noundef %4)
  %17 = getelementptr inbounds i8, ptr %0, i64 72
  %18 = getelementptr inbounds i8, ptr %0, i64 76
  %19 = getelementptr inbounds i8, ptr %0, i64 80
  %20 = getelementptr inbounds i8, ptr %0, i64 128
  %21 = getelementptr inbounds i8, ptr %0, i64 136
  %22 = getelementptr inbounds i8, ptr %0, i64 216
  %23 = getelementptr inbounds i8, ptr %0, i64 224
  %24 = getelementptr inbounds i8, ptr %0, i64 240
  %25 = getelementptr inbounds i8, ptr %0, i64 248
  %26 = getelementptr inbounds i8, ptr %0, i64 232
  %27 = getelementptr inbounds i8, ptr %0, i64 104
  %.not53 = icmp eq ptr %5, null
  br label %28

28:                                               ; preds = %select.unfold, %12
  %29 = load i32, ptr %17, align 8, !tbaa !27
  %30 = load i32, ptr %18, align 4, !tbaa !28
  %31 = icmp eq i32 %29, %30
  br i1 %31, label %32, label %38

32:                                               ; preds = %28
  store i32 0, ptr %18, align 4, !tbaa !28
  store i32 0, ptr %17, align 8, !tbaa !27
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = load ptr, ptr %1, align 8, !tbaa !25
  %35 = getelementptr inbounds i8, ptr %34, i64 40
  %36 = load ptr, ptr %35, align 8
  %37 = call noundef i32 %36(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %33, i32 noundef 1048576, ptr noundef nonnull %18)
  %.not.not = icmp eq i32 %37, 0
  br i1 %.not.not, label %38, label %.loopexit

38:                                               ; preds = %32, %28
  %39 = load i64, ptr %20, align 8, !tbaa !29
  %40 = load i64, ptr %21, align 8, !tbaa !30
  %41 = sub i64 %40, %39
  %spec.store.select = call i64 @llvm.umin.i64(i64 %41, i64 4194304)
  %42 = load i8, ptr %22, align 8, !tbaa !31, !range !32, !noundef !33
  %43 = trunc nuw i8 %42 to i1
  br i1 %43, label %44, label %51

44:                                               ; preds = %38
  %45 = load i64, ptr %23, align 8, !tbaa !34
  %46 = load i64, ptr %24, align 8, !tbaa !35
  %47 = sub i64 %45, %46
  %48 = icmp ult i64 %47, %spec.store.select
  br i1 %48, label %49, label %51

49:                                               ; preds = %44
  %50 = load i8, ptr %25, align 8, !tbaa !36, !range !32, !noundef !33
  %spec.select = zext nneg i8 %50 to i32
  br label %51

51:                                               ; preds = %49, %44, %38
  %.145 = phi i32 [ 0, %38 ], [ 0, %44 ], [ %spec.select, %49 ]
  %.143 = phi i64 [ %spec.store.select, %38 ], [ %spec.store.select, %44 ], [ %47, %49 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %52 = load i32, ptr %18, align 4, !tbaa !28
  %53 = load i32, ptr %17, align 8, !tbaa !27
  %54 = sub i32 %52, %53
  %55 = zext i32 %54 to i64
  store i64 %55, ptr %7, align 8, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %56 = add i64 %.143, %39
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = zext i32 %53 to i64
  %59 = getelementptr inbounds i8, ptr %57, i64 %58
  %60 = call i32 @LzmaDec_DecodeToDic(ptr noundef nonnull %19, i64 noundef %56, ptr noundef %59, ptr noundef nonnull %7, i32 noundef %.145, ptr noundef nonnull %8)
  %61 = load i64, ptr %7, align 8, !tbaa !37
  %62 = trunc i64 %61 to i32
  %63 = load i32, ptr %17, align 8, !tbaa !27
  %64 = add i32 %63, %62
  store i32 %64, ptr %17, align 8, !tbaa !27
  %65 = load i64, ptr %26, align 8, !tbaa !38
  %66 = add i64 %65, %61
  store i64 %66, ptr %26, align 8, !tbaa !38
  %67 = load i64, ptr %20, align 8, !tbaa !29
  %68 = sub i64 %67, %39
  %69 = load i64, ptr %24, align 8, !tbaa !35
  %70 = add i64 %69, %68
  store i64 %70, ptr %24, align 8, !tbaa !35
  %71 = icmp eq i64 %61, 0
  %72 = icmp eq i64 %67, %39
  %73 = select i1 %71, i1 %72, i1 false
  %74 = load i8, ptr %22, align 8, !tbaa !31, !range !32, !noundef !33
  %75 = trunc nuw i8 %74 to i1
  %76 = load i64, ptr %23, align 8
  %77 = icmp uge i64 %70, %76
  %78 = select i1 %75, i1 %77, i1 false
  %.not51 = icmp eq i32 %60, 0
  br i1 %.not51, label %79, label %82

79:                                               ; preds = %51
  %80 = load i64, ptr %21, align 8, !tbaa !30
  %81 = icmp eq i64 %67, %80
  %brmerge = select i1 %81, i1 true, i1 %73
  %brmerge55 = select i1 %brmerge, i1 true, i1 %78
  br i1 %brmerge55, label %85, label %93

82:                                               ; preds = %51
  %83 = load ptr, ptr %27, align 8, !tbaa !39
  %84 = call noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef %2, ptr noundef %83, i64 noundef %67)
  br label %.thread65

85:                                               ; preds = %79
  %86 = load ptr, ptr %27, align 8, !tbaa !39
  %87 = call noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef %2, ptr noundef %86, i64 noundef %67)
  %.not52 = icmp ne i32 %87, 0
  %brmerge57 = select i1 %.not52, i1 true, i1 %78
  %.not58 = xor i1 %73, true
  %brmerge59 = select i1 %brmerge57, i1 true, i1 %.not58
  br i1 %brmerge59, label %92, label %88

88:                                               ; preds = %85
  %89 = load i32, ptr %8, align 4, !tbaa !40
  %90 = icmp ne i32 %89, 1
  %91 = zext i1 %90 to i32
  br label %.thread65

92:                                               ; preds = %85
  br i1 %brmerge57, label %.thread65, label %._crit_edge

._crit_edge:                                      ; preds = %92
  %.pre = load i64, ptr %20, align 8, !tbaa !29
  %.pre75 = load i64, ptr %21, align 8, !tbaa !30
  br label %93

93:                                               ; preds = %._crit_edge, %79
  %94 = phi i64 [ %.pre75, %._crit_edge ], [ %80, %79 ]
  %95 = phi i64 [ %.pre, %._crit_edge ], [ %67, %79 ]
  %96 = icmp eq i64 %95, %94
  br i1 %96, label %97, label %98

97:                                               ; preds = %93
  store i64 0, ptr %20, align 8, !tbaa !29
  br label %98

98:                                               ; preds = %97, %93
  br i1 %.not53, label %select.unfold, label %99

99:                                               ; preds = %98
  %100 = load ptr, ptr %5, align 8, !tbaa !25
  %101 = getelementptr inbounds i8, ptr %100, i64 40
  %102 = load ptr, ptr %101, align 8
  %103 = call noundef i32 %102(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull %26, ptr noundef nonnull %24)
  %.not54 = icmp eq i32 %103, 0
  br i1 %.not54, label %select.unfold, label %.thread65

.thread65:                                        ; preds = %92, %99, %88, %82
  %.8.ph = phi i32 [ 1, %82 ], [ %91, %88 ], [ %87, %92 ], [ %103, %99 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %.loopexit

select.unfold:                                    ; preds = %99, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %28

.loopexit:                                        ; preds = %32, %.thread65, %6
  %.9 = phi i32 [ 1, %6 ], [ %.8.ph, %.thread65 ], [ %37, %32 ]
  ret i32 %.9
}

declare i32 @LzmaDec_DecodeToDic(ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare noundef i32 @_Z11WriteStreamP20ISequentialOutStreamPKvm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !19, i64 64}
!6 = !{!"_ZTSN9NCompress5NLzma8CDecoderE", !7, i64 0, !9, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !13, i64 40, !14, i64 48, !18, i64 56, !19, i64 64, !15, i64 72, !15, i64 76, !20, i64 80, !23, i64 216, !24, i64 224, !24, i64 232, !24, i64 240, !23, i64 248}
!7 = !{!"_ZTS14ICompressCoder", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS30ICompressSetDecoderProperties2", !8, i64 0}
!10 = !{!"_ZTS33ICompressGetInStreamProcessedSize", !8, i64 0}
!11 = !{!"_ZTS20ICompressSetInStream", !8, i64 0}
!12 = !{!"_ZTS25ICompressSetOutStreamSize", !8, i64 0}
!13 = !{!"_ZTS19ISequentialInStream", !8, i64 0}
!14 = !{!"_ZTS13CMyUnknownImp", !15, i64 0}
!15 = !{!"int", !16, i64 0}
!16 = !{!"omnipotent char", !17, i64 0}
!17 = !{!"Simple C++ TBAA"}
!18 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !19, i64 0}
!19 = !{!"any pointer", !16, i64 0}
!20 = !{!"_ZTS8CLzmaDec", !21, i64 0, !19, i64 16, !19, i64 24, !19, i64 32, !15, i64 40, !15, i64 44, !22, i64 48, !22, i64 56, !15, i64 64, !15, i64 68, !15, i64 72, !16, i64 76, !15, i64 92, !15, i64 96, !15, i64 100, !15, i64 104, !15, i64 108, !16, i64 112}
!21 = !{!"_ZTS11_CLzmaProps", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!22 = !{!"long", !16, i64 0}
!23 = !{!"bool", !16, i64 0}
!24 = !{!"long long", !16, i64 0}
!25 = !{!26, !26, i64 0}
!26 = !{!"vtable pointer", !17, i64 0}
!27 = !{!6, !15, i64 72}
!28 = !{!6, !15, i64 76}
!29 = !{!6, !22, i64 128}
!30 = !{!6, !22, i64 136}
!31 = !{!6, !23, i64 216}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = !{!6, !24, i64 224}
!35 = !{!6, !24, i64 240}
!36 = !{!6, !23, i64 248}
!37 = !{!22, !22, i64 0}
!38 = !{!6, !24, i64 232}
!39 = !{!6, !19, i64 104}
!40 = !{!41, !41, i64 0}
!41 = !{!"_ZTS11ELzmaStatus", !16, i64 0}


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