; LLVM IR from intel/qpl :: sources/isal/igzip (igzip_base)

; 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.isal_zstream = type { ptr, i32, i32, ptr, i32, i32, ptr, i32, i32, ptr, i16, i16, i16, i16, %struct.isal_zstate }
%struct.isal_zstate = type { i32, i32, i32, i32, i32, i32, %struct.BitBuf2, i32, i8, i8, i8, i8, i16, i32, [16 x i8], i32, i32, i32, i32, [65824 x i8], [8192 x i16] }
%struct.BitBuf2 = type { i64, i32, ptr, ptr, ptr }

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @set_buf(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_full(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @update_state(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @load_u32(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @compute_hash(i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @compare258(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @get_len_code(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @get_dist_code(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @write_bits(ptr noundef, i64 noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @get_lit_code(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @qpl_isal_deflate_finish_base(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i16, align 2
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #3
  store i16 0, ptr %7, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store i64 0, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.isal_zstream, ptr %22, i32 0, i32 14
  store ptr %23, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %24 = load ptr, ptr %13, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.isal_zstate, ptr %24, i32 0, i32 20
  %26 = getelementptr inbounds [8192 x i16], ptr %25, i64 0, i64 0
  store ptr %26, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.isal_zstream, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !15
  %30 = ptrtoint ptr %29 to i64
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.isal_zstream, ptr %31, i32 0, i32 2
  %33 = load i32, ptr %32, align 4, !tbaa !19
  %34 = zext i32 %33 to i64
  %35 = sub i64 %30, %34
  %36 = inttoptr i64 %35 to ptr
  store ptr %36, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.isal_zstate, ptr %37, i32 0, i32 3
  %39 = load i32, ptr %38, align 4, !tbaa !20
  store i32 %39, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %40 = load ptr, ptr %13, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.isal_zstate, ptr %40, i32 0, i32 4
  %42 = load i32, ptr %41, align 8, !tbaa !21
  store i32 %42, ptr %17, align 4, !tbaa !9
  %43 = load ptr, ptr %13, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.isal_zstate, ptr %43, i32 0, i32 6
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.isal_zstream, ptr %45, i32 0, i32 3
  %47 = load ptr, ptr %46, align 8, !tbaa !22
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.isal_zstream, ptr %48, i32 0, i32 4
  %50 = load i32, ptr %49, align 8, !tbaa !23
  call void @set_buf(ptr noundef %44, ptr noundef %47, i32 noundef %50)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.isal_zstream, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  store ptr %53, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %54 = load ptr, ptr %18, align 8, !tbaa !5
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.isal_zstream, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 8, !tbaa !24
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %54, i64 %58
  store ptr %59, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %60 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %60, ptr %20, align 8, !tbaa !5
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.isal_zstream, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 8, !tbaa !24
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %239

65:                                               ; preds = %1
  br label %66

66:                                               ; preds = %194, %165, %65
  %67 = load ptr, ptr %20, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 3
  %69 = load ptr, ptr %19, align 8, !tbaa !5
  %70 = icmp ult ptr %68, %69
  br i1 %70, label %71, label %207

71:                                               ; preds = %66
  %72 = load ptr, ptr %13, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.isal_zstate, ptr %72, i32 0, i32 6
  %74 = call i32 @is_full(ptr noundef %73)
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %81

76:                                               ; preds = %71
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = load ptr, ptr %18, align 8, !tbaa !5
  %79 = load ptr, ptr %20, align 8, !tbaa !5
  %80 = load ptr, ptr %19, align 8, !tbaa !5
  call void @update_state(ptr noundef %77, ptr noundef %78, ptr noundef %79, ptr noundef %80)
  store i32 1, ptr %21, align 4
  br label %272

81:                                               ; preds = %71
  %82 = load ptr, ptr %20, align 8, !tbaa !5
  %83 = call i32 @load_u32(ptr noundef %82)
  store i32 %83, ptr %3, align 4, !tbaa !9
  %84 = load i32, ptr %3, align 4, !tbaa !9
  %85 = call i32 @compute_hash(i32 noundef %84)
  %86 = load i32, ptr %17, align 4, !tbaa !9
  %87 = and i32 %85, %86
  store i32 %87, ptr %4, align 4, !tbaa !9
  %88 = load ptr, ptr %20, align 8, !tbaa !5
  %89 = load ptr, ptr %15, align 8, !tbaa !5
  %90 = ptrtoint ptr %88 to i64
  %91 = ptrtoint ptr %89 to i64
  %92 = sub i64 %90, %91
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  %94 = load i32, ptr %4, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds i16, ptr %93, i64 %95
  %97 = load i16, ptr %96, align 2, !tbaa !11
  %98 = zext i16 %97 to i64
  %99 = sub nsw i64 %92, %98
  %100 = and i64 %99, 65535
  %101 = trunc i64 %100 to i32
  store i32 %101, ptr %8, align 4, !tbaa !9
  %102 = load ptr, ptr %20, align 8, !tbaa !5
  %103 = load ptr, ptr %15, align 8, !tbaa !5
  %104 = ptrtoint ptr %102 to i64
  %105 = ptrtoint ptr %103 to i64
  %106 = sub i64 %104, %105
  %107 = trunc i64 %106 to i16
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = load i32, ptr %4, align 4, !tbaa !9
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds i16, ptr %108, i64 %110
  store i16 %107, ptr %111, align 2, !tbaa !11
  %112 = load i32, ptr %8, align 4, !tbaa !9
  %113 = sub i32 %112, 1
  %114 = load i32, ptr %16, align 4, !tbaa !9
  %115 = icmp ult i32 %113, %114
  br i1 %115, label %116, label %194

116:                                              ; preds = %81
  %117 = load ptr, ptr %20, align 8, !tbaa !5
  %118 = load i32, ptr %8, align 4, !tbaa !9
  %119 = zext i32 %118 to i64
  %120 = sub i64 0, %119
  %121 = getelementptr inbounds i8, ptr %117, i64 %120
  %122 = load ptr, ptr %20, align 8, !tbaa !5
  %123 = load ptr, ptr %19, align 8, !tbaa !5
  %124 = load ptr, ptr %20, align 8, !tbaa !5
  %125 = ptrtoint ptr %123 to i64
  %126 = ptrtoint ptr %124 to i64
  %127 = sub i64 %125, %126
  %128 = trunc i64 %127 to i32
  %129 = call i32 @compare258(ptr noundef %121, ptr noundef %122, i32 noundef %128)
  %130 = trunc i32 %129 to i16
  store i16 %130, ptr %7, align 2, !tbaa !11
  %131 = load i16, ptr %7, align 2, !tbaa !11
  %132 = zext i16 %131 to i32
  %133 = icmp sge i32 %132, 4
  br i1 %133, label %134, label %193

134:                                              ; preds = %116
  %135 = load ptr, ptr %20, align 8, !tbaa !5
  store ptr %135, ptr %6, align 8, !tbaa !5
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = getelementptr inbounds i8, ptr %136, i64 3
  store ptr %137, ptr %5, align 8, !tbaa !5
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds i8, ptr %138, i32 1
  store ptr %139, ptr %6, align 8, !tbaa !5
  br label %140

140:                                              ; preds = %162, %134
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds i8, ptr %142, i64 -3
  %144 = icmp ult ptr %141, %143
  br i1 %144, label %145, label %165

145:                                              ; preds = %140
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  %147 = call i32 @load_u32(ptr noundef %146)
  store i32 %147, ptr %3, align 4, !tbaa !9
  %148 = load i32, ptr %3, align 4, !tbaa !9
  %149 = call i32 @compute_hash(i32 noundef %148)
  %150 = load i32, ptr %17, align 4, !tbaa !9
  %151 = and i32 %149, %150
  store i32 %151, ptr %4, align 4, !tbaa !9
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = load ptr, ptr %15, align 8, !tbaa !5
  %154 = ptrtoint ptr %152 to i64
  %155 = ptrtoint ptr %153 to i64
  %156 = sub i64 %154, %155
  %157 = trunc i64 %156 to i16
  %158 = load ptr, ptr %14, align 8, !tbaa !5
  %159 = load i32, ptr %4, align 4, !tbaa !9
  %160 = zext i32 %159 to i64
  %161 = getelementptr inbounds i16, ptr %158, i64 %160
  store i16 %157, ptr %161, align 2, !tbaa !11
  br label %162

162:                                              ; preds = %145
  %163 = load ptr, ptr %6, align 8, !tbaa !5
  %164 = getelementptr inbounds i8, ptr %163, i32 1
  store ptr %164, ptr %6, align 8, !tbaa !5
  br label %140, !llvm.loop !25

165:                                              ; preds = %140
  %166 = load ptr, ptr %2, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.isal_zstream, ptr %166, i32 0, i32 6
  %168 = load ptr, ptr %167, align 8, !tbaa !27
  %169 = load i16, ptr %7, align 2, !tbaa !11
  %170 = zext i16 %169 to i32
  call void @get_len_code(ptr noundef %168, i32 noundef %170, ptr noundef %9, ptr noundef %10)
  %171 = load ptr, ptr %2, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.isal_zstream, ptr %171, i32 0, i32 6
  %173 = load ptr, ptr %172, align 8, !tbaa !27
  %174 = load i32, ptr %8, align 4, !tbaa !9
  call void @get_dist_code(ptr noundef %173, i32 noundef %174, ptr noundef %11, ptr noundef %12)
  %175 = load i64, ptr %11, align 8, !tbaa !13
  %176 = load i64, ptr %10, align 8, !tbaa !13
  %177 = shl i64 %175, %176
  %178 = load i64, ptr %9, align 8, !tbaa !13
  %179 = or i64 %178, %177
  store i64 %179, ptr %9, align 8, !tbaa !13
  %180 = load i64, ptr %12, align 8, !tbaa !13
  %181 = load i64, ptr %10, align 8, !tbaa !13
  %182 = add i64 %181, %180
  store i64 %182, ptr %10, align 8, !tbaa !13
  %183 = load ptr, ptr %13, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.isal_zstate, ptr %183, i32 0, i32 6
  %185 = load i64, ptr %9, align 8, !tbaa !13
  %186 = load i64, ptr %10, align 8, !tbaa !13
  %187 = trunc i64 %186 to i32
  call void @write_bits(ptr noundef %184, i64 noundef %185, i32 noundef %187)
  %188 = load i16, ptr %7, align 2, !tbaa !11
  %189 = zext i16 %188 to i32
  %190 = load ptr, ptr %20, align 8, !tbaa !5
  %191 = sext i32 %189 to i64
  %192 = getelementptr inbounds i8, ptr %190, i64 %191
  store ptr %192, ptr %20, align 8, !tbaa !5
  br label %66, !llvm.loop !28

193:                                              ; preds = %116
  br label %194

194:                                              ; preds = %193, %81
  %195 = load ptr, ptr %2, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.isal_zstream, ptr %195, i32 0, i32 6
  %197 = load ptr, ptr %196, align 8, !tbaa !27
  %198 = load i32, ptr %3, align 4, !tbaa !9
  %199 = and i32 %198, 255
  call void @get_lit_code(ptr noundef %197, i32 noundef %199, ptr noundef %9, ptr noundef %10)
  %200 = load ptr, ptr %13, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.isal_zstate, ptr %200, i32 0, i32 6
  %202 = load i64, ptr %9, align 8, !tbaa !13
  %203 = load i64, ptr %10, align 8, !tbaa !13
  %204 = trunc i64 %203 to i32
  call void @write_bits(ptr noundef %201, i64 noundef %202, i32 noundef %204)
  %205 = load ptr, ptr %20, align 8, !tbaa !5
  %206 = getelementptr inbounds i8, ptr %205, i32 1
  store ptr %206, ptr %20, align 8, !tbaa !5
  br label %66, !llvm.loop !28

207:                                              ; preds = %66
  br label %208

208:                                              ; preds = %222, %207
  %209 = load ptr, ptr %20, align 8, !tbaa !5
  %210 = load ptr, ptr %19, align 8, !tbaa !5
  %211 = icmp ult ptr %209, %210
  br i1 %211, label %212, label %238

212:                                              ; preds = %208
  %213 = load ptr, ptr %13, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.isal_zstate, ptr %213, i32 0, i32 6
  %215 = call i32 @is_full(ptr noundef %214)
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %217, label %222

217:                                              ; preds = %212
  %218 = load ptr, ptr %2, align 8, !tbaa !5
  %219 = load ptr, ptr %18, align 8, !tbaa !5
  %220 = load ptr, ptr %20, align 8, !tbaa !5
  %221 = load ptr, ptr %19, align 8, !tbaa !5
  call void @update_state(ptr noundef %218, ptr noundef %219, ptr noundef %220, ptr noundef %221)
  store i32 1, ptr %21, align 4
  br label %272

222:                                              ; preds = %212
  %223 = load ptr, ptr %20, align 8, !tbaa !5
  %224 = load i8, ptr %223, align 1, !tbaa !29
  %225 = zext i8 %224 to i32
  store i32 %225, ptr %3, align 4, !tbaa !9
  %226 = load ptr, ptr %2, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.isal_zstream, ptr %226, i32 0, i32 6
  %228 = load ptr, ptr %227, align 8, !tbaa !27
  %229 = load i32, ptr %3, align 4, !tbaa !9
  %230 = and i32 %229, 255
  call void @get_lit_code(ptr noundef %228, i32 noundef %230, ptr noundef %9, ptr noundef %10)
  %231 = load ptr, ptr %13, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.isal_zstate, ptr %231, i32 0, i32 6
  %233 = load i64, ptr %9, align 8, !tbaa !13
  %234 = load i64, ptr %10, align 8, !tbaa !13
  %235 = trunc i64 %234 to i32
  call void @write_bits(ptr noundef %232, i64 noundef %233, i32 noundef %235)
  %236 = load ptr, ptr %20, align 8, !tbaa !5
  %237 = getelementptr inbounds i8, ptr %236, i32 1
  store ptr %237, ptr %20, align 8, !tbaa !5
  br label %208, !llvm.loop !30

238:                                              ; preds = %208
  br label %239

239:                                              ; preds = %238, %1
  %240 = load ptr, ptr %13, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.isal_zstate, ptr %240, i32 0, i32 6
  %242 = call i32 @is_full(ptr noundef %241)
  %243 = icmp ne i32 %242, 0
  br i1 %243, label %267, label %244

244:                                              ; preds = %239
  %245 = load ptr, ptr %2, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.isal_zstream, ptr %245, i32 0, i32 6
  %247 = load ptr, ptr %246, align 8, !tbaa !27
  call void @get_lit_code(ptr noundef %247, i32 noundef 256, ptr noundef %9, ptr noundef %10)
  %248 = load ptr, ptr %13, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.isal_zstate, ptr %248, i32 0, i32 6
  %250 = load i64, ptr %9, align 8, !tbaa !13
  %251 = load i64, ptr %10, align 8, !tbaa !13
  %252 = trunc i64 %251 to i32
  call void @write_bits(ptr noundef %249, i64 noundef %250, i32 noundef %252)
  %253 = load ptr, ptr %13, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct.isal_zstate, ptr %253, i32 0, i32 10
  store i8 1, ptr %254, align 2, !tbaa !31
  %255 = load ptr, ptr %2, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.isal_zstream, ptr %255, i32 0, i32 10
  %257 = load i16, ptr %256, align 8, !tbaa !32
  %258 = zext i16 %257 to i32
  %259 = icmp eq i32 %258, 1
  br i1 %259, label %260, label %263

260:                                              ; preds = %244
  %261 = load ptr, ptr %13, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.isal_zstate, ptr %261, i32 0, i32 5
  store i32 10, ptr %262, align 4, !tbaa !33
  br label %266

263:                                              ; preds = %244
  %264 = load ptr, ptr %13, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.isal_zstate, ptr %264, i32 0, i32 5
  store i32 8, ptr %265, align 4, !tbaa !33
  br label %266

266:                                              ; preds = %263, %260
  br label %267

267:                                              ; preds = %266, %239
  %268 = load ptr, ptr %2, align 8, !tbaa !5
  %269 = load ptr, ptr %18, align 8, !tbaa !5
  %270 = load ptr, ptr %20, align 8, !tbaa !5
  %271 = load ptr, ptr %19, align 8, !tbaa !5
  call void @update_state(ptr noundef %268, ptr noundef %269, ptr noundef %270, ptr noundef %271)
  store i32 0, ptr %21, align 4
  br label %272

272:                                              ; preds = %267, %217, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  %273 = load i32, ptr %21, align 4
  switch i32 %273, label %275 [
    i32 0, label %274
    i32 1, label %274
  ]

274:                                              ; preds = %272, %272
  ret void

275:                                              ; preds = %272
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"isal_zstream", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24, !10, i64 28, !6, i64 32, !10, i64 40, !10, i64 44, !6, i64 48, !12, i64 56, !12, i64 58, !12, i64 60, !12, i64 62, !17, i64 64}
!17 = !{!"isal_zstate", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !18, i64 24, !10, i64 64, !7, i64 68, !7, i64 69, !7, i64 70, !7, i64 71, !12, i64 72, !10, i64 76, !7, i64 80, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !7, i64 112, !7, i64 65936}
!18 = !{!"BitBuf2", !14, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!19 = !{!16, !10, i64 12}
!20 = !{!17, !10, i64 12}
!21 = !{!17, !10, i64 16}
!22 = !{!16, !6, i64 16}
!23 = !{!16, !10, i64 24}
!24 = !{!16, !10, i64 8}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!16, !6, i64 32}
!28 = distinct !{!28, !26}
!29 = !{!7, !7, i64 0}
!30 = distinct !{!30, !26}
!31 = !{!17, !7, i64 70}
!32 = !{!16, !12, i64 56}
!33 = !{!17, !10, i64 20}


; 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: inlinehint nounwind uwtable
declare hidden void @set_buf(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_full(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @update_state(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @load_u32(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @compute_hash(i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @compare258(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @get_len_code(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @get_dist_code(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @write_bits(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @get_lit_code(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @qpl_isal_deflate_finish_base(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  store i64 0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  store i64 0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  store i64 0, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 66000
  %7 = load ptr, ptr %0, align 8, !tbaa !9
  %8 = ptrtoint ptr %7 to i64
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  %10 = load i32, ptr %9, align 4, !tbaa !16
  %11 = zext i32 %10 to i64
  %.neg = sub i64 %11, %8
  %12 = getelementptr inbounds i8, ptr %0, i64 76
  %13 = load i32, ptr %12, align 4, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %0, i64 80
  %15 = load i32, ptr %14, align 8, !tbaa !18
  %16 = getelementptr inbounds i8, ptr %0, i64 88
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = load i32, ptr %19, align 8, !tbaa !20
  tail call void @set_buf(ptr noundef nonnull %16, ptr noundef %18, i32 noundef %20)
  %21 = load ptr, ptr %0, align 8, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load i32, ptr %22, align 8, !tbaa !21
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds i8, ptr %21, i64 %24
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %.loopexit, label %.preheader95

.preheader95:                                     ; preds = %1
  %26 = icmp ugt i32 %23, 3
  br i1 %26, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %.preheader95
  %27 = ptrtoint ptr %25 to i64
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  br label %31

.preheader:                                       ; preds = %.backedge, %.preheader95
  %.0.lcssa = phi ptr [ %21, %.preheader95 ], [ %66, %.backedge ]
  %29 = icmp ult ptr %.0.lcssa, %25
  br i1 %29, label %.lr.ph102, label %.loopexit

.lr.ph102:                                        ; preds = %.preheader
  %30 = getelementptr inbounds i8, ptr %0, i64 32
  br label %75

31:                                               ; preds = %.lr.ph, %.backedge
  %.0100 = phi ptr [ %21, %.lr.ph ], [ %66, %.backedge ]
  %32 = call i32 @is_full(ptr noundef nonnull %16)
  %.not93 = icmp eq i32 %32, 0
  br i1 %.not93, label %34, label %33

33:                                               ; preds = %31
  call void @update_state(ptr noundef nonnull %0, ptr noundef %21, ptr noundef %.0100, ptr noundef nonnull %25)
  br label %99

34:                                               ; preds = %31
  %35 = call i32 @load_u32(ptr noundef %.0100)
  %36 = call i32 @compute_hash(i32 noundef %35)
  %37 = and i32 %36, %15
  %38 = ptrtoint ptr %.0100 to i64
  %39 = add i64 %.neg, %38
  %40 = zext i32 %37 to i64
  %41 = getelementptr inbounds i16, ptr %6, i64 %40
  %42 = load i16, ptr %41, align 2, !tbaa !22
  %.tr = trunc i64 %39 to i16
  %.narrow = sub i16 %.tr, %42
  %43 = zext i16 %.narrow to i32
  store i16 %.tr, ptr %41, align 2, !tbaa !22
  %44 = add nsw i32 %43, -1
  %45 = icmp ult i32 %44, %13
  br i1 %45, label %46, label %69

46:                                               ; preds = %34
  %47 = zext i16 %.narrow to i64
  %48 = sub nsw i64 0, %47
  %49 = getelementptr inbounds i8, ptr %.0100, i64 %48
  %50 = sub i64 %27, %38
  %51 = trunc i64 %50 to i32
  %52 = call i32 @compare258(ptr noundef %49, ptr noundef %.0100, i32 noundef %51)
  %53 = and i32 %52, 65535
  %54 = icmp ugt i32 %53, 3
  br i1 %54, label %.preheader94, label %69

.preheader94:                                     ; preds = %46
  %55 = load ptr, ptr %28, align 8, !tbaa !23
  call void @get_len_code(ptr noundef %55, i32 noundef %53, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %56 = load ptr, ptr %28, align 8, !tbaa !23
  call void @get_dist_code(ptr noundef %56, i32 noundef %43, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %57 = load i64, ptr %4, align 8, !tbaa !5
  %58 = load i64, ptr %3, align 8, !tbaa !5
  %59 = shl i64 %57, %58
  %60 = load i64, ptr %2, align 8, !tbaa !5
  %61 = or i64 %60, %59
  store i64 %61, ptr %2, align 8, !tbaa !5
  %62 = load i64, ptr %5, align 8, !tbaa !5
  %63 = add i64 %62, %58
  store i64 %63, ptr %3, align 8, !tbaa !5
  %64 = trunc i64 %63 to i32
  call void @write_bits(ptr noundef nonnull %16, i64 noundef %61, i32 noundef %64)
  %65 = zext nneg i32 %53 to i64
  br label %.backedge

.backedge:                                        ; preds = %.preheader94, %69
  %.sink = phi i64 [ %65, %.preheader94 ], [ 1, %69 ]
  %66 = getelementptr inbounds i8, ptr %.0100, i64 %.sink
  %67 = getelementptr inbounds i8, ptr %66, i64 3
  %68 = icmp ult ptr %67, %25
  br i1 %68, label %31, label %.preheader, !llvm.loop !24

69:                                               ; preds = %46, %34
  %70 = load ptr, ptr %28, align 8, !tbaa !23
  %71 = and i32 %35, 255
  call void @get_lit_code(ptr noundef %70, i32 noundef %71, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %72 = load i64, ptr %2, align 8, !tbaa !5
  %73 = load i64, ptr %3, align 8, !tbaa !5
  %74 = trunc i64 %73 to i32
  call void @write_bits(ptr noundef nonnull %16, i64 noundef %72, i32 noundef %74)
  br label %.backedge

75:                                               ; preds = %.lr.ph102, %78
  %.1101 = phi ptr [ %.0.lcssa, %.lr.ph102 ], [ %85, %78 ]
  %76 = call i32 @is_full(ptr noundef nonnull %16)
  %.not92 = icmp eq i32 %76, 0
  br i1 %.not92, label %78, label %77

77:                                               ; preds = %75
  call void @update_state(ptr noundef nonnull %0, ptr noundef %21, ptr noundef %.1101, ptr noundef nonnull %25)
  br label %99

78:                                               ; preds = %75
  %79 = load i8, ptr %.1101, align 1, !tbaa !26
  %80 = zext i8 %79 to i32
  %81 = load ptr, ptr %30, align 8, !tbaa !23
  call void @get_lit_code(ptr noundef %81, i32 noundef %80, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %82 = load i64, ptr %2, align 8, !tbaa !5
  %83 = load i64, ptr %3, align 8, !tbaa !5
  %84 = trunc i64 %83 to i32
  call void @write_bits(ptr noundef nonnull %16, i64 noundef %82, i32 noundef %84)
  %85 = getelementptr inbounds i8, ptr %.1101, i64 1
  %86 = icmp ult ptr %85, %25
  br i1 %86, label %75, label %.loopexit, !llvm.loop !27

.loopexit:                                        ; preds = %78, %.preheader, %1
  %.2 = phi ptr [ %21, %1 ], [ %.0.lcssa, %.preheader ], [ %85, %78 ]
  %87 = call i32 @is_full(ptr noundef nonnull %16)
  %.not91 = icmp eq i32 %87, 0
  br i1 %.not91, label %.sink.split, label %98

.sink.split:                                      ; preds = %.loopexit
  %88 = getelementptr inbounds i8, ptr %0, i64 32
  %89 = load ptr, ptr %88, align 8, !tbaa !23
  call void @get_lit_code(ptr noundef %89, i32 noundef 256, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %90 = load i64, ptr %2, align 8, !tbaa !5
  %91 = load i64, ptr %3, align 8, !tbaa !5
  %92 = trunc i64 %91 to i32
  call void @write_bits(ptr noundef nonnull %16, i64 noundef %90, i32 noundef %92)
  %93 = getelementptr inbounds i8, ptr %0, i64 134
  store i8 1, ptr %93, align 2, !tbaa !28
  %94 = getelementptr inbounds i8, ptr %0, i64 56
  %95 = load i16, ptr %94, align 8, !tbaa !29
  %96 = icmp eq i16 %95, 1
  %97 = getelementptr inbounds i8, ptr %0, i64 84
  %. = select i1 %96, i32 10, i32 8
  store i32 %., ptr %97, align 4, !tbaa !30
  br label %98

98:                                               ; preds = %.sink.split, %.loopexit
  call void @update_state(ptr noundef nonnull %0, ptr noundef %21, ptr noundef %.2, ptr noundef %25)
  br label %99

99:                                               ; preds = %98, %77, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"isal_zstream", !11, i64 0, !12, i64 8, !12, i64 12, !11, i64 16, !12, i64 24, !12, i64 28, !11, i64 32, !12, i64 40, !12, i64 44, !11, i64 48, !13, i64 56, !13, i64 58, !13, i64 60, !13, i64 62, !14, i64 64}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!"isal_zstate", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !15, i64 24, !12, i64 64, !7, i64 68, !7, i64 69, !7, i64 70, !7, i64 71, !13, i64 72, !12, i64 76, !7, i64 80, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !7, i64 112, !7, i64 65936}
!15 = !{!"BitBuf2", !6, i64 0, !12, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!16 = !{!10, !12, i64 12}
!17 = !{!14, !12, i64 12}
!18 = !{!14, !12, i64 16}
!19 = !{!10, !11, i64 16}
!20 = !{!10, !12, i64 24}
!21 = !{!10, !12, i64 8}
!22 = !{!13, !13, i64 0}
!23 = !{!10, !11, i64 32}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!7, !7, i64 0}
!27 = distinct !{!27, !25}
!28 = !{!14, !7, i64 70}
!29 = !{!10, !13, i64 56}
!30 = !{!14, !12, i64 20}


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