; LLVM IR from ebiggers/libdeflate :: lib (deflate_compress)

; 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.libdeflate_options = type { i64, ptr, ptr }
%struct.libdeflate_compressor = type { ptr, ptr, i32, i64, i32, i32, %struct.deflate_freqs, %struct.block_split_stats, %struct.deflate_codes, %struct.deflate_codes, %union.anon, [4 x i8], %union.anon.1 }
%struct.deflate_freqs = type { [288 x i32], [32 x i32] }
%struct.block_split_stats = type { [10 x i32], [10 x i32], i32, i32 }
%struct.deflate_codes = type { %struct.deflate_codewords, %struct.deflate_lens }
%struct.deflate_codewords = type { [288 x i32], [32 x i32] }
%struct.deflate_lens = type { [288 x i8], [32 x i8] }
%union.anon = type { %struct.anon }
%struct.anon = type { [19 x i32], [19 x i32], [19 x i8], [320 x i32], i32, i32, i32, i32 }
%union.anon.1 = type { %struct.anon.4 }
%struct.anon.4 = type { %struct.bt_matchfinder, [1500513 x %struct.lz_match], [305000 x %struct.deflate_optimum_node], %struct.deflate_costs, %struct.deflate_costs, [32769 x i8], [10 x i32], i32, [259 x i32], [259 x i32], i32, i32, i32, i32, [12 x i8] }
%struct.bt_matchfinder = type { [65536 x [2 x i16]], [65536 x i16], [65536 x i16] }
%struct.lz_match = type { i16, i16 }
%struct.deflate_optimum_node = type { i32, i32 }
%struct.deflate_costs = type { [256 x i32], [259 x i32], [32 x i32] }

@libdeflate_default_malloc_func = external global ptr, align 8
@libdeflate_default_free_func = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @libdeflate_alloc_compressor_ex(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 6080, ptr %7, align 8, !tbaa !11
  call void @check_buildtime_parameters()
  %9 = load ptr, ptr %5, align 8, !tbaa !9
  %10 = getelementptr inbounds %struct.libdeflate_options, ptr %9, i32 0, i32 0
  %11 = load i64, ptr %10, align 8, !tbaa !13
  %12 = icmp ne i64 %11, 24
  br i1 %12, label %13, label %14

13:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %214

14:                                               ; preds = %2
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %20, label %17

17:                                               ; preds = %14
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 12
  br i1 %19, label %20, label %21

20:                                               ; preds = %17, %14
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %214

21:                                               ; preds = %17
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = icmp sge i32 %22, 10
  br i1 %23, label %24, label %27

24:                                               ; preds = %21
  %25 = load i64, ptr %7, align 8, !tbaa !11
  %26 = add i64 %25, 9005632
  store i64 %26, ptr %7, align 8, !tbaa !11
  br label %41

27:                                               ; preds = %21
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = icmp sge i32 %28, 2
  br i1 %29, label %30, label %33

30:                                               ; preds = %27
  %31 = load i64, ptr %7, align 8, !tbaa !11
  %32 = add i64 %31, 662176
  store i64 %32, ptr %7, align 8, !tbaa !11
  br label %40

33:                                               ; preds = %27
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 1
  br i1 %35, label %36, label %39

36:                                               ; preds = %33
  %37 = load i64, ptr %7, align 8, !tbaa !11
  %38 = add i64 %37, 196640
  store i64 %38, ptr %7, align 8, !tbaa !11
  br label %39

39:                                               ; preds = %36, %33
  br label %40

40:                                               ; preds = %39, %30
  br label %41

41:                                               ; preds = %40, %24
  %42 = load ptr, ptr %5, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.libdeflate_options, ptr %42, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %50

46:                                               ; preds = %41
  %47 = load ptr, ptr %5, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct.libdeflate_options, ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !15
  br label %52

50:                                               ; preds = %41
  %51 = load ptr, ptr @libdeflate_default_malloc_func, align 8, !tbaa !9
  br label %52

52:                                               ; preds = %50, %46
  %53 = phi ptr [ %49, %46 ], [ %51, %50 ]
  %54 = load i64, ptr %7, align 8, !tbaa !11
  %55 = call ptr @libdeflate_aligned_malloc(ptr noundef %53, i64 noundef 32, i64 noundef %54)
  store ptr %55, ptr %6, align 8, !tbaa !9
  %56 = load ptr, ptr %6, align 8, !tbaa !9
  %57 = icmp ne ptr %56, null
  br i1 %57, label %59, label %58

58:                                               ; preds = %52
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %214

59:                                               ; preds = %52
  %60 = load ptr, ptr %5, align 8, !tbaa !9
  %61 = getelementptr inbounds %struct.libdeflate_options, ptr %60, i32 0, i32 2
  %62 = load ptr, ptr %61, align 8, !tbaa !16
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %68

64:                                               ; preds = %59
  %65 = load ptr, ptr %5, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct.libdeflate_options, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  br label %70

68:                                               ; preds = %59
  %69 = load ptr, ptr @libdeflate_default_free_func, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %68, %64
  %71 = phi ptr [ %67, %64 ], [ %69, %68 ]
  %72 = load ptr, ptr %6, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.libdeflate_compressor, ptr %72, i32 0, i32 1
  store ptr %71, ptr %73, align 8, !tbaa !17
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = load ptr, ptr %6, align 8, !tbaa !9
  %76 = getelementptr inbounds %struct.libdeflate_compressor, ptr %75, i32 0, i32 2
  store i32 %74, ptr %76, align 16, !tbaa !24
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = mul nsw i32 %77, 4
  %79 = sub nsw i32 55, %78
  %80 = sext i32 %79 to i64
  %81 = load ptr, ptr %6, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.libdeflate_compressor, ptr %81, i32 0, i32 3
  store i64 %80, ptr %82, align 8, !tbaa !25
  %83 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %83, label %191 [
    i32 0, label %84
    i32 1, label %89
    i32 2, label %94
    i32 3, label %101
    i32 4, label %108
    i32 5, label %115
    i32 6, label %122
    i32 7, label %129
    i32 8, label %136
    i32 9, label %143
    i32 10, label %150
    i32 11, label %170
    i32 12, label %190
  ]

84:                                               ; preds = %70
  %85 = load ptr, ptr %6, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.libdeflate_compressor, ptr %85, i32 0, i32 3
  store i64 -1, ptr %86, align 8, !tbaa !25
  %87 = load ptr, ptr %6, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.libdeflate_compressor, ptr %87, i32 0, i32 0
  store ptr null, ptr %88, align 32, !tbaa !26
  br label %211

89:                                               ; preds = %70
  %90 = load ptr, ptr %6, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct.libdeflate_compressor, ptr %90, i32 0, i32 0
  store ptr @deflate_compress_fastest, ptr %91, align 32, !tbaa !26
  %92 = load ptr, ptr %6, align 8, !tbaa !9
  %93 = getelementptr inbounds %struct.libdeflate_compressor, ptr %92, i32 0, i32 5
  store i32 32, ptr %93, align 4, !tbaa !27
  br label %211

94:                                               ; preds = %70
  %95 = load ptr, ptr %6, align 8, !tbaa !9
  %96 = getelementptr inbounds %struct.libdeflate_compressor, ptr %95, i32 0, i32 0
  store ptr @deflate_compress_greedy, ptr %96, align 32, !tbaa !26
  %97 = load ptr, ptr %6, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.libdeflate_compressor, ptr %97, i32 0, i32 4
  store i32 6, ptr %98, align 32, !tbaa !28
  %99 = load ptr, ptr %6, align 8, !tbaa !9
  %100 = getelementptr inbounds %struct.libdeflate_compressor, ptr %99, i32 0, i32 5
  store i32 10, ptr %100, align 4, !tbaa !27
  br label %211

101:                                              ; preds = %70
  %102 = load ptr, ptr %6, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct.libdeflate_compressor, ptr %102, i32 0, i32 0
  store ptr @deflate_compress_greedy, ptr %103, align 32, !tbaa !26
  %104 = load ptr, ptr %6, align 8, !tbaa !9
  %105 = getelementptr inbounds %struct.libdeflate_compressor, ptr %104, i32 0, i32 4
  store i32 12, ptr %105, align 32, !tbaa !28
  %106 = load ptr, ptr %6, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct.libdeflate_compressor, ptr %106, i32 0, i32 5
  store i32 14, ptr %107, align 4, !tbaa !27
  br label %211

108:                                              ; preds = %70
  %109 = load ptr, ptr %6, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.libdeflate_compressor, ptr %109, i32 0, i32 0
  store ptr @deflate_compress_greedy, ptr %110, align 32, !tbaa !26
  %111 = load ptr, ptr %6, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct.libdeflate_compressor, ptr %111, i32 0, i32 4
  store i32 16, ptr %112, align 32, !tbaa !28
  %113 = load ptr, ptr %6, align 8, !tbaa !9
  %114 = getelementptr inbounds %struct.libdeflate_compressor, ptr %113, i32 0, i32 5
  store i32 30, ptr %114, align 4, !tbaa !27
  br label %211

115:                                              ; preds = %70
  %116 = load ptr, ptr %6, align 8, !tbaa !9
  %117 = getelementptr inbounds %struct.libdeflate_compressor, ptr %116, i32 0, i32 0
  store ptr @deflate_compress_lazy, ptr %117, align 32, !tbaa !26
  %118 = load ptr, ptr %6, align 8, !tbaa !9
  %119 = getelementptr inbounds %struct.libdeflate_compressor, ptr %118, i32 0, i32 4
  store i32 16, ptr %119, align 32, !tbaa !28
  %120 = load ptr, ptr %6, align 8, !tbaa !9
  %121 = getelementptr inbounds %struct.libdeflate_compressor, ptr %120, i32 0, i32 5
  store i32 30, ptr %121, align 4, !tbaa !27
  br label %211

122:                                              ; preds = %70
  %123 = load ptr, ptr %6, align 8, !tbaa !9
  %124 = getelementptr inbounds %struct.libdeflate_compressor, ptr %123, i32 0, i32 0
  store ptr @deflate_compress_lazy, ptr %124, align 32, !tbaa !26
  %125 = load ptr, ptr %6, align 8, !tbaa !9
  %126 = getelementptr inbounds %struct.libdeflate_compressor, ptr %125, i32 0, i32 4
  store i32 35, ptr %126, align 32, !tbaa !28
  %127 = load ptr, ptr %6, align 8, !tbaa !9
  %128 = getelementptr inbounds %struct.libdeflate_compressor, ptr %127, i32 0, i32 5
  store i32 65, ptr %128, align 4, !tbaa !27
  br label %211

129:                                              ; preds = %70
  %130 = load ptr, ptr %6, align 8, !tbaa !9
  %131 = getelementptr inbounds %struct.libdeflate_compressor, ptr %130, i32 0, i32 0
  store ptr @deflate_compress_lazy, ptr %131, align 32, !tbaa !26
  %132 = load ptr, ptr %6, align 8, !tbaa !9
  %133 = getelementptr inbounds %struct.libdeflate_compressor, ptr %132, i32 0, i32 4
  store i32 100, ptr %133, align 32, !tbaa !28
  %134 = load ptr, ptr %6, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct.libdeflate_compressor, ptr %134, i32 0, i32 5
  store i32 130, ptr %135, align 4, !tbaa !27
  br label %211

136:                                              ; preds = %70
  %137 = load ptr, ptr %6, align 8, !tbaa !9
  %138 = getelementptr inbounds %struct.libdeflate_compressor, ptr %137, i32 0, i32 0
  store ptr @deflate_compress_lazy2, ptr %138, align 32, !tbaa !26
  %139 = load ptr, ptr %6, align 8, !tbaa !9
  %140 = getelementptr inbounds %struct.libdeflate_compressor, ptr %139, i32 0, i32 4
  store i32 300, ptr %140, align 32, !tbaa !28
  %141 = load ptr, ptr %6, align 8, !tbaa !9
  %142 = getelementptr inbounds %struct.libdeflate_compressor, ptr %141, i32 0, i32 5
  store i32 258, ptr %142, align 4, !tbaa !27
  br label %211

143:                                              ; preds = %70
  %144 = load ptr, ptr %6, align 8, !tbaa !9
  %145 = getelementptr inbounds %struct.libdeflate_compressor, ptr %144, i32 0, i32 0
  store ptr @deflate_compress_lazy2, ptr %145, align 32, !tbaa !26
  %146 = load ptr, ptr %6, align 8, !tbaa !9
  %147 = getelementptr inbounds %struct.libdeflate_compressor, ptr %146, i32 0, i32 4
  store i32 600, ptr %147, align 32, !tbaa !28
  %148 = load ptr, ptr %6, align 8, !tbaa !9
  %149 = getelementptr inbounds %struct.libdeflate_compressor, ptr %148, i32 0, i32 5
  store i32 258, ptr %149, align 4, !tbaa !27
  br label %211

150:                                              ; preds = %70
  %151 = load ptr, ptr %6, align 8, !tbaa !9
  %152 = getelementptr inbounds %struct.libdeflate_compressor, ptr %151, i32 0, i32 0
  store ptr @deflate_compress_near_optimal, ptr %152, align 32, !tbaa !26
  %153 = load ptr, ptr %6, align 8, !tbaa !9
  %154 = getelementptr inbounds %struct.libdeflate_compressor, ptr %153, i32 0, i32 4
  store i32 35, ptr %154, align 32, !tbaa !28
  %155 = load ptr, ptr %6, align 8, !tbaa !9
  %156 = getelementptr inbounds %struct.libdeflate_compressor, ptr %155, i32 0, i32 5
  store i32 75, ptr %156, align 4, !tbaa !27
  %157 = load ptr, ptr %6, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct.libdeflate_compressor, ptr %157, i32 0, i32 12
  %159 = getelementptr inbounds %struct.anon.4, ptr %158, i32 0, i32 10
  store i32 2, ptr %159, align 4, !tbaa !29
  %160 = load ptr, ptr %6, align 8, !tbaa !9
  %161 = getelementptr inbounds %struct.libdeflate_compressor, ptr %160, i32 0, i32 12
  %162 = getelementptr inbounds %struct.anon.4, ptr %161, i32 0, i32 11
  store i32 32, ptr %162, align 8, !tbaa !29
  %163 = load ptr, ptr %6, align 8, !tbaa !9
  %164 = getelementptr inbounds %struct.libdeflate_compressor, ptr %163, i32 0, i32 12
  %165 = getelementptr inbounds %struct.anon.4, ptr %164, i32 0, i32 12
  store i32 32, ptr %165, align 4, !tbaa !29
  %166 = load ptr, ptr %6, align 8, !tbaa !9
  %167 = getelementptr inbounds %struct.libdeflate_compressor, ptr %166, i32 0, i32 12
  %168 = getelementptr inbounds %struct.anon.4, ptr %167, i32 0, i32 13
  store i32 0, ptr %168, align 16, !tbaa !29
  %169 = load ptr, ptr %6, align 8, !tbaa !9
  call void @deflate_init_offset_slot_full(ptr noundef %169)
  br label %211

170:                                              ; preds = %70
  %171 = load ptr, ptr %6, align 8, !tbaa !9
  %172 = getelementptr inbounds %struct.libdeflate_compressor, ptr %171, i32 0, i32 0
  store ptr @deflate_compress_near_optimal, ptr %172, align 32, !tbaa !26
  %173 = load ptr, ptr %6, align 8, !tbaa !9
  %174 = getelementptr inbounds %struct.libdeflate_compressor, ptr %173, i32 0, i32 4
  store i32 100, ptr %174, align 32, !tbaa !28
  %175 = load ptr, ptr %6, align 8, !tbaa !9
  %176 = getelementptr inbounds %struct.libdeflate_compressor, ptr %175, i32 0, i32 5
  store i32 150, ptr %176, align 4, !tbaa !27
  %177 = load ptr, ptr %6, align 8, !tbaa !9
  %178 = getelementptr inbounds %struct.libdeflate_compressor, ptr %177, i32 0, i32 12
  %179 = getelementptr inbounds %struct.anon.4, ptr %178, i32 0, i32 10
  store i32 4, ptr %179, align 4, !tbaa !29
  %180 = load ptr, ptr %6, align 8, !tbaa !9
  %181 = getelementptr inbounds %struct.libdeflate_compressor, ptr %180, i32 0, i32 12
  %182 = getelementptr inbounds %struct.anon.4, ptr %181, i32 0, i32 11
  store i32 16, ptr %182, align 8, !tbaa !29
  %183 = load ptr, ptr %6, align 8, !tbaa !9
  %184 = getelementptr inbounds %struct.libdeflate_compressor, ptr %183, i32 0, i32 12
  %185 = getelementptr inbounds %struct.anon.4, ptr %184, i32 0, i32 12
  store i32 16, ptr %185, align 4, !tbaa !29
  %186 = load ptr, ptr %6, align 8, !tbaa !9
  %187 = getelementptr inbounds %struct.libdeflate_compressor, ptr %186, i32 0, i32 12
  %188 = getelementptr inbounds %struct.anon.4, ptr %187, i32 0, i32 13
  store i32 1000, ptr %188, align 16, !tbaa !29
  %189 = load ptr, ptr %6, align 8, !tbaa !9
  call void @deflate_init_offset_slot_full(ptr noundef %189)
  br label %211

190:                                              ; preds = %70
  br label %191

191:                                              ; preds = %190, %70
  %192 = load ptr, ptr %6, align 8, !tbaa !9
  %193 = getelementptr inbounds %struct.libdeflate_compressor, ptr %192, i32 0, i32 0
  store ptr @deflate_compress_near_optimal, ptr %193, align 32, !tbaa !26
  %194 = load ptr, ptr %6, align 8, !tbaa !9
  %195 = getelementptr inbounds %struct.libdeflate_compressor, ptr %194, i32 0, i32 4
  store i32 300, ptr %195, align 32, !tbaa !28
  %196 = load ptr, ptr %6, align 8, !tbaa !9
  %197 = getelementptr inbounds %struct.libdeflate_compressor, ptr %196, i32 0, i32 5
  store i32 258, ptr %197, align 4, !tbaa !27
  %198 = load ptr, ptr %6, align 8, !tbaa !9
  %199 = getelementptr inbounds %struct.libdeflate_compressor, ptr %198, i32 0, i32 12
  %200 = getelementptr inbounds %struct.anon.4, ptr %199, i32 0, i32 10
  store i32 10, ptr %200, align 4, !tbaa !29
  %201 = load ptr, ptr %6, align 8, !tbaa !9
  %202 = getelementptr inbounds %struct.libdeflate_compressor, ptr %201, i32 0, i32 12
  %203 = getelementptr inbounds %struct.anon.4, ptr %202, i32 0, i32 11
  store i32 1, ptr %203, align 8, !tbaa !29
  %204 = load ptr, ptr %6, align 8, !tbaa !9
  %205 = getelementptr inbounds %struct.libdeflate_compressor, ptr %204, i32 0, i32 12
  %206 = getelementptr inbounds %struct.anon.4, ptr %205, i32 0, i32 12
  store i32 1, ptr %206, align 4, !tbaa !29
  %207 = load ptr, ptr %6, align 8, !tbaa !9
  %208 = getelementptr inbounds %struct.libdeflate_compressor, ptr %207, i32 0, i32 12
  %209 = getelementptr inbounds %struct.anon.4, ptr %208, i32 0, i32 13
  store i32 10000, ptr %209, align 16, !tbaa !29
  %210 = load ptr, ptr %6, align 8, !tbaa !9
  call void @deflate_init_offset_slot_full(ptr noundef %210)
  br label %211

211:                                              ; preds = %191, %170, %150, %143, %136, %129, %122, %115, %108, %101, %94, %89, %84
  %212 = load ptr, ptr %6, align 8, !tbaa !9
  call void @deflate_init_static_codes(ptr noundef %212)
  %213 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %213, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %214

214:                                              ; preds = %211, %58, %20, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %215 = load ptr, ptr %3, align 8
  ret ptr %215
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @check_buildtime_parameters() #2

declare ptr @libdeflate_aligned_malloc(ptr noundef, i64 noundef, i64 noundef) #3

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

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline 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 = { "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 }

!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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"libdeflate_options", !12, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!14, !10, i64 8}
!16 = !{!14, !10, i64 16}
!17 = !{!18, !10, i64 8}
!18 = !{!"libdeflate_compressor", !10, i64 0, !10, i64 8, !6, i64 16, !12, i64 24, !6, i64 32, !6, i64 36, !19, i64 40, !20, i64 1320, !21, i64 1408, !21, i64 3008, !7, i64 4608, !7, i64 6080}
!19 = !{!"deflate_freqs", !7, i64 0, !7, i64 1152}
!20 = !{!"block_split_stats", !7, i64 0, !7, i64 40, !6, i64 80, !6, i64 84}
!21 = !{!"deflate_codes", !22, i64 0, !23, i64 1280}
!22 = !{!"deflate_codewords", !7, i64 0, !7, i64 1152}
!23 = !{!"deflate_lens", !7, i64 0, !7, i64 288}
!24 = !{!18, !6, i64 16}
!25 = !{!18, !12, i64 24}
!26 = !{!18, !10, i64 0}
!27 = !{!18, !6, i64 36}
!28 = !{!18, !6, i64 32}
!29 = !{!7, !7, i64 0}


; 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"

@libdeflate_default_malloc_func = external local_unnamed_addr global ptr, align 8
@libdeflate_default_free_func = external local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @libdeflate_alloc_compressor_ex(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  tail call void @check_buildtime_parameters()
  %3 = load i64, ptr %1, align 8, !tbaa !5
  %.not = icmp ne i64 %3, 24
  %or.cond = icmp ugt i32 %0, 12
  %or.cond84 = or i1 %or.cond, %.not
  br i1 %or.cond84, label %67, label %4

4:                                                ; preds = %2
  %5 = icmp ugt i32 %0, 9
  br i1 %5, label %10, label %6

6:                                                ; preds = %4
  %7 = icmp ugt i32 %0, 1
  br i1 %7, label %10, label %8

8:                                                ; preds = %6
  %9 = icmp eq i32 %0, 1
  %spec.select = select i1 %9, i64 202720, i64 6080
  br label %10

10:                                               ; preds = %8, %6, %4
  %.0 = phi i64 [ 9011712, %4 ], [ 668256, %6 ], [ %spec.select, %8 ]
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %.not81 = icmp eq ptr %12, null
  %13 = load ptr, ptr @libdeflate_default_malloc_func, align 8
  %14 = select i1 %.not81, ptr %13, ptr %12
  %15 = tail call ptr @libdeflate_aligned_malloc(ptr noundef %14, i64 noundef 32, i64 noundef %.0) #3
  %.not82 = icmp eq ptr %15, null
  br i1 %.not82, label %67, label %16

16:                                               ; preds = %10
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %.not83 = icmp eq ptr %18, null
  %19 = load ptr, ptr @libdeflate_default_free_func, align 8
  %20 = select i1 %.not83, ptr %19, ptr %18
  %21 = getelementptr inbounds i8, ptr %15, i64 8
  store ptr %20, ptr %21, align 8, !tbaa !13
  %22 = getelementptr inbounds i8, ptr %15, i64 16
  store i32 %0, ptr %22, align 16, !tbaa !21
  %23 = shl nuw nsw i32 %0, 2
  %24 = sub nuw nsw i32 55, %23
  %25 = zext nneg i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %15, i64 24
  store i64 %25, ptr %26, align 8, !tbaa !22
  switch i32 %0, label %62 [
    i32 0, label %27
    i32 1, label %28
    i32 2, label %30
    i32 3, label %33
    i32 4, label %36
    i32 5, label %39
    i32 6, label %42
    i32 7, label %45
    i32 8, label %48
    i32 9, label %51
    i32 10, label %54
    i32 11, label %58
  ]

27:                                               ; preds = %16
  store i64 -1, ptr %26, align 8, !tbaa !22
  store ptr null, ptr %15, align 32, !tbaa !23
  br label %66

28:                                               ; preds = %16
  store ptr @deflate_compress_fastest, ptr %15, align 32, !tbaa !23
  %29 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 32, ptr %29, align 4, !tbaa !24
  br label %66

30:                                               ; preds = %16
  store ptr @deflate_compress_greedy, ptr %15, align 32, !tbaa !23
  %31 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 6, ptr %31, align 32, !tbaa !25
  %32 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 10, ptr %32, align 4, !tbaa !24
  br label %66

33:                                               ; preds = %16
  store ptr @deflate_compress_greedy, ptr %15, align 32, !tbaa !23
  %34 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 12, ptr %34, align 32, !tbaa !25
  %35 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 14, ptr %35, align 4, !tbaa !24
  br label %66

36:                                               ; preds = %16
  store ptr @deflate_compress_greedy, ptr %15, align 32, !tbaa !23
  %37 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 16, ptr %37, align 32, !tbaa !25
  %38 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 30, ptr %38, align 4, !tbaa !24
  br label %66

39:                                               ; preds = %16
  store ptr @deflate_compress_lazy, ptr %15, align 32, !tbaa !23
  %40 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 16, ptr %40, align 32, !tbaa !25
  %41 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 30, ptr %41, align 4, !tbaa !24
  br label %66

42:                                               ; preds = %16
  store ptr @deflate_compress_lazy, ptr %15, align 32, !tbaa !23
  %43 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 35, ptr %43, align 32, !tbaa !25
  %44 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 65, ptr %44, align 4, !tbaa !24
  br label %66

45:                                               ; preds = %16
  store ptr @deflate_compress_lazy, ptr %15, align 32, !tbaa !23
  %46 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 100, ptr %46, align 32, !tbaa !25
  %47 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 130, ptr %47, align 4, !tbaa !24
  br label %66

48:                                               ; preds = %16
  store ptr @deflate_compress_lazy2, ptr %15, align 32, !tbaa !23
  %49 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 300, ptr %49, align 32, !tbaa !25
  %50 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 258, ptr %50, align 4, !tbaa !24
  br label %66

51:                                               ; preds = %16
  store ptr @deflate_compress_lazy2, ptr %15, align 32, !tbaa !23
  %52 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 600, ptr %52, align 32, !tbaa !25
  %53 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 258, ptr %53, align 4, !tbaa !24
  br label %66

54:                                               ; preds = %16
  store ptr @deflate_compress_near_optimal, ptr %15, align 32, !tbaa !23
  %55 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 35, ptr %55, align 32, !tbaa !25
  %56 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 75, ptr %56, align 4, !tbaa !24
  %57 = getelementptr inbounds i8, ptr %15, i64 9011684
  store <4 x i32> <i32 2, i32 32, i32 32, i32 0>, ptr %57, align 4, !tbaa !26
  tail call void @deflate_init_offset_slot_full(ptr noundef nonnull %15)
  br label %66

58:                                               ; preds = %16
  store ptr @deflate_compress_near_optimal, ptr %15, align 32, !tbaa !23
  %59 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 100, ptr %59, align 32, !tbaa !25
  %60 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 150, ptr %60, align 4, !tbaa !24
  %61 = getelementptr inbounds i8, ptr %15, i64 9011684
  store <4 x i32> <i32 4, i32 16, i32 16, i32 1000>, ptr %61, align 4, !tbaa !26
  tail call void @deflate_init_offset_slot_full(ptr noundef nonnull %15)
  br label %66

62:                                               ; preds = %16
  store ptr @deflate_compress_near_optimal, ptr %15, align 32, !tbaa !23
  %63 = getelementptr inbounds i8, ptr %15, i64 32
  store i32 300, ptr %63, align 32, !tbaa !25
  %64 = getelementptr inbounds i8, ptr %15, i64 36
  store i32 258, ptr %64, align 4, !tbaa !24
  %65 = getelementptr inbounds i8, ptr %15, i64 9011684
  store <4 x i32> <i32 10, i32 1, i32 1, i32 10000>, ptr %65, align 4, !tbaa !26
  tail call void @deflate_init_offset_slot_full(ptr noundef nonnull %15)
  br label %66

66:                                               ; preds = %62, %58, %54, %51, %48, %45, %42, %39, %36, %33, %30, %28, %27
  tail call void @deflate_init_static_codes(ptr noundef nonnull %15)
  br label %67

67:                                               ; preds = %10, %2, %66
  %.076 = phi ptr [ %15, %66 ], [ null, %2 ], [ null, %10 ]
  ret ptr %.076
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @check_buildtime_parameters() local_unnamed_addr #1

declare ptr @libdeflate_aligned_malloc(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @deflate_init_static_codes(ptr noundef) local_unnamed_addr #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 = { alwaysinline 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 = { "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, !7, i64 0}
!6 = !{!"libdeflate_options", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 16}
!13 = !{!14, !10, i64 8}
!14 = !{!"libdeflate_compressor", !10, i64 0, !10, i64 8, !15, i64 16, !7, i64 24, !15, i64 32, !15, i64 36, !16, i64 40, !17, i64 1320, !18, i64 1408, !18, i64 3008, !8, i64 4608, !8, i64 6080}
!15 = !{!"int", !8, i64 0}
!16 = !{!"deflate_freqs", !8, i64 0, !8, i64 1152}
!17 = !{!"block_split_stats", !8, i64 0, !8, i64 40, !15, i64 80, !15, i64 84}
!18 = !{!"deflate_codes", !19, i64 0, !20, i64 1280}
!19 = !{!"deflate_codewords", !8, i64 0, !8, i64 1152}
!20 = !{!"deflate_lens", !8, i64 0, !8, i64 288}
!21 = !{!14, !15, i64 16}
!22 = !{!14, !7, i64 24}
!23 = !{!14, !10, i64 0}
!24 = !{!14, !15, i64 36}
!25 = !{!14, !15, i64 32}
!26 = !{!8, !8, i64 0}


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