; LLVM IR from indygreg/python-zstandard :: zstd (zstd)

; 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.ZSTD_BuildCTableWksp = type { [53 x i16], [285 x i32] }

; Function Attrs: nounwind uwtable
declare hidden i32 @ERR_isError(i64 noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @FSE_buildCTable_wksp(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @FSE_writeNCount(ptr noundef, i64 noundef, ptr noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @FSE_optimalTableLog(i32 noundef, i64 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @FSE_normalizeCount(ptr noundef, i32 noundef, ptr noundef, i64 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @FSE_buildCTable_rle(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_buildCTable(ptr noundef %0, i64 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef %7, i64 noundef %8, ptr noundef %9, i32 noundef %10, i32 noundef %11, ptr noundef %12, i64 noundef %13, ptr noundef %14, i64 noundef %15) #0 {
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i64, align 8
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca ptr, align 8
  %31 = alloca i64, align 8
  %32 = alloca ptr, align 8
  %33 = alloca i64, align 8
  %34 = alloca ptr, align 8
  %35 = alloca ptr, align 8
  %36 = alloca i64, align 8
  %37 = alloca i32, align 4
  %38 = alloca i64, align 8
  %39 = alloca ptr, align 8
  %40 = alloca i64, align 8
  %41 = alloca i32, align 4
  %42 = alloca i64, align 8
  %43 = alloca i64, align 8
  %44 = alloca i64, align 8
  %45 = alloca i64, align 8
  store ptr %0, ptr %18, align 8, !tbaa !5
  store i64 %1, ptr %19, align 8, !tbaa !9
  store ptr %2, ptr %20, align 8, !tbaa !5
  store i32 %3, ptr %21, align 4, !tbaa !11
  store i32 %4, ptr %22, align 4, !tbaa !11
  store ptr %5, ptr %23, align 8, !tbaa !5
  store i32 %6, ptr %24, align 4, !tbaa !11
  store ptr %7, ptr %25, align 8, !tbaa !5
  store i64 %8, ptr %26, align 8, !tbaa !9
  store ptr %9, ptr %27, align 8, !tbaa !5
  store i32 %10, ptr %28, align 4, !tbaa !11
  store i32 %11, ptr %29, align 4, !tbaa !11
  store ptr %12, ptr %30, align 8, !tbaa !5
  store i64 %13, ptr %31, align 8, !tbaa !9
  store ptr %14, ptr %32, align 8, !tbaa !5
  store i64 %15, ptr %33, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #3
  %46 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %46, ptr %34, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #3
  %47 = load ptr, ptr %34, align 8, !tbaa !5
  %48 = load i64, ptr %19, align 8, !tbaa !9
  %49 = getelementptr inbounds i8, ptr %47, i64 %48
  store ptr %49, ptr %35, align 8, !tbaa !5
  br label %50

50:                                               ; preds = %16
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %22, align 4, !tbaa !11
  switch i32 %53, label %282 [
    i32 1, label %54
    i32 3, label %106
    i32 0, label %110
    i32 2, label %142
  ]

54:                                               ; preds = %52
  br label %55

55:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #3
  %56 = load ptr, ptr %20, align 8, !tbaa !5
  %57 = load i32, ptr %24, align 4, !tbaa !11
  %58 = trunc i32 %57 to i8
  %59 = call i64 @FSE_buildCTable_rle(ptr noundef %56, i8 noundef zeroext %58)
  store i64 %59, ptr %36, align 8, !tbaa !9
  %60 = load i64, ptr %36, align 8, !tbaa !9
  %61 = call i32 @ERR_isError(i64 noundef %60)
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %77

63:                                               ; preds = %55
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  br label %75

75:                                               ; preds = %74
  %76 = load i64, ptr %36, align 8, !tbaa !9
  store i64 %76, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %78

77:                                               ; preds = %55
  store i32 0, ptr %37, align 4
  br label %78

78:                                               ; preds = %77, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #3
  %79 = load i32, ptr %37, align 4
  switch i32 %79, label %299 [
    i32 0, label %80
  ]

80:                                               ; preds = %78
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = load i64, ptr %19, align 8, !tbaa !9
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %99

86:                                               ; preds = %83
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97
  store i64 -70, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %299

99:                                               ; preds = %83
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr %25, align 8, !tbaa !5
  %103 = getelementptr inbounds i8, ptr %102, i64 0
  %104 = load i8, ptr %103, align 1, !tbaa !13
  %105 = load ptr, ptr %34, align 8, !tbaa !5
  store i8 %104, ptr %105, align 1, !tbaa !13
  store i64 1, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %299

106:                                              ; preds = %52
  %107 = load ptr, ptr %20, align 8, !tbaa !5
  %108 = load ptr, ptr %30, align 8, !tbaa !5
  %109 = load i64, ptr %31, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %107, ptr align 4 %108, i64 %109, i1 false)
  store i64 0, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %299

110:                                              ; preds = %52
  br label %111

111:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #3
  %112 = load ptr, ptr %20, align 8, !tbaa !5
  %113 = load ptr, ptr %27, align 8, !tbaa !5
  %114 = load i32, ptr %29, align 4, !tbaa !11
  %115 = load i32, ptr %28, align 4, !tbaa !11
  %116 = load ptr, ptr %32, align 8, !tbaa !5
  %117 = load i64, ptr %33, align 8, !tbaa !9
  %118 = call i64 @FSE_buildCTable_wksp(ptr noundef %112, ptr noundef %113, i32 noundef %114, i32 noundef %115, ptr noundef %116, i64 noundef %117)
  store i64 %118, ptr %38, align 8, !tbaa !9
  %119 = load i64, ptr %38, align 8, !tbaa !9
  %120 = call i32 @ERR_isError(i64 noundef %119)
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %136

122:                                              ; preds = %111
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = load i64, ptr %38, align 8, !tbaa !9
  store i64 %135, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %137

136:                                              ; preds = %111
  store i32 0, ptr %37, align 4
  br label %137

137:                                              ; preds = %136, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #3
  %138 = load i32, ptr %37, align 4
  switch i32 %138, label %299 [
    i32 0, label %139
  ]

139:                                              ; preds = %137
  br label %140

140:                                              ; preds = %139
  br label %141

141:                                              ; preds = %140
  store i64 0, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %299

142:                                              ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %39) #3
  %143 = load ptr, ptr %32, align 8, !tbaa !5
  store ptr %143, ptr %39, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %40) #3
  %144 = load i64, ptr %26, align 8, !tbaa !9
  store i64 %144, ptr %40, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #3
  %145 = load i32, ptr %21, align 4, !tbaa !11
  %146 = load i64, ptr %26, align 8, !tbaa !9
  %147 = load i32, ptr %24, align 4, !tbaa !11
  %148 = call i32 @FSE_optimalTableLog(i32 noundef %145, i64 noundef %146, i32 noundef %147)
  store i32 %148, ptr %41, align 4, !tbaa !11
  %149 = load ptr, ptr %23, align 8, !tbaa !5
  %150 = load ptr, ptr %25, align 8, !tbaa !5
  %151 = load i64, ptr %26, align 8, !tbaa !9
  %152 = sub i64 %151, 1
  %153 = getelementptr inbounds i8, ptr %150, i64 %152
  %154 = load i8, ptr %153, align 1, !tbaa !13
  %155 = zext i8 %154 to i64
  %156 = getelementptr inbounds i32, ptr %149, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !11
  %158 = icmp ugt i32 %157, 1
  br i1 %158, label %159, label %172

159:                                              ; preds = %142
  %160 = load ptr, ptr %23, align 8, !tbaa !5
  %161 = load ptr, ptr %25, align 8, !tbaa !5
  %162 = load i64, ptr %26, align 8, !tbaa !9
  %163 = sub i64 %162, 1
  %164 = getelementptr inbounds i8, ptr %161, i64 %163
  %165 = load i8, ptr %164, align 1, !tbaa !13
  %166 = zext i8 %165 to i64
  %167 = getelementptr inbounds i32, ptr %160, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !11
  %169 = add i32 %168, -1
  store i32 %169, ptr %167, align 4, !tbaa !11
  %170 = load i64, ptr %40, align 8, !tbaa !9
  %171 = add i64 %170, -1
  store i64 %171, ptr %40, align 8, !tbaa !9
  br label %172

172:                                              ; preds = %159, %142
  %173 = load i64, ptr %33, align 8, !tbaa !9
  br label %174

174:                                              ; preds = %172
  call void @llvm.lifetime.start.p0(i64 8, ptr %42) #3
  %175 = load ptr, ptr %39, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.ZSTD_BuildCTableWksp, ptr %175, i32 0, i32 0
  %177 = getelementptr inbounds [53 x i16], ptr %176, i64 0, i64 0
  %178 = load i32, ptr %41, align 4, !tbaa !11
  %179 = load ptr, ptr %23, align 8, !tbaa !5
  %180 = load i64, ptr %40, align 8, !tbaa !9
  %181 = load i32, ptr %24, align 4, !tbaa !11
  %182 = load i64, ptr %40, align 8, !tbaa !9
  %183 = call i32 @ZSTD_useLowProbCount(i64 noundef %182)
  %184 = call i64 @FSE_normalizeCount(ptr noundef %177, i32 noundef %178, ptr noundef %179, i64 noundef %180, i32 noundef %181, i32 noundef %183)
  store i64 %184, ptr %42, align 8, !tbaa !9
  %185 = load i64, ptr %42, align 8, !tbaa !9
  %186 = call i32 @ERR_isError(i64 noundef %185)
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %202

188:                                              ; preds = %174
  br label %189

189:                                              ; preds = %188
  br label %190

190:                                              ; preds = %189
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  %201 = load i64, ptr %42, align 8, !tbaa !9
  store i64 %201, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %203

202:                                              ; preds = %174
  store i32 0, ptr %37, align 4
  br label %203

203:                                              ; preds = %202, %200
  call void @llvm.lifetime.end.p0(i64 8, ptr %42) #3
  %204 = load i32, ptr %37, align 4
  switch i32 %204, label %281 [
    i32 0, label %205
  ]

205:                                              ; preds = %203
  br label %206

206:                                              ; preds = %205
  br label %207

207:                                              ; preds = %206
  call void @llvm.lifetime.start.p0(i64 8, ptr %43) #3
  %208 = load ptr, ptr %34, align 8, !tbaa !5
  %209 = load ptr, ptr %35, align 8, !tbaa !5
  %210 = load ptr, ptr %34, align 8, !tbaa !5
  %211 = ptrtoint ptr %209 to i64
  %212 = ptrtoint ptr %210 to i64
  %213 = sub i64 %211, %212
  %214 = load ptr, ptr %39, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.ZSTD_BuildCTableWksp, ptr %214, i32 0, i32 0
  %216 = getelementptr inbounds [53 x i16], ptr %215, i64 0, i64 0
  %217 = load i32, ptr %24, align 4, !tbaa !11
  %218 = load i32, ptr %41, align 4, !tbaa !11
  %219 = call i64 @FSE_writeNCount(ptr noundef %208, i64 noundef %213, ptr noundef %216, i32 noundef %217, i32 noundef %218)
  store i64 %219, ptr %43, align 8, !tbaa !9
  br label %220

220:                                              ; preds = %207
  call void @llvm.lifetime.start.p0(i64 8, ptr %44) #3
  %221 = load i64, ptr %43, align 8, !tbaa !9
  store i64 %221, ptr %44, align 8, !tbaa !9
  %222 = load i64, ptr %44, align 8, !tbaa !9
  %223 = call i32 @ERR_isError(i64 noundef %222)
  %224 = icmp ne i32 %223, 0
  br i1 %224, label %225, label %239

225:                                              ; preds = %220
  br label %226

226:                                              ; preds = %225
  br label %227

227:                                              ; preds = %226
  br label %228

228:                                              ; preds = %227
  br label %229

229:                                              ; preds = %228
  br label %230

230:                                              ; preds = %229
  br label %231

231:                                              ; preds = %230
  br label %232

232:                                              ; preds = %231
  br label %233

233:                                              ; preds = %232
  br label %234

234:                                              ; preds = %233
  br label %235

235:                                              ; preds = %234
  br label %236

236:                                              ; preds = %235
  br label %237

237:                                              ; preds = %236
  %238 = load i64, ptr %44, align 8, !tbaa !9
  store i64 %238, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %240

239:                                              ; preds = %220
  store i32 0, ptr %37, align 4
  br label %240

240:                                              ; preds = %239, %237
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #3
  %241 = load i32, ptr %37, align 4
  switch i32 %241, label %280 [
    i32 0, label %242
  ]

242:                                              ; preds = %240
  br label %243

243:                                              ; preds = %242
  br label %244

244:                                              ; preds = %243
  br label %245

245:                                              ; preds = %244
  call void @llvm.lifetime.start.p0(i64 8, ptr %45) #3
  %246 = load ptr, ptr %20, align 8, !tbaa !5
  %247 = load ptr, ptr %39, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.ZSTD_BuildCTableWksp, ptr %247, i32 0, i32 0
  %249 = getelementptr inbounds [53 x i16], ptr %248, i64 0, i64 0
  %250 = load i32, ptr %24, align 4, !tbaa !11
  %251 = load i32, ptr %41, align 4, !tbaa !11
  %252 = load ptr, ptr %39, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.ZSTD_BuildCTableWksp, ptr %252, i32 0, i32 1
  %254 = getelementptr inbounds [285 x i32], ptr %253, i64 0, i64 0
  %255 = call i64 @FSE_buildCTable_wksp(ptr noundef %246, ptr noundef %249, i32 noundef %250, i32 noundef %251, ptr noundef %254, i64 noundef 1140)
  store i64 %255, ptr %45, align 8, !tbaa !9
  %256 = load i64, ptr %45, align 8, !tbaa !9
  %257 = call i32 @ERR_isError(i64 noundef %256)
  %258 = icmp ne i32 %257, 0
  br i1 %258, label %259, label %273

259:                                              ; preds = %245
  br label %260

260:                                              ; preds = %259
  br label %261

261:                                              ; preds = %260
  br label %262

262:                                              ; preds = %261
  br label %263

263:                                              ; preds = %262
  br label %264

264:                                              ; preds = %263
  br label %265

265:                                              ; preds = %264
  br label %266

266:                                              ; preds = %265
  br label %267

267:                                              ; preds = %266
  br label %268

268:                                              ; preds = %267
  br label %269

269:                                              ; preds = %268
  br label %270

270:                                              ; preds = %269
  br label %271

271:                                              ; preds = %270
  %272 = load i64, ptr %45, align 8, !tbaa !9
  store i64 %272, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %274

273:                                              ; preds = %245
  store i32 0, ptr %37, align 4
  br label %274

274:                                              ; preds = %273, %271
  call void @llvm.lifetime.end.p0(i64 8, ptr %45) #3
  %275 = load i32, ptr %37, align 4
  switch i32 %275, label %280 [
    i32 0, label %276
  ]

276:                                              ; preds = %274
  br label %277

277:                                              ; preds = %276
  br label %278

278:                                              ; preds = %277
  %279 = load i64, ptr %43, align 8, !tbaa !9
  store i64 %279, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %280

280:                                              ; preds = %278, %274, %240
  call void @llvm.lifetime.end.p0(i64 8, ptr %43) #3
  br label %281

281:                                              ; preds = %280, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #3
  br label %299

282:                                              ; preds = %52
  br label %283

283:                                              ; preds = %282
  br label %284

284:                                              ; preds = %283
  br label %285

285:                                              ; preds = %284
  br label %286

286:                                              ; preds = %285
  br label %287

287:                                              ; preds = %286
  br label %288

288:                                              ; preds = %287
  br label %289

289:                                              ; preds = %288
  br label %290

290:                                              ; preds = %289
  br label %291

291:                                              ; preds = %290
  br label %292

292:                                              ; preds = %291
  br label %293

293:                                              ; preds = %292
  br label %294

294:                                              ; preds = %293
  br label %295

295:                                              ; preds = %294
  store i64 -1, ptr %17, align 8
  store i32 1, ptr %37, align 4
  br label %299

296:                                              ; No predecessors!
  br label %297

297:                                              ; preds = %296
  br label %298

298:                                              ; preds = %297
  store i32 0, ptr %37, align 4
  br label %299

299:                                              ; preds = %298, %295, %281, %141, %137, %106, %101, %98, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #3
  %300 = load i32, ptr %37, align 4
  switch i32 %300, label %303 [
    i32 0, label %301
    i32 1, label %301
  ]

301:                                              ; preds = %299, %299
  %302 = load i64, ptr %17, align 8
  ret i64 %302

303:                                              ; preds = %299
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden i32 @ZSTD_useLowProbCount(i64 noundef) #0

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}


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

; Function Attrs: nounwind uwtable
declare hidden i32 @ERR_isError(i64 noundef) local_unnamed_addr #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: nounwind uwtable
declare dso_local i64 @FSE_buildCTable_wksp(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @FSE_writeNCount(ptr noundef, i64 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @FSE_optimalTableLog(i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @FSE_normalizeCount(ptr noundef, i32 noundef, ptr noundef, i64 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @FSE_buildCTable_rle(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_buildCTable(ptr noundef %0, i64 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6, ptr nocapture noundef readonly %7, i64 noundef %8, ptr noundef %9, i32 noundef %10, i32 noundef %11, ptr nocapture noundef readonly %12, i64 noundef %13, ptr noundef %14, i64 noundef %15) local_unnamed_addr #0 {
  switch i32 %4, label %52 [
    i32 1, label %17
    i32 3, label %25
    i32 0, label %26
    i32 2, label %29
  ]

17:                                               ; preds = %16
  %18 = trunc i32 %6 to i8
  %19 = tail call i64 @FSE_buildCTable_rle(ptr noundef %2, i8 noundef zeroext %18)
  %20 = tail call i32 @ERR_isError(i64 noundef %19)
  %.not78 = icmp eq i32 %20, 0
  br i1 %.not78, label %21, label %52

21:                                               ; preds = %17
  %22 = icmp eq i64 %1, 0
  br i1 %22, label %52, label %23

23:                                               ; preds = %21
  %24 = load i8, ptr %7, align 1, !tbaa !5
  store i8 %24, ptr %0, align 1, !tbaa !5
  br label %52

25:                                               ; preds = %16
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %2, ptr align 4 %12, i64 %13, i1 false)
  br label %52

26:                                               ; preds = %16
  %27 = tail call i64 @FSE_buildCTable_wksp(ptr noundef %2, ptr noundef %9, i32 noundef %11, i32 noundef %10, ptr noundef %14, i64 noundef %15)
  %28 = tail call i32 @ERR_isError(i64 noundef %27)
  %.not77 = icmp eq i32 %28, 0
  %spec.select = select i1 %.not77, i64 0, i64 %27
  br label %52

29:                                               ; preds = %16
  %30 = tail call i32 @FSE_optimalTableLog(i32 noundef %3, i64 noundef %8, i32 noundef %6)
  %31 = getelementptr i8, ptr %7, i64 %8
  %32 = getelementptr i8, ptr %31, i64 -1
  %33 = load i8, ptr %32, align 1, !tbaa !5
  %34 = zext i8 %33 to i64
  %35 = getelementptr inbounds i32, ptr %5, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !8
  %37 = icmp ugt i32 %36, 1
  br i1 %37, label %38, label %41

38:                                               ; preds = %29
  %39 = add i32 %36, -1
  store i32 %39, ptr %35, align 4, !tbaa !8
  %40 = add i64 %8, -1
  br label %41

41:                                               ; preds = %38, %29
  %.074 = phi i64 [ %40, %38 ], [ %8, %29 ]
  %42 = tail call i32 @ZSTD_useLowProbCount(i64 noundef %.074)
  %43 = tail call i64 @FSE_normalizeCount(ptr noundef %14, i32 noundef %30, ptr noundef nonnull %5, i64 noundef %.074, i32 noundef %6, i32 noundef %42)
  %44 = tail call i32 @ERR_isError(i64 noundef %43)
  %.not = icmp eq i32 %44, 0
  br i1 %.not, label %45, label %52

45:                                               ; preds = %41
  %46 = tail call i64 @FSE_writeNCount(ptr noundef %0, i64 noundef %1, ptr noundef %14, i32 noundef %6, i32 noundef %30)
  %47 = tail call i32 @ERR_isError(i64 noundef %46)
  %.not75 = icmp eq i32 %47, 0
  br i1 %.not75, label %48, label %52

48:                                               ; preds = %45
  %49 = getelementptr inbounds i8, ptr %14, i64 108
  %50 = tail call i64 @FSE_buildCTable_wksp(ptr noundef %2, ptr noundef %14, i32 noundef %6, i32 noundef %30, ptr noundef nonnull %49, i64 noundef 1140)
  %51 = tail call i32 @ERR_isError(i64 noundef %50)
  %.not76 = icmp eq i32 %51, 0
  %spec.select79 = select i1 %.not76, i64 %46, i64 %50
  br label %52

52:                                               ; preds = %48, %26, %16, %41, %45, %21, %17, %25, %23
  %.7 = phi i64 [ 0, %25 ], [ 1, %23 ], [ %19, %17 ], [ -70, %21 ], [ %43, %41 ], [ %46, %45 ], [ -1, %16 ], [ %spec.select, %26 ], [ %spec.select79, %48 ]
  ret i64 %.7
}

; Function Attrs: nounwind uwtable
declare hidden i32 @ZSTD_useLowProbCount(i64 noundef) local_unnamed_addr #0

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass