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

30:                                               ; preds = %8
  store i32 1, ptr %19, align 4
  br label %195

31:                                               ; preds = %8
  %32 = load i32, ptr %13, align 4, !tbaa !9
  %33 = load i32, ptr %12, align 4, !tbaa !9
  %34 = icmp ult i32 %32, %33
  br i1 %34, label %35, label %39

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %36 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %36, ptr %20, align 4, !tbaa !9
  %37 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %37, ptr %13, align 4, !tbaa !9
  %38 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %38, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %39

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

84:                                               ; preds = %39
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = load i32, ptr %13, align 4, !tbaa !9
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds %struct.HistogramCommand, ptr %85, i64 %87
  %89 = getelementptr inbounds %struct.HistogramCommand, ptr %88, i32 0, i32 2
  %90 = load double, ptr %89, align 8, !tbaa !19
  %91 = getelementptr inbounds %struct.HistogramPair, ptr %18, i32 0, i32 2
  store double %90, ptr %91, align 8, !tbaa !17
  store i32 1, ptr %17, align 4, !tbaa !9
  br label %144

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

100:                                              ; preds = %92
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = getelementptr inbounds %struct.HistogramCommand, ptr %101, i64 %103
  %105 = getelementptr inbounds %struct.HistogramCommand, ptr %104, i32 0, i32 2
  %106 = load double, ptr %105, align 8, !tbaa !19
  %107 = getelementptr inbounds %struct.HistogramPair, ptr %18, i32 0, i32 2
  store double %106, ptr %107, align 8, !tbaa !17
  store i32 1, ptr %17, align 4, !tbaa !9
  br label %143

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

112:                                              ; preds = %108
  br label %119

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

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

139:                                              ; preds = %119
  %140 = load double, ptr %22, align 8, !tbaa !22
  %141 = getelementptr inbounds %struct.HistogramPair, ptr %18, i32 0, i32 2
  store double %140, ptr %141, align 8, !tbaa !17
  store i32 1, ptr %17, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %139, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %143

143:                                              ; preds = %142, %100
  br label %144

144:                                              ; preds = %143, %84
  %145 = load i32, ptr %17, align 4, !tbaa !9
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %194

147:                                              ; preds = %144
  %148 = getelementptr inbounds %struct.HistogramPair, ptr %18, i32 0, i32 2
  %149 = load double, ptr %148, align 8, !tbaa !17
  %150 = getelementptr inbounds %struct.HistogramPair, ptr %18, i32 0, i32 3
  %151 = load double, ptr %150, align 8, !tbaa !18
  %152 = fadd double %151, %149
  store double %152, ptr %150, align 8, !tbaa !18
  %153 = load ptr, ptr %16, align 8, !tbaa !5
  %154 = load i64, ptr %153, align 8, !tbaa !11
  %155 = icmp ugt i64 %154, 0
  br i1 %155, label %156, label %179

156:                                              ; preds = %147
  %157 = load ptr, ptr %15, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.HistogramPair, ptr %157, i64 0
  %159 = call i32 @HistogramPairIsLess(ptr noundef %158, ptr noundef %18)
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %179

161:                                              ; preds = %156
  %162 = load ptr, ptr %16, align 8, !tbaa !5
  %163 = load i64, ptr %162, align 8, !tbaa !11
  %164 = load i64, ptr %14, align 8, !tbaa !11
  %165 = icmp ult i64 %163, %164
  br i1 %165, label %166, label %176

166:                                              ; preds = %161
  %167 = load ptr, ptr %15, align 8, !tbaa !5
  %168 = load ptr, ptr %16, align 8, !tbaa !5
  %169 = load i64, ptr %168, align 8, !tbaa !11
  %170 = getelementptr inbounds %struct.HistogramPair, ptr %167, i64 %169
  %171 = load ptr, ptr %15, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.HistogramPair, ptr %171, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %170, ptr align 8 %172, i64 24, i1 false), !tbaa.struct !25
  %173 = load ptr, ptr %16, align 8, !tbaa !5
  %174 = load i64, ptr %173, align 8, !tbaa !11
  %175 = add i64 %174, 1
  store i64 %175, ptr %173, align 8, !tbaa !11
  br label %176

176:                                              ; preds = %166, %161
  %177 = load ptr, ptr %15, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.HistogramPair, ptr %177, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %178, ptr align 8 %18, i64 24, i1 false), !tbaa.struct !25
  br label %193

179:                                              ; preds = %156, %147
  %180 = load ptr, ptr %16, align 8, !tbaa !5
  %181 = load i64, ptr %180, align 8, !tbaa !11
  %182 = load i64, ptr %14, align 8, !tbaa !11
  %183 = icmp ult i64 %181, %182
  br i1 %183, label %184, label %192

184:                                              ; preds = %179
  %185 = load ptr, ptr %15, align 8, !tbaa !5
  %186 = load ptr, ptr %16, align 8, !tbaa !5
  %187 = load i64, ptr %186, align 8, !tbaa !11
  %188 = getelementptr inbounds %struct.HistogramPair, ptr %185, i64 %187
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %188, ptr align 8 %18, i64 24, i1 false), !tbaa.struct !25
  %189 = load ptr, ptr %16, align 8, !tbaa !5
  %190 = load i64, ptr %189, align 8, !tbaa !11
  %191 = add i64 %190, 1
  store i64 %191, ptr %189, align 8, !tbaa !11
  br label %192

192:                                              ; preds = %184, %179
  br label %193

193:                                              ; preds = %192, %176
  br label %194

194:                                              ; preds = %193, %144
  store i32 0, ptr %19, align 4
  br label %195

195:                                              ; preds = %194, %30
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  %196 = load i32, ptr %19, align 4
  switch i32 %196, label %198 [
    i32 0, label %197
    i32 1, label %197
  ]

197:                                              ; preds = %195, %195
  ret void

198:                                              ; preds = %195
  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 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, i32 noundef %4, i64 noundef %5, ptr noundef %6, ptr nocapture noundef %7) local_unnamed_addr #3 {
  %9 = alloca %struct.HistogramPair, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #6
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = getelementptr inbounds i8, ptr %9, i64 16
  %12 = icmp eq i32 %3, %4
  %13 = getelementptr inbounds i8, ptr %9, i64 8
  store i64 0, ptr %13, align 8
  br i1 %12, label %.critedge61, label %14

14:                                               ; preds = %8
  %15 = getelementptr inbounds i8, ptr %9, i64 4
  %spec.select = tail call i32 @llvm.umax.i32(i32 %4, i32 %3)
  %spec.select59 = tail call i32 @llvm.umin.i32(i32 %4, i32 %3)
  store i32 %spec.select59, ptr %9, align 8, !tbaa !5
  store i32 %spec.select, ptr %15, align 4, !tbaa !11
  %16 = zext i32 %spec.select59 to i64
  %17 = getelementptr inbounds i32, ptr %2, 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 %2, 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 %.critedge, label %37

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

41:                                               ; preds = %37
  %42 = load i64, ptr %7, align 8, !tbaa !17
  %43 = icmp eq i64 %42, 0
  br i1 %43, label %48, label %44

44:                                               ; preds = %41
  %45 = getelementptr inbounds i8, ptr %6, i64 16
  %46 = load double, ptr %45, align 8, !tbaa !18
  %47 = tail call double @brotli_max_double(double noundef 0.000000e+00, double noundef %46)
  br label %48

48:                                               ; preds = %41, %44
  %49 = phi double [ %47, %44 ], [ 0x547D42AEA2879F2E, %41 ]
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(2832) %1, ptr noundef nonnull align 8 dereferenceable(2832) %26, i64 2832, i1 false), !tbaa.struct !19
  tail call void @HistogramAddHistogramCommand(ptr noundef %1, ptr noundef nonnull %30)
  %50 = tail call double @BrotliPopulationCostCommand(ptr noundef %1) #6
  %51 = fsub double %49, %33
  %52 = fcmp uge double %50, %51
  br i1 %52, label %.critedge61, label %.critedge

.critedge:                                        ; preds = %48, %37, %14
  %.sink = phi double [ %32, %14 ], [ %28, %37 ], [ %50, %48 ]
  store double %.sink, ptr %10, align 8, !tbaa !22
  %53 = fadd double %.sink, %33
  store double %53, ptr %11, align 8, !tbaa !18
  %54 = load i64, ptr %7, align 8, !tbaa !17
  %.not = icmp eq i64 %54, 0
  br i1 %.not, label %64, label %55

55:                                               ; preds = %.critedge
  %56 = call i32 @HistogramPairIsLess(ptr noundef %6, ptr noundef nonnull %9)
  %.not58 = icmp eq i32 %56, 0
  %.pre = load i64, ptr %7, align 8, !tbaa !17
  br i1 %.not58, label %64, label %57

57:                                               ; preds = %55
  %58 = icmp ult i64 %.pre, %5
  br i1 %58, label %59, label %63

59:                                               ; preds = %57
  %60 = getelementptr inbounds %struct.HistogramPair, ptr %6, i64 %.pre
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %60, ptr noundef nonnull align 8 dereferenceable(24) %6, i64 24, i1 false), !tbaa.struct !23
  %61 = load i64, ptr %7, align 8, !tbaa !17
  %62 = add i64 %61, 1
  store i64 %62, ptr %7, align 8, !tbaa !17
  br label %63

63:                                               ; preds = %59, %57
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %9, i64 24, i1 false), !tbaa.struct !23
  br label %.critedge61

64:                                               ; preds = %55, %.critedge
  %65 = phi i64 [ %.pre, %55 ], [ 0, %.critedge ]
  %66 = icmp ult i64 %65, %5
  br i1 %66, label %67, label %.critedge61

67:                                               ; preds = %64
  %68 = getelementptr inbounds %struct.HistogramPair, ptr %6, i64 %65
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 8 dereferenceable(24) %9, i64 24, i1 false), !tbaa.struct !23
  %69 = load i64, ptr %7, align 8, !tbaa !17
  %70 = add i64 %69, 1
  store i64 %70, ptr %7, align 8, !tbaa !17
  br label %.critedge61

.critedge61:                                      ; preds = %64, %67, %63, %48, %8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #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 = !{!15, !15, i64 0}
!18 = !{!6, !10, i64 16}
!19 = !{i64 0, i64 2816, !20, i64 2816, i64 8, !17, i64 2824, i64 8, !21}
!20 = !{!8, !8, i64 0}
!21 = !{!10, !10, i64 0}
!22 = !{!6, !10, i64 8}
!23 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 8, !21, i64 16, i64 8, !21}


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