; LLVM IR from DanEngelbrecht/longtail :: lib/zstd/ext/compress (zstd_compress)

; 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.XXH64_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, i64, %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.XXH64_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: 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 hidden i32 @ERR_isError(i64 noundef) #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
define dso_local i64 @ZSTD_compressStream2(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 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 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
  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 %16

16:                                               ; preds = %4
  br label %17

17:                                               ; preds = %16
  br label %18

18:                                               ; preds = %17
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %19, i32 0, i32 2
  %21 = load i64, ptr %20, align 8, !tbaa !11
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %22, i32 0, i32 1
  %24 = load i64, ptr %23, align 8, !tbaa !14
  %25 = icmp ugt i64 %21, %24
  br i1 %25, label %26, label %35

26:                                               ; preds = %18
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  store i64 -70, ptr %5, align 8
  br label %280

35:                                               ; preds = %18
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %38, i32 0, i32 2
  %40 = load i64, ptr %39, align 8, !tbaa !15
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %41, i32 0, i32 1
  %43 = load i64, ptr %42, align 8, !tbaa !17
  %44 = icmp ugt i64 %40, %43
  br i1 %44, label %45, label %54

45:                                               ; preds = %37
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  store i64 -72, ptr %5, align 8
  br label %280

54:                                               ; preds = %37
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = icmp ugt i32 %57, 2
  br i1 %58, label %59, label %68

59:                                               ; preds = %56
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  store i64 -42, ptr %5, align 8
  br label %280

68:                                               ; preds = %56
  br label %69

69:                                               ; preds = %68
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %70, i32 0, i32 37
  %72 = load i32, ptr %71, align 8, !tbaa !18
  %73 = icmp eq i32 %72, 0
  br i1 %73, label %74, label %211

74:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %75, i32 0, i32 1
  %77 = load i64, ptr %76, align 8, !tbaa !17
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %78, i32 0, i32 2
  %80 = load i64, ptr %79, align 8, !tbaa !15
  %81 = sub i64 %77, %80
  store i64 %81, ptr %10, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %82 = load i64, ptr %10, align 8, !tbaa !42
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %83, i32 0, i32 40
  %85 = load i64, ptr %84, align 8, !tbaa !43
  %86 = add i64 %82, %85
  store i64 %86, ptr %11, 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 3
  %89 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %88, i32 0, i32 15
  %90 = load i32, ptr %89, align 4, !tbaa !44
  %91 = icmp eq i32 %90, 1
  br i1 %91, label %92, label %176

92:                                               ; preds = %74
  %93 = load i32, ptr %9, align 4, !tbaa !9
  %94 = icmp eq i32 %93, 0
  br i1 %94, label %95, label %176

95:                                               ; preds = %92
  %96 = load i64, ptr %11, align 8, !tbaa !42
  %97 = icmp ult i64 %96, 131072
  br i1 %97, label %98, label %176

98:                                               ; preds = %95
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %99, i32 0, i32 40
  %101 = load i64, ptr %100, align 8, !tbaa !43
  %102 = icmp ne i64 %101, 0
  br i1 %102, label %103, label %154

103:                                              ; preds = %98
  br label %104

104:                                              ; preds = %103
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !45
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %108, i32 0, i32 39
  %110 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !46
  %112 = icmp ne ptr %107, %111
  br i1 %112, label %113, label %126

113:                                              ; preds = %104
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  br label %116

116:                                              ; preds = %115
  br label %117

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

126:                                              ; preds = %104
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  br label %129

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

138:                                              ; preds = %129
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  br label %141

141:                                              ; preds = %140
  br label %142

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

151:                                              ; preds = %129
  br label %152

152:                                              ; preds = %151
  br label %153

153:                                              ; preds = %152
  br label %154

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

176:                                              ; preds = %95, %92, %74
  br label %177

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

185:                                              ; preds = %177
  br label %186

186:                                              ; preds = %185
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187
  br label %189

189:                                              ; preds = %188
  br label %190

190:                                              ; preds = %189
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  br label %197

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

199:                                              ; preds = %177
  store i32 0, ptr %12, align 4
  br label %200

200:                                              ; preds = %199, %197
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %201 = load i32, ptr %12, align 4
  switch i32 %201, label %208 [
    i32 0, label %202
  ]

202:                                              ; preds = %200
  br label %203

203:                                              ; preds = %202
  br label %204

204:                                              ; preds = %203
  %205 = load ptr, ptr %6, align 8, !tbaa !5
  %206 = load ptr, ptr %7, align 8, !tbaa !5
  %207 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ZSTD_setBufferExpectations(ptr noundef %205, ptr noundef %206, ptr noundef %207)
  store i32 0, ptr %12, align 4
  br label %208

208:                                              ; preds = %204, %200, %154, %150, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %209 = load i32, ptr %12, align 4
  switch i32 %209, label %282 [
    i32 0, label %210
    i32 1, label %280
  ]

210:                                              ; preds = %208
  br label %211

211:                                              ; preds = %210, %69
  br label %212

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

221:                                              ; preds = %212
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222
  br label %224

224:                                              ; preds = %223
  br label %225

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

235:                                              ; preds = %212
  store i32 0, ptr %12, align 4
  br label %236

236:                                              ; preds = %235, %233
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %237 = load i32, ptr %12, align 4
  switch i32 %237, label %282 [
    i32 0, label %238
    i32 1, label %280
  ]

238:                                              ; preds = %236
  br label %239

239:                                              ; preds = %238
  br label %240

240:                                              ; preds = %239
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %241 = load ptr, ptr %6, align 8, !tbaa !5
  %242 = load ptr, ptr %7, align 8, !tbaa !5
  %243 = load ptr, ptr %8, align 8, !tbaa !5
  %244 = load i32, ptr %9, align 4, !tbaa !9
  %245 = call i64 @ZSTD_compressStream_generic(ptr noundef %241, ptr noundef %242, ptr noundef %243, i32 noundef %244)
  store i64 %245, ptr %15, align 8, !tbaa !42
  %246 = load i64, ptr %15, align 8, !tbaa !42
  %247 = call i32 @ERR_isError(i64 noundef %246)
  %248 = icmp ne i32 %247, 0
  br i1 %248, label %249, label %263

249:                                              ; preds = %240
  br label %250

250:                                              ; preds = %249
  br label %251

251:                                              ; preds = %250
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252
  br label %254

254:                                              ; preds = %253
  br label %255

255:                                              ; preds = %254
  br label %256

256:                                              ; preds = %255
  br label %257

257:                                              ; preds = %256
  br label %258

258:                                              ; preds = %257
  br label %259

259:                                              ; preds = %258
  br label %260

260:                                              ; preds = %259
  br label %261

261:                                              ; preds = %260
  %262 = load i64, ptr %15, align 8, !tbaa !42
  store i64 %262, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %264

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

264:                                              ; preds = %263, %261
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  %265 = load i32, ptr %12, align 4
  switch i32 %265, label %282 [
    i32 0, label %266
    i32 1, label %280
  ]

266:                                              ; preds = %264
  br label %267

267:                                              ; preds = %266
  br label %268

268:                                              ; preds = %267
  br label %269

269:                                              ; preds = %268
  %270 = load ptr, ptr %6, align 8, !tbaa !5
  %271 = load ptr, ptr %7, align 8, !tbaa !5
  %272 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ZSTD_setBufferExpectations(ptr noundef %270, ptr noundef %271, ptr noundef %272)
  %273 = load ptr, ptr %6, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %273, i32 0, i32 35
  %275 = load i64, ptr %274, align 8, !tbaa !50
  %276 = load ptr, ptr %6, align 8, !tbaa !5
  %277 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %276, i32 0, i32 36
  %278 = load i64, ptr %277, align 8, !tbaa !51
  %279 = sub i64 %275, %278
  store i64 %279, ptr %5, align 8
  br label %280

280:                                              ; preds = %269, %264, %236, %208, %67, %53, %34
  %281 = load i64, ptr %5, align 8
  ret i64 %281

282:                                              ; preds = %264, %236, %208
  unreachable
}

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

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

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

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

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 = { 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, !26, 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 = !{!"XXH64_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, !13, i64 3592}
!51 = !{!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
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.cond3 = select i1 %or.cond, i1 %32, i1 false
  br i1 %or.cond3, label %33, label %46

33:                                               ; preds = %22
  %.not63 = icmp eq i64 %25, 0
  br i1 %.not63, 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
  %.not64 = icmp eq ptr %35, %37
  br i1 %.not64, label %38, label %.thread

38:                                               ; preds = %34
  %39 = getelementptr inbounds i8, ptr %0, i64 3624
  %40 = load i64, ptr %39, align 8, !tbaa !44
  %.not65 = icmp eq i64 %12, %40
  br i1 %.not65, 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)
  %.not66.not = icmp eq i32 %52, 0
  br i1 %.not66.not, label %53, label %.thread

53:                                               ; preds = %50
  %54 = tail call i64 @ZSTD_compressStream_generic(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef %3)
  %55 = tail call i32 @ERR_isError(i64 noundef %54)
  %.not67.not = icmp eq i32 %55, 0
  br i1 %.not67.not, label %56, label %.thread

56:                                               ; preds = %53
  tail call void @ZSTD_setBufferExpectations(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %57 = getelementptr inbounds i8, ptr %0, i64 3592
  %58 = load i64, ptr %57, align 8, !tbaa !49
  %59 = getelementptr inbounds i8, ptr %0, i64 3600
  %60 = load i64, ptr %59, align 8, !tbaa !50
  %61 = sub i64 %58, %60
  br label %.thread

.thread:                                          ; preds = %38, %34, %46, %41, %53, %50, %16, %10, %4, %56
  %.5 = phi i64 [ %51, %50 ], [ %54, %53 ], [ %61, %56 ], [ -70, %4 ], [ -72, %10 ], [ -42, %16 ], [ -50, %38 ], [ -50, %34 ], [ %47, %46 ], [ %45, %41 ]
  ret i64 %.5
}

; 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 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, !24, 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 = !{!"XXH64_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, !10, i64 3592}
!50 = !{!16, !10, i64 3600}


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