; 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.ZSTD_customMem = type { ptr, ptr, ptr }
%struct.SeqCollector = type { i32, ptr, i64, i64 }
%struct.ZSTD_CCtx_s = type { i32, i32, i32, %struct.ZSTD_CCtx_params_s, %struct.ZSTD_CCtx_params_s, %struct.ZSTD_CCtx_params_s, i32, i64, %struct.ZSTD_cwksp, i64, i64, i64, i64, %struct.XXH_NAMESPACEXXH64_state_s, %struct.ZSTD_customMem, ptr, i64, %struct.SeqCollector, i32, i32, %struct.seqStore_t, %struct.ldmState_t, ptr, i64, %struct.rawSeqStore_t, %struct.ZSTD_blockState_t, ptr, i32, ptr, i64, i64, i64, i64, ptr, i64, i64, i64, i32, i32, %struct.ZSTD_inBuffer_s, i64, i64, %struct.ZSTD_localDict, ptr, %struct.ZSTD_prefixDict_s, ptr, %struct.ZSTD_blockSplitCtx, ptr, i64 }
%struct.ZSTD_CCtx_params_s = type { i32, %struct.ZSTD_compressionParameters, %struct.ZSTD_frameParameters, i32, i32, i64, i32, i32, i32, i32, i64, i32, i32, %struct.ldmParams_t, i32, i32, i32, i32, i32, i32, i32, i32, %struct.ZSTD_customMem, i32, i32, ptr, ptr, i64, i32 }
%struct.ZSTD_compressionParameters = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.ZSTD_frameParameters = type { i32, i32, i32 }
%struct.ldmParams_t = type { i32, i32, i32, i32, i32, i32 }
%struct.ZSTD_cwksp = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32 }
%struct.XXH_NAMESPACEXXH64_state_s = type { i64, [4 x i64], [4 x i64], i32, i32, i64 }
%struct.seqStore_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i32, i32 }
%struct.ldmState_t = type { %struct.ZSTD_window_t, ptr, i32, ptr, [64 x i64], [64 x %struct.ldmMatchCandidate_t] }
%struct.ZSTD_window_t = type { ptr, ptr, ptr, i32, i32, i32 }
%struct.ldmMatchCandidate_t = type { ptr, i32, i32, ptr }
%struct.rawSeqStore_t = type { ptr, i64, i64, i64, i64 }
%struct.ZSTD_blockState_t = type { ptr, ptr, %struct.ZSTD_matchState_t }
%struct.ZSTD_matchState_t = type { %struct.ZSTD_window_t, i32, i32, i32, i32, ptr, [8 x i32], i64, i32, ptr, ptr, ptr, i32, i32, %struct.optState_t, ptr, %struct.ZSTD_compressionParameters, ptr, i32, i32 }
%struct.optState_t = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32 }
%struct.ZSTD_inBuffer_s = type { ptr, i64, i64 }
%struct.ZSTD_localDict = type { ptr, ptr, i64, i32, ptr }
%struct.ZSTD_prefixDict_s = type { ptr, i64, i32 }
%struct.ZSTD_blockSplitCtx = type { %struct.seqStore_t, %struct.seqStore_t, %struct.seqStore_t, %struct.seqStore_t, %struct.seqStore_t, [196 x i32], %struct.ZSTD_entropyCTablesMetadata_t }
%struct.ZSTD_entropyCTablesMetadata_t = type { %struct.ZSTD_hufCTablesMetadata_t, %struct.ZSTD_fseCTablesMetadata_t }
%struct.ZSTD_hufCTablesMetadata_t = type { i32, [128 x i8], i64 }
%struct.ZSTD_fseCTablesMetadata_t = type { i32, i32, i32, [133 x i8], i64, i64 }

@ZSTD_defaultCMem = external hidden constant %struct.ZSTD_customMem, 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: 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: nounwind uwtable
declare dso_local i64 @ZSTD_CCtx_getParameter(ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_generateSequences(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4) #0 {
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %struct.SeqCollector, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i64 %4, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %22 = load i64, ptr %11, align 8, !tbaa !9
  %23 = call i64 @ZSTD_compressBound(i64 noundef %22)
  store i64 %23, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %24 = load i64, ptr %12, align 8, !tbaa !9
  %25 = call ptr @ZSTD_customMalloc(i64 noundef %24, ptr noundef byval(%struct.ZSTD_customMem) align 8 @ZSTD_defaultCMem)
  store ptr %25, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  br label %26

26:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = call i64 @ZSTD_CCtx_getParameter(ptr noundef %27, i32 noundef 130, ptr noundef %15)
  store i64 %28, ptr %16, align 8, !tbaa !9
  %29 = load i64, ptr %16, align 8, !tbaa !9
  %30 = call i32 @ERR_isError(i64 noundef %29)
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %46

32:                                               ; preds = %26
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load i64, ptr %16, align 8, !tbaa !9
  store i64 %45, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %47

46:                                               ; preds = %26
  store i32 0, ptr %17, align 4
  br label %47

47:                                               ; preds = %46, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  %48 = load i32, ptr %17, align 4
  switch i32 %48, label %71 [
    i32 0, label %49
  ]

49:                                               ; preds = %47
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %15, align 4, !tbaa !11
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %68

55:                                               ; preds = %52
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  store i64 -40, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %71

68:                                               ; preds = %52
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  store i32 0, ptr %17, align 4
  br label %71

71:                                               ; preds = %70, %67, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %72 = load i32, ptr %17, align 4
  switch i32 %72, label %188 [
    i32 0, label %73
  ]

73:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  br label %74

74:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = call i64 @ZSTD_CCtx_getParameter(ptr noundef %75, i32 noundef 400, ptr noundef %18)
  store i64 %76, ptr %19, align 8, !tbaa !9
  %77 = load i64, ptr %19, align 8, !tbaa !9
  %78 = call i32 @ERR_isError(i64 noundef %77)
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %94

80:                                               ; preds = %74
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  %93 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %93, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %95

94:                                               ; preds = %74
  store i32 0, ptr %17, align 4
  br label %95

95:                                               ; preds = %94, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  %96 = load i32, ptr %17, align 4
  switch i32 %96, label %119 [
    i32 0, label %97
  ]

97:                                               ; preds = %95
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %18, align 4, !tbaa !11
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %116

103:                                              ; preds = %100
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  store i64 -40, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %119

116:                                              ; preds = %100
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  store i32 0, ptr %17, align 4
  br label %119

119:                                              ; preds = %118, %115, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  %120 = load i32, ptr %17, align 4
  switch i32 %120, label %188 [
    i32 0, label %121
  ]

121:                                              ; preds = %119
  br label %122

122:                                              ; preds = %121
  %123 = load ptr, ptr %13, align 8, !tbaa !5
  %124 = icmp eq ptr %123, null
  br i1 %124, label %125, label %138

125:                                              ; preds = %122
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  br label %137

137:                                              ; preds = %136
  store i64 -64, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %188

138:                                              ; preds = %122
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  %141 = getelementptr inbounds %struct.SeqCollector, ptr %14, i32 0, i32 0
  store i32 1, ptr %141, align 8, !tbaa !13
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.SeqCollector, ptr %14, i32 0, i32 1
  store ptr %142, ptr %143, align 8, !tbaa !15
  %144 = getelementptr inbounds %struct.SeqCollector, ptr %14, i32 0, i32 2
  store i64 0, ptr %144, align 8, !tbaa !16
  %145 = load i64, ptr %9, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct.SeqCollector, ptr %14, i32 0, i32 3
  store i64 %145, ptr %146, align 8, !tbaa !17
  %147 = load ptr, ptr %7, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %147, i32 0, i32 17
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %148, ptr align 8 %14, i64 32, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %149 = load ptr, ptr %7, align 8, !tbaa !5
  %150 = load ptr, ptr %13, align 8, !tbaa !5
  %151 = load i64, ptr %12, align 8, !tbaa !9
  %152 = load ptr, ptr %10, align 8, !tbaa !5
  %153 = load i64, ptr %11, align 8, !tbaa !9
  %154 = call i64 @ZSTD_compress2(ptr noundef %149, ptr noundef %150, i64 noundef %151, ptr noundef %152, i64 noundef %153)
  store i64 %154, ptr %20, align 8, !tbaa !9
  %155 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ZSTD_customFree(ptr noundef %155, ptr noundef byval(%struct.ZSTD_customMem) align 8 @ZSTD_defaultCMem)
  br label %156

156:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %157 = load i64, ptr %20, align 8, !tbaa !9
  store i64 %157, ptr %21, align 8, !tbaa !9
  %158 = load i64, ptr %21, align 8, !tbaa !9
  %159 = call i32 @ERR_isError(i64 noundef %158)
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %175

161:                                              ; preds = %156
  br label %162

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162
  br label %164

164:                                              ; preds = %163
  br label %165

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171
  br label %173

173:                                              ; preds = %172
  %174 = load i64, ptr %21, align 8, !tbaa !9
  store i64 %174, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %176

175:                                              ; preds = %156
  store i32 0, ptr %17, align 4
  br label %176

176:                                              ; preds = %175, %173
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  %177 = load i32, ptr %17, align 4
  switch i32 %177, label %181 [
    i32 0, label %178
  ]

178:                                              ; preds = %176
  br label %179

179:                                              ; preds = %178
  br label %180

180:                                              ; preds = %179
  store i32 0, ptr %17, align 4
  br label %181

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

183:                                              ; preds = %181
  %184 = load ptr, ptr %7, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.ZSTD_CCtx_s, ptr %184, i32 0, i32 17
  %186 = getelementptr inbounds %struct.SeqCollector, ptr %185, i32 0, i32 2
  %187 = load i64, ptr %186, align 8, !tbaa !19
  store i64 %187, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %188

188:                                              ; preds = %183, %181, %137, %119, %71
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %189 = load i64, ptr %6, align 8
  ret i64 %189
}

; Function Attrs: nounwind uwtable
declare dso_local i64 @ZSTD_compress2(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 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, !12, i64 0}
!14 = !{!"", !12, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!15 = !{!14, !6, i64 8}
!16 = !{!14, !10, i64 16}
!17 = !{!14, !10, i64 24}
!18 = !{i64 0, i64 4, !11, i64 8, i64 8, !5, i64 16, i64 8, !9, i64 24, i64 8, !9}
!19 = !{!20, !10, i64 928}
!20 = !{!"ZSTD_CCtx_s", !12, i64 0, !12, i64 4, !12, i64 8, !21, i64 16, !21, i64 232, !21, i64 448, !12, i64 664, !10, i64 672, !26, i64 680, !10, i64 752, !27, i64 760, !27, i64 768, !27, i64 776, !28, i64 784, !25, i64 872, !6, i64 896, !10, i64 904, !14, i64 912, !12, i64 944, !12, i64 948, !29, i64 952, !30, i64 1032, !6, i64 3144, !10, i64 3152, !32, i64 3160, !33, i64 3200, !6, i64 3520, !12, i64 3528, !6, i64 3536, !10, i64 3544, !10, i64 3552, !10, i64 3560, !10, i64 3568, !6, i64 3576, !10, i64 3584, !10, i64 3592, !10, i64 3600, !12, i64 3608, !12, i64 3612, !36, i64 3616, !10, i64 3640, !10, i64 3648, !37, i64 3656, !6, i64 3696, !38, i64 3704, !6, i64 3728, !39, i64 3736, !6, i64 5232, !10, i64 5240}
!21 = !{!"ZSTD_CCtx_params_s", !12, i64 0, !22, i64 4, !23, 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, !24, 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, !25, i64 152, !12, i64 176, !12, i64 180, !6, i64 184, !6, i64 192, !10, i64 200, !12, i64 208}
!22 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24}
!23 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!24 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!25 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !12, i64 60, !12, i64 64, !12, i64 68}
!27 = !{!"long long", !7, i64 0}
!28 = !{!"XXH_NAMESPACEXXH64_state_s", !10, i64 0, !7, i64 8, !7, i64 40, !12, i64 72, !12, i64 76, !10, i64 80}
!29 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !10, i64 64, !12, i64 72, !12, i64 76}
!30 = !{!"", !31, i64 0, !6, i64 40, !12, i64 48, !6, i64 56, !7, i64 64, !7, i64 576}
!31 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !12, i64 28, !12, i64 32}
!32 = !{!"", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!33 = !{!"", !6, i64 0, !6, i64 8, !34, i64 16}
!34 = !{!"ZSTD_matchState_t", !31, i64 0, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !6, i64 56, !7, i64 64, !10, i64 96, !12, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !12, i64 136, !12, i64 140, !35, i64 144, !6, i64 248, !22, i64 256, !6, i64 288, !12, i64 296, !12, i64 300}
!35 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !6, i64 88, !12, i64 96}
!36 = !{!"ZSTD_inBuffer_s", !6, i64 0, !10, i64 8, !10, i64 16}
!37 = !{!"", !6, i64 0, !6, i64 8, !10, i64 16, !12, i64 24, !6, i64 32}
!38 = !{!"ZSTD_prefixDict_s", !6, i64 0, !10, i64 8, !12, i64 16}
!39 = !{!"", !29, i64 0, !29, i64 80, !29, i64 160, !29, i64 240, !29, i64 320, !7, i64 400, !40, i64 1184}
!40 = !{!"", !41, i64 0, !42, i64 144}
!41 = !{!"", !12, i64 0, !7, i64 4, !10, i64 136}
!42 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !7, i64 12, !10, i64 152, !10, i64 160}


; 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_customMem = type { ptr, ptr, ptr }

@ZSTD_defaultCMem = external hidden constant %struct.ZSTD_customMem, 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: inlinehint nounwind uwtable
declare hidden void @ZSTD_customFree(ptr noundef, ptr noundef byval(%struct.ZSTD_customMem) align 8) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ZSTD_generateSequences(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4) local_unnamed_addr #0 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = tail call i64 @ZSTD_compressBound(i64 noundef %4)
  %9 = tail call ptr @ZSTD_customMalloc(i64 noundef %8, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 @ZSTD_defaultCMem)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  %10 = call i64 @ZSTD_CCtx_getParameter(ptr noundef %0, i32 noundef 130, ptr noundef nonnull %6)
  %11 = call i32 @ERR_isError(i64 noundef %10)
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %12, label %.thread

.thread:                                          ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  br label %27

12:                                               ; preds = %5
  %13 = load i32, ptr %6, align 4, !tbaa !5
  %.not39 = icmp eq i32 %13, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  br i1 %.not39, label %14, label %27

14:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  %15 = call i64 @ZSTD_CCtx_getParameter(ptr noundef %0, i32 noundef 400, ptr noundef nonnull %7)
  %16 = call i32 @ERR_isError(i64 noundef %15)
  %.not40 = icmp eq i32 %16, 0
  br i1 %.not40, label %17, label %.thread47

.thread47:                                        ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  br label %27

17:                                               ; preds = %14
  %18 = load i32, ptr %7, align 4, !tbaa !5
  %.not41 = icmp eq i32 %18, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  br i1 %.not41, label %19, label %27

19:                                               ; preds = %17
  %20 = icmp eq ptr %9, null
  br i1 %20, label %27, label %21

21:                                               ; preds = %19
  %22 = getelementptr inbounds i8, ptr %0, i64 912
  store i32 1, ptr %22, align 8, !tbaa !5
  %.sroa.418.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 920
  store ptr %1, ptr %.sroa.418.0..sroa_idx, align 8, !tbaa !9
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 928
  store i64 0, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !11
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 936
  store i64 %2, ptr %.sroa.6.0..sroa_idx, align 8, !tbaa !11
  %23 = call i64 @ZSTD_compress2(ptr noundef %0, ptr noundef nonnull %9, i64 noundef %8, ptr noundef %3, i64 noundef %4)
  call void @ZSTD_customFree(ptr noundef nonnull %9, ptr noundef nonnull byval(%struct.ZSTD_customMem) align 8 @ZSTD_defaultCMem)
  %24 = call i32 @ERR_isError(i64 noundef %23)
  %.not42 = icmp eq i32 %24, 0
  br i1 %.not42, label %25, label %27

25:                                               ; preds = %21
  %26 = load i64, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !13
  br label %27

27:                                               ; preds = %.thread47, %.thread, %19, %21, %17, %12, %25
  %.5 = phi i64 [ %26, %25 ], [ %23, %21 ], [ -40, %17 ], [ -40, %12 ], [ -64, %19 ], [ %10, %.thread ], [ %15, %.thread47 ]
  ret i64 %.5
}

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 928}
!14 = !{!"ZSTD_CCtx_s", !6, i64 0, !6, i64 4, !6, i64 8, !15, i64 16, !15, i64 232, !15, i64 448, !6, i64 664, !12, i64 672, !20, i64 680, !12, i64 752, !21, i64 760, !21, i64 768, !21, i64 776, !22, i64 784, !19, i64 872, !10, i64 896, !12, i64 904, !23, i64 912, !6, i64 944, !6, i64 948, !24, i64 952, !25, i64 1032, !10, i64 3144, !12, i64 3152, !27, i64 3160, !28, i64 3200, !10, i64 3520, !6, i64 3528, !10, i64 3536, !12, i64 3544, !12, i64 3552, !12, i64 3560, !12, i64 3568, !10, i64 3576, !12, i64 3584, !12, i64 3592, !12, i64 3600, !6, i64 3608, !6, i64 3612, !31, i64 3616, !12, i64 3640, !12, i64 3648, !32, i64 3656, !10, i64 3696, !33, i64 3704, !10, i64 3728, !34, i64 3736, !10, i64 5232, !12, i64 5240}
!15 = !{!"ZSTD_CCtx_params_s", !6, i64 0, !16, i64 4, !17, i64 32, !6, i64 44, !6, i64 48, !12, i64 56, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !12, i64 80, !6, i64 88, !6, i64 92, !18, i64 96, !6, i64 120, !6, i64 124, !6, i64 128, !6, i64 132, !6, i64 136, !6, i64 140, !6, i64 144, !6, i64 148, !19, i64 152, !6, i64 176, !6, i64 180, !10, i64 184, !10, i64 192, !12, i64 200, !6, i64 208}
!16 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!17 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!18 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!19 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16}
!20 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !6, i64 60, !6, i64 64, !6, i64 68}
!21 = !{!"long long", !7, i64 0}
!22 = !{!"XXH_NAMESPACEXXH64_state_s", !12, i64 0, !7, i64 8, !7, i64 40, !6, i64 72, !6, i64 76, !12, i64 80}
!23 = !{!"", !6, i64 0, !10, i64 8, !12, i64 16, !12, i64 24}
!24 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !12, i64 56, !12, i64 64, !6, i64 72, !6, i64 76}
!25 = !{!"", !26, i64 0, !10, i64 40, !6, i64 48, !10, i64 56, !7, i64 64, !7, i64 576}
!26 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 28, !6, i64 32}
!27 = !{!"", !10, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!28 = !{!"", !10, i64 0, !10, i64 8, !29, i64 16}
!29 = !{!"ZSTD_matchState_t", !26, i64 0, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !10, i64 56, !7, i64 64, !12, i64 96, !6, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !6, i64 136, !6, i64 140, !30, i64 144, !10, i64 248, !16, i64 256, !10, i64 288, !6, i64 296, !6, i64 300}
!30 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !6, i64 80, !10, i64 88, !6, i64 96}
!31 = !{!"ZSTD_inBuffer_s", !10, i64 0, !12, i64 8, !12, i64 16}
!32 = !{!"", !10, i64 0, !10, i64 8, !12, i64 16, !6, i64 24, !10, i64 32}
!33 = !{!"ZSTD_prefixDict_s", !10, i64 0, !12, i64 8, !6, i64 16}
!34 = !{!"", !24, i64 0, !24, i64 80, !24, i64 160, !24, i64 240, !24, i64 320, !7, i64 400, !35, i64 1184}
!35 = !{!"", !36, i64 0, !37, i64 144}
!36 = !{!"", !6, i64 0, !7, i64 4, !12, i64 136}
!37 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !7, i64 12, !12, i64 152, !12, i64 160}


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