; LLVM IR from DanEngelbrecht/longtail :: lib/brotli/ext/enc (cluster)

; 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.HistogramCommand = type { [704 x i32], i64, double }

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

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

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

declare hidden ptr @BrotliAllocate(ptr noundef, i64 noundef) #2

declare hidden void @BrotliFree(ptr noundef, ptr noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @brotli_min_size_t(i64 noundef, i64 noundef) #3

declare hidden double @BrotliPopulationCostCommand(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i64 @BrotliHistogramCombineCommand(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) #4

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

; Function Attrs: nounwind uwtable
declare hidden i64 @BrotliHistogramReindexCommand(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #4

; Function Attrs: nounwind uwtable
define hidden void @BrotliClusterHistogramsCommand(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #4 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = alloca ptr, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i64 %2, ptr %10, align 8, !tbaa !9
  store i64 %3, ptr %11, align 8, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %29 = load i64, ptr %10, align 8, !tbaa !9
  %30 = icmp ugt i64 %29, 0
  br i1 %30, label %31, label %36

31:                                               ; preds = %7
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = load i64, ptr %10, align 8, !tbaa !9
  %34 = mul i64 %33, 4
  %35 = call ptr @BrotliAllocate(ptr noundef %32, i64 noundef %34)
  br label %37

36:                                               ; preds = %7
  br label %37

37:                                               ; preds = %36, %31
  %38 = phi ptr [ %35, %31 ], [ null, %36 ]
  store ptr %38, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %39 = load i64, ptr %10, align 8, !tbaa !9
  %40 = icmp ugt i64 %39, 0
  br i1 %40, label %41, label %46

41:                                               ; preds = %37
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = load i64, ptr %10, align 8, !tbaa !9
  %44 = mul i64 %43, 4
  %45 = call ptr @BrotliAllocate(ptr noundef %42, i64 noundef %44)
  br label %47

46:                                               ; preds = %37
  br label %47

47:                                               ; preds = %46, %41
  %48 = phi ptr [ %45, %41 ], [ null, %46 ]
  store ptr %48, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store i64 0, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  store i64 64, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  store i64 2048, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %49 = load i64, ptr %19, align 8, !tbaa !9
  %50 = add i64 %49, 1
  %51 = icmp ugt i64 %50, 0
  br i1 %51, label %52, label %58

52:                                               ; preds = %47
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = load i64, ptr %19, align 8, !tbaa !9
  %55 = add i64 %54, 1
  %56 = mul i64 %55, 24
  %57 = call ptr @BrotliAllocate(ptr noundef %53, i64 noundef %56)
  br label %59

58:                                               ; preds = %47
  br label %59

59:                                               ; preds = %58, %52
  %60 = phi ptr [ %57, %52 ], [ null, %58 ]
  store ptr %60, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = call ptr @BrotliAllocate(ptr noundef %61, i64 noundef 2832)
  store ptr %62, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  store i64 0, ptr %22, align 8, !tbaa !9
  br label %63

63:                                               ; preds = %71, %59
  %64 = load i64, ptr %22, align 8, !tbaa !9
  %65 = load i64, ptr %10, align 8, !tbaa !9
  %66 = icmp ult i64 %64, %65
  br i1 %66, label %67, label %74

67:                                               ; preds = %63
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  %69 = load i64, ptr %22, align 8, !tbaa !9
  %70 = getelementptr inbounds i32, ptr %68, i64 %69
  store i32 1, ptr %70, align 4, !tbaa !11
  br label %71

71:                                               ; preds = %67
  %72 = load i64, ptr %22, align 8, !tbaa !9
  %73 = add i64 %72, 1
  store i64 %73, ptr %22, align 8, !tbaa !9
  br label %63, !llvm.loop !13

74:                                               ; preds = %63
  store i64 0, ptr %22, align 8, !tbaa !9
  br label %75

75:                                               ; preds = %99, %74
  %76 = load i64, ptr %22, align 8, !tbaa !9
  %77 = load i64, ptr %10, align 8, !tbaa !9
  %78 = icmp ult i64 %76, %77
  br i1 %78, label %79, label %102

79:                                               ; preds = %75
  %80 = load ptr, ptr %12, align 8, !tbaa !5
  %81 = load i64, ptr %22, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.HistogramCommand, ptr %80, i64 %81
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = load i64, ptr %22, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct.HistogramCommand, ptr %83, i64 %84
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %82, ptr align 8 %85, i64 2832, i1 false), !tbaa.struct !15
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = load i64, ptr %22, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.HistogramCommand, ptr %86, i64 %87
  %89 = call double @BrotliPopulationCostCommand(ptr noundef %88)
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  %91 = load i64, ptr %22, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.HistogramCommand, ptr %90, i64 %91
  %93 = getelementptr inbounds %struct.HistogramCommand, ptr %92, i32 0, i32 2
  store double %89, ptr %93, align 8, !tbaa !19
  %94 = load i64, ptr %22, align 8, !tbaa !9
  %95 = trunc i64 %94 to i32
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = load i64, ptr %22, align 8, !tbaa !9
  %98 = getelementptr inbounds i32, ptr %96, i64 %97
  store i32 %95, ptr %98, align 4, !tbaa !11
  br label %99

99:                                               ; preds = %79
  %100 = load i64, ptr %22, align 8, !tbaa !9
  %101 = add i64 %100, 1
  store i64 %101, ptr %22, align 8, !tbaa !9
  br label %75, !llvm.loop !21

102:                                              ; preds = %75
  store i64 0, ptr %22, align 8, !tbaa !9
  br label %103

103:                                              ; preds = %148, %102
  %104 = load i64, ptr %22, align 8, !tbaa !9
  %105 = load i64, ptr %10, align 8, !tbaa !9
  %106 = icmp ult i64 %104, %105
  br i1 %106, label %107, label %151

107:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %108 = load i64, ptr %10, align 8, !tbaa !9
  %109 = load i64, ptr %22, align 8, !tbaa !9
  %110 = sub i64 %108, %109
  %111 = call i64 @brotli_min_size_t(i64 noundef %110, i64 noundef 64)
  store i64 %111, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  store i64 0, ptr %25, align 8, !tbaa !9
  br label %112

112:                                              ; preds = %126, %107
  %113 = load i64, ptr %25, align 8, !tbaa !9
  %114 = load i64, ptr %23, align 8, !tbaa !9
  %115 = icmp ult i64 %113, %114
  br i1 %115, label %116, label %129

116:                                              ; preds = %112
  %117 = load i64, ptr %22, align 8, !tbaa !9
  %118 = load i64, ptr %25, align 8, !tbaa !9
  %119 = add i64 %117, %118
  %120 = trunc i64 %119 to i32
  %121 = load ptr, ptr %16, align 8, !tbaa !5
  %122 = load i64, ptr %17, align 8, !tbaa !9
  %123 = load i64, ptr %25, align 8, !tbaa !9
  %124 = add i64 %122, %123
  %125 = getelementptr inbounds i32, ptr %121, i64 %124
  store i32 %120, ptr %125, align 4, !tbaa !11
  br label %126

126:                                              ; preds = %116
  %127 = load i64, ptr %25, align 8, !tbaa !9
  %128 = add i64 %127, 1
  store i64 %128, ptr %25, align 8, !tbaa !9
  br label %112, !llvm.loop !22

129:                                              ; preds = %112
  %130 = load ptr, ptr %12, align 8, !tbaa !5
  %131 = load ptr, ptr %21, align 8, !tbaa !5
  %132 = load ptr, ptr %15, align 8, !tbaa !5
  %133 = load ptr, ptr %14, align 8, !tbaa !5
  %134 = load i64, ptr %22, align 8, !tbaa !9
  %135 = getelementptr inbounds i32, ptr %133, i64 %134
  %136 = load ptr, ptr %16, align 8, !tbaa !5
  %137 = load i64, ptr %17, align 8, !tbaa !9
  %138 = getelementptr inbounds i32, ptr %136, i64 %137
  %139 = load ptr, ptr %20, align 8, !tbaa !5
  %140 = load i64, ptr %23, align 8, !tbaa !9
  %141 = load i64, ptr %23, align 8, !tbaa !9
  %142 = load i64, ptr %11, align 8, !tbaa !9
  %143 = load i64, ptr %19, align 8, !tbaa !9
  %144 = call i64 @BrotliHistogramCombineCommand(ptr noundef %130, ptr noundef %131, ptr noundef %132, ptr noundef %135, ptr noundef %138, ptr noundef %139, i64 noundef %140, i64 noundef %141, i64 noundef %142, i64 noundef %143)
  store i64 %144, ptr %24, align 8, !tbaa !9
  %145 = load i64, ptr %24, align 8, !tbaa !9
  %146 = load i64, ptr %17, align 8, !tbaa !9
  %147 = add i64 %146, %145
  store i64 %147, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  br label %148

148:                                              ; preds = %129
  %149 = load i64, ptr %22, align 8, !tbaa !9
  %150 = add i64 %149, 64
  store i64 %150, ptr %22, align 8, !tbaa !9
  br label %103, !llvm.loop !23

151:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %152 = load i64, ptr %17, align 8, !tbaa !9
  %153 = mul i64 64, %152
  %154 = load i64, ptr %17, align 8, !tbaa !9
  %155 = udiv i64 %154, 2
  %156 = load i64, ptr %17, align 8, !tbaa !9
  %157 = mul i64 %155, %156
  %158 = call i64 @brotli_min_size_t(i64 noundef %153, i64 noundef %157)
  store i64 %158, ptr %26, align 8, !tbaa !9
  %159 = load i64, ptr %19, align 8, !tbaa !9
  %160 = load i64, ptr %26, align 8, !tbaa !9
  %161 = add i64 %160, 1
  %162 = icmp ult i64 %159, %161
  br i1 %162, label %163, label %204

163:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  %164 = load i64, ptr %19, align 8, !tbaa !9
  %165 = icmp eq i64 %164, 0
  br i1 %165, label %166, label %169

166:                                              ; preds = %163
  %167 = load i64, ptr %26, align 8, !tbaa !9
  %168 = add i64 %167, 1
  br label %171

169:                                              ; preds = %163
  %170 = load i64, ptr %19, align 8, !tbaa !9
  br label %171

171:                                              ; preds = %169, %166
  %172 = phi i64 [ %168, %166 ], [ %170, %169 ]
  store i64 %172, ptr %27, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  br label %173

173:                                              ; preds = %178, %171
  %174 = load i64, ptr %27, align 8, !tbaa !9
  %175 = load i64, ptr %26, align 8, !tbaa !9
  %176 = add i64 %175, 1
  %177 = icmp ult i64 %174, %176
  br i1 %177, label %178, label %181

178:                                              ; preds = %173
  %179 = load i64, ptr %27, align 8, !tbaa !9
  %180 = mul i64 %179, 2
  store i64 %180, ptr %27, align 8, !tbaa !9
  br label %173, !llvm.loop !24

181:                                              ; preds = %173
  %182 = load i64, ptr %27, align 8, !tbaa !9
  %183 = icmp ugt i64 %182, 0
  br i1 %183, label %184, label %189

184:                                              ; preds = %181
  %185 = load ptr, ptr %8, align 8, !tbaa !5
  %186 = load i64, ptr %27, align 8, !tbaa !9
  %187 = mul i64 %186, 24
  %188 = call ptr @BrotliAllocate(ptr noundef %185, i64 noundef %187)
  br label %190

189:                                              ; preds = %181
  br label %190

190:                                              ; preds = %189, %184
  %191 = phi ptr [ %188, %184 ], [ null, %189 ]
  store ptr %191, ptr %28, align 8, !tbaa !5
  %192 = load i64, ptr %19, align 8, !tbaa !9
  %193 = icmp ne i64 %192, 0
  br i1 %193, label %194, label %199

194:                                              ; preds = %190
  %195 = load ptr, ptr %28, align 8, !tbaa !5
  %196 = load ptr, ptr %20, align 8, !tbaa !5
  %197 = load i64, ptr %19, align 8, !tbaa !9
  %198 = mul i64 %197, 24
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %195, ptr align 8 %196, i64 %198, i1 false)
  br label %199

199:                                              ; preds = %194, %190
  %200 = load ptr, ptr %8, align 8, !tbaa !5
  %201 = load ptr, ptr %20, align 8, !tbaa !5
  call void @BrotliFree(ptr noundef %200, ptr noundef %201)
  store ptr null, ptr %20, align 8, !tbaa !5
  %202 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr %202, ptr %20, align 8, !tbaa !5
  %203 = load i64, ptr %27, align 8, !tbaa !9
  store i64 %203, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  br label %204

204:                                              ; preds = %199, %151
  %205 = load ptr, ptr %12, align 8, !tbaa !5
  %206 = load ptr, ptr %21, align 8, !tbaa !5
  %207 = load ptr, ptr %15, align 8, !tbaa !5
  %208 = load ptr, ptr %14, align 8, !tbaa !5
  %209 = load ptr, ptr %16, align 8, !tbaa !5
  %210 = load ptr, ptr %20, align 8, !tbaa !5
  %211 = load i64, ptr %17, align 8, !tbaa !9
  %212 = load i64, ptr %10, align 8, !tbaa !9
  %213 = load i64, ptr %11, align 8, !tbaa !9
  %214 = load i64, ptr %26, align 8, !tbaa !9
  %215 = call i64 @BrotliHistogramCombineCommand(ptr noundef %205, ptr noundef %206, ptr noundef %207, ptr noundef %208, ptr noundef %209, ptr noundef %210, i64 noundef %211, i64 noundef %212, i64 noundef %213, i64 noundef %214)
  store i64 %215, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  %216 = load ptr, ptr %8, align 8, !tbaa !5
  %217 = load ptr, ptr %20, align 8, !tbaa !5
  call void @BrotliFree(ptr noundef %216, ptr noundef %217)
  store ptr null, ptr %20, align 8, !tbaa !5
  %218 = load ptr, ptr %8, align 8, !tbaa !5
  %219 = load ptr, ptr %15, align 8, !tbaa !5
  call void @BrotliFree(ptr noundef %218, ptr noundef %219)
  store ptr null, ptr %15, align 8, !tbaa !5
  %220 = load ptr, ptr %9, align 8, !tbaa !5
  %221 = load i64, ptr %10, align 8, !tbaa !9
  %222 = load ptr, ptr %16, align 8, !tbaa !5
  %223 = load i64, ptr %17, align 8, !tbaa !9
  %224 = load ptr, ptr %12, align 8, !tbaa !5
  %225 = load ptr, ptr %21, align 8, !tbaa !5
  %226 = load ptr, ptr %14, align 8, !tbaa !5
  call void @BrotliHistogramRemapCommand(ptr noundef %220, i64 noundef %221, ptr noundef %222, i64 noundef %223, ptr noundef %224, ptr noundef %225, ptr noundef %226)
  %227 = load ptr, ptr %8, align 8, !tbaa !5
  %228 = load ptr, ptr %21, align 8, !tbaa !5
  call void @BrotliFree(ptr noundef %227, ptr noundef %228)
  store ptr null, ptr %21, align 8, !tbaa !5
  %229 = load ptr, ptr %8, align 8, !tbaa !5
  %230 = load ptr, ptr %16, align 8, !tbaa !5
  call void @BrotliFree(ptr noundef %229, ptr noundef %230)
  store ptr null, ptr %16, align 8, !tbaa !5
  %231 = load ptr, ptr %8, align 8, !tbaa !5
  %232 = load ptr, ptr %12, align 8, !tbaa !5
  %233 = load ptr, ptr %14, align 8, !tbaa !5
  %234 = load i64, ptr %10, align 8, !tbaa !9
  %235 = call i64 @BrotliHistogramReindexCommand(ptr noundef %231, ptr noundef %232, ptr noundef %233, i64 noundef %234)
  %236 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 %235, ptr %236, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{i64 0, i64 2816, !16, i64 2816, i64 8, !9, i64 2824, i64 8, !17}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !7, i64 0}
!19 = !{!20, !18, i64 2824}
!20 = !{!"HistogramCommand", !7, i64 0, !10, i64 2816, !18, i64 2824}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}


; 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.HistogramCommand = type { [704 x i32], i64, double }

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

declare hidden ptr @BrotliAllocate(ptr noundef, i64 noundef) local_unnamed_addr #1

declare hidden void @BrotliFree(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @brotli_min_size_t(i64 noundef, i64 noundef) local_unnamed_addr #2

declare hidden double @BrotliPopulationCostCommand(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @BrotliHistogramCombineCommand(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden i64 @BrotliHistogramReindexCommand(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define hidden void @BrotliClusterHistogramsCommand(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4, ptr nocapture noundef writeonly %5, ptr noundef %6) local_unnamed_addr #3 {
  %.not = icmp eq i64 %2, 0
  br i1 %.not, label %.thread, label %8

8:                                                ; preds = %7
  %9 = shl i64 %2, 2
  %10 = tail call ptr @BrotliAllocate(ptr noundef %0, i64 noundef %9) #4
  %11 = tail call ptr @BrotliAllocate(ptr noundef %0, i64 noundef %9) #4
  br label %.thread

.thread:                                          ; preds = %7, %8
  %12 = phi ptr [ %10, %8 ], [ null, %7 ]
  %13 = phi ptr [ %11, %8 ], [ null, %7 ]
  %14 = tail call ptr @BrotliAllocate(ptr noundef %0, i64 noundef 49176) #4
  %15 = tail call ptr @BrotliAllocate(ptr noundef %0, i64 noundef 2832) #4
  br i1 %.not, label %._crit_edge126, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.thread
  %min.iters.check = icmp ult i64 %2, 8
  br i1 %min.iters.check, label %.lr.ph.preheader146, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %2, -8
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %16 = getelementptr inbounds i32, ptr %12, i64 %index
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %16, align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %17, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %2
  br i1 %cmp.n, label %.lr.ph120.preheader, label %.lr.ph.preheader146

.lr.ph.preheader146:                              ; preds = %middle.block, %.lr.ph.preheader
  %.0109118.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader146, %.lr.ph
  %.0109118 = phi i64 [ %20, %.lr.ph ], [ %.0109118.ph, %.lr.ph.preheader146 ]
  %19 = getelementptr inbounds i32, ptr %12, i64 %.0109118
  store i32 1, ptr %19, align 4, !tbaa !5
  %20 = add nuw i64 %.0109118, 1
  %exitcond.not = icmp eq i64 %20, %2
  br i1 %exitcond.not, label %.lr.ph120.preheader, label %.lr.ph, !llvm.loop !13

.lr.ph120.preheader:                              ; preds = %.lr.ph, %middle.block
  br label %.lr.ph120

.lr.ph120:                                        ; preds = %.lr.ph120.preheader, %.lr.ph120
  %.1119 = phi i64 [ %27, %.lr.ph120 ], [ 0, %.lr.ph120.preheader ]
  %21 = getelementptr inbounds %struct.HistogramCommand, ptr %4, i64 %.1119
  %22 = getelementptr inbounds %struct.HistogramCommand, ptr %1, i64 %.1119
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(2832) %21, ptr noundef nonnull align 8 dereferenceable(2832) %22, i64 2832, i1 false), !tbaa.struct !14
  %23 = tail call double @BrotliPopulationCostCommand(ptr noundef %22) #4
  %24 = getelementptr inbounds i8, ptr %21, i64 2824
  store double %23, ptr %24, align 8, !tbaa !20
  %25 = trunc i64 %.1119 to i32
  %26 = getelementptr inbounds i32, ptr %6, i64 %.1119
  store i32 %25, ptr %26, align 4, !tbaa !5
  %27 = add nuw i64 %.1119, 1
  %exitcond131.not = icmp eq i64 %27, %2
  br i1 %exitcond131.not, label %.lr.ph125, label %.lr.ph120, !llvm.loop !22

.lr.ph125:                                        ; preds = %.lr.ph120, %._crit_edge
  %.0108124 = phi i64 [ %46, %._crit_edge ], [ 0, %.lr.ph120 ]
  %.2123 = phi i64 [ %47, %._crit_edge ], [ 0, %.lr.ph120 ]
  %28 = sub i64 %2, %.2123
  %29 = tail call i64 @brotli_min_size_t(i64 noundef %28, i64 noundef 64)
  %.not130 = icmp eq i64 %29, 0
  br i1 %.not130, label %._crit_edge, label %.lr.ph122.preheader

.lr.ph122.preheader:                              ; preds = %.lr.ph125
  %min.iters.check135 = icmp ult i64 %29, 8
  br i1 %min.iters.check135, label %.lr.ph122.preheader145, label %vector.ph136

vector.ph136:                                     ; preds = %.lr.ph122.preheader
  %n.vec138 = and i64 %29, -8
  %broadcast.splatinsert = insertelement <4 x i64> poison, i64 %.2123, i64 0
  %broadcast.splat = shufflevector <4 x i64> %broadcast.splatinsert, <4 x i64> poison, <4 x i32> zeroinitializer
  br label %vector.body140

vector.body140:                                   ; preds = %vector.body140, %vector.ph136
  %index141 = phi i64 [ 0, %vector.ph136 ], [ %index.next143, %vector.body140 ]
  %vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph136 ], [ %vec.ind.next, %vector.body140 ]
  %step.add = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4>
  %30 = add <4 x i64> %vec.ind, %broadcast.splat
  %31 = add <4 x i64> %step.add, %broadcast.splat
  %32 = trunc <4 x i64> %30 to <4 x i32>
  %33 = trunc <4 x i64> %31 to <4 x i32>
  %34 = add i64 %index141, %.0108124
  %35 = getelementptr inbounds i32, ptr %13, i64 %34
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  store <4 x i32> %32, ptr %35, align 4, !tbaa !5
  store <4 x i32> %33, ptr %36, align 4, !tbaa !5
  %index.next143 = add nuw i64 %index141, 8
  %vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
  %37 = icmp eq i64 %index.next143, %n.vec138
  br i1 %37, label %middle.block133, label %vector.body140, !llvm.loop !23

middle.block133:                                  ; preds = %vector.body140
  %cmp.n144 = icmp eq i64 %29, %n.vec138
  br i1 %cmp.n144, label %._crit_edge, label %.lr.ph122.preheader145

.lr.ph122.preheader145:                           ; preds = %middle.block133, %.lr.ph122.preheader
  %.0107121.ph = phi i64 [ 0, %.lr.ph122.preheader ], [ %n.vec138, %middle.block133 ]
  br label %.lr.ph122

.lr.ph122:                                        ; preds = %.lr.ph122.preheader145, %.lr.ph122
  %.0107121 = phi i64 [ %42, %.lr.ph122 ], [ %.0107121.ph, %.lr.ph122.preheader145 ]
  %38 = add i64 %.0107121, %.2123
  %39 = trunc i64 %38 to i32
  %40 = add i64 %.0107121, %.0108124
  %41 = getelementptr inbounds i32, ptr %13, i64 %40
  store i32 %39, ptr %41, align 4, !tbaa !5
  %42 = add nuw i64 %.0107121, 1
  %exitcond132.not = icmp eq i64 %42, %29
  br i1 %exitcond132.not, label %._crit_edge, label %.lr.ph122, !llvm.loop !24

._crit_edge:                                      ; preds = %.lr.ph122, %middle.block133, %.lr.ph125
  %43 = getelementptr inbounds i32, ptr %6, i64 %.2123
  %44 = getelementptr inbounds i32, ptr %13, i64 %.0108124
  %45 = tail call i64 @BrotliHistogramCombineCommand(ptr noundef %4, ptr noundef %15, ptr noundef %12, ptr noundef %43, ptr noundef %44, ptr noundef %14, i64 noundef %29, i64 noundef %29, i64 noundef %3, i64 noundef 2048)
  %46 = add i64 %45, %.0108124
  %47 = add i64 %.2123, 64
  %48 = icmp ult i64 %47, %2
  br i1 %48, label %.lr.ph125, label %._crit_edge126, !llvm.loop !25

._crit_edge126:                                   ; preds = %._crit_edge, %.thread
  %.0108.lcssa = phi i64 [ 0, %.thread ], [ %46, %._crit_edge ]
  %49 = shl i64 %.0108.lcssa, 6
  %50 = lshr i64 %.0108.lcssa, 1
  %51 = mul i64 %50, %.0108.lcssa
  %52 = tail call i64 @brotli_min_size_t(i64 noundef %49, i64 noundef %51)
  %53 = add i64 %52, 1
  %54 = icmp ugt i64 %53, 2048
  br i1 %54, label %.preheader, label %60

.preheader:                                       ; preds = %._crit_edge126, %.preheader
  %.0 = phi i64 [ %56, %.preheader ], [ 2048, %._crit_edge126 ]
  %55 = icmp ult i64 %.0, %53
  %56 = shl i64 %.0, 1
  br i1 %55, label %.preheader, label %57, !llvm.loop !26

57:                                               ; preds = %.preheader
  %58 = mul i64 %.0, 24
  %59 = tail call ptr @BrotliAllocate(ptr noundef %0, i64 noundef %58) #4
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(49152) %59, ptr noundef nonnull align 8 dereferenceable(49152) %14, i64 49152, i1 false)
  tail call void @BrotliFree(ptr noundef %0, ptr noundef %14) #4
  br label %60

60:                                               ; preds = %57, %._crit_edge126
  %.0110 = phi ptr [ %59, %57 ], [ %14, %._crit_edge126 ]
  %61 = tail call i64 @BrotliHistogramCombineCommand(ptr noundef %4, ptr noundef %15, ptr noundef %12, ptr noundef %6, ptr noundef %13, ptr noundef %.0110, i64 noundef %.0108.lcssa, i64 noundef %2, i64 noundef %3, i64 noundef %52)
  tail call void @BrotliFree(ptr noundef %0, ptr noundef %.0110) #4
  tail call void @BrotliFree(ptr noundef %0, ptr noundef %12) #4
  tail call void @BrotliHistogramRemapCommand(ptr noundef %1, i64 noundef %2, ptr noundef %13, i64 noundef %61, ptr noundef %4, ptr noundef %15, ptr noundef %6)
  tail call void @BrotliFree(ptr noundef %0, ptr noundef %15) #4
  tail call void @BrotliFree(ptr noundef %0, ptr noundef %13) #4
  %62 = tail call i64 @BrotliHistogramReindexCommand(ptr noundef %0, ptr noundef %4, ptr noundef %6, i64 noundef %2)
  store i64 %62, ptr %5, align 8, !tbaa !16
  ret void
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #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 #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = !{i64 0, i64 2816, !15, i64 2816, i64 8, !16, i64 2824, i64 8, !18}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = !{!21, !19, i64 2824}
!21 = !{!"HistogramCommand", !7, i64 0, !17, i64 2816, !19, i64 2824}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !11, !12}
!24 = distinct !{!24, !10, !12, !11}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


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