; LLVM IR from mkazhdan/DMG :: Util/ZLIB/trees.ll (tr_flush_block)

; 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.ct_data_s = type { %union.anon, %union.anon.0 }
%union.anon = type { i16 }
%union.anon.0 = type { i16 }
%struct.internal_state = type { ptr, i32, ptr, i64, ptr, i32, i32, i8, i8, i32, i32, i32, i32, ptr, i64, ptr, ptr, i32, i32, i32, i32, i32, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [573 x %struct.ct_data_s], [61 x %struct.ct_data_s], [39 x %struct.ct_data_s], %struct.tree_desc_s, %struct.tree_desc_s, %struct.tree_desc_s, [16 x i16], [573 x i32], i32, i32, [573 x i8], ptr, i32, i32, ptr, i64, i64, i32, i32, i16, i32 }
%struct.tree_desc_s = type { ptr, i32, ptr }

@static_ltree = external hidden constant [288 x %struct.ct_data_s], align 16
@static_dtree = external hidden constant [30 x %struct.ct_data_s], align 16

; Function Attrs: nounwind uwtable
declare hidden void @init_block(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @_tr_stored_block(ptr noundef, ptr noundef, i64 noundef, i32 noundef) #0

; 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: nounwind uwtable
define dso_local void @_tr_flush_block(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %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
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  store i32 0, ptr %11, align 4, !tbaa !11
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.internal_state, ptr %16, i32 0, i32 32
  %18 = load i32, ptr %17, align 4, !tbaa !13
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %20, label %55

20:                                               ; preds = %4
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.internal_state, ptr %21, i32 0, i32 7
  %23 = load i8, ptr %22, align 8, !tbaa !17
  %24 = zext i8 %23 to i32
  %25 = icmp eq i32 %24, 2
  br i1 %25, label %26, label %28

26:                                               ; preds = %20
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  call void @set_data_type(ptr noundef %27)
  br label %28

28:                                               ; preds = %26, %20
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.internal_state, ptr %30, i32 0, i32 39
  call void @build_tree(ptr noundef %29, ptr noundef %31)
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.internal_state, ptr %33, i32 0, i32 40
  call void @build_tree(ptr noundef %32, ptr noundef %34)
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call i32 @build_bl_tree(ptr noundef %35)
  store i32 %36, ptr %11, align 4, !tbaa !11
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.internal_state, ptr %37, i32 0, i32 51
  %39 = load i64, ptr %38, align 8, !tbaa !18
  %40 = add i64 %39, 3
  %41 = add i64 %40, 7
  %42 = lshr i64 %41, 3
  store i64 %42, ptr %9, align 8, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.internal_state, ptr %43, i32 0, i32 52
  %45 = load i64, ptr %44, align 8, !tbaa !19
  %46 = add i64 %45, 3
  %47 = add i64 %46, 7
  %48 = lshr i64 %47, 3
  store i64 %48, ptr %10, align 8, !tbaa !9
  %49 = load i64, ptr %10, align 8, !tbaa !9
  %50 = load i64, ptr %9, align 8, !tbaa !9
  %51 = icmp ule i64 %49, %50
  br i1 %51, label %52, label %54

52:                                               ; preds = %28
  %53 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %53, ptr %9, align 8, !tbaa !9
  br label %54

54:                                               ; preds = %52, %28
  br label %58

55:                                               ; preds = %4
  %56 = load i64, ptr %7, align 8, !tbaa !9
  %57 = add i64 %56, 5
  store i64 %57, ptr %10, align 8, !tbaa !9
  store i64 %57, ptr %9, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %55, %54
  %59 = load i64, ptr %7, align 8, !tbaa !9
  %60 = add i64 %59, 4
  %61 = load i64, ptr %9, align 8, !tbaa !9
  %62 = icmp ule i64 %60, %61
  br i1 %62, label %63, label %71

63:                                               ; preds = %58
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = icmp ne ptr %64, null
  br i1 %65, label %66, label %71

66:                                               ; preds = %63
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load i64, ptr %7, align 8, !tbaa !9
  %70 = load i32, ptr %8, align 4, !tbaa !11
  call void @_tr_stored_block(ptr noundef %67, ptr noundef %68, i64 noundef %69, i32 noundef %70)
  br label %281

71:                                               ; preds = %63, %58
  %72 = load i64, ptr %10, align 8, !tbaa !9
  %73 = load i64, ptr %9, align 8, !tbaa !9
  %74 = icmp eq i64 %72, %73
  br i1 %74, label %75, label %168

75:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  store i32 3, ptr %12, align 4, !tbaa !11
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.internal_state, ptr %76, i32 0, i32 56
  %78 = load i32, ptr %77, align 4, !tbaa !20
  %79 = load i32, ptr %12, align 4, !tbaa !11
  %80 = sub nsw i32 16, %79
  %81 = icmp sgt i32 %78, %80
  br i1 %81, label %82, label %148

82:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  %83 = load i32, ptr %8, align 4, !tbaa !11
  %84 = add nsw i32 2, %83
  store i32 %84, ptr %13, align 4, !tbaa !11
  %85 = load i32, ptr %13, align 4, !tbaa !11
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.internal_state, ptr %86, i32 0, i32 56
  %88 = load i32, ptr %87, align 4, !tbaa !20
  %89 = shl i32 %85, %88
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.internal_state, ptr %90, i32 0, i32 55
  %92 = load i16, ptr %91, align 8, !tbaa !21
  %93 = zext i16 %92 to i32
  %94 = or i32 %93, %89
  %95 = trunc i32 %94 to i16
  store i16 %95, ptr %91, align 8, !tbaa !21
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.internal_state, ptr %96, i32 0, i32 55
  %98 = load i16, ptr %97, align 8, !tbaa !21
  %99 = zext i16 %98 to i32
  %100 = and i32 %99, 255
  %101 = trunc i32 %100 to i8
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.internal_state, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !22
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.internal_state, ptr %105, i32 0, i32 5
  %107 = load i32, ptr %106, align 8, !tbaa !23
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %106, align 8, !tbaa !23
  %109 = sext i32 %107 to i64
  %110 = getelementptr inbounds i8, ptr %104, i64 %109
  store i8 %101, ptr %110, align 1, !tbaa !24
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.internal_state, ptr %111, i32 0, i32 55
  %113 = load i16, ptr %112, align 8, !tbaa !21
  %114 = zext i16 %113 to i32
  %115 = ashr i32 %114, 8
  %116 = trunc i32 %115 to i8
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.internal_state, ptr %117, i32 0, i32 2
  %119 = load ptr, ptr %118, align 8, !tbaa !22
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.internal_state, ptr %120, i32 0, i32 5
  %122 = load i32, ptr %121, align 8, !tbaa !23
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %121, align 8, !tbaa !23
  %124 = sext i32 %122 to i64
  %125 = getelementptr inbounds i8, ptr %119, i64 %124
  store i8 %116, ptr %125, align 1, !tbaa !24
  %126 = load i32, ptr %13, align 4, !tbaa !11
  %127 = trunc i32 %126 to i16
  %128 = zext i16 %127 to i32
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.internal_state, ptr %129, i32 0, i32 56
  %131 = load i32, ptr %130, align 4, !tbaa !20
  %132 = sext i32 %131 to i64
  %133 = sub i64 16, %132
  %134 = trunc i64 %133 to i32
  %135 = ashr i32 %128, %134
  %136 = trunc i32 %135 to i16
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.internal_state, ptr %137, i32 0, i32 55
  store i16 %136, ptr %138, align 8, !tbaa !21
  %139 = load i32, ptr %12, align 4, !tbaa !11
  %140 = sext i32 %139 to i64
  %141 = sub i64 %140, 16
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.internal_state, ptr %142, i32 0, i32 56
  %144 = load i32, ptr %143, align 4, !tbaa !20
  %145 = sext i32 %144 to i64
  %146 = add i64 %145, %141
  %147 = trunc i64 %146 to i32
  store i32 %147, ptr %143, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #2
  br label %166

148:                                              ; preds = %75
  %149 = load i32, ptr %8, align 4, !tbaa !11
  %150 = add nsw i32 2, %149
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.internal_state, ptr %151, i32 0, i32 56
  %153 = load i32, ptr %152, align 4, !tbaa !20
  %154 = shl i32 %150, %153
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.internal_state, ptr %155, i32 0, i32 55
  %157 = load i16, ptr %156, align 8, !tbaa !21
  %158 = zext i16 %157 to i32
  %159 = or i32 %158, %154
  %160 = trunc i32 %159 to i16
  store i16 %160, ptr %156, align 8, !tbaa !21
  %161 = load i32, ptr %12, align 4, !tbaa !11
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.internal_state, ptr %162, i32 0, i32 56
  %164 = load i32, ptr %163, align 4, !tbaa !20
  %165 = add nsw i32 %164, %161
  store i32 %165, ptr %163, align 4, !tbaa !20
  br label %166

166:                                              ; preds = %148, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  call void @compress_block(ptr noundef %167, ptr noundef @static_ltree, ptr noundef @static_dtree)
  br label %280

168:                                              ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #2
  store i32 3, ptr %14, align 4, !tbaa !11
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.internal_state, ptr %169, i32 0, i32 56
  %171 = load i32, ptr %170, align 4, !tbaa !20
  %172 = load i32, ptr %14, align 4, !tbaa !11
  %173 = sub nsw i32 16, %172
  %174 = icmp sgt i32 %171, %173
  br i1 %174, label %175, label %241

175:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #2
  %176 = load i32, ptr %8, align 4, !tbaa !11
  %177 = add nsw i32 4, %176
  store i32 %177, ptr %15, align 4, !tbaa !11
  %178 = load i32, ptr %15, align 4, !tbaa !11
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.internal_state, ptr %179, i32 0, i32 56
  %181 = load i32, ptr %180, align 4, !tbaa !20
  %182 = shl i32 %178, %181
  %183 = load ptr, ptr %5, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.internal_state, ptr %183, i32 0, i32 55
  %185 = load i16, ptr %184, align 8, !tbaa !21
  %186 = zext i16 %185 to i32
  %187 = or i32 %186, %182
  %188 = trunc i32 %187 to i16
  store i16 %188, ptr %184, align 8, !tbaa !21
  %189 = load ptr, ptr %5, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.internal_state, ptr %189, i32 0, i32 55
  %191 = load i16, ptr %190, align 8, !tbaa !21
  %192 = zext i16 %191 to i32
  %193 = and i32 %192, 255
  %194 = trunc i32 %193 to i8
  %195 = load ptr, ptr %5, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.internal_state, ptr %195, i32 0, i32 2
  %197 = load ptr, ptr %196, align 8, !tbaa !22
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.internal_state, ptr %198, i32 0, i32 5
  %200 = load i32, ptr %199, align 8, !tbaa !23
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %199, align 8, !tbaa !23
  %202 = sext i32 %200 to i64
  %203 = getelementptr inbounds i8, ptr %197, i64 %202
  store i8 %194, ptr %203, align 1, !tbaa !24
  %204 = load ptr, ptr %5, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.internal_state, ptr %204, i32 0, i32 55
  %206 = load i16, ptr %205, align 8, !tbaa !21
  %207 = zext i16 %206 to i32
  %208 = ashr i32 %207, 8
  %209 = trunc i32 %208 to i8
  %210 = load ptr, ptr %5, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.internal_state, ptr %210, i32 0, i32 2
  %212 = load ptr, ptr %211, align 8, !tbaa !22
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.internal_state, ptr %213, i32 0, i32 5
  %215 = load i32, ptr %214, align 8, !tbaa !23
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %214, align 8, !tbaa !23
  %217 = sext i32 %215 to i64
  %218 = getelementptr inbounds i8, ptr %212, i64 %217
  store i8 %209, ptr %218, align 1, !tbaa !24
  %219 = load i32, ptr %15, align 4, !tbaa !11
  %220 = trunc i32 %219 to i16
  %221 = zext i16 %220 to i32
  %222 = load ptr, ptr %5, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.internal_state, ptr %222, i32 0, i32 56
  %224 = load i32, ptr %223, align 4, !tbaa !20
  %225 = sext i32 %224 to i64
  %226 = sub i64 16, %225
  %227 = trunc i64 %226 to i32
  %228 = ashr i32 %221, %227
  %229 = trunc i32 %228 to i16
  %230 = load ptr, ptr %5, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.internal_state, ptr %230, i32 0, i32 55
  store i16 %229, ptr %231, align 8, !tbaa !21
  %232 = load i32, ptr %14, align 4, !tbaa !11
  %233 = sext i32 %232 to i64
  %234 = sub i64 %233, 16
  %235 = load ptr, ptr %5, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.internal_state, ptr %235, i32 0, i32 56
  %237 = load i32, ptr %236, align 4, !tbaa !20
  %238 = sext i32 %237 to i64
  %239 = add i64 %238, %234
  %240 = trunc i64 %239 to i32
  store i32 %240, ptr %236, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #2
  br label %259

241:                                              ; preds = %168
  %242 = load i32, ptr %8, align 4, !tbaa !11
  %243 = add nsw i32 4, %242
  %244 = load ptr, ptr %5, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.internal_state, ptr %244, i32 0, i32 56
  %246 = load i32, ptr %245, align 4, !tbaa !20
  %247 = shl i32 %243, %246
  %248 = load ptr, ptr %5, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.internal_state, ptr %248, i32 0, i32 55
  %250 = load i16, ptr %249, align 8, !tbaa !21
  %251 = zext i16 %250 to i32
  %252 = or i32 %251, %247
  %253 = trunc i32 %252 to i16
  store i16 %253, ptr %249, align 8, !tbaa !21
  %254 = load i32, ptr %14, align 4, !tbaa !11
  %255 = load ptr, ptr %5, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.internal_state, ptr %255, i32 0, i32 56
  %257 = load i32, ptr %256, align 4, !tbaa !20
  %258 = add nsw i32 %257, %254
  store i32 %258, ptr %256, align 4, !tbaa !20
  br label %259

259:                                              ; preds = %241, %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #2
  %260 = load ptr, ptr %5, align 8, !tbaa !5
  %261 = load ptr, ptr %5, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.internal_state, ptr %261, i32 0, i32 39
  %263 = getelementptr inbounds %struct.tree_desc_s, ptr %262, i32 0, i32 1
  %264 = load i32, ptr %263, align 8, !tbaa !25
  %265 = add nsw i32 %264, 1
  %266 = load ptr, ptr %5, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.internal_state, ptr %266, i32 0, i32 40
  %268 = getelementptr inbounds %struct.tree_desc_s, ptr %267, i32 0, i32 1
  %269 = load i32, ptr %268, align 8, !tbaa !26
  %270 = add nsw i32 %269, 1
  %271 = load i32, ptr %11, align 4, !tbaa !11
  %272 = add nsw i32 %271, 1
  call void @send_all_trees(ptr noundef %260, i32 noundef %265, i32 noundef %270, i32 noundef %272)
  %273 = load ptr, ptr %5, align 8, !tbaa !5
  %274 = load ptr, ptr %5, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.internal_state, ptr %274, i32 0, i32 36
  %276 = getelementptr inbounds [573 x %struct.ct_data_s], ptr %275, i64 0, i64 0
  %277 = load ptr, ptr %5, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct.internal_state, ptr %277, i32 0, i32 37
  %279 = getelementptr inbounds [61 x %struct.ct_data_s], ptr %278, i64 0, i64 0
  call void @compress_block(ptr noundef %273, ptr noundef %276, ptr noundef %279)
  br label %280

280:                                              ; preds = %259, %166
  br label %281

281:                                              ; preds = %280, %66
  %282 = load ptr, ptr %5, align 8, !tbaa !5
  call void @init_block(ptr noundef %282)
  %283 = load i32, ptr %8, align 4, !tbaa !11
  %284 = icmp ne i32 %283, 0
  br i1 %284, label %285, label %287

285:                                              ; preds = %281
  %286 = load ptr, ptr %5, align 8, !tbaa !5
  call void @bi_windup(ptr noundef %286)
  br label %287

287:                                              ; preds = %285, %281
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @set_data_type(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @build_tree(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @build_bl_tree(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @compress_block(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @send_all_trees(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @bi_windup(ptr noundef) #0

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 172}
!14 = !{!"internal_state", !6, i64 0, !12, i64 8, !6, i64 16, !10, i64 24, !6, i64 32, !12, i64 40, !12, i64 44, !7, i64 48, !7, i64 49, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !6, i64 72, !10, i64 80, !6, i64 88, !6, i64 96, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !10, i64 128, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !12, i64 184, !7, i64 188, !7, i64 2480, !7, i64 2724, !15, i64 2880, !15, i64 2904, !15, i64 2928, !7, i64 2952, !7, i64 2984, !12, i64 5276, !12, i64 5280, !7, i64 5284, !6, i64 5864, !12, i64 5872, !12, i64 5876, !6, i64 5880, !10, i64 5888, !10, i64 5896, !12, i64 5904, !12, i64 5908, !16, i64 5912, !12, i64 5916}
!15 = !{!"tree_desc_s", !6, i64 0, !12, i64 8, !6, i64 16}
!16 = !{!"short", !7, i64 0}
!17 = !{!14, !7, i64 48}
!18 = !{!14, !10, i64 5888}
!19 = !{!14, !10, i64 5896}
!20 = !{!14, !12, i64 5916}
!21 = !{!14, !16, i64 5912}
!22 = !{!14, !6, i64 16}
!23 = !{!14, !12, i64 40}
!24 = !{!7, !7, i64 0}
!25 = !{!14, !12, i64 2888}
!26 = !{!14, !12, i64 2912}


; 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.ct_data_s = type { %union.anon, %union.anon.0 }
%union.anon = type { i16 }
%union.anon.0 = type { i16 }

@static_ltree = external hidden constant [288 x %struct.ct_data_s], align 16
@static_dtree = external hidden constant [30 x %struct.ct_data_s], align 16

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

; Function Attrs: nounwind uwtable
declare dso_local void @_tr_stored_block(ptr noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @_tr_flush_block(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 172
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %8, label %26

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = load i8, ptr %9, align 8, !tbaa !14
  %11 = icmp eq i8 %10, 2
  br i1 %11, label %12, label %13

12:                                               ; preds = %8
  tail call void @set_data_type(ptr noundef nonnull %0)
  br label %13

13:                                               ; preds = %12, %8
  %14 = getelementptr inbounds i8, ptr %0, i64 2880
  tail call void @build_tree(ptr noundef nonnull %0, ptr noundef nonnull %14)
  %15 = getelementptr inbounds i8, ptr %0, i64 2904
  tail call void @build_tree(ptr noundef nonnull %0, ptr noundef nonnull %15)
  %16 = tail call i32 @build_bl_tree(ptr noundef nonnull %0)
  %17 = getelementptr inbounds i8, ptr %0, i64 5888
  %18 = load i64, ptr %17, align 8, !tbaa !15
  %19 = add i64 %18, 10
  %20 = lshr i64 %19, 3
  %21 = getelementptr inbounds i8, ptr %0, i64 5896
  %22 = load i64, ptr %21, align 8, !tbaa !16
  %23 = add i64 %22, 10
  %24 = lshr i64 %23, 3
  %spec.select = tail call i64 @llvm.umin.i64(i64 %24, i64 %20)
  %25 = add nsw i32 %16, 1
  br label %28

26:                                               ; preds = %4
  %27 = add i64 %2, 5
  br label %28

28:                                               ; preds = %13, %26
  %.079 = phi i32 [ 1, %26 ], [ %25, %13 ]
  %.078 = phi i64 [ %27, %26 ], [ %24, %13 ]
  %.0 = phi i64 [ %27, %26 ], [ %spec.select, %13 ]
  %29 = add i64 %2, 4
  %30 = icmp ule i64 %29, %.0
  %31 = icmp ne ptr %1, null
  %or.cond = and i1 %31, %30
  br i1 %or.cond, label %32, label %33

32:                                               ; preds = %28
  tail call void @_tr_stored_block(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef %2, i32 noundef %3)
  br label %110

33:                                               ; preds = %28
  %34 = icmp eq i64 %.078, %.0
  %35 = getelementptr inbounds i8, ptr %0, i64 5916
  %36 = load i32, ptr %35, align 4, !tbaa !17
  %37 = icmp sgt i32 %36, 13
  %38 = getelementptr inbounds i8, ptr %0, i64 5912
  %39 = load i16, ptr %38, align 8, !tbaa !18
  br i1 %34, label %40, label %71

40:                                               ; preds = %33
  %41 = add nsw i32 %3, 2
  %42 = shl i32 %41, %36
  %43 = trunc i32 %42 to i16
  %44 = or i16 %39, %43
  store i16 %44, ptr %38, align 8, !tbaa !18
  br i1 %37, label %45, label %68

45:                                               ; preds = %40
  %46 = trunc i16 %44 to i8
  %47 = getelementptr inbounds i8, ptr %0, i64 16
  %48 = load ptr, ptr %47, align 8, !tbaa !19
  %49 = getelementptr inbounds i8, ptr %0, i64 40
  %50 = load i32, ptr %49, align 8, !tbaa !20
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %49, align 8, !tbaa !20
  %52 = sext i32 %50 to i64
  %53 = getelementptr inbounds i8, ptr %48, i64 %52
  store i8 %46, ptr %53, align 1, !tbaa !21
  %54 = load i16, ptr %38, align 8, !tbaa !18
  %55 = lshr i16 %54, 8
  %56 = trunc nuw i16 %55 to i8
  %57 = load ptr, ptr %47, align 8, !tbaa !19
  %58 = load i32, ptr %49, align 8, !tbaa !20
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %49, align 8, !tbaa !20
  %60 = sext i32 %58 to i64
  %61 = getelementptr inbounds i8, ptr %57, i64 %60
  store i8 %56, ptr %61, align 1, !tbaa !21
  %62 = and i32 %41, 65535
  %63 = load i32, ptr %35, align 4, !tbaa !17
  %64 = sub i32 16, %63
  %65 = lshr i32 %62, %64
  %66 = trunc nuw i32 %65 to i16
  store i16 %66, ptr %38, align 8, !tbaa !18
  %67 = add i32 %63, -13
  br label %70

68:                                               ; preds = %40
  %69 = add nsw i32 %36, 3
  br label %70

70:                                               ; preds = %68, %45
  %storemerge87 = phi i32 [ %69, %68 ], [ %67, %45 ]
  store i32 %storemerge87, ptr %35, align 4, !tbaa !17
  tail call void @compress_block(ptr noundef nonnull %0, ptr noundef nonnull @static_ltree, ptr noundef nonnull @static_dtree)
  br label %110

71:                                               ; preds = %33
  %72 = add nsw i32 %3, 4
  %73 = shl i32 %72, %36
  %74 = trunc i32 %73 to i16
  %75 = or i16 %39, %74
  store i16 %75, ptr %38, align 8, !tbaa !18
  br i1 %37, label %76, label %99

76:                                               ; preds = %71
  %77 = trunc i16 %75 to i8
  %78 = getelementptr inbounds i8, ptr %0, i64 16
  %79 = load ptr, ptr %78, align 8, !tbaa !19
  %80 = getelementptr inbounds i8, ptr %0, i64 40
  %81 = load i32, ptr %80, align 8, !tbaa !20
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %80, align 8, !tbaa !20
  %83 = sext i32 %81 to i64
  %84 = getelementptr inbounds i8, ptr %79, i64 %83
  store i8 %77, ptr %84, align 1, !tbaa !21
  %85 = load i16, ptr %38, align 8, !tbaa !18
  %86 = lshr i16 %85, 8
  %87 = trunc nuw i16 %86 to i8
  %88 = load ptr, ptr %78, align 8, !tbaa !19
  %89 = load i32, ptr %80, align 8, !tbaa !20
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %80, align 8, !tbaa !20
  %91 = sext i32 %89 to i64
  %92 = getelementptr inbounds i8, ptr %88, i64 %91
  store i8 %87, ptr %92, align 1, !tbaa !21
  %93 = and i32 %72, 65535
  %94 = load i32, ptr %35, align 4, !tbaa !17
  %95 = sub i32 16, %94
  %96 = lshr i32 %93, %95
  %97 = trunc nuw i32 %96 to i16
  store i16 %97, ptr %38, align 8, !tbaa !18
  %98 = add i32 %94, -13
  br label %101

99:                                               ; preds = %71
  %100 = add nsw i32 %36, 3
  br label %101

101:                                              ; preds = %99, %76
  %storemerge = phi i32 [ %100, %99 ], [ %98, %76 ]
  store i32 %storemerge, ptr %35, align 4, !tbaa !17
  %102 = getelementptr inbounds i8, ptr %0, i64 2888
  %103 = load i32, ptr %102, align 8, !tbaa !22
  %104 = add nsw i32 %103, 1
  %105 = getelementptr inbounds i8, ptr %0, i64 2912
  %106 = load i32, ptr %105, align 8, !tbaa !23
  %107 = add nsw i32 %106, 1
  tail call void @send_all_trees(ptr noundef nonnull %0, i32 noundef %104, i32 noundef %107, i32 noundef %.079)
  %108 = getelementptr inbounds i8, ptr %0, i64 188
  %109 = getelementptr inbounds i8, ptr %0, i64 2480
  tail call void @compress_block(ptr noundef nonnull %0, ptr noundef nonnull %108, ptr noundef nonnull %109)
  br label %110

110:                                              ; preds = %70, %101, %32
  tail call void @init_block(ptr noundef nonnull %0)
  %.not88 = icmp eq i32 %3, 0
  br i1 %.not88, label %112, label %111

111:                                              ; preds = %110
  tail call void @bi_windup(ptr noundef nonnull %0)
  br label %112

112:                                              ; preds = %111, %110
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden void @build_tree(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @build_bl_tree(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @compress_block(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @send_all_trees(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !10, i64 172}
!6 = !{!"internal_state", !7, i64 0, !10, i64 8, !7, i64 16, !11, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !8, i64 48, !8, i64 49, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !7, i64 72, !11, i64 80, !7, i64 88, !7, i64 96, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !11, i64 128, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !8, i64 188, !8, i64 2480, !8, i64 2724, !12, i64 2880, !12, i64 2904, !12, i64 2928, !8, i64 2952, !8, i64 2984, !10, i64 5276, !10, i64 5280, !8, i64 5284, !7, i64 5864, !10, i64 5872, !10, i64 5876, !7, i64 5880, !11, i64 5888, !11, i64 5896, !10, i64 5904, !10, i64 5908, !13, i64 5912, !10, i64 5916}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"tree_desc_s", !7, i64 0, !10, i64 8, !7, i64 16}
!13 = !{!"short", !8, i64 0}
!14 = !{!6, !8, i64 48}
!15 = !{!6, !11, i64 5888}
!16 = !{!6, !11, i64 5896}
!17 = !{!6, !10, i64 5916}
!18 = !{!6, !13, i64 5912}
!19 = !{!6, !7, i64 16}
!20 = !{!6, !10, i64 40}
!21 = !{!8, !8, i64 0}
!22 = !{!6, !10, i64 2888}
!23 = !{!6, !10, i64 2912}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass