; LLVM IR from catid/Zpng :: zstd (zstd_decompress)

; 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_seqSymbol = type { i16, i8, i8, i32 }
%struct.ZSTD_DCtx_s = type { ptr, ptr, ptr, ptr, %struct.ZSTD_entropyDTables_t, ptr, ptr, ptr, ptr, i64, %struct.ZSTD_frameHeader, i64, i32, i32, i32, i32, %struct.XXH64_state_s, i64, i32, i32, ptr, %struct.ZSTD_customMem, i64, i64, i64, i32, ptr, ptr, i32, ptr, i64, i64, i64, ptr, i64, i64, i64, i64, ptr, i32, i32, i32, [131080 x i8], [18 x i8] }
%struct.ZSTD_entropyDTables_t = type { [513 x %struct.ZSTD_seqSymbol], [257 x %struct.ZSTD_seqSymbol], [513 x %struct.ZSTD_seqSymbol], [4097 x i32], [512 x i32], [3 x i32] }
%struct.ZSTD_frameHeader = type { i64, i64, 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 }

@LL_base = external hidden constant [36 x i32], align 16
@LL_bits = external hidden constant [36 x i32], align 16
@LL_defaultDTable = external hidden constant [65 x %struct.ZSTD_seqSymbol], align 16
@OF_base = external hidden constant [32 x i32], align 16
@OF_bits = external hidden constant [32 x i32], align 16
@OF_defaultDTable = external hidden constant [33 x %struct.ZSTD_seqSymbol], align 16
@ML_base = external hidden constant [53 x i32], align 16
@ML_bits = external hidden constant [53 x i32], align 16
@ML_defaultDTable = external hidden constant [65 x %struct.ZSTD_seqSymbol], align 16

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @MEM_readLE16(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_decodeSeqHeaders(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #2 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %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
  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 i64 %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %21, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = load i64, ptr %9, align 8, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %22, i64 %23
  store ptr %24, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %25, ptr %12, align 8, !tbaa !5
  %26 = load i64, ptr %9, align 8, !tbaa !9
  %27 = icmp ult i64 %26, 1
  br i1 %27, label %28, label %29

28:                                               ; preds = %4
  store i64 -72, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %192

29:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i32 1
  store ptr %31, ptr %12, align 8, !tbaa !5
  %32 = load i8, ptr %30, align 1, !tbaa !11
  %33 = zext i8 %32 to i32
  store i32 %33, ptr %14, align 4, !tbaa !12
  %34 = load i32, ptr %14, align 4, !tbaa !12
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %38, label %36

36:                                               ; preds = %29
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %37, align 4, !tbaa !12
  store i64 1, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %75

38:                                               ; preds = %29
  %39 = load i32, ptr %14, align 4, !tbaa !12
  %40 = icmp sgt i32 %39, 127
  br i1 %40, label %41, label %72

41:                                               ; preds = %38
  %42 = load i32, ptr %14, align 4, !tbaa !12
  %43 = icmp eq i32 %42, 255
  br i1 %43, label %44, label %57

44:                                               ; preds = %41
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 2
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = icmp ugt ptr %46, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %44
  store i64 -72, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %75

50:                                               ; preds = %44
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = call zeroext i16 @MEM_readLE16(ptr noundef %51)
  %53 = zext i16 %52 to i32
  %54 = add nsw i32 %53, 32512
  store i32 %54, ptr %14, align 4, !tbaa !12
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 2
  store ptr %56, ptr %12, align 8, !tbaa !5
  br label %71

57:                                               ; preds = %41
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = icmp uge ptr %58, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %57
  store i64 -72, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %75

62:                                               ; preds = %57
  %63 = load i32, ptr %14, align 4, !tbaa !12
  %64 = sub nsw i32 %63, 128
  %65 = shl i32 %64, 8
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i32 1
  store ptr %67, ptr %12, align 8, !tbaa !5
  %68 = load i8, ptr %66, align 1, !tbaa !11
  %69 = zext i8 %68 to i32
  %70 = add nsw i32 %65, %69
  store i32 %70, ptr %14, align 4, !tbaa !12
  br label %71

71:                                               ; preds = %62, %50
  br label %72

72:                                               ; preds = %71, %38
  %73 = load i32, ptr %14, align 4, !tbaa !12
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %73, ptr %74, align 4, !tbaa !12
  store i32 0, ptr %13, align 4
  br label %75

75:                                               ; preds = %72, %61, %49, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %76 = load i32, ptr %13, align 4
  switch i32 %76, label %192 [
    i32 0, label %77
  ]

77:                                               ; preds = %75
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 4
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = icmp ugt ptr %79, %80
  br i1 %81, label %82, label %83

82:                                               ; preds = %77
  store i64 -72, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %192

83:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = load i8, ptr %84, align 1, !tbaa !11
  %86 = zext i8 %85 to i32
  %87 = ashr i32 %86, 6
  store i32 %87, ptr %15, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = load i8, ptr %88, align 1, !tbaa !11
  %90 = zext i8 %89 to i32
  %91 = ashr i32 %90, 4
  %92 = and i32 %91, 3
  store i32 %92, ptr %16, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = load i8, ptr %93, align 1, !tbaa !11
  %95 = zext i8 %94 to i32
  %96 = ashr i32 %95, 2
  %97 = and i32 %96, 3
  store i32 %97, ptr %17, align 4, !tbaa !12
  %98 = load ptr, ptr %12, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i32 1
  store ptr %99, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %100, i32 0, i32 4
  %102 = getelementptr inbounds %struct.ZSTD_entropyDTables_t, ptr %101, i32 0, i32 0
  %103 = getelementptr inbounds [513 x %struct.ZSTD_seqSymbol], ptr %102, i64 0, i64 0
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %104, i32 0, i32 0
  %106 = load i32, ptr %15, align 4, !tbaa !12
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  %108 = load ptr, ptr %11, align 8, !tbaa !5
  %109 = load ptr, ptr %12, align 8, !tbaa !5
  %110 = ptrtoint ptr %108 to i64
  %111 = ptrtoint ptr %109 to i64
  %112 = sub i64 %110, %111
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %113, i32 0, i32 15
  %115 = load i32, ptr %114, align 4, !tbaa !14
  %116 = call i64 @ZSTD_buildSeqTable(ptr noundef %103, ptr noundef %105, i32 noundef %106, i32 noundef 35, i32 noundef 9, ptr noundef %107, i64 noundef %112, ptr noundef @LL_base, ptr noundef @LL_bits, ptr noundef @LL_defaultDTable, i32 noundef %115)
  store i64 %116, ptr %18, align 8, !tbaa !9
  %117 = load i64, ptr %18, align 8, !tbaa !9
  %118 = call i32 @ERR_isError(i64 noundef %117)
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %121

120:                                              ; preds = %83
  store i64 -20, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %125

121:                                              ; preds = %83
  %122 = load i64, ptr %18, align 8, !tbaa !9
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = getelementptr inbounds i8, ptr %123, i64 %122
  store ptr %124, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %13, align 4
  br label %125

125:                                              ; preds = %121, %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  %126 = load i32, ptr %13, align 4
  switch i32 %126, label %184 [
    i32 0, label %127
  ]

127:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %128 = load ptr, ptr %6, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %128, i32 0, i32 4
  %130 = getelementptr inbounds %struct.ZSTD_entropyDTables_t, ptr %129, i32 0, i32 1
  %131 = getelementptr inbounds [257 x %struct.ZSTD_seqSymbol], ptr %130, i64 0, i64 0
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %132, i32 0, i32 2
  %134 = load i32, ptr %16, align 4, !tbaa !12
  %135 = load ptr, ptr %12, align 8, !tbaa !5
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  %137 = load ptr, ptr %12, align 8, !tbaa !5
  %138 = ptrtoint ptr %136 to i64
  %139 = ptrtoint ptr %137 to i64
  %140 = sub i64 %138, %139
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %141, i32 0, i32 15
  %143 = load i32, ptr %142, align 4, !tbaa !14
  %144 = call i64 @ZSTD_buildSeqTable(ptr noundef %131, ptr noundef %133, i32 noundef %134, i32 noundef 31, i32 noundef 8, ptr noundef %135, i64 noundef %140, ptr noundef @OF_base, ptr noundef @OF_bits, ptr noundef @OF_defaultDTable, i32 noundef %143)
  store i64 %144, ptr %19, align 8, !tbaa !9
  %145 = load i64, ptr %19, align 8, !tbaa !9
  %146 = call i32 @ERR_isError(i64 noundef %145)
  %147 = icmp ne i32 %146, 0
  br i1 %147, label %148, label %149

148:                                              ; preds = %127
  store i64 -20, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %153

149:                                              ; preds = %127
  %150 = load i64, ptr %19, align 8, !tbaa !9
  %151 = load ptr, ptr %12, align 8, !tbaa !5
  %152 = getelementptr inbounds i8, ptr %151, i64 %150
  store ptr %152, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %13, align 4
  br label %153

153:                                              ; preds = %149, %148
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  %154 = load i32, ptr %13, align 4
  switch i32 %154, label %184 [
    i32 0, label %155
  ]

155:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %156, i32 0, i32 4
  %158 = getelementptr inbounds %struct.ZSTD_entropyDTables_t, ptr %157, i32 0, i32 2
  %159 = getelementptr inbounds [513 x %struct.ZSTD_seqSymbol], ptr %158, i64 0, i64 0
  %160 = load ptr, ptr %6, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %160, i32 0, i32 1
  %162 = load i32, ptr %17, align 4, !tbaa !12
  %163 = load ptr, ptr %12, align 8, !tbaa !5
  %164 = load ptr, ptr %11, align 8, !tbaa !5
  %165 = load ptr, ptr %12, align 8, !tbaa !5
  %166 = ptrtoint ptr %164 to i64
  %167 = ptrtoint ptr %165 to i64
  %168 = sub i64 %166, %167
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.ZSTD_DCtx_s, ptr %169, i32 0, i32 15
  %171 = load i32, ptr %170, align 4, !tbaa !14
  %172 = call i64 @ZSTD_buildSeqTable(ptr noundef %159, ptr noundef %161, i32 noundef %162, i32 noundef 52, i32 noundef 9, ptr noundef %163, i64 noundef %168, ptr noundef @ML_base, ptr noundef @ML_bits, ptr noundef @ML_defaultDTable, i32 noundef %171)
  store i64 %172, ptr %20, align 8, !tbaa !9
  %173 = load i64, ptr %20, align 8, !tbaa !9
  %174 = call i32 @ERR_isError(i64 noundef %173)
  %175 = icmp ne i32 %174, 0
  br i1 %175, label %176, label %177

176:                                              ; preds = %155
  store i64 -20, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %181

177:                                              ; preds = %155
  %178 = load i64, ptr %20, align 8, !tbaa !9
  %179 = load ptr, ptr %12, align 8, !tbaa !5
  %180 = getelementptr inbounds i8, ptr %179, i64 %178
  store ptr %180, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %13, align 4
  br label %181

181:                                              ; preds = %177, %176
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  %182 = load i32, ptr %13, align 4
  switch i32 %182, label %184 [
    i32 0, label %183
  ]

183:                                              ; preds = %181
  store i32 0, ptr %13, align 4
  br label %184

184:                                              ; preds = %183, %181, %153, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  %185 = load i32, ptr %13, align 4
  switch i32 %185, label %192 [
    i32 0, label %186
  ]

186:                                              ; preds = %184
  %187 = load ptr, ptr %12, align 8, !tbaa !5
  %188 = load ptr, ptr %10, align 8, !tbaa !5
  %189 = ptrtoint ptr %187 to i64
  %190 = ptrtoint ptr %188 to i64
  %191 = sub i64 %189, %190
  store i64 %191, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %192

192:                                              ; preds = %186, %184, %82, %75, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %193 = load i64, ptr %5, align 8
  ret i64 %193
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 28844}
!15 = !{!"ZSTD_DCtx_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !16, i64 32, !6, i64 28744, !6, i64 28752, !6, i64 28760, !6, i64 28768, !10, i64 28776, !17, i64 28784, !10, i64 28824, !13, i64 28832, !13, i64 28836, !13, i64 28840, !13, i64 28844, !19, i64 28848, !10, i64 28936, !13, i64 28944, !13, i64 28948, !6, i64 28952, !20, i64 28960, !10, i64 28984, !10, i64 28992, !10, i64 29000, !13, i64 29008, !6, i64 29016, !6, i64 29024, !13, i64 29032, !6, i64 29040, !10, i64 29048, !10, i64 29056, !10, i64 29064, !6, i64 29072, !10, i64 29080, !10, i64 29088, !10, i64 29096, !10, i64 29104, !6, i64 29112, !13, i64 29120, !13, i64 29124, !13, i64 29128, !7, i64 29132, !7, i64 160212}
!16 = !{!"", !7, i64 0, !7, i64 4104, !7, i64 6160, !7, i64 10264, !7, i64 26652, !7, i64 28700}
!17 = !{!"", !18, i64 0, !18, i64 8, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32}
!18 = !{!"long long", !7, i64 0}
!19 = !{!"XXH64_state_s", !18, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !18, i64 32, !7, i64 40, !13, i64 72, !7, i64 76}
!20 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}


; 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.ZSTD_seqSymbol = type { i16, i8, i8, i32 }

@LL_base = external hidden constant [36 x i32], align 16
@LL_bits = external hidden constant [36 x i32], align 16
@LL_defaultDTable = external hidden constant [65 x %struct.ZSTD_seqSymbol], align 16
@OF_base = external hidden constant [32 x i32], align 16
@OF_bits = external hidden constant [32 x i32], align 16
@OF_defaultDTable = external hidden constant [33 x %struct.ZSTD_seqSymbol], align 16
@ML_base = external hidden constant [53 x i32], align 16
@ML_bits = external hidden constant [53 x i32], align 16
@ML_defaultDTable = external hidden constant [65 x %struct.ZSTD_seqSymbol], align 16

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @MEM_readLE16(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_decodeSeqHeaders(ptr noundef %0, ptr nocapture noundef writeonly %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #1 {
  %5 = getelementptr inbounds i8, ptr %2, i64 %3
  %6 = icmp eq i64 %3, 0
  br i1 %6, label %.thread, label %7

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %2, i64 1
  %9 = load i8, ptr %2, align 1, !tbaa !5
  %10 = zext i8 %9 to i32
  %.not = icmp eq i8 %9, 0
  br i1 %.not, label %11, label %12

11:                                               ; preds = %7
  store i32 0, ptr %1, align 4, !tbaa !8
  br label %.thread

12:                                               ; preds = %7
  %13 = icmp slt i8 %9, 0
  br i1 %13, label %14, label %31

14:                                               ; preds = %12
  %15 = icmp eq i8 %9, -1
  br i1 %15, label %16, label %23

16:                                               ; preds = %14
  %17 = icmp slt i64 %3, 3
  br i1 %17, label %.thread, label %18

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %2, i64 3
  %20 = tail call zeroext i16 @MEM_readLE16(ptr noundef nonnull %8)
  %21 = zext i16 %20 to i32
  %22 = add nuw nsw i32 %21, 32512
  br label %31

23:                                               ; preds = %14
  %.not84 = icmp sgt i64 %3, 1
  br i1 %.not84, label %24, label %.thread

24:                                               ; preds = %23
  %25 = shl nuw nsw i32 %10, 8
  %26 = add nsw i32 %25, -32768
  %27 = getelementptr inbounds i8, ptr %2, i64 2
  %28 = load i8, ptr %8, align 1, !tbaa !5
  %29 = zext i8 %28 to i32
  %30 = or disjoint i32 %26, %29
  br label %31

31:                                               ; preds = %18, %24, %12
  %.078 = phi i32 [ %22, %18 ], [ %30, %24 ], [ %10, %12 ]
  %.067 = phi ptr [ %19, %18 ], [ %27, %24 ], [ %8, %12 ]
  store i32 %.078, ptr %1, align 4, !tbaa !8
  %32 = getelementptr inbounds i8, ptr %.067, i64 4
  %33 = icmp ugt ptr %32, %5
  br i1 %33, label %.thread, label %34

34:                                               ; preds = %31
  %35 = load i8, ptr %.067, align 1, !tbaa !5
  %36 = zext i8 %35 to i32
  %37 = lshr i32 %36, 6
  %38 = lshr i32 %36, 2
  %39 = and i32 %38, 3
  %40 = getelementptr inbounds i8, ptr %.067, i64 1
  %41 = getelementptr inbounds i8, ptr %0, i64 32
  %42 = ptrtoint ptr %5 to i64
  %43 = ptrtoint ptr %40 to i64
  %44 = sub i64 %42, %43
  %45 = getelementptr inbounds i8, ptr %0, i64 28844
  %46 = load i32, ptr %45, align 4, !tbaa !10
  %47 = tail call i64 @ZSTD_buildSeqTable(ptr noundef nonnull %41, ptr noundef %0, i32 noundef %37, i32 noundef 35, i32 noundef 9, ptr noundef nonnull %40, i64 noundef %44, ptr noundef nonnull @LL_base, ptr noundef nonnull @LL_bits, ptr noundef nonnull @LL_defaultDTable, i32 noundef %46)
  %48 = tail call i32 @ERR_isError(i64 noundef %47)
  %.not85 = icmp eq i32 %48, 0
  br i1 %.not85, label %49, label %.thread

49:                                               ; preds = %34
  %50 = getelementptr inbounds i8, ptr %40, i64 %47
  %51 = lshr i32 %36, 4
  %52 = and i32 %51, 3
  %53 = getelementptr inbounds i8, ptr %0, i64 4136
  %54 = getelementptr inbounds i8, ptr %0, i64 16
  %55 = ptrtoint ptr %50 to i64
  %56 = sub i64 %42, %55
  %57 = load i32, ptr %45, align 4, !tbaa !10
  %58 = tail call i64 @ZSTD_buildSeqTable(ptr noundef nonnull %53, ptr noundef nonnull %54, i32 noundef %52, i32 noundef 31, i32 noundef 8, ptr noundef nonnull %50, i64 noundef %56, ptr noundef nonnull @OF_base, ptr noundef nonnull @OF_bits, ptr noundef nonnull @OF_defaultDTable, i32 noundef %57)
  %59 = tail call i32 @ERR_isError(i64 noundef %58)
  %.not86 = icmp eq i32 %59, 0
  br i1 %.not86, label %60, label %.thread

60:                                               ; preds = %49
  %61 = getelementptr inbounds i8, ptr %50, i64 %58
  %62 = getelementptr inbounds i8, ptr %0, i64 6192
  %63 = getelementptr inbounds i8, ptr %0, i64 8
  %64 = ptrtoint ptr %61 to i64
  %65 = sub i64 %42, %64
  %66 = load i32, ptr %45, align 4, !tbaa !10
  %67 = tail call i64 @ZSTD_buildSeqTable(ptr noundef nonnull %62, ptr noundef nonnull %63, i32 noundef %39, i32 noundef 52, i32 noundef 9, ptr noundef nonnull %61, i64 noundef %65, ptr noundef nonnull @ML_base, ptr noundef nonnull @ML_bits, ptr noundef nonnull @ML_defaultDTable, i32 noundef %66)
  %68 = tail call i32 @ERR_isError(i64 noundef %67)
  %.not87 = icmp eq i32 %68, 0
  br i1 %.not87, label %69, label %.thread

69:                                               ; preds = %60
  %70 = getelementptr inbounds i8, ptr %61, i64 %67
  %71 = ptrtoint ptr %70 to i64
  %72 = ptrtoint ptr %2 to i64
  %73 = sub i64 %71, %72
  br label %.thread

.thread:                                          ; preds = %34, %49, %23, %16, %11, %31, %4, %60, %69
  %.5 = phi i64 [ %73, %69 ], [ -20, %60 ], [ -72, %4 ], [ -72, %31 ], [ -72, %23 ], [ -72, %16 ], [ 1, %11 ], [ -20, %34 ], [ -20, %49 ]
  ret i64 %.5
}

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

attributes #0 = { 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 #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !9, i64 28844}
!11 = !{!"ZSTD_DCtx_s", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32, !12, i64 28744, !12, i64 28752, !12, i64 28760, !12, i64 28768, !14, i64 28776, !15, i64 28784, !14, i64 28824, !9, i64 28832, !9, i64 28836, !9, i64 28840, !9, i64 28844, !17, i64 28848, !14, i64 28936, !9, i64 28944, !9, i64 28948, !12, i64 28952, !18, i64 28960, !14, i64 28984, !14, i64 28992, !14, i64 29000, !9, i64 29008, !12, i64 29016, !12, i64 29024, !9, i64 29032, !12, i64 29040, !14, i64 29048, !14, i64 29056, !14, i64 29064, !12, i64 29072, !14, i64 29080, !14, i64 29088, !14, i64 29096, !14, i64 29104, !12, i64 29112, !9, i64 29120, !9, i64 29124, !9, i64 29128, !6, i64 29132, !6, i64 160212}
!12 = !{!"any pointer", !6, i64 0}
!13 = !{!"", !6, i64 0, !6, i64 4104, !6, i64 6160, !6, i64 10264, !6, i64 26652, !6, i64 28700}
!14 = !{!"long", !6, i64 0}
!15 = !{!"", !16, i64 0, !16, i64 8, !9, i64 16, !9, i64 20, !9, i64 24, !9, i64 28, !9, i64 32}
!16 = !{!"long long", !6, i64 0}
!17 = !{!"XXH64_state_s", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !6, i64 40, !9, i64 72, !6, i64 76}
!18 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16}


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