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

; 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.heap_tree = type { %union.anon.1 }
%union.anon.1 = type { [859 x i64] }
%struct.rl_code = type { i8, i8 }
%struct.BitBuf2 = type { i64, i32, ptr, ptr, ptr }
%struct.hufftables_icf = type { %union.anon.2 }
%union.anon.2 = type { %struct.anon.3 }
%struct.anon.3 = type { [31 x %struct.huff_code], [513 x %struct.huff_code] }
%struct.huff_code = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { i32 }
%struct.isal_mod_hist = type { [30 x i32], [513 x i32] }
%struct.anon.0 = type { i16, i8, i8 }

@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__.qpl_create_hufftables_icf = external hidden unnamed_addr constant [112 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@len_code_extra_bits = external hidden constant [29 x i32], align 16
@dist_code_extra_bits = external hidden constant [30 x i32], align 16
@static_hufftables = external hidden global { { { [31 x { { { i8, i8, i8, i8 } } }], <{ [288 x { { { i8, i8, i8, i8 } } }], [225 x { { { i8, i8, i8, i8 } } }] }> } } }, align 4

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @qpl_create_hufftables_icf(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca [16 x i32], align 16
  %10 = alloca %struct.heap_tree, align 8
  %11 = alloca [316 x %struct.rl_code], align 16
  %12 = alloca i32, align 4
  %13 = alloca [19 x i64], align 16
  %14 = alloca [316 x i16], align 16
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca %struct.BitBuf2, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 6872, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 632, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 152, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 632, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store i64 0, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  store i64 3, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 40, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.hufftables_icf, ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds %struct.anon.3, ptr %29, i32 0, i32 1
  %31 = getelementptr inbounds [513 x %struct.huff_code], ptr %30, i64 0, i64 0
  store ptr %31, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.hufftables_icf, ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds %struct.anon.3, ptr %33, i32 0, i32 0
  %35 = getelementptr inbounds [31 x %struct.huff_code], ptr %34, i64 0, i64 0
  store ptr %35, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.isal_mod_hist, ptr %36, i32 0, i32 1
  %38 = getelementptr inbounds [513 x i32], ptr %37, i64 0, i64 0
  store ptr %38, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.isal_mod_hist, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds [30 x i32], ptr %40, i64 0, i64 0
  store ptr %41, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  store ptr getelementptr inbounds (%struct.anon.3, ptr @static_hufftables, i32 0, i32 1), ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  store ptr @static_hufftables, ptr %24, align 8, !tbaa !5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %42, i64 40, i1 false)
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.isal_mod_hist, ptr %43, i32 0, i32 1
  %45 = getelementptr inbounds [513 x i32], ptr %44, i64 0, i64 0
  call void @qpl_flatten_ll(ptr noundef %45)
  %46 = load ptr, ptr %21, align 8, !tbaa !5
  %47 = getelementptr inbounds i32, ptr %46, i64 256
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %53

50:                                               ; preds = %4
  %51 = load ptr, ptr %21, align 8, !tbaa !5
  %52 = getelementptr inbounds i32, ptr %51, i64 256
  store i32 1, ptr %52, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %50, %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  %54 = load ptr, ptr %21, align 8, !tbaa !5
  %55 = call i32 @init_heap32(ptr noundef %10, ptr noundef %54, i32 noundef 286)
  store i32 %55, ptr %25, align 4, !tbaa !9
  %56 = load i32, ptr %25, align 4, !tbaa !9
  %57 = getelementptr inbounds [16 x i32], ptr %9, i64 0, i64 0
  %58 = load ptr, ptr %19, align 8, !tbaa !5
  call void @gen_huff_code_lens(ptr noundef %10, i32 noundef %56, ptr noundef %57, ptr noundef %58, i32 noundef 286, i32 noundef 15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %59 = load ptr, ptr %19, align 8, !tbaa !5
  %60 = getelementptr inbounds [16 x i32], ptr %9, i64 0, i64 0
  %61 = call i32 @set_huff_codes(ptr noundef %59, i32 noundef 286, ptr noundef %60)
  store i32 %61, ptr %26, align 4, !tbaa !9
  %62 = load ptr, ptr %22, align 8, !tbaa !5
  %63 = call i32 @init_heap32(ptr noundef %10, ptr noundef %62, i32 noundef 30)
  store i32 %63, ptr %25, align 4, !tbaa !9
  %64 = load i32, ptr %25, align 4, !tbaa !9
  %65 = getelementptr inbounds [16 x i32], ptr %9, i64 0, i64 0
  %66 = load ptr, ptr %20, align 8, !tbaa !5
  call void @gen_huff_code_lens(ptr noundef %10, i32 noundef %64, ptr noundef %65, ptr noundef %66, i32 noundef 30, i32 noundef 15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %67 = load ptr, ptr %20, align 8, !tbaa !5
  %68 = getelementptr inbounds [16 x i32], ptr %9, i64 0, i64 0
  %69 = call i32 @set_dist_huff_codes(ptr noundef %67, ptr noundef %68)
  store i32 %69, ptr %27, align 4, !tbaa !9
  %70 = load i32, ptr %26, align 4, !tbaa !9
  %71 = icmp uge i32 %70, 256
  br i1 %71, label %72, label %73

72:                                               ; preds = %53
  br label %74

73:                                               ; preds = %53
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 1549, ptr noundef @__PRETTY_FUNCTION__.qpl_create_hufftables_icf) #8
  unreachable

74:                                               ; preds = %72
  %75 = load i32, ptr %27, align 4, !tbaa !9
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  br label %79

78:                                               ; preds = %74
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 1550, ptr noundef @__PRETTY_FUNCTION__.qpl_create_hufftables_icf) #8
  unreachable

79:                                               ; preds = %77
  %80 = getelementptr inbounds [19 x i64], ptr %13, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %80, i8 0, i64 152, i1 false)
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %130, %79
  %82 = load i32, ptr %15, align 4, !tbaa !9
  %83 = icmp ule i32 %82, 256
  br i1 %83, label %84, label %133

84:                                               ; preds = %81
  %85 = load ptr, ptr %19, align 8, !tbaa !5
  %86 = load i32, ptr %15, align 4, !tbaa !9
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds %struct.huff_code, ptr %85, i64 %87
  %89 = getelementptr inbounds %struct.huff_code, ptr %88, i32 0, i32 0
  %90 = getelementptr inbounds %struct.anon.0, ptr %89, i32 0, i32 2
  %91 = load i8, ptr %90, align 1, !tbaa !13
  %92 = zext i8 %91 to i16
  %93 = load i32, ptr %15, align 4, !tbaa !9
  %94 = zext i32 %93 to i64
  %95 = getelementptr inbounds [316 x i16], ptr %14, i64 0, i64 %94
  store i16 %92, ptr %95, align 2, !tbaa !14
  %96 = load ptr, ptr %19, align 8, !tbaa !5
  %97 = load i32, ptr %15, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds %struct.huff_code, ptr %96, i64 %98
  %100 = getelementptr inbounds %struct.huff_code, ptr %99, i32 0, i32 0
  %101 = getelementptr inbounds %struct.anon.0, ptr %100, i32 0, i32 2
  %102 = load i8, ptr %101, align 1, !tbaa !13
  %103 = zext i8 %102 to i32
  %104 = load ptr, ptr %21, align 8, !tbaa !5
  %105 = load i32, ptr %15, align 4, !tbaa !9
  %106 = zext i32 %105 to i64
  %107 = getelementptr inbounds i32, ptr %104, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = mul i32 %103, %108
  %110 = zext i32 %109 to i64
  %111 = load i64, ptr %16, align 8, !tbaa !11
  %112 = add i64 %111, %110
  store i64 %112, ptr %16, align 8, !tbaa !11
  %113 = load ptr, ptr %23, align 8, !tbaa !5
  %114 = load i32, ptr %15, align 4, !tbaa !9
  %115 = zext i32 %114 to i64
  %116 = getelementptr inbounds %struct.huff_code, ptr %113, i64 %115
  %117 = getelementptr inbounds %struct.huff_code, ptr %116, i32 0, i32 0
  %118 = getelementptr inbounds %struct.anon.0, ptr %117, i32 0, i32 2
  %119 = load i8, ptr %118, align 1, !tbaa !13
  %120 = zext i8 %119 to i32
  %121 = load ptr, ptr %21, align 8, !tbaa !5
  %122 = load i32, ptr %15, align 4, !tbaa !9
  %123 = zext i32 %122 to i64
  %124 = getelementptr inbounds i32, ptr %121, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = mul i32 %120, %125
  %127 = zext i32 %126 to i64
  %128 = load i64, ptr %17, align 8, !tbaa !11
  %129 = add i64 %128, %127
  store i64 %129, ptr %17, align 8, !tbaa !11
  br label %130

130:                                              ; preds = %84
  %131 = load i32, ptr %15, align 4, !tbaa !9
  %132 = add i32 %131, 1
  store i32 %132, ptr %15, align 4, !tbaa !9
  br label %81, !llvm.loop !16

133:                                              ; preds = %81
  br label %134

134:                                              ; preds = %199, %133
  %135 = load i32, ptr %15, align 4, !tbaa !9
  %136 = load i32, ptr %26, align 4, !tbaa !9
  %137 = add i32 %136, 1
  %138 = icmp ult i32 %135, %137
  br i1 %138, label %139, label %202

139:                                              ; preds = %134
  %140 = load ptr, ptr %19, align 8, !tbaa !5
  %141 = load i32, ptr %15, align 4, !tbaa !9
  %142 = zext i32 %141 to i64
  %143 = getelementptr inbounds %struct.huff_code, ptr %140, i64 %142
  %144 = getelementptr inbounds %struct.huff_code, ptr %143, i32 0, i32 0
  %145 = getelementptr inbounds %struct.anon.0, ptr %144, i32 0, i32 2
  %146 = load i8, ptr %145, align 1, !tbaa !13
  %147 = zext i8 %146 to i16
  %148 = load i32, ptr %15, align 4, !tbaa !9
  %149 = zext i32 %148 to i64
  %150 = getelementptr inbounds [316 x i16], ptr %14, i64 0, i64 %149
  store i16 %147, ptr %150, align 2, !tbaa !14
  %151 = load ptr, ptr %19, align 8, !tbaa !5
  %152 = load i32, ptr %15, align 4, !tbaa !9
  %153 = zext i32 %152 to i64
  %154 = getelementptr inbounds %struct.huff_code, ptr %151, i64 %153
  %155 = getelementptr inbounds %struct.huff_code, ptr %154, i32 0, i32 0
  %156 = getelementptr inbounds %struct.anon.0, ptr %155, i32 0, i32 2
  %157 = load i8, ptr %156, align 1, !tbaa !13
  %158 = zext i8 %157 to i32
  %159 = load i32, ptr %15, align 4, !tbaa !9
  %160 = sub i32 %159, 257
  %161 = zext i32 %160 to i64
  %162 = getelementptr inbounds [29 x i32], ptr @len_code_extra_bits, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !9
  %164 = add i32 %158, %163
  %165 = zext i32 %164 to i64
  %166 = load ptr, ptr %21, align 8, !tbaa !5
  %167 = load i32, ptr %15, align 4, !tbaa !9
  %168 = zext i32 %167 to i64
  %169 = getelementptr inbounds i32, ptr %166, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !9
  %171 = zext i32 %170 to i64
  %172 = mul i64 %165, %171
  %173 = load i64, ptr %16, align 8, !tbaa !11
  %174 = add i64 %173, %172
  store i64 %174, ptr %16, align 8, !tbaa !11
  %175 = load ptr, ptr %23, align 8, !tbaa !5
  %176 = load i32, ptr %15, align 4, !tbaa !9
  %177 = zext i32 %176 to i64
  %178 = getelementptr inbounds %struct.huff_code, ptr %175, i64 %177
  %179 = getelementptr inbounds %struct.huff_code, ptr %178, i32 0, i32 0
  %180 = getelementptr inbounds %struct.anon.0, ptr %179, i32 0, i32 2
  %181 = load i8, ptr %180, align 1, !tbaa !13
  %182 = zext i8 %181 to i32
  %183 = load i32, ptr %15, align 4, !tbaa !9
  %184 = sub i32 %183, 257
  %185 = zext i32 %184 to i64
  %186 = getelementptr inbounds [29 x i32], ptr @len_code_extra_bits, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !9
  %188 = add i32 %182, %187
  %189 = zext i32 %188 to i64
  %190 = load ptr, ptr %21, align 8, !tbaa !5
  %191 = load i32, ptr %15, align 4, !tbaa !9
  %192 = zext i32 %191 to i64
  %193 = getelementptr inbounds i32, ptr %190, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !9
  %195 = zext i32 %194 to i64
  %196 = mul i64 %189, %195
  %197 = load i64, ptr %17, align 8, !tbaa !11
  %198 = add i64 %197, %196
  store i64 %198, ptr %17, align 8, !tbaa !11
  br label %199

199:                                              ; preds = %139
  %200 = load i32, ptr %15, align 4, !tbaa !9
  %201 = add i32 %200, 1
  store i32 %201, ptr %15, align 4, !tbaa !9
  br label %134, !llvm.loop !18

202:                                              ; preds = %134
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %203

203:                                              ; preds = %269, %202
  %204 = load i32, ptr %15, align 4, !tbaa !9
  %205 = load i32, ptr %27, align 4, !tbaa !9
  %206 = add i32 %205, 1
  %207 = icmp ult i32 %204, %206
  br i1 %207, label %208, label %272

208:                                              ; preds = %203
  %209 = load ptr, ptr %20, align 8, !tbaa !5
  %210 = load i32, ptr %15, align 4, !tbaa !9
  %211 = zext i32 %210 to i64
  %212 = getelementptr inbounds %struct.huff_code, ptr %209, i64 %211
  %213 = getelementptr inbounds %struct.huff_code, ptr %212, i32 0, i32 0
  %214 = getelementptr inbounds %struct.anon.0, ptr %213, i32 0, i32 2
  %215 = load i8, ptr %214, align 1, !tbaa !13
  %216 = zext i8 %215 to i16
  %217 = load i32, ptr %15, align 4, !tbaa !9
  %218 = load i32, ptr %26, align 4, !tbaa !9
  %219 = add i32 %217, %218
  %220 = add i32 %219, 1
  %221 = zext i32 %220 to i64
  %222 = getelementptr inbounds [316 x i16], ptr %14, i64 0, i64 %221
  store i16 %216, ptr %222, align 2, !tbaa !14
  %223 = load ptr, ptr %20, align 8, !tbaa !5
  %224 = load i32, ptr %15, align 4, !tbaa !9
  %225 = zext i32 %224 to i64
  %226 = getelementptr inbounds %struct.huff_code, ptr %223, i64 %225
  %227 = getelementptr inbounds %struct.huff_code, ptr %226, i32 0, i32 0
  %228 = getelementptr inbounds %struct.anon.0, ptr %227, i32 0, i32 2
  %229 = load i8, ptr %228, align 1, !tbaa !13
  %230 = zext i8 %229 to i32
  %231 = load i32, ptr %15, align 4, !tbaa !9
  %232 = zext i32 %231 to i64
  %233 = getelementptr inbounds [30 x i32], ptr @dist_code_extra_bits, i64 0, i64 %232
  %234 = load i32, ptr %233, align 4, !tbaa !9
  %235 = add i32 %230, %234
  %236 = zext i32 %235 to i64
  %237 = load ptr, ptr %22, align 8, !tbaa !5
  %238 = load i32, ptr %15, align 4, !tbaa !9
  %239 = zext i32 %238 to i64
  %240 = getelementptr inbounds i32, ptr %237, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !9
  %242 = zext i32 %241 to i64
  %243 = mul i64 %236, %242
  %244 = load i64, ptr %16, align 8, !tbaa !11
  %245 = add i64 %244, %243
  store i64 %245, ptr %16, align 8, !tbaa !11
  %246 = load ptr, ptr %24, align 8, !tbaa !5
  %247 = load i32, ptr %15, align 4, !tbaa !9
  %248 = zext i32 %247 to i64
  %249 = getelementptr inbounds %struct.huff_code, ptr %246, i64 %248
  %250 = getelementptr inbounds %struct.huff_code, ptr %249, i32 0, i32 0
  %251 = getelementptr inbounds %struct.anon.0, ptr %250, i32 0, i32 2
  %252 = load i8, ptr %251, align 1, !tbaa !13
  %253 = zext i8 %252 to i32
  %254 = load i32, ptr %15, align 4, !tbaa !9
  %255 = zext i32 %254 to i64
  %256 = getelementptr inbounds [30 x i32], ptr @dist_code_extra_bits, i64 0, i64 %255
  %257 = load i32, ptr %256, align 4, !tbaa !9
  %258 = add i32 %253, %257
  %259 = zext i32 %258 to i64
  %260 = load ptr, ptr %22, align 8, !tbaa !5
  %261 = load i32, ptr %15, align 4, !tbaa !9
  %262 = zext i32 %261 to i64
  %263 = getelementptr inbounds i32, ptr %260, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !9
  %265 = zext i32 %264 to i64
  %266 = mul i64 %259, %265
  %267 = load i64, ptr %17, align 8, !tbaa !11
  %268 = add i64 %267, %266
  store i64 %268, ptr %17, align 8, !tbaa !11
  br label %269

269:                                              ; preds = %208
  %270 = load i32, ptr %15, align 4, !tbaa !9
  %271 = add i32 %270, 1
  store i32 %271, ptr %15, align 4, !tbaa !9
  br label %203, !llvm.loop !19

272:                                              ; preds = %203
  %273 = load i64, ptr %17, align 8, !tbaa !11
  %274 = load i64, ptr %16, align 8, !tbaa !11
  %275 = icmp ugt i64 %273, %274
  br i1 %275, label %276, label %304

276:                                              ; preds = %272
  %277 = getelementptr inbounds [316 x i16], ptr %14, i64 0, i64 0
  %278 = load i32, ptr %26, align 4, !tbaa !9
  %279 = load i32, ptr %27, align 4, !tbaa !9
  %280 = add i32 %278, %279
  %281 = add i32 %280, 2
  %282 = getelementptr inbounds [19 x i64], ptr %13, i64 0, i64 0
  %283 = getelementptr inbounds [316 x %struct.rl_code], ptr %11, i64 0, i64 0
  %284 = call i32 @rl_encode(ptr noundef %277, i32 noundef %281, ptr noundef %282, ptr noundef %283)
  store i32 %284, ptr %12, align 4, !tbaa !9
  %285 = load ptr, ptr %5, align 8, !tbaa !5
  %286 = getelementptr inbounds [316 x %struct.rl_code], ptr %11, i64 0, i64 0
  %287 = load i32, ptr %12, align 4, !tbaa !9
  %288 = getelementptr inbounds [19 x i64], ptr %13, i64 0, i64 0
  %289 = load i32, ptr %26, align 4, !tbaa !9
  %290 = sub i32 %289, 256
  %291 = load i32, ptr %27, align 4, !tbaa !9
  %292 = load i32, ptr %8, align 4, !tbaa !9
  %293 = call i32 @create_header(ptr noundef %285, ptr noundef %286, i32 noundef %287, ptr noundef %288, i32 noundef %290, i32 noundef %291, i32 noundef %292)
  %294 = load ptr, ptr %5, align 8, !tbaa !5
  %295 = call i32 @buffer_used(ptr noundef %294)
  %296 = mul i32 8, %295
  %297 = load ptr, ptr %5, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.BitBuf2, ptr %297, i32 0, i32 1
  %299 = load i32, ptr %298, align 8, !tbaa !20
  %300 = add i32 %296, %299
  %301 = zext i32 %300 to i64
  %302 = load i64, ptr %16, align 8, !tbaa !11
  %303 = add i64 %302, %301
  store i64 %303, ptr %16, align 8, !tbaa !11
  br label %304

304:                                              ; preds = %276, %272
  %305 = load i64, ptr %17, align 8, !tbaa !11
  %306 = load i64, ptr %16, align 8, !tbaa !11
  %307 = icmp ule i64 %305, %306
  br i1 %307, label %308, label %320

308:                                              ; preds = %304
  %309 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %309, ptr align 4 @static_hufftables, i64 2176, i1 false)
  %310 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %310, ptr align 8 %18, i64 40, i1 false)
  %311 = load i32, ptr %8, align 4, !tbaa !9
  %312 = icmp ne i32 %311, 0
  %313 = zext i1 %312 to i64
  %314 = select i1 %312, i32 1, i32 0
  store i32 %314, ptr %8, align 4, !tbaa !9
  %315 = load ptr, ptr %5, align 8, !tbaa !5
  %316 = load i32, ptr %8, align 4, !tbaa !9
  %317 = or i32 2, %316
  %318 = zext i32 %317 to i64
  call void @write_bits(ptr noundef %315, i64 noundef %318, i32 noundef 3)
  %319 = load i64, ptr %17, align 8, !tbaa !11
  store i64 %319, ptr %16, align 8, !tbaa !11
  br label %320

320:                                              ; preds = %308, %304
  %321 = load ptr, ptr %6, align 8, !tbaa !5
  call void @expand_hufftables_icf(ptr noundef %321)
  %322 = load i64, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 632, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 152, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 632, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 6872, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #7
  ret i64 %322
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

declare void @qpl_flatten_ll(ptr noundef) #6

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @expand_hufftables_icf(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { "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 #7 = { nounwind }
attributes #8 = { noreturn 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 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = !{!21, !10, i64 8}
!21 = !{!"BitBuf2", !12, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}


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

%struct.heap_tree = type { %union.anon.1 }
%union.anon.1 = type { [859 x i64] }
%struct.rl_code = type { i8, i8 }
%struct.BitBuf2 = type { i64, i32, ptr, ptr, ptr }
%struct.huff_code = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { i32 }

@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__.qpl_create_hufftables_icf = external hidden unnamed_addr constant [112 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@len_code_extra_bits = external hidden local_unnamed_addr constant [29 x i32], align 16
@dist_code_extra_bits = external hidden local_unnamed_addr constant [30 x i32], align 16
@static_hufftables = external hidden local_unnamed_addr global { { { [31 x { { { i8, i8, i8, i8 } } }], <{ [288 x { { { i8, i8, i8, i8 } } }], [225 x { { { i8, i8, i8, i8 } } }] }> } } }, align 4

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @qpl_create_hufftables_icf(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #4 {
  %5 = alloca [16 x i32], align 16
  %6 = alloca %struct.heap_tree, align 8
  %7 = alloca [316 x %struct.rl_code], align 16
  %8 = alloca [19 x i64], align 16
  %9 = alloca [316 x i16], align 16
  %10 = alloca %struct.BitBuf2, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 6872, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 632, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 632, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %10)
  %11 = getelementptr inbounds i8, ptr %1, i64 124
  %12 = getelementptr inbounds i8, ptr %2, i64 120
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %10, ptr noundef nonnull align 8 dereferenceable(40) %0, i64 40, i1 false)
  tail call void @qpl_flatten_ll(ptr noundef nonnull %12) #8
  %13 = getelementptr inbounds i8, ptr %2, i64 1144
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %4
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %16, %4
  %18 = call i32 @init_heap32(ptr noundef nonnull %6, ptr noundef nonnull %12, i32 noundef 286)
  call void @gen_huff_code_lens(ptr noundef nonnull %6, i32 noundef %18, ptr noundef nonnull %5, ptr noundef nonnull %11, i32 noundef 286, i32 noundef 15)
  %19 = call i32 @set_huff_codes(ptr noundef nonnull %11, i32 noundef 286, ptr noundef nonnull %5)
  %20 = call i32 @init_heap32(ptr noundef nonnull %6, ptr noundef nonnull %2, i32 noundef 30)
  call void @gen_huff_code_lens(ptr noundef nonnull %6, i32 noundef %20, ptr noundef nonnull %5, ptr noundef %1, i32 noundef 30, i32 noundef 15)
  %21 = call i32 @set_dist_huff_codes(ptr noundef %1, ptr noundef nonnull %5)
  %22 = icmp ugt i32 %19, 255
  br i1 %22, label %24, label %23

23:                                               ; preds = %17
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 1549, ptr noundef nonnull @__PRETTY_FUNCTION__.qpl_create_hufftables_icf) #9
  unreachable

24:                                               ; preds = %17
  %.not = icmp eq i32 %21, 0
  br i1 %.not, label %25, label %26

25:                                               ; preds = %24
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 1550, ptr noundef nonnull @__PRETTY_FUNCTION__.qpl_create_hufftables_icf) #9
  unreachable

26:                                               ; preds = %24
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(152) %8, i8 0, i64 152, i1 false)
  %invariant.gep = getelementptr inbounds i8, ptr %1, i64 127
  br label %94

.preheader101:                                    ; preds = %94
  %27 = add i32 %19, 1
  %28 = icmp ugt i32 %27, 257
  br i1 %28, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %.preheader101
  %wide.trip.count = zext i32 %27 to i64
  %29 = add nsw i64 %wide.trip.count, -257
  %min.iters.check = icmp ult i64 %29, 5
  br i1 %min.iters.check, label %.lr.ph.preheader184, label %vector.ph

.lr.ph.preheader184:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv130.ph = phi i64 [ 257, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.192110.ph = phi i64 [ %103, %.lr.ph.preheader ], [ %92, %middle.block ]
  %.195109.ph = phi i64 [ %108, %.lr.ph.preheader ], [ %93, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.mod.vf = and i64 %29, 3
  %30 = icmp eq i64 %n.mod.vf, 0
  %31 = select i1 %30, i64 4, i64 %n.mod.vf
  %n.vec = sub nsw i64 %29, %31
  %ind.end = add nsw i64 %n.vec, 257
  %32 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %103, i64 0
  %33 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %108, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %32, %vector.ph ], [ %67, %vector.body ]
  %vec.phi149 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %68, %vector.body ]
  %vec.phi150 = phi <2 x i64> [ %33, %vector.ph ], [ %89, %vector.body ]
  %vec.phi151 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %90, %vector.body ]
  %offset.idx = add i64 %index, 257
  %34 = add i64 %index, 258
  %35 = add i64 %index, 259
  %36 = add i64 %index, 260
  %37 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep, i64 %offset.idx
  %38 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep, i64 %34
  %39 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep, i64 %35
  %40 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep, i64 %36
  %41 = load i8, ptr %37, align 1, !tbaa !9
  %42 = load i8, ptr %38, align 1, !tbaa !9
  %43 = insertelement <2 x i8> poison, i8 %41, i64 0
  %44 = insertelement <2 x i8> %43, i8 %42, i64 1
  %45 = load i8, ptr %39, align 1, !tbaa !9
  %46 = load i8, ptr %40, align 1, !tbaa !9
  %47 = insertelement <2 x i8> poison, i8 %45, i64 0
  %48 = insertelement <2 x i8> %47, i8 %46, i64 1
  %49 = zext <2 x i8> %44 to <2 x i16>
  %50 = zext <2 x i8> %48 to <2 x i16>
  %51 = getelementptr inbounds [316 x i16], ptr %9, i64 0, i64 %offset.idx
  %52 = getelementptr inbounds i8, ptr %51, i64 4
  store <2 x i16> %49, ptr %51, align 2, !tbaa !10
  store <2 x i16> %50, ptr %52, align 2, !tbaa !10
  %53 = zext <2 x i8> %44 to <2 x i32>
  %54 = zext <2 x i8> %48 to <2 x i32>
  %55 = getelementptr inbounds [29 x i32], ptr @len_code_extra_bits, i64 0, i64 %index
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  %wide.load = load <2 x i32>, ptr %55, align 16, !tbaa !5
  %wide.load152 = load <2 x i32>, ptr %56, align 8, !tbaa !5
  %57 = add <2 x i32> %wide.load, %53
  %58 = add <2 x i32> %wide.load152, %54
  %59 = zext <2 x i32> %57 to <2 x i64>
  %60 = zext <2 x i32> %58 to <2 x i64>
  %61 = getelementptr inbounds i32, ptr %12, i64 %offset.idx
  %62 = getelementptr inbounds i8, ptr %61, i64 8
  %wide.load153 = load <2 x i32>, ptr %61, align 4, !tbaa !5
  %wide.load154 = load <2 x i32>, ptr %62, align 4, !tbaa !5
  %63 = zext <2 x i32> %wide.load153 to <2 x i64>
  %64 = zext <2 x i32> %wide.load154 to <2 x i64>
  %65 = mul nuw <2 x i64> %59, %63
  %66 = mul nuw <2 x i64> %60, %64
  %67 = add <2 x i64> %65, %vec.phi
  %68 = add <2 x i64> %66, %vec.phi149
  %69 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 127), i64 %offset.idx
  %70 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 127), i64 %34
  %71 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 127), i64 %35
  %72 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 127), i64 %36
  %73 = load i8, ptr %69, align 1, !tbaa !9
  %74 = load i8, ptr %70, align 1, !tbaa !9
  %75 = insertelement <2 x i8> poison, i8 %73, i64 0
  %76 = insertelement <2 x i8> %75, i8 %74, i64 1
  %77 = load i8, ptr %71, align 1, !tbaa !9
  %78 = load i8, ptr %72, align 1, !tbaa !9
  %79 = insertelement <2 x i8> poison, i8 %77, i64 0
  %80 = insertelement <2 x i8> %79, i8 %78, i64 1
  %81 = zext <2 x i8> %76 to <2 x i32>
  %82 = zext <2 x i8> %80 to <2 x i32>
  %83 = add <2 x i32> %wide.load, %81
  %84 = add <2 x i32> %wide.load152, %82
  %85 = zext <2 x i32> %83 to <2 x i64>
  %86 = zext <2 x i32> %84 to <2 x i64>
  %87 = mul nuw <2 x i64> %85, %63
  %88 = mul nuw <2 x i64> %86, %64
  %89 = add <2 x i64> %87, %vec.phi150
  %90 = add <2 x i64> %88, %vec.phi151
  %index.next = add nuw i64 %index, 4
  %91 = icmp eq i64 %index.next, %n.vec
  br i1 %91, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %68, %67
  %92 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %bin.rdx155 = add <2 x i64> %90, %89
  %93 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx155)
  br label %.lr.ph.preheader184

94:                                               ; preds = %109, %26
  %indvars.iv = phi i64 [ 0, %26 ], [ %indvars.iv.next.1, %109 ]
  %.091104 = phi i64 [ 0, %26 ], [ %118, %109 ]
  %.094103 = phi i64 [ 3, %26 ], [ %123, %109 ]
  %gep = getelementptr inbounds %struct.huff_code, ptr %invariant.gep, i64 %indvars.iv
  %95 = load i8, ptr %gep, align 1, !tbaa !9
  %96 = zext i8 %95 to i16
  %97 = getelementptr inbounds [316 x i16], ptr %9, i64 0, i64 %indvars.iv
  store i16 %96, ptr %97, align 4, !tbaa !10
  %98 = zext i8 %95 to i32
  %99 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = mul i32 %100, %98
  %102 = zext i32 %101 to i64
  %103 = add i64 %.091104, %102
  %gep102 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 127), i64 %indvars.iv
  %104 = load i8, ptr %gep102, align 1, !tbaa !9
  %105 = zext i8 %104 to i32
  %106 = mul i32 %100, %105
  %107 = zext i32 %106 to i64
  %108 = add i64 %.094103, %107
  %exitcond.not = icmp eq i64 %indvars.iv, 256
  br i1 %exitcond.not, label %.preheader101, label %109, !llvm.loop !16

109:                                              ; preds = %94
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %gep.1 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep, i64 %indvars.iv.next
  %110 = load i8, ptr %gep.1, align 1, !tbaa !9
  %111 = zext i8 %110 to i16
  %112 = getelementptr inbounds [316 x i16], ptr %9, i64 0, i64 %indvars.iv.next
  store i16 %111, ptr %112, align 2, !tbaa !10
  %113 = zext i8 %110 to i32
  %114 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.next
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = mul i32 %115, %113
  %117 = zext i32 %116 to i64
  %118 = add i64 %103, %117
  %gep102.1 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 127), i64 %indvars.iv.next
  %119 = load i8, ptr %gep102.1, align 1, !tbaa !9
  %120 = zext i8 %119 to i32
  %121 = mul i32 %115, %120
  %122 = zext i32 %121 to i64
  %123 = add i64 %108, %122
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  br label %94

.preheader:                                       ; preds = %.lr.ph, %.preheader101
  %.195.lcssa = phi i64 [ %108, %.preheader101 ], [ %217, %.lr.ph ]
  %.192.lcssa = phi i64 [ %103, %.preheader101 ], [ %211, %.lr.ph ]
  %124 = add i32 %21, 1
  %invariant.gep113 = getelementptr inbounds i8, ptr %1, i64 3
  %.not122 = icmp eq i32 %124, 0
  br i1 %.not122, label %._crit_edge, label %.lr.ph119

.lr.ph119:                                        ; preds = %.preheader
  %wide.trip.count137 = zext i32 %124 to i64
  %min.iters.check159 = icmp ult i32 %124, 7
  br i1 %min.iters.check159, label %scalar.ph158.preheader, label %vector.scevcheck

scalar.ph158.preheader:                           ; preds = %middle.block157, %vector.scevcheck, %.lr.ph119
  %indvars.iv134.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %.lr.ph119 ], [ %n.vec162, %middle.block157 ]
  %.293117.ph = phi i64 [ %.192.lcssa, %vector.scevcheck ], [ %.192.lcssa, %.lr.ph119 ], [ %196, %middle.block157 ]
  %.296116.ph = phi i64 [ %.195.lcssa, %vector.scevcheck ], [ %.195.lcssa, %.lr.ph119 ], [ %197, %middle.block157 ]
  br label %scalar.ph158

vector.scevcheck:                                 ; preds = %.lr.ph119
  %125 = add nsw i64 %wide.trip.count137, -1
  %126 = trunc i64 %125 to i32
  %127 = sub i32 -2, %19
  %128 = icmp ult i32 %127, %126
  %129 = icmp ugt i64 %125, 4294967295
  %130 = or i1 %128, %129
  br i1 %130, label %scalar.ph158.preheader, label %vector.ph160

vector.ph160:                                     ; preds = %vector.scevcheck
  %n.mod.vf161 = and i64 %wide.trip.count137, 3
  %131 = icmp eq i64 %n.mod.vf161, 0
  %132 = select i1 %131, i64 4, i64 %n.mod.vf161
  %n.vec162 = sub nsw i64 %wide.trip.count137, %132
  %133 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.192.lcssa, i64 0
  %134 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.195.lcssa, i64 0
  br label %vector.body164

vector.body164:                                   ; preds = %vector.body164, %vector.ph160
  %index165 = phi i64 [ 0, %vector.ph160 ], [ %index.next174, %vector.body164 ]
  %vec.phi166 = phi <2 x i64> [ %133, %vector.ph160 ], [ %171, %vector.body164 ]
  %vec.phi167 = phi <2 x i64> [ zeroinitializer, %vector.ph160 ], [ %172, %vector.body164 ]
  %vec.phi168 = phi <2 x i64> [ %134, %vector.ph160 ], [ %193, %vector.body164 ]
  %vec.phi169 = phi <2 x i64> [ zeroinitializer, %vector.ph160 ], [ %194, %vector.body164 ]
  %135 = or disjoint i64 %index165, 1
  %136 = or disjoint i64 %index165, 2
  %137 = or disjoint i64 %index165, 3
  %138 = trunc i64 %index165 to i32
  %139 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep113, i64 %index165
  %140 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep113, i64 %135
  %141 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep113, i64 %136
  %142 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep113, i64 %137
  %143 = load i8, ptr %139, align 1, !tbaa !9
  %144 = load i8, ptr %140, align 1, !tbaa !9
  %145 = insertelement <2 x i8> poison, i8 %143, i64 0
  %146 = insertelement <2 x i8> %145, i8 %144, i64 1
  %147 = load i8, ptr %141, align 1, !tbaa !9
  %148 = load i8, ptr %142, align 1, !tbaa !9
  %149 = insertelement <2 x i8> poison, i8 %147, i64 0
  %150 = insertelement <2 x i8> %149, i8 %148, i64 1
  %151 = zext <2 x i8> %146 to <2 x i16>
  %152 = zext <2 x i8> %150 to <2 x i16>
  %153 = add i32 %27, %138
  %154 = zext i32 %153 to i64
  %155 = getelementptr inbounds [316 x i16], ptr %9, i64 0, i64 %154
  %156 = getelementptr inbounds i8, ptr %155, i64 4
  store <2 x i16> %151, ptr %155, align 2, !tbaa !10
  store <2 x i16> %152, ptr %156, align 2, !tbaa !10
  %157 = zext <2 x i8> %146 to <2 x i32>
  %158 = zext <2 x i8> %150 to <2 x i32>
  %159 = getelementptr inbounds [30 x i32], ptr @dist_code_extra_bits, i64 0, i64 %index165
  %160 = getelementptr inbounds i8, ptr %159, i64 8
  %wide.load170 = load <2 x i32>, ptr %159, align 16, !tbaa !5
  %wide.load171 = load <2 x i32>, ptr %160, align 8, !tbaa !5
  %161 = add <2 x i32> %wide.load170, %157
  %162 = add <2 x i32> %wide.load171, %158
  %163 = zext <2 x i32> %161 to <2 x i64>
  %164 = zext <2 x i32> %162 to <2 x i64>
  %165 = getelementptr inbounds i32, ptr %2, i64 %index165
  %166 = getelementptr inbounds i8, ptr %165, i64 8
  %wide.load172 = load <2 x i32>, ptr %165, align 4, !tbaa !5
  %wide.load173 = load <2 x i32>, ptr %166, align 4, !tbaa !5
  %167 = zext <2 x i32> %wide.load172 to <2 x i64>
  %168 = zext <2 x i32> %wide.load173 to <2 x i64>
  %169 = mul nuw <2 x i64> %163, %167
  %170 = mul nuw <2 x i64> %164, %168
  %171 = add <2 x i64> %169, %vec.phi166
  %172 = add <2 x i64> %170, %vec.phi167
  %173 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 3), i64 %index165
  %174 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 3), i64 %135
  %175 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 3), i64 %136
  %176 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 3), i64 %137
  %177 = load i8, ptr %173, align 1, !tbaa !9
  %178 = load i8, ptr %174, align 1, !tbaa !9
  %179 = insertelement <2 x i8> poison, i8 %177, i64 0
  %180 = insertelement <2 x i8> %179, i8 %178, i64 1
  %181 = load i8, ptr %175, align 1, !tbaa !9
  %182 = load i8, ptr %176, align 1, !tbaa !9
  %183 = insertelement <2 x i8> poison, i8 %181, i64 0
  %184 = insertelement <2 x i8> %183, i8 %182, i64 1
  %185 = zext <2 x i8> %180 to <2 x i32>
  %186 = zext <2 x i8> %184 to <2 x i32>
  %187 = add <2 x i32> %wide.load170, %185
  %188 = add <2 x i32> %wide.load171, %186
  %189 = zext <2 x i32> %187 to <2 x i64>
  %190 = zext <2 x i32> %188 to <2 x i64>
  %191 = mul nuw <2 x i64> %189, %167
  %192 = mul nuw <2 x i64> %190, %168
  %193 = add <2 x i64> %191, %vec.phi168
  %194 = add <2 x i64> %192, %vec.phi169
  %index.next174 = add nuw i64 %index165, 4
  %195 = icmp eq i64 %index.next174, %n.vec162
  br i1 %195, label %middle.block157, label %vector.body164, !llvm.loop !17

middle.block157:                                  ; preds = %vector.body164
  %bin.rdx175 = add <2 x i64> %172, %171
  %196 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx175)
  %bin.rdx176 = add <2 x i64> %194, %193
  %197 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx176)
  br label %scalar.ph158.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader184, %.lr.ph
  %indvars.iv130 = phi i64 [ %indvars.iv.next131, %.lr.ph ], [ %indvars.iv130.ph, %.lr.ph.preheader184 ]
  %.192110 = phi i64 [ %211, %.lr.ph ], [ %.192110.ph, %.lr.ph.preheader184 ]
  %.195109 = phi i64 [ %217, %.lr.ph ], [ %.195109.ph, %.lr.ph.preheader184 ]
  %gep107 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep, i64 %indvars.iv130
  %198 = load i8, ptr %gep107, align 1, !tbaa !9
  %199 = zext i8 %198 to i16
  %200 = getelementptr inbounds [316 x i16], ptr %9, i64 0, i64 %indvars.iv130
  store i16 %199, ptr %200, align 2, !tbaa !10
  %201 = zext i8 %198 to i32
  %202 = add nsw i64 %indvars.iv130, -257
  %203 = getelementptr inbounds [29 x i32], ptr @len_code_extra_bits, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = add i32 %204, %201
  %206 = zext i32 %205 to i64
  %207 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv130
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = zext i32 %208 to i64
  %210 = mul nuw i64 %206, %209
  %211 = add i64 %210, %.192110
  %gep108 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 127), i64 %indvars.iv130
  %212 = load i8, ptr %gep108, align 1, !tbaa !9
  %213 = zext i8 %212 to i32
  %214 = add i32 %204, %213
  %215 = zext i32 %214 to i64
  %216 = mul nuw i64 %215, %209
  %217 = add i64 %216, %.195109
  %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
  %exitcond133.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count
  br i1 %exitcond133.not, label %.preheader, label %.lr.ph, !llvm.loop !18

scalar.ph158:                                     ; preds = %scalar.ph158.preheader, %scalar.ph158
  %indvars.iv134 = phi i64 [ %indvars.iv.next135, %scalar.ph158 ], [ %indvars.iv134.ph, %scalar.ph158.preheader ]
  %.293117 = phi i64 [ %233, %scalar.ph158 ], [ %.293117.ph, %scalar.ph158.preheader ]
  %.296116 = phi i64 [ %239, %scalar.ph158 ], [ %.296116.ph, %scalar.ph158.preheader ]
  %gep114 = getelementptr inbounds %struct.huff_code, ptr %invariant.gep113, i64 %indvars.iv134
  %218 = load i8, ptr %gep114, align 1, !tbaa !9
  %219 = zext i8 %218 to i16
  %220 = trunc nuw i64 %indvars.iv134 to i32
  %221 = add i32 %27, %220
  %222 = zext i32 %221 to i64
  %223 = getelementptr inbounds [316 x i16], ptr %9, i64 0, i64 %222
  store i16 %219, ptr %223, align 2, !tbaa !10
  %224 = zext i8 %218 to i32
  %225 = getelementptr inbounds [30 x i32], ptr @dist_code_extra_bits, i64 0, i64 %indvars.iv134
  %226 = load i32, ptr %225, align 4, !tbaa !5
  %227 = add i32 %226, %224
  %228 = zext i32 %227 to i64
  %229 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv134
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = zext i32 %230 to i64
  %232 = mul nuw i64 %228, %231
  %233 = add i64 %232, %.293117
  %gep115 = getelementptr inbounds %struct.huff_code, ptr getelementptr inbounds (i8, ptr @static_hufftables, i64 3), i64 %indvars.iv134
  %234 = load i8, ptr %gep115, align 1, !tbaa !9
  %235 = zext i8 %234 to i32
  %236 = add i32 %226, %235
  %237 = zext i32 %236 to i64
  %238 = mul nuw i64 %237, %231
  %239 = add i64 %238, %.296116
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %exitcond138.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count137
  br i1 %exitcond138.not, label %._crit_edge, label %scalar.ph158, !llvm.loop !19

._crit_edge:                                      ; preds = %scalar.ph158, %.preheader
  %.296.lcssa = phi i64 [ %.195.lcssa, %.preheader ], [ %239, %scalar.ph158 ]
  %.293.lcssa = phi i64 [ %.192.lcssa, %.preheader ], [ %233, %scalar.ph158 ]
  %240 = icmp ugt i64 %.296.lcssa, %.293.lcssa
  br i1 %240, label %241, label %254

241:                                              ; preds = %._crit_edge
  %242 = add i32 %19, 2
  %243 = add i32 %242, %21
  %244 = call i32 @rl_encode(ptr noundef nonnull %9, i32 noundef %243, ptr noundef nonnull %8, ptr noundef nonnull %7)
  %245 = add i32 %19, -256
  %246 = call i32 @create_header(ptr noundef %0, ptr noundef nonnull %7, i32 noundef %244, ptr noundef nonnull %8, i32 noundef %245, i32 noundef %21, i32 noundef %3)
  %247 = call i32 @buffer_used(ptr noundef %0)
  %248 = shl i32 %247, 3
  %249 = getelementptr inbounds i8, ptr %0, i64 8
  %250 = load i32, ptr %249, align 8, !tbaa !20
  %251 = add i32 %248, %250
  %252 = zext i32 %251 to i64
  %253 = add i64 %.293.lcssa, %252
  br label %254

254:                                              ; preds = %241, %._crit_edge
  %.3 = phi i64 [ %253, %241 ], [ %.293.lcssa, %._crit_edge ]
  %.not99 = icmp ugt i64 %.296.lcssa, %.3
  br i1 %.not99, label %258, label %255

255:                                              ; preds = %254
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(2176) %1, ptr noundef nonnull align 4 dereferenceable(2176) @static_hufftables, i64 2176, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(40) %10, i64 40, i1 false)
  %.not100 = icmp ne i32 %3, 0
  %256 = zext i1 %.not100 to i64
  %257 = or disjoint i64 %256, 2
  call void @write_bits(ptr noundef %0, i64 noundef %257, i32 noundef 3)
  br label %258

258:                                              ; preds = %255, %254
  %.4 = phi i64 [ %.296.lcssa, %255 ], [ %.3, %254 ]
  call void @expand_hufftables_icf(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %10)
  call void @llvm.lifetime.end.p0(i64 632, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 632, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 6872, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #8
  ret i64 %.4
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

declare void @qpl_flatten_ll(ptr noundef) local_unnamed_addr #6

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @expand_hufftables_icf(ptr noundef) local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { "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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13, !14, !15}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13, !14, !15}
!18 = distinct !{!18, !13, !15, !14}
!19 = distinct !{!19, !13, !14}
!20 = !{!21, !6, i64 8}
!21 = !{!"BitBuf2", !22, i64 0, !6, i64 8, !23, i64 16, !23, i64 24, !23, i64 32}
!22 = !{!"long", !7, i64 0}
!23 = !{!"any pointer", !7, i64 0}


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