; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/7zip/Bundles/LzmaSpec/LzmaSpec.ll (ZN12CLzmaDecoder6DecodeEby)

; 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.CLzmaDecoder = type <{ %class.CRangeDecoder, %class.COutWindow, i8, [3 x i8], i32, i32, i32, i32, i32, ptr, [4 x %class.CBitTreeDecoder], %class.CBitTreeDecoder.0, [115 x i16], [192 x i16], [12 x i16], [12 x i16], [12 x i16], [12 x i16], [192 x i16], %class.CLenDecoder, %class.CLenDecoder, [2 x i8] }>
%class.CRangeDecoder = type <{ i32, i32, ptr, i8, [7 x i8] }>
%class.COutWindow = type { ptr, i32, i32, i8, i32, %struct.COutStream }
%struct.COutStream = type { ptr, i64 }
%class.CBitTreeDecoder = type { [64 x i16] }
%class.CBitTreeDecoder.0 = type { [16 x i16] }
%class.CLenDecoder = type { i16, i16, [16 x %class.CBitTreeDecoder.1], [16 x %class.CBitTreeDecoder.1], %class.CBitTreeDecoder.2 }
%class.CBitTreeDecoder.1 = type { [8 x i16] }
%class.CBitTreeDecoder.2 = type { [256 x i16] }

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN13CRangeDecoder4InitEv(ptr noundef nonnull align 8 dereferenceable(17)) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z19UpdateState_Literalj(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z17UpdateState_Matchj(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z15UpdateState_Repj(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z20UpdateState_ShortRepj(i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12CLzmaDecoder6DecodeEby(ptr noundef nonnull align 8 dereferenceable(3790) %0, i1 noundef zeroext %1, i64 noundef %2) #0 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i8, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  %18 = zext i1 %1 to i8
  store i8 %18, ptr %6, align 1, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !11
  %19 = load ptr, ptr %5, align 8
  %20 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %21 = call noundef zeroext i1 @_ZN13CRangeDecoder4InitEv(ptr noundef nonnull align 8 dereferenceable(17) %20)
  br i1 %21, label %23, label %22

22:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  br label %225

23:                                               ; preds = %3
  call void @_ZN12CLzmaDecoder4InitEv(ptr noundef nonnull align 8 dereferenceable(3790) %19)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !13
  br label %24

24:                                               ; preds = %223, %221, %23
  %25 = load i8, ptr %6, align 1, !tbaa !9, !range !15, !noundef !16
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %39

27:                                               ; preds = %24
  %28 = load i64, ptr %7, align 8, !tbaa !11
  %29 = icmp eq i64 %28, 0
  br i1 %29, label %30, label %39

30:                                               ; preds = %27
  %31 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 2
  %32 = load i8, ptr %31, align 8, !tbaa !17, !range !15, !noundef !16
  %33 = trunc i8 %32 to i1
  br i1 %33, label %39, label %34

34:                                               ; preds = %30
  %35 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %36 = call noundef zeroext i1 @_ZNK13CRangeDecoder12IsFinishedOKEv(ptr noundef nonnull align 8 dereferenceable(17) %35)
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  store i32 2, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %224

38:                                               ; preds = %34
  br label %39

39:                                               ; preds = %38, %30, %27, %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %40 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 1
  %41 = getelementptr inbounds %class.COutWindow, ptr %40, i32 0, i32 4
  %42 = load i32, ptr %41, align 4, !tbaa !26
  %43 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 5
  %44 = load i32, ptr %43, align 8, !tbaa !27
  %45 = shl i32 1, %44
  %46 = sub nsw i32 %45, 1
  %47 = and i32 %42, %46
  store i32 %47, ptr %14, align 4, !tbaa !13
  %48 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %49 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 13
  %50 = load i32, ptr %12, align 4, !tbaa !13
  %51 = shl i32 %50, 4
  %52 = load i32, ptr %14, align 4, !tbaa !13
  %53 = add i32 %51, %52
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds [192 x i16], ptr %49, i64 0, i64 %54
  %56 = call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %48, ptr noundef %55)
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %72

58:                                               ; preds = %39
  %59 = load i8, ptr %6, align 1, !tbaa !9, !range !15, !noundef !16
  %60 = trunc i8 %59 to i1
  br i1 %60, label %61, label %65

61:                                               ; preds = %58
  %62 = load i64, ptr %7, align 8, !tbaa !11
  %63 = icmp eq i64 %62, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %61
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %221

65:                                               ; preds = %61, %58
  %66 = load i32, ptr %12, align 4, !tbaa !13
  %67 = load i32, ptr %8, align 4, !tbaa !13
  call void @_ZN12CLzmaDecoder13DecodeLiteralEjj(ptr noundef nonnull align 8 dereferenceable(3790) %19, i32 noundef %66, i32 noundef %67)
  %68 = load i32, ptr %12, align 4, !tbaa !13
  %69 = call noundef i32 @_Z19UpdateState_Literalj(i32 noundef %68)
  store i32 %69, ptr %12, align 4, !tbaa !13
  %70 = load i64, ptr %7, align 8, !tbaa !11
  %71 = add i64 %70, -1
  store i64 %71, ptr %7, align 8, !tbaa !11
  store i32 3, ptr %13, align 4
  br label %221, !llvm.loop !28

72:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %73 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %74 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 14
  %75 = load i32, ptr %12, align 4, !tbaa !13
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds [12 x i16], ptr %74, i64 0, i64 %76
  %78 = call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %73, ptr noundef %77)
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %156

80:                                               ; preds = %72
  %81 = load i8, ptr %6, align 1, !tbaa !9, !range !15, !noundef !16
  %82 = trunc i8 %81 to i1
  br i1 %82, label %83, label %87

83:                                               ; preds = %80
  %84 = load i64, ptr %7, align 8, !tbaa !11
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %83
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %220

87:                                               ; preds = %83, %80
  %88 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 1
  %89 = call noundef zeroext i1 @_ZNK10COutWindow7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(40) %88)
  br i1 %89, label %90, label %91

90:                                               ; preds = %87
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %220

91:                                               ; preds = %87
  %92 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %93 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 15
  %94 = load i32, ptr %12, align 4, !tbaa !13
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds [12 x i16], ptr %93, i64 0, i64 %95
  %97 = call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %92, ptr noundef %96)
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %121

99:                                               ; preds = %91
  %100 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %101 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 18
  %102 = load i32, ptr %12, align 4, !tbaa !13
  %103 = shl i32 %102, 4
  %104 = load i32, ptr %14, align 4, !tbaa !13
  %105 = add i32 %103, %104
  %106 = zext i32 %105 to i64
  %107 = getelementptr inbounds [192 x i16], ptr %101, i64 0, i64 %106
  %108 = call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %100, ptr noundef %107)
  %109 = icmp eq i32 %108, 0
  br i1 %109, label %110, label %120

110:                                              ; preds = %99
  %111 = load i32, ptr %12, align 4, !tbaa !13
  %112 = call noundef i32 @_Z20UpdateState_ShortRepj(i32 noundef %111)
  store i32 %112, ptr %12, align 4, !tbaa !13
  %113 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 1
  %114 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 1
  %115 = load i32, ptr %8, align 4, !tbaa !13
  %116 = add i32 %115, 1
  %117 = call noundef zeroext i8 @_ZNK10COutWindow7GetByteEj(ptr noundef nonnull align 8 dereferenceable(40) %114, i32 noundef %116)
  call void @_ZN10COutWindow7PutByteEh(ptr noundef nonnull align 8 dereferenceable(40) %113, i8 noundef zeroext %117)
  %118 = load i64, ptr %7, align 8, !tbaa !11
  %119 = add i64 %118, -1
  store i64 %119, ptr %7, align 8, !tbaa !11
  store i32 3, ptr %13, align 4
  br label %220, !llvm.loop !28

120:                                              ; preds = %99
  br label %149

121:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %122 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %123 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 16
  %124 = load i32, ptr %12, align 4, !tbaa !13
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds [12 x i16], ptr %123, i64 0, i64 %125
  %127 = call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %122, ptr noundef %126)
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %131

129:                                              ; preds = %121
  %130 = load i32, ptr %9, align 4, !tbaa !13
  store i32 %130, ptr %16, align 4, !tbaa !13
  br label %146

131:                                              ; preds = %121
  %132 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %133 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 17
  %134 = load i32, ptr %12, align 4, !tbaa !13
  %135 = zext i32 %134 to i64
  %136 = getelementptr inbounds [12 x i16], ptr %133, i64 0, i64 %135
  %137 = call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %132, ptr noundef %136)
  %138 = icmp eq i32 %137, 0
  br i1 %138, label %139, label %141

139:                                              ; preds = %131
  %140 = load i32, ptr %10, align 4, !tbaa !13
  store i32 %140, ptr %16, align 4, !tbaa !13
  br label %144

141:                                              ; preds = %131
  %142 = load i32, ptr %11, align 4, !tbaa !13
  store i32 %142, ptr %16, align 4, !tbaa !13
  %143 = load i32, ptr %10, align 4, !tbaa !13
  store i32 %143, ptr %11, align 4, !tbaa !13
  br label %144

144:                                              ; preds = %141, %139
  %145 = load i32, ptr %9, align 4, !tbaa !13
  store i32 %145, ptr %10, align 4, !tbaa !13
  br label %146

146:                                              ; preds = %144, %129
  %147 = load i32, ptr %8, align 4, !tbaa !13
  store i32 %147, ptr %9, align 4, !tbaa !13
  %148 = load i32, ptr %16, align 4, !tbaa !13
  store i32 %148, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  br label %149

149:                                              ; preds = %146, %120
  %150 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 20
  %151 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %152 = load i32, ptr %14, align 4, !tbaa !13
  %153 = call noundef i32 @_ZN11CLenDecoder6DecodeEP13CRangeDecoderj(ptr noundef nonnull align 2 dereferenceable(1028) %150, ptr noundef %151, i32 noundef %152)
  store i32 %153, ptr %15, align 4, !tbaa !13
  %154 = load i32, ptr %12, align 4, !tbaa !13
  %155 = call noundef i32 @_Z15UpdateState_Repj(i32 noundef %154)
  store i32 %155, ptr %12, align 4, !tbaa !13
  br label %193

156:                                              ; preds = %72
  %157 = load i32, ptr %10, align 4, !tbaa !13
  store i32 %157, ptr %11, align 4, !tbaa !13
  %158 = load i32, ptr %9, align 4, !tbaa !13
  store i32 %158, ptr %10, align 4, !tbaa !13
  %159 = load i32, ptr %8, align 4, !tbaa !13
  store i32 %159, ptr %9, align 4, !tbaa !13
  %160 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 19
  %161 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %162 = load i32, ptr %14, align 4, !tbaa !13
  %163 = call noundef i32 @_ZN11CLenDecoder6DecodeEP13CRangeDecoderj(ptr noundef nonnull align 2 dereferenceable(1028) %160, ptr noundef %161, i32 noundef %162)
  store i32 %163, ptr %15, align 4, !tbaa !13
  %164 = load i32, ptr %12, align 4, !tbaa !13
  %165 = call noundef i32 @_Z17UpdateState_Matchj(i32 noundef %164)
  store i32 %165, ptr %12, align 4, !tbaa !13
  %166 = load i32, ptr %15, align 4, !tbaa !13
  %167 = call noundef i32 @_ZN12CLzmaDecoder14DecodeDistanceEj(ptr noundef nonnull align 8 dereferenceable(3790) %19, i32 noundef %166)
  store i32 %167, ptr %8, align 4, !tbaa !13
  %168 = load i32, ptr %8, align 4, !tbaa !13
  %169 = icmp eq i32 %168, -1
  br i1 %169, label %170, label %175

170:                                              ; preds = %156
  %171 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 0
  %172 = call noundef zeroext i1 @_ZNK13CRangeDecoder12IsFinishedOKEv(ptr noundef nonnull align 8 dereferenceable(17) %171)
  %173 = zext i1 %172 to i64
  %174 = select i1 %172, i32 1, i32 0
  store i32 %174, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %220

175:                                              ; preds = %156
  %176 = load i8, ptr %6, align 1, !tbaa !9, !range !15, !noundef !16
  %177 = trunc i8 %176 to i1
  br i1 %177, label %178, label %182

178:                                              ; preds = %175
  %179 = load i64, ptr %7, align 8, !tbaa !11
  %180 = icmp eq i64 %179, 0
  br i1 %180, label %181, label %182

181:                                              ; preds = %178
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %220

182:                                              ; preds = %178, %175
  %183 = load i32, ptr %8, align 4, !tbaa !13
  %184 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 7
  %185 = load i32, ptr %184, align 8, !tbaa !30
  %186 = icmp uge i32 %183, %185
  br i1 %186, label %191, label %187

187:                                              ; preds = %182
  %188 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 1
  %189 = load i32, ptr %8, align 4, !tbaa !13
  %190 = call noundef zeroext i1 @_ZNK10COutWindow13CheckDistanceEj(ptr noundef nonnull align 8 dereferenceable(40) %188, i32 noundef %189)
  br i1 %190, label %192, label %191

191:                                              ; preds = %187, %182
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %220

192:                                              ; preds = %187
  br label %193

193:                                              ; preds = %192, %149
  %194 = load i32, ptr %15, align 4, !tbaa !13
  %195 = add i32 %194, 2
  store i32 %195, ptr %15, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #3
  store i8 0, ptr %17, align 1, !tbaa !9
  %196 = load i8, ptr %6, align 1, !tbaa !9, !range !15, !noundef !16
  %197 = trunc i8 %196 to i1
  br i1 %197, label %198, label %206

198:                                              ; preds = %193
  %199 = load i64, ptr %7, align 8, !tbaa !11
  %200 = load i32, ptr %15, align 4, !tbaa !13
  %201 = zext i32 %200 to i64
  %202 = icmp ult i64 %199, %201
  br i1 %202, label %203, label %206

203:                                              ; preds = %198
  %204 = load i64, ptr %7, align 8, !tbaa !11
  %205 = trunc i64 %204 to i32
  store i32 %205, ptr %15, align 4, !tbaa !13
  store i8 1, ptr %17, align 1, !tbaa !9
  br label %206

206:                                              ; preds = %203, %198, %193
  %207 = getelementptr inbounds %class.CLzmaDecoder, ptr %19, i32 0, i32 1
  %208 = load i32, ptr %8, align 4, !tbaa !13
  %209 = add i32 %208, 1
  %210 = load i32, ptr %15, align 4, !tbaa !13
  call void @_ZN10COutWindow9CopyMatchEjj(ptr noundef nonnull align 8 dereferenceable(40) %207, i32 noundef %209, i32 noundef %210)
  %211 = load i32, ptr %15, align 4, !tbaa !13
  %212 = zext i32 %211 to i64
  %213 = load i64, ptr %7, align 8, !tbaa !11
  %214 = sub i64 %213, %212
  store i64 %214, ptr %7, align 8, !tbaa !11
  %215 = load i8, ptr %17, align 1, !tbaa !9, !range !15, !noundef !16
  %216 = trunc i8 %215 to i1
  br i1 %216, label %217, label %218

217:                                              ; preds = %206
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %219

218:                                              ; preds = %206
  store i32 0, ptr %13, align 4
  br label %219

219:                                              ; preds = %218, %217
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #3
  br label %220

220:                                              ; preds = %219, %191, %181, %170, %110, %90, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %221

221:                                              ; preds = %220, %65, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %222 = load i32, ptr %13, align 4
  switch i32 %222, label %224 [
    i32 0, label %223
    i32 3, label %24
  ]

223:                                              ; preds = %221
  br label %24, !llvm.loop !28

224:                                              ; preds = %221, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %225

225:                                              ; preds = %224, %22
  %226 = load i32, ptr %4, align 4
  ret i32 %226
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12CLzmaDecoder4InitEv(ptr noundef nonnull align 8 dereferenceable(3790)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK13CRangeDecoder12IsFinishedOKEv(ptr noundef nonnull align 8 dereferenceable(17)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12CLzmaDecoder13DecodeLiteralEjj(ptr noundef nonnull align 8 dereferenceable(3790), i32 noundef, i32 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10COutWindow7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10COutWindow7PutByteEh(ptr noundef nonnull align 8 dereferenceable(40), i8 noundef zeroext) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZNK10COutWindow7GetByteEj(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN11CLenDecoder6DecodeEP13CRangeDecoderj(ptr noundef nonnull align 2 dereferenceable(1028), ptr noundef, i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN12CLzmaDecoder14DecodeDistanceEj(ptr noundef nonnull align 8 dereferenceable(3790), i32 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10COutWindow13CheckDistanceEj(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10COutWindow9CopyMatchEjj(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef) #0 align 2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !10, i64 64}
!18 = !{!"_ZTS12CLzmaDecoder", !19, i64 0, !20, i64 24, !10, i64 64, !14, i64 68, !14, i64 72, !14, i64 76, !14, i64 80, !14, i64 84, !6, i64 88, !7, i64 96, !22, i64 608, !7, i64 640, !7, i64 870, !7, i64 1254, !7, i64 1278, !7, i64 1302, !7, i64 1326, !7, i64 1350, !23, i64 1734, !23, i64 2762}
!19 = !{!"_ZTS13CRangeDecoder", !14, i64 0, !14, i64 4, !6, i64 8, !10, i64 16}
!20 = !{!"_ZTS10COutWindow", !6, i64 0, !14, i64 8, !14, i64 12, !10, i64 16, !14, i64 20, !21, i64 24}
!21 = !{!"_ZTS10COutStream", !6, i64 0, !12, i64 8}
!22 = !{!"_ZTS15CBitTreeDecoderILj4EE", !7, i64 0}
!23 = !{!"_ZTS11CLenDecoder", !24, i64 0, !24, i64 2, !7, i64 4, !7, i64 260, !25, i64 516}
!24 = !{!"short", !7, i64 0}
!25 = !{!"_ZTS15CBitTreeDecoderILj8EE", !7, i64 0}
!26 = !{!18, !14, i64 44}
!27 = !{!18, !14, i64 72}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!18, !14, i64 80}


; 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 uwtable
declare dso_local noundef zeroext i1 @_ZN13CRangeDecoder4InitEv(ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z19UpdateState_Literalj(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z17UpdateState_Matchj(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z15UpdateState_Repj(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z20UpdateState_ShortRepj(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12CLzmaDecoder6DecodeEby(ptr noundef nonnull align 8 dereferenceable(3790) %0, i1 noundef zeroext %1, i64 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = tail call noundef zeroext i1 @_ZN13CRangeDecoder4InitEv(ptr noundef nonnull align 8 dereferenceable(17) %0)
  br i1 %4, label %5, label %.thread

5:                                                ; preds = %3
  tail call void @_ZN12CLzmaDecoder4InitEv(ptr noundef nonnull align 8 dereferenceable(3790) %0)
  %6 = getelementptr inbounds i8, ptr %0, i64 64
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = getelementptr inbounds i8, ptr %0, i64 44
  %9 = getelementptr inbounds i8, ptr %0, i64 72
  %10 = getelementptr inbounds i8, ptr %0, i64 870
  %11 = getelementptr inbounds i8, ptr %0, i64 1254
  %12 = getelementptr inbounds i8, ptr %0, i64 1278
  %13 = getelementptr inbounds i8, ptr %0, i64 1302
  %14 = getelementptr inbounds i8, ptr %0, i64 1326
  %15 = getelementptr inbounds i8, ptr %0, i64 1350
  %16 = getelementptr inbounds i8, ptr %0, i64 2762
  %17 = getelementptr inbounds i8, ptr %0, i64 1734
  %18 = getelementptr inbounds i8, ptr %0, i64 80
  br label %.outer

.outer:                                           ; preds = %81, %5
  %.094.ph = phi i64 [ %88, %81 ], [ %2, %5 ]
  %.089.ph = phi i32 [ %.291, %81 ], [ 0, %5 ]
  %.084.ph = phi i32 [ %.286, %81 ], [ 0, %5 ]
  %.078.ph = phi i32 [ %.381, %81 ], [ 0, %5 ]
  %.072.ph = phi i32 [ %.476, %81 ], [ 0, %5 ]
  %.068.ph = phi i32 [ %.169, %81 ], [ 0, %5 ]
  %19 = add i32 %.089.ph, 1
  br label %20

20:                                               ; preds = %.backedge, %.outer
  %.094 = phi i64 [ %.094.ph, %.outer ], [ %.094.be, %.backedge ]
  %.068 = phi i32 [ %.068.ph, %.outer ], [ %.068.be, %.backedge ]
  %21 = icmp eq i64 %.094, 0
  %or.cond = select i1 %1, i1 %21, i1 false
  br i1 %or.cond, label %22, label %27

22:                                               ; preds = %20
  %23 = load i8, ptr %6, align 8, !tbaa !5, !range !20, !noundef !21
  %24 = trunc nuw i8 %23 to i1
  br i1 %24, label %27, label %25

25:                                               ; preds = %22
  %26 = tail call noundef zeroext i1 @_ZNK13CRangeDecoder12IsFinishedOKEv(ptr noundef nonnull align 8 dereferenceable(17) %0)
  br i1 %26, label %.thread, label %27

27:                                               ; preds = %25, %22, %20
  %28 = load i32, ptr %8, align 4, !tbaa !22
  %29 = load i32, ptr %9, align 8, !tbaa !23
  %notmask = shl nsw i32 -1, %29
  %30 = xor i32 %notmask, -1
  %31 = and i32 %28, %30
  %32 = shl i32 %.068, 4
  %33 = add i32 %31, %32
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [192 x i16], ptr %10, i64 0, i64 %34
  %36 = tail call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull %35)
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %41

38:                                               ; preds = %27
  br i1 %or.cond, label %.thread, label %39

39:                                               ; preds = %38
  tail call void @_ZN12CLzmaDecoder13DecodeLiteralEjj(ptr noundef nonnull align 8 dereferenceable(3790) %0, i32 noundef %.068, i32 noundef %.089.ph)
  %40 = tail call noundef i32 @_Z19UpdateState_Literalj(i32 noundef %.068)
  br label %.backedge

41:                                               ; preds = %27
  %42 = zext i32 %.068 to i64
  %43 = getelementptr inbounds [12 x i16], ptr %11, i64 0, i64 %42
  %44 = tail call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull %43)
  %.not = icmp eq i32 %44, 0
  br i1 %.not, label %69, label %45

45:                                               ; preds = %41
  br i1 %or.cond, label %.thread, label %46

46:                                               ; preds = %45
  %47 = tail call noundef zeroext i1 @_ZNK10COutWindow7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(40) %7)
  br i1 %47, label %.thread, label %48

48:                                               ; preds = %46
  %49 = getelementptr inbounds [12 x i16], ptr %12, i64 0, i64 %42
  %50 = tail call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull %49)
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %59

52:                                               ; preds = %48
  %53 = getelementptr inbounds [192 x i16], ptr %15, i64 0, i64 %34
  %54 = tail call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull %53)
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %.loopexit

56:                                               ; preds = %52
  %57 = tail call noundef i32 @_Z20UpdateState_ShortRepj(i32 noundef %.068)
  %58 = tail call noundef zeroext i8 @_ZNK10COutWindow7GetByteEj(ptr noundef nonnull align 8 dereferenceable(40) %7, i32 noundef %19)
  tail call void @_ZN10COutWindow7PutByteEh(ptr noundef nonnull align 8 dereferenceable(40) %7, i8 noundef zeroext %58)
  br label %.backedge

.backedge:                                        ; preds = %56, %39
  %.068.be = phi i32 [ %40, %39 ], [ %57, %56 ]
  %.094.be = add i64 %.094, -1
  br label %20, !llvm.loop !24

59:                                               ; preds = %48
  %60 = getelementptr inbounds [12 x i16], ptr %13, i64 0, i64 %42
  %61 = tail call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull %60)
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %.loopexit, label %63

63:                                               ; preds = %59
  %64 = getelementptr inbounds [12 x i16], ptr %14, i64 0, i64 %42
  %65 = tail call noundef i32 @_ZN13CRangeDecoder9DecodeBitEPt(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull %64)
  %66 = icmp eq i32 %65, 0
  %.072..078 = select i1 %66, i32 %.072.ph, i32 %.078.ph
  %.078..072 = select i1 %66, i32 %.078.ph, i32 %.072.ph
  br label %.loopexit

.loopexit:                                        ; preds = %52, %63, %59
  %.190 = phi i32 [ %.078..072, %63 ], [ %.084.ph, %59 ], [ %.089.ph, %52 ]
  %.185 = phi i32 [ %.089.ph, %63 ], [ %.089.ph, %59 ], [ %.084.ph, %52 ]
  %.280 = phi i32 [ %.084.ph, %63 ], [ %.078.ph, %59 ], [ %.078.ph, %52 ]
  %.375 = phi i32 [ %.072..078, %63 ], [ %.072.ph, %59 ], [ %.072.ph, %52 ]
  %67 = tail call noundef i32 @_ZN11CLenDecoder6DecodeEP13CRangeDecoderj(ptr noundef nonnull align 2 dereferenceable(1028) %16, ptr noundef nonnull %0, i32 noundef %31)
  %68 = tail call noundef i32 @_Z15UpdateState_Repj(i32 noundef %.068)
  br label %81

69:                                               ; preds = %41
  %70 = tail call noundef i32 @_ZN11CLenDecoder6DecodeEP13CRangeDecoderj(ptr noundef nonnull align 2 dereferenceable(1028) %17, ptr noundef nonnull %0, i32 noundef %31)
  %71 = tail call noundef i32 @_Z17UpdateState_Matchj(i32 noundef %.068)
  %72 = tail call noundef i32 @_ZN12CLzmaDecoder14DecodeDistanceEj(ptr noundef nonnull align 8 dereferenceable(3790) %0, i32 noundef %70)
  %73 = icmp eq i32 %72, -1
  br i1 %73, label %74, label %77

74:                                               ; preds = %69
  %75 = tail call noundef zeroext i1 @_ZNK13CRangeDecoder12IsFinishedOKEv(ptr noundef nonnull align 8 dereferenceable(17) %0)
  %76 = zext i1 %75 to i32
  br label %.thread

77:                                               ; preds = %69
  %78 = load i32, ptr %18, align 8
  %.not99 = icmp uge i32 %72, %78
  %or.cond111.not = select i1 %or.cond, i1 true, i1 %.not99
  br i1 %or.cond111.not, label %.thread, label %79

79:                                               ; preds = %77
  %80 = tail call noundef zeroext i1 @_ZNK10COutWindow13CheckDistanceEj(ptr noundef nonnull align 8 dereferenceable(40) %7, i32 noundef %72)
  br i1 %80, label %81, label %.thread

81:                                               ; preds = %79, %.loopexit
  %.291 = phi i32 [ %.190, %.loopexit ], [ %72, %79 ]
  %.286 = phi i32 [ %.185, %.loopexit ], [ %.089.ph, %79 ]
  %.381 = phi i32 [ %.280, %.loopexit ], [ %.084.ph, %79 ]
  %.476 = phi i32 [ %.375, %.loopexit ], [ %.078.ph, %79 ]
  %.169 = phi i32 [ %68, %.loopexit ], [ %71, %79 ]
  %.061 = phi i32 [ %67, %.loopexit ], [ %70, %79 ]
  %82 = add i32 %.061, 2
  %83 = zext i32 %82 to i64
  %84 = icmp ult i64 %.094, %83
  %or.cond101 = select i1 %1, i1 %84, i1 false
  %85 = trunc nuw i64 %.094 to i32
  %.162 = select i1 %or.cond101, i32 %85, i32 %82
  %86 = add i32 %.291, 1
  tail call void @_ZN10COutWindow9CopyMatchEjj(ptr noundef nonnull align 8 dereferenceable(40) %7, i32 noundef %86, i32 noundef %.162)
  %87 = zext i32 %.162 to i64
  %88 = sub i64 %.094, %87
  br i1 %or.cond101, label %.thread, label %.outer

.thread:                                          ; preds = %46, %45, %38, %25, %81, %79, %77, %74, %3
  %.5 = phi i32 [ 0, %3 ], [ %76, %74 ], [ 2, %25 ], [ 0, %46 ], [ 0, %45 ], [ 0, %38 ], [ 0, %81 ], [ 0, %79 ], [ 0, %77 ]
  ret i32 %.5
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12CLzmaDecoder4InitEv(ptr noundef nonnull align 8 dereferenceable(3790)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK13CRangeDecoder12IsFinishedOKEv(ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12CLzmaDecoder13DecodeLiteralEjj(ptr noundef nonnull align 8 dereferenceable(3790), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10COutWindow7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10COutWindow7PutByteEh(ptr noundef nonnull align 8 dereferenceable(40), i8 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZNK10COutWindow7GetByteEj(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN11CLenDecoder6DecodeEP13CRangeDecoderj(ptr noundef nonnull align 2 dereferenceable(1028), ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN12CLzmaDecoder14DecodeDistanceEj(ptr noundef nonnull align 8 dereferenceable(3790), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10COutWindow13CheckDistanceEj(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10COutWindow9CopyMatchEjj(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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 = { 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, !12, i64 64}
!6 = !{!"_ZTS12CLzmaDecoder", !7, i64 0, !13, i64 24, !12, i64 64, !8, i64 68, !8, i64 72, !8, i64 76, !8, i64 80, !8, i64 84, !11, i64 88, !9, i64 96, !16, i64 608, !9, i64 640, !9, i64 870, !9, i64 1254, !9, i64 1278, !9, i64 1302, !9, i64 1326, !9, i64 1350, !17, i64 1734, !17, i64 2762}
!7 = !{!"_ZTS13CRangeDecoder", !8, i64 0, !8, i64 4, !11, i64 8, !12, i64 16}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"_ZTS10COutWindow", !11, i64 0, !8, i64 8, !8, i64 12, !12, i64 16, !8, i64 20, !14, i64 24}
!14 = !{!"_ZTS10COutStream", !11, i64 0, !15, i64 8}
!15 = !{!"long long", !9, i64 0}
!16 = !{!"_ZTS15CBitTreeDecoderILj4EE", !9, i64 0}
!17 = !{!"_ZTS11CLenDecoder", !18, i64 0, !18, i64 2, !9, i64 4, !9, i64 260, !19, i64 516}
!18 = !{!"short", !9, i64 0}
!19 = !{!"_ZTS15CBitTreeDecoderILj8EE", !9, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!6, !8, i64 44}
!23 = !{!6, !8, i64 72}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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