; LLVM IR from itchio/go-brotli :: 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.HistogramPair = type { i32, i32, double, double }
%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: alwaysinline nounwind uwtable
declare hidden double @ClusterCostDiff(i64 noundef, i64 noundef) #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @brotli_max_double(double noundef, double noundef) #1

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @HistogramPairIsLess(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define hidden void @BrotliCompareAndPushToQueueCommand(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i64 noundef %4, ptr noundef %5, ptr noundef %6) #3 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %struct.HistogramPair, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca double, align 8
  %20 = alloca %struct.HistogramCommand, align 8
  %21 = alloca double, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store i64 %4, ptr %12, align 8, !tbaa !11
  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 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #5
  %22 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 1
  store i32 0, ptr %22, align 4, !tbaa !13
  %23 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 0
  store i32 0, ptr %23, align 8, !tbaa !16
  %24 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 2
  store double 0.000000e+00, ptr %24, align 8, !tbaa !17
  %25 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 3
  store double 0.000000e+00, ptr %25, align 8, !tbaa !18
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %27 = load i32, ptr %11, align 4, !tbaa !9
  %28 = icmp eq i32 %26, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %7
  store i32 1, ptr %17, align 4
  br label %191

30:                                               ; preds = %7
  %31 = load i32, ptr %11, align 4, !tbaa !9
  %32 = load i32, ptr %10, align 4, !tbaa !9
  %33 = icmp ult i32 %31, %32
  br i1 %33, label %34, label %38

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %35 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %35, ptr %18, align 4, !tbaa !9
  %36 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %36, ptr %11, align 4, !tbaa !9
  %37 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %37, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %38

38:                                               ; preds = %34, %30
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 0
  store i32 %39, ptr %40, align 8, !tbaa !16
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 1
  store i32 %41, ptr %42, align 4, !tbaa !13
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr %43, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr %49, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = call double @ClusterCostDiff(i64 noundef %48, i64 noundef %54)
  %56 = fmul double 5.000000e-01, %55
  %57 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 3
  store double %56, ptr %57, align 8, !tbaa !18
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds %struct.HistogramCommand, ptr %58, i64 %60
  %62 = getelementptr inbounds %struct.HistogramCommand, ptr %61, i32 0, i32 2
  %63 = load double, ptr %62, align 8, !tbaa !19
  %64 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 3
  %65 = load double, ptr %64, align 8, !tbaa !18
  %66 = fsub double %65, %63
  store double %66, ptr %64, align 8, !tbaa !18
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = load i32, ptr %11, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds %struct.HistogramCommand, ptr %67, i64 %69
  %71 = getelementptr inbounds %struct.HistogramCommand, ptr %70, i32 0, i32 2
  %72 = load double, ptr %71, align 8, !tbaa !19
  %73 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 3
  %74 = load double, ptr %73, align 8, !tbaa !18
  %75 = fsub double %74, %72
  store double %75, ptr %73, align 8, !tbaa !18
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = load i32, ptr %10, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds %struct.HistogramCommand, ptr %76, i64 %78
  %80 = getelementptr inbounds %struct.HistogramCommand, ptr %79, i32 0, i32 1
  %81 = load i64, ptr %80, align 8, !tbaa !21
  %82 = icmp eq i64 %81, 0
  br i1 %82, label %83, label %91

83:                                               ; preds = %38
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = load i32, ptr %11, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds %struct.HistogramCommand, ptr %84, i64 %86
  %88 = getelementptr inbounds %struct.HistogramCommand, ptr %87, i32 0, i32 2
  %89 = load double, ptr %88, align 8, !tbaa !19
  %90 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 2
  store double %89, ptr %90, align 8, !tbaa !17
  store i32 1, ptr %15, align 4, !tbaa !9
  br label %140

91:                                               ; preds = %38
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = zext i32 %93 to i64
  %95 = getelementptr inbounds %struct.HistogramCommand, ptr %92, i64 %94
  %96 = getelementptr inbounds %struct.HistogramCommand, ptr %95, i32 0, i32 1
  %97 = load i64, ptr %96, align 8, !tbaa !21
  %98 = icmp eq i64 %97, 0
  br i1 %98, label %99, label %107

99:                                               ; preds = %91
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = load i32, ptr %10, align 4, !tbaa !9
  %102 = zext i32 %101 to i64
  %103 = getelementptr inbounds %struct.HistogramCommand, ptr %100, i64 %102
  %104 = getelementptr inbounds %struct.HistogramCommand, ptr %103, i32 0, i32 2
  %105 = load double, ptr %104, align 8, !tbaa !19
  %106 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 2
  store double %105, ptr %106, align 8, !tbaa !17
  store i32 1, ptr %15, align 4, !tbaa !9
  br label %139

107:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = load i64, ptr %108, align 8, !tbaa !11
  %110 = icmp eq i64 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %107
  br label %118

112:                                              ; preds = %107
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.HistogramPair, ptr %113, i64 0
  %115 = getelementptr inbounds %struct.HistogramPair, ptr %114, i32 0, i32 3
  %116 = load double, ptr %115, align 8, !tbaa !18
  %117 = call double @brotli_max_double(double noundef 0.000000e+00, double noundef %116)
  br label %118

118:                                              ; preds = %112, %111
  %119 = phi double [ 0x547D42AEA2879F2E, %111 ], [ %117, %112 ]
  store double %119, ptr %19, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 2832, ptr %20) #5
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = load i32, ptr %10, align 4, !tbaa !9
  %122 = zext i32 %121 to i64
  %123 = getelementptr inbounds %struct.HistogramCommand, ptr %120, i64 %122
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %123, i64 2832, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  %125 = load i32, ptr %11, align 4, !tbaa !9
  %126 = zext i32 %125 to i64
  %127 = getelementptr inbounds %struct.HistogramCommand, ptr %124, i64 %126
  call void @HistogramAddHistogramCommand(ptr noundef %20, ptr noundef %127)
  %128 = call double @BrotliPopulationCostCommand(ptr noundef %20)
  store double %128, ptr %21, align 8, !tbaa !22
  %129 = load double, ptr %21, align 8, !tbaa !22
  %130 = load double, ptr %19, align 8, !tbaa !22
  %131 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 3
  %132 = load double, ptr %131, align 8, !tbaa !18
  %133 = fsub double %130, %132
  %134 = fcmp olt double %129, %133
  br i1 %134, label %135, label %138

135:                                              ; preds = %118
  %136 = load double, ptr %21, align 8, !tbaa !22
  %137 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 2
  store double %136, ptr %137, align 8, !tbaa !17
  store i32 1, ptr %15, align 4, !tbaa !9
  br label %138

138:                                              ; preds = %135, %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 2832, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %139

139:                                              ; preds = %138, %99
  br label %140

140:                                              ; preds = %139, %83
  %141 = load i32, ptr %15, align 4, !tbaa !9
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %143, label %190

143:                                              ; preds = %140
  %144 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 2
  %145 = load double, ptr %144, align 8, !tbaa !17
  %146 = getelementptr inbounds %struct.HistogramPair, ptr %16, i32 0, i32 3
  %147 = load double, ptr %146, align 8, !tbaa !18
  %148 = fadd double %147, %145
  store double %148, ptr %146, align 8, !tbaa !18
  %149 = load ptr, ptr %14, align 8, !tbaa !5
  %150 = load i64, ptr %149, align 8, !tbaa !11
  %151 = icmp ugt i64 %150, 0
  br i1 %151, label %152, label %175

152:                                              ; preds = %143
  %153 = load ptr, ptr %13, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.HistogramPair, ptr %153, i64 0
  %155 = call i32 @HistogramPairIsLess(ptr noundef %154, ptr noundef %16)
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %157, label %175

157:                                              ; preds = %152
  %158 = load ptr, ptr %14, align 8, !tbaa !5
  %159 = load i64, ptr %158, align 8, !tbaa !11
  %160 = load i64, ptr %12, align 8, !tbaa !11
  %161 = icmp ult i64 %159, %160
  br i1 %161, label %162, label %172

162:                                              ; preds = %157
  %163 = load ptr, ptr %13, align 8, !tbaa !5
  %164 = load ptr, ptr %14, align 8, !tbaa !5
  %165 = load i64, ptr %164, align 8, !tbaa !11
  %166 = getelementptr inbounds %struct.HistogramPair, ptr %163, i64 %165
  %167 = load ptr, ptr %13, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.HistogramPair, ptr %167, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %166, ptr align 8 %168, i64 24, i1 false), !tbaa.struct !25
  %169 = load ptr, ptr %14, align 8, !tbaa !5
  %170 = load i64, ptr %169, align 8, !tbaa !11
  %171 = add i64 %170, 1
  store i64 %171, ptr %169, align 8, !tbaa !11
  br label %172

172:                                              ; preds = %162, %157
  %173 = load ptr, ptr %13, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.HistogramPair, ptr %173, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %174, ptr align 8 %16, i64 24, i1 false), !tbaa.struct !25
  br label %189

175:                                              ; preds = %152, %143
  %176 = load ptr, ptr %14, align 8, !tbaa !5
  %177 = load i64, ptr %176, align 8, !tbaa !11
  %178 = load i64, ptr %12, align 8, !tbaa !11
  %179 = icmp ult i64 %177, %178
  br i1 %179, label %180, label %188

180:                                              ; preds = %175
  %181 = load ptr, ptr %13, align 8, !tbaa !5
  %182 = load ptr, ptr %14, align 8, !tbaa !5
  %183 = load i64, ptr %182, align 8, !tbaa !11
  %184 = getelementptr inbounds %struct.HistogramPair, ptr %181, i64 %183
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %184, ptr align 8 %16, i64 24, i1 false), !tbaa.struct !25
  %185 = load ptr, ptr %14, align 8, !tbaa !5
  %186 = load i64, ptr %185, align 8, !tbaa !11
  %187 = add i64 %186, 1
  store i64 %187, ptr %185, align 8, !tbaa !11
  br label %188

188:                                              ; preds = %180, %175
  br label %189

189:                                              ; preds = %188, %172
  br label %190

190:                                              ; preds = %189, %140
  store i32 0, ptr %17, align 4
  br label %191

191:                                              ; preds = %190, %29
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %192 = load i32, ptr %17, align 4
  switch i32 %192, label %194 [
    i32 0, label %193
    i32 1, label %193
  ]

193:                                              ; preds = %191, %191
  ret void

194:                                              ; preds = %191
  unreachable
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @HistogramAddHistogramCommand(ptr noundef, ptr noundef) #1

declare hidden double @BrotliPopulationCostCommand(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 4}
!14 = !{!"HistogramPair", !10, i64 0, !10, i64 4, !15, i64 8, !15, i64 16}
!15 = !{!"double", !7, i64 0}
!16 = !{!14, !10, i64 0}
!17 = !{!14, !15, i64 8}
!18 = !{!14, !15, i64 16}
!19 = !{!20, !15, i64 2824}
!20 = !{!"HistogramCommand", !7, i64 0, !12, i64 2816, !15, i64 2824}
!21 = !{!20, !12, i64 2816}
!22 = !{!15, !15, i64 0}
!23 = !{i64 0, i64 2816, !24, i64 2816, i64 8, !11, i64 2824, i64 8, !22}
!24 = !{!7, !7, i64 0}
!25 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 8, !22, i64 16, i64 8, !22}


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

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

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @ClusterCostDiff(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @brotli_max_double(double noundef, double noundef) local_unnamed_addr #1

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @HistogramPairIsLess(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define hidden void @BrotliCompareAndPushToQueueCommand(ptr noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2, i32 noundef %3, i64 noundef %4, ptr noundef %5, ptr nocapture noundef %6) local_unnamed_addr #3 {
  %8 = alloca %struct.HistogramPair, align 8
  %9 = alloca %struct.HistogramCommand, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  %10 = getelementptr inbounds i8, ptr %8, i64 8
  %11 = getelementptr inbounds i8, ptr %8, i64 16
  %12 = icmp eq i32 %2, %3
  %13 = getelementptr inbounds i8, ptr %8, i64 8
  store i64 0, ptr %13, align 8
  br i1 %12, label %75, label %14

14:                                               ; preds = %7
  %15 = getelementptr inbounds i8, ptr %8, i64 4
  %spec.select = tail call i32 @llvm.umax.i32(i32 %3, i32 %2)
  %spec.select56 = tail call i32 @llvm.umin.i32(i32 %3, i32 %2)
  store i32 %spec.select56, ptr %8, align 8, !tbaa !5
  store i32 %spec.select, ptr %15, align 4, !tbaa !11
  %16 = zext i32 %spec.select56 to i64
  %17 = getelementptr inbounds i32, ptr %1, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !12
  %19 = zext i32 %18 to i64
  %20 = zext i32 %spec.select to i64
  %21 = getelementptr inbounds i32, ptr %1, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !12
  %23 = zext i32 %22 to i64
  %24 = tail call double @ClusterCostDiff(i64 noundef %19, i64 noundef %23)
  %25 = fmul double %24, 5.000000e-01
  %26 = getelementptr inbounds %struct.HistogramCommand, ptr %0, i64 %16
  %27 = getelementptr inbounds i8, ptr %26, i64 2824
  %28 = load double, ptr %27, align 8, !tbaa !13
  %29 = fsub double %25, %28
  %30 = getelementptr inbounds %struct.HistogramCommand, ptr %0, i64 %20
  %31 = getelementptr inbounds i8, ptr %30, i64 2824
  %32 = load double, ptr %31, align 8, !tbaa !13
  %33 = fsub double %29, %32
  %34 = getelementptr inbounds i8, ptr %26, i64 2816
  %35 = load i64, ptr %34, align 8, !tbaa !16
  %36 = icmp eq i64 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %14
  store double %32, ptr %10, align 8, !tbaa !17
  br label %.critedge

38:                                               ; preds = %14
  %39 = getelementptr inbounds i8, ptr %30, i64 2816
  %40 = load i64, ptr %39, align 8, !tbaa !16
  %41 = icmp eq i64 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  store double %28, ptr %10, align 8, !tbaa !17
  br label %.critedge

43:                                               ; preds = %38
  %44 = load i64, ptr %6, align 8, !tbaa !18
  %45 = icmp eq i64 %44, 0
  br i1 %45, label %50, label %46

46:                                               ; preds = %43
  %47 = getelementptr inbounds i8, ptr %5, i64 16
  %48 = load double, ptr %47, align 8, !tbaa !19
  %49 = tail call double @brotli_max_double(double noundef 0.000000e+00, double noundef %48)
  br label %50

50:                                               ; preds = %43, %46
  %51 = phi double [ %49, %46 ], [ 0x547D42AEA2879F2E, %43 ]
  call void @llvm.lifetime.start.p0(i64 2832, ptr nonnull %9) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(2832) %9, ptr noundef nonnull align 8 dereferenceable(2832) %26, i64 2832, i1 false), !tbaa.struct !20
  call void @HistogramAddHistogramCommand(ptr noundef nonnull %9, ptr noundef nonnull %30)
  %52 = call double @BrotliPopulationCostCommand(ptr noundef nonnull %9) #6
  %53 = fsub double %51, %33
  %54 = fcmp uge double %52, %53
  br i1 %54, label %.critedge58, label %55

55:                                               ; preds = %50
  store double %52, ptr %10, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 2832, ptr nonnull %9) #6
  br label %.critedge

.critedge:                                        ; preds = %55, %37, %42
  %56 = phi double [ %52, %55 ], [ %32, %37 ], [ %28, %42 ]
  %57 = fadd double %56, %33
  store double %57, ptr %11, align 8, !tbaa !19
  %58 = load i64, ptr %6, align 8, !tbaa !18
  %.not = icmp eq i64 %58, 0
  br i1 %.not, label %68, label %59

59:                                               ; preds = %.critedge
  %60 = call i32 @HistogramPairIsLess(ptr noundef %5, ptr noundef nonnull %8)
  %.not55 = icmp eq i32 %60, 0
  %.pre = load i64, ptr %6, align 8, !tbaa !18
  br i1 %.not55, label %68, label %61

61:                                               ; preds = %59
  %62 = icmp ult i64 %.pre, %4
  br i1 %62, label %63, label %67

63:                                               ; preds = %61
  %64 = getelementptr inbounds %struct.HistogramPair, ptr %5, i64 %.pre
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %64, ptr noundef nonnull align 8 dereferenceable(24) %5, i64 24, i1 false), !tbaa.struct !23
  %65 = load i64, ptr %6, align 8, !tbaa !18
  %66 = add i64 %65, 1
  store i64 %66, ptr %6, align 8, !tbaa !18
  br label %67

67:                                               ; preds = %63, %61
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %8, i64 24, i1 false), !tbaa.struct !23
  br label %75

68:                                               ; preds = %59, %.critedge
  %69 = phi i64 [ %.pre, %59 ], [ 0, %.critedge ]
  %70 = icmp ult i64 %69, %4
  br i1 %70, label %71, label %75

71:                                               ; preds = %68
  %72 = getelementptr inbounds %struct.HistogramPair, ptr %5, i64 %69
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %72, ptr noundef nonnull align 8 dereferenceable(24) %8, i64 24, i1 false), !tbaa.struct !23
  %73 = load i64, ptr %6, align 8, !tbaa !18
  %74 = add i64 %73, 1
  store i64 %74, ptr %6, align 8, !tbaa !18
  br label %75

.critedge58:                                      ; preds = %50
  call void @llvm.lifetime.end.p0(i64 2832, ptr nonnull %9) #6
  br label %75

75:                                               ; preds = %.critedge58, %68, %71, %67, %7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  ret void
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @HistogramAddHistogramCommand(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #5

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = !{!"HistogramPair", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !10, i64 2824}
!14 = !{!"HistogramCommand", !8, i64 0, !15, i64 2816, !10, i64 2824}
!15 = !{!"long", !8, i64 0}
!16 = !{!14, !15, i64 2816}
!17 = !{!6, !10, i64 8}
!18 = !{!15, !15, i64 0}
!19 = !{!6, !10, i64 16}
!20 = !{i64 0, i64 2816, !21, i64 2816, i64 8, !18, i64 2824, i64 8, !22}
!21 = !{!8, !8, i64 0}
!22 = !{!10, !10, i64 0}
!23 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 8, !22, i64 16, i64 8, !22}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass