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

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

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

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

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

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

33:                                               ; preds = %63, %10
  %34 = load i64, ptr %24, align 8, !tbaa !9
  %35 = load i64, ptr %17, align 8, !tbaa !9
  %36 = icmp ult i64 %34, %35
  br i1 %36, label %37, label %66

37:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %38 = load i64, ptr %24, align 8, !tbaa !9
  %39 = add i64 %38, 1
  store i64 %39, ptr %25, align 8, !tbaa !9
  br label %40

40:                                               ; preds = %59, %37
  %41 = load i64, ptr %25, align 8, !tbaa !9
  %42 = load i64, ptr %17, align 8, !tbaa !9
  %43 = icmp ult i64 %41, %42
  br i1 %43, label %44, label %62

44:                                               ; preds = %40
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = load ptr, ptr %13, align 8, !tbaa !5
  %48 = load ptr, ptr %15, align 8, !tbaa !5
  %49 = load i64, ptr %24, align 8, !tbaa !9
  %50 = getelementptr inbounds i32, ptr %48, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !13
  %52 = load ptr, ptr %15, align 8, !tbaa !5
  %53 = load i64, ptr %25, align 8, !tbaa !9
  %54 = getelementptr inbounds i32, ptr %52, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !13
  %56 = load i64, ptr %20, align 8, !tbaa !9
  %57 = load ptr, ptr %16, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.HistogramPair, ptr %57, i64 0
  call void @BrotliCompareAndPushToQueueCommand(ptr noundef %45, ptr noundef %46, ptr noundef %47, i32 noundef %51, i32 noundef %55, i64 noundef %56, ptr noundef %58, ptr noundef %23)
  br label %59

59:                                               ; preds = %44
  %60 = load i64, ptr %25, align 8, !tbaa !9
  %61 = add i64 %60, 1
  store i64 %61, ptr %25, align 8, !tbaa !9
  br label %40, !llvm.loop !15

62:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  br label %63

63:                                               ; preds = %62
  %64 = load i64, ptr %24, align 8, !tbaa !9
  %65 = add i64 %64, 1
  store i64 %65, ptr %24, align 8, !tbaa !9
  br label %33, !llvm.loop !17

66:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  br label %67

67:                                               ; preds = %254, %252, %66
  %68 = load i64, ptr %17, align 8, !tbaa !9
  %69 = load i64, ptr %22, align 8, !tbaa !9
  %70 = icmp ugt i64 %68, %69
  br i1 %70, label %71, label %255

71:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.HistogramPair, ptr %72, i64 0
  %74 = getelementptr inbounds %struct.HistogramPair, ptr %73, i32 0, i32 3
  %75 = load double, ptr %74, align 8, !tbaa !18
  %76 = load double, ptr %21, align 8, !tbaa !11
  %77 = fcmp oge double %75, %76
  br i1 %77, label %78, label %80

78:                                               ; preds = %71
  store double 0x547D42AEA2879F2E, ptr %21, align 8, !tbaa !11
  %79 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %79, ptr %22, align 8, !tbaa !9
  store i32 8, ptr %29, align 4
  br label %252, !llvm.loop !20

80:                                               ; preds = %71
  %81 = load ptr, ptr %16, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.HistogramPair, ptr %81, i64 0
  %83 = getelementptr inbounds %struct.HistogramPair, ptr %82, i32 0, i32 0
  %84 = load i32, ptr %83, align 8, !tbaa !21
  store i32 %84, ptr %26, align 4, !tbaa !13
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.HistogramPair, ptr %85, i64 0
  %87 = getelementptr inbounds %struct.HistogramPair, ptr %86, i32 0, i32 1
  %88 = load i32, ptr %87, align 4, !tbaa !22
  store i32 %88, ptr %27, align 4, !tbaa !13
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = load i32, ptr %26, align 4, !tbaa !13
  %91 = zext i32 %90 to i64
  %92 = getelementptr inbounds %struct.HistogramCommand, ptr %89, i64 %91
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = load i32, ptr %27, align 4, !tbaa !13
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds %struct.HistogramCommand, ptr %93, i64 %95
  call void @HistogramAddHistogramCommand(ptr noundef %92, ptr noundef %96)
  %97 = load ptr, ptr %16, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.HistogramPair, ptr %97, i64 0
  %99 = getelementptr inbounds %struct.HistogramPair, ptr %98, i32 0, i32 2
  %100 = load double, ptr %99, align 8, !tbaa !23
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  %102 = load i32, ptr %26, align 4, !tbaa !13
  %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
  store double %100, ptr %105, align 8, !tbaa !24
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  %107 = load i32, ptr %27, align 4, !tbaa !13
  %108 = zext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %106, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !13
  %111 = load ptr, ptr %13, align 8, !tbaa !5
  %112 = load i32, ptr %26, align 4, !tbaa !13
  %113 = zext i32 %112 to i64
  %114 = getelementptr inbounds i32, ptr %111, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !13
  %116 = add i32 %115, %110
  store i32 %116, ptr %114, align 4, !tbaa !13
  store i64 0, ptr %28, align 8, !tbaa !9
  br label %117

117:                                              ; preds = %134, %80
  %118 = load i64, ptr %28, align 8, !tbaa !9
  %119 = load i64, ptr %18, align 8, !tbaa !9
  %120 = icmp ult i64 %118, %119
  br i1 %120, label %121, label %137

121:                                              ; preds = %117
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  %123 = load i64, ptr %28, align 8, !tbaa !9
  %124 = getelementptr inbounds i32, ptr %122, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !13
  %126 = load i32, ptr %27, align 4, !tbaa !13
  %127 = icmp eq i32 %125, %126
  br i1 %127, label %128, label %133

128:                                              ; preds = %121
  %129 = load i32, ptr %26, align 4, !tbaa !13
  %130 = load ptr, ptr %14, align 8, !tbaa !5
  %131 = load i64, ptr %28, align 8, !tbaa !9
  %132 = getelementptr inbounds i32, ptr %130, i64 %131
  store i32 %129, ptr %132, align 4, !tbaa !13
  br label %133

133:                                              ; preds = %128, %121
  br label %134

134:                                              ; preds = %133
  %135 = load i64, ptr %28, align 8, !tbaa !9
  %136 = add i64 %135, 1
  store i64 %136, ptr %28, align 8, !tbaa !9
  br label %117, !llvm.loop !26

137:                                              ; preds = %117
  store i64 0, ptr %28, align 8, !tbaa !9
  br label %138

138:                                              ; preds = %163, %137
  %139 = load i64, ptr %28, align 8, !tbaa !9
  %140 = load i64, ptr %17, align 8, !tbaa !9
  %141 = icmp ult i64 %139, %140
  br i1 %141, label %142, label %166

142:                                              ; preds = %138
  %143 = load ptr, ptr %15, align 8, !tbaa !5
  %144 = load i64, ptr %28, align 8, !tbaa !9
  %145 = getelementptr inbounds i32, ptr %143, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !13
  %147 = load i32, ptr %27, align 4, !tbaa !13
  %148 = icmp eq i32 %146, %147
  br i1 %148, label %149, label %162

149:                                              ; preds = %142
  %150 = load ptr, ptr %15, align 8, !tbaa !5
  %151 = load i64, ptr %28, align 8, !tbaa !9
  %152 = getelementptr inbounds i32, ptr %150, i64 %151
  %153 = load ptr, ptr %15, align 8, !tbaa !5
  %154 = load i64, ptr %28, align 8, !tbaa !9
  %155 = add i64 %154, 1
  %156 = getelementptr inbounds i32, ptr %153, i64 %155
  %157 = load i64, ptr %17, align 8, !tbaa !9
  %158 = load i64, ptr %28, align 8, !tbaa !9
  %159 = sub i64 %157, %158
  %160 = sub i64 %159, 1
  %161 = mul i64 %160, 4
  call void @llvm.memmove.p0.p0.i64(ptr align 4 %152, ptr align 4 %156, i64 %161, i1 false)
  br label %166

162:                                              ; preds = %142
  br label %163

163:                                              ; preds = %162
  %164 = load i64, ptr %28, align 8, !tbaa !9
  %165 = add i64 %164, 1
  store i64 %165, ptr %28, align 8, !tbaa !9
  br label %138, !llvm.loop !27

166:                                              ; preds = %149, %138
  %167 = load i64, ptr %17, align 8, !tbaa !9
  %168 = add i64 %167, -1
  store i64 %168, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #4
  store i64 0, ptr %30, align 8, !tbaa !9
  store i64 0, ptr %28, align 8, !tbaa !9
  br label %169

169:                                              ; preds = %227, %166
  %170 = load i64, ptr %28, align 8, !tbaa !9
  %171 = load i64, ptr %23, align 8, !tbaa !9
  %172 = icmp ult i64 %170, %171
  br i1 %172, label %173, label %230

173:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #4
  %174 = load ptr, ptr %16, align 8, !tbaa !5
  %175 = load i64, ptr %28, align 8, !tbaa !9
  %176 = getelementptr inbounds %struct.HistogramPair, ptr %174, i64 %175
  store ptr %176, ptr %31, align 8, !tbaa !5
  %177 = load ptr, ptr %31, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.HistogramPair, ptr %177, i32 0, i32 0
  %179 = load i32, ptr %178, align 8, !tbaa !21
  %180 = load i32, ptr %26, align 4, !tbaa !13
  %181 = icmp eq i32 %179, %180
  br i1 %181, label %200, label %182

182:                                              ; preds = %173
  %183 = load ptr, ptr %31, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.HistogramPair, ptr %183, i32 0, i32 1
  %185 = load i32, ptr %184, align 4, !tbaa !22
  %186 = load i32, ptr %26, align 4, !tbaa !13
  %187 = icmp eq i32 %185, %186
  br i1 %187, label %200, label %188

188:                                              ; preds = %182
  %189 = load ptr, ptr %31, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.HistogramPair, ptr %189, i32 0, i32 0
  %191 = load i32, ptr %190, align 8, !tbaa !21
  %192 = load i32, ptr %27, align 4, !tbaa !13
  %193 = icmp eq i32 %191, %192
  br i1 %193, label %200, label %194

194:                                              ; preds = %188
  %195 = load ptr, ptr %31, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.HistogramPair, ptr %195, i32 0, i32 1
  %197 = load i32, ptr %196, align 4, !tbaa !22
  %198 = load i32, ptr %27, align 4, !tbaa !13
  %199 = icmp eq i32 %197, %198
  br i1 %199, label %200, label %201

200:                                              ; preds = %194, %188, %182, %173
  store i32 18, ptr %29, align 4
  br label %224

201:                                              ; preds = %194
  %202 = load ptr, ptr %16, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.HistogramPair, ptr %202, i64 0
  %204 = load ptr, ptr %31, align 8, !tbaa !5
  %205 = call i32 @HistogramPairIsLess(ptr noundef %203, ptr noundef %204)
  %206 = icmp ne i32 %205, 0
  br i1 %206, label %207, label %216

207:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 24, ptr %32) #4
  %208 = load ptr, ptr %16, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.HistogramPair, ptr %208, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %32, ptr align 8 %209, i64 24, i1 false), !tbaa.struct !28
  %210 = load ptr, ptr %16, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.HistogramPair, ptr %210, i64 0
  %212 = load ptr, ptr %31, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %211, ptr align 8 %212, i64 24, i1 false), !tbaa.struct !28
  %213 = load ptr, ptr %16, align 8, !tbaa !5
  %214 = load i64, ptr %30, align 8, !tbaa !9
  %215 = getelementptr inbounds %struct.HistogramPair, ptr %213, i64 %214
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %215, ptr align 8 %32, i64 24, i1 false), !tbaa.struct !28
  call void @llvm.lifetime.end.p0(i64 24, ptr %32) #4
  br label %221

216:                                              ; preds = %201
  %217 = load ptr, ptr %16, align 8, !tbaa !5
  %218 = load i64, ptr %30, align 8, !tbaa !9
  %219 = getelementptr inbounds %struct.HistogramPair, ptr %217, i64 %218
  %220 = load ptr, ptr %31, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %219, ptr align 8 %220, i64 24, i1 false), !tbaa.struct !28
  br label %221

221:                                              ; preds = %216, %207
  %222 = load i64, ptr %30, align 8, !tbaa !9
  %223 = add i64 %222, 1
  store i64 %223, ptr %30, align 8, !tbaa !9
  store i32 0, ptr %29, align 4
  br label %224

224:                                              ; preds = %221, %200
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #4
  %225 = load i32, ptr %29, align 4
  switch i32 %225, label %257 [
    i32 0, label %226
    i32 18, label %227
  ]

226:                                              ; preds = %224
  br label %227

227:                                              ; preds = %226, %224
  %228 = load i64, ptr %28, align 8, !tbaa !9
  %229 = add i64 %228, 1
  store i64 %229, ptr %28, align 8, !tbaa !9
  br label %169, !llvm.loop !29

230:                                              ; preds = %169
  %231 = load i64, ptr %30, align 8, !tbaa !9
  store i64 %231, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #4
  store i64 0, ptr %28, align 8, !tbaa !9
  br label %232

232:                                              ; preds = %248, %230
  %233 = load i64, ptr %28, align 8, !tbaa !9
  %234 = load i64, ptr %17, align 8, !tbaa !9
  %235 = icmp ult i64 %233, %234
  br i1 %235, label %236, label %251

236:                                              ; preds = %232
  %237 = load ptr, ptr %11, align 8, !tbaa !5
  %238 = load ptr, ptr %12, align 8, !tbaa !5
  %239 = load ptr, ptr %13, align 8, !tbaa !5
  %240 = load i32, ptr %26, align 4, !tbaa !13
  %241 = load ptr, ptr %15, align 8, !tbaa !5
  %242 = load i64, ptr %28, align 8, !tbaa !9
  %243 = getelementptr inbounds i32, ptr %241, i64 %242
  %244 = load i32, ptr %243, align 4, !tbaa !13
  %245 = load i64, ptr %20, align 8, !tbaa !9
  %246 = load ptr, ptr %16, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.HistogramPair, ptr %246, i64 0
  call void @BrotliCompareAndPushToQueueCommand(ptr noundef %237, ptr noundef %238, ptr noundef %239, i32 noundef %240, i32 noundef %244, i64 noundef %245, ptr noundef %247, ptr noundef %23)
  br label %248

248:                                              ; preds = %236
  %249 = load i64, ptr %28, align 8, !tbaa !9
  %250 = add i64 %249, 1
  store i64 %250, ptr %28, align 8, !tbaa !9
  br label %232, !llvm.loop !30

251:                                              ; preds = %232
  store i32 0, ptr %29, align 4
  br label %252

252:                                              ; preds = %251, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  %253 = load i32, ptr %29, align 4
  switch i32 %253, label %257 [
    i32 0, label %254
    i32 8, label %67
  ]

254:                                              ; preds = %252
  br label %67, !llvm.loop !20

255:                                              ; preds = %67
  %256 = load i64, ptr %17, align 8, !tbaa !9
  store i32 1, ptr %29, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  ret i64 %256

257:                                              ; preds = %252, %224
  unreachable
}

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


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

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

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

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

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

; Function Attrs: nounwind uwtable
define hidden i64 @BrotliHistogramCombineCommand(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef %3, ptr nocapture noundef %4, ptr noundef %5, i64 noundef %6, i64 noundef %7, i64 noundef %8, i64 noundef %9) local_unnamed_addr #3 {
  %11 = alloca i64, align 8
  %12 = alloca %struct.HistogramPair, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #5
  store i64 0, ptr %11, align 8, !tbaa !5
  %.not131 = icmp eq i64 %6, 0
  br i1 %.not131, label %._crit_edge129, label %.lr.ph115

.loopexit111:                                     ; preds = %19, %.lr.ph115
  %exitcond.not = icmp eq i64 %16, %6
  br i1 %exitcond.not, label %.preheader110, label %.lr.ph115, !llvm.loop !9

.preheader110:                                    ; preds = %.loopexit111
  %.not146 = icmp eq i64 %6, 1
  br i1 %.not146, label %._crit_edge129, label %.lr.ph128

.lr.ph128:                                        ; preds = %.preheader110
  %13 = getelementptr inbounds i8, ptr %5, i64 16
  %14 = getelementptr inbounds i8, ptr %5, i64 4
  %15 = getelementptr inbounds i8, ptr %5, i64 8
  %.not132 = icmp eq i64 %7, 0
  %min.iters.check = icmp ult i64 %7, 8
  %n.vec = and i64 %7, -8
  %cmp.n = icmp eq i64 %n.vec, %7
  br label %25

.lr.ph115:                                        ; preds = %10, %.loopexit111
  %.0100114 = phi i64 [ %16, %.loopexit111 ], [ 0, %10 ]
  %16 = add nuw i64 %.0100114, 1
  %17 = icmp ult i64 %16, %6
  br i1 %17, label %.lr.ph, label %.loopexit111

.lr.ph:                                           ; preds = %.lr.ph115
  %18 = getelementptr inbounds i32, ptr %4, i64 %.0100114
  br label %19

19:                                               ; preds = %.lr.ph, %19
  %.099113 = phi i64 [ %16, %.lr.ph ], [ %23, %19 ]
  %20 = load i32, ptr %18, align 4, !tbaa !11
  %21 = getelementptr inbounds i32, ptr %4, i64 %.099113
  %22 = load i32, ptr %21, align 4, !tbaa !11
  call void @BrotliCompareAndPushToQueueCommand(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %20, i32 noundef %22, i64 noundef %9, ptr noundef %5, ptr noundef nonnull %11)
  %23 = add nuw i64 %.099113, 1
  %24 = icmp ult i64 %23, %6
  br i1 %24, label %19, label %.loopexit111, !llvm.loop !13

25:                                               ; preds = %.lr.ph128, %.loopexit
  %.0127 = phi i64 [ %6, %.lr.ph128 ], [ %.1, %.loopexit ]
  %.095126 = phi double [ 0.000000e+00, %.lr.ph128 ], [ %.196, %.loopexit ]
  %.097125 = phi i64 [ 1, %.lr.ph128 ], [ %.198, %.loopexit ]
  %26 = load double, ptr %13, align 8, !tbaa !14
  %27 = fcmp ult double %26, %.095126
  br i1 %27, label %28, label %.loopexit, !llvm.loop !17

28:                                               ; preds = %25
  %29 = load i32, ptr %5, align 8, !tbaa !18
  %30 = load i32, ptr %14, align 4, !tbaa !19
  %31 = zext i32 %29 to i64
  %32 = getelementptr inbounds %struct.HistogramCommand, ptr %0, i64 %31
  %33 = zext i32 %30 to i64
  %34 = getelementptr inbounds %struct.HistogramCommand, ptr %0, i64 %33
  call void @HistogramAddHistogramCommand(ptr noundef %32, ptr noundef %34)
  %35 = load double, ptr %15, align 8, !tbaa !20
  %36 = getelementptr inbounds i8, ptr %32, i64 2824
  store double %35, ptr %36, align 8, !tbaa !21
  %37 = getelementptr inbounds i32, ptr %2, i64 %33
  %38 = load i32, ptr %37, align 4, !tbaa !11
  %39 = getelementptr inbounds i32, ptr %2, i64 %31
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = add i32 %40, %38
  store i32 %41, ptr %39, align 4, !tbaa !11
  br i1 %.not132, label %.preheader, label %.lr.ph117.preheader

.lr.ph117.preheader:                              ; preds = %28
  br i1 %min.iters.check, label %.lr.ph117.preheader163, label %vector.ph

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

vector.ph:                                        ; preds = %.lr.ph117.preheader
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %30, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %pred.store.continue162, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue162 ]
  %42 = or disjoint i64 %index, 4
  %43 = getelementptr inbounds i32, ptr %3, i64 %index
  %44 = getelementptr inbounds i8, ptr %43, i64 16
  %wide.load = load <4 x i32>, ptr %43, align 4, !tbaa !11
  %wide.load148 = load <4 x i32>, ptr %44, align 4, !tbaa !11
  %45 = icmp eq <4 x i32> %wide.load, %broadcast.splat
  %46 = icmp eq <4 x i32> %wide.load148, %broadcast.splat
  %47 = extractelement <4 x i1> %45, i64 0
  br i1 %47, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body
  %48 = getelementptr inbounds i32, ptr %3, i64 %index
  store i32 %29, ptr %48, align 4, !tbaa !11
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body
  %49 = extractelement <4 x i1> %45, i64 1
  br i1 %49, label %pred.store.if149, label %pred.store.continue150

pred.store.if149:                                 ; preds = %pred.store.continue
  %50 = or disjoint i64 %index, 1
  %51 = getelementptr inbounds i32, ptr %3, i64 %50
  store i32 %29, ptr %51, align 4, !tbaa !11
  br label %pred.store.continue150

pred.store.continue150:                           ; preds = %pred.store.if149, %pred.store.continue
  %52 = extractelement <4 x i1> %45, i64 2
  br i1 %52, label %pred.store.if151, label %pred.store.continue152

pred.store.if151:                                 ; preds = %pred.store.continue150
  %53 = or disjoint i64 %index, 2
  %54 = getelementptr inbounds i32, ptr %3, i64 %53
  store i32 %29, ptr %54, align 4, !tbaa !11
  br label %pred.store.continue152

pred.store.continue152:                           ; preds = %pred.store.if151, %pred.store.continue150
  %55 = extractelement <4 x i1> %45, i64 3
  br i1 %55, label %pred.store.if153, label %pred.store.continue154

pred.store.if153:                                 ; preds = %pred.store.continue152
  %56 = or disjoint i64 %index, 3
  %57 = getelementptr inbounds i32, ptr %3, i64 %56
  store i32 %29, ptr %57, align 4, !tbaa !11
  br label %pred.store.continue154

pred.store.continue154:                           ; preds = %pred.store.if153, %pred.store.continue152
  %58 = extractelement <4 x i1> %46, i64 0
  br i1 %58, label %pred.store.if155, label %pred.store.continue156

pred.store.if155:                                 ; preds = %pred.store.continue154
  %59 = getelementptr inbounds i32, ptr %3, i64 %42
  store i32 %29, ptr %59, align 4, !tbaa !11
  br label %pred.store.continue156

pred.store.continue156:                           ; preds = %pred.store.if155, %pred.store.continue154
  %60 = extractelement <4 x i1> %46, i64 1
  br i1 %60, label %pred.store.if157, label %pred.store.continue158

pred.store.if157:                                 ; preds = %pred.store.continue156
  %61 = or disjoint i64 %index, 5
  %62 = getelementptr inbounds i32, ptr %3, i64 %61
  store i32 %29, ptr %62, align 4, !tbaa !11
  br label %pred.store.continue158

pred.store.continue158:                           ; preds = %pred.store.if157, %pred.store.continue156
  %63 = extractelement <4 x i1> %46, i64 2
  br i1 %63, label %pred.store.if159, label %pred.store.continue160

pred.store.if159:                                 ; preds = %pred.store.continue158
  %64 = or disjoint i64 %index, 6
  %65 = getelementptr inbounds i32, ptr %3, i64 %64
  store i32 %29, ptr %65, align 4, !tbaa !11
  br label %pred.store.continue160

pred.store.continue160:                           ; preds = %pred.store.if159, %pred.store.continue158
  %66 = extractelement <4 x i1> %46, i64 3
  br i1 %66, label %pred.store.if161, label %pred.store.continue162

pred.store.if161:                                 ; preds = %pred.store.continue160
  %67 = or disjoint i64 %index, 7
  %68 = getelementptr inbounds i32, ptr %3, i64 %67
  store i32 %29, ptr %68, align 4, !tbaa !11
  br label %pred.store.continue162

pred.store.continue162:                           ; preds = %pred.store.if161, %pred.store.continue160
  %index.next = add nuw i64 %index, 8
  %69 = icmp eq i64 %index.next, %n.vec
  br i1 %69, label %middle.block, label %vector.body, !llvm.loop !23

middle.block:                                     ; preds = %pred.store.continue162
  br i1 %cmp.n, label %.preheader, label %.lr.ph117.preheader163

.preheader:                                       ; preds = %74, %middle.block, %28
  %umax = call i64 @llvm.umax.i64(i64 %.0127, i64 1)
  br label %76

.lr.ph117:                                        ; preds = %.lr.ph117.preheader163, %74
  %.093116 = phi i64 [ %75, %74 ], [ %.093116.ph, %.lr.ph117.preheader163 ]
  %70 = getelementptr inbounds i32, ptr %3, i64 %.093116
  %71 = load i32, ptr %70, align 4, !tbaa !11
  %72 = icmp eq i32 %71, %30
  br i1 %72, label %73, label %74

73:                                               ; preds = %.lr.ph117
  store i32 %29, ptr %70, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %.lr.ph117, %73
  %75 = add nuw i64 %.093116, 1
  %exitcond136.not = icmp eq i64 %75, %7
  br i1 %exitcond136.not, label %.preheader, label %.lr.ph117, !llvm.loop !26

76:                                               ; preds = %.preheader, %86
  %.194118 = phi i64 [ 0, %.preheader ], [ %87, %86 ]
  %77 = getelementptr inbounds i32, ptr %4, i64 %.194118
  %78 = load i32, ptr %77, align 4, !tbaa !11
  %79 = icmp eq i32 %78, %30
  br i1 %79, label %80, label %86

80:                                               ; preds = %76
  %81 = getelementptr inbounds i32, ptr %4, i64 %.194118
  %82 = getelementptr i8, ptr %81, i64 4
  %83 = xor i64 %.194118, -1
  %84 = add i64 %.0127, %83
  %85 = shl i64 %84, 2
  call void @llvm.memmove.p0.p0.i64(ptr nonnull align 4 %81, ptr align 4 %82, i64 %85, i1 false)
  br label %.loopexit109

86:                                               ; preds = %76
  %87 = add nuw i64 %.194118, 1
  %exitcond137.not = icmp eq i64 %87, %umax
  br i1 %exitcond137.not, label %.loopexit109, label %76, !llvm.loop !27

.loopexit109:                                     ; preds = %86, %80
  %88 = add i64 %.0127, -1
  %89 = load i64, ptr %11, align 8, !tbaa !5
  %.not133 = icmp eq i64 %89, 0
  br i1 %.not133, label %._crit_edge, label %.lr.ph121

.lr.ph121:                                        ; preds = %.loopexit109, %108
  %90 = phi i64 [ %109, %108 ], [ %89, %.loopexit109 ]
  %.091120 = phi i64 [ %.192, %108 ], [ 0, %.loopexit109 ]
  %.2119 = phi i64 [ %110, %108 ], [ 0, %.loopexit109 ]
  %91 = getelementptr inbounds %struct.HistogramPair, ptr %5, i64 %.2119
  %92 = load i32, ptr %91, align 8, !tbaa !18
  %93 = icmp eq i32 %92, %29
  br i1 %93, label %108, label %94

94:                                               ; preds = %.lr.ph121
  %95 = getelementptr inbounds i8, ptr %91, i64 4
  %96 = load i32, ptr %95, align 4, !tbaa !19
  %97 = icmp eq i32 %96, %29
  %98 = icmp eq i32 %92, %30
  %or.cond = or i1 %98, %97
  %99 = icmp eq i32 %96, %30
  %or.cond108 = or i1 %99, %or.cond
  br i1 %or.cond108, label %108, label %100

100:                                              ; preds = %94
  %101 = call i32 @HistogramPairIsLess(ptr noundef nonnull %5, ptr noundef nonnull %91)
  %.not = icmp eq i32 %101, 0
  br i1 %.not, label %104, label %102

102:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %5, i64 24, i1 false), !tbaa.struct !28
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %91, i64 24, i1 false), !tbaa.struct !28
  %103 = getelementptr inbounds %struct.HistogramPair, ptr %5, i64 %.091120
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %103, ptr noundef nonnull align 8 dereferenceable(24) %12, i64 24, i1 false), !tbaa.struct !28
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12)
  br label %106

104:                                              ; preds = %100
  %105 = getelementptr inbounds %struct.HistogramPair, ptr %5, i64 %.091120
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %105, ptr noundef nonnull align 8 dereferenceable(24) %91, i64 24, i1 false), !tbaa.struct !28
  br label %106

106:                                              ; preds = %104, %102
  %107 = add i64 %.091120, 1
  %.pre = load i64, ptr %11, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %.lr.ph121, %94, %106
  %109 = phi i64 [ %.pre, %106 ], [ %90, %94 ], [ %90, %.lr.ph121 ]
  %.192 = phi i64 [ %107, %106 ], [ %.091120, %94 ], [ %.091120, %.lr.ph121 ]
  %110 = add nuw i64 %.2119, 1
  %111 = icmp ult i64 %110, %109
  br i1 %111, label %.lr.ph121, label %._crit_edge, !llvm.loop !30

._crit_edge:                                      ; preds = %108, %.loopexit109
  %.091.lcssa = phi i64 [ 0, %.loopexit109 ], [ %.192, %108 ]
  store i64 %.091.lcssa, ptr %11, align 8, !tbaa !5
  %.not134 = icmp eq i64 %88, 0
  br i1 %.not134, label %._crit_edge129, label %.lr.ph124

.lr.ph124:                                        ; preds = %._crit_edge, %.lr.ph124
  %.3122 = phi i64 [ %114, %.lr.ph124 ], [ 0, %._crit_edge ]
  %112 = getelementptr inbounds i32, ptr %4, i64 %.3122
  %113 = load i32, ptr %112, align 4, !tbaa !11
  call void @BrotliCompareAndPushToQueueCommand(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %29, i32 noundef %113, i64 noundef %9, ptr noundef nonnull %5, ptr noundef nonnull %11)
  %114 = add nuw i64 %.3122, 1
  %exitcond138.not = icmp eq i64 %114, %88
  br i1 %exitcond138.not, label %.loopexit, label %.lr.ph124, !llvm.loop !31

.loopexit:                                        ; preds = %.lr.ph124, %25
  %.198 = phi i64 [ %8, %25 ], [ %.097125, %.lr.ph124 ]
  %.196 = phi double [ 0x547D42AEA2879F2E, %25 ], [ %.095126, %.lr.ph124 ]
  %.1 = phi i64 [ %.0127, %25 ], [ %88, %.lr.ph124 ]
  %115 = icmp ugt i64 %.1, %.198
  br i1 %115, label %25, label %._crit_edge129

._crit_edge129:                                   ; preds = %._crit_edge, %.loopexit, %10, %.preheader110
  %.0.lcssa = phi i64 [ %6, %.preheader110 ], [ 0, %10 ], [ 0, %._crit_edge ], [ %.1, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  ret i64 %.0.lcssa
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{!15, !16, i64 16}
!15 = !{!"HistogramPair", !12, i64 0, !12, i64 4, !16, i64 8, !16, i64 16}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = !{!15, !12, i64 0}
!19 = !{!15, !12, i64 4}
!20 = !{!15, !16, i64 8}
!21 = !{!22, !16, i64 2824}
!22 = !{!"HistogramCommand", !7, i64 0, !6, i64 2816, !16, i64 2824}
!23 = distinct !{!23, !10, !24, !25}
!24 = !{!"llvm.loop.isvectorized", i32 1}
!25 = !{!"llvm.loop.unroll.runtime.disable"}
!26 = distinct !{!26, !10, !25, !24}
!27 = distinct !{!27, !10}
!28 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 8, !29, i64 16, i64 8, !29}
!29 = !{!16, !16, i64 0}
!30 = distinct !{!30, !10}
!31 = distinct !{!31, !10}


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