; 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_outBuffer_s = type { ptr, i64, i64 }
%struct.ZSTD_inBuffer_s = type { ptr, i64, i64 }
%struct.ZSTD_CCtx_s = type { i32, i32, i32, %struct.ZSTD_CCtx_params_s, %struct.ZSTD_CCtx_params_s, %struct.ZSTD_CCtx_params_s, i32, i64, %struct.ZSTD_cwksp, i64, i64, i64, i64, %struct.XXH_NAMESPACEXXH64_state_s, %struct.ZSTD_customMem, ptr, i64, %struct.SeqCollector, i32, i32, %struct.seqStore_t, %struct.ldmState_t, ptr, i64, %struct.rawSeqStore_t, %struct.ZSTD_blockState_t, ptr, i32, ptr, i64, i64, i64, i64, ptr, i64, i64, i64, i32, i32, %struct.ZSTD_inBuffer_s, i64, i64, %struct.ZSTD_localDict, ptr, %struct.ZSTD_prefixDict_s, ptr, %struct.ZSTD_blockSplitCtx, ptr, i64 }
%struct.ZSTD_CCtx_params_s = type { i32, %struct.ZSTD_compressionParameters, %struct.ZSTD_frameParameters, i32, i32, i64, i32, i32, i32, i32, i64, i32, i32, %struct.ldmParams_t, i32, i32, i32, i32, i32, i32, i32, i32, %struct.ZSTD_customMem, i32, i32, ptr, ptr, i64, i32 }
%struct.ZSTD_compressionParameters = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.ZSTD_frameParameters = type { i32, i32, i32 }
%struct.ldmParams_t = type { i32, i32, i32, i32, i32, i32 }
%struct.ZSTD_cwksp = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, 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.SeqCollector = type { i32, ptr, i64, i64 }
%struct.seqStore_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i32, i32 }
%struct.ldmState_t = type { %struct.ZSTD_window_t, ptr, i32, ptr, [64 x i64], [64 x %struct.ldmMatchCandidate_t] }
%struct.ZSTD_window_t = type { ptr, ptr, ptr, i32, i32, i32 }
%struct.ldmMatchCandidate_t = type { ptr, i32, i32, ptr }
%struct.rawSeqStore_t = type { ptr, i64, i64, i64, i64 }
%struct.ZSTD_blockState_t = type { ptr, ptr, %struct.ZSTD_matchState_t }
%struct.ZSTD_matchState_t = type { %struct.ZSTD_window_t, i32, i32, i32, i32, ptr, [8 x i32], i64, i32, ptr, ptr, ptr, i32, i32, %struct.optState_t, ptr, %struct.ZSTD_compressionParameters, ptr, i32, i32 }
%struct.optState_t = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32 }
%struct.ZSTD_localDict = type { ptr, ptr, i64, i32, ptr }
%struct.ZSTD_prefixDict_s = type { ptr, i64, i32 }
%struct.ZSTD_blockSplitCtx = type { %struct.seqStore_t, %struct.seqStore_t, %struct.seqStore_t, %struct.seqStore_t, %struct.seqStore_t, [196 x i32], %struct.ZSTD_entropyCTablesMetadata_t }
%struct.ZSTD_entropyCTablesMetadata_t = type { %struct.ZSTD_hufCTablesMetadata_t, %struct.ZSTD_fseCTablesMetadata_t }
%struct.ZSTD_hufCTablesMetadata_t = type { i32, [128 x i8], i64 }
%struct.ZSTD_fseCTablesMetadata_t = type { i32, i32, i32, [133 x i8], i64, i64 }

; 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 i32 @ZSTD_isError(i64 noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_compressStream2(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = 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 i32 %3, ptr %9, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %4
  br label %21

21:                                               ; preds = %20
  br label %22

22:                                               ; preds = %21
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %23, i32 0, i32 2
  %25 = load i64, ptr %24, align 8, !tbaa !11
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %26, i32 0, i32 1
  %28 = load i64, ptr %27, align 8, !tbaa !14
  %29 = icmp ugt i64 %25, %28
  br i1 %29, label %30, label %39

30:                                               ; preds = %22
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  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
  store i64 -70, ptr %5, align 8
  br label %452

39:                                               ; preds = %22
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %42, i32 0, i32 2
  %44 = load i64, ptr %43, align 8, !tbaa !15
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %45, i32 0, i32 1
  %47 = load i64, ptr %46, align 8, !tbaa !17
  %48 = icmp ugt i64 %44, %47
  br i1 %48, label %49, label %58

49:                                               ; preds = %41
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  store i64 -72, ptr %5, align 8
  br label %452

58:                                               ; preds = %41
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = icmp ugt i32 %61, 2
  br i1 %62, label %63, label %72

63:                                               ; preds = %60
  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
  store i64 -42, ptr %5, align 8
  br label %452

72:                                               ; preds = %60
  br label %73

73:                                               ; preds = %72
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %74, i32 0, i32 37
  %76 = load i32, ptr %75, align 8, !tbaa !18
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %215

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %79, i32 0, i32 1
  %81 = load i64, ptr %80, align 8, !tbaa !17
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %82, i32 0, i32 2
  %84 = load i64, ptr %83, align 8, !tbaa !15
  %85 = sub i64 %81, %84
  store i64 %85, ptr %10, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %86 = load i64, ptr %10, align 8, !tbaa !42
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %87, i32 0, i32 40
  %89 = load i64, ptr %88, align 8, !tbaa !43
  %90 = add i64 %86, %89
  store i64 %90, ptr %11, align 8, !tbaa !42
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %91, i32 0, i32 3
  %93 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %92, i32 0, i32 15
  %94 = load i32, ptr %93, align 4, !tbaa !44
  %95 = icmp eq i32 %94, 1
  br i1 %95, label %96, label %180

96:                                               ; preds = %78
  %97 = load i32, ptr %9, align 4, !tbaa !9
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %180

99:                                               ; preds = %96
  %100 = load i64, ptr %11, align 8, !tbaa !42
  %101 = icmp ult i64 %100, 131072
  br i1 %101, label %102, label %180

102:                                              ; preds = %99
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %103, i32 0, i32 40
  %105 = load i64, ptr %104, align 8, !tbaa !43
  %106 = icmp ne i64 %105, 0
  br i1 %106, label %107, label %158

107:                                              ; preds = %102
  br label %108

108:                                              ; preds = %107
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !45
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %112, i32 0, i32 39
  %114 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !46
  %116 = icmp ne ptr %111, %115
  br i1 %116, label %117, label %130

117:                                              ; preds = %108
  br label %118

118:                                              ; preds = %117
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121
  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
  store i64 -50, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %212

130:                                              ; preds = %108
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  %134 = load ptr, ptr %8, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %134, i32 0, i32 2
  %136 = load i64, ptr %135, align 8, !tbaa !15
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %137, i32 0, i32 39
  %139 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %138, i32 0, i32 1
  %140 = load i64, ptr %139, align 8, !tbaa !47
  %141 = icmp ne i64 %136, %140
  br i1 %141, label %142, label %155

142:                                              ; preds = %133
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  br label %147

147:                                              ; preds = %146
  br label %148

148:                                              ; preds = %147
  br label %149

149:                                              ; preds = %148
  br label %150

150:                                              ; preds = %149
  br label %151

151:                                              ; preds = %150
  br label %152

152:                                              ; preds = %151
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153
  store i64 -50, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %212

155:                                              ; preds = %133
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157, %102
  %159 = load ptr, ptr %8, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %159, i32 0, i32 1
  %161 = load i64, ptr %160, align 8, !tbaa !17
  %162 = load ptr, ptr %8, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %162, i32 0, i32 2
  store i64 %161, ptr %163, align 8, !tbaa !15
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %164, i32 0, i32 39
  %166 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %165, ptr align 8 %166, i64 24, i1 false), !tbaa.struct !48
  %167 = load i64, ptr %10, align 8, !tbaa !42
  %168 = load ptr, ptr %6, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %168, i32 0, i32 40
  %170 = load i64, ptr %169, align 8, !tbaa !43
  %171 = add i64 %170, %167
  store i64 %171, ptr %169, align 8, !tbaa !43
  %172 = load ptr, ptr %6, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %172, i32 0, i32 3
  %174 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %173, i32 0, i32 0
  %175 = load i32, ptr %174, align 8, !tbaa !49
  %176 = icmp eq i32 %175, 0
  %177 = zext i1 %176 to i64
  %178 = select i1 %176, i32 6, i32 2
  %179 = sext i32 %178 to i64
  store i64 %179, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %212

180:                                              ; preds = %99, %96, %78
  br label %181

181:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = load i32, ptr %9, align 4, !tbaa !9
  %184 = load i64, ptr %11, align 8, !tbaa !42
  %185 = call i64 @ZSTD_CCtx_init_compressStream2(ptr noundef %182, i32 noundef %183, i64 noundef %184)
  store i64 %185, ptr %13, align 8, !tbaa !42
  %186 = load i64, ptr %13, align 8, !tbaa !42
  %187 = call i32 @ERR_isError(i64 noundef %186)
  %188 = icmp ne i32 %187, 0
  br i1 %188, label %189, label %203

189:                                              ; preds = %181
  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
  br label %201

201:                                              ; preds = %200
  %202 = load i64, ptr %13, align 8, !tbaa !42
  store i64 %202, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %204

203:                                              ; preds = %181
  store i32 0, ptr %12, align 4
  br label %204

204:                                              ; preds = %203, %201
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %205 = load i32, ptr %12, align 4
  switch i32 %205, label %212 [
    i32 0, label %206
  ]

206:                                              ; preds = %204
  br label %207

207:                                              ; preds = %206
  br label %208

208:                                              ; preds = %207
  %209 = load ptr, ptr %6, align 8, !tbaa !5
  %210 = load ptr, ptr %7, align 8, !tbaa !5
  %211 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ZSTD_setBufferExpectations(ptr noundef %209, ptr noundef %210, ptr noundef %211)
  store i32 0, ptr %12, align 4
  br label %212

212:                                              ; preds = %208, %204, %158, %154, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %213 = load i32, ptr %12, align 4
  switch i32 %213, label %454 [
    i32 0, label %214
    i32 1, label %452
  ]

214:                                              ; preds = %212
  br label %215

215:                                              ; preds = %214, %73
  br label %216

216:                                              ; preds = %215
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %217 = load ptr, ptr %6, align 8, !tbaa !5
  %218 = load ptr, ptr %7, align 8, !tbaa !5
  %219 = load ptr, ptr %8, align 8, !tbaa !5
  %220 = load i32, ptr %9, align 4, !tbaa !9
  %221 = call i64 @ZSTD_checkBufferStability(ptr noundef %217, ptr noundef %218, ptr noundef %219, i32 noundef %220)
  store i64 %221, ptr %14, align 8, !tbaa !42
  %222 = load i64, ptr %14, align 8, !tbaa !42
  %223 = call i32 @ERR_isError(i64 noundef %222)
  %224 = icmp ne i32 %223, 0
  br i1 %224, label %225, label %239

225:                                              ; preds = %216
  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 %14, align 8, !tbaa !42
  store i64 %238, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %240

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

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

242:                                              ; preds = %240
  br label %243

243:                                              ; preds = %242
  %244 = load ptr, ptr %6, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %244, i32 0, i32 4
  %246 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %245, i32 0, i32 9
  %247 = load i32, ptr %246, align 4, !tbaa !50
  %248 = icmp sgt i32 %247, 0
  br i1 %248, label %249, label %411

249:                                              ; preds = %243
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %250 = load ptr, ptr %6, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %250, i32 0, i32 1
  %252 = load i32, ptr %251, align 4, !tbaa !51
  %253 = icmp ne i32 %252, 0
  br i1 %253, label %254, label %262

254:                                              ; preds = %249
  %255 = load ptr, ptr %6, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %255, i32 0, i32 45
  %257 = load ptr, ptr %256, align 8, !tbaa !52
  %258 = load ptr, ptr %6, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %258, i32 0, i32 3
  call void @ZSTDMT_updateCParams_whileCompressing(ptr noundef %257, ptr noundef %259)
  %260 = load ptr, ptr %6, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %260, i32 0, i32 1
  store i32 0, ptr %261, align 4, !tbaa !51
  br label %262

262:                                              ; preds = %254, %249
  %263 = load ptr, ptr %6, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %263, i32 0, i32 40
  %265 = load i64, ptr %264, align 8, !tbaa !43
  %266 = icmp ne i64 %265, 0
  br i1 %266, label %267, label %277

267:                                              ; preds = %262
  %268 = load ptr, ptr %6, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %268, i32 0, i32 40
  %270 = load i64, ptr %269, align 8, !tbaa !43
  %271 = load ptr, ptr %8, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %271, i32 0, i32 2
  %273 = load i64, ptr %272, align 8, !tbaa !15
  %274 = sub i64 %273, %270
  store i64 %274, ptr %272, align 8, !tbaa !15
  %275 = load ptr, ptr %6, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %275, i32 0, i32 40
  store i64 0, ptr %276, align 8, !tbaa !43
  br label %277

277:                                              ; preds = %267, %262
  br label %278

278:                                              ; preds = %401, %277
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %279 = load ptr, ptr %8, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %279, i32 0, i32 2
  %281 = load i64, ptr %280, align 8, !tbaa !15
  store i64 %281, ptr %16, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %282 = load ptr, ptr %7, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %282, i32 0, i32 2
  %284 = load i64, ptr %283, align 8, !tbaa !11
  store i64 %284, ptr %17, align 8, !tbaa !42
  %285 = load ptr, ptr %6, align 8, !tbaa !5
  %286 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %285, i32 0, i32 45
  %287 = load ptr, ptr %286, align 8, !tbaa !52
  %288 = load ptr, ptr %7, align 8, !tbaa !5
  %289 = load ptr, ptr %8, align 8, !tbaa !5
  %290 = load i32, ptr %9, align 4, !tbaa !9
  %291 = call i64 @ZSTDMT_compressStream_generic(ptr noundef %287, ptr noundef %288, ptr noundef %289, i32 noundef %290)
  store i64 %291, ptr %15, align 8, !tbaa !42
  %292 = load ptr, ptr %8, align 8, !tbaa !5
  %293 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %292, i32 0, i32 2
  %294 = load i64, ptr %293, align 8, !tbaa !15
  %295 = load i64, ptr %16, align 8, !tbaa !42
  %296 = sub i64 %294, %295
  %297 = load ptr, ptr %6, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %297, i32 0, i32 11
  %299 = load i64, ptr %298, align 8, !tbaa !53
  %300 = add i64 %299, %296
  store i64 %300, ptr %298, align 8, !tbaa !53
  %301 = load ptr, ptr %7, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %301, i32 0, i32 2
  %303 = load i64, ptr %302, align 8, !tbaa !11
  %304 = load i64, ptr %17, align 8, !tbaa !42
  %305 = sub i64 %303, %304
  %306 = load ptr, ptr %6, align 8, !tbaa !5
  %307 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %306, i32 0, i32 12
  %308 = load i64, ptr %307, align 8, !tbaa !54
  %309 = add i64 %308, %305
  store i64 %309, ptr %307, align 8, !tbaa !54
  %310 = load i64, ptr %15, align 8, !tbaa !42
  %311 = call i32 @ZSTD_isError(i64 noundef %310)
  %312 = icmp ne i32 %311, 0
  br i1 %312, label %319, label %313

313:                                              ; preds = %278
  %314 = load i32, ptr %9, align 4, !tbaa !9
  %315 = icmp eq i32 %314, 2
  br i1 %315, label %316, label %327

316:                                              ; preds = %313
  %317 = load i64, ptr %15, align 8, !tbaa !42
  %318 = icmp eq i64 %317, 0
  br i1 %318, label %319, label %327

319:                                              ; preds = %316, %278
  %320 = load i64, ptr %15, align 8, !tbaa !42
  %321 = icmp eq i64 %320, 0
  br i1 %321, label %322, label %324

322:                                              ; preds = %319
  %323 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ZSTD_CCtx_trace(ptr noundef %323, i64 noundef 0)
  br label %324

324:                                              ; preds = %322, %319
  %325 = load ptr, ptr %6, align 8, !tbaa !5
  %326 = call i64 @ZSTD_CCtx_reset(ptr noundef %325, i32 noundef 1)
  br label %327

327:                                              ; preds = %324, %316, %313
  br label %328

328:                                              ; preds = %327
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %329 = load i64, ptr %15, align 8, !tbaa !42
  store i64 %329, ptr %18, align 8, !tbaa !42
  %330 = load i64, ptr %18, align 8, !tbaa !42
  %331 = call i32 @ERR_isError(i64 noundef %330)
  %332 = icmp ne i32 %331, 0
  br i1 %332, label %333, label %347

333:                                              ; preds = %328
  br label %334

334:                                              ; preds = %333
  br label %335

335:                                              ; preds = %334
  br label %336

336:                                              ; preds = %335
  br label %337

337:                                              ; preds = %336
  br label %338

338:                                              ; preds = %337
  br label %339

339:                                              ; preds = %338
  br label %340

340:                                              ; preds = %339
  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
  %346 = load i64, ptr %18, align 8, !tbaa !42
  store i64 %346, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %348

347:                                              ; preds = %328
  store i32 0, ptr %12, align 4
  br label %348

348:                                              ; preds = %347, %345
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  %349 = load i32, ptr %12, align 4
  switch i32 %349, label %399 [
    i32 0, label %350
  ]

350:                                              ; preds = %348
  br label %351

351:                                              ; preds = %350
  br label %352

352:                                              ; preds = %351
  %353 = load i32, ptr %9, align 4, !tbaa !9
  %354 = icmp eq i32 %353, 0
  br i1 %354, label %355, label %385

355:                                              ; preds = %352
  %356 = load ptr, ptr %8, align 8, !tbaa !5
  %357 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %356, i32 0, i32 2
  %358 = load i64, ptr %357, align 8, !tbaa !15
  %359 = load i64, ptr %16, align 8, !tbaa !42
  %360 = icmp ne i64 %358, %359
  br i1 %360, label %383, label %361

361:                                              ; preds = %355
  %362 = load ptr, ptr %7, align 8, !tbaa !5
  %363 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %362, i32 0, i32 2
  %364 = load i64, ptr %363, align 8, !tbaa !11
  %365 = load i64, ptr %17, align 8, !tbaa !42
  %366 = icmp ne i64 %364, %365
  br i1 %366, label %383, label %367

367:                                              ; preds = %361
  %368 = load ptr, ptr %8, align 8, !tbaa !5
  %369 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %368, i32 0, i32 2
  %370 = load i64, ptr %369, align 8, !tbaa !15
  %371 = load ptr, ptr %8, align 8, !tbaa !5
  %372 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %371, i32 0, i32 1
  %373 = load i64, ptr %372, align 8, !tbaa !17
  %374 = icmp eq i64 %370, %373
  br i1 %374, label %383, label %375

375:                                              ; preds = %367
  %376 = load ptr, ptr %7, align 8, !tbaa !5
  %377 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %376, i32 0, i32 2
  %378 = load i64, ptr %377, align 8, !tbaa !11
  %379 = load ptr, ptr %7, align 8, !tbaa !5
  %380 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %379, i32 0, i32 1
  %381 = load i64, ptr %380, align 8, !tbaa !14
  %382 = icmp eq i64 %378, %381
  br i1 %382, label %383, label %384

383:                                              ; preds = %375, %367, %361, %355
  store i32 74, ptr %12, align 4
  br label %399

384:                                              ; preds = %375
  br label %398

385:                                              ; preds = %352
  %386 = load i64, ptr %15, align 8, !tbaa !42
  %387 = icmp eq i64 %386, 0
  br i1 %387, label %396, label %388

388:                                              ; preds = %385
  %389 = load ptr, ptr %7, align 8, !tbaa !5
  %390 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %389, i32 0, i32 2
  %391 = load i64, ptr %390, align 8, !tbaa !11
  %392 = load ptr, ptr %7, align 8, !tbaa !5
  %393 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %392, i32 0, i32 1
  %394 = load i64, ptr %393, align 8, !tbaa !14
  %395 = icmp eq i64 %391, %394
  br i1 %395, label %396, label %397

396:                                              ; preds = %388, %385
  store i32 74, ptr %12, align 4
  br label %399

397:                                              ; preds = %388
  br label %398

398:                                              ; preds = %397, %384
  store i32 0, ptr %12, align 4
  br label %399

399:                                              ; preds = %398, %396, %383, %348
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  %400 = load i32, ptr %12, align 4
  switch i32 %400, label %410 [
    i32 0, label %401
    i32 74, label %402
  ]

401:                                              ; preds = %399
  br label %278

402:                                              ; preds = %399
  br label %403

403:                                              ; preds = %402
  br label %404

404:                                              ; preds = %403
  br label %405

405:                                              ; preds = %404
  %406 = load ptr, ptr %6, align 8, !tbaa !5
  %407 = load ptr, ptr %7, align 8, !tbaa !5
  %408 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ZSTD_setBufferExpectations(ptr noundef %406, ptr noundef %407, ptr noundef %408)
  %409 = load i64, ptr %15, align 8, !tbaa !42
  store i64 %409, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %410

410:                                              ; preds = %405, %399
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %452

411:                                              ; preds = %243
  br label %412

412:                                              ; preds = %411
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %413 = load ptr, ptr %6, align 8, !tbaa !5
  %414 = load ptr, ptr %7, align 8, !tbaa !5
  %415 = load ptr, ptr %8, align 8, !tbaa !5
  %416 = load i32, ptr %9, align 4, !tbaa !9
  %417 = call i64 @ZSTD_compressStream_generic(ptr noundef %413, ptr noundef %414, ptr noundef %415, i32 noundef %416)
  store i64 %417, ptr %19, align 8, !tbaa !42
  %418 = load i64, ptr %19, align 8, !tbaa !42
  %419 = call i32 @ERR_isError(i64 noundef %418)
  %420 = icmp ne i32 %419, 0
  br i1 %420, label %421, label %435

421:                                              ; preds = %412
  br label %422

422:                                              ; preds = %421
  br label %423

423:                                              ; preds = %422
  br label %424

424:                                              ; preds = %423
  br label %425

425:                                              ; preds = %424
  br label %426

426:                                              ; preds = %425
  br label %427

427:                                              ; preds = %426
  br label %428

428:                                              ; preds = %427
  br label %429

429:                                              ; preds = %428
  br label %430

430:                                              ; preds = %429
  br label %431

431:                                              ; preds = %430
  br label %432

432:                                              ; preds = %431
  br label %433

433:                                              ; preds = %432
  %434 = load i64, ptr %19, align 8, !tbaa !42
  store i64 %434, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %436

435:                                              ; preds = %412
  store i32 0, ptr %12, align 4
  br label %436

436:                                              ; preds = %435, %433
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  %437 = load i32, ptr %12, align 4
  switch i32 %437, label %454 [
    i32 0, label %438
    i32 1, label %452
  ]

438:                                              ; preds = %436
  br label %439

439:                                              ; preds = %438
  br label %440

440:                                              ; preds = %439
  br label %441

441:                                              ; preds = %440
  %442 = load ptr, ptr %6, align 8, !tbaa !5
  %443 = load ptr, ptr %7, align 8, !tbaa !5
  %444 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ZSTD_setBufferExpectations(ptr noundef %442, ptr noundef %443, ptr noundef %444)
  %445 = load ptr, ptr %6, align 8, !tbaa !5
  %446 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %445, i32 0, i32 35
  %447 = load i64, ptr %446, align 8, !tbaa !55
  %448 = load ptr, ptr %6, align 8, !tbaa !5
  %449 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %448, i32 0, i32 36
  %450 = load i64, ptr %449, align 8, !tbaa !56
  %451 = sub i64 %447, %450
  store i64 %451, ptr %5, align 8
  br label %452

452:                                              ; preds = %441, %436, %410, %240, %212, %71, %57, %38
  %453 = load i64, ptr %5, align 8
  ret i64 %453

454:                                              ; preds = %436, %240, %212
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare hidden void @ZSTD_setBufferExpectations(ptr noundef, ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @ZSTDMT_updateCParams_whileCompressing(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden i64 @ZSTD_compressStream_generic(ptr noundef, ptr noundef, ptr noundef, i32 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 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"ZSTD_outBuffer_s", !6, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!16, !13, i64 16}
!16 = !{!"ZSTD_inBuffer_s", !6, i64 0, !13, i64 8, !13, i64 16}
!17 = !{!16, !13, i64 8}
!18 = !{!19, !10, i64 3608}
!19 = !{!"ZSTD_CCtx_s", !10, i64 0, !10, i64 4, !10, i64 8, !20, i64 16, !20, i64 232, !20, i64 448, !10, i64 664, !13, i64 672, !25, i64 680, !13, i64 752, !26, i64 760, !26, i64 768, !26, i64 776, !27, i64 784, !24, i64 872, !6, i64 896, !13, i64 904, !28, i64 912, !10, i64 944, !10, i64 948, !29, i64 952, !30, i64 1032, !6, i64 3144, !13, i64 3152, !32, i64 3160, !33, i64 3200, !6, i64 3520, !10, i64 3528, !6, i64 3536, !13, i64 3544, !13, i64 3552, !13, i64 3560, !13, i64 3568, !6, i64 3576, !13, i64 3584, !13, i64 3592, !13, i64 3600, !10, i64 3608, !10, i64 3612, !16, i64 3616, !13, i64 3640, !13, i64 3648, !36, i64 3656, !6, i64 3696, !37, i64 3704, !6, i64 3728, !38, i64 3736, !6, i64 5232, !13, i64 5240}
!20 = !{!"ZSTD_CCtx_params_s", !10, i64 0, !21, i64 4, !22, i64 32, !10, i64 44, !10, i64 48, !13, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !13, i64 80, !10, i64 88, !10, i64 92, !23, i64 96, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !24, i64 152, !10, i64 176, !10, i64 180, !6, i64 184, !6, i64 192, !13, i64 200, !10, i64 208}
!21 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!22 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8}
!23 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!24 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !10, i64 60, !10, i64 64, !10, i64 68}
!26 = !{!"long long", !7, i64 0}
!27 = !{!"XXH_NAMESPACEXXH64_state_s", !13, i64 0, !7, i64 8, !7, i64 40, !10, i64 72, !10, i64 76, !13, i64 80}
!28 = !{!"", !10, i64 0, !6, i64 8, !13, i64 16, !13, i64 24}
!29 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !13, i64 64, !10, i64 72, !10, i64 76}
!30 = !{!"", !31, i64 0, !6, i64 40, !10, i64 48, !6, i64 56, !7, i64 64, !7, i64 576}
!31 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32}
!32 = !{!"", !6, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!33 = !{!"", !6, i64 0, !6, i64 8, !34, i64 16}
!34 = !{!"ZSTD_matchState_t", !31, i64 0, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !6, i64 56, !7, i64 64, !13, i64 96, !10, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !10, i64 136, !10, i64 140, !35, i64 144, !6, i64 248, !21, i64 256, !6, i64 288, !10, i64 296, !10, i64 300}
!35 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !6, i64 88, !10, i64 96}
!36 = !{!"", !6, i64 0, !6, i64 8, !13, i64 16, !10, i64 24, !6, i64 32}
!37 = !{!"ZSTD_prefixDict_s", !6, i64 0, !13, i64 8, !10, i64 16}
!38 = !{!"", !29, i64 0, !29, i64 80, !29, i64 160, !29, i64 240, !29, i64 320, !7, i64 400, !39, i64 1184}
!39 = !{!"", !40, i64 0, !41, i64 144}
!40 = !{!"", !10, i64 0, !7, i64 4, !13, i64 136}
!41 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !13, i64 152, !13, i64 160}
!42 = !{!13, !13, i64 0}
!43 = !{!19, !13, i64 3640}
!44 = !{!19, !10, i64 140}
!45 = !{!16, !6, i64 0}
!46 = !{!19, !6, i64 3616}
!47 = !{!19, !13, i64 3624}
!48 = !{i64 0, i64 8, !5, i64 8, i64 8, !42, i64 16, i64 8, !42}
!49 = !{!19, !10, i64 16}
!50 = !{!19, !10, i64 308}
!51 = !{!19, !10, i64 4}
!52 = !{!19, !6, i64 3728}
!53 = !{!19, !26, i64 768}
!54 = !{!19, !26, i64 776}
!55 = !{!19, !13, i64 3592}
!56 = !{!19, !13, i64 3600}


; 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 i32 @ZSTD_isError(i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_compressStream2(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = load i64, ptr %7, align 8, !tbaa !11
  %9 = icmp ugt i64 %6, %8
  br i1 %9, label %.thread, label %10

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %2, i64 16
  %12 = load i64, ptr %11, align 8, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  %14 = load i64, ptr %13, align 8, !tbaa !14
  %15 = icmp ugt i64 %12, %14
  br i1 %15, label %.thread, label %16

16:                                               ; preds = %10
  %17 = icmp ugt i32 %3, 2
  br i1 %17, label %.thread, label %18

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %0, i64 3608
  %20 = load i32, ptr %19, align 8, !tbaa !15
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %50

22:                                               ; preds = %18
  %23 = sub i64 %14, %12
  %24 = getelementptr inbounds i8, ptr %0, i64 3640
  %25 = load i64, ptr %24, align 8, !tbaa !40
  %26 = add i64 %25, %23
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = getelementptr inbounds i8, ptr %0, i64 140
  %29 = load i32, ptr %28, align 4, !tbaa !41
  %30 = icmp eq i32 %29, 1
  %31 = icmp eq i32 %3, 0
  %or.cond = and i1 %31, %30
  %32 = icmp ult i64 %26, 131072
  %or.cond4 = select i1 %or.cond, i1 %32, i1 false
  br i1 %or.cond4, label %33, label %46

33:                                               ; preds = %22
  %.not119 = icmp eq i64 %25, 0
  br i1 %.not119, label %41, label %34

34:                                               ; preds = %33
  %35 = load ptr, ptr %2, align 8, !tbaa !42
  %36 = getelementptr inbounds i8, ptr %0, i64 3616
  %37 = load ptr, ptr %36, align 8, !tbaa !43
  %.not120 = icmp eq ptr %35, %37
  br i1 %.not120, label %38, label %.thread

38:                                               ; preds = %34
  %39 = getelementptr inbounds i8, ptr %0, i64 3624
  %40 = load i64, ptr %39, align 8, !tbaa !44
  %.not121 = icmp eq i64 %12, %40
  br i1 %.not121, label %41, label %.thread

41:                                               ; preds = %38, %33
  store i64 %14, ptr %11, align 8, !tbaa !12
  %42 = getelementptr inbounds i8, ptr %0, i64 3616
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %42, ptr noundef nonnull align 8 dereferenceable(24) %2, i64 24, i1 false), !tbaa.struct !45
  store i64 %26, ptr %24, align 8, !tbaa !40
  %43 = load i32, ptr %27, align 8, !tbaa !48
  %44 = icmp eq i32 %43, 0
  %45 = select i1 %44, i64 6, i64 2
  br label %.thread

46:                                               ; preds = %22
  %47 = tail call i64 @ZSTD_CCtx_init_compressStream2(ptr noundef nonnull %0, i32 noundef %3, i64 noundef %26)
  %48 = tail call i32 @ERR_isError(i64 noundef %47)
  %.not = icmp eq i32 %48, 0
  br i1 %.not, label %49, label %.thread

49:                                               ; preds = %46
  tail call void @ZSTD_setBufferExpectations(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2)
  br label %50

50:                                               ; preds = %49, %18
  %51 = tail call i64 @ZSTD_checkBufferStability(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef %3)
  %52 = tail call i32 @ERR_isError(i64 noundef %51)
  %.not122.not = icmp eq i32 %52, 0
  br i1 %.not122.not, label %53, label %.thread

53:                                               ; preds = %50
  %54 = getelementptr inbounds i8, ptr %0, i64 308
  %55 = load i32, ptr %54, align 4, !tbaa !49
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %57, label %155

57:                                               ; preds = %53
  %58 = getelementptr inbounds i8, ptr %0, i64 4
  %59 = load i32, ptr %58, align 4, !tbaa !50
  %.not124 = icmp eq i32 %59, 0
  br i1 %.not124, label %64, label %60

60:                                               ; preds = %57
  %61 = getelementptr inbounds i8, ptr %0, i64 3728
  %62 = load ptr, ptr %61, align 8, !tbaa !51
  %63 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @ZSTDMT_updateCParams_whileCompressing(ptr noundef %62, ptr noundef nonnull %63)
  store i32 0, ptr %58, align 4, !tbaa !50
  br label %64

64:                                               ; preds = %60, %57
  %65 = getelementptr inbounds i8, ptr %0, i64 3640
  %66 = load i64, ptr %65, align 8, !tbaa !40
  %.not125 = icmp eq i64 %66, 0
  br i1 %.not125, label %70, label %67

67:                                               ; preds = %64
  %68 = load i64, ptr %11, align 8, !tbaa !12
  %69 = sub i64 %68, %66
  store i64 %69, ptr %11, align 8, !tbaa !12
  store i64 0, ptr %65, align 8, !tbaa !40
  br label %70

70:                                               ; preds = %67, %64
  %71 = getelementptr inbounds i8, ptr %0, i64 3728
  %72 = getelementptr inbounds i8, ptr %0, i64 768
  %73 = getelementptr inbounds i8, ptr %0, i64 776
  %74 = icmp eq i32 %3, 2
  %75 = icmp eq i32 %3, 0
  br i1 %75, label %.split.us.preheader, label %.split

.split.us.preheader:                              ; preds = %70
  %.pre168 = load i64, ptr %11, align 8, !tbaa !12
  %.pre169 = load i64, ptr %5, align 8, !tbaa !5
  br label %.split.us

.split.us:                                        ; preds = %.split.us.preheader, %101
  %76 = load ptr, ptr %71, align 8, !tbaa !51
  %77 = tail call i64 @ZSTDMT_compressStream_generic(ptr noundef %76, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef 0)
  %78 = load i64, ptr %11, align 8, !tbaa !12
  %79 = sub i64 %78, %.pre168
  %80 = load i64, ptr %72, align 8, !tbaa !52
  %81 = add i64 %79, %80
  store i64 %81, ptr %72, align 8, !tbaa !52
  %82 = load i64, ptr %5, align 8, !tbaa !5
  %83 = sub i64 %82, %.pre169
  %84 = load i64, ptr %73, align 8, !tbaa !53
  %85 = add i64 %83, %84
  store i64 %85, ptr %73, align 8, !tbaa !53
  %86 = tail call i32 @ZSTD_isError(i64 noundef %77)
  %.not126.us = icmp eq i32 %86, 0
  %87 = icmp eq i64 %77, 0
  br i1 %.not126.us, label %89, label %88

88:                                               ; preds = %.split.us
  br i1 %87, label %.thread136.us, label %90

89:                                               ; preds = %.split.us
  %or.cond6.us = and i1 %74, %87
  br i1 %or.cond6.us, label %.thread136.us, label %92

.thread136.us:                                    ; preds = %89, %88
  tail call void @ZSTD_CCtx_trace(ptr noundef nonnull %0, i64 noundef 0)
  br label %90

90:                                               ; preds = %.thread136.us, %88
  %91 = tail call i64 @ZSTD_CCtx_reset(ptr noundef nonnull %0, i32 noundef 1)
  br label %92

92:                                               ; preds = %90, %89
  %93 = tail call i32 @ERR_isError(i64 noundef %77)
  %.not127.us = icmp eq i32 %93, 0
  br i1 %.not127.us, label %94, label %.thread

94:                                               ; preds = %92
  %95 = load i64, ptr %11, align 8, !tbaa !12
  %.not128.us = icmp eq i64 %95, %.pre168
  br i1 %.not128.us, label %96, label %.split145.us

96:                                               ; preds = %94
  %97 = load i64, ptr %5, align 8, !tbaa !5
  %.not129.us = icmp eq i64 %97, %.pre169
  br i1 %.not129.us, label %98, label %.split145.us

98:                                               ; preds = %96
  %99 = load i64, ptr %13, align 8, !tbaa !14
  %100 = icmp eq i64 %.pre168, %99
  br i1 %100, label %.split145.us, label %101

101:                                              ; preds = %98
  %102 = load i64, ptr %7, align 8, !tbaa !11
  %103 = icmp eq i64 %.pre169, %102
  br i1 %103, label %.split145.us, label %.split.us

.split:                                           ; preds = %70
  %.pre167 = load i64, ptr %5, align 8, !tbaa !5
  br i1 %74, label %.split.split, label %.split.split.us

.split.split.us:                                  ; preds = %.split, %125
  %104 = phi i64 [ %126, %125 ], [ %.pre167, %.split ]
  %105 = load i64, ptr %11, align 8, !tbaa !12
  %106 = load ptr, ptr %71, align 8, !tbaa !51
  %107 = tail call i64 @ZSTDMT_compressStream_generic(ptr noundef %106, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef %3)
  %108 = load i64, ptr %11, align 8, !tbaa !12
  %109 = sub i64 %108, %105
  %110 = load i64, ptr %72, align 8, !tbaa !52
  %111 = add i64 %109, %110
  store i64 %111, ptr %72, align 8, !tbaa !52
  %112 = load i64, ptr %5, align 8, !tbaa !5
  %113 = sub i64 %112, %104
  %114 = load i64, ptr %73, align 8, !tbaa !53
  %115 = add i64 %113, %114
  store i64 %115, ptr %73, align 8, !tbaa !53
  %116 = tail call i32 @ZSTD_isError(i64 noundef %107)
  %.not126.us151 = icmp eq i32 %116, 0
  br i1 %.not126.us151, label %121, label %117

117:                                              ; preds = %.split.split.us
  %118 = icmp eq i64 %107, 0
  br i1 %118, label %.thread136.us153, label %119

.thread136.us153:                                 ; preds = %117
  tail call void @ZSTD_CCtx_trace(ptr noundef nonnull %0, i64 noundef 0)
  br label %119

119:                                              ; preds = %.thread136.us153, %117
  %120 = tail call i64 @ZSTD_CCtx_reset(ptr noundef nonnull %0, i32 noundef 1)
  br label %121

121:                                              ; preds = %.split.split.us, %119
  %122 = tail call i32 @ERR_isError(i64 noundef %107)
  %.not127.us154 = icmp eq i32 %122, 0
  br i1 %.not127.us154, label %123, label %.thread

123:                                              ; preds = %121
  %124 = icmp eq i64 %107, 0
  br i1 %124, label %.split145.us, label %125

125:                                              ; preds = %123
  %126 = load i64, ptr %5, align 8, !tbaa !5
  %127 = load i64, ptr %7, align 8, !tbaa !11
  %128 = icmp eq i64 %126, %127
  br i1 %128, label %.split145.us, label %.split.split.us

.split.split:                                     ; preds = %.split, %151
  %129 = phi i64 [ %152, %151 ], [ %.pre167, %.split ]
  %130 = load i64, ptr %11, align 8, !tbaa !12
  %131 = load ptr, ptr %71, align 8, !tbaa !51
  %132 = tail call i64 @ZSTDMT_compressStream_generic(ptr noundef %131, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef 2)
  %133 = load i64, ptr %11, align 8, !tbaa !12
  %134 = sub i64 %133, %130
  %135 = load i64, ptr %72, align 8, !tbaa !52
  %136 = add i64 %134, %135
  store i64 %136, ptr %72, align 8, !tbaa !52
  %137 = load i64, ptr %5, align 8, !tbaa !5
  %138 = sub i64 %137, %129
  %139 = load i64, ptr %73, align 8, !tbaa !53
  %140 = add i64 %138, %139
  store i64 %140, ptr %73, align 8, !tbaa !53
  %141 = tail call i32 @ZSTD_isError(i64 noundef %132)
  %.not126 = icmp eq i32 %141, 0
  %142 = icmp eq i64 %132, 0
  br i1 %.not126, label %143, label %144

143:                                              ; preds = %.split.split
  br i1 %142, label %.thread136, label %147

144:                                              ; preds = %.split.split
  br i1 %142, label %.thread136, label %145

.thread136:                                       ; preds = %143, %144
  tail call void @ZSTD_CCtx_trace(ptr noundef nonnull %0, i64 noundef 0)
  br label %145

145:                                              ; preds = %.thread136, %144
  %146 = tail call i64 @ZSTD_CCtx_reset(ptr noundef nonnull %0, i32 noundef 1)
  br label %147

147:                                              ; preds = %143, %145
  %148 = tail call i32 @ERR_isError(i64 noundef %132)
  %.not127 = icmp eq i32 %148, 0
  br i1 %.not127, label %149, label %.thread

149:                                              ; preds = %147
  %150 = icmp eq i64 %132, 0
  br i1 %150, label %.split145.us, label %151

151:                                              ; preds = %149
  %152 = load i64, ptr %5, align 8, !tbaa !5
  %153 = load i64, ptr %7, align 8, !tbaa !11
  %154 = icmp eq i64 %152, %153
  br i1 %154, label %.split145.us, label %.split.split

.split145.us:                                     ; preds = %125, %123, %151, %149, %94, %96, %98, %101
  %.us-phi146 = phi i64 [ %77, %101 ], [ %77, %98 ], [ %77, %96 ], [ %77, %94 ], [ %132, %151 ], [ 0, %149 ], [ %107, %125 ], [ 0, %123 ]
  tail call void @ZSTD_setBufferExpectations(ptr noundef %0, ptr noundef nonnull %1, ptr noundef nonnull %2)
  br label %.thread

155:                                              ; preds = %53
  %156 = tail call i64 @ZSTD_compressStream_generic(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef %3)
  %157 = tail call i32 @ERR_isError(i64 noundef %156)
  %.not123.not = icmp eq i32 %157, 0
  br i1 %.not123.not, label %158, label %.thread

158:                                              ; preds = %155
  tail call void @ZSTD_setBufferExpectations(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %159 = getelementptr inbounds i8, ptr %0, i64 3592
  %160 = load i64, ptr %159, align 8, !tbaa !54
  %161 = getelementptr inbounds i8, ptr %0, i64 3600
  %162 = load i64, ptr %161, align 8, !tbaa !55
  %163 = sub i64 %160, %162
  br label %.thread

.thread:                                          ; preds = %121, %147, %92, %38, %34, %46, %41, %155, %50, %.split145.us, %16, %10, %4, %158
  %.8 = phi i64 [ %51, %50 ], [ %156, %155 ], [ %163, %158 ], [ -70, %4 ], [ -72, %10 ], [ -42, %16 ], [ %.us-phi146, %.split145.us ], [ -50, %38 ], [ -50, %34 ], [ %47, %46 ], [ %45, %41 ], [ %77, %92 ], [ %132, %147 ], [ %107, %121 ]
  ret i64 %.8
}

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

; Function Attrs: nounwind uwtable
declare hidden void @ZSTD_setBufferExpectations(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @ZSTDMT_updateCParams_whileCompressing(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden i64 @ZSTD_compressStream_generic(ptr noundef, ptr noundef, ptr noundef, i32 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, !10, i64 16}
!6 = !{!"ZSTD_outBuffer_s", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!13, !10, i64 16}
!13 = !{!"ZSTD_inBuffer_s", !7, i64 0, !10, i64 8, !10, i64 16}
!14 = !{!13, !10, i64 8}
!15 = !{!16, !17, i64 3608}
!16 = !{!"ZSTD_CCtx_s", !17, i64 0, !17, i64 4, !17, i64 8, !18, i64 16, !18, i64 232, !18, i64 448, !17, i64 664, !10, i64 672, !23, i64 680, !10, i64 752, !24, i64 760, !24, i64 768, !24, i64 776, !25, i64 784, !22, i64 872, !7, i64 896, !10, i64 904, !26, i64 912, !17, i64 944, !17, i64 948, !27, i64 952, !28, i64 1032, !7, i64 3144, !10, i64 3152, !30, i64 3160, !31, i64 3200, !7, i64 3520, !17, i64 3528, !7, i64 3536, !10, i64 3544, !10, i64 3552, !10, i64 3560, !10, i64 3568, !7, i64 3576, !10, i64 3584, !10, i64 3592, !10, i64 3600, !17, i64 3608, !17, i64 3612, !13, i64 3616, !10, i64 3640, !10, i64 3648, !34, i64 3656, !7, i64 3696, !35, i64 3704, !7, i64 3728, !36, i64 3736, !7, i64 5232, !10, i64 5240}
!17 = !{!"int", !8, i64 0}
!18 = !{!"ZSTD_CCtx_params_s", !17, i64 0, !19, i64 4, !20, i64 32, !17, i64 44, !17, i64 48, !10, i64 56, !17, i64 64, !17, i64 68, !17, i64 72, !17, i64 76, !10, i64 80, !17, i64 88, !17, i64 92, !21, i64 96, !17, i64 120, !17, i64 124, !17, i64 128, !17, i64 132, !17, i64 136, !17, i64 140, !17, i64 144, !17, i64 148, !22, i64 152, !17, i64 176, !17, i64 180, !7, i64 184, !7, i64 192, !10, i64 200, !17, i64 208}
!19 = !{!"", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24}
!20 = !{!"", !17, i64 0, !17, i64 4, !17, i64 8}
!21 = !{!"", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20}
!22 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!23 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !8, i64 56, !17, i64 60, !17, i64 64, !17, i64 68}
!24 = !{!"long long", !8, i64 0}
!25 = !{!"XXH_NAMESPACEXXH64_state_s", !10, i64 0, !8, i64 8, !8, i64 40, !17, i64 72, !17, i64 76, !10, i64 80}
!26 = !{!"", !17, i64 0, !7, i64 8, !10, i64 16, !10, i64 24}
!27 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 64, !17, i64 72, !17, i64 76}
!28 = !{!"", !29, i64 0, !7, i64 40, !17, i64 48, !7, i64 56, !8, i64 64, !8, i64 576}
!29 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !17, i64 24, !17, i64 28, !17, i64 32}
!30 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!31 = !{!"", !7, i64 0, !7, i64 8, !32, i64 16}
!32 = !{!"ZSTD_matchState_t", !29, i64 0, !17, i64 40, !17, i64 44, !17, i64 48, !17, i64 52, !7, i64 56, !8, i64 64, !10, i64 96, !17, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !17, i64 136, !17, i64 140, !33, i64 144, !7, i64 248, !19, i64 256, !7, i64 288, !17, i64 296, !17, i64 300}
!33 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !17, i64 48, !17, i64 52, !17, i64 56, !17, i64 60, !17, i64 64, !17, i64 68, !17, i64 72, !17, i64 76, !17, i64 80, !7, i64 88, !17, i64 96}
!34 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !17, i64 24, !7, i64 32}
!35 = !{!"ZSTD_prefixDict_s", !7, i64 0, !10, i64 8, !17, i64 16}
!36 = !{!"", !27, i64 0, !27, i64 80, !27, i64 160, !27, i64 240, !27, i64 320, !8, i64 400, !37, i64 1184}
!37 = !{!"", !38, i64 0, !39, i64 144}
!38 = !{!"", !17, i64 0, !8, i64 4, !10, i64 136}
!39 = !{!"", !17, i64 0, !17, i64 4, !17, i64 8, !8, i64 12, !10, i64 152, !10, i64 160}
!40 = !{!16, !10, i64 3640}
!41 = !{!16, !17, i64 140}
!42 = !{!13, !7, i64 0}
!43 = !{!16, !7, i64 3616}
!44 = !{!16, !10, i64 3624}
!45 = !{i64 0, i64 8, !46, i64 8, i64 8, !47, i64 16, i64 8, !47}
!46 = !{!7, !7, i64 0}
!47 = !{!10, !10, i64 0}
!48 = !{!16, !17, i64 16}
!49 = !{!16, !17, i64 308}
!50 = !{!16, !17, i64 4}
!51 = !{!16, !7, i64 3728}
!52 = !{!16, !24, i64 768}
!53 = !{!16, !24, i64 776}
!54 = !{!16, !10, i64 3592}
!55 = !{!16, !10, i64 3600}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass