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

; 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.anon = type { ptr, ptr, i32 }
%struct.qpack_header_block_test = type { i32, i32, i32, i32, [10 x %struct.anon], i64, [200 x i8], i64, [10 x i8], i64, [200 x i8] }

@header_block_tests = external hidden constant <{ { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, [200 x i8], i64, [10 x i8], i64, <{ i8, [199 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, [200 x i8], i64, [10 x i8], i64, <{ [8 x i8], [192 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, <{ i8, i8, i8, i8, i8, i8, i8, [193 x i8] }>, i64, [10 x i8], i64, <{ [8 x i8], [192 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, <{ i8, i8, i8, i8, i8, i8, i8, [193 x i8] }>, i64, <{ i8, i8, [8 x i8] }>, i64, <{ i8, [199 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, [200 x i8], i64, [10 x i8], i64, <{ [17 x i8], [183 x i8] }> }, { i32, i32, i32, i32, [10 x %struct.anon], i64, <{ [53 x i8], [147 x i8] }>, i64, [10 x i8], i64, <{ [55 x i8], [145 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, <{ [17 x i8], [183 x i8] }>, i64, <{ i8, i8, [8 x i8] }>, i64, <{ i8, [199 x i8] }> } }>, align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #2
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %3

3:                                                ; preds = %14, %0
  %4 = load i32, ptr %2, align 4, !tbaa !5
  %5 = zext i32 %4 to i64
  %6 = icmp ult i64 %5, 7
  br i1 %6, label %7, label %17

7:                                                ; preds = %3
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = zext i32 %8 to i64
  %10 = getelementptr inbounds [7 x %struct.qpack_header_block_test], ptr @header_block_tests, i64 0, i64 %9
  call void @run_header_test(ptr noundef %10)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds [7 x %struct.qpack_header_block_test], ptr @header_block_tests, i64 0, i64 %12
  call void @run_decoded_headers_test(ptr noundef %13)
  br label %14

14:                                               ; preds = %7
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = add i32 %15, 1
  store i32 %16, ptr %2, align 4, !tbaa !5
  br label %3, !llvm.loop !9

17:                                               ; preds = %3
  call void @run_header_cancellation_test(ptr noundef @header_block_tests)
  call void @test_enc_init()
  call void @test_push_promise()
  call void @test_discard_header(i32 noundef 0)
  call void @test_discard_header(i32 noundef 1)
  call void @test_static_bounds_header_block()
  call void @test_static_bounds_enc_stream()
  call void @test_wonr_name_too_large_huffman()
  call void @test_wonr_name_too_large_plain()
  call void @test_wonr_value_too_large_huffman()
  call void @test_wonr_value_too_large_plain()
  call void @test_winr_value_too_large_huffman()
  call void @test_winr_value_too_large_plain()
  call void @test_dec_header_zero_in()
  call void @test_dec_header_too_short(i64 noundef 0)
  call void @test_dec_header_too_short(i64 noundef 1)
  call void @test_enc_risked_streams()
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #2
  ret i32 0
}

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @test_enc_init() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_push_promise() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_discard_header(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @test_static_bounds_header_block() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_static_bounds_enc_stream() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_wonr_name_too_large_huffman() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_wonr_name_too_large_plain() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_wonr_value_too_large_huffman() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_wonr_value_too_large_plain() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_winr_value_too_large_huffman() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_winr_value_too_large_plain() #0

; Function Attrs: nounwind uwtable
declare hidden void @test_dec_header_zero_in() #0

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

; Function Attrs: nounwind uwtable
declare hidden void @test_enc_risked_streams() #0

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

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 }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; 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.anon = type { ptr, ptr, i32 }

@header_block_tests = external hidden constant <{ { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, [200 x i8], i64, [10 x i8], i64, <{ i8, [199 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, [200 x i8], i64, [10 x i8], i64, <{ [8 x i8], [192 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, <{ i8, i8, i8, i8, i8, i8, i8, [193 x i8] }>, i64, [10 x i8], i64, <{ [8 x i8], [192 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, <{ i8, i8, i8, i8, i8, i8, i8, [193 x i8] }>, i64, <{ i8, i8, [8 x i8] }>, i64, <{ i8, [199 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, [200 x i8], i64, [10 x i8], i64, <{ [17 x i8], [183 x i8] }> }, { i32, i32, i32, i32, [10 x %struct.anon], i64, <{ [53 x i8], [147 x i8] }>, i64, [10 x i8], i64, <{ [55 x i8], [145 x i8] }> }, { i32, i32, i32, i32, <{ %struct.anon, [9 x %struct.anon] }>, i64, <{ [17 x i8], [183 x i8] }>, i64, <{ i8, i8, [8 x i8] }>, i64, <{ i8, [199 x i8] }> } }>, align 16

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  tail call void @run_header_test(ptr noundef nonnull @header_block_tests)
  tail call void @run_decoded_headers_test(ptr noundef nonnull @header_block_tests)
  tail call void @run_header_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 696))
  tail call void @run_decoded_headers_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 696))
  tail call void @run_header_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 1392))
  tail call void @run_decoded_headers_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 1392))
  tail call void @run_header_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 2088))
  tail call void @run_decoded_headers_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 2088))
  tail call void @run_header_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 2784))
  tail call void @run_decoded_headers_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 2784))
  tail call void @run_header_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 3480))
  tail call void @run_decoded_headers_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 3480))
  tail call void @run_header_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 4176))
  tail call void @run_decoded_headers_test(ptr noundef nonnull getelementptr inbounds (i8, ptr @header_block_tests, i64 4176))
  tail call void @run_header_cancellation_test(ptr noundef nonnull @header_block_tests)
  tail call void @test_enc_init()
  tail call void @test_push_promise()
  tail call void @test_discard_header(i32 noundef 0)
  tail call void @test_discard_header(i32 noundef 1)
  tail call void @test_static_bounds_header_block()
  tail call void @test_static_bounds_enc_stream()
  tail call void @test_wonr_name_too_large_huffman()
  tail call void @test_wonr_name_too_large_plain()
  tail call void @test_wonr_value_too_large_huffman()
  tail call void @test_wonr_value_too_large_plain()
  tail call void @test_winr_value_too_large_huffman()
  tail call void @test_winr_value_too_large_plain()
  tail call void @test_dec_header_zero_in()
  tail call void @test_dec_header_too_short(i64 noundef 0)
  tail call void @test_dec_header_too_short(i64 noundef 1)
  tail call void @test_enc_risked_streams()
  ret i32 0
}

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @test_enc_init() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_push_promise() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @test_static_bounds_header_block() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_static_bounds_enc_stream() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_wonr_name_too_large_huffman() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_wonr_name_too_large_plain() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_wonr_value_too_large_huffman() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_wonr_value_too_large_plain() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_winr_value_too_large_huffman() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_winr_value_too_large_plain() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @test_dec_header_zero_in() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @test_enc_risked_streams() 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" }

!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)"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass