; 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_seqSymbol = type { i16, i8, i8, i32 }
%struct.ZSTD_DCtx_s = type { ptr, ptr, ptr, ptr, %struct.ZSTD_entropyDTables_t, [640 x i32], ptr, ptr, ptr, ptr, i64, %struct.ZSTD_frameHeader, i64, i64, i32, i32, i32, i32, %struct.XXH_NAMESPACEXXH64_state_s, i64, i32, i32, i32, ptr, %struct.ZSTD_customMem, i64, i64, i64, i32, i32, ptr, ptr, i32, i32, i32, ptr, i32, i32, i32, i32, ptr, i64, i64, i64, ptr, i64, i64, i64, i64, i32, i32, i32, %struct.ZSTD_outBuffer_s, ptr, ptr, i32, [65568 x i8], [18 x i8], i64 }
%struct.ZSTD_entropyDTables_t = type { [513 x %struct.ZSTD_seqSymbol], [257 x %struct.ZSTD_seqSymbol], [513 x %struct.ZSTD_seqSymbol], [4097 x i32], [3 x i32], [157 x i32] }
%struct.ZSTD_frameHeader = type { i64, i64, i32, i32, i32, i32, i32, i32, i32 }
%struct.XXH_NAMESPACEXXH64_state_s = type { i64, [4 x i64], [4 x i64], i32, i32, i64 }
%struct.ZSTD_customMem = type { ptr, ptr, ptr }
%struct.ZSTD_outBuffer_s = type { ptr, i64, i64 }

@OF_base = external hidden constant [32 x i32], align 16
@OF_bits = external hidden constant [32 x i8], align 16
@ML_base = external hidden constant [53 x i32], align 16
@ML_bits = external hidden constant [53 x i8], align 16
@LL_base = external hidden constant [36 x i32], align 16
@LL_bits = external hidden constant [36 x i8], align 16
@LL_defaultDTable = external hidden constant [65 x %struct.ZSTD_seqSymbol], align 16
@OF_defaultDTable = external hidden constant [33 x %struct.ZSTD_seqSymbol], align 16
@ML_defaultDTable = external hidden constant [65 x %struct.ZSTD_seqSymbol], align 16

; 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 uwtable
declare dso_local i32 @ZSTD_isError(i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @MEM_readLE16(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_decodeSeqHeaders(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #1 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i64 %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %21, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = load i64, ptr %9, align 8, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %22, i64 %23
  store ptr %24, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %25, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  br label %26

26:                                               ; preds = %4
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = load i64, ptr %9, align 8, !tbaa !9
  %31 = icmp ult i64 %30, 1
  br i1 %31, label %32, label %45

32:                                               ; preds = %29
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  store i64 -72, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %370

45:                                               ; preds = %29
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i32 1
  store ptr %49, ptr %12, align 8, !tbaa !5
  %50 = load i8, ptr %48, align 1, !tbaa !11
  %51 = zext i8 %50 to i32
  store i32 %51, ptr %13, align 4, !tbaa !12
  %52 = load i32, ptr %13, align 4, !tbaa !12
  %53 = icmp sgt i32 %52, 127
  br i1 %53, label %54, label %115

54:                                               ; preds = %47
  %55 = load i32, ptr %13, align 4, !tbaa !12
  %56 = icmp eq i32 %55, 255
  br i1 %56, label %57, label %85

57:                                               ; preds = %54
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 2
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = icmp ugt ptr %60, %61
  br i1 %62, label %63, label %76

63:                                               ; preds = %58
  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
  store i64 -72, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %370

76:                                               ; preds = %58
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  %79 = load ptr, ptr %12, align 8, !tbaa !5
  %80 = call zeroext i16 @MEM_readLE16(ptr noundef %79)
  %81 = zext i16 %80 to i32
  %82 = add nsw i32 %81, 32512
  store i32 %82, ptr %13, align 4, !tbaa !12
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  %84 = getelementptr inbounds i8, ptr %83, i64 2
  store ptr %84, ptr %12, align 8, !tbaa !5
  br label %114

85:                                               ; preds = %54
  br label %86

86:                                               ; preds = %85
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = load ptr, ptr %11, align 8, !tbaa !5
  %89 = icmp uge ptr %87, %88
  br i1 %89, label %90, label %103

90:                                               ; preds = %86
  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
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  store i64 -72, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %370

103:                                              ; preds = %86
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %13, align 4, !tbaa !12
  %107 = sub nsw i32 %106, 128
  %108 = shl i32 %107, 8
  %109 = load ptr, ptr %12, align 8, !tbaa !5
  %110 = getelementptr inbounds i8, ptr %109, i32 1
  store ptr %110, ptr %12, align 8, !tbaa !5
  %111 = load i8, ptr %109, align 1, !tbaa !11
  %112 = zext i8 %111 to i32
  %113 = add nsw i32 %108, %112
  store i32 %113, ptr %13, align 4, !tbaa !12
  br label %114

114:                                              ; preds = %105, %78
  br label %115

115:                                              ; preds = %114, %47
  %116 = load i32, ptr %13, align 4, !tbaa !12
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %116, ptr %117, align 4, !tbaa !12
  %118 = load i32, ptr %13, align 4, !tbaa !12
  %119 = icmp eq i32 %118, 0
  br i1 %119, label %120, label %146

120:                                              ; preds = %115
  br label %121

121:                                              ; preds = %120
  %122 = load ptr, ptr %12, align 8, !tbaa !5
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = icmp ne ptr %122, %123
  br i1 %124, label %125, label %138

125:                                              ; preds = %121
  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
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  br label %137

137:                                              ; preds = %136
  store i64 -20, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %370

138:                                              ; preds = %121
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  %141 = load ptr, ptr %12, align 8, !tbaa !5
  %142 = load ptr, ptr %10, align 8, !tbaa !5
  %143 = ptrtoint ptr %141 to i64
  %144 = ptrtoint ptr %142 to i64
  %145 = sub i64 %143, %144
  store i64 %145, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %370

146:                                              ; preds = %115
  br label %147

147:                                              ; preds = %146
  %148 = load ptr, ptr %12, align 8, !tbaa !5
  %149 = getelementptr inbounds i8, ptr %148, i64 1
  %150 = load ptr, ptr %11, align 8, !tbaa !5
  %151 = icmp ugt ptr %149, %150
  br i1 %151, label %152, label %165

152:                                              ; preds = %147
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162
  br label %164

164:                                              ; preds = %163
  store i64 -72, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %370

165:                                              ; preds = %147
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  %170 = load i8, ptr %169, align 1, !tbaa !11
  %171 = zext i8 %170 to i32
  %172 = and i32 %171, 3
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %187

174:                                              ; preds = %168
  br label %175

175:                                              ; preds = %174
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176
  br label %178

178:                                              ; preds = %177
  br label %179

179:                                              ; preds = %178
  br label %180

180:                                              ; preds = %179
  br label %181

181:                                              ; preds = %180
  br label %182

182:                                              ; preds = %181
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185
  store i64 -20, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %370

187:                                              ; preds = %168
  br label %188

188:                                              ; preds = %187
  br label %189

189:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %190 = load ptr, ptr %12, align 8, !tbaa !5
  %191 = load i8, ptr %190, align 1, !tbaa !11
  %192 = zext i8 %191 to i32
  %193 = ashr i32 %192, 6
  store i32 %193, ptr %15, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %194 = load ptr, ptr %12, align 8, !tbaa !5
  %195 = load i8, ptr %194, align 1, !tbaa !11
  %196 = zext i8 %195 to i32
  %197 = ashr i32 %196, 4
  %198 = and i32 %197, 3
  store i32 %198, ptr %16, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %199 = load ptr, ptr %12, align 8, !tbaa !5
  %200 = load i8, ptr %199, align 1, !tbaa !11
  %201 = zext i8 %200 to i32
  %202 = ashr i32 %201, 2
  %203 = and i32 %202, 3
  store i32 %203, ptr %17, align 4, !tbaa !12
  %204 = load ptr, ptr %12, align 8, !tbaa !5
  %205 = getelementptr inbounds i8, ptr %204, i32 1
  store ptr %205, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %206 = load ptr, ptr %6, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %206, i32 0, i32 4
  %208 = getelementptr inbounds %struct.ZSTD_entropyDTables_t, ptr %207, i32 0, i32 0
  %209 = getelementptr inbounds [513 x %struct.ZSTD_seqSymbol], ptr %208, i64 0, i64 0
  %210 = load ptr, ptr %6, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %210, i32 0, i32 0
  %212 = load i32, ptr %15, align 4, !tbaa !12
  %213 = load ptr, ptr %12, align 8, !tbaa !5
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  %215 = load ptr, ptr %12, align 8, !tbaa !5
  %216 = ptrtoint ptr %214 to i64
  %217 = ptrtoint ptr %215 to i64
  %218 = sub i64 %216, %217
  %219 = load ptr, ptr %6, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %219, i32 0, i32 17
  %221 = load i32, ptr %220, align 4, !tbaa !14
  %222 = load ptr, ptr %6, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %222, i32 0, i32 33
  %224 = load i32, ptr %223, align 4, !tbaa !22
  %225 = load i32, ptr %13, align 4, !tbaa !12
  %226 = load ptr, ptr %6, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %226, i32 0, i32 5
  %228 = getelementptr inbounds [640 x i32], ptr %227, i64 0, i64 0
  %229 = load ptr, ptr %6, align 8, !tbaa !5
  %230 = call i32 @ZSTD_DCtx_get_bmi2(ptr noundef %229)
  %231 = call i64 @ZSTD_buildSeqTable(ptr noundef %209, ptr noundef %211, i32 noundef %212, i32 noundef 35, i32 noundef 9, ptr noundef %213, i64 noundef %218, ptr noundef @LL_base, ptr noundef @LL_bits, ptr noundef @LL_defaultDTable, i32 noundef %221, i32 noundef %224, i32 noundef %225, ptr noundef %228, i64 noundef 2560, i32 noundef %230)
  store i64 %231, ptr %18, align 8, !tbaa !9
  br label %232

232:                                              ; preds = %189
  %233 = load i64, ptr %18, align 8, !tbaa !9
  %234 = call i32 @ZSTD_isError(i64 noundef %233)
  %235 = icmp ne i32 %234, 0
  br i1 %235, label %236, label %249

236:                                              ; preds = %232
  br label %237

237:                                              ; preds = %236
  br label %238

238:                                              ; preds = %237
  br label %239

239:                                              ; preds = %238
  br label %240

240:                                              ; preds = %239
  br label %241

241:                                              ; preds = %240
  br label %242

242:                                              ; preds = %241
  br label %243

243:                                              ; preds = %242
  br label %244

244:                                              ; preds = %243
  br label %245

245:                                              ; preds = %244
  br label %246

246:                                              ; preds = %245
  br label %247

247:                                              ; preds = %246
  br label %248

248:                                              ; preds = %247
  store i64 -20, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %255

249:                                              ; preds = %232
  br label %250

250:                                              ; preds = %249
  br label %251

251:                                              ; preds = %250
  %252 = load i64, ptr %18, align 8, !tbaa !9
  %253 = load ptr, ptr %12, align 8, !tbaa !5
  %254 = getelementptr inbounds i8, ptr %253, i64 %252
  store ptr %254, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %14, align 4
  br label %255

255:                                              ; preds = %251, %248
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  %256 = load i32, ptr %14, align 4
  switch i32 %256, label %362 [
    i32 0, label %257
  ]

257:                                              ; preds = %255
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %258 = load ptr, ptr %6, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %258, i32 0, i32 4
  %260 = getelementptr inbounds %struct.ZSTD_entropyDTables_t, ptr %259, i32 0, i32 1
  %261 = getelementptr inbounds [257 x %struct.ZSTD_seqSymbol], ptr %260, i64 0, i64 0
  %262 = load ptr, ptr %6, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %262, i32 0, i32 2
  %264 = load i32, ptr %16, align 4, !tbaa !12
  %265 = load ptr, ptr %12, align 8, !tbaa !5
  %266 = load ptr, ptr %11, align 8, !tbaa !5
  %267 = load ptr, ptr %12, align 8, !tbaa !5
  %268 = ptrtoint ptr %266 to i64
  %269 = ptrtoint ptr %267 to i64
  %270 = sub i64 %268, %269
  %271 = load ptr, ptr %6, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %271, i32 0, i32 17
  %273 = load i32, ptr %272, align 4, !tbaa !14
  %274 = load ptr, ptr %6, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %274, i32 0, i32 33
  %276 = load i32, ptr %275, align 4, !tbaa !22
  %277 = load i32, ptr %13, align 4, !tbaa !12
  %278 = load ptr, ptr %6, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %278, i32 0, i32 5
  %280 = getelementptr inbounds [640 x i32], ptr %279, i64 0, i64 0
  %281 = load ptr, ptr %6, align 8, !tbaa !5
  %282 = call i32 @ZSTD_DCtx_get_bmi2(ptr noundef %281)
  %283 = call i64 @ZSTD_buildSeqTable(ptr noundef %261, ptr noundef %263, i32 noundef %264, i32 noundef 31, i32 noundef 8, ptr noundef %265, i64 noundef %270, ptr noundef @OF_base, ptr noundef @OF_bits, ptr noundef @OF_defaultDTable, i32 noundef %273, i32 noundef %276, i32 noundef %277, ptr noundef %280, i64 noundef 2560, i32 noundef %282)
  store i64 %283, ptr %19, align 8, !tbaa !9
  br label %284

284:                                              ; preds = %257
  %285 = load i64, ptr %19, align 8, !tbaa !9
  %286 = call i32 @ZSTD_isError(i64 noundef %285)
  %287 = icmp ne i32 %286, 0
  br i1 %287, label %288, label %301

288:                                              ; preds = %284
  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
  br label %296

296:                                              ; preds = %295
  br label %297

297:                                              ; preds = %296
  br label %298

298:                                              ; preds = %297
  br label %299

299:                                              ; preds = %298
  br label %300

300:                                              ; preds = %299
  store i64 -20, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %307

301:                                              ; preds = %284
  br label %302

302:                                              ; preds = %301
  br label %303

303:                                              ; preds = %302
  %304 = load i64, ptr %19, align 8, !tbaa !9
  %305 = load ptr, ptr %12, align 8, !tbaa !5
  %306 = getelementptr inbounds i8, ptr %305, i64 %304
  store ptr %306, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %14, align 4
  br label %307

307:                                              ; preds = %303, %300
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  %308 = load i32, ptr %14, align 4
  switch i32 %308, label %362 [
    i32 0, label %309
  ]

309:                                              ; preds = %307
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %310 = load ptr, ptr %6, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %310, i32 0, i32 4
  %312 = getelementptr inbounds %struct.ZSTD_entropyDTables_t, ptr %311, i32 0, i32 2
  %313 = getelementptr inbounds [513 x %struct.ZSTD_seqSymbol], ptr %312, i64 0, i64 0
  %314 = load ptr, ptr %6, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %314, i32 0, i32 1
  %316 = load i32, ptr %17, align 4, !tbaa !12
  %317 = load ptr, ptr %12, align 8, !tbaa !5
  %318 = load ptr, ptr %11, align 8, !tbaa !5
  %319 = load ptr, ptr %12, align 8, !tbaa !5
  %320 = ptrtoint ptr %318 to i64
  %321 = ptrtoint ptr %319 to i64
  %322 = sub i64 %320, %321
  %323 = load ptr, ptr %6, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %323, i32 0, i32 17
  %325 = load i32, ptr %324, align 4, !tbaa !14
  %326 = load ptr, ptr %6, align 8, !tbaa !5
  %327 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %326, i32 0, i32 33
  %328 = load i32, ptr %327, align 4, !tbaa !22
  %329 = load i32, ptr %13, align 4, !tbaa !12
  %330 = load ptr, ptr %6, align 8, !tbaa !5
  %331 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %330, i32 0, i32 5
  %332 = getelementptr inbounds [640 x i32], ptr %331, i64 0, i64 0
  %333 = load ptr, ptr %6, align 8, !tbaa !5
  %334 = call i32 @ZSTD_DCtx_get_bmi2(ptr noundef %333)
  %335 = call i64 @ZSTD_buildSeqTable(ptr noundef %313, ptr noundef %315, i32 noundef %316, i32 noundef 52, i32 noundef 9, ptr noundef %317, i64 noundef %322, ptr noundef @ML_base, ptr noundef @ML_bits, ptr noundef @ML_defaultDTable, i32 noundef %325, i32 noundef %328, i32 noundef %329, ptr noundef %332, i64 noundef 2560, i32 noundef %334)
  store i64 %335, ptr %20, align 8, !tbaa !9
  br label %336

336:                                              ; preds = %309
  %337 = load i64, ptr %20, align 8, !tbaa !9
  %338 = call i32 @ZSTD_isError(i64 noundef %337)
  %339 = icmp ne i32 %338, 0
  br i1 %339, label %340, label %353

340:                                              ; preds = %336
  br label %341

341:                                              ; preds = %340
  br label %342

342:                                              ; preds = %341
  br label %343

343:                                              ; preds = %342
  br label %344

344:                                              ; preds = %343
  br label %345

345:                                              ; preds = %344
  br label %346

346:                                              ; preds = %345
  br label %347

347:                                              ; preds = %346
  br label %348

348:                                              ; preds = %347
  br label %349

349:                                              ; preds = %348
  br label %350

350:                                              ; preds = %349
  br label %351

351:                                              ; preds = %350
  br label %352

352:                                              ; preds = %351
  store i64 -20, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %359

353:                                              ; preds = %336
  br label %354

354:                                              ; preds = %353
  br label %355

355:                                              ; preds = %354
  %356 = load i64, ptr %20, align 8, !tbaa !9
  %357 = load ptr, ptr %12, align 8, !tbaa !5
  %358 = getelementptr inbounds i8, ptr %357, i64 %356
  store ptr %358, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %14, align 4
  br label %359

359:                                              ; preds = %355, %352
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  %360 = load i32, ptr %14, align 4
  switch i32 %360, label %362 [
    i32 0, label %361
  ]

361:                                              ; preds = %359
  store i32 0, ptr %14, align 4
  br label %362

362:                                              ; preds = %361, %359, %307, %255
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  %363 = load i32, ptr %14, align 4
  switch i32 %363, label %370 [
    i32 0, label %364
  ]

364:                                              ; preds = %362
  %365 = load ptr, ptr %12, align 8, !tbaa !5
  %366 = load ptr, ptr %10, align 8, !tbaa !5
  %367 = ptrtoint ptr %365 to i64
  %368 = ptrtoint ptr %366 to i64
  %369 = sub i64 %367, %368
  store i64 %369, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %370

370:                                              ; preds = %364, %362, %186, %164, %140, %137, %102, %75, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %371 = load i64, ptr %5, align 8
  ret i64 %371
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ZSTD_DCtx_get_bmi2(ptr noundef) #2

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

!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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 30004}
!15 = !{!"ZSTD_DCtx_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !16, i64 32, !7, i64 27324, !6, i64 29888, !6, i64 29896, !6, i64 29904, !6, i64 29912, !10, i64 29920, !17, i64 29928, !10, i64 29976, !10, i64 29984, !13, i64 29992, !13, i64 29996, !13, i64 30000, !13, i64 30004, !19, i64 30008, !10, i64 30096, !13, i64 30104, !13, i64 30108, !13, i64 30112, !6, i64 30120, !20, i64 30128, !10, i64 30152, !10, i64 30160, !10, i64 30168, !13, i64 30176, !13, i64 30180, !6, i64 30184, !6, i64 30192, !13, i64 30200, !13, i64 30204, !13, i64 30208, !6, i64 30216, !13, i64 30224, !13, i64 30228, !13, i64 30232, !13, i64 30236, !6, i64 30240, !10, i64 30248, !10, i64 30256, !10, i64 30264, !6, i64 30272, !10, i64 30280, !10, i64 30288, !10, i64 30296, !10, i64 30304, !13, i64 30312, !13, i64 30316, !13, i64 30320, !21, i64 30328, !6, i64 30352, !6, i64 30360, !13, i64 30368, !7, i64 30372, !7, i64 95940, !10, i64 95960}
!16 = !{!"", !7, i64 0, !7, i64 4104, !7, i64 6160, !7, i64 10264, !7, i64 26652, !7, i64 26664}
!17 = !{!"", !18, i64 0, !18, i64 8, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40}
!18 = !{!"long long", !7, i64 0}
!19 = !{!"XXH_NAMESPACEXXH64_state_s", !10, i64 0, !7, i64 8, !7, i64 40, !13, i64 72, !13, i64 76, !10, i64 80}
!20 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"ZSTD_outBuffer_s", !6, i64 0, !10, i64 8, !10, i64 16}
!22 = !{!15, !13, i64 30204}


; 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.ZSTD_seqSymbol = type { i16, i8, i8, i32 }

@OF_base = external hidden constant [32 x i32], align 16
@OF_bits = external hidden constant [32 x i8], align 16
@ML_base = external hidden constant [53 x i32], align 16
@ML_bits = external hidden constant [53 x i8], align 16
@LL_base = external hidden constant [36 x i32], align 16
@LL_bits = external hidden constant [36 x i8], align 16
@LL_defaultDTable = external hidden constant [65 x %struct.ZSTD_seqSymbol], align 16
@OF_defaultDTable = external hidden constant [33 x %struct.ZSTD_seqSymbol], align 16
@ML_defaultDTable = external hidden constant [65 x %struct.ZSTD_seqSymbol], align 16

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @MEM_readLE16(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_decodeSeqHeaders(ptr noundef %0, ptr nocapture noundef writeonly %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %2, i64 %3
  %6 = icmp eq i64 %3, 0
  br i1 %6, label %.thread104, label %7

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %2, i64 1
  %9 = load i8, ptr %2, align 1, !tbaa !5
  %10 = zext i8 %9 to i32
  %11 = icmp slt i8 %9, 0
  br i1 %11, label %12, label %28

12:                                               ; preds = %7
  %13 = icmp eq i8 %9, -1
  br i1 %13, label %14, label %20

14:                                               ; preds = %12
  %15 = icmp slt i64 %3, 3
  br i1 %15, label %.thread104, label %.thread

.thread:                                          ; preds = %14
  %16 = getelementptr inbounds i8, ptr %2, i64 3
  %17 = tail call zeroext i16 @MEM_readLE16(ptr noundef nonnull %8)
  %18 = zext i16 %17 to i32
  %19 = add nuw nsw i32 %18, 32512
  store i32 %19, ptr %1, align 4, !tbaa !8
  br label %31

20:                                               ; preds = %12
  %.not = icmp sgt i64 %3, 1
  br i1 %.not, label %21, label %.thread104

21:                                               ; preds = %20
  %22 = shl nuw nsw i32 %10, 8
  %23 = add nsw i32 %22, -32768
  %24 = getelementptr inbounds i8, ptr %2, i64 2
  %25 = load i8, ptr %8, align 1, !tbaa !5
  %26 = zext i8 %25 to i32
  %27 = or disjoint i32 %23, %26
  br label %28

28:                                               ; preds = %21, %7
  %.086 = phi i32 [ %27, %21 ], [ %10, %7 ]
  %.081 = phi ptr [ %24, %21 ], [ %8, %7 ]
  store i32 %.086, ptr %1, align 4, !tbaa !8
  %29 = icmp eq i32 %.086, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %28
  %.not99 = icmp eq ptr %.081, %5
  %spec.select = select i1 %.not99, i64 %3, i64 -20
  br label %.thread104

31:                                               ; preds = %.thread, %28
  %.081103 = phi ptr [ %16, %.thread ], [ %.081, %28 ]
  %.086102 = phi i32 [ %19, %.thread ], [ %.086, %28 ]
  %32 = getelementptr inbounds i8, ptr %.081103, i64 1
  %33 = icmp ugt ptr %32, %5
  br i1 %33, label %.thread104, label %34

34:                                               ; preds = %31
  %35 = load i8, ptr %.081103, align 1, !tbaa !5
  %36 = zext i8 %35 to i32
  %37 = and i32 %36, 3
  %.not95 = icmp eq i32 %37, 0
  br i1 %.not95, label %38, label %.thread104

38:                                               ; preds = %34
  %39 = lshr i32 %36, 6
  %40 = lshr exact i32 %36, 2
  %41 = and i32 %40, 3
  %42 = getelementptr inbounds i8, ptr %0, i64 32
  %43 = ptrtoint ptr %5 to i64
  %44 = ptrtoint ptr %32 to i64
  %45 = sub i64 %43, %44
  %46 = getelementptr inbounds i8, ptr %0, i64 30004
  %47 = load i32, ptr %46, align 4, !tbaa !10
  %48 = getelementptr inbounds i8, ptr %0, i64 30204
  %49 = load i32, ptr %48, align 4, !tbaa !20
  %50 = getelementptr inbounds i8, ptr %0, i64 27324
  %51 = tail call i32 @ZSTD_DCtx_get_bmi2(ptr noundef %0)
  %52 = tail call i64 @ZSTD_buildSeqTable(ptr noundef nonnull %42, ptr noundef %0, i32 noundef %39, i32 noundef 35, i32 noundef 9, ptr noundef nonnull %32, i64 noundef %45, ptr noundef nonnull @LL_base, ptr noundef nonnull @LL_bits, ptr noundef nonnull @LL_defaultDTable, i32 noundef %47, i32 noundef %49, i32 noundef %.086102, ptr noundef nonnull %50, i64 noundef 2560, i32 noundef %51)
  %53 = tail call i32 @ZSTD_isError(i64 noundef %52)
  %.not96 = icmp eq i32 %53, 0
  br i1 %.not96, label %54, label %.thread104

54:                                               ; preds = %38
  %55 = getelementptr inbounds i8, ptr %32, i64 %52
  %56 = lshr i32 %36, 4
  %57 = and i32 %56, 3
  %58 = getelementptr inbounds i8, ptr %0, i64 4136
  %59 = getelementptr inbounds i8, ptr %0, i64 16
  %60 = ptrtoint ptr %55 to i64
  %61 = sub i64 %43, %60
  %62 = load i32, ptr %46, align 4, !tbaa !10
  %63 = load i32, ptr %48, align 4, !tbaa !20
  %64 = tail call i32 @ZSTD_DCtx_get_bmi2(ptr noundef nonnull %0)
  %65 = tail call i64 @ZSTD_buildSeqTable(ptr noundef nonnull %58, ptr noundef nonnull %59, i32 noundef %57, i32 noundef 31, i32 noundef 8, ptr noundef nonnull %55, i64 noundef %61, ptr noundef nonnull @OF_base, ptr noundef nonnull @OF_bits, ptr noundef nonnull @OF_defaultDTable, i32 noundef %62, i32 noundef %63, i32 noundef %.086102, ptr noundef nonnull %50, i64 noundef 2560, i32 noundef %64)
  %66 = tail call i32 @ZSTD_isError(i64 noundef %65)
  %.not97 = icmp eq i32 %66, 0
  br i1 %.not97, label %67, label %.thread104

67:                                               ; preds = %54
  %68 = getelementptr inbounds i8, ptr %55, i64 %65
  %69 = getelementptr inbounds i8, ptr %0, i64 6192
  %70 = getelementptr inbounds i8, ptr %0, i64 8
  %71 = ptrtoint ptr %68 to i64
  %72 = sub i64 %43, %71
  %73 = load i32, ptr %46, align 4, !tbaa !10
  %74 = load i32, ptr %48, align 4, !tbaa !20
  %75 = tail call i32 @ZSTD_DCtx_get_bmi2(ptr noundef nonnull %0)
  %76 = tail call i64 @ZSTD_buildSeqTable(ptr noundef nonnull %69, ptr noundef nonnull %70, i32 noundef %41, i32 noundef 52, i32 noundef 9, ptr noundef nonnull %68, i64 noundef %72, ptr noundef nonnull @ML_base, ptr noundef nonnull @ML_bits, ptr noundef nonnull @ML_defaultDTable, i32 noundef %73, i32 noundef %74, i32 noundef %.086102, ptr noundef nonnull %50, i64 noundef 2560, i32 noundef %75)
  %77 = tail call i32 @ZSTD_isError(i64 noundef %76)
  %.not98 = icmp eq i32 %77, 0
  br i1 %.not98, label %78, label %.thread104

78:                                               ; preds = %67
  %79 = getelementptr inbounds i8, ptr %68, i64 %76
  %80 = ptrtoint ptr %79 to i64
  %81 = ptrtoint ptr %2 to i64
  %82 = sub i64 %80, %81
  br label %.thread104

.thread104:                                       ; preds = %30, %38, %54, %34, %31, %20, %14, %4, %67, %78
  %.4 = phi i64 [ %82, %78 ], [ -20, %67 ], [ -72, %4 ], [ -72, %14 ], [ -72, %20 ], [ -72, %31 ], [ -20, %34 ], [ -20, %54 ], [ -20, %38 ], [ %spec.select, %30 ]
  ret i64 %.4
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ZSTD_DCtx_get_bmi2(ptr noundef) local_unnamed_addr #1

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 = { inlinehint 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" }

!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}
!10 = !{!11, !9, i64 30004}
!11 = !{!"ZSTD_DCtx_s", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32, !6, i64 27324, !12, i64 29888, !12, i64 29896, !12, i64 29904, !12, i64 29912, !14, i64 29920, !15, i64 29928, !14, i64 29976, !14, i64 29984, !9, i64 29992, !9, i64 29996, !9, i64 30000, !9, i64 30004, !17, i64 30008, !14, i64 30096, !9, i64 30104, !9, i64 30108, !9, i64 30112, !12, i64 30120, !18, i64 30128, !14, i64 30152, !14, i64 30160, !14, i64 30168, !9, i64 30176, !9, i64 30180, !12, i64 30184, !12, i64 30192, !9, i64 30200, !9, i64 30204, !9, i64 30208, !12, i64 30216, !9, i64 30224, !9, i64 30228, !9, i64 30232, !9, i64 30236, !12, i64 30240, !14, i64 30248, !14, i64 30256, !14, i64 30264, !12, i64 30272, !14, i64 30280, !14, i64 30288, !14, i64 30296, !14, i64 30304, !9, i64 30312, !9, i64 30316, !9, i64 30320, !19, i64 30328, !12, i64 30352, !12, i64 30360, !9, i64 30368, !6, i64 30372, !6, i64 95940, !14, i64 95960}
!12 = !{!"any pointer", !6, i64 0}
!13 = !{!"", !6, i64 0, !6, i64 4104, !6, i64 6160, !6, i64 10264, !6, i64 26652, !6, i64 26664}
!14 = !{!"long", !6, i64 0}
!15 = !{!"", !16, i64 0, !16, i64 8, !9, i64 16, !9, i64 20, !9, i64 24, !9, i64 28, !9, i64 32, !9, i64 36, !9, i64 40}
!16 = !{!"long long", !6, i64 0}
!17 = !{!"XXH_NAMESPACEXXH64_state_s", !14, i64 0, !6, i64 8, !6, i64 40, !9, i64 72, !9, i64 76, !14, i64 80}
!18 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16}
!19 = !{!"ZSTD_outBuffer_s", !12, i64 0, !14, i64 8, !14, i64 16}
!20 = !{!11, !9, i64 30204}


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