; LLVM IR from litespeedtech/ls-qpack :: test (test_huff_dec)

; 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.huff_decode_retval = type { i32, i32, i32 }
%struct.lsqpack_huff_decode_state = type { i32, %struct.lsqpack_decode_status }
%struct.lsqpack_decode_status = type { i8, i8 }
%struct.test_huff_dec = type { i32, ptr, i64, ptr, i64 }

@verbose = external hidden global i32, align 4
@stderr = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [77 x i8], align 1
@__PRETTY_FUNCTION__.run_test = external hidden unnamed_addr constant [44 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @run_test(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.huff_decode_retval, align 4
  %4 = alloca %struct.lsqpack_huff_decode_state, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca [4096 x i8], align 16
  %12 = alloca %struct.huff_decode_retval, align 4
  %13 = alloca { i64, i32 }, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr %11) #7
  %14 = load i32, ptr @verbose, align 4, !tbaa !9
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %22

16:                                               ; preds = %1
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.test_huff_dec, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str.6, i32 noundef %20) #7
  br label %22

22:                                               ; preds = %16, %1
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %229, %22
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.test_huff_dec, ptr %26, i32 0, i32 2
  %28 = load i64, ptr %27, align 8, !tbaa !14
  %29 = icmp ule i64 %25, %28
  br i1 %29, label %30, label %232

30:                                               ; preds = %23
  %31 = load i32, ptr @verbose, align 4, !tbaa !9
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %40

33:                                               ; preds = %30
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.test_huff_dec, ptr %36, i32 0, i32 2
  %38 = load i64, ptr %37, align 8, !tbaa !14
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.7, i32 noundef %35, i64 noundef %38) #7
  br label %40

40:                                               ; preds = %33, %30
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %225, %40
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.test_huff_dec, ptr %44, i32 0, i32 4
  %46 = load i64, ptr %45, align 8, !tbaa !15
  %47 = icmp ule i64 %43, %46
  br i1 %47, label %48, label %228

48:                                               ; preds = %41
  store i32 0, ptr %7, align 4, !tbaa !9
  store i32 0, ptr %8, align 4, !tbaa !9
  %49 = getelementptr inbounds %struct.lsqpack_huff_decode_state, ptr %4, i32 0, i32 0
  store i32 0, ptr %49, align 4, !tbaa !16
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.test_huff_dec, ptr %50, i32 0, i32 2
  %52 = load i64, ptr %51, align 8, !tbaa !14
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = icmp ult i64 %52, %54
  br i1 %55, label %56, label %60

56:                                               ; preds = %48
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.test_huff_dec, ptr %57, i32 0, i32 2
  %59 = load i64, ptr %58, align 8, !tbaa !14
  br label %63

60:                                               ; preds = %48
  %61 = load i32, ptr %5, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  br label %63

63:                                               ; preds = %60, %56
  %64 = phi i64 [ %59, %56 ], [ %62, %60 ]
  %65 = trunc i64 %64 to i32
  store i32 %65, ptr %9, align 4, !tbaa !9
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.test_huff_dec, ptr %66, i32 0, i32 4
  %68 = load i64, ptr %67, align 8, !tbaa !15
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = zext i32 %69 to i64
  %71 = icmp ult i64 %68, %70
  br i1 %71, label %72, label %76

72:                                               ; preds = %63
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.test_huff_dec, ptr %73, i32 0, i32 4
  %75 = load i64, ptr %74, align 8, !tbaa !15
  br label %79

76:                                               ; preds = %63
  %77 = load i32, ptr %6, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  br label %79

79:                                               ; preds = %76, %72
  %80 = phi i64 [ %75, %72 ], [ %78, %76 ]
  %81 = trunc i64 %80 to i32
  store i32 %81, ptr %10, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %211, %79
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = load i32, ptr %9, align 4, !tbaa !9
  %85 = add i32 %83, %84
  %86 = zext i32 %85 to i64
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.test_huff_dec, ptr %87, i32 0, i32 2
  %89 = load i64, ptr %88, align 8, !tbaa !14
  %90 = icmp ule i64 %86, %89
  br i1 %90, label %91, label %92

91:                                               ; preds = %82
  br label %93

92:                                               ; preds = %82
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.9, i32 noundef 342, ptr noundef @__PRETTY_FUNCTION__.run_test) #8
  unreachable

93:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #7
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.test_huff_dec, ptr %94, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !19
  %97 = load i32, ptr %7, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds i8, ptr %96, i64 %98
  %100 = load i32, ptr %9, align 4, !tbaa !9
  %101 = getelementptr inbounds [4096 x i8], ptr %11, i64 0, i64 0
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = getelementptr inbounds i8, ptr %101, i64 %103
  %105 = load i32, ptr %10, align 4, !tbaa !9
  %106 = load ptr, ptr %2, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.test_huff_dec, ptr %106, i32 0, i32 2
  %108 = load i64, ptr %107, align 8, !tbaa !14
  %109 = load i32, ptr %7, align 4, !tbaa !9
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = add i32 %109, %110
  %112 = zext i32 %111 to i64
  %113 = icmp eq i64 %108, %112
  %114 = zext i1 %113 to i32
  %115 = call { i64, i32 } @lsqpack_huff_decode_full(ptr noundef %99, i32 noundef %100, ptr noundef %104, i32 noundef %105, ptr noundef %4, i32 noundef %114)
  store { i64, i32 } %115, ptr %13, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 8 %13, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 4 %12, i64 12, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #7
  %116 = getelementptr inbounds %struct.huff_decode_retval, ptr %3, i32 0, i32 0
  %117 = load i32, ptr %116, align 4, !tbaa !21
  switch i32 %117, label %203 [
    i32 0, label %118
    i32 1, label %156
    i32 2, label %156
  ]

118:                                              ; preds = %93
  %119 = getelementptr inbounds %struct.huff_decode_retval, ptr %3, i32 0, i32 2
  %120 = load i32, ptr %119, align 4, !tbaa !23
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = add i32 %121, %120
  store i32 %122, ptr %7, align 4, !tbaa !9
  %123 = getelementptr inbounds %struct.huff_decode_retval, ptr %3, i32 0, i32 1
  %124 = load i32, ptr %123, align 4, !tbaa !24
  %125 = load i32, ptr %8, align 4, !tbaa !9
  %126 = add i32 %125, %124
  store i32 %126, ptr %8, align 4, !tbaa !9
  %127 = load ptr, ptr %2, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.test_huff_dec, ptr %127, i32 0, i32 4
  %129 = load i64, ptr %128, align 8, !tbaa !15
  %130 = load i32, ptr %8, align 4, !tbaa !9
  %131 = zext i32 %130 to i64
  %132 = icmp eq i64 %129, %131
  br i1 %132, label %133, label %134

133:                                              ; preds = %118
  br label %135

134:                                              ; preds = %118
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.9, i32 noundef 351, ptr noundef @__PRETTY_FUNCTION__.run_test) #8
  unreachable

135:                                              ; preds = %133
  %136 = load ptr, ptr %2, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.test_huff_dec, ptr %136, i32 0, i32 2
  %138 = load i64, ptr %137, align 8, !tbaa !14
  %139 = load i32, ptr %7, align 4, !tbaa !9
  %140 = zext i32 %139 to i64
  %141 = icmp eq i64 %138, %140
  br i1 %141, label %142, label %143

142:                                              ; preds = %135
  br label %144

143:                                              ; preds = %135
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.9, i32 noundef 352, ptr noundef @__PRETTY_FUNCTION__.run_test) #8
  unreachable

144:                                              ; preds = %142
  %145 = load ptr, ptr %2, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.test_huff_dec, ptr %145, i32 0, i32 3
  %147 = load ptr, ptr %146, align 8, !tbaa !25
  %148 = getelementptr inbounds [4096 x i8], ptr %11, i64 0, i64 0
  %149 = load i32, ptr %8, align 4, !tbaa !9
  %150 = zext i32 %149 to i64
  %151 = call i32 @memcmp(ptr noundef %147, ptr noundef %148, i64 noundef %150) #9
  %152 = icmp eq i32 0, %151
  br i1 %152, label %153, label %154

153:                                              ; preds = %144
  br label %155

154:                                              ; preds = %144
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.9, i32 noundef 353, ptr noundef @__PRETTY_FUNCTION__.run_test) #8
  unreachable

155:                                              ; preds = %153
  br label %210

156:                                              ; preds = %93, %93
  %157 = getelementptr inbounds %struct.huff_decode_retval, ptr %3, i32 0, i32 2
  %158 = load i32, ptr %157, align 4, !tbaa !23
  %159 = load i32, ptr %7, align 4, !tbaa !9
  %160 = add i32 %159, %158
  store i32 %160, ptr %7, align 4, !tbaa !9
  %161 = getelementptr inbounds %struct.huff_decode_retval, ptr %3, i32 0, i32 1
  %162 = load i32, ptr %161, align 4, !tbaa !24
  %163 = load i32, ptr %8, align 4, !tbaa !9
  %164 = add i32 %163, %162
  store i32 %164, ptr %8, align 4, !tbaa !9
  %165 = load i32, ptr %8, align 4, !tbaa !9
  %166 = zext i32 %165 to i64
  %167 = sub i64 4096, %166
  %168 = load i32, ptr %6, align 4, !tbaa !9
  %169 = zext i32 %168 to i64
  %170 = icmp ult i64 %167, %169
  br i1 %170, label %171, label %175

171:                                              ; preds = %156
  %172 = load i32, ptr %8, align 4, !tbaa !9
  %173 = zext i32 %172 to i64
  %174 = sub i64 4096, %173
  br label %178

175:                                              ; preds = %156
  %176 = load i32, ptr %6, align 4, !tbaa !9
  %177 = zext i32 %176 to i64
  br label %178

178:                                              ; preds = %175, %171
  %179 = phi i64 [ %174, %171 ], [ %177, %175 ]
  %180 = trunc i64 %179 to i32
  store i32 %180, ptr %10, align 4, !tbaa !9
  %181 = load ptr, ptr %2, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.test_huff_dec, ptr %181, i32 0, i32 2
  %183 = load i64, ptr %182, align 8, !tbaa !14
  %184 = load i32, ptr %7, align 4, !tbaa !9
  %185 = zext i32 %184 to i64
  %186 = sub i64 %183, %185
  %187 = load i32, ptr %5, align 4, !tbaa !9
  %188 = zext i32 %187 to i64
  %189 = icmp ult i64 %186, %188
  br i1 %189, label %190, label %197

190:                                              ; preds = %178
  %191 = load ptr, ptr %2, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.test_huff_dec, ptr %191, i32 0, i32 2
  %193 = load i64, ptr %192, align 8, !tbaa !14
  %194 = load i32, ptr %7, align 4, !tbaa !9
  %195 = zext i32 %194 to i64
  %196 = sub i64 %193, %195
  br label %200

197:                                              ; preds = %178
  %198 = load i32, ptr %5, align 4, !tbaa !9
  %199 = zext i32 %198 to i64
  br label %200

200:                                              ; preds = %197, %190
  %201 = phi i64 [ %196, %190 ], [ %199, %197 ]
  %202 = trunc i64 %201 to i32
  store i32 %202, ptr %9, align 4, !tbaa !9
  br label %210

203:                                              ; preds = %93
  %204 = getelementptr inbounds %struct.huff_decode_retval, ptr %3, i32 0, i32 0
  %205 = load i32, ptr %204, align 4, !tbaa !21
  %206 = icmp eq i32 %205, 3
  br i1 %206, label %207, label %208

207:                                              ; preds = %203
  br label %209

208:                                              ; preds = %203
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.9, i32 noundef 363, ptr noundef @__PRETTY_FUNCTION__.run_test) #8
  unreachable

209:                                              ; preds = %207
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.9, i32 noundef 364, ptr noundef @__PRETTY_FUNCTION__.run_test) #8
  unreachable

210:                                              ; preds = %200, %155
  br label %211

211:                                              ; preds = %210
  %212 = load i32, ptr %7, align 4, !tbaa !9
  %213 = zext i32 %212 to i64
  %214 = load ptr, ptr %2, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.test_huff_dec, ptr %214, i32 0, i32 2
  %216 = load i64, ptr %215, align 8, !tbaa !14
  %217 = icmp ult i64 %213, %216
  br i1 %217, label %82, label %218, !llvm.loop !26

218:                                              ; preds = %211
  %219 = getelementptr inbounds %struct.huff_decode_retval, ptr %3, i32 0, i32 0
  %220 = load i32, ptr %219, align 4, !tbaa !21
  %221 = icmp eq i32 %220, 0
  br i1 %221, label %222, label %223

222:                                              ; preds = %218
  br label %224

223:                                              ; preds = %218
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.9, i32 noundef 368, ptr noundef @__PRETTY_FUNCTION__.run_test) #8
  unreachable

224:                                              ; preds = %222
  br label %225

225:                                              ; preds = %224
  %226 = load i32, ptr %6, align 4, !tbaa !9
  %227 = add i32 %226, 1
  store i32 %227, ptr %6, align 4, !tbaa !9
  br label %41, !llvm.loop !28

228:                                              ; preds = %41
  br label %229

229:                                              ; preds = %228
  %230 = load i32, ptr %5, align 4, !tbaa !9
  %231 = add i32 %230, 1
  store i32 %231, ptr %5, align 4, !tbaa !9
  br label %23, !llvm.loop !29

232:                                              ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4096, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %3) #7
  ret void
}

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare { i64, i32 } @lsqpack_huff_decode_full(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #4

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #6

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 = { nounwind "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 = { noreturn nounwind "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 = { "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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind willreturn memory(read) "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 #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"test_huff_dec", !10, i64 0, !6, i64 8, !13, i64 16, !6, i64 24, !13, i64 32}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 16}
!15 = !{!12, !13, i64 32}
!16 = !{!17, !10, i64 0}
!17 = !{!"lsqpack_huff_decode_state", !10, i64 0, !18, i64 4}
!18 = !{!"lsqpack_decode_status", !7, i64 0, !7, i64 1}
!19 = !{!12, !6, i64 8}
!20 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9}
!21 = !{!22, !10, i64 0}
!22 = !{!"huff_decode_retval", !10, i64 0, !10, i64 4, !10, i64 8}
!23 = !{!22, !10, i64 8}
!24 = !{!22, !10, i64 4}
!25 = !{!12, !6, i64 24}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = distinct !{!28, !27}
!29 = distinct !{!29, !27}


; 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.lsqpack_huff_decode_state = type { i32, %struct.lsqpack_decode_status }
%struct.lsqpack_decode_status = type { i8, i8 }

@verbose = external hidden local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [77 x i8], align 1
@__PRETTY_FUNCTION__.run_test = external hidden unnamed_addr constant [44 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @run_test(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca %struct.lsqpack_huff_decode_state, align 4
  %3 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %3) #7
  %4 = load i32, ptr @verbose, align 4, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %9, label %5

5:                                                ; preds = %1
  %6 = load ptr, ptr @stderr, align 8, !tbaa !9
  %7 = load i32, ptr %0, align 8, !tbaa !11
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.6, i32 noundef %7) #8
  br label %9

9:                                                ; preds = %5, %1
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load i64, ptr %10, align 8, !tbaa !14
  %.not76120 = icmp eq i64 %11, 0
  br i1 %.not76120, label %._crit_edge124, label %.lr.ph123

.lr.ph123:                                        ; preds = %9
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  br label %15

15:                                               ; preds = %.lr.ph123, %._crit_edge
  %.pre158159 = phi i64 [ %11, %.lr.ph123 ], [ %.pre158160, %._crit_edge ]
  %16 = phi i64 [ 1, %.lr.ph123 ], [ %72, %._crit_edge ]
  %.0121 = phi i32 [ 1, %.lr.ph123 ], [ %71, %._crit_edge ]
  %17 = load i32, ptr @verbose, align 4, !tbaa !5
  %.not77 = icmp eq i32 %17, 0
  br i1 %.not77, label %21, label %18

18:                                               ; preds = %15
  %19 = load ptr, ptr @stderr, align 8, !tbaa !9
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.7, i32 noundef %.0121, i64 noundef %.pre158159) #8
  %.pre158.pre = load i64, ptr %10, align 8, !tbaa !14
  br label %21

21:                                               ; preds = %18, %15
  %.pre158 = phi i64 [ %.pre158.pre, %18 ], [ %.pre158159, %15 ]
  %22 = load i64, ptr %12, align 8, !tbaa !15
  %.not78118 = icmp eq i64 %22, 0
  br i1 %.not78118, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %21, %.thread85
  %23 = phi i64 [ %48, %.thread85 ], [ %.pre158, %21 ]
  %24 = phi i64 [ %70, %.thread85 ], [ 1, %21 ]
  %.059119 = phi i32 [ %69, %.thread85 ], [ 1, %21 ]
  store i32 0, ptr %2, align 4, !tbaa !16
  %. = call i64 @llvm.umin.i64(i64 %23, i64 %16)
  br label %25

25:                                               ; preds = %.lr.ph, %57
  %26 = phi i64 [ %64, %57 ], [ %23, %.lr.ph ]
  %.065.ph.in = phi i64 [ %.80, %57 ], [ %., %.lr.ph ]
  %.063.ph = phi i32 [ %63, %57 ], [ %.059119, %.lr.ph ]
  %.061.ph = phi i32 [ %59, %57 ], [ 0, %.lr.ph ]
  %.060.ph = phi i32 [ %58, %57 ], [ 0, %.lr.ph ]
  %.065.ph = trunc i64 %.065.ph.in to i32
  %27 = add i32 %.060.ph, %.065.ph
  %28 = zext i32 %27 to i64
  %.not79 = icmp ult i64 %26, %28
  br i1 %.not79, label %29, label %30

29:                                               ; preds = %25
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, i32 noundef 342, ptr noundef nonnull @__PRETTY_FUNCTION__.run_test) #9
  unreachable

30:                                               ; preds = %25
  %31 = load ptr, ptr %13, align 8, !tbaa !19
  %32 = zext i32 %.060.ph to i64
  %33 = getelementptr inbounds i8, ptr %31, i64 %32
  %34 = zext i32 %.061.ph to i64
  %35 = getelementptr inbounds i8, ptr %3, i64 %34
  %36 = icmp eq i64 %26, %28
  %37 = zext i1 %36 to i32
  %38 = call { i64, i32 } @lsqpack_huff_decode_full(ptr noundef %33, i32 noundef %.065.ph, ptr noundef nonnull %35, i32 noundef %.063.ph, ptr noundef nonnull %2, i32 noundef %37) #7
  %.fca.0.extract = extractvalue { i64, i32 } %38, 0
  %.fca.1.extract = extractvalue { i64, i32 } %38, 1
  %.sroa.034.0.extract.trunc = trunc i64 %.fca.0.extract to i32
  switch i32 %.sroa.034.0.extract.trunc, label %55 [
    i32 0, label %39
    i32 1, label %57
    i32 2, label %57
    i32 3, label %56
  ]

39:                                               ; preds = %30
  %.sroa.034.4.extract.shift = lshr i64 %.fca.0.extract, 32
  %.sroa.034.4.extract.trunc = trunc nuw i64 %.sroa.034.4.extract.shift to i32
  %40 = add i32 %.061.ph, %.sroa.034.4.extract.trunc
  %41 = load i64, ptr %12, align 8, !tbaa !15
  %42 = zext i32 %40 to i64
  %43 = icmp eq i64 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.9, i32 noundef 351, ptr noundef nonnull @__PRETTY_FUNCTION__.run_test) #9
  unreachable

45:                                               ; preds = %39
  %46 = add i32 %.fca.1.extract, %.060.ph
  %47 = load i64, ptr %10, align 8, !tbaa !14
  %48 = zext i32 %46 to i64
  %49 = icmp eq i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %45
  call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.9, i32 noundef 352, ptr noundef nonnull @__PRETTY_FUNCTION__.run_test) #9
  unreachable

51:                                               ; preds = %45
  %52 = load ptr, ptr %14, align 8, !tbaa !20
  %bcmp = call i32 @bcmp(ptr %52, ptr nonnull %3, i64 %42)
  %53 = icmp eq i32 %bcmp, 0
  br i1 %53, label %.thread85, label %54

54:                                               ; preds = %51
  call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.9, i32 noundef 353, ptr noundef nonnull @__PRETTY_FUNCTION__.run_test) #9
  unreachable

55:                                               ; preds = %30
  call void @__assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.9, i32 noundef 363, ptr noundef nonnull @__PRETTY_FUNCTION__.run_test) #9
  unreachable

56:                                               ; preds = %30
  call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.9, i32 noundef 364, ptr noundef nonnull @__PRETTY_FUNCTION__.run_test) #9
  unreachable

57:                                               ; preds = %30, %30
  %58 = add i32 %.fca.1.extract, %.060.ph
  %.sroa.034.4.extract.shift40 = lshr i64 %.fca.0.extract, 32
  %.sroa.034.4.extract.trunc41 = trunc nuw i64 %.sroa.034.4.extract.shift40 to i32
  %59 = add i32 %.061.ph, %.sroa.034.4.extract.trunc41
  %60 = zext i32 %59 to i64
  %61 = sub nsw i64 4096, %60
  %62 = call i64 @llvm.umin.i64(i64 %61, i64 %24)
  %63 = trunc nuw i64 %62 to i32
  %64 = load i64, ptr %10, align 8, !tbaa !14
  %65 = zext i32 %58 to i64
  %66 = sub i64 %64, %65
  %.80 = call i64 @llvm.umin.i64(i64 %66, i64 %16)
  %67 = icmp ugt i64 %64, %65
  br i1 %67, label %25, label %68, !llvm.loop !21

68:                                               ; preds = %57
  call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.9, i32 noundef 368, ptr noundef nonnull @__PRETTY_FUNCTION__.run_test) #9
  unreachable

.thread85:                                        ; preds = %51
  %69 = add i32 %.059119, 1
  %70 = zext i32 %69 to i64
  %.not78 = icmp ult i32 %40, %69
  br i1 %.not78, label %._crit_edge, label %.lr.ph, !llvm.loop !23

._crit_edge:                                      ; preds = %.thread85, %21
  %.pre158160 = phi i64 [ %.pre158, %21 ], [ %48, %.thread85 ]
  %71 = add i32 %.0121, 1
  %72 = zext i32 %71 to i64
  %.not76 = icmp ult i64 %.pre158160, %72
  br i1 %.not76, label %._crit_edge124, label %15, !llvm.loop !24

._crit_edge124:                                   ; preds = %._crit_edge, %9
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  ret void
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare { i64, i32 } @lsqpack_huff_decode_full(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

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

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6

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 = { nofree nounwind "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 = { noreturn nounwind "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 = { "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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind willreturn memory(argmem: read) }
attributes #7 = { nounwind }
attributes #8 = { cold nounwind }
attributes #9 = { noreturn 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, !6, i64 0}
!12 = !{!"test_huff_dec", !6, i64 0, !10, i64 8, !13, i64 16, !10, i64 24, !13, i64 32}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 16}
!15 = !{!12, !13, i64 32}
!16 = !{!17, !6, i64 0}
!17 = !{!"lsqpack_huff_decode_state", !6, i64 0, !18, i64 4}
!18 = !{!"lsqpack_decode_status", !7, i64 0, !7, i64 1}
!19 = !{!12, !10, i64 8}
!20 = !{!12, !10, i64 24}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}


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