; 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.buffer_s = type { ptr, i64 }
%struct.range_t = type { ptr, i64 }
%struct.ZSTD_customMem = type { ptr, ptr, ptr }
%struct.ZSTD_compressionParameters = type { i32, i32, i32, i32, i32, i32, i32 }
%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_frameParameters = type { i32, i32, i32 }
%struct.ldmParams_t = type { i32, i32, i32, i32, i32, i32 }
%struct.ZSTDMT_CCtx_s = type { ptr, ptr, ptr, ptr, ptr, %struct.ZSTD_CCtx_params_s, i64, i64, i32, %struct.inBuff_t, %struct.roundBuff_t, %struct.serialState_t, %struct.rsyncState_t, i32, i32, i32, i32, i32, i64, i64, i64, %struct.ZSTD_customMem, ptr, ptr, i8 }
%struct.inBuff_t = type { %struct.range_t, %struct.buffer_s, i64 }
%struct.roundBuff_t = type { ptr, i64, i64 }
%struct.serialState_t = type { %union.pthread_mutex_t, %union.pthread_cond_t, %struct.ZSTD_CCtx_params_s, %struct.ldmState_t, %struct.XXH_NAMESPACEXXH64_state_s, i32, %union.pthread_mutex_t, %union.pthread_cond_t, %struct.ZSTD_window_t }
%struct.ldmState_t = type { %struct.ZSTD_window_t, ptr, i32, ptr, [64 x i64], [64 x %struct.ldmMatchCandidate_t] }
%struct.ldmMatchCandidate_t = type { ptr, i32, i32, ptr }
%struct.XXH_NAMESPACEXXH64_state_s = type { i64, [4 x i64], [4 x i64], i32, i32, i64 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.ZSTD_window_t = type { ptr, ptr, ptr, i32, i32, i32 }
%struct.rsyncState_t = type { i64, i64, i64 }

@g_nullBuffer = external hidden constant %struct.buffer_s, align 8
@kNullRange = external hidden constant %struct.range_t, align 8

; 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: inlinehint nounwind uwtable
declare hidden void @ZSTD_customFree(ptr noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ZSTD_highbit32(i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i64 @ZSTD_compressBound(i64 noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ZSTD_customMalloc(i64 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @MEM_32bits() #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @ZSTD_createCDict_advanced(ptr noundef, i64 noundef, i32 noundef, i32 noundef, ptr noundef byval(%struct.ZSTD_compressionParameters) align 8, ptr noundef byval(%struct.ZSTD_customMem) align 8) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTDMT_initCStream_internal(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef byval(%struct.ZSTD_CCtx_params_s) align 8 %5, i64 noundef %6) #0 {
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca %struct.ZSTD_compressionParameters, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i64 %2, ptr %11, align 8, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !11
  store ptr %4, ptr %13, align 8, !tbaa !5
  store i64 %6, ptr %14, align 8, !tbaa !13
  br label %26

26:                                               ; preds = %7
  br label %27

27:                                               ; preds = %26
  %28 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 9
  %29 = load i32, ptr %28, align 4, !tbaa !15
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %30, i32 0, i32 5
  %32 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %31, i32 0, i32 9
  %33 = load i32, ptr %32, align 4, !tbaa !21
  %34 = icmp ne i32 %29, %33
  br i1 %34, label %35, label %63

35:                                               ; preds = %27
  br label %36

36:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 9
  %39 = load i32, ptr %38, align 4, !tbaa !15
  %40 = call i64 @ZSTDMT_resize(ptr noundef %37, i32 noundef %39)
  store i64 %40, ptr %15, align 8, !tbaa !9
  %41 = load i64, ptr %15, align 8, !tbaa !9
  %42 = call i32 @ERR_isError(i64 noundef %41)
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %58

44:                                               ; preds = %36
  br label %45

45:                                               ; preds = %44
  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
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  %57 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %57, ptr %8, align 8
  store i32 1, ptr %16, align 4
  br label %59

58:                                               ; preds = %36
  store i32 0, ptr %16, align 4
  br label %59

59:                                               ; preds = %58, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  %60 = load i32, ptr %16, align 4
  switch i32 %60, label %367 [
    i32 0, label %61
    i32 1, label %365
  ]

61:                                               ; preds = %59
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62, %27
  %64 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 10
  %65 = load i64, ptr %64, align 8, !tbaa !32
  %66 = icmp ne i64 %65, 0
  br i1 %66, label %67, label %73

67:                                               ; preds = %63
  %68 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 10
  %69 = load i64, ptr %68, align 8, !tbaa !32
  %70 = icmp ult i64 %69, 524288
  br i1 %70, label %71, label %73

71:                                               ; preds = %67
  %72 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 10
  store i64 524288, ptr %72, align 8, !tbaa !32
  br label %73

73:                                               ; preds = %71, %67, %63
  %74 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 10
  %75 = load i64, ptr %74, align 8, !tbaa !32
  %76 = call i32 @MEM_32bits()
  %77 = icmp ne i32 %76, 0
  %78 = zext i1 %77 to i64
  %79 = select i1 %77, i32 536870912, i32 1073741824
  %80 = sext i32 %79 to i64
  %81 = icmp ugt i64 %75, %80
  br i1 %81, label %82, label %89

82:                                               ; preds = %73
  %83 = call i32 @MEM_32bits()
  %84 = icmp ne i32 %83, 0
  %85 = zext i1 %84 to i64
  %86 = select i1 %84, i32 536870912, i32 1073741824
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 10
  store i64 %87, ptr %88, align 8, !tbaa !32
  br label %89

89:                                               ; preds = %82, %73
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %92, i32 0, i32 17
  %94 = load i32, ptr %93, align 8, !tbaa !33
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %101

96:                                               ; preds = %91
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  call void @ZSTDMT_waitForAllJobsCompleted(ptr noundef %97)
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  call void @ZSTDMT_releaseAllJobResources(ptr noundef %98)
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %99, i32 0, i32 17
  store i32 1, ptr %100, align 8, !tbaa !33
  br label %101

101:                                              ; preds = %96, %91
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %102, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %103, ptr align 8 %5, i64 216, i1 false), !tbaa.struct !34
  %104 = load i64, ptr %14, align 8, !tbaa !13
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %105, i32 0, i32 18
  store i64 %104, ptr %106, align 8, !tbaa !35
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %134

109:                                              ; preds = %101
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %110, i32 0, i32 22
  %112 = load ptr, ptr %111, align 8, !tbaa !36
  %113 = call i64 @ZSTD_freeCDict(ptr noundef %112)
  %114 = load ptr, ptr %10, align 8, !tbaa !5
  %115 = load i64, ptr %11, align 8, !tbaa !9
  %116 = load i32, ptr %12, align 4, !tbaa !11
  %117 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 1
  %118 = load ptr, ptr %9, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %118, i32 0, i32 21
  call void @llvm.lifetime.start.p0(i64 28, ptr %17) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 4 %117, i64 28, i1 false), !tbaa.struct !37
  %120 = call ptr @ZSTD_createCDict_advanced(ptr noundef %114, i64 noundef %115, i32 noundef 0, i32 noundef %116, ptr noundef byval(%struct.ZSTD_compressionParameters) align 8 %17, ptr noundef byval(%struct.ZSTD_customMem) align 8 %119)
  call void @llvm.lifetime.end.p0(i64 28, ptr %17) #4
  %121 = load ptr, ptr %9, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %121, i32 0, i32 22
  store ptr %120, ptr %122, align 8, !tbaa !36
  %123 = load ptr, ptr %9, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %123, i32 0, i32 22
  %125 = load ptr, ptr %124, align 8, !tbaa !36
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %126, i32 0, i32 23
  store ptr %125, ptr %127, align 8, !tbaa !38
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %128, i32 0, i32 22
  %130 = load ptr, ptr %129, align 8, !tbaa !36
  %131 = icmp eq ptr %130, null
  br i1 %131, label %132, label %133

132:                                              ; preds = %109
  store i64 -64, ptr %8, align 8
  br label %365

133:                                              ; preds = %109
  br label %144

134:                                              ; preds = %101
  %135 = load ptr, ptr %9, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %135, i32 0, i32 22
  %137 = load ptr, ptr %136, align 8, !tbaa !36
  %138 = call i64 @ZSTD_freeCDict(ptr noundef %137)
  %139 = load ptr, ptr %9, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %139, i32 0, i32 22
  store ptr null, ptr %140, align 8, !tbaa !36
  %141 = load ptr, ptr %13, align 8, !tbaa !5
  %142 = load ptr, ptr %9, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %142, i32 0, i32 23
  store ptr %141, ptr %143, align 8, !tbaa !38
  br label %144

144:                                              ; preds = %134, %133
  %145 = call i64 @ZSTDMT_computeOverlapSize(ptr noundef %5)
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %146, i32 0, i32 7
  store i64 %145, ptr %147, align 8, !tbaa !39
  br label %148

148:                                              ; preds = %144
  br label %149

149:                                              ; preds = %148
  %150 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 10
  %151 = load i64, ptr %150, align 8, !tbaa !32
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %152, i32 0, i32 6
  store i64 %151, ptr %153, align 8, !tbaa !40
  %154 = load ptr, ptr %9, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %154, i32 0, i32 6
  %156 = load i64, ptr %155, align 8, !tbaa !40
  %157 = icmp eq i64 %156, 0
  br i1 %157, label %158, label %164

158:                                              ; preds = %149
  %159 = call i32 @ZSTDMT_computeTargetJobLog(ptr noundef %5)
  %160 = zext i32 %159 to i64
  %161 = shl i64 1, %160
  %162 = load ptr, ptr %9, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %162, i32 0, i32 6
  store i64 %161, ptr %163, align 8, !tbaa !40
  br label %164

164:                                              ; preds = %158, %149
  %165 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %5, i32 0, i32 12
  %166 = load i32, ptr %165, align 4, !tbaa !41
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %194

168:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %169 = load ptr, ptr %9, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %169, i32 0, i32 6
  %171 = load i64, ptr %170, align 8, !tbaa !40
  %172 = lshr i64 %171, 10
  %173 = trunc i64 %172 to i32
  store i32 %173, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %174 = load i32, ptr %18, align 4, !tbaa !11
  %175 = call i32 @ZSTD_highbit32(i32 noundef %174)
  %176 = add i32 %175, 10
  store i32 %176, ptr %19, align 4, !tbaa !11
  br label %177

177:                                              ; preds = %168
  br label %178

178:                                              ; preds = %177
  br label %179

179:                                              ; preds = %178
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %180, i32 0, i32 12
  %182 = getelementptr inbounds %struct.rsyncState_t, ptr %181, i32 0, i32 0
  store i64 0, ptr %182, align 8, !tbaa !42
  %183 = load i32, ptr %19, align 4, !tbaa !11
  %184 = zext i32 %183 to i64
  %185 = shl i64 1, %184
  %186 = sub i64 %185, 1
  %187 = load ptr, ptr %9, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %187, i32 0, i32 12
  %189 = getelementptr inbounds %struct.rsyncState_t, ptr %188, i32 0, i32 1
  store i64 %186, ptr %189, align 8, !tbaa !43
  %190 = call i64 @ZSTD_rollingHash_primePower(i32 noundef 32)
  %191 = load ptr, ptr %9, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %191, i32 0, i32 12
  %193 = getelementptr inbounds %struct.rsyncState_t, ptr %192, i32 0, i32 2
  store i64 %190, ptr %193, align 8, !tbaa !44
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %194

194:                                              ; preds = %179, %164
  %195 = load ptr, ptr %9, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %195, i32 0, i32 6
  %197 = load i64, ptr %196, align 8, !tbaa !40
  %198 = load ptr, ptr %9, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %198, i32 0, i32 7
  %200 = load i64, ptr %199, align 8, !tbaa !39
  %201 = icmp ult i64 %197, %200
  br i1 %201, label %202, label %208

202:                                              ; preds = %194
  %203 = load ptr, ptr %9, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %203, i32 0, i32 7
  %205 = load i64, ptr %204, align 8, !tbaa !39
  %206 = load ptr, ptr %9, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %206, i32 0, i32 6
  store i64 %205, ptr %207, align 8, !tbaa !40
  br label %208

208:                                              ; preds = %202, %194
  br label %209

209:                                              ; preds = %208
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210
  br label %212

212:                                              ; preds = %211
  %213 = load ptr, ptr %9, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %213, i32 0, i32 2
  %215 = load ptr, ptr %214, align 8, !tbaa !45
  %216 = load ptr, ptr %9, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %216, i32 0, i32 6
  %218 = load i64, ptr %217, align 8, !tbaa !40
  %219 = call i64 @ZSTD_compressBound(i64 noundef %218)
  call void @ZSTDMT_setBufferSize(ptr noundef %215, i64 noundef %219)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %220 = load ptr, ptr %9, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %220, i32 0, i32 5
  %222 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %221, i32 0, i32 13
  %223 = getelementptr inbounds %struct.ldmParams_t, ptr %222, i32 0, i32 0
  %224 = load i32, ptr %223, align 8, !tbaa !46
  %225 = icmp eq i32 %224, 1
  br i1 %225, label %226, label %233

226:                                              ; preds = %212
  %227 = load ptr, ptr %9, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %227, i32 0, i32 5
  %229 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %228, i32 0, i32 1
  %230 = getelementptr inbounds %struct.ZSTD_compressionParameters, ptr %229, i32 0, i32 0
  %231 = load i32, ptr %230, align 4, !tbaa !47
  %232 = shl i32 1, %231
  br label %234

233:                                              ; preds = %212
  br label %234

234:                                              ; preds = %233, %226
  %235 = phi i32 [ %232, %226 ], [ 0, %233 ]
  %236 = zext i32 %235 to i64
  store i64 %236, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %237 = load ptr, ptr %9, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %237, i32 0, i32 7
  %239 = load i64, ptr %238, align 8, !tbaa !39
  %240 = icmp ugt i64 %239, 0
  %241 = zext i1 %240 to i32
  %242 = add nsw i32 2, %241
  %243 = sext i32 %242 to i64
  store i64 %243, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %244 = load ptr, ptr %9, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %244, i32 0, i32 6
  %246 = load i64, ptr %245, align 8, !tbaa !40
  %247 = load i64, ptr %21, align 8, !tbaa !9
  %248 = mul i64 %246, %247
  store i64 %248, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %249 = load ptr, ptr %9, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %249, i32 0, i32 5
  %251 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %250, i32 0, i32 9
  %252 = load i32, ptr %251, align 4, !tbaa !21
  %253 = icmp sgt i32 %252, 1
  br i1 %253, label %254, label %259

254:                                              ; preds = %234
  %255 = load ptr, ptr %9, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %255, i32 0, i32 5
  %257 = getelementptr inbounds %struct.ZSTD_CCtx_params_s, ptr %256, i32 0, i32 9
  %258 = load i32, ptr %257, align 4, !tbaa !21
  br label %260

259:                                              ; preds = %234
  br label %260

260:                                              ; preds = %259, %254
  %261 = phi i32 [ %258, %254 ], [ 1, %259 ]
  %262 = sext i32 %261 to i64
  store i64 %262, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %263 = load ptr, ptr %9, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %263, i32 0, i32 6
  %265 = load i64, ptr %264, align 8, !tbaa !40
  %266 = load i64, ptr %23, align 8, !tbaa !9
  %267 = mul i64 %265, %266
  store i64 %267, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %268 = load i64, ptr %20, align 8, !tbaa !9
  %269 = load i64, ptr %24, align 8, !tbaa !9
  %270 = icmp ugt i64 %268, %269
  br i1 %270, label %271, label %273

271:                                              ; preds = %260
  %272 = load i64, ptr %20, align 8, !tbaa !9
  br label %275

273:                                              ; preds = %260
  %274 = load i64, ptr %24, align 8, !tbaa !9
  br label %275

275:                                              ; preds = %273, %271
  %276 = phi i64 [ %272, %271 ], [ %274, %273 ]
  %277 = load i64, ptr %22, align 8, !tbaa !9
  %278 = add i64 %276, %277
  store i64 %278, ptr %25, align 8, !tbaa !9
  %279 = load ptr, ptr %9, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %279, i32 0, i32 10
  %281 = getelementptr inbounds %struct.roundBuff_t, ptr %280, i32 0, i32 1
  %282 = load i64, ptr %281, align 8, !tbaa !48
  %283 = load i64, ptr %25, align 8, !tbaa !9
  %284 = icmp ult i64 %282, %283
  br i1 %284, label %285, label %320

285:                                              ; preds = %275
  %286 = load ptr, ptr %9, align 8, !tbaa !5
  %287 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %286, i32 0, i32 10
  %288 = getelementptr inbounds %struct.roundBuff_t, ptr %287, i32 0, i32 0
  %289 = load ptr, ptr %288, align 8, !tbaa !49
  %290 = icmp ne ptr %289, null
  br i1 %290, label %291, label %298

291:                                              ; preds = %285
  %292 = load ptr, ptr %9, align 8, !tbaa !5
  %293 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %292, i32 0, i32 10
  %294 = getelementptr inbounds %struct.roundBuff_t, ptr %293, i32 0, i32 0
  %295 = load ptr, ptr %294, align 8, !tbaa !49
  %296 = load ptr, ptr %9, align 8, !tbaa !5
  %297 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %296, i32 0, i32 21
  call void @ZSTD_customFree(ptr noundef %295, ptr noundef byval(%struct.ZSTD_customMem) align 8 %297)
  br label %298

298:                                              ; preds = %291, %285
  %299 = load i64, ptr %25, align 8, !tbaa !9
  %300 = load ptr, ptr %9, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %300, i32 0, i32 21
  %302 = call ptr @ZSTD_customMalloc(i64 noundef %299, ptr noundef byval(%struct.ZSTD_customMem) align 8 %301)
  %303 = load ptr, ptr %9, align 8, !tbaa !5
  %304 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %303, i32 0, i32 10
  %305 = getelementptr inbounds %struct.roundBuff_t, ptr %304, i32 0, i32 0
  store ptr %302, ptr %305, align 8, !tbaa !49
  %306 = load ptr, ptr %9, align 8, !tbaa !5
  %307 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %306, i32 0, i32 10
  %308 = getelementptr inbounds %struct.roundBuff_t, ptr %307, i32 0, i32 0
  %309 = load ptr, ptr %308, align 8, !tbaa !49
  %310 = icmp eq ptr %309, null
  br i1 %310, label %311, label %315

311:                                              ; preds = %298
  %312 = load ptr, ptr %9, align 8, !tbaa !5
  %313 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %312, i32 0, i32 10
  %314 = getelementptr inbounds %struct.roundBuff_t, ptr %313, i32 0, i32 1
  store i64 0, ptr %314, align 8, !tbaa !48
  store i64 -64, ptr %8, align 8
  store i32 1, ptr %16, align 4
  br label %321

315:                                              ; preds = %298
  %316 = load i64, ptr %25, align 8, !tbaa !9
  %317 = load ptr, ptr %9, align 8, !tbaa !5
  %318 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %317, i32 0, i32 10
  %319 = getelementptr inbounds %struct.roundBuff_t, ptr %318, i32 0, i32 1
  store i64 %316, ptr %319, align 8, !tbaa !48
  br label %320

320:                                              ; preds = %315, %275
  store i32 0, ptr %16, align 4
  br label %321

321:                                              ; preds = %320, %311
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  %322 = load i32, ptr %16, align 4
  switch i32 %322, label %367 [
    i32 0, label %323
    i32 1, label %365
  ]

323:                                              ; preds = %321
  br label %324

324:                                              ; preds = %323
  br label %325

325:                                              ; preds = %324
  %326 = load ptr, ptr %9, align 8, !tbaa !5
  %327 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %326, i32 0, i32 10
  %328 = getelementptr inbounds %struct.roundBuff_t, ptr %327, i32 0, i32 2
  store i64 0, ptr %328, align 8, !tbaa !50
  %329 = load ptr, ptr %9, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %329, i32 0, i32 9
  %331 = getelementptr inbounds %struct.inBuff_t, ptr %330, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %331, ptr align 8 @g_nullBuffer, i64 16, i1 false), !tbaa.struct !51
  %332 = load ptr, ptr %9, align 8, !tbaa !5
  %333 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %332, i32 0, i32 9
  %334 = getelementptr inbounds %struct.inBuff_t, ptr %333, i32 0, i32 2
  store i64 0, ptr %334, align 8, !tbaa !52
  %335 = load ptr, ptr %9, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %335, i32 0, i32 9
  %337 = getelementptr inbounds %struct.inBuff_t, ptr %336, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %337, ptr align 8 @kNullRange, i64 16, i1 false), !tbaa.struct !51
  %338 = load ptr, ptr %9, align 8, !tbaa !5
  %339 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %338, i32 0, i32 14
  store i32 0, ptr %339, align 4, !tbaa !53
  %340 = load ptr, ptr %9, align 8, !tbaa !5
  %341 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %340, i32 0, i32 15
  store i32 0, ptr %341, align 8, !tbaa !54
  %342 = load ptr, ptr %9, align 8, !tbaa !5
  %343 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %342, i32 0, i32 16
  store i32 0, ptr %343, align 4, !tbaa !55
  %344 = load ptr, ptr %9, align 8, !tbaa !5
  %345 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %344, i32 0, i32 17
  store i32 0, ptr %345, align 8, !tbaa !33
  %346 = load ptr, ptr %9, align 8, !tbaa !5
  %347 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %346, i32 0, i32 19
  store i64 0, ptr %347, align 8, !tbaa !56
  %348 = load ptr, ptr %9, align 8, !tbaa !5
  %349 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %348, i32 0, i32 20
  store i64 0, ptr %349, align 8, !tbaa !57
  %350 = load ptr, ptr %9, align 8, !tbaa !5
  %351 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %350, i32 0, i32 11
  %352 = load ptr, ptr %9, align 8, !tbaa !5
  %353 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %352, i32 0, i32 4
  %354 = load ptr, ptr %353, align 8, !tbaa !58
  %355 = load ptr, ptr %9, align 8, !tbaa !5
  %356 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %355, i32 0, i32 6
  %357 = load i64, ptr %356, align 8, !tbaa !40
  %358 = load ptr, ptr %10, align 8, !tbaa !5
  %359 = load i64, ptr %11, align 8, !tbaa !9
  %360 = load i32, ptr %12, align 4, !tbaa !11
  %361 = call i32 @ZSTDMT_serialState_reset(ptr noundef %351, ptr noundef %354, ptr noundef byval(%struct.ZSTD_CCtx_params_s) align 8 %5, i64 noundef %357, ptr noundef %358, i64 noundef %359, i32 noundef %360)
  %362 = icmp ne i32 %361, 0
  br i1 %362, label %363, label %364

363:                                              ; preds = %325
  store i64 -64, ptr %8, align 8
  br label %365

364:                                              ; preds = %325
  store i64 0, ptr %8, align 8
  br label %365

365:                                              ; preds = %364, %363, %321, %132, %59
  %366 = load i64, ptr %8, align 8
  ret i64 %366

367:                                              ; preds = %321, %59
  unreachable
}

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

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @ZSTD_rollingHash_primePower(i32 noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @ZSTDMT_serialState_reset(ptr noundef, ptr noundef, ptr noundef byval(%struct.ZSTD_CCtx_params_s) align 8, i64 noundef, ptr noundef, i64 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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!16, !12, i64 76}
!16 = !{!"ZSTD_CCtx_params_s", !12, i64 0, !17, i64 4, !18, i64 32, !12, i64 44, !12, i64 48, !10, i64 56, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !10, i64 80, !12, i64 88, !12, i64 92, !19, i64 96, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !20, i64 152, !12, i64 176, !12, i64 180, !6, i64 184, !6, i64 192, !10, i64 200, !12, i64 208}
!17 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24}
!18 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!19 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!20 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!22, !12, i64 116}
!22 = !{!"ZSTDMT_CCtx_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !16, i64 40, !10, i64 256, !10, i64 264, !12, i64 272, !23, i64 280, !26, i64 320, !27, i64 344, !31, i64 2984, !12, i64 3008, !12, i64 3012, !12, i64 3016, !12, i64 3020, !12, i64 3024, !14, i64 3032, !14, i64 3040, !14, i64 3048, !20, i64 3056, !6, i64 3080, !6, i64 3088, !12, i64 3096}
!23 = !{!"", !24, i64 0, !25, i64 16, !10, i64 32}
!24 = !{!"", !6, i64 0, !10, i64 8}
!25 = !{!"buffer_s", !6, i64 0, !10, i64 8}
!26 = !{!"", !6, i64 0, !10, i64 8, !10, i64 16}
!27 = !{!"", !7, i64 0, !7, i64 40, !16, i64 88, !28, i64 304, !30, i64 2416, !12, i64 2504, !7, i64 2512, !7, i64 2552, !29, i64 2600}
!28 = !{!"", !29, i64 0, !6, i64 40, !12, i64 48, !6, i64 56, !7, i64 64, !7, i64 576}
!29 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !12, i64 28, !12, i64 32}
!30 = !{!"XXH_NAMESPACEXXH64_state_s", !10, i64 0, !7, i64 8, !7, i64 40, !12, i64 72, !12, i64 76, !10, i64 80}
!31 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16}
!32 = !{!16, !10, i64 80}
!33 = !{!22, !12, i64 3024}
!34 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11, i64 12, i64 4, !11, i64 16, i64 4, !11, i64 20, i64 4, !11, i64 24, i64 4, !11, i64 28, i64 4, !11, i64 32, i64 4, !11, i64 36, i64 4, !11, i64 40, i64 4, !11, i64 44, i64 4, !11, i64 48, i64 4, !11, i64 56, i64 8, !9, i64 64, i64 4, !11, i64 68, i64 4, !11, i64 72, i64 4, !11, i64 76, i64 4, !11, i64 80, i64 8, !9, i64 88, i64 4, !11, i64 92, i64 4, !11, i64 96, i64 4, !11, i64 100, i64 4, !11, i64 104, i64 4, !11, i64 108, i64 4, !11, i64 112, i64 4, !11, i64 116, i64 4, !11, i64 120, i64 4, !11, i64 124, i64 4, !11, i64 128, i64 4, !11, i64 132, i64 4, !11, i64 136, i64 4, !11, i64 140, i64 4, !11, i64 144, i64 4, !11, i64 148, i64 4, !11, i64 152, i64 8, !5, i64 160, i64 8, !5, i64 168, i64 8, !5, i64 176, i64 4, !11, i64 180, i64 4, !11, i64 184, i64 8, !5, i64 192, i64 8, !5, i64 200, i64 8, !9, i64 208, i64 4, !11}
!35 = !{!22, !14, i64 3032}
!36 = !{!22, !6, i64 3080}
!37 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11, i64 12, i64 4, !11, i64 16, i64 4, !11, i64 20, i64 4, !11, i64 24, i64 4, !11}
!38 = !{!22, !6, i64 3088}
!39 = !{!22, !10, i64 264}
!40 = !{!22, !10, i64 256}
!41 = !{!16, !12, i64 92}
!42 = !{!22, !10, i64 2984}
!43 = !{!22, !10, i64 2992}
!44 = !{!22, !10, i64 3000}
!45 = !{!22, !6, i64 16}
!46 = !{!22, !12, i64 136}
!47 = !{!22, !12, i64 44}
!48 = !{!22, !10, i64 328}
!49 = !{!22, !6, i64 320}
!50 = !{!22, !10, i64 336}
!51 = !{i64 0, i64 8, !5, i64 8, i64 8, !9}
!52 = !{!22, !10, i64 312}
!53 = !{!22, !12, i64 3012}
!54 = !{!22, !12, i64 3016}
!55 = !{!22, !12, i64 3020}
!56 = !{!22, !14, i64 3040}
!57 = !{!22, !14, i64 3048}
!58 = !{!22, !6, i64 32}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.buffer_s = type { ptr, i64 }
%struct.range_t = type { ptr, i64 }
%struct.ZSTD_customMem = type { ptr, ptr, ptr }
%struct.ZSTD_compressionParameters = type { i32, i32, i32, i32, i32, i32, i32 }
%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_frameParameters = type { i32, i32, i32 }
%struct.ldmParams_t = type { i32, i32, i32, i32, i32, i32 }

@g_nullBuffer = external hidden local_unnamed_addr constant %struct.buffer_s, align 8
@kNullRange = external hidden local_unnamed_addr constant %struct.range_t, align 8

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

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

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

; 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) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @ZSTD_customFree(ptr noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ZSTD_highbit32(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ZSTD_customMalloc(i64 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @MEM_32bits() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @ZSTD_createCDict_advanced(ptr noundef, i64 noundef, i32 noundef, i32 noundef, ptr noundef byval(%struct.ZSTD_compressionParameters) align 8, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTDMT_initCStream_internal(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef byval(%struct.ZSTD_CCtx_params_s) align 8 %5, i64 noundef %6) local_unnamed_addr #0 {
  %8 = alloca %struct.ZSTD_compressionParameters, align 8
  %9 = getelementptr inbounds i8, ptr %5, i64 76
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = getelementptr inbounds i8, ptr %0, i64 116
  %13 = load i32, ptr %12, align 4, !tbaa !16
  %.not = icmp eq i32 %10, %13
  br i1 %.not, label %17, label %14

14:                                               ; preds = %7
  %15 = tail call i64 @ZSTDMT_resize(ptr noundef nonnull %0, i32 noundef %10)
  %16 = tail call i32 @ERR_isError(i64 noundef %15)
  %.not94.not = icmp eq i32 %16, 0
  br i1 %.not94.not, label %17, label %127

17:                                               ; preds = %14, %7
  %18 = getelementptr inbounds i8, ptr %5, i64 80
  %19 = load i64, ptr %18, align 8
  %20 = add i64 %19, -1
  %or.cond = icmp ult i64 %20, 524287
  br i1 %or.cond, label %21, label %22

21:                                               ; preds = %17
  store i64 524288, ptr %18, align 8, !tbaa !28
  br label %22

22:                                               ; preds = %21, %17
  %23 = phi i64 [ 524288, %21 ], [ %19, %17 ]
  %24 = tail call i32 @MEM_32bits()
  %.not95 = icmp eq i32 %24, 0
  %25 = select i1 %.not95, i64 1073741824, i64 536870912
  %26 = icmp ugt i64 %23, %25
  br i1 %26, label %27, label %30

27:                                               ; preds = %22
  %28 = tail call i32 @MEM_32bits()
  %.not96 = icmp eq i32 %28, 0
  %29 = select i1 %.not96, i64 1073741824, i64 536870912
  store i64 %29, ptr %18, align 8, !tbaa !28
  br label %30

30:                                               ; preds = %27, %22
  %31 = getelementptr inbounds i8, ptr %0, i64 3024
  %32 = load i32, ptr %31, align 8, !tbaa !29
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %30
  tail call void @ZSTDMT_waitForAllJobsCompleted(ptr noundef nonnull %0)
  tail call void @ZSTDMT_releaseAllJobResources(ptr noundef nonnull %0)
  store i32 1, ptr %31, align 8, !tbaa !29
  br label %35

35:                                               ; preds = %34, %30
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(216) %11, ptr noundef nonnull align 8 dereferenceable(216) %5, i64 216, i1 false), !tbaa.struct !30
  %36 = getelementptr inbounds i8, ptr %0, i64 3032
  store i64 %6, ptr %36, align 8, !tbaa !34
  %.not97 = icmp eq ptr %1, null
  %37 = getelementptr inbounds i8, ptr %0, i64 3080
  %38 = load ptr, ptr %37, align 8, !tbaa !35
  %39 = tail call i64 @ZSTD_freeCDict(ptr noundef %38)
  br i1 %.not97, label %46, label %40

40:                                               ; preds = %35
  %41 = getelementptr inbounds i8, ptr %5, i64 4
  %42 = getelementptr inbounds i8, ptr %0, i64 3056
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %8) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %8, ptr noundef nonnull align 4 dereferenceable(28) %41, i64 28, i1 false), !tbaa.struct !36
  %43 = tail call ptr @ZSTD_createCDict_advanced(ptr noundef nonnull %1, i64 noundef %2, i32 noundef 0, i32 noundef %3, ptr noundef nonnull byval(%struct.ZSTD_compressionParameters) align 8 %8, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %42)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %8) #6
  store ptr %43, ptr %37, align 8, !tbaa !35
  %44 = getelementptr inbounds i8, ptr %0, i64 3088
  store ptr %43, ptr %44, align 8, !tbaa !37
  %45 = icmp eq ptr %43, null
  br i1 %45, label %127, label %48

46:                                               ; preds = %35
  store ptr null, ptr %37, align 8, !tbaa !35
  %47 = getelementptr inbounds i8, ptr %0, i64 3088
  store ptr %4, ptr %47, align 8, !tbaa !37
  br label %48

48:                                               ; preds = %40, %46
  %49 = call i64 @ZSTDMT_computeOverlapSize(ptr noundef nonnull %5)
  %50 = getelementptr inbounds i8, ptr %0, i64 264
  store i64 %49, ptr %50, align 8, !tbaa !38
  %51 = load i64, ptr %18, align 8, !tbaa !28
  %52 = getelementptr inbounds i8, ptr %0, i64 256
  store i64 %51, ptr %52, align 8, !tbaa !39
  %53 = icmp eq i64 %51, 0
  br i1 %53, label %54, label %58

54:                                               ; preds = %48
  %55 = call i32 @ZSTDMT_computeTargetJobLog(ptr noundef nonnull %5)
  %56 = zext nneg i32 %55 to i64
  %57 = shl nuw i64 1, %56
  store i64 %57, ptr %52, align 8, !tbaa !39
  br label %58

58:                                               ; preds = %54, %48
  %59 = phi i64 [ %57, %54 ], [ %51, %48 ]
  %60 = getelementptr inbounds i8, ptr %5, i64 92
  %61 = load i32, ptr %60, align 4, !tbaa !40
  %.not98 = icmp eq i32 %61, 0
  br i1 %.not98, label %73, label %62

62:                                               ; preds = %58
  %63 = lshr i64 %59, 10
  %64 = trunc i64 %63 to i32
  %65 = call i32 @ZSTD_highbit32(i32 noundef %64)
  %66 = add i32 %65, 10
  %67 = getelementptr inbounds i8, ptr %0, i64 2984
  store i64 0, ptr %67, align 8, !tbaa !41
  %68 = zext nneg i32 %66 to i64
  %notmask = shl nsw i64 -1, %68
  %69 = xor i64 %notmask, -1
  %70 = getelementptr inbounds i8, ptr %0, i64 2992
  store i64 %69, ptr %70, align 8, !tbaa !42
  %71 = call i64 @ZSTD_rollingHash_primePower(i32 noundef 32)
  %72 = getelementptr inbounds i8, ptr %0, i64 3000
  store i64 %71, ptr %72, align 8, !tbaa !43
  %.pre = load i64, ptr %52, align 8, !tbaa !39
  br label %73

73:                                               ; preds = %62, %58
  %74 = phi i64 [ %.pre, %62 ], [ %59, %58 ]
  %75 = load i64, ptr %50, align 8, !tbaa !38
  %76 = icmp ult i64 %74, %75
  br i1 %76, label %77, label %78

77:                                               ; preds = %73
  store i64 %75, ptr %52, align 8, !tbaa !39
  br label %78

78:                                               ; preds = %77, %73
  %79 = phi i64 [ %75, %77 ], [ %74, %73 ]
  %80 = getelementptr inbounds i8, ptr %0, i64 16
  %81 = load ptr, ptr %80, align 8, !tbaa !44
  %82 = call i64 @ZSTD_compressBound(i64 noundef %79)
  call void @ZSTDMT_setBufferSize(ptr noundef %81, i64 noundef %82)
  %83 = getelementptr inbounds i8, ptr %0, i64 136
  %84 = load i32, ptr %83, align 8, !tbaa !45
  %85 = icmp eq i32 %84, 1
  br i1 %85, label %86, label %91

86:                                               ; preds = %78
  %87 = getelementptr inbounds i8, ptr %0, i64 44
  %88 = load i32, ptr %87, align 4, !tbaa !46
  %89 = shl nuw i32 1, %88
  %90 = zext i32 %89 to i64
  br label %91

91:                                               ; preds = %78, %86
  %92 = phi i64 [ %90, %86 ], [ 0, %78 ]
  %93 = load i64, ptr %50, align 8, !tbaa !38
  %.not99 = icmp eq i64 %93, 0
  %94 = select i1 %.not99, i64 2, i64 3
  %95 = load i64, ptr %52, align 8, !tbaa !39
  %96 = mul i64 %94, %95
  %97 = load i32, ptr %12, align 4, !tbaa !16
  %narrow = call i32 @llvm.smax.i32(i32 %97, i32 1)
  %spec.select = zext nneg i32 %narrow to i64
  %98 = mul i64 %95, %spec.select
  %99 = call i64 @llvm.umax.i64(i64 %92, i64 %98)
  %100 = add i64 %99, %96
  %101 = getelementptr inbounds i8, ptr %0, i64 320
  %102 = getelementptr inbounds i8, ptr %0, i64 328
  %103 = load i64, ptr %102, align 8, !tbaa !47
  %104 = icmp ult i64 %103, %100
  br i1 %104, label %105, label %115

105:                                              ; preds = %91
  %106 = load ptr, ptr %101, align 8, !tbaa !48
  %.not100 = icmp eq ptr %106, null
  br i1 %.not100, label %109, label %107

107:                                              ; preds = %105
  %108 = getelementptr inbounds i8, ptr %0, i64 3056
  call void @ZSTD_customFree(ptr noundef nonnull %106, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %108)
  br label %109

109:                                              ; preds = %107, %105
  %110 = getelementptr inbounds i8, ptr %0, i64 3056
  %111 = call ptr @ZSTD_customMalloc(i64 noundef %100, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %110)
  store ptr %111, ptr %101, align 8, !tbaa !48
  %112 = icmp eq ptr %111, null
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i64 %100, ptr %102, align 8, !tbaa !47
  %.pre106 = load i64, ptr %52, align 8, !tbaa !39
  br label %115

114:                                              ; preds = %109
  store i64 0, ptr %102, align 8, !tbaa !47
  br label %127

115:                                              ; preds = %113, %91
  %116 = phi i64 [ %.pre106, %113 ], [ %95, %91 ]
  %117 = getelementptr inbounds i8, ptr %0, i64 336
  store i64 0, ptr %117, align 8, !tbaa !49
  %118 = getelementptr inbounds i8, ptr %0, i64 280
  %119 = getelementptr inbounds i8, ptr %0, i64 296
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %119, ptr noundef nonnull align 8 dereferenceable(16) @g_nullBuffer, i64 16, i1 false), !tbaa.struct !50
  %120 = getelementptr inbounds i8, ptr %0, i64 312
  store i64 0, ptr %120, align 8, !tbaa !51
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %118, ptr noundef nonnull align 8 dereferenceable(16) @kNullRange, i64 16, i1 false), !tbaa.struct !50
  %121 = getelementptr inbounds i8, ptr %0, i64 3012
  %122 = getelementptr inbounds i8, ptr %0, i64 3040
  %123 = getelementptr inbounds i8, ptr %0, i64 344
  %124 = getelementptr inbounds i8, ptr %0, i64 32
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %121, i8 0, i64 16, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %122, i8 0, i64 16, i1 false)
  %125 = load ptr, ptr %124, align 8, !tbaa !52
  %126 = call i32 @ZSTDMT_serialState_reset(ptr noundef nonnull %123, ptr noundef %125, ptr noundef nonnull byval(%struct.ZSTD_CCtx_params_s) align 8 %5, i64 noundef %116, ptr noundef %1, i64 noundef %2, i32 noundef %3)
  %.not101 = icmp eq i32 %126, 0
  %. = select i1 %.not101, i64 0, i64 -64
  br label %127

127:                                              ; preds = %114, %14, %115, %40
  %.3 = phi i64 [ %15, %14 ], [ -64, %114 ], [ -64, %40 ], [ %., %115 ]
  ret i64 %.3
}

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

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @ZSTD_rollingHash_primePower(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @ZSTDMT_serialState_reset(ptr noundef, ptr noundef, ptr noundef byval(%struct.ZSTD_CCtx_params_s) align 8, i64 noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

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

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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 76}
!6 = !{!"ZSTD_CCtx_params_s", !7, i64 0, !10, i64 4, !11, i64 32, !7, i64 44, !7, i64 48, !12, i64 56, !7, i64 64, !7, i64 68, !7, i64 72, !7, i64 76, !12, i64 80, !7, i64 88, !7, i64 92, !13, i64 96, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !7, i64 144, !7, i64 148, !14, i64 152, !7, i64 176, !7, i64 180, !15, i64 184, !15, i64 192, !12, i64 200, !7, i64 208}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24}
!11 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!12 = !{!"long", !8, i64 0}
!13 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!14 = !{!"", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!17, !7, i64 116}
!17 = !{!"ZSTDMT_CCtx_s", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !6, i64 40, !12, i64 256, !12, i64 264, !7, i64 272, !18, i64 280, !21, i64 320, !22, i64 344, !26, i64 2984, !7, i64 3008, !7, i64 3012, !7, i64 3016, !7, i64 3020, !7, i64 3024, !27, i64 3032, !27, i64 3040, !27, i64 3048, !14, i64 3056, !15, i64 3080, !15, i64 3088, !7, i64 3096}
!18 = !{!"", !19, i64 0, !20, i64 16, !12, i64 32}
!19 = !{!"", !15, i64 0, !12, i64 8}
!20 = !{!"buffer_s", !15, i64 0, !12, i64 8}
!21 = !{!"", !15, i64 0, !12, i64 8, !12, i64 16}
!22 = !{!"", !8, i64 0, !8, i64 40, !6, i64 88, !23, i64 304, !25, i64 2416, !7, i64 2504, !8, i64 2512, !8, i64 2552, !24, i64 2600}
!23 = !{!"", !24, i64 0, !15, i64 40, !7, i64 48, !15, i64 56, !8, i64 64, !8, i64 576}
!24 = !{!"", !15, i64 0, !15, i64 8, !15, i64 16, !7, i64 24, !7, i64 28, !7, i64 32}
!25 = !{!"XXH_NAMESPACEXXH64_state_s", !12, i64 0, !8, i64 8, !8, i64 40, !7, i64 72, !7, i64 76, !12, i64 80}
!26 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16}
!27 = !{!"long long", !8, i64 0}
!28 = !{!6, !12, i64 80}
!29 = !{!17, !7, i64 3024}
!30 = !{i64 0, i64 4, !31, i64 4, i64 4, !31, i64 8, i64 4, !31, i64 12, i64 4, !31, i64 16, i64 4, !31, i64 20, i64 4, !31, i64 24, i64 4, !31, i64 28, i64 4, !31, i64 32, i64 4, !31, i64 36, i64 4, !31, i64 40, i64 4, !31, i64 44, i64 4, !31, i64 48, i64 4, !31, i64 56, i64 8, !32, i64 64, i64 4, !31, i64 68, i64 4, !31, i64 72, i64 4, !31, i64 76, i64 4, !31, i64 80, i64 8, !32, i64 88, i64 4, !31, i64 92, i64 4, !31, i64 96, i64 4, !31, i64 100, i64 4, !31, i64 104, i64 4, !31, i64 108, i64 4, !31, i64 112, i64 4, !31, i64 116, i64 4, !31, i64 120, i64 4, !31, i64 124, i64 4, !31, i64 128, i64 4, !31, i64 132, i64 4, !31, i64 136, i64 4, !31, i64 140, i64 4, !31, i64 144, i64 4, !31, i64 148, i64 4, !31, i64 152, i64 8, !33, i64 160, i64 8, !33, i64 168, i64 8, !33, i64 176, i64 4, !31, i64 180, i64 4, !31, i64 184, i64 8, !33, i64 192, i64 8, !33, i64 200, i64 8, !32, i64 208, i64 4, !31}
!31 = !{!7, !7, i64 0}
!32 = !{!12, !12, i64 0}
!33 = !{!15, !15, i64 0}
!34 = !{!17, !27, i64 3032}
!35 = !{!17, !15, i64 3080}
!36 = !{i64 0, i64 4, !31, i64 4, i64 4, !31, i64 8, i64 4, !31, i64 12, i64 4, !31, i64 16, i64 4, !31, i64 20, i64 4, !31, i64 24, i64 4, !31}
!37 = !{!17, !15, i64 3088}
!38 = !{!17, !12, i64 264}
!39 = !{!17, !12, i64 256}
!40 = !{!6, !7, i64 92}
!41 = !{!17, !12, i64 2984}
!42 = !{!17, !12, i64 2992}
!43 = !{!17, !12, i64 3000}
!44 = !{!17, !15, i64 16}
!45 = !{!17, !7, i64 136}
!46 = !{!17, !7, i64 44}
!47 = !{!17, !12, i64 328}
!48 = !{!17, !15, i64 320}
!49 = !{!17, !12, i64 336}
!50 = !{i64 0, i64 8, !33, i64 8, i64 8, !32}
!51 = !{!17, !12, i64 312}
!52 = !{!17, !15, i64 32}


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