; LLVM IR from yourtion/LearningMasteringAlgorithms-C :: source (huffman)

; 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.HuffCode_ = type { i8, i16, i8 }
%struct.BiTree_ = type { i32, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local i32 @huffman_compress(ptr noundef %0, ptr noundef %1, i32 noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca [256 x %struct.HuffCode_], align 16
  %10 = alloca [256 x i32], align 16
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 1536, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 1024, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr null, ptr %22, align 8, !tbaa !5
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %30, %3
  %24 = load i32, ptr %17, align 4, !tbaa !9
  %25 = icmp sle i32 %24, 255
  br i1 %25, label %26, label %33

26:                                               ; preds = %23
  %27 = load i32, ptr %17, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %28
  store i32 0, ptr %29, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %26
  %31 = load i32, ptr %17, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %17, align 4, !tbaa !9
  br label %23, !llvm.loop !11

33:                                               ; preds = %23
  store i32 0, ptr %14, align 4, !tbaa !9
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %36, label %54

36:                                               ; preds = %33
  br label %37

37:                                               ; preds = %41, %36
  %38 = load i32, ptr %14, align 4, !tbaa !9
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %41, label %53

41:                                               ; preds = %37
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i32, ptr %14, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %42, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !13
  %47 = zext i8 %46 to i64
  %48 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %48, align 4, !tbaa !9
  %51 = load i32, ptr %14, align 4, !tbaa !9
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %14, align 4, !tbaa !9
  br label %37, !llvm.loop !14

53:                                               ; preds = %37
  br label %54

54:                                               ; preds = %53, %33
  store i32 255, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %71, %54
  %56 = load i32, ptr %17, align 4, !tbaa !9
  %57 = icmp sle i32 %56, 255
  br i1 %57, label %58, label %74

58:                                               ; preds = %55
  %59 = load i32, ptr %17, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = load i32, ptr %11, align 4, !tbaa !9
  %64 = icmp sgt i32 %62, %63
  br i1 %64, label %65, label %70

65:                                               ; preds = %58
  %66 = load i32, ptr %17, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !9
  store i32 %69, ptr %11, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %65, %58
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %17, align 4, !tbaa !9
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %17, align 4, !tbaa !9
  br label %55, !llvm.loop !15

74:                                               ; preds = %55
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %107, %74
  %76 = load i32, ptr %17, align 4, !tbaa !9
  %77 = icmp sle i32 %76, 255
  br i1 %77, label %78, label %110

78:                                               ; preds = %75
  %79 = load i32, ptr %17, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !9
  %83 = sitofp i32 %82 to double
  %84 = load i32, ptr %11, align 4, !tbaa !9
  %85 = sitofp i32 %84 to double
  %86 = fdiv double %85, 2.550000e+02
  %87 = fdiv double %83, %86
  %88 = fptosi double %87 to i32
  store i32 %88, ptr %12, align 4, !tbaa !9
  %89 = load i32, ptr %12, align 4, !tbaa !9
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %91, label %101

91:                                               ; preds = %78
  %92 = load i32, ptr %17, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !9
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %101

97:                                               ; preds = %91
  %98 = load i32, ptr %17, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %99
  store i32 1, ptr %100, align 4, !tbaa !9
  br label %106

101:                                              ; preds = %91, %78
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = load i32, ptr %17, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %104
  store i32 %102, ptr %105, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %101, %97
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %17, align 4, !tbaa !9
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %17, align 4, !tbaa !9
  br label %75, !llvm.loop !16

110:                                              ; preds = %75
  %111 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 0
  %112 = call i32 @build_tree(ptr noundef %111, ptr noundef %8)
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %115

114:                                              ; preds = %110
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %231

115:                                              ; preds = %110
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %123, %115
  %117 = load i32, ptr %17, align 4, !tbaa !9
  %118 = icmp sle i32 %117, 255
  br i1 %118, label %119, label %126

119:                                              ; preds = %116
  %120 = load i32, ptr %17, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [256 x %struct.HuffCode_], ptr %9, i64 0, i64 %121
  call void @llvm.memset.p0.i64(ptr align 2 %122, i8 0, i64 6, i1 false)
  br label %123

123:                                              ; preds = %119
  %124 = load i32, ptr %17, align 4, !tbaa !9
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %17, align 4, !tbaa !9
  br label %116, !llvm.loop !17

126:                                              ; preds = %116
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.BiTree_, ptr %127, i32 0, i32 3
  %129 = load ptr, ptr %128, align 8, !tbaa !18
  %130 = getelementptr inbounds [256 x %struct.HuffCode_], ptr %9, i64 0, i64 0
  call void @build_table(ptr noundef %129, i16 noundef zeroext 0, i8 noundef zeroext 0, ptr noundef %130)
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  call void @bitree_destroy(ptr noundef %131)
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %132) #8
  store i32 260, ptr %13, align 4, !tbaa !9
  %133 = load i32, ptr %13, align 4, !tbaa !9
  %134 = sext i32 %133 to i64
  %135 = call noalias ptr @malloc(i64 noundef %134) #9
  store ptr %135, ptr %19, align 8, !tbaa !5
  %136 = icmp eq ptr %135, null
  br i1 %136, label %137, label %138

137:                                              ; preds = %126
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %231

138:                                              ; preds = %126
  %139 = load ptr, ptr %19, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %139, ptr align 4 %7, i64 4, i1 false)
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %154, %138
  %141 = load i32, ptr %17, align 4, !tbaa !9
  %142 = icmp sle i32 %141, 255
  br i1 %142, label %143, label %157

143:                                              ; preds = %140
  %144 = load i32, ptr %17, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [256 x i32], ptr %10, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !9
  %148 = trunc i32 %147 to i8
  %149 = load ptr, ptr %19, align 8, !tbaa !5
  %150 = load i32, ptr %17, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = add i64 4, %151
  %153 = getelementptr inbounds i8, ptr %149, i64 %152
  store i8 %148, ptr %153, align 1, !tbaa !13
  br label %154

154:                                              ; preds = %143
  %155 = load i32, ptr %17, align 4, !tbaa !9
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %17, align 4, !tbaa !9
  br label %140, !llvm.loop !20

157:                                              ; preds = %140
  store i32 0, ptr %14, align 4, !tbaa !9
  %158 = load i32, ptr %13, align 4, !tbaa !9
  %159 = mul nsw i32 %158, 8
  store i32 %159, ptr %15, align 4, !tbaa !9
  br label %160

160:                                              ; preds = %221, %157
  %161 = load i32, ptr %14, align 4, !tbaa !9
  %162 = load i32, ptr %7, align 4, !tbaa !9
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %164, label %224

164:                                              ; preds = %160
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  %166 = load i32, ptr %14, align 4, !tbaa !9
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds i8, ptr %165, i64 %167
  %169 = load i8, ptr %168, align 1, !tbaa !13
  %170 = zext i8 %169 to i32
  store i32 %170, ptr %17, align 4, !tbaa !9
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %171

171:                                              ; preds = %218, %164
  %172 = load i32, ptr %18, align 4, !tbaa !9
  %173 = load i32, ptr %17, align 4, !tbaa !9
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [256 x %struct.HuffCode_], ptr %9, i64 0, i64 %174
  %176 = getelementptr inbounds %struct.HuffCode_, ptr %175, i32 0, i32 2
  %177 = load i8, ptr %176, align 2, !tbaa !21
  %178 = zext i8 %177 to i32
  %179 = icmp slt i32 %172, %178
  br i1 %179, label %180, label %221

180:                                              ; preds = %171
  %181 = load i32, ptr %15, align 4, !tbaa !9
  %182 = srem i32 %181, 8
  %183 = icmp eq i32 %182, 0
  br i1 %183, label %184, label %196

184:                                              ; preds = %180
  %185 = load ptr, ptr %19, align 8, !tbaa !5
  %186 = load i32, ptr %15, align 4, !tbaa !9
  %187 = sdiv i32 %186, 8
  %188 = add nsw i32 %187, 1
  %189 = sext i32 %188 to i64
  %190 = call ptr @realloc(ptr noundef %185, i64 noundef %189) #10
  store ptr %190, ptr %20, align 8, !tbaa !5
  %191 = icmp eq ptr %190, null
  br i1 %191, label %192, label %194

192:                                              ; preds = %184
  %193 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %193) #8
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %231

194:                                              ; preds = %184
  %195 = load ptr, ptr %20, align 8, !tbaa !5
  store ptr %195, ptr %19, align 8, !tbaa !5
  br label %196

196:                                              ; preds = %194, %180
  %197 = load i32, ptr %17, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [256 x %struct.HuffCode_], ptr %9, i64 0, i64 %198
  %200 = getelementptr inbounds %struct.HuffCode_, ptr %199, i32 0, i32 2
  %201 = load i8, ptr %200, align 2, !tbaa !21
  %202 = zext i8 %201 to i64
  %203 = sub i64 16, %202
  %204 = load i32, ptr %18, align 4, !tbaa !9
  %205 = sext i32 %204 to i64
  %206 = add i64 %203, %205
  %207 = trunc i64 %206 to i32
  store i32 %207, ptr %16, align 4, !tbaa !9
  %208 = load ptr, ptr %19, align 8, !tbaa !5
  %209 = load i32, ptr %15, align 4, !tbaa !9
  %210 = load i32, ptr %17, align 4, !tbaa !9
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [256 x %struct.HuffCode_], ptr %9, i64 0, i64 %211
  %213 = getelementptr inbounds %struct.HuffCode_, ptr %212, i32 0, i32 1
  %214 = load i32, ptr %16, align 4, !tbaa !9
  %215 = call i32 @bit_get(ptr noundef %213, i32 noundef %214)
  call void @bit_set(ptr noundef %208, i32 noundef %209, i32 noundef %215)
  %216 = load i32, ptr %15, align 4, !tbaa !9
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %15, align 4, !tbaa !9
  br label %218

218:                                              ; preds = %196
  %219 = load i32, ptr %18, align 4, !tbaa !9
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %18, align 4, !tbaa !9
  br label %171, !llvm.loop !24

221:                                              ; preds = %171
  %222 = load i32, ptr %14, align 4, !tbaa !9
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %14, align 4, !tbaa !9
  br label %160, !llvm.loop !25

224:                                              ; preds = %160
  %225 = load ptr, ptr %19, align 8, !tbaa !5
  %226 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %225, ptr %226, align 8, !tbaa !5
  %227 = load i32, ptr %15, align 4, !tbaa !9
  %228 = sub nsw i32 %227, 1
  %229 = sdiv i32 %228, 8
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %231

231:                                              ; preds = %224, %192, %137, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 1024, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 1536, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %232 = load i32, ptr %4, align 4
  ret i32 %232
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare hidden void @build_table(ptr noundef, i16 noundef zeroext, i8 noundef zeroext, ptr noundef) #0

declare void @bitree_destroy(ptr noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

; 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) #6

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #7

declare void @bit_set(ptr noundef, i32 noundef, i32 noundef) #3

declare i32 @bit_get(ptr noundef, i32 noundef) #3

; 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 "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 = { nounwind allocsize(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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind allocsize(1) "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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { nounwind allocsize(1) }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{!19, !6, i64 24}
!19 = !{!"BiTree_", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = distinct !{!20, !12}
!21 = !{!22, !7, i64 4}
!22 = !{!"HuffCode_", !7, i64 0, !23, i64 2, !7, i64 4}
!23 = !{!"short", !7, i64 0}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}


; 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.HuffCode_ = type { i8, i16, i8 }

; Function Attrs: nounwind uwtable
define dso_local range(i32 -268435455, 268435457) i32 @huffman_compress(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  %5 = alloca [256 x %struct.HuffCode_], align 16
  %6 = alloca [256 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 1536, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %6) #8
  store ptr null, ptr %1, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %6, i8 0, i64 1024, i1 false), !tbaa !9
  %7 = icmp sgt i32 %2, 0
  br i1 %7, label %.preheader75.preheader, label %vector.body.preheader

.preheader75.preheader:                           ; preds = %3
  %wide.trip.count = zext nneg i32 %2 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %8 = icmp ult i32 %2, 4
  br i1 %8, label %vector.body.preheader.loopexit.unr-lcssa, label %.preheader75.preheader.new

.preheader75.preheader.new:                       ; preds = %.preheader75.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.preheader75

.preheader75:                                     ; preds = %.preheader75, %.preheader75.preheader.new
  %indvars.iv = phi i64 [ 0, %.preheader75.preheader.new ], [ %indvars.iv.next.3, %.preheader75 ]
  %niter = phi i64 [ 0, %.preheader75.preheader.new ], [ %niter.next.3, %.preheader75 ]
  %9 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %10 = load i8, ptr %9, align 1, !tbaa !11
  %11 = zext i8 %10 to i64
  %12 = getelementptr inbounds [256 x i32], ptr %6, i64 0, i64 %11
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %12, align 4, !tbaa !9
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %15 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.next
  %16 = load i8, ptr %15, align 1, !tbaa !11
  %17 = zext i8 %16 to i64
  %18 = getelementptr inbounds [256 x i32], ptr %6, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %18, align 4, !tbaa !9
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %21 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.next.1
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = zext i8 %22 to i64
  %24 = getelementptr inbounds [256 x i32], ptr %6, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %24, align 4, !tbaa !9
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %27 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.next.2
  %28 = load i8, ptr %27, align 1, !tbaa !11
  %29 = zext i8 %28 to i64
  %30 = getelementptr inbounds [256 x i32], ptr %6, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %30, align 4, !tbaa !9
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %vector.body.preheader.loopexit.unr-lcssa, label %.preheader75, !llvm.loop !12

vector.body.preheader.loopexit.unr-lcssa:         ; preds = %.preheader75, %.preheader75.preheader
  %indvars.iv.unr = phi i64 [ 0, %.preheader75.preheader ], [ %indvars.iv.next.3, %.preheader75 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %vector.body.preheader, label %.preheader75.epil

.preheader75.epil:                                ; preds = %vector.body.preheader.loopexit.unr-lcssa, %.preheader75.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.preheader75.epil ], [ %indvars.iv.unr, %vector.body.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader75.epil ], [ 0, %vector.body.preheader.loopexit.unr-lcssa ]
  %33 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.epil
  %34 = load i8, ptr %33, align 1, !tbaa !11
  %35 = zext i8 %34 to i64
  %36 = getelementptr inbounds [256 x i32], ptr %6, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %36, align 4, !tbaa !9
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %vector.body.preheader, label %.preheader75.epil, !llvm.loop !14

vector.body.preheader:                            ; preds = %vector.body.preheader.loopexit.unr-lcssa, %.preheader75.epil, %3
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.body.preheader
  %index = phi i64 [ 0, %vector.body.preheader ], [ %index.next.1, %vector.body ]
  %vec.phi = phi <4 x i32> [ <i32 255, i32 255, i32 255, i32 255>, %vector.body.preheader ], [ %45, %vector.body ]
  %vec.phi125 = phi <4 x i32> [ <i32 255, i32 255, i32 255, i32 255>, %vector.body.preheader ], [ %46, %vector.body ]
  %39 = getelementptr inbounds [256 x i32], ptr %6, i64 0, i64 %index
  %40 = getelementptr inbounds i8, ptr %39, i64 16
  %wide.load = load <4 x i32>, ptr %39, align 16, !tbaa !9
  %wide.load126 = load <4 x i32>, ptr %40, align 16, !tbaa !9
  %41 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
  %42 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load126, <4 x i32> %vec.phi125)
  %index.next = or disjoint i64 %index, 8
  %43 = getelementptr inbounds [256 x i32], ptr %6, i64 0, i64 %index.next
  %44 = getelementptr inbounds i8, ptr %43, i64 16
  %wide.load.1 = load <4 x i32>, ptr %43, align 16, !tbaa !9
  %wide.load126.1 = load <4 x i32>, ptr %44, align 16, !tbaa !9
  %45 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load.1, <4 x i32> %41)
  %46 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load126.1, <4 x i32> %42)
  %index.next.1 = add nuw nsw i64 %index, 16
  %47 = icmp eq i64 %index.next.1, 256
  br i1 %47, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %45, <4 x i32> %46)
  %48 = tail call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  %49 = uitofp nneg i32 %48 to double
  %50 = fdiv double %49, 2.550000e+02
  %broadcast.splatinsert = insertelement <4 x double> poison, double %50, i64 0
  %broadcast.splat = shufflevector <4 x double> %broadcast.splatinsert, <4 x double> poison, <4 x i32> zeroinitializer
  br label %vector.body131

vector.body131:                                   ; preds = %vector.body131, %middle.block
  %index132 = phi i64 [ 0, %middle.block ], [ %index.next134, %vector.body131 ]
  %51 = getelementptr inbounds [256 x i32], ptr %6, i64 0, i64 %index132
  %wide.load133 = load <4 x i32>, ptr %51, align 16, !tbaa !9
  %52 = sitofp <4 x i32> %wide.load133 to <4 x double>
  %53 = fdiv <4 x double> %52, %broadcast.splat
  %54 = fptosi <4 x double> %53 to <4 x i32>
  %55 = icmp ne <4 x i32> %54, zeroinitializer
  %56 = icmp eq <4 x i32> %wide.load133, zeroinitializer
  %57 = or <4 x i1> %56, %55
  %58 = select <4 x i1> %57, <4 x i32> %54, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %58, ptr %51, align 16, !tbaa !9
  %index.next134 = add nuw i64 %index132, 4
  %59 = icmp eq i64 %index.next134, 256
  br i1 %59, label %middle.block127, label %vector.body131, !llvm.loop !19

middle.block127:                                  ; preds = %vector.body131
  %60 = call i32 @build_tree(ptr noundef nonnull %6, ptr noundef nonnull %4)
  %.not = icmp eq i32 %60, 0
  br i1 %.not, label %.preheader73.preheader, label %289

.preheader73.preheader:                           ; preds = %middle.block127
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1536) %5, i8 0, i64 1536, i1 false)
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i64 24
  %63 = load ptr, ptr %62, align 8, !tbaa !20
  call void @build_table(ptr noundef %63, i16 noundef zeroext 0, i8 noundef zeroext 0, ptr noundef nonnull %5)
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  call void @bitree_destroy(ptr noundef %64) #8
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  call void @free(ptr noundef %65) #8
  %66 = call noalias dereferenceable_or_null(260) ptr @malloc(i64 noundef 260) #9
  %67 = icmp eq ptr %66, null
  br i1 %67, label %289, label %vector.ph137

vector.ph137:                                     ; preds = %.preheader73.preheader
  store i32 %2, ptr %66, align 1
  %invariant.gep = getelementptr inbounds i8, ptr %66, i64 4
  %68 = getelementptr inbounds i8, ptr %6, i64 16
  %wide.load141 = load <4 x i32>, ptr %6, align 16, !tbaa !9
  %wide.load142 = load <4 x i32>, ptr %68, align 16, !tbaa !9
  %69 = trunc <4 x i32> %wide.load141 to <4 x i8>
  %70 = trunc <4 x i32> %wide.load142 to <4 x i8>
  %71 = getelementptr inbounds i8, ptr %66, i64 8
  store <4 x i8> %69, ptr %invariant.gep, align 1, !tbaa !11
  store <4 x i8> %70, ptr %71, align 1, !tbaa !11
  %72 = getelementptr inbounds i8, ptr %6, i64 32
  %73 = getelementptr inbounds i8, ptr %6, i64 48
  %wide.load141.1 = load <4 x i32>, ptr %72, align 16, !tbaa !9
  %wide.load142.1 = load <4 x i32>, ptr %73, align 16, !tbaa !9
  %74 = trunc <4 x i32> %wide.load141.1 to <4 x i8>
  %75 = trunc <4 x i32> %wide.load142.1 to <4 x i8>
  %76 = getelementptr inbounds i8, ptr %66, i64 12
  %77 = getelementptr inbounds i8, ptr %66, i64 16
  store <4 x i8> %74, ptr %76, align 1, !tbaa !11
  store <4 x i8> %75, ptr %77, align 1, !tbaa !11
  %78 = getelementptr inbounds i8, ptr %6, i64 64
  %79 = getelementptr inbounds i8, ptr %6, i64 80
  %wide.load141.2 = load <4 x i32>, ptr %78, align 16, !tbaa !9
  %wide.load142.2 = load <4 x i32>, ptr %79, align 16, !tbaa !9
  %80 = trunc <4 x i32> %wide.load141.2 to <4 x i8>
  %81 = trunc <4 x i32> %wide.load142.2 to <4 x i8>
  %82 = getelementptr inbounds i8, ptr %66, i64 20
  %83 = getelementptr inbounds i8, ptr %66, i64 24
  store <4 x i8> %80, ptr %82, align 1, !tbaa !11
  store <4 x i8> %81, ptr %83, align 1, !tbaa !11
  %84 = getelementptr inbounds i8, ptr %6, i64 96
  %85 = getelementptr inbounds i8, ptr %6, i64 112
  %wide.load141.3 = load <4 x i32>, ptr %84, align 16, !tbaa !9
  %wide.load142.3 = load <4 x i32>, ptr %85, align 16, !tbaa !9
  %86 = trunc <4 x i32> %wide.load141.3 to <4 x i8>
  %87 = trunc <4 x i32> %wide.load142.3 to <4 x i8>
  %88 = getelementptr inbounds i8, ptr %66, i64 28
  %89 = getelementptr inbounds i8, ptr %66, i64 32
  store <4 x i8> %86, ptr %88, align 1, !tbaa !11
  store <4 x i8> %87, ptr %89, align 1, !tbaa !11
  %90 = getelementptr inbounds i8, ptr %6, i64 128
  %91 = getelementptr inbounds i8, ptr %6, i64 144
  %wide.load141.4 = load <4 x i32>, ptr %90, align 16, !tbaa !9
  %wide.load142.4 = load <4 x i32>, ptr %91, align 16, !tbaa !9
  %92 = trunc <4 x i32> %wide.load141.4 to <4 x i8>
  %93 = trunc <4 x i32> %wide.load142.4 to <4 x i8>
  %94 = getelementptr inbounds i8, ptr %66, i64 36
  %95 = getelementptr inbounds i8, ptr %66, i64 40
  store <4 x i8> %92, ptr %94, align 1, !tbaa !11
  store <4 x i8> %93, ptr %95, align 1, !tbaa !11
  %96 = getelementptr inbounds i8, ptr %6, i64 160
  %97 = getelementptr inbounds i8, ptr %6, i64 176
  %wide.load141.5 = load <4 x i32>, ptr %96, align 16, !tbaa !9
  %wide.load142.5 = load <4 x i32>, ptr %97, align 16, !tbaa !9
  %98 = trunc <4 x i32> %wide.load141.5 to <4 x i8>
  %99 = trunc <4 x i32> %wide.load142.5 to <4 x i8>
  %100 = getelementptr inbounds i8, ptr %66, i64 44
  %101 = getelementptr inbounds i8, ptr %66, i64 48
  store <4 x i8> %98, ptr %100, align 1, !tbaa !11
  store <4 x i8> %99, ptr %101, align 1, !tbaa !11
  %102 = getelementptr inbounds i8, ptr %6, i64 192
  %103 = getelementptr inbounds i8, ptr %6, i64 208
  %wide.load141.6 = load <4 x i32>, ptr %102, align 16, !tbaa !9
  %wide.load142.6 = load <4 x i32>, ptr %103, align 16, !tbaa !9
  %104 = trunc <4 x i32> %wide.load141.6 to <4 x i8>
  %105 = trunc <4 x i32> %wide.load142.6 to <4 x i8>
  %106 = getelementptr inbounds i8, ptr %66, i64 52
  %107 = getelementptr inbounds i8, ptr %66, i64 56
  store <4 x i8> %104, ptr %106, align 1, !tbaa !11
  store <4 x i8> %105, ptr %107, align 1, !tbaa !11
  %108 = getelementptr inbounds i8, ptr %6, i64 224
  %109 = getelementptr inbounds i8, ptr %6, i64 240
  %wide.load141.7 = load <4 x i32>, ptr %108, align 16, !tbaa !9
  %wide.load142.7 = load <4 x i32>, ptr %109, align 16, !tbaa !9
  %110 = trunc <4 x i32> %wide.load141.7 to <4 x i8>
  %111 = trunc <4 x i32> %wide.load142.7 to <4 x i8>
  %112 = getelementptr inbounds i8, ptr %66, i64 60
  %113 = getelementptr inbounds i8, ptr %66, i64 64
  store <4 x i8> %110, ptr %112, align 1, !tbaa !11
  store <4 x i8> %111, ptr %113, align 1, !tbaa !11
  %114 = getelementptr inbounds i8, ptr %6, i64 256
  %115 = getelementptr inbounds i8, ptr %6, i64 272
  %wide.load141.8 = load <4 x i32>, ptr %114, align 16, !tbaa !9
  %wide.load142.8 = load <4 x i32>, ptr %115, align 16, !tbaa !9
  %116 = trunc <4 x i32> %wide.load141.8 to <4 x i8>
  %117 = trunc <4 x i32> %wide.load142.8 to <4 x i8>
  %118 = getelementptr inbounds i8, ptr %66, i64 68
  %119 = getelementptr inbounds i8, ptr %66, i64 72
  store <4 x i8> %116, ptr %118, align 1, !tbaa !11
  store <4 x i8> %117, ptr %119, align 1, !tbaa !11
  %120 = getelementptr inbounds i8, ptr %6, i64 288
  %121 = getelementptr inbounds i8, ptr %6, i64 304
  %wide.load141.9 = load <4 x i32>, ptr %120, align 16, !tbaa !9
  %wide.load142.9 = load <4 x i32>, ptr %121, align 16, !tbaa !9
  %122 = trunc <4 x i32> %wide.load141.9 to <4 x i8>
  %123 = trunc <4 x i32> %wide.load142.9 to <4 x i8>
  %124 = getelementptr inbounds i8, ptr %66, i64 76
  %125 = getelementptr inbounds i8, ptr %66, i64 80
  store <4 x i8> %122, ptr %124, align 1, !tbaa !11
  store <4 x i8> %123, ptr %125, align 1, !tbaa !11
  %126 = getelementptr inbounds i8, ptr %6, i64 320
  %127 = getelementptr inbounds i8, ptr %6, i64 336
  %wide.load141.10 = load <4 x i32>, ptr %126, align 16, !tbaa !9
  %wide.load142.10 = load <4 x i32>, ptr %127, align 16, !tbaa !9
  %128 = trunc <4 x i32> %wide.load141.10 to <4 x i8>
  %129 = trunc <4 x i32> %wide.load142.10 to <4 x i8>
  %130 = getelementptr inbounds i8, ptr %66, i64 84
  %131 = getelementptr inbounds i8, ptr %66, i64 88
  store <4 x i8> %128, ptr %130, align 1, !tbaa !11
  store <4 x i8> %129, ptr %131, align 1, !tbaa !11
  %132 = getelementptr inbounds i8, ptr %6, i64 352
  %133 = getelementptr inbounds i8, ptr %6, i64 368
  %wide.load141.11 = load <4 x i32>, ptr %132, align 16, !tbaa !9
  %wide.load142.11 = load <4 x i32>, ptr %133, align 16, !tbaa !9
  %134 = trunc <4 x i32> %wide.load141.11 to <4 x i8>
  %135 = trunc <4 x i32> %wide.load142.11 to <4 x i8>
  %136 = getelementptr inbounds i8, ptr %66, i64 92
  %137 = getelementptr inbounds i8, ptr %66, i64 96
  store <4 x i8> %134, ptr %136, align 1, !tbaa !11
  store <4 x i8> %135, ptr %137, align 1, !tbaa !11
  %138 = getelementptr inbounds i8, ptr %6, i64 384
  %139 = getelementptr inbounds i8, ptr %6, i64 400
  %wide.load141.12 = load <4 x i32>, ptr %138, align 16, !tbaa !9
  %wide.load142.12 = load <4 x i32>, ptr %139, align 16, !tbaa !9
  %140 = trunc <4 x i32> %wide.load141.12 to <4 x i8>
  %141 = trunc <4 x i32> %wide.load142.12 to <4 x i8>
  %142 = getelementptr inbounds i8, ptr %66, i64 100
  %143 = getelementptr inbounds i8, ptr %66, i64 104
  store <4 x i8> %140, ptr %142, align 1, !tbaa !11
  store <4 x i8> %141, ptr %143, align 1, !tbaa !11
  %144 = getelementptr inbounds i8, ptr %6, i64 416
  %145 = getelementptr inbounds i8, ptr %6, i64 432
  %wide.load141.13 = load <4 x i32>, ptr %144, align 16, !tbaa !9
  %wide.load142.13 = load <4 x i32>, ptr %145, align 16, !tbaa !9
  %146 = trunc <4 x i32> %wide.load141.13 to <4 x i8>
  %147 = trunc <4 x i32> %wide.load142.13 to <4 x i8>
  %148 = getelementptr inbounds i8, ptr %66, i64 108
  %149 = getelementptr inbounds i8, ptr %66, i64 112
  store <4 x i8> %146, ptr %148, align 1, !tbaa !11
  store <4 x i8> %147, ptr %149, align 1, !tbaa !11
  %150 = getelementptr inbounds i8, ptr %6, i64 448
  %151 = getelementptr inbounds i8, ptr %6, i64 464
  %wide.load141.14 = load <4 x i32>, ptr %150, align 16, !tbaa !9
  %wide.load142.14 = load <4 x i32>, ptr %151, align 16, !tbaa !9
  %152 = trunc <4 x i32> %wide.load141.14 to <4 x i8>
  %153 = trunc <4 x i32> %wide.load142.14 to <4 x i8>
  %154 = getelementptr inbounds i8, ptr %66, i64 116
  %155 = getelementptr inbounds i8, ptr %66, i64 120
  store <4 x i8> %152, ptr %154, align 1, !tbaa !11
  store <4 x i8> %153, ptr %155, align 1, !tbaa !11
  %156 = getelementptr inbounds i8, ptr %6, i64 480
  %157 = getelementptr inbounds i8, ptr %6, i64 496
  %wide.load141.15 = load <4 x i32>, ptr %156, align 16, !tbaa !9
  %wide.load142.15 = load <4 x i32>, ptr %157, align 16, !tbaa !9
  %158 = trunc <4 x i32> %wide.load141.15 to <4 x i8>
  %159 = trunc <4 x i32> %wide.load142.15 to <4 x i8>
  %160 = getelementptr inbounds i8, ptr %66, i64 124
  %161 = getelementptr inbounds i8, ptr %66, i64 128
  store <4 x i8> %158, ptr %160, align 1, !tbaa !11
  store <4 x i8> %159, ptr %161, align 1, !tbaa !11
  %162 = getelementptr inbounds i8, ptr %6, i64 512
  %163 = getelementptr inbounds i8, ptr %6, i64 528
  %wide.load141.16 = load <4 x i32>, ptr %162, align 16, !tbaa !9
  %wide.load142.16 = load <4 x i32>, ptr %163, align 16, !tbaa !9
  %164 = trunc <4 x i32> %wide.load141.16 to <4 x i8>
  %165 = trunc <4 x i32> %wide.load142.16 to <4 x i8>
  %166 = getelementptr inbounds i8, ptr %66, i64 132
  %167 = getelementptr inbounds i8, ptr %66, i64 136
  store <4 x i8> %164, ptr %166, align 1, !tbaa !11
  store <4 x i8> %165, ptr %167, align 1, !tbaa !11
  %168 = getelementptr inbounds i8, ptr %6, i64 544
  %169 = getelementptr inbounds i8, ptr %6, i64 560
  %wide.load141.17 = load <4 x i32>, ptr %168, align 16, !tbaa !9
  %wide.load142.17 = load <4 x i32>, ptr %169, align 16, !tbaa !9
  %170 = trunc <4 x i32> %wide.load141.17 to <4 x i8>
  %171 = trunc <4 x i32> %wide.load142.17 to <4 x i8>
  %172 = getelementptr inbounds i8, ptr %66, i64 140
  %173 = getelementptr inbounds i8, ptr %66, i64 144
  store <4 x i8> %170, ptr %172, align 1, !tbaa !11
  store <4 x i8> %171, ptr %173, align 1, !tbaa !11
  %174 = getelementptr inbounds i8, ptr %6, i64 576
  %175 = getelementptr inbounds i8, ptr %6, i64 592
  %wide.load141.18 = load <4 x i32>, ptr %174, align 16, !tbaa !9
  %wide.load142.18 = load <4 x i32>, ptr %175, align 16, !tbaa !9
  %176 = trunc <4 x i32> %wide.load141.18 to <4 x i8>
  %177 = trunc <4 x i32> %wide.load142.18 to <4 x i8>
  %178 = getelementptr inbounds i8, ptr %66, i64 148
  %179 = getelementptr inbounds i8, ptr %66, i64 152
  store <4 x i8> %176, ptr %178, align 1, !tbaa !11
  store <4 x i8> %177, ptr %179, align 1, !tbaa !11
  %180 = getelementptr inbounds i8, ptr %6, i64 608
  %181 = getelementptr inbounds i8, ptr %6, i64 624
  %wide.load141.19 = load <4 x i32>, ptr %180, align 16, !tbaa !9
  %wide.load142.19 = load <4 x i32>, ptr %181, align 16, !tbaa !9
  %182 = trunc <4 x i32> %wide.load141.19 to <4 x i8>
  %183 = trunc <4 x i32> %wide.load142.19 to <4 x i8>
  %184 = getelementptr inbounds i8, ptr %66, i64 156
  %185 = getelementptr inbounds i8, ptr %66, i64 160
  store <4 x i8> %182, ptr %184, align 1, !tbaa !11
  store <4 x i8> %183, ptr %185, align 1, !tbaa !11
  %186 = getelementptr inbounds i8, ptr %6, i64 640
  %187 = getelementptr inbounds i8, ptr %6, i64 656
  %wide.load141.20 = load <4 x i32>, ptr %186, align 16, !tbaa !9
  %wide.load142.20 = load <4 x i32>, ptr %187, align 16, !tbaa !9
  %188 = trunc <4 x i32> %wide.load141.20 to <4 x i8>
  %189 = trunc <4 x i32> %wide.load142.20 to <4 x i8>
  %190 = getelementptr inbounds i8, ptr %66, i64 164
  %191 = getelementptr inbounds i8, ptr %66, i64 168
  store <4 x i8> %188, ptr %190, align 1, !tbaa !11
  store <4 x i8> %189, ptr %191, align 1, !tbaa !11
  %192 = getelementptr inbounds i8, ptr %6, i64 672
  %193 = getelementptr inbounds i8, ptr %6, i64 688
  %wide.load141.21 = load <4 x i32>, ptr %192, align 16, !tbaa !9
  %wide.load142.21 = load <4 x i32>, ptr %193, align 16, !tbaa !9
  %194 = trunc <4 x i32> %wide.load141.21 to <4 x i8>
  %195 = trunc <4 x i32> %wide.load142.21 to <4 x i8>
  %196 = getelementptr inbounds i8, ptr %66, i64 172
  %197 = getelementptr inbounds i8, ptr %66, i64 176
  store <4 x i8> %194, ptr %196, align 1, !tbaa !11
  store <4 x i8> %195, ptr %197, align 1, !tbaa !11
  %198 = getelementptr inbounds i8, ptr %6, i64 704
  %199 = getelementptr inbounds i8, ptr %6, i64 720
  %wide.load141.22 = load <4 x i32>, ptr %198, align 16, !tbaa !9
  %wide.load142.22 = load <4 x i32>, ptr %199, align 16, !tbaa !9
  %200 = trunc <4 x i32> %wide.load141.22 to <4 x i8>
  %201 = trunc <4 x i32> %wide.load142.22 to <4 x i8>
  %202 = getelementptr inbounds i8, ptr %66, i64 180
  %203 = getelementptr inbounds i8, ptr %66, i64 184
  store <4 x i8> %200, ptr %202, align 1, !tbaa !11
  store <4 x i8> %201, ptr %203, align 1, !tbaa !11
  %204 = getelementptr inbounds i8, ptr %6, i64 736
  %205 = getelementptr inbounds i8, ptr %6, i64 752
  %wide.load141.23 = load <4 x i32>, ptr %204, align 16, !tbaa !9
  %wide.load142.23 = load <4 x i32>, ptr %205, align 16, !tbaa !9
  %206 = trunc <4 x i32> %wide.load141.23 to <4 x i8>
  %207 = trunc <4 x i32> %wide.load142.23 to <4 x i8>
  %208 = getelementptr inbounds i8, ptr %66, i64 188
  %209 = getelementptr inbounds i8, ptr %66, i64 192
  store <4 x i8> %206, ptr %208, align 1, !tbaa !11
  store <4 x i8> %207, ptr %209, align 1, !tbaa !11
  %210 = getelementptr inbounds i8, ptr %6, i64 768
  %211 = getelementptr inbounds i8, ptr %6, i64 784
  %wide.load141.24 = load <4 x i32>, ptr %210, align 16, !tbaa !9
  %wide.load142.24 = load <4 x i32>, ptr %211, align 16, !tbaa !9
  %212 = trunc <4 x i32> %wide.load141.24 to <4 x i8>
  %213 = trunc <4 x i32> %wide.load142.24 to <4 x i8>
  %214 = getelementptr inbounds i8, ptr %66, i64 196
  %215 = getelementptr inbounds i8, ptr %66, i64 200
  store <4 x i8> %212, ptr %214, align 1, !tbaa !11
  store <4 x i8> %213, ptr %215, align 1, !tbaa !11
  %216 = getelementptr inbounds i8, ptr %6, i64 800
  %217 = getelementptr inbounds i8, ptr %6, i64 816
  %wide.load141.25 = load <4 x i32>, ptr %216, align 16, !tbaa !9
  %wide.load142.25 = load <4 x i32>, ptr %217, align 16, !tbaa !9
  %218 = trunc <4 x i32> %wide.load141.25 to <4 x i8>
  %219 = trunc <4 x i32> %wide.load142.25 to <4 x i8>
  %220 = getelementptr inbounds i8, ptr %66, i64 204
  %221 = getelementptr inbounds i8, ptr %66, i64 208
  store <4 x i8> %218, ptr %220, align 1, !tbaa !11
  store <4 x i8> %219, ptr %221, align 1, !tbaa !11
  %222 = getelementptr inbounds i8, ptr %6, i64 832
  %223 = getelementptr inbounds i8, ptr %6, i64 848
  %wide.load141.26 = load <4 x i32>, ptr %222, align 16, !tbaa !9
  %wide.load142.26 = load <4 x i32>, ptr %223, align 16, !tbaa !9
  %224 = trunc <4 x i32> %wide.load141.26 to <4 x i8>
  %225 = trunc <4 x i32> %wide.load142.26 to <4 x i8>
  %226 = getelementptr inbounds i8, ptr %66, i64 212
  %227 = getelementptr inbounds i8, ptr %66, i64 216
  store <4 x i8> %224, ptr %226, align 1, !tbaa !11
  store <4 x i8> %225, ptr %227, align 1, !tbaa !11
  %228 = getelementptr inbounds i8, ptr %6, i64 864
  %229 = getelementptr inbounds i8, ptr %6, i64 880
  %wide.load141.27 = load <4 x i32>, ptr %228, align 16, !tbaa !9
  %wide.load142.27 = load <4 x i32>, ptr %229, align 16, !tbaa !9
  %230 = trunc <4 x i32> %wide.load141.27 to <4 x i8>
  %231 = trunc <4 x i32> %wide.load142.27 to <4 x i8>
  %232 = getelementptr inbounds i8, ptr %66, i64 220
  %233 = getelementptr inbounds i8, ptr %66, i64 224
  store <4 x i8> %230, ptr %232, align 1, !tbaa !11
  store <4 x i8> %231, ptr %233, align 1, !tbaa !11
  %234 = getelementptr inbounds i8, ptr %6, i64 896
  %235 = getelementptr inbounds i8, ptr %6, i64 912
  %wide.load141.28 = load <4 x i32>, ptr %234, align 16, !tbaa !9
  %wide.load142.28 = load <4 x i32>, ptr %235, align 16, !tbaa !9
  %236 = trunc <4 x i32> %wide.load141.28 to <4 x i8>
  %237 = trunc <4 x i32> %wide.load142.28 to <4 x i8>
  %238 = getelementptr inbounds i8, ptr %66, i64 228
  %239 = getelementptr inbounds i8, ptr %66, i64 232
  store <4 x i8> %236, ptr %238, align 1, !tbaa !11
  store <4 x i8> %237, ptr %239, align 1, !tbaa !11
  %240 = getelementptr inbounds i8, ptr %6, i64 928
  %241 = getelementptr inbounds i8, ptr %6, i64 944
  %wide.load141.29 = load <4 x i32>, ptr %240, align 16, !tbaa !9
  %wide.load142.29 = load <4 x i32>, ptr %241, align 16, !tbaa !9
  %242 = trunc <4 x i32> %wide.load141.29 to <4 x i8>
  %243 = trunc <4 x i32> %wide.load142.29 to <4 x i8>
  %244 = getelementptr inbounds i8, ptr %66, i64 236
  %245 = getelementptr inbounds i8, ptr %66, i64 240
  store <4 x i8> %242, ptr %244, align 1, !tbaa !11
  store <4 x i8> %243, ptr %245, align 1, !tbaa !11
  %246 = getelementptr inbounds i8, ptr %6, i64 960
  %247 = getelementptr inbounds i8, ptr %6, i64 976
  %wide.load141.30 = load <4 x i32>, ptr %246, align 16, !tbaa !9
  %wide.load142.30 = load <4 x i32>, ptr %247, align 16, !tbaa !9
  %248 = trunc <4 x i32> %wide.load141.30 to <4 x i8>
  %249 = trunc <4 x i32> %wide.load142.30 to <4 x i8>
  %250 = getelementptr inbounds i8, ptr %66, i64 244
  %251 = getelementptr inbounds i8, ptr %66, i64 248
  store <4 x i8> %248, ptr %250, align 1, !tbaa !11
  store <4 x i8> %249, ptr %251, align 1, !tbaa !11
  %252 = getelementptr inbounds i8, ptr %6, i64 992
  %253 = getelementptr inbounds i8, ptr %6, i64 1008
  %wide.load141.31 = load <4 x i32>, ptr %252, align 16, !tbaa !9
  %wide.load142.31 = load <4 x i32>, ptr %253, align 16, !tbaa !9
  %254 = trunc <4 x i32> %wide.load141.31 to <4 x i8>
  %255 = trunc <4 x i32> %wide.load142.31 to <4 x i8>
  %256 = getelementptr inbounds i8, ptr %66, i64 252
  %257 = getelementptr inbounds i8, ptr %66, i64 256
  store <4 x i8> %254, ptr %256, align 1, !tbaa !11
  store <4 x i8> %255, ptr %257, align 1, !tbaa !11
  br i1 %7, label %.lr.ph94.preheader, label %._crit_edge95

.lr.ph94.preheader:                               ; preds = %vector.ph137
  %wide.trip.count120 = zext nneg i32 %2 to i64
  br label %.lr.ph94

.lr.ph94:                                         ; preds = %.lr.ph94.preheader, %._crit_edge
  %indvars.iv117 = phi i64 [ 0, %.lr.ph94.preheader ], [ %indvars.iv.next118, %._crit_edge ]
  %.05893 = phi ptr [ %66, %.lr.ph94.preheader ], [ %.1.lcssa, %._crit_edge ]
  %.06592 = phi i32 [ 2080, %.lr.ph94.preheader ], [ %.166.lcssa, %._crit_edge ]
  %258 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv117
  %259 = load i8, ptr %258, align 1, !tbaa !11
  %260 = zext i8 %259 to i64
  %261 = getelementptr inbounds [256 x %struct.HuffCode_], ptr %5, i64 0, i64 %260
  %262 = getelementptr inbounds i8, ptr %261, i64 4
  %263 = load i8, ptr %262, align 2, !tbaa !22
  %.not98 = icmp eq i8 %263, 0
  br i1 %.not98, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph94
  %264 = getelementptr inbounds i8, ptr %261, i64 2
  br label %265

265:                                              ; preds = %.lr.ph, %276
  %266 = phi i8 [ %263, %.lr.ph ], [ %283, %276 ]
  %.189 = phi ptr [ %.05893, %.lr.ph ], [ %.2, %276 ]
  %.05988 = phi i32 [ 0, %.lr.ph ], [ %282, %276 ]
  %.16687 = phi i32 [ %.06592, %.lr.ph ], [ %281, %276 ]
  %267 = and i32 %.16687, 7
  %268 = icmp eq i32 %267, 0
  br i1 %268, label %269, label %276

269:                                              ; preds = %265
  %270 = ashr exact i32 %.16687, 3
  %271 = add nsw i32 %270, 1
  %272 = sext i32 %271 to i64
  %273 = call ptr @realloc(ptr noundef %.189, i64 noundef %272) #10
  %274 = icmp eq ptr %273, null
  br i1 %274, label %275, label %._crit_edge122

._crit_edge122:                                   ; preds = %269
  %.pre = load i8, ptr %262, align 2, !tbaa !22
  br label %276

275:                                              ; preds = %269
  call void @free(ptr noundef %.189) #8
  br label %289

276:                                              ; preds = %._crit_edge122, %265
  %277 = phi i8 [ %266, %265 ], [ %.pre, %._crit_edge122 ]
  %.2 = phi ptr [ %.189, %265 ], [ %273, %._crit_edge122 ]
  %278 = zext i8 %277 to i32
  %reass.sub = add nuw nsw i32 %.05988, 16
  %279 = sub nsw i32 %reass.sub, %278
  %280 = call i32 @bit_get(ptr noundef nonnull %264, i32 noundef %279) #8
  call void @bit_set(ptr noundef %.2, i32 noundef %.16687, i32 noundef %280) #8
  %281 = add nsw i32 %.16687, 1
  %282 = add nuw nsw i32 %.05988, 1
  %283 = load i8, ptr %262, align 2, !tbaa !22
  %284 = zext i8 %283 to i32
  %285 = icmp ult i32 %282, %284
  br i1 %285, label %265, label %._crit_edge, !llvm.loop !25

._crit_edge:                                      ; preds = %276, %.lr.ph94
  %.166.lcssa = phi i32 [ %.06592, %.lr.ph94 ], [ %281, %276 ]
  %.1.lcssa = phi ptr [ %.05893, %.lr.ph94 ], [ %.2, %276 ]
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120
  br i1 %exitcond121.not, label %._crit_edge95.loopexit, label %.lr.ph94, !llvm.loop !26

._crit_edge95.loopexit:                           ; preds = %._crit_edge
  %286 = add nsw i32 %.166.lcssa, -1
  %287 = sdiv i32 %286, 8
  %288 = add nsw i32 %287, 1
  br label %._crit_edge95

._crit_edge95:                                    ; preds = %._crit_edge95.loopexit, %vector.ph137
  %.065.lcssa = phi i32 [ 260, %vector.ph137 ], [ %288, %._crit_edge95.loopexit ]
  %.058.lcssa = phi ptr [ %66, %vector.ph137 ], [ %.1.lcssa, %._crit_edge95.loopexit ]
  store ptr %.058.lcssa, ptr %1, align 8, !tbaa !5
  br label %289

289:                                              ; preds = %.preheader73.preheader, %middle.block127, %._crit_edge95, %275
  %.0 = phi i32 [ -1, %275 ], [ %.065.lcssa, %._crit_edge95 ], [ -1, %middle.block127 ], [ -1, %.preheader73.preheader ]
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 1536, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  ret i32 %.0
}

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare hidden void @build_table(ptr noundef, i16 noundef zeroext, i8 noundef zeroext, ptr noundef) local_unnamed_addr #0

declare void @bitree_destroy(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #6

declare void @bit_set(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare i32 @bit_get(ptr noundef, i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #7

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #6 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nounwind allocsize(0) }
attributes #10 = { nounwind allocsize(1) }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !13, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !13, !17, !18}
!20 = !{!21, !6, i64 24}
!21 = !{!"BiTree_", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!22 = !{!23, !7, i64 4}
!23 = !{!"HuffCode_", !7, i64 0, !24, i64 2, !7, i64 4}
!24 = !{!"short", !7, i64 0}
!25 = distinct !{!25, !13}
!26 = distinct !{!26, !13}


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