; LLVM IR from catid/Zpng :: zstd (zstdmt_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.roundBuff_t = type { ptr, i64, i64 }
%struct.ZSTD_customMem = type { ptr, ptr, ptr }
%struct.ZSTDMT_CCtx_s = type { ptr, ptr, ptr, ptr, ptr, %struct.ZSTD_CCtx_params_s, i64, i64, %struct.roundBuff_t, %struct.inBuff_t, i32, %struct.serialState_t, i32, i32, i32, i32, i32, i32, i64, i64, i64, %struct.ZSTD_customMem, ptr, ptr }
%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.inBuff_t = type { %struct.range_t, %struct.buffer_s, i64 }
%struct.range_t = type { ptr, i64 }
%struct.buffer_s = type { ptr, i64 }
%struct.serialState_t = type { i32, i32, %struct.ZSTD_CCtx_params_s, %struct.ldmState_t, %struct.XXH64_state_s, i32, i32, i32, %struct.ZSTD_window_t }
%struct.ldmState_t = type { %struct.ZSTD_window_t, ptr, ptr, i64 }
%struct.XXH64_state_s = type { i64, i64, i64, i64, i64, [4 x i64], i32, [2 x i32] }
%struct.ZSTD_window_t = type { ptr, ptr, ptr, i32, i32 }

@kNullRoundBuff = external hidden constant %struct.roundBuff_t, align 8

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ZSTDMT_createCCtx_advanced(i32 noundef %0, ptr noundef byval(%struct.ZSTD_customMem) align 8 %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = add i32 %9, 2
  store i32 %10, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = icmp ult i32 %11, 1
  br i1 %12, label %13, label %14

13:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %118

14:                                               ; preds = %2
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp ult i32 %15, 200
  br i1 %16, label %17, label %19

17:                                               ; preds = %14
  %18 = load i32, ptr %4, align 4, !tbaa !5
  br label %20

19:                                               ; preds = %14
  br label %20

20:                                               ; preds = %19, %17
  %21 = phi i32 [ %18, %17 ], [ 200, %19 ]
  store i32 %21, ptr %4, align 4, !tbaa !5
  %22 = getelementptr inbounds %struct.ZSTD_customMem, ptr %1, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = icmp ne ptr %23, null
  %25 = zext i1 %24 to i32
  %26 = getelementptr inbounds %struct.ZSTD_customMem, ptr %1, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !12
  %28 = icmp ne ptr %27, null
  %29 = zext i1 %28 to i32
  %30 = xor i32 %25, %29
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %20
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %118

33:                                               ; preds = %20
  %34 = call ptr @ZSTD_calloc(i64 noundef 656, ptr noundef byval(%struct.ZSTD_customMem) align 8 %1)
  store ptr %34, ptr %5, align 8, !tbaa !13
  %35 = load ptr, ptr %5, align 8, !tbaa !13
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %118

38:                                               ; preds = %33
  %39 = load ptr, ptr %5, align 8, !tbaa !13
  %40 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %39, i32 0, i32 5
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = call i64 @ZSTDMT_CCtxParam_setNbWorkers(ptr noundef %40, i32 noundef %41)
  %43 = load ptr, ptr %5, align 8, !tbaa !13
  %44 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %43, i32 0, i32 21
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %44, ptr align 8 %1, i64 24, i1 false), !tbaa.struct !14
  %45 = load ptr, ptr %5, align 8, !tbaa !13
  %46 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %45, i32 0, i32 17
  store i32 1, ptr %46, align 4, !tbaa !15
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = zext i32 %47 to i64
  %49 = call ptr @POOL_create_advanced(i64 noundef %48, i64 noundef 0, ptr noundef byval(%struct.ZSTD_customMem) align 8 %1)
  %50 = load ptr, ptr %5, align 8, !tbaa !13
  %51 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %50, i32 0, i32 0
  store ptr %49, ptr %51, align 8, !tbaa !31
  %52 = call ptr @ZSTDMT_createJobsTable(ptr noundef %6, ptr noundef byval(%struct.ZSTD_customMem) align 8 %1)
  %53 = load ptr, ptr %5, align 8, !tbaa !13
  %54 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %53, i32 0, i32 1
  store ptr %52, ptr %54, align 8, !tbaa !32
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = sub i32 %55, 1
  %57 = load ptr, ptr %5, align 8, !tbaa !13
  %58 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %57, i32 0, i32 13
  store i32 %56, ptr %58, align 4, !tbaa !33
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = call ptr @ZSTDMT_createBufferPool(i32 noundef %59, ptr noundef byval(%struct.ZSTD_customMem) align 8 %1)
  %61 = load ptr, ptr %5, align 8, !tbaa !13
  %62 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %61, i32 0, i32 2
  store ptr %60, ptr %62, align 8, !tbaa !34
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = call ptr @ZSTDMT_createCCtxPool(i32 noundef %63, ptr noundef byval(%struct.ZSTD_customMem) align 8 %1)
  %65 = load ptr, ptr %5, align 8, !tbaa !13
  %66 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %65, i32 0, i32 3
  store ptr %64, ptr %66, align 8, !tbaa !35
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = call ptr @ZSTDMT_createSeqPool(i32 noundef %67, ptr noundef byval(%struct.ZSTD_customMem) align 8 %1)
  %69 = load ptr, ptr %5, align 8, !tbaa !13
  %70 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %69, i32 0, i32 4
  store ptr %68, ptr %70, align 8, !tbaa !36
  %71 = load ptr, ptr %5, align 8, !tbaa !13
  %72 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %71, i32 0, i32 11
  %73 = call i32 @ZSTDMT_serialState_init(ptr noundef %72)
  store i32 %73, ptr %7, align 4, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !13
  %75 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %74, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %75, ptr align 8 @kNullRoundBuff, i64 24, i1 false), !tbaa.struct !37
  %76 = load ptr, ptr %5, align 8, !tbaa !13
  %77 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !31
  %79 = icmp ne ptr %78, null
  %80 = xor i1 %79, true
  %81 = zext i1 %80 to i32
  %82 = load ptr, ptr %5, align 8, !tbaa !13
  %83 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !32
  %85 = icmp ne ptr %84, null
  %86 = xor i1 %85, true
  %87 = zext i1 %86 to i32
  %88 = or i32 %81, %87
  %89 = load ptr, ptr %5, align 8, !tbaa !13
  %90 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !34
  %92 = icmp ne ptr %91, null
  %93 = xor i1 %92, true
  %94 = zext i1 %93 to i32
  %95 = or i32 %88, %94
  %96 = load ptr, ptr %5, align 8, !tbaa !13
  %97 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %96, i32 0, i32 3
  %98 = load ptr, ptr %97, align 8, !tbaa !35
  %99 = icmp ne ptr %98, null
  %100 = xor i1 %99, true
  %101 = zext i1 %100 to i32
  %102 = or i32 %95, %101
  %103 = load ptr, ptr %5, align 8, !tbaa !13
  %104 = getelementptr inbounds %struct.ZSTDMT_CCtx_s, ptr %103, i32 0, i32 4
  %105 = load ptr, ptr %104, align 8, !tbaa !36
  %106 = icmp ne ptr %105, null
  %107 = xor i1 %106, true
  %108 = zext i1 %107 to i32
  %109 = or i32 %102, %108
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = or i32 %109, %110
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %116

113:                                              ; preds = %38
  %114 = load ptr, ptr %5, align 8, !tbaa !13
  %115 = call i64 @ZSTDMT_freeCCtx(ptr noundef %114)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %118

116:                                              ; preds = %38
  %117 = load ptr, ptr %5, align 8, !tbaa !13
  store ptr %117, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %118

118:                                              ; preds = %116, %113, %37, %32, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %119 = load ptr, ptr %3, align 8
  ret ptr %119
}

declare ptr @ZSTD_calloc(i64 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) #3

declare ptr @POOL_create_advanced(i64 noundef, i64 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) #3

; Function Attrs: nounwind uwtable
declare hidden ptr @ZSTDMT_createJobsTable(ptr noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) #2

; Function Attrs: nounwind uwtable
declare hidden ptr @ZSTDMT_createBufferPool(i32 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) #2

; Function Attrs: nounwind uwtable
declare hidden ptr @ZSTDMT_createCCtxPool(i32 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) #2

; Function Attrs: nounwind uwtable
declare hidden ptr @ZSTDMT_createSeqPool(i32 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @ZSTDMT_freeCCtx(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{i64 0, i64 8, !13, i64 8, i64 8, !13, i64 16, i64 8, !13}
!15 = !{!16, !6, i64 588}
!16 = !{!"ZSTDMT_CCtx_s", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !17, i64 40, !21, i64 160, !21, i64 168, !22, i64 176, !23, i64 200, !6, i64 240, !26, i64 248, !6, i64 568, !6, i64 572, !6, i64 576, !6, i64 580, !6, i64 584, !6, i64 588, !30, i64 592, !30, i64 600, !30, i64 608, !10, i64 616, !11, i64 640, !11, i64 648}
!17 = !{!"ZSTD_CCtx_params_s", !6, i64 0, !18, i64 4, !19, i64 32, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !20, i64 68, !10, i64 96}
!18 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!19 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!20 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!21 = !{!"long", !7, i64 0}
!22 = !{!"", !11, i64 0, !21, i64 8, !21, i64 16}
!23 = !{!"", !24, i64 0, !25, i64 16, !21, i64 32}
!24 = !{!"", !11, i64 0, !21, i64 8}
!25 = !{!"buffer_s", !11, i64 0, !21, i64 8}
!26 = !{!"", !6, i64 0, !6, i64 4, !17, i64 8, !27, i64 128, !29, i64 184, !6, i64 272, !6, i64 276, !6, i64 280, !28, i64 288}
!27 = !{!"", !28, i64 0, !11, i64 32, !11, i64 40, !21, i64 48}
!28 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !6, i64 28}
!29 = !{!"XXH64_state_s", !30, i64 0, !30, i64 8, !30, i64 16, !30, i64 24, !30, i64 32, !7, i64 40, !6, i64 72, !7, i64 76}
!30 = !{!"long long", !7, i64 0}
!31 = !{!16, !11, i64 0}
!32 = !{!16, !11, i64 8}
!33 = !{!16, !6, i64 572}
!34 = !{!16, !11, i64 16}
!35 = !{!16, !11, i64 24}
!36 = !{!16, !11, i64 32}
!37 = !{i64 0, i64 8, !13, i64 8, i64 8, !38, i64 16, i64 8, !38}
!38 = !{!21, !21, i64 0}


; 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.roundBuff_t = type { ptr, i64, i64 }
%struct.ZSTD_customMem = type { ptr, ptr, ptr }

@kNullRoundBuff = external hidden local_unnamed_addr constant %struct.roundBuff_t, align 8

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ZSTDMT_createCCtx_advanced(i32 noundef %0, ptr noundef byval(%struct.ZSTD_customMem) align 8 %1) local_unnamed_addr #2 {
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %4 = add i32 %0, 2
  store i32 %4, ptr %3, align 4, !tbaa !5
  %5 = icmp eq i32 %0, 0
  br i1 %5, label %46, label %6

6:                                                ; preds = %2
  %7 = tail call i32 @llvm.umin.i32(i32 %0, i32 200)
  %8 = load ptr, ptr %1, align 8, !tbaa !9
  %9 = icmp ne ptr %8, null
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = icmp ne ptr %11, null
  %13 = xor i1 %9, %12
  br i1 %13, label %46, label %14

14:                                               ; preds = %6
  %15 = tail call ptr @ZSTD_calloc(i64 noundef 656, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %1) #5
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %46, label %16

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %15, i64 40
  %18 = tail call i64 @ZSTDMT_CCtxParam_setNbWorkers(ptr noundef nonnull %17, i32 noundef %7)
  %19 = getelementptr inbounds i8, ptr %15, i64 616
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 24, i1 false), !tbaa.struct !13
  %20 = getelementptr inbounds i8, ptr %15, i64 588
  store i32 1, ptr %20, align 4, !tbaa !15
  %21 = zext nneg i32 %7 to i64
  %22 = tail call ptr @POOL_create_advanced(i64 noundef %21, i64 noundef 0, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %1) #5
  store ptr %22, ptr %15, align 8, !tbaa !31
  %23 = call ptr @ZSTDMT_createJobsTable(ptr noundef nonnull %3, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %1)
  %24 = getelementptr inbounds i8, ptr %15, i64 8
  store ptr %23, ptr %24, align 8, !tbaa !32
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = add i32 %25, -1
  %27 = getelementptr inbounds i8, ptr %15, i64 572
  store i32 %26, ptr %27, align 4, !tbaa !33
  %28 = call ptr @ZSTDMT_createBufferPool(i32 noundef %7, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %1)
  %29 = getelementptr inbounds i8, ptr %15, i64 16
  store ptr %28, ptr %29, align 8, !tbaa !34
  %30 = call ptr @ZSTDMT_createCCtxPool(i32 noundef %7, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %1)
  %31 = getelementptr inbounds i8, ptr %15, i64 24
  store ptr %30, ptr %31, align 8, !tbaa !35
  %32 = call ptr @ZSTDMT_createSeqPool(i32 noundef %7, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 %1)
  %33 = getelementptr inbounds i8, ptr %15, i64 32
  store ptr %32, ptr %33, align 8, !tbaa !36
  %34 = getelementptr inbounds i8, ptr %15, i64 248
  %35 = call i32 @ZSTDMT_serialState_init(ptr noundef nonnull %34)
  %36 = getelementptr inbounds i8, ptr %15, i64 176
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %36, ptr noundef nonnull align 8 dereferenceable(24) @kNullRoundBuff, i64 24, i1 false), !tbaa.struct !37
  %37 = load <4 x ptr>, ptr %15, align 8, !tbaa !14
  %38 = icmp eq <4 x ptr> %37, zeroinitializer
  %39 = load ptr, ptr %33, align 8, !tbaa !36
  %.not35 = icmp eq ptr %39, null
  %40 = bitcast <4 x i1> %38 to i4
  %41 = icmp ne i4 %40, 0
  %op.rdx = or i1 %41, %.not35
  %42 = zext i1 %op.rdx to i32
  %43 = or i32 %35, %42
  %.not36 = icmp eq i32 %43, 0
  br i1 %.not36, label %46, label %44

44:                                               ; preds = %16
  %45 = call i64 @ZSTDMT_freeCCtx(ptr noundef nonnull %15)
  br label %46

46:                                               ; preds = %16, %14, %6, %2, %44
  %.0 = phi ptr [ null, %44 ], [ null, %2 ], [ null, %6 ], [ null, %14 ], [ %15, %16 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret ptr %.0
}

declare ptr @ZSTD_calloc(i64 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #3

declare ptr @POOL_create_advanced(i64 noundef, i64 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden ptr @ZSTDMT_createJobsTable(ptr noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @ZSTDMT_createBufferPool(i32 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @ZSTDMT_createCCtxPool(i32 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @ZSTDMT_createSeqPool(i32 noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #2

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { "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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{i64 0, i64 8, !14, i64 8, i64 8, !14, i64 16, i64 8, !14}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !6, i64 588}
!16 = !{!"ZSTDMT_CCtx_s", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !17, i64 40, !21, i64 160, !21, i64 168, !22, i64 176, !23, i64 200, !6, i64 240, !26, i64 248, !6, i64 568, !6, i64 572, !6, i64 576, !6, i64 580, !6, i64 584, !6, i64 588, !30, i64 592, !30, i64 600, !30, i64 608, !10, i64 616, !11, i64 640, !11, i64 648}
!17 = !{!"ZSTD_CCtx_params_s", !6, i64 0, !18, i64 4, !19, i64 32, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !20, i64 68, !10, i64 96}
!18 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!19 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!20 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!21 = !{!"long", !7, i64 0}
!22 = !{!"", !11, i64 0, !21, i64 8, !21, i64 16}
!23 = !{!"", !24, i64 0, !25, i64 16, !21, i64 32}
!24 = !{!"", !11, i64 0, !21, i64 8}
!25 = !{!"buffer_s", !11, i64 0, !21, i64 8}
!26 = !{!"", !6, i64 0, !6, i64 4, !17, i64 8, !27, i64 128, !29, i64 184, !6, i64 272, !6, i64 276, !6, i64 280, !28, i64 288}
!27 = !{!"", !28, i64 0, !11, i64 32, !11, i64 40, !21, i64 48}
!28 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !6, i64 28}
!29 = !{!"XXH64_state_s", !30, i64 0, !30, i64 8, !30, i64 16, !30, i64 24, !30, i64 32, !7, i64 40, !6, i64 72, !7, i64 76}
!30 = !{!"long long", !7, i64 0}
!31 = !{!16, !11, i64 0}
!32 = !{!16, !11, i64 8}
!33 = !{!16, !6, i64 572}
!34 = !{!16, !11, i64 16}
!35 = !{!16, !11, i64 24}
!36 = !{!16, !11, i64 32}
!37 = !{i64 0, i64 8, !14, i64 8, i64 8, !38, i64 16, i64 8, !38}
!38 = !{!21, !21, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass