; LLVM IR from catid/Zpng :: zstd (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_inBuffer_s = type { ptr, i64, i64 }
%struct.ZSTD_outBuffer_s = type { ptr, i64, i64 }
%struct.ZSTD_CCtx_s = type { i32, i32, i32, %struct.ZSTD_CCtx_params_s, %struct.ZSTD_CCtx_params_s, i32, ptr, i64, i64, i64, i64, i64, %struct.XXH64_state_s, %struct.ZSTD_customMem, i64, %struct.seqStore_t, %struct.ldmState_t, ptr, i64, %struct.rawSeqStore_t, %struct.ZSTD_blockState_t, ptr, ptr, i64, i64, i64, i64, ptr, i64, i64, i64, i32, i32, ptr, ptr, %struct.ZSTD_prefixDict_s }
%struct.ZSTD_CCtx_params_s = type { i32, %struct.ZSTD_compressionParameters, %struct.ZSTD_frameParameters, i32, i32, i32, i32, i32, i32, %struct.ldmParams_t, %struct.ZSTD_customMem }
%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.XXH64_state_s = type { i64, i64, i64, i64, i64, [4 x i64], i32, [2 x i32] }
%struct.ZSTD_customMem = type { ptr, ptr, ptr }
%struct.seqStore_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32 }
%struct.ldmState_t = type { %struct.ZSTD_window_t, ptr, ptr, i64 }
%struct.ZSTD_window_t = type { ptr, ptr, ptr, i32, i32 }
%struct.rawSeqStore_t = type { ptr, 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, ptr, ptr, %struct.optState_t }
%struct.optState_t = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.ZSTD_prefixDict_s = type { ptr, i64, i32 }

; Function Attrs: nounwind uwtable
declare dso_local i64 @ZSTD_compressBound(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: nounwind uwtable
declare dso_local void @ZSTD_CCtx_reset(ptr noundef) #0

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

declare i32 @ZSTD_isError(i64 noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_compressStream_generic(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 ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i32, align 4
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  store ptr %31, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %33, i32 0, i32 1
  %35 = load i64, ptr %34, align 8, !tbaa !14
  %36 = getelementptr inbounds i8, ptr %32, i64 %35
  store ptr %36, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %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 = getelementptr inbounds i8, ptr %37, i64 %40
  store ptr %41, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !16
  store ptr %44, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %45 = load ptr, ptr %13, align 8, !tbaa !5
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %46, i32 0, i32 1
  %48 = load i64, ptr %47, align 8, !tbaa !18
  %49 = getelementptr inbounds i8, ptr %45, i64 %48
  store ptr %49, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %50 = load ptr, ptr %13, align 8, !tbaa !5
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %51, i32 0, i32 2
  %53 = load i64, ptr %52, align 8, !tbaa !19
  %54 = getelementptr inbounds i8, ptr %50, i64 %53
  store ptr %54, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %356, %4
  %56 = load i32, ptr %16, align 4, !tbaa !9
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %357

58:                                               ; preds = %55
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %59, i32 0, i32 31
  %61 = load i32, ptr %60, align 8, !tbaa !20
  switch i32 %61, label %355 [
    i32 0, label %62
    i32 1, label %63
    i32 2, label %305
  ]

62:                                               ; preds = %58
  store i64 -62, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %393

63:                                               ; preds = %58
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = icmp eq i32 %64, 2
  br i1 %65, label %66, label %114

66:                                               ; preds = %63
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  %69 = ptrtoint ptr %67 to i64
  %70 = ptrtoint ptr %68 to i64
  %71 = sub i64 %69, %70
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = ptrtoint ptr %72 to i64
  %75 = ptrtoint ptr %73 to i64
  %76 = sub i64 %74, %75
  %77 = call i64 @ZSTD_compressBound(i64 noundef %76)
  %78 = icmp uge i64 %71, %77
  br i1 %78, label %79, label %114

79:                                               ; preds = %66
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %80, i32 0, i32 25
  %82 = load i64, ptr %81, align 8, !tbaa !37
  %83 = icmp eq i64 %82, 0
  br i1 %83, label %84, label %114

84:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = load ptr, ptr %15, align 8, !tbaa !5
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = load ptr, ptr %15, align 8, !tbaa !5
  %89 = ptrtoint ptr %87 to i64
  %90 = ptrtoint ptr %88 to i64
  %91 = sub i64 %89, %90
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = load ptr, ptr %12, align 8, !tbaa !5
  %95 = ptrtoint ptr %93 to i64
  %96 = ptrtoint ptr %94 to i64
  %97 = sub i64 %95, %96
  %98 = call i64 @ZSTD_compressEnd(ptr noundef %85, ptr noundef %86, i64 noundef %91, ptr noundef %92, i64 noundef %97)
  store i64 %98, ptr %18, align 8, !tbaa !38
  %99 = load i64, ptr %18, align 8, !tbaa !38
  %100 = call i32 @ZSTD_isError(i64 noundef %99)
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %104

102:                                              ; preds = %84
  %103 = load i64, ptr %18, align 8, !tbaa !38
  store i64 %103, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %112

104:                                              ; preds = %84
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %105, ptr %12, align 8, !tbaa !5
  %106 = load i64, ptr %18, align 8, !tbaa !38
  %107 = load ptr, ptr %15, align 8, !tbaa !5
  %108 = getelementptr inbounds i8, ptr %107, i64 %106
  store ptr %108, ptr %15, align 8, !tbaa !5
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %109, i32 0, i32 32
  store i32 1, ptr %110, align 4, !tbaa !39
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ZSTD_CCtx_reset(ptr noundef %111)
  store i32 0, ptr %16, align 4, !tbaa !9
  store i32 4, ptr %17, align 4
  br label %112

112:                                              ; preds = %104, %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  %113 = load i32, ptr %17, align 4
  switch i32 %113, label %393 [
    i32 4, label %356
  ]

114:                                              ; preds = %79, %66, %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %115 = load ptr, ptr %6, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %115, i32 0, i32 26
  %117 = load i64, ptr %116, align 8, !tbaa !40
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %118, i32 0, i32 25
  %120 = load i64, ptr %119, align 8, !tbaa !37
  %121 = sub i64 %117, %120
  store i64 %121, ptr %19, align 8, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %122, i32 0, i32 22
  %124 = load ptr, ptr %123, align 8, !tbaa !41
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %125, i32 0, i32 25
  %127 = load i64, ptr %126, align 8, !tbaa !37
  %128 = getelementptr inbounds i8, ptr %124, i64 %127
  %129 = load i64, ptr %19, align 8, !tbaa !38
  %130 = load ptr, ptr %12, align 8, !tbaa !5
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = ptrtoint ptr %131 to i64
  %134 = ptrtoint ptr %132 to i64
  %135 = sub i64 %133, %134
  %136 = call i64 @ZSTD_limitCopy(ptr noundef %128, i64 noundef %129, ptr noundef %130, i64 noundef %135)
  store i64 %136, ptr %20, align 8, !tbaa !38
  %137 = load i64, ptr %20, align 8, !tbaa !38
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %138, i32 0, i32 25
  %140 = load i64, ptr %139, align 8, !tbaa !37
  %141 = add i64 %140, %137
  store i64 %141, ptr %139, align 8, !tbaa !37
  %142 = load i64, ptr %20, align 8, !tbaa !38
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  %144 = getelementptr inbounds i8, ptr %143, i64 %142
  store ptr %144, ptr %12, align 8, !tbaa !5
  %145 = load i32, ptr %9, align 4, !tbaa !9
  %146 = icmp eq i32 %145, 0
  br i1 %146, label %147, label %156

147:                                              ; preds = %114
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %148, i32 0, i32 25
  %150 = load i64, ptr %149, align 8, !tbaa !37
  %151 = load ptr, ptr %6, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %151, i32 0, i32 26
  %153 = load i64, ptr %152, align 8, !tbaa !40
  %154 = icmp ult i64 %150, %153
  br i1 %154, label %155, label %156

155:                                              ; preds = %147
  store i32 0, ptr %16, align 4, !tbaa !9
  store i32 4, ptr %17, align 4
  br label %169

156:                                              ; preds = %147, %114
  %157 = load i32, ptr %9, align 4, !tbaa !9
  %158 = icmp eq i32 %157, 1
  br i1 %158, label %159, label %168

159:                                              ; preds = %156
  %160 = load ptr, ptr %6, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %160, i32 0, i32 25
  %162 = load i64, ptr %161, align 8, !tbaa !37
  %163 = load ptr, ptr %6, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %163, i32 0, i32 24
  %165 = load i64, ptr %164, align 8, !tbaa !42
  %166 = icmp eq i64 %162, %165
  br i1 %166, label %167, label %168

167:                                              ; preds = %159
  store i32 0, ptr %16, align 4, !tbaa !9
  store i32 4, ptr %17, align 4
  br label %169

168:                                              ; preds = %159, %156
  store i32 0, ptr %17, align 4
  br label %169

169:                                              ; preds = %168, %167, %155
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  %170 = load i32, ptr %17, align 4
  switch i32 %170, label %395 [
    i32 0, label %171
    i32 4, label %356
  ]

171:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %172 = load ptr, ptr %6, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %172, i32 0, i32 25
  %174 = load i64, ptr %173, align 8, !tbaa !37
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %175, i32 0, i32 24
  %177 = load i64, ptr %176, align 8, !tbaa !42
  %178 = sub i64 %174, %177
  store i64 %178, ptr %23, align 8, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %179 = load ptr, ptr %14, align 8, !tbaa !5
  %180 = load ptr, ptr %15, align 8, !tbaa !5
  %181 = ptrtoint ptr %179 to i64
  %182 = ptrtoint ptr %180 to i64
  %183 = sub i64 %181, %182
  store i64 %183, ptr %24, align 8, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  %184 = load i32, ptr %9, align 4, !tbaa !9
  %185 = icmp eq i32 %184, 2
  br i1 %185, label %186, label %190

186:                                              ; preds = %171
  %187 = load ptr, ptr %12, align 8, !tbaa !5
  %188 = load ptr, ptr %11, align 8, !tbaa !5
  %189 = icmp eq ptr %187, %188
  br label %190

190:                                              ; preds = %186, %171
  %191 = phi i1 [ false, %171 ], [ %189, %186 ]
  %192 = zext i1 %191 to i32
  store i32 %192, ptr %25, align 4, !tbaa !9
  %193 = load i64, ptr %24, align 8, !tbaa !38
  %194 = load i64, ptr %23, align 8, !tbaa !38
  %195 = call i64 @ZSTD_compressBound(i64 noundef %194)
  %196 = icmp uge i64 %193, %195
  br i1 %196, label %197, label %199

197:                                              ; preds = %190
  %198 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %198, ptr %21, align 8, !tbaa !5
  br label %206

199:                                              ; preds = %190
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %200, i32 0, i32 27
  %202 = load ptr, ptr %201, align 8, !tbaa !43
  store ptr %202, ptr %21, align 8, !tbaa !5
  %203 = load ptr, ptr %6, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %203, i32 0, i32 28
  %205 = load i64, ptr %204, align 8, !tbaa !44
  store i64 %205, ptr %24, align 8, !tbaa !38
  br label %206

206:                                              ; preds = %199, %197
  %207 = load i32, ptr %25, align 4, !tbaa !9
  %208 = icmp ne i32 %207, 0
  br i1 %208, label %209, label %222

209:                                              ; preds = %206
  %210 = load ptr, ptr %6, align 8, !tbaa !5
  %211 = load ptr, ptr %21, align 8, !tbaa !5
  %212 = load i64, ptr %24, align 8, !tbaa !38
  %213 = load ptr, ptr %6, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %213, i32 0, i32 22
  %215 = load ptr, ptr %214, align 8, !tbaa !41
  %216 = load ptr, ptr %6, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %216, i32 0, i32 24
  %218 = load i64, ptr %217, align 8, !tbaa !42
  %219 = getelementptr inbounds i8, ptr %215, i64 %218
  %220 = load i64, ptr %23, align 8, !tbaa !38
  %221 = call i64 @ZSTD_compressEnd(ptr noundef %210, ptr noundef %211, i64 noundef %212, ptr noundef %219, i64 noundef %220)
  br label %235

222:                                              ; preds = %206
  %223 = load ptr, ptr %6, align 8, !tbaa !5
  %224 = load ptr, ptr %21, align 8, !tbaa !5
  %225 = load i64, ptr %24, align 8, !tbaa !38
  %226 = load ptr, ptr %6, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %226, i32 0, i32 22
  %228 = load ptr, ptr %227, align 8, !tbaa !41
  %229 = load ptr, ptr %6, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %229, i32 0, i32 24
  %231 = load i64, ptr %230, align 8, !tbaa !42
  %232 = getelementptr inbounds i8, ptr %228, i64 %231
  %233 = load i64, ptr %23, align 8, !tbaa !38
  %234 = call i64 @ZSTD_compressContinue(ptr noundef %223, ptr noundef %224, i64 noundef %225, ptr noundef %232, i64 noundef %233)
  br label %235

235:                                              ; preds = %222, %209
  %236 = phi i64 [ %221, %209 ], [ %234, %222 ]
  store i64 %236, ptr %22, align 8, !tbaa !38
  %237 = load i64, ptr %22, align 8, !tbaa !38
  %238 = call i32 @ZSTD_isError(i64 noundef %237)
  %239 = icmp ne i32 %238, 0
  br i1 %239, label %240, label %242

240:                                              ; preds = %235
  %241 = load i64, ptr %22, align 8, !tbaa !38
  store i64 %241, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %302

242:                                              ; preds = %235
  %243 = load i32, ptr %25, align 4, !tbaa !9
  %244 = load ptr, ptr %6, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %244, i32 0, i32 32
  store i32 %243, ptr %245, align 4, !tbaa !39
  %246 = load ptr, ptr %6, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %246, i32 0, i32 25
  %248 = load i64, ptr %247, align 8, !tbaa !37
  %249 = load ptr, ptr %6, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %249, i32 0, i32 8
  %251 = load i64, ptr %250, align 8, !tbaa !45
  %252 = add i64 %248, %251
  %253 = load ptr, ptr %6, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %253, i32 0, i32 26
  store i64 %252, ptr %254, align 8, !tbaa !40
  %255 = load ptr, ptr %6, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %255, i32 0, i32 26
  %257 = load i64, ptr %256, align 8, !tbaa !40
  %258 = load ptr, ptr %6, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %258, i32 0, i32 23
  %260 = load i64, ptr %259, align 8, !tbaa !46
  %261 = icmp ugt i64 %257, %260
  br i1 %261, label %262, label %270

262:                                              ; preds = %242
  %263 = load ptr, ptr %6, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %263, i32 0, i32 25
  store i64 0, ptr %264, align 8, !tbaa !37
  %265 = load ptr, ptr %6, align 8, !tbaa !5
  %266 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %265, i32 0, i32 8
  %267 = load i64, ptr %266, align 8, !tbaa !45
  %268 = load ptr, ptr %6, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %268, i32 0, i32 26
  store i64 %267, ptr %269, align 8, !tbaa !40
  br label %270

270:                                              ; preds = %262, %242
  %271 = load i32, ptr %25, align 4, !tbaa !9
  %272 = icmp ne i32 %271, 0
  br i1 %272, label %274, label %273

273:                                              ; preds = %270
  br label %274

274:                                              ; preds = %273, %270
  %275 = load ptr, ptr %6, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %275, i32 0, i32 25
  %277 = load i64, ptr %276, align 8, !tbaa !37
  %278 = load ptr, ptr %6, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %278, i32 0, i32 24
  store i64 %277, ptr %279, align 8, !tbaa !42
  %280 = load ptr, ptr %21, align 8, !tbaa !5
  %281 = load ptr, ptr %15, align 8, !tbaa !5
  %282 = icmp eq ptr %280, %281
  br i1 %282, label %283, label %294

283:                                              ; preds = %274
  %284 = load i64, ptr %22, align 8, !tbaa !38
  %285 = load ptr, ptr %15, align 8, !tbaa !5
  %286 = getelementptr inbounds i8, ptr %285, i64 %284
  store ptr %286, ptr %15, align 8, !tbaa !5
  %287 = load ptr, ptr %6, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %287, i32 0, i32 32
  %289 = load i32, ptr %288, align 4, !tbaa !39
  %290 = icmp ne i32 %289, 0
  br i1 %290, label %291, label %293

291:                                              ; preds = %283
  store i32 0, ptr %16, align 4, !tbaa !9
  %292 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ZSTD_CCtx_reset(ptr noundef %292)
  br label %293

293:                                              ; preds = %291, %283
  store i32 4, ptr %17, align 4
  br label %302

294:                                              ; preds = %274
  %295 = load i64, ptr %22, align 8, !tbaa !38
  %296 = load ptr, ptr %6, align 8, !tbaa !5
  %297 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %296, i32 0, i32 29
  store i64 %295, ptr %297, align 8, !tbaa !47
  %298 = load ptr, ptr %6, align 8, !tbaa !5
  %299 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %298, i32 0, i32 30
  store i64 0, ptr %299, align 8, !tbaa !48
  %300 = load ptr, ptr %6, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %300, i32 0, i32 31
  store i32 2, ptr %301, align 8, !tbaa !20
  store i32 0, ptr %17, align 4
  br label %302

302:                                              ; preds = %294, %293, %240
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  %303 = load i32, ptr %17, align 4
  switch i32 %303, label %393 [
    i32 0, label %304
    i32 4, label %356
  ]

304:                                              ; preds = %302
  br label %305

305:                                              ; preds = %304, %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  %306 = load ptr, ptr %6, align 8, !tbaa !5
  %307 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %306, i32 0, i32 29
  %308 = load i64, ptr %307, align 8, !tbaa !47
  %309 = load ptr, ptr %6, align 8, !tbaa !5
  %310 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %309, i32 0, i32 30
  %311 = load i64, ptr %310, align 8, !tbaa !48
  %312 = sub i64 %308, %311
  store i64 %312, ptr %26, align 8, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  %313 = load ptr, ptr %15, align 8, !tbaa !5
  %314 = load ptr, ptr %14, align 8, !tbaa !5
  %315 = load ptr, ptr %15, align 8, !tbaa !5
  %316 = ptrtoint ptr %314 to i64
  %317 = ptrtoint ptr %315 to i64
  %318 = sub i64 %316, %317
  %319 = load ptr, ptr %6, align 8, !tbaa !5
  %320 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %319, i32 0, i32 27
  %321 = load ptr, ptr %320, align 8, !tbaa !43
  %322 = load ptr, ptr %6, align 8, !tbaa !5
  %323 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %322, i32 0, i32 30
  %324 = load i64, ptr %323, align 8, !tbaa !48
  %325 = getelementptr inbounds i8, ptr %321, i64 %324
  %326 = load i64, ptr %26, align 8, !tbaa !38
  %327 = call i64 @ZSTD_limitCopy(ptr noundef %313, i64 noundef %318, ptr noundef %325, i64 noundef %326)
  store i64 %327, ptr %27, align 8, !tbaa !38
  %328 = load i64, ptr %27, align 8, !tbaa !38
  %329 = load ptr, ptr %15, align 8, !tbaa !5
  %330 = getelementptr inbounds i8, ptr %329, i64 %328
  store ptr %330, ptr %15, align 8, !tbaa !5
  %331 = load i64, ptr %27, align 8, !tbaa !38
  %332 = load ptr, ptr %6, align 8, !tbaa !5
  %333 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %332, i32 0, i32 30
  %334 = load i64, ptr %333, align 8, !tbaa !48
  %335 = add i64 %334, %331
  store i64 %335, ptr %333, align 8, !tbaa !48
  %336 = load i64, ptr %26, align 8, !tbaa !38
  %337 = load i64, ptr %27, align 8, !tbaa !38
  %338 = icmp ne i64 %336, %337
  br i1 %338, label %339, label %340

339:                                              ; preds = %305
  store i32 0, ptr %16, align 4, !tbaa !9
  store i32 4, ptr %17, align 4
  br label %354

340:                                              ; preds = %305
  %341 = load ptr, ptr %6, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %341, i32 0, i32 30
  store i64 0, ptr %342, align 8, !tbaa !48
  %343 = load ptr, ptr %6, align 8, !tbaa !5
  %344 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %343, i32 0, i32 29
  store i64 0, ptr %344, align 8, !tbaa !47
  %345 = load ptr, ptr %6, align 8, !tbaa !5
  %346 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %345, i32 0, i32 32
  %347 = load i32, ptr %346, align 4, !tbaa !39
  %348 = icmp ne i32 %347, 0
  br i1 %348, label %349, label %351

349:                                              ; preds = %340
  store i32 0, ptr %16, align 4, !tbaa !9
  %350 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ZSTD_CCtx_reset(ptr noundef %350)
  store i32 4, ptr %17, align 4
  br label %354

351:                                              ; preds = %340
  %352 = load ptr, ptr %6, align 8, !tbaa !5
  %353 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %352, i32 0, i32 31
  store i32 1, ptr %353, align 8, !tbaa !20
  store i32 4, ptr %17, align 4
  br label %354

354:                                              ; preds = %351, %349, %339
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  br label %356

355:                                              ; preds = %58
  br label %356

356:                                              ; preds = %355, %354, %302, %169, %112
  br label %55, !llvm.loop !49

357:                                              ; preds = %55
  %358 = load ptr, ptr %12, align 8, !tbaa !5
  %359 = load ptr, ptr %10, align 8, !tbaa !5
  %360 = ptrtoint ptr %358 to i64
  %361 = ptrtoint ptr %359 to i64
  %362 = sub i64 %360, %361
  %363 = load ptr, ptr %8, align 8, !tbaa !5
  %364 = getelementptr inbounds %struct.ZSTD_inBuffer_s, ptr %363, i32 0, i32 2
  store i64 %362, ptr %364, align 8, !tbaa !15
  %365 = load ptr, ptr %15, align 8, !tbaa !5
  %366 = load ptr, ptr %13, align 8, !tbaa !5
  %367 = ptrtoint ptr %365 to i64
  %368 = ptrtoint ptr %366 to i64
  %369 = sub i64 %367, %368
  %370 = load ptr, ptr %7, align 8, !tbaa !5
  %371 = getelementptr inbounds %struct.ZSTD_outBuffer_s, ptr %370, i32 0, i32 2
  store i64 %369, ptr %371, align 8, !tbaa !19
  %372 = load ptr, ptr %6, align 8, !tbaa !5
  %373 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %372, i32 0, i32 32
  %374 = load i32, ptr %373, align 4, !tbaa !39
  %375 = icmp ne i32 %374, 0
  br i1 %375, label %376, label %377

376:                                              ; preds = %357
  store i64 0, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %393

377:                                              ; preds = %357
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  %378 = load ptr, ptr %6, align 8, !tbaa !5
  %379 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %378, i32 0, i32 26
  %380 = load i64, ptr %379, align 8, !tbaa !40
  %381 = load ptr, ptr %6, align 8, !tbaa !5
  %382 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %381, i32 0, i32 25
  %383 = load i64, ptr %382, align 8, !tbaa !37
  %384 = sub i64 %380, %383
  store i64 %384, ptr %28, align 8, !tbaa !38
  %385 = load i64, ptr %28, align 8, !tbaa !38
  %386 = icmp eq i64 %385, 0
  br i1 %386, label %387, label %391

387:                                              ; preds = %377
  %388 = load ptr, ptr %6, align 8, !tbaa !5
  %389 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %388, i32 0, i32 8
  %390 = load i64, ptr %389, align 8, !tbaa !45
  store i64 %390, ptr %28, align 8, !tbaa !38
  br label %391

391:                                              ; preds = %387, %377
  %392 = load i64, ptr %28, align 8, !tbaa !38
  store i64 %392, ptr %5, align 8
  store i32 1, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  br label %393

393:                                              ; preds = %391, %376, %302, %112, %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %394 = load i64, ptr %5, align 8
  ret i64 %394

395:                                              ; preds = %169
  unreachable
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @ZSTD_limitCopy(ptr noundef, i64 noundef, ptr noundef, i64 noundef) #3

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !6, i64 0}
!12 = !{!"ZSTD_inBuffer_s", !6, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!12, !13, i64 16}
!16 = !{!17, !6, i64 0}
!17 = !{!"ZSTD_outBuffer_s", !6, i64 0, !13, i64 8, !13, i64 16}
!18 = !{!17, !13, i64 8}
!19 = !{!17, !13, i64 16}
!20 = !{!21, !10, i64 856}
!21 = !{!"ZSTD_CCtx_s", !10, i64 0, !10, i64 4, !10, i64 8, !22, i64 16, !22, i64 136, !10, i64 256, !6, i64 264, !13, i64 272, !13, i64 280, !27, i64 288, !27, i64 296, !27, i64 304, !28, i64 312, !26, i64 400, !13, i64 424, !29, i64 432, !30, i64 496, !6, i64 552, !13, i64 560, !32, i64 568, !33, i64 600, !6, i64 776, !6, i64 784, !13, i64 792, !13, i64 800, !13, i64 808, !13, i64 816, !6, i64 824, !13, i64 832, !13, i64 840, !13, i64 848, !10, i64 856, !10, i64 860, !6, i64 864, !6, i64 872, !36, i64 880}
!22 = !{!"ZSTD_CCtx_params_s", !10, i64 0, !23, i64 4, !24, i64 32, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !25, i64 68, !26, i64 96}
!23 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!24 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8}
!25 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!26 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!"long long", !7, i64 0}
!28 = !{!"XXH64_state_s", !27, i64 0, !27, i64 8, !27, i64 16, !27, i64 24, !27, i64 32, !7, i64 40, !10, i64 72, !7, i64 76}
!29 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !10, i64 60}
!30 = !{!"", !31, i64 0, !6, i64 32, !6, i64 40, !13, i64 48}
!31 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28}
!32 = !{!"", !6, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!33 = !{!"", !6, i64 0, !6, i64 8, !34, i64 16}
!34 = !{!"", !31, i64 0, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !6, i64 48, !6, i64 56, !6, i64 64, !35, i64 72}
!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}
!36 = !{!"ZSTD_prefixDict_s", !6, i64 0, !13, i64 8, !10, i64 16}
!37 = !{!21, !13, i64 808}
!38 = !{!13, !13, i64 0}
!39 = !{!21, !10, i64 860}
!40 = !{!21, !13, i64 816}
!41 = !{!21, !6, i64 784}
!42 = !{!21, !13, i64 800}
!43 = !{!21, !6, i64 824}
!44 = !{!21, !13, i64 832}
!45 = !{!21, !13, i64 280}
!46 = !{!21, !13, i64 792}
!47 = !{!21, !13, i64 840}
!48 = !{!21, !13, i64 848}
!49 = distinct !{!49, !50}
!50 = !{!"llvm.loop.mustprogress"}


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

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

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

declare i32 @ZSTD_isError(i64 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_compressStream_generic(ptr noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %2, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %5, i64 %7
  %9 = getelementptr inbounds i8, ptr %2, i64 16
  %10 = load i64, ptr %9, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %5, i64 %10
  %12 = load ptr, ptr %1, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  %14 = load i64, ptr %13, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %12, i64 %14
  %16 = getelementptr inbounds i8, ptr %1, i64 16
  %17 = load i64, ptr %16, align 8, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %12, i64 %17
  %19 = getelementptr inbounds i8, ptr %0, i64 856
  %20 = icmp eq i32 %3, 2
  %21 = getelementptr inbounds i8, ptr %0, i64 816
  %22 = getelementptr inbounds i8, ptr %0, i64 808
  %23 = getelementptr inbounds i8, ptr %0, i64 784
  %24 = ptrtoint ptr %8 to i64
  %25 = getelementptr inbounds i8, ptr %0, i64 800
  %26 = ptrtoint ptr %15 to i64
  %27 = getelementptr inbounds i8, ptr %0, i64 860
  %28 = getelementptr inbounds i8, ptr %0, i64 824
  %29 = getelementptr inbounds i8, ptr %0, i64 832
  %30 = getelementptr inbounds i8, ptr %0, i64 280
  %31 = getelementptr inbounds i8, ptr %0, i64 792
  %32 = getelementptr inbounds i8, ptr %0, i64 840
  %33 = getelementptr inbounds i8, ptr %0, i64 848
  br label %.thread172.outer

.thread172.outer:                                 ; preds = %.thread172.outer.backedge, %4
  %.0135190.ph = phi ptr [ %11, %4 ], [ %.0135190.ph.be, %.thread172.outer.backedge ]
  %.0139189.ph = phi ptr [ %18, %4 ], [ %.0139189.ph.be, %.thread172.outer.backedge ]
  %34 = load i32, ptr %19, align 8, !tbaa !17
  br label %.thread172

.thread172:                                       ; preds = %.thread172.outer, %.thread172
  switch i32 %34, label %.thread172 [
    i32 0, label %.thread182
    i32 1, label %35
    i32 2, label %._crit_edge
  ], !llvm.loop !35

._crit_edge:                                      ; preds = %.thread172
  %.pre191 = load i64, ptr %32, align 8, !tbaa !37
  %.pre192 = load i64, ptr %33, align 8, !tbaa !38
  %.pre193 = ptrtoint ptr %.0139189.ph to i64
  %.pre194 = sub i64 %26, %.pre193
  br label %111

35:                                               ; preds = %.thread172
  br i1 %20, label %36, label %55

36:                                               ; preds = %35
  %37 = ptrtoint ptr %.0139189.ph to i64
  %38 = sub i64 %26, %37
  %39 = ptrtoint ptr %.0135190.ph to i64
  %40 = sub i64 %24, %39
  %41 = tail call i64 @ZSTD_compressBound(i64 noundef %40)
  %.not159 = icmp uge i64 %38, %41
  %.pre = load i64, ptr %22, align 8, !tbaa !39
  %42 = icmp eq i64 %.pre, 0
  %or.cond = select i1 %.not159, i1 %42, i1 false
  br i1 %or.cond, label %43, label %.thread170

43:                                               ; preds = %36
  %44 = tail call i64 @ZSTD_compressEnd(ptr noundef nonnull %0, ptr noundef %.0139189.ph, i64 noundef %38, ptr noundef %.0135190.ph, i64 noundef %40)
  %45 = tail call i32 @ZSTD_isError(i64 noundef %44) #4
  %.not165 = icmp eq i32 %45, 0
  br i1 %.not165, label %.thread, label %.thread182

.thread:                                          ; preds = %43
  %46 = getelementptr inbounds i8, ptr %.0139189.ph, i64 %44
  store i32 1, ptr %27, align 4, !tbaa !40
  br label %.loopexit.sink.split

.thread170:                                       ; preds = %36
  %47 = load i64, ptr %21, align 8, !tbaa !41
  %48 = sub i64 %47, %.pre
  %49 = load ptr, ptr %23, align 8, !tbaa !42
  %50 = getelementptr inbounds i8, ptr %49, i64 %.pre
  %51 = tail call i64 @ZSTD_limitCopy(ptr noundef %50, i64 noundef %48, ptr noundef %.0135190.ph, i64 noundef %40)
  %52 = load i64, ptr %22, align 8, !tbaa !39
  %53 = add i64 %52, %51
  store i64 %53, ptr %22, align 8, !tbaa !39
  %54 = getelementptr inbounds i8, ptr %.0135190.ph, i64 %51
  br label %73

55:                                               ; preds = %35
  %56 = load i64, ptr %21, align 8, !tbaa !41
  %57 = load i64, ptr %22, align 8, !tbaa !39
  %58 = sub i64 %56, %57
  %59 = load ptr, ptr %23, align 8, !tbaa !42
  %60 = getelementptr inbounds i8, ptr %59, i64 %57
  %61 = ptrtoint ptr %.0135190.ph to i64
  %62 = sub i64 %24, %61
  %63 = tail call i64 @ZSTD_limitCopy(ptr noundef %60, i64 noundef %58, ptr noundef %.0135190.ph, i64 noundef %62)
  %64 = load i64, ptr %22, align 8, !tbaa !39
  %65 = add i64 %64, %63
  store i64 %65, ptr %22, align 8, !tbaa !39
  %66 = getelementptr inbounds i8, ptr %.0135190.ph, i64 %63
  switch i32 %3, label %73 [
    i32 0, label %67
    i32 1, label %70
  ]

67:                                               ; preds = %55
  %68 = load i64, ptr %21, align 8, !tbaa !41
  %69 = icmp ult i64 %65, %68
  br i1 %69, label %.loopexit, label %73

70:                                               ; preds = %55
  %71 = load i64, ptr %25, align 8, !tbaa !43
  %72 = icmp eq i64 %65, %71
  br i1 %72, label %.loopexit, label %73

73:                                               ; preds = %67, %.thread170, %55, %70
  %74 = phi ptr [ %54, %.thread170 ], [ %66, %55 ], [ %66, %70 ], [ %66, %67 ]
  %75 = phi i64 [ %53, %.thread170 ], [ %65, %55 ], [ %65, %70 ], [ %65, %67 ]
  %76 = load i64, ptr %25, align 8, !tbaa !43
  %77 = sub i64 %75, %76
  %78 = ptrtoint ptr %.0139189.ph to i64
  %79 = sub i64 %26, %78
  %80 = icmp eq ptr %74, %8
  %81 = select i1 %20, i1 %80, i1 false
  %82 = zext i1 %81 to i32
  %83 = tail call i64 @ZSTD_compressBound(i64 noundef %77)
  %.not160 = icmp ult i64 %79, %83
  br i1 %.not160, label %84, label %87

84:                                               ; preds = %73
  %85 = load ptr, ptr %28, align 8, !tbaa !44
  %86 = load i64, ptr %29, align 8, !tbaa !45
  br label %87

87:                                               ; preds = %73, %84
  %.0154 = phi ptr [ %85, %84 ], [ %.0139189.ph, %73 ]
  %.0144 = phi i64 [ %86, %84 ], [ %79, %73 ]
  %88 = load ptr, ptr %23, align 8, !tbaa !42
  %89 = load i64, ptr %25, align 8, !tbaa !43
  %90 = getelementptr inbounds i8, ptr %88, i64 %89
  br i1 %81, label %91, label %93

91:                                               ; preds = %87
  %92 = tail call i64 @ZSTD_compressEnd(ptr noundef nonnull %0, ptr noundef %.0154, i64 noundef %.0144, ptr noundef %90, i64 noundef %77)
  br label %95

93:                                               ; preds = %87
  %94 = tail call i64 @ZSTD_compressContinue(ptr noundef nonnull %0, ptr noundef %.0154, i64 noundef %.0144, ptr noundef %90, i64 noundef %77)
  br label %95

95:                                               ; preds = %93, %91
  %96 = phi i64 [ %92, %91 ], [ %94, %93 ]
  %97 = tail call i32 @ZSTD_isError(i64 noundef %96) #4
  %.not161 = icmp eq i32 %97, 0
  br i1 %.not161, label %98, label %.thread182

98:                                               ; preds = %95
  store i32 %82, ptr %27, align 4, !tbaa !40
  %99 = load i64, ptr %22, align 8, !tbaa !39
  %100 = load i64, ptr %30, align 8, !tbaa !46
  %101 = add i64 %100, %99
  store i64 %101, ptr %21, align 8, !tbaa !41
  %102 = load i64, ptr %31, align 8, !tbaa !47
  %103 = icmp ugt i64 %101, %102
  br i1 %103, label %104, label %105

104:                                              ; preds = %98
  store i64 0, ptr %22, align 8, !tbaa !39
  store i64 %100, ptr %21, align 8, !tbaa !41
  br label %105

105:                                              ; preds = %104, %98
  %106 = phi i64 [ 0, %104 ], [ %99, %98 ]
  store i64 %106, ptr %25, align 8, !tbaa !43
  %107 = icmp eq ptr %.0154, %.0139189.ph
  br i1 %107, label %108, label %110

108:                                              ; preds = %105
  %109 = getelementptr inbounds i8, ptr %.0139189.ph, i64 %96
  br i1 %81, label %.loopexit.sink.split, label %.thread172.outer.backedge

110:                                              ; preds = %105
  store i64 %96, ptr %32, align 8, !tbaa !37
  store i64 0, ptr %33, align 8, !tbaa !38
  store i32 2, ptr %19, align 8, !tbaa !17
  br label %111

111:                                              ; preds = %._crit_edge, %110
  %.pre-phi195 = phi i64 [ %.pre194, %._crit_edge ], [ %79, %110 ]
  %112 = phi i64 [ %.pre192, %._crit_edge ], [ 0, %110 ]
  %113 = phi i64 [ %.pre191, %._crit_edge ], [ %96, %110 ]
  %.2137 = phi ptr [ %.0135190.ph, %._crit_edge ], [ %74, %110 ]
  %114 = sub i64 %113, %112
  %115 = load ptr, ptr %28, align 8, !tbaa !44
  %116 = getelementptr inbounds i8, ptr %115, i64 %112
  %117 = tail call i64 @ZSTD_limitCopy(ptr noundef %.0139189.ph, i64 noundef %.pre-phi195, ptr noundef %116, i64 noundef %114)
  %118 = getelementptr inbounds i8, ptr %.0139189.ph, i64 %117
  %119 = load i64, ptr %33, align 8, !tbaa !38
  %120 = add i64 %119, %117
  store i64 %120, ptr %33, align 8, !tbaa !38
  %.not163 = icmp eq i64 %114, %117
  br i1 %.not163, label %121, label %.loopexit

121:                                              ; preds = %111
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %32, i8 0, i64 16, i1 false)
  %122 = load i32, ptr %27, align 4, !tbaa !40
  %.not164 = icmp eq i32 %122, 0
  br i1 %.not164, label %123, label %.loopexit.sink.split

123:                                              ; preds = %121
  store i32 1, ptr %19, align 8, !tbaa !17
  br label %.thread172.outer.backedge

.thread172.outer.backedge:                        ; preds = %123, %108
  %.0135190.ph.be = phi ptr [ %74, %108 ], [ %.2137, %123 ]
  %.0139189.ph.be = phi ptr [ %109, %108 ], [ %118, %123 ]
  br label %.thread172.outer, !llvm.loop !35

.loopexit.sink.split:                             ; preds = %121, %108, %.thread
  %.4143.ph.ph = phi ptr [ %46, %.thread ], [ %109, %108 ], [ %118, %121 ]
  %.3138.ph.ph = phi ptr [ %8, %.thread ], [ %8, %108 ], [ %.2137, %121 ]
  tail call void @ZSTD_CCtx_reset(ptr noundef nonnull %0)
  br label %.loopexit

.loopexit:                                        ; preds = %111, %67, %70, %.loopexit.sink.split
  %.4143.ph = phi ptr [ %.4143.ph.ph, %.loopexit.sink.split ], [ %118, %111 ], [ %.0139189.ph, %67 ], [ %.0139189.ph, %70 ]
  %.3138.ph = phi ptr [ %.3138.ph.ph, %.loopexit.sink.split ], [ %.2137, %111 ], [ %66, %67 ], [ %66, %70 ]
  %124 = ptrtoint ptr %.3138.ph to i64
  %125 = ptrtoint ptr %5 to i64
  %126 = sub i64 %124, %125
  store i64 %126, ptr %9, align 8, !tbaa !12
  %127 = ptrtoint ptr %.4143.ph to i64
  %128 = ptrtoint ptr %12 to i64
  %129 = sub i64 %127, %128
  store i64 %129, ptr %16, align 8, !tbaa !16
  %130 = load i32, ptr %27, align 4, !tbaa !40
  %.not158 = icmp eq i32 %130, 0
  br i1 %.not158, label %131, label %.thread182

131:                                              ; preds = %.loopexit
  %132 = load i64, ptr %21, align 8, !tbaa !41
  %133 = load i64, ptr %22, align 8, !tbaa !39
  %134 = sub i64 %132, %133
  %135 = icmp eq i64 %134, 0
  br i1 %135, label %136, label %.thread182

136:                                              ; preds = %131
  %137 = load i64, ptr %30, align 8, !tbaa !46
  br label %.thread182

.thread182:                                       ; preds = %.thread172, %95, %43, %131, %136, %.loopexit
  %.5 = phi i64 [ 0, %.loopexit ], [ %137, %136 ], [ %134, %131 ], [ %44, %43 ], [ -62, %.thread172 ], [ %96, %95 ]
  ret i64 %.5
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @ZSTD_limitCopy(ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"ZSTD_inBuffer_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 = !{!6, !10, i64 16}
!13 = !{!14, !7, i64 0}
!14 = !{!"ZSTD_outBuffer_s", !7, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!14, !10, i64 8}
!16 = !{!14, !10, i64 16}
!17 = !{!18, !19, i64 856}
!18 = !{!"ZSTD_CCtx_s", !19, i64 0, !19, i64 4, !19, i64 8, !20, i64 16, !20, i64 136, !19, i64 256, !7, i64 264, !10, i64 272, !10, i64 280, !25, i64 288, !25, i64 296, !25, i64 304, !26, i64 312, !24, i64 400, !10, i64 424, !27, i64 432, !28, i64 496, !7, i64 552, !10, i64 560, !30, i64 568, !31, i64 600, !7, i64 776, !7, i64 784, !10, i64 792, !10, i64 800, !10, i64 808, !10, i64 816, !7, i64 824, !10, i64 832, !10, i64 840, !10, i64 848, !19, i64 856, !19, i64 860, !7, i64 864, !7, i64 872, !34, i64 880}
!19 = !{!"int", !8, i64 0}
!20 = !{!"ZSTD_CCtx_params_s", !19, i64 0, !21, i64 4, !22, i64 32, !19, i64 44, !19, i64 48, !19, i64 52, !19, i64 56, !19, i64 60, !19, i64 64, !23, i64 68, !24, i64 96}
!21 = !{!"", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12, !19, i64 16, !19, i64 20, !19, i64 24}
!22 = !{!"", !19, i64 0, !19, i64 4, !19, i64 8}
!23 = !{!"", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12, !19, i64 16, !19, i64 20}
!24 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!25 = !{!"long long", !8, i64 0}
!26 = !{!"XXH64_state_s", !25, i64 0, !25, i64 8, !25, i64 16, !25, i64 24, !25, i64 32, !8, i64 40, !19, i64 72, !8, i64 76}
!27 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !19, i64 56, !19, i64 60}
!28 = !{!"", !29, i64 0, !7, i64 32, !7, i64 40, !10, i64 48}
!29 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !19, i64 24, !19, i64 28}
!30 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!31 = !{!"", !7, i64 0, !7, i64 8, !32, i64 16}
!32 = !{!"", !29, i64 0, !19, i64 32, !19, i64 36, !19, i64 40, !19, i64 44, !7, i64 48, !7, i64 56, !7, i64 64, !33, i64 72}
!33 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !19, i64 48, !19, i64 52, !19, i64 56, !19, i64 60, !19, i64 64, !19, i64 68, !19, i64 72, !19, i64 76, !19, i64 80}
!34 = !{!"ZSTD_prefixDict_s", !7, i64 0, !10, i64 8, !19, i64 16}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!18, !10, i64 840}
!38 = !{!18, !10, i64 848}
!39 = !{!18, !10, i64 808}
!40 = !{!18, !19, i64 860}
!41 = !{!18, !10, i64 816}
!42 = !{!18, !7, i64 784}
!43 = !{!18, !10, i64 800}
!44 = !{!18, !7, i64 824}
!45 = !{!18, !10, i64 832}
!46 = !{!18, !10, i64 280}
!47 = !{!18, !10, i64 792}


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