; LLVM IR from catid/Zpng :: zstd (zdict)

; 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.ZDICT_params_t = type { i32, i32, i32 }
%struct.ZDICT_legacy_params_t = type { i32, %struct.ZDICT_params_t }
%struct.dictItem = type { i32, i32, i32 }

@stderr = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [55 x i8], align 1

; 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

declare i32 @fflush(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @ZDICT_addEntropyTablesFromBuffer_advanced(ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef byval(%struct.ZDICT_params_t) align 8) #4

; Function Attrs: nounwind uwtable
define dso_local i64 @ZDICT_trainFromBuffer_unsafe_legacy(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef byval(%struct.ZDICT_legacy_params_t) align 8 %5) #4 {
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca ptr, align 8
  %35 = alloca i32, align 4
  %36 = alloca %struct.ZDICT_params_t, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %37 = load i32, ptr %12, align 4, !tbaa !11
  %38 = icmp ugt i32 10000, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %6
  br label %42

40:                                               ; preds = %6
  %41 = load i32, ptr %12, align 4, !tbaa !11
  br label %42

42:                                               ; preds = %40, %39
  %43 = phi i32 [ 10000, %39 ], [ %41, %40 ]
  %44 = load i64, ptr %9, align 8, !tbaa !9
  %45 = udiv i64 %44, 16
  %46 = trunc i64 %45 to i32
  %47 = icmp ugt i32 %43, %46
  br i1 %47, label %48, label %56

48:                                               ; preds = %42
  %49 = load i32, ptr %12, align 4, !tbaa !11
  %50 = icmp ugt i32 10000, %49
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  br label %54

52:                                               ; preds = %48
  %53 = load i32, ptr %12, align 4, !tbaa !11
  br label %54

54:                                               ; preds = %52, %51
  %55 = phi i32 [ 10000, %51 ], [ %53, %52 ]
  br label %60

56:                                               ; preds = %42
  %57 = load i64, ptr %9, align 8, !tbaa !9
  %58 = udiv i64 %57, 16
  %59 = trunc i64 %58 to i32
  br label %60

60:                                               ; preds = %56, %54
  %61 = phi i32 [ %55, %54 ], [ %59, %56 ]
  store i32 %61, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %62 = load i32, ptr %13, align 4, !tbaa !11
  %63 = zext i32 %62 to i64
  %64 = mul i64 %63, 12
  %65 = call noalias ptr @malloc(i64 noundef %64) #7
  store ptr %65, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %66 = getelementptr inbounds %struct.ZDICT_legacy_params_t, ptr %5, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !13
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %60
  br label %73

70:                                               ; preds = %60
  %71 = getelementptr inbounds %struct.ZDICT_legacy_params_t, ptr %5, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !13
  br label %73

73:                                               ; preds = %70, %69
  %74 = phi i32 [ 9, %69 ], [ %72, %70 ]
  store i32 %74, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %75 = load i32, ptr %15, align 4, !tbaa !11
  %76 = icmp ugt i32 %75, 30
  br i1 %76, label %77, label %78

77:                                               ; preds = %73
  br label %82

78:                                               ; preds = %73
  %79 = load i32, ptr %12, align 4, !tbaa !11
  %80 = load i32, ptr %15, align 4, !tbaa !11
  %81 = lshr i32 %79, %80
  br label %82

82:                                               ; preds = %78, %77
  %83 = phi i32 [ 4, %77 ], [ %81, %78 ]
  store i32 %83, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %84 = load i64, ptr %9, align 8, !tbaa !9
  store i64 %84, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load i32, ptr %12, align 4, !tbaa !11
  %87 = call i64 @ZDICT_totalSampleSize(ptr noundef %85, i32 noundef %86)
  store i64 %87, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  store i64 0, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %88 = getelementptr inbounds %struct.ZDICT_legacy_params_t, ptr %5, i32 0, i32 1
  %89 = getelementptr inbounds %struct.ZDICT_params_t, ptr %88, i32 0, i32 1
  %90 = load i32, ptr %89, align 4, !tbaa !16
  store i32 %90, ptr %20, align 4, !tbaa !11
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = icmp ne ptr %91, null
  br i1 %92, label %94, label %93

93:                                               ; preds = %82
  store i64 -64, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %455

94:                                               ; preds = %82
  %95 = load i64, ptr %9, align 8, !tbaa !9
  %96 = icmp ult i64 %95, 256
  br i1 %96, label %97, label %99

97:                                               ; preds = %94
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %98) #6
  store i64 -70, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %455

99:                                               ; preds = %94
  %100 = load i64, ptr %18, align 8, !tbaa !9
  %101 = icmp ult i64 %100, 512
  br i1 %101, label %102, label %104

102:                                              ; preds = %99
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %103) #6
  store i64 -34, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %455

104:                                              ; preds = %99
  %105 = load ptr, ptr %14, align 8, !tbaa !5
  call void @ZDICT_initDictItem(ptr noundef %105)
  %106 = load ptr, ptr %14, align 8, !tbaa !5
  %107 = load i32, ptr %13, align 4, !tbaa !11
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  %109 = load i64, ptr %18, align 8, !tbaa !9
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  %111 = load i32, ptr %12, align 4, !tbaa !11
  %112 = load i32, ptr %16, align 4, !tbaa !11
  %113 = load i32, ptr %20, align 4, !tbaa !11
  %114 = call i64 @ZDICT_trainBuffer_legacy(ptr noundef %106, i32 noundef %107, ptr noundef %108, i64 noundef %109, ptr noundef %110, i32 noundef %111, i32 noundef %112, i32 noundef %113)
  %115 = getelementptr inbounds %struct.ZDICT_legacy_params_t, ptr %5, i32 0, i32 1
  %116 = getelementptr inbounds %struct.ZDICT_params_t, ptr %115, i32 0, i32 1
  %117 = load i32, ptr %116, align 4, !tbaa !16
  %118 = icmp uge i32 %117, 3
  br i1 %118, label %119, label %237

119:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %120 = load ptr, ptr %14, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.dictItem, ptr %120, i64 0
  %122 = getelementptr inbounds %struct.dictItem, ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 4, !tbaa !17
  %124 = icmp ult i32 25, %123
  br i1 %124, label %125, label %126

125:                                              ; preds = %119
  br label %131

126:                                              ; preds = %119
  %127 = load ptr, ptr %14, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.dictItem, ptr %127, i64 0
  %129 = getelementptr inbounds %struct.dictItem, ptr %128, i32 0, i32 0
  %130 = load i32, ptr %129, align 4, !tbaa !17
  br label %131

131:                                              ; preds = %126, %125
  %132 = phi i32 [ 25, %125 ], [ %130, %126 ]
  store i32 %132, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %133 = load ptr, ptr %14, align 8, !tbaa !5
  %134 = call i32 @ZDICT_dictSize(ptr noundef %133)
  store i32 %134, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  %135 = load i32, ptr %20, align 4, !tbaa !11
  %136 = icmp uge i32 %135, 3
  br i1 %136, label %137, label %148

137:                                              ; preds = %131
  %138 = load ptr, ptr @stderr, align 8, !tbaa !5
  %139 = load ptr, ptr %14, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.dictItem, ptr %139, i64 0
  %141 = getelementptr inbounds %struct.dictItem, ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 4, !tbaa !17
  %143 = sub i32 %142, 1
  %144 = load i32, ptr %23, align 4, !tbaa !11
  %145 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %138, ptr noundef @.str.3, i32 noundef %143, i32 noundef %144) #6
  %146 = load ptr, ptr @stderr, align 8, !tbaa !5
  %147 = call i32 @fflush(ptr noundef %146)
  br label %148

148:                                              ; preds = %137, %131
  %149 = load i32, ptr %20, align 4, !tbaa !11
  %150 = icmp uge i32 %149, 3
  br i1 %150, label %151, label %158

151:                                              ; preds = %148
  %152 = load ptr, ptr @stderr, align 8, !tbaa !5
  %153 = load i32, ptr %22, align 4, !tbaa !11
  %154 = sub i32 %153, 1
  %155 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %152, ptr noundef @.str.4, i32 noundef %154) #6
  %156 = load ptr, ptr @stderr, align 8, !tbaa !5
  %157 = call i32 @fflush(ptr noundef %156)
  br label %158

158:                                              ; preds = %151, %148
  store i32 1, ptr %24, align 4, !tbaa !11
  br label %159

159:                                              ; preds = %230, %158
  %160 = load i32, ptr %24, align 4, !tbaa !11
  %161 = load i32, ptr %22, align 4, !tbaa !11
  %162 = icmp ult i32 %160, %161
  br i1 %162, label %163, label %233

163:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  %164 = load ptr, ptr %14, align 8, !tbaa !5
  %165 = load i32, ptr %24, align 4, !tbaa !11
  %166 = zext i32 %165 to i64
  %167 = getelementptr inbounds %struct.dictItem, ptr %164, i64 %166
  %168 = getelementptr inbounds %struct.dictItem, ptr %167, i32 0, i32 0
  %169 = load i32, ptr %168, align 4, !tbaa !17
  store i32 %169, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  %170 = load ptr, ptr %14, align 8, !tbaa !5
  %171 = load i32, ptr %24, align 4, !tbaa !11
  %172 = zext i32 %171 to i64
  %173 = getelementptr inbounds %struct.dictItem, ptr %170, i64 %172
  %174 = getelementptr inbounds %struct.dictItem, ptr %173, i32 0, i32 1
  %175 = load i32, ptr %174, align 4, !tbaa !18
  store i32 %175, ptr %26, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #6
  %176 = load i32, ptr %26, align 4, !tbaa !11
  %177 = icmp ult i32 40, %176
  br i1 %177, label %178, label %179

178:                                              ; preds = %163
  br label %181

179:                                              ; preds = %163
  %180 = load i32, ptr %26, align 4, !tbaa !11
  br label %181

181:                                              ; preds = %179, %178
  %182 = phi i32 [ 40, %178 ], [ %180, %179 ]
  store i32 %182, ptr %27, align 4, !tbaa !11
  %183 = load i32, ptr %25, align 4, !tbaa !11
  %184 = zext i32 %183 to i64
  %185 = load i64, ptr %18, align 8, !tbaa !9
  %186 = icmp ugt i64 %184, %185
  br i1 %186, label %194, label %187

187:                                              ; preds = %181
  %188 = load i32, ptr %25, align 4, !tbaa !11
  %189 = load i32, ptr %26, align 4, !tbaa !11
  %190 = add i32 %188, %189
  %191 = zext i32 %190 to i64
  %192 = load i64, ptr %18, align 8, !tbaa !9
  %193 = icmp ugt i64 %191, %192
  br i1 %193, label %194, label %195

194:                                              ; preds = %187, %181
  store i64 -1, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %227

195:                                              ; preds = %187
  %196 = load i32, ptr %20, align 4, !tbaa !11
  %197 = icmp uge i32 %196, 3
  br i1 %197, label %198, label %212

198:                                              ; preds = %195
  %199 = load ptr, ptr @stderr, align 8, !tbaa !5
  %200 = load i32, ptr %24, align 4, !tbaa !11
  %201 = load i32, ptr %26, align 4, !tbaa !11
  %202 = load i32, ptr %25, align 4, !tbaa !11
  %203 = load ptr, ptr %14, align 8, !tbaa !5
  %204 = load i32, ptr %24, align 4, !tbaa !11
  %205 = zext i32 %204 to i64
  %206 = getelementptr inbounds %struct.dictItem, ptr %203, i64 %205
  %207 = getelementptr inbounds %struct.dictItem, ptr %206, i32 0, i32 2
  %208 = load i32, ptr %207, align 4, !tbaa !19
  %209 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %199, ptr noundef @.str.5, i32 noundef %200, i32 noundef %201, i32 noundef %202, i32 noundef %208) #6
  %210 = load ptr, ptr @stderr, align 8, !tbaa !5
  %211 = call i32 @fflush(ptr noundef %210)
  br label %212

212:                                              ; preds = %198, %195
  %213 = load ptr, ptr %10, align 8, !tbaa !5
  %214 = load i32, ptr %25, align 4, !tbaa !11
  %215 = zext i32 %214 to i64
  %216 = getelementptr inbounds i8, ptr %213, i64 %215
  %217 = load i32, ptr %27, align 4, !tbaa !11
  %218 = zext i32 %217 to i64
  call void @ZDICT_printHex(ptr noundef %216, i64 noundef %218)
  %219 = load i32, ptr %20, align 4, !tbaa !11
  %220 = icmp uge i32 %219, 3
  br i1 %220, label %221, label %226

221:                                              ; preds = %212
  %222 = load ptr, ptr @stderr, align 8, !tbaa !5
  %223 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %222, ptr noundef @.str.6) #6
  %224 = load ptr, ptr @stderr, align 8, !tbaa !5
  %225 = call i32 @fflush(ptr noundef %224)
  br label %226

226:                                              ; preds = %221, %212
  store i32 0, ptr %21, align 4
  br label %227

227:                                              ; preds = %226, %194
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  %228 = load i32, ptr %21, align 4
  switch i32 %228, label %234 [
    i32 0, label %229
  ]

229:                                              ; preds = %227
  br label %230

230:                                              ; preds = %229
  %231 = load i32, ptr %24, align 4, !tbaa !11
  %232 = add i32 %231, 1
  store i32 %232, ptr %24, align 4, !tbaa !11
  br label %159, !llvm.loop !20

233:                                              ; preds = %159
  store i32 0, ptr %21, align 4
  br label %234

234:                                              ; preds = %233, %227
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  %235 = load i32, ptr %21, align 4
  switch i32 %235, label %455 [
    i32 0, label %236
  ]

236:                                              ; preds = %234
  br label %237

237:                                              ; preds = %236, %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #6
  %238 = load ptr, ptr %14, align 8, !tbaa !5
  %239 = call i32 @ZDICT_dictSize(ptr noundef %238)
  store i32 %239, ptr %28, align 4, !tbaa !11
  %240 = load i32, ptr %28, align 4, !tbaa !11
  %241 = icmp ult i32 %240, 128
  br i1 %241, label %242, label %244

242:                                              ; preds = %237
  %243 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %243) #6
  store i64 -34, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %450

244:                                              ; preds = %237
  %245 = load i32, ptr %28, align 4, !tbaa !11
  %246 = zext i32 %245 to i64
  %247 = load i64, ptr %17, align 8, !tbaa !9
  %248 = udiv i64 %247, 4
  %249 = icmp ult i64 %246, %248
  br i1 %249, label %250, label %301

250:                                              ; preds = %244
  %251 = load i32, ptr %20, align 4, !tbaa !11
  %252 = icmp uge i32 %251, 2
  br i1 %252, label %253, label %261

253:                                              ; preds = %250
  %254 = load ptr, ptr @stderr, align 8, !tbaa !5
  %255 = load i32, ptr %28, align 4, !tbaa !11
  %256 = load i64, ptr %9, align 8, !tbaa !9
  %257 = trunc i64 %256 to i32
  %258 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %254, ptr noundef @.str.7, i32 noundef %255, i32 noundef %257) #6
  %259 = load ptr, ptr @stderr, align 8, !tbaa !5
  %260 = call i32 @fflush(ptr noundef %259)
  br label %261

261:                                              ; preds = %253, %250
  %262 = load i64, ptr %18, align 8, !tbaa !9
  %263 = load i64, ptr %17, align 8, !tbaa !9
  %264 = mul i64 10, %263
  %265 = icmp ult i64 %262, %264
  br i1 %265, label %266, label %278

266:                                              ; preds = %261
  %267 = load i32, ptr %20, align 4, !tbaa !11
  %268 = icmp uge i32 %267, 2
  br i1 %268, label %269, label %277

269:                                              ; preds = %266
  %270 = load ptr, ptr @stderr, align 8, !tbaa !5
  %271 = load i64, ptr %18, align 8, !tbaa !9
  %272 = lshr i64 %271, 20
  %273 = trunc i64 %272 to i32
  %274 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %270, ptr noundef @.str.8, i32 noundef %273) #6
  %275 = load ptr, ptr @stderr, align 8, !tbaa !5
  %276 = call i32 @fflush(ptr noundef %275)
  br label %277

277:                                              ; preds = %269, %266
  br label %278

278:                                              ; preds = %277, %261
  %279 = load i32, ptr %16, align 4, !tbaa !11
  %280 = icmp ugt i32 %279, 4
  br i1 %280, label %281, label %300

281:                                              ; preds = %278
  %282 = load i32, ptr %20, align 4, !tbaa !11
  %283 = icmp uge i32 %282, 2
  br i1 %283, label %284, label %291

284:                                              ; preds = %281
  %285 = load ptr, ptr @stderr, align 8, !tbaa !5
  %286 = load i32, ptr %15, align 4, !tbaa !11
  %287 = add i32 %286, 1
  %288 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %285, ptr noundef @.str.9, i32 noundef %287) #6
  %289 = load ptr, ptr @stderr, align 8, !tbaa !5
  %290 = call i32 @fflush(ptr noundef %289)
  br label %291

291:                                              ; preds = %284, %281
  %292 = load i32, ptr %20, align 4, !tbaa !11
  %293 = icmp uge i32 %292, 2
  br i1 %293, label %294, label %299

294:                                              ; preds = %291
  %295 = load ptr, ptr @stderr, align 8, !tbaa !5
  %296 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %295, ptr noundef @.str.10) #6
  %297 = load ptr, ptr @stderr, align 8, !tbaa !5
  %298 = call i32 @fflush(ptr noundef %297)
  br label %299

299:                                              ; preds = %294, %291
  br label %300

300:                                              ; preds = %299, %278
  br label %301

301:                                              ; preds = %300, %244
  %302 = load i32, ptr %28, align 4, !tbaa !11
  %303 = zext i32 %302 to i64
  %304 = load i64, ptr %17, align 8, !tbaa !9
  %305 = mul i64 %304, 3
  %306 = icmp ugt i64 %303, %305
  br i1 %306, label %307, label %353

307:                                              ; preds = %301
  %308 = load i32, ptr %12, align 4, !tbaa !11
  %309 = icmp ugt i32 %308, 8
  br i1 %309, label %310, label %353

310:                                              ; preds = %307
  %311 = load i32, ptr %15, align 4, !tbaa !11
  %312 = icmp ugt i32 %311, 1
  br i1 %312, label %313, label %353

313:                                              ; preds = %310
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #6
  %314 = load i32, ptr %15, align 4, !tbaa !11
  %315 = sub i32 %314, 1
  store i32 %315, ptr %29, align 4, !tbaa !11
  br label %316

316:                                              ; preds = %321, %313
  %317 = load i32, ptr %12, align 4, !tbaa !11
  %318 = load i32, ptr %29, align 4, !tbaa !11
  %319 = lshr i32 %317, %318
  %320 = icmp ule i32 %319, 4
  br i1 %320, label %321, label %324

321:                                              ; preds = %316
  %322 = load i32, ptr %29, align 4, !tbaa !11
  %323 = add i32 %322, -1
  store i32 %323, ptr %29, align 4, !tbaa !11
  br label %316, !llvm.loop !22

324:                                              ; preds = %316
  %325 = load i32, ptr %20, align 4, !tbaa !11
  %326 = icmp uge i32 %325, 2
  br i1 %326, label %327, label %335

327:                                              ; preds = %324
  %328 = load ptr, ptr @stderr, align 8, !tbaa !5
  %329 = load i32, ptr %28, align 4, !tbaa !11
  %330 = load i64, ptr %9, align 8, !tbaa !9
  %331 = trunc i64 %330 to i32
  %332 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %328, ptr noundef @.str.11, i32 noundef %329, i32 noundef %331) #6
  %333 = load ptr, ptr @stderr, align 8, !tbaa !5
  %334 = call i32 @fflush(ptr noundef %333)
  br label %335

335:                                              ; preds = %327, %324
  %336 = load i32, ptr %20, align 4, !tbaa !11
  %337 = icmp uge i32 %336, 2
  br i1 %337, label %338, label %344

338:                                              ; preds = %335
  %339 = load ptr, ptr @stderr, align 8, !tbaa !5
  %340 = load i32, ptr %29, align 4, !tbaa !11
  %341 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %339, ptr noundef @.str.12, i32 noundef %340) #6
  %342 = load ptr, ptr @stderr, align 8, !tbaa !5
  %343 = call i32 @fflush(ptr noundef %342)
  br label %344

344:                                              ; preds = %338, %335
  %345 = load i32, ptr %20, align 4, !tbaa !11
  %346 = icmp uge i32 %345, 2
  br i1 %346, label %347, label %352

347:                                              ; preds = %344
  %348 = load ptr, ptr @stderr, align 8, !tbaa !5
  %349 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %348, ptr noundef @.str.13) #6
  %350 = load ptr, ptr @stderr, align 8, !tbaa !5
  %351 = call i32 @fflush(ptr noundef %350)
  br label %352

352:                                              ; preds = %347, %344
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #6
  br label %353

353:                                              ; preds = %352, %310, %307, %301
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #6
  %354 = load ptr, ptr %14, align 8, !tbaa !5
  %355 = getelementptr inbounds %struct.dictItem, ptr %354, i32 0, i32 0
  %356 = load i32, ptr %355, align 4, !tbaa !17
  store i32 %356, ptr %30, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #6
  store i32 0, ptr %31, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #6
  store i32 1, ptr %32, align 4, !tbaa !11
  br label %357

357:                                              ; preds = %384, %353
  %358 = load i32, ptr %32, align 4, !tbaa !11
  %359 = load i32, ptr %30, align 4, !tbaa !11
  %360 = icmp ult i32 %358, %359
  br i1 %360, label %361, label %387

361:                                              ; preds = %357
  %362 = load ptr, ptr %14, align 8, !tbaa !5
  %363 = load i32, ptr %32, align 4, !tbaa !11
  %364 = zext i32 %363 to i64
  %365 = getelementptr inbounds %struct.dictItem, ptr %362, i64 %364
  %366 = getelementptr inbounds %struct.dictItem, ptr %365, i32 0, i32 1
  %367 = load i32, ptr %366, align 4, !tbaa !18
  %368 = load i32, ptr %31, align 4, !tbaa !11
  %369 = add i32 %368, %367
  store i32 %369, ptr %31, align 4, !tbaa !11
  %370 = load i32, ptr %31, align 4, !tbaa !11
  %371 = zext i32 %370 to i64
  %372 = load i64, ptr %17, align 8, !tbaa !9
  %373 = icmp ugt i64 %371, %372
  br i1 %373, label %374, label %383

374:                                              ; preds = %361
  %375 = load ptr, ptr %14, align 8, !tbaa !5
  %376 = load i32, ptr %32, align 4, !tbaa !11
  %377 = zext i32 %376 to i64
  %378 = getelementptr inbounds %struct.dictItem, ptr %375, i64 %377
  %379 = getelementptr inbounds %struct.dictItem, ptr %378, i32 0, i32 1
  %380 = load i32, ptr %379, align 4, !tbaa !18
  %381 = load i32, ptr %31, align 4, !tbaa !11
  %382 = sub i32 %381, %380
  store i32 %382, ptr %31, align 4, !tbaa !11
  br label %387

383:                                              ; preds = %361
  br label %384

384:                                              ; preds = %383
  %385 = load i32, ptr %32, align 4, !tbaa !11
  %386 = add i32 %385, 1
  store i32 %386, ptr %32, align 4, !tbaa !11
  br label %357, !llvm.loop !23

387:                                              ; preds = %374, %357
  %388 = load i32, ptr %32, align 4, !tbaa !11
  %389 = load ptr, ptr %14, align 8, !tbaa !5
  %390 = getelementptr inbounds %struct.dictItem, ptr %389, i32 0, i32 0
  store i32 %388, ptr %390, align 4, !tbaa !17
  %391 = load i32, ptr %31, align 4, !tbaa !11
  store i32 %391, ptr %28, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #6
  %392 = load ptr, ptr %8, align 8, !tbaa !5
  %393 = load i64, ptr %9, align 8, !tbaa !9
  %394 = getelementptr inbounds i8, ptr %392, i64 %393
  store ptr %394, ptr %34, align 8, !tbaa !5
  store i32 1, ptr %33, align 4, !tbaa !11
  br label %395

395:                                              ; preds = %434, %387
  %396 = load i32, ptr %33, align 4, !tbaa !11
  %397 = load ptr, ptr %14, align 8, !tbaa !5
  %398 = getelementptr inbounds %struct.dictItem, ptr %397, i32 0, i32 0
  %399 = load i32, ptr %398, align 4, !tbaa !17
  %400 = icmp ult i32 %396, %399
  br i1 %400, label %401, label %437

401:                                              ; preds = %395
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #6
  %402 = load ptr, ptr %14, align 8, !tbaa !5
  %403 = load i32, ptr %33, align 4, !tbaa !11
  %404 = zext i32 %403 to i64
  %405 = getelementptr inbounds %struct.dictItem, ptr %402, i64 %404
  %406 = getelementptr inbounds %struct.dictItem, ptr %405, i32 0, i32 1
  %407 = load i32, ptr %406, align 4, !tbaa !18
  store i32 %407, ptr %35, align 4, !tbaa !11
  %408 = load i32, ptr %35, align 4, !tbaa !11
  %409 = load ptr, ptr %34, align 8, !tbaa !5
  %410 = zext i32 %408 to i64
  %411 = sub i64 0, %410
  %412 = getelementptr inbounds i8, ptr %409, i64 %411
  store ptr %412, ptr %34, align 8, !tbaa !5
  %413 = load ptr, ptr %34, align 8, !tbaa !5
  %414 = load ptr, ptr %8, align 8, !tbaa !5
  %415 = icmp ult ptr %413, %414
  br i1 %415, label %416, label %418

416:                                              ; preds = %401
  %417 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %417) #6
  store i64 -1, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %431

418:                                              ; preds = %401
  %419 = load ptr, ptr %34, align 8, !tbaa !5
  %420 = load ptr, ptr %10, align 8, !tbaa !5
  %421 = load ptr, ptr %14, align 8, !tbaa !5
  %422 = load i32, ptr %33, align 4, !tbaa !11
  %423 = zext i32 %422 to i64
  %424 = getelementptr inbounds %struct.dictItem, ptr %421, i64 %423
  %425 = getelementptr inbounds %struct.dictItem, ptr %424, i32 0, i32 0
  %426 = load i32, ptr %425, align 4, !tbaa !17
  %427 = zext i32 %426 to i64
  %428 = getelementptr inbounds i8, ptr %420, i64 %427
  %429 = load i32, ptr %35, align 4, !tbaa !11
  %430 = zext i32 %429 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %419, ptr align 1 %428, i64 %430, i1 false)
  store i32 0, ptr %21, align 4
  br label %431

431:                                              ; preds = %418, %416
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #6
  %432 = load i32, ptr %21, align 4
  switch i32 %432, label %438 [
    i32 0, label %433
  ]

433:                                              ; preds = %431
  br label %434

434:                                              ; preds = %433
  %435 = load i32, ptr %33, align 4, !tbaa !11
  %436 = add i32 %435, 1
  store i32 %436, ptr %33, align 4, !tbaa !11
  br label %395, !llvm.loop !24

437:                                              ; preds = %395
  store i32 0, ptr %21, align 4
  br label %438

438:                                              ; preds = %437, %431
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #6
  %439 = load i32, ptr %21, align 4
  switch i32 %439, label %450 [
    i32 0, label %440
  ]

440:                                              ; preds = %438
  %441 = load ptr, ptr %8, align 8, !tbaa !5
  %442 = load i32, ptr %28, align 4, !tbaa !11
  %443 = zext i32 %442 to i64
  %444 = load i64, ptr %9, align 8, !tbaa !9
  %445 = load ptr, ptr %10, align 8, !tbaa !5
  %446 = load ptr, ptr %11, align 8, !tbaa !5
  %447 = load i32, ptr %12, align 4, !tbaa !11
  %448 = getelementptr inbounds %struct.ZDICT_legacy_params_t, ptr %5, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 12, ptr %36) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %36, ptr align 4 %448, i64 12, i1 false), !tbaa.struct !25
  %449 = call i64 @ZDICT_addEntropyTablesFromBuffer_advanced(ptr noundef %441, i64 noundef %443, i64 noundef %444, ptr noundef %445, ptr noundef %446, i32 noundef %447, ptr noundef byval(%struct.ZDICT_params_t) align 8 %36)
  call void @llvm.lifetime.end.p0(i64 12, ptr %36) #6
  store i64 %449, ptr %19, align 8, !tbaa !9
  store i32 0, ptr %21, align 4
  br label %450

450:                                              ; preds = %440, %438, %242
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #6
  %451 = load i32, ptr %21, align 4
  switch i32 %451, label %455 [
    i32 0, label %452
  ]

452:                                              ; preds = %450
  %453 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %453) #6
  %454 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %454, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %455

455:                                              ; preds = %452, %450, %234, %102, %97, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %456 = load i64, ptr %7, align 8
  ret i64 %456
}

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @ZDICT_dictSize(ptr noundef) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"", !12, i64 0, !15, i64 4}
!15 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!16 = !{!14, !12, i64 8}
!17 = !{!15, !12, i64 0}
!18 = !{!15, !12, i64 4}
!19 = !{!15, !12, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}
!24 = distinct !{!24, !21}
!25 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11}


; 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.ZDICT_params_t = type { i32, i32, i32 }
%struct.ZDICT_legacy_params_t = type { i32, %struct.ZDICT_params_t }
%struct.dictItem = type { i32, i32, i32 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [55 x i8], align 1

; 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture 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: nounwind uwtable
declare dso_local i64 @ZDICT_addEntropyTablesFromBuffer_advanced(ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef byval(%struct.ZDICT_params_t) align 8) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i64 @ZDICT_trainFromBuffer_unsafe_legacy(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, ptr nocapture noundef readonly byval(%struct.ZDICT_legacy_params_t) align 8 %5) local_unnamed_addr #3 {
  %7 = alloca %struct.ZDICT_params_t, align 8
  %8 = lshr i64 %1, 4
  %9 = trunc i64 %8 to i32
  %10 = tail call i32 @llvm.umax.i32(i32 %4, i32 %9)
  %. = tail call i32 @llvm.umax.i32(i32 %10, i32 10000)
  %11 = zext i32 %. to i64
  %12 = mul nuw nsw i64 %11, 12
  %13 = tail call noalias ptr @malloc(i64 noundef %12) #7
  %14 = load i32, ptr %5, align 8
  %15 = icmp eq i32 %14, 0
  %16 = select i1 %15, i32 9, i32 %14
  %17 = icmp ugt i32 %16, 30
  %18 = lshr i32 %4, %16
  %19 = select i1 %17, i32 4, i32 %18
  %20 = tail call i64 @ZDICT_totalSampleSize(ptr noundef %3, i32 noundef %4)
  %21 = getelementptr inbounds i8, ptr %5, i64 4
  %22 = getelementptr inbounds i8, ptr %5, i64 8
  %23 = load i32, ptr %22, align 8, !tbaa !5
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %.critedge176, label %24

24:                                               ; preds = %6
  %25 = icmp ult i64 %1, 256
  br i1 %25, label %.critedge176.sink.split, label %26

26:                                               ; preds = %24
  %27 = icmp ult i64 %20, 512
  br i1 %27, label %.critedge176.sink.split, label %28

28:                                               ; preds = %26
  tail call void @ZDICT_initDictItem(ptr noundef nonnull %13)
  %29 = tail call i64 @ZDICT_trainBuffer_legacy(ptr noundef nonnull %13, i32 noundef %., ptr noundef %2, i64 noundef %20, ptr noundef %3, i32 noundef %4, i32 noundef %19, i32 noundef %23)
  %30 = icmp ugt i32 %23, 2
  br i1 %30, label %.critedge, label %.critedge177

.critedge:                                        ; preds = %28
  %31 = load i32, ptr %13, align 4, !tbaa !11
  %spec.select = tail call i32 @llvm.umin.i32(i32 %31, i32 25)
  %32 = tail call i32 @ZDICT_dictSize(ptr noundef nonnull %13)
  %33 = load ptr, ptr @stderr, align 8, !tbaa !12
  %34 = load i32, ptr %13, align 4, !tbaa !11
  %35 = add i32 %34, -1
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.3, i32 noundef %35, i32 noundef %32) #8
  %37 = load ptr, ptr @stderr, align 8, !tbaa !12
  %38 = tail call i32 @fflush(ptr noundef %37)
  %39 = load ptr, ptr @stderr, align 8, !tbaa !12
  %40 = add nsw i32 %spec.select, -1
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.4, i32 noundef %40) #8
  %42 = load ptr, ptr @stderr, align 8, !tbaa !12
  %43 = tail call i32 @fflush(ptr noundef %42)
  %.not167198 = icmp ugt i32 %31, 1
  br i1 %.not167198, label %.lr.ph.preheader, label %.critedge177

.lr.ph.preheader:                                 ; preds = %.critedge
  %wide.trip.count = zext nneg i32 %spec.select to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %53
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %53 ]
  %44 = getelementptr inbounds %struct.dictItem, ptr %13, i64 %indvars.iv
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = getelementptr inbounds i8, ptr %44, i64 4
  %47 = load i32, ptr %46, align 4, !tbaa !14
  %48 = zext i32 %45 to i64
  %49 = icmp ult i64 %20, %48
  %50 = add i32 %47, %45
  %51 = zext i32 %50 to i64
  %52 = icmp ult i64 %20, %51
  %or.cond172 = select i1 %49, i1 true, i1 %52
  br i1 %or.cond172, label %.critedge176, label %53

53:                                               ; preds = %.lr.ph
  %54 = tail call i32 @llvm.umin.i32(i32 %47, i32 40)
  %55 = load ptr, ptr @stderr, align 8, !tbaa !12
  %56 = getelementptr inbounds i8, ptr %44, i64 8
  %57 = load i32, ptr %56, align 4, !tbaa !15
  %58 = trunc nuw nsw i64 %indvars.iv to i32
  %59 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.5, i32 noundef %58, i32 noundef %47, i32 noundef %45, i32 noundef %57) #8
  %60 = load ptr, ptr @stderr, align 8, !tbaa !12
  %61 = tail call i32 @fflush(ptr noundef %60)
  %62 = getelementptr inbounds i8, ptr %2, i64 %48
  %63 = zext nneg i32 %54 to i64
  tail call void @ZDICT_printHex(ptr noundef %62, i64 noundef %63)
  %64 = load ptr, ptr @stderr, align 8, !tbaa !12
  %65 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef nonnull @.str.6) #8
  %66 = load ptr, ptr @stderr, align 8, !tbaa !12
  %67 = tail call i32 @fflush(ptr noundef %66)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge177, label %.lr.ph, !llvm.loop !16

.critedge177:                                     ; preds = %53, %.critedge, %28
  %68 = tail call i32 @ZDICT_dictSize(ptr noundef nonnull %13)
  %69 = icmp ult i32 %68, 128
  br i1 %69, label %.critedge176.sink.split, label %70

70:                                               ; preds = %.critedge177
  %71 = zext i32 %68 to i64
  %72 = lshr i64 %1, 2
  %73 = icmp ugt i64 %72, %71
  %74 = icmp ugt i32 %23, 1
  %or.cond213 = select i1 %73, i1 %74, i1 false
  br i1 %or.cond213, label %75, label %.critedge179

75:                                               ; preds = %70
  %76 = load ptr, ptr @stderr, align 8, !tbaa !12
  %77 = trunc i64 %1 to i32
  %78 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef nonnull @.str.7, i32 noundef %68, i32 noundef %77) #8
  %79 = load ptr, ptr @stderr, align 8, !tbaa !12
  %80 = tail call i32 @fflush(ptr noundef %79)
  %81 = mul i64 %1, 10
  %82 = icmp ult i64 %20, %81
  br i1 %82, label %83, label %90

83:                                               ; preds = %75
  %84 = load ptr, ptr @stderr, align 8, !tbaa !12
  %85 = lshr i64 %20, 20
  %86 = trunc i64 %85 to i32
  %87 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef nonnull @.str.8, i32 noundef %86) #8
  %88 = load ptr, ptr @stderr, align 8, !tbaa !12
  %89 = tail call i32 @fflush(ptr noundef %88)
  br label %90

90:                                               ; preds = %83, %75
  %91 = icmp ugt i32 %19, 4
  br i1 %91, label %92, label %.critedge179

92:                                               ; preds = %90
  %93 = load ptr, ptr @stderr, align 8, !tbaa !12
  %94 = add i32 %16, 1
  %95 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.9, i32 noundef %94) #8
  %96 = load ptr, ptr @stderr, align 8, !tbaa !12
  %97 = tail call i32 @fflush(ptr noundef %96)
  %98 = load ptr, ptr @stderr, align 8, !tbaa !12
  %99 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef nonnull @.str.10) #8
  %100 = load ptr, ptr @stderr, align 8, !tbaa !12
  %101 = tail call i32 @fflush(ptr noundef %100)
  br label %.critedge179

.critedge179:                                     ; preds = %90, %92, %70
  %102 = mul i64 %1, 3
  %103 = icmp ult i64 %102, %71
  %104 = icmp ugt i32 %4, 8
  %or.cond = and i1 %104, %103
  %105 = icmp ugt i32 %16, 1
  %or.cond7 = select i1 %or.cond, i1 %105, i1 false
  br i1 %or.cond7, label %.preheader, label %.critedge182

.preheader:                                       ; preds = %.critedge179, %.preheader
  %.0149.in = phi i32 [ %.0149, %.preheader ], [ %16, %.critedge179 ]
  %.0149 = add i32 %.0149.in, -1
  %106 = lshr i32 %4, %.0149
  %107 = icmp ult i32 %106, 5
  br i1 %107, label %.preheader, label %108, !llvm.loop !18

108:                                              ; preds = %.preheader
  br i1 %74, label %.critedge181, label %.critedge182

.critedge181:                                     ; preds = %108
  %109 = load ptr, ptr @stderr, align 8, !tbaa !12
  %110 = trunc i64 %1 to i32
  %111 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef nonnull @.str.11, i32 noundef %68, i32 noundef %110) #8
  %112 = load ptr, ptr @stderr, align 8, !tbaa !12
  %113 = tail call i32 @fflush(ptr noundef %112)
  %114 = load ptr, ptr @stderr, align 8, !tbaa !12
  %115 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef nonnull @.str.12, i32 noundef %.0149) #8
  %116 = load ptr, ptr @stderr, align 8, !tbaa !12
  %117 = tail call i32 @fflush(ptr noundef %116)
  %118 = load ptr, ptr @stderr, align 8, !tbaa !12
  %119 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef nonnull @.str.13) #8
  %120 = load ptr, ptr @stderr, align 8, !tbaa !12
  %121 = tail call i32 @fflush(ptr noundef %120)
  br label %.critedge182

.critedge182:                                     ; preds = %.critedge181, %108, %.critedge179
  %122 = load i32, ptr %13, align 4, !tbaa !11
  %123 = icmp ugt i32 %122, 1
  br i1 %123, label %.lr.ph202.preheader, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.critedge182
  store i32 1, ptr %13, align 4, !tbaa !11
  br label %._crit_edge212

.lr.ph202.preheader:                              ; preds = %.critedge182
  %wide.trip.count218 = zext i32 %122 to i64
  br label %.lr.ph202

.lr.ph202:                                        ; preds = %.lr.ph202.preheader, %129
  %indvars.iv215 = phi i64 [ 1, %.lr.ph202.preheader ], [ %indvars.iv.next216, %129 ]
  %.0146200 = phi i32 [ 0, %.lr.ph202.preheader ], [ %126, %129 ]
  %124 = getelementptr inbounds %struct.dictItem, ptr %13, i64 %indvars.iv215, i32 1
  %125 = load i32, ptr %124, align 4, !tbaa !14
  %126 = add i32 %125, %.0146200
  %127 = zext i32 %126 to i64
  %128 = icmp ugt i64 %127, %1
  br i1 %128, label %._crit_edge.split.loop.exit229, label %129

129:                                              ; preds = %.lr.ph202
  %indvars.iv.next216 = add nuw nsw i64 %indvars.iv215, 1
  %exitcond219.not = icmp eq i64 %indvars.iv.next216, %wide.trip.count218
  br i1 %exitcond219.not, label %._crit_edge, label %.lr.ph202, !llvm.loop !19

._crit_edge.split.loop.exit229:                   ; preds = %.lr.ph202
  %130 = trunc nuw i64 %indvars.iv215 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %129, %._crit_edge.split.loop.exit229
  %.0146.lcssa.ph = phi i32 [ %.0146200, %._crit_edge.split.loop.exit229 ], [ %126, %129 ]
  %.0145.lcssa.ph = phi i32 [ %130, %._crit_edge.split.loop.exit229 ], [ %122, %129 ]
  store i32 %.0145.lcssa.ph, ptr %13, align 4, !tbaa !11
  %.not169207 = icmp ugt i32 %.0145.lcssa.ph, 1
  br i1 %.not169207, label %.lr.ph211.preheader, label %._crit_edge212

.lr.ph211.preheader:                              ; preds = %._crit_edge
  %131 = getelementptr inbounds i8, ptr %0, i64 %1
  %wide.trip.count223 = zext i32 %.0145.lcssa.ph to i64
  br label %.lr.ph211

.lr.ph211:                                        ; preds = %.lr.ph211.preheader, %138
  %indvars.iv220 = phi i64 [ 1, %.lr.ph211.preheader ], [ %indvars.iv.next221, %138 ]
  %.0143209 = phi ptr [ %131, %.lr.ph211.preheader ], [ %137, %138 ]
  %132 = getelementptr inbounds %struct.dictItem, ptr %13, i64 %indvars.iv220
  %133 = getelementptr inbounds i8, ptr %132, i64 4
  %134 = load i32, ptr %133, align 4, !tbaa !14
  %135 = zext i32 %134 to i64
  %136 = sub nsw i64 0, %135
  %137 = getelementptr inbounds i8, ptr %.0143209, i64 %136
  %.not168 = icmp ult ptr %137, %0
  br i1 %.not168, label %.critedge176.sink.split, label %138

138:                                              ; preds = %.lr.ph211
  %139 = load i32, ptr %132, align 4, !tbaa !11
  %140 = zext i32 %139 to i64
  %141 = getelementptr inbounds i8, ptr %2, i64 %140
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %137, ptr align 1 %141, i64 %135, i1 false)
  %indvars.iv.next221 = add nuw nsw i64 %indvars.iv220, 1
  %exitcond224.not = icmp eq i64 %indvars.iv.next221, %wide.trip.count223
  br i1 %exitcond224.not, label %._crit_edge212, label %.lr.ph211, !llvm.loop !20

._crit_edge212:                                   ; preds = %138, %._crit_edge.thread, %._crit_edge
  %.0146.lcssa228.shrunk = phi i32 [ 0, %._crit_edge.thread ], [ %.0146.lcssa.ph, %._crit_edge ], [ %.0146.lcssa.ph, %138 ]
  %.0146.lcssa228 = zext i32 %.0146.lcssa228.shrunk to i64
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %21, i64 12, i1 false), !tbaa.struct !21
  %142 = tail call i64 @ZDICT_addEntropyTablesFromBuffer_advanced(ptr noundef %0, i64 noundef %.0146.lcssa228, i64 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef nonnull byval(%struct.ZDICT_params_t) align 8 %7)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #9
  br label %.critedge176.sink.split

.critedge176.sink.split:                          ; preds = %.lr.ph211, %.critedge177, %26, %24, %._crit_edge212
  %.8.ph = phi i64 [ %142, %._crit_edge212 ], [ -70, %24 ], [ -34, %26 ], [ -34, %.critedge177 ], [ -1, %.lr.ph211 ]
  tail call void @free(ptr noundef nonnull %13) #9
  br label %.critedge176

.critedge176:                                     ; preds = %.lr.ph, %.critedge176.sink.split, %6
  %.8 = phi i64 [ -64, %6 ], [ %.8.ph, %.critedge176.sink.split ], [ -1, %.lr.ph ]
  ret i64 %.8
}

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @ZDICT_dictSize(ptr noundef) local_unnamed_addr #3

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { cold nounwind }
attributes #9 = { 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 8}
!6 = !{!"", !7, i64 0, !10, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!11 = !{!10, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!10, !7, i64 4}
!15 = !{!10, !7, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22, i64 8, i64 4, !22}
!22 = !{!7, !7, i64 0}


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