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

; 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.lsqpack_dec_hset_if = type { ptr, ptr, ptr }
%struct.lsqpack_dec = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, %struct.lsqpack_ringbuf, %struct.anon, [8 x %struct.anon.0], i32, float, %struct.anon.1, %struct.lsqpack_dec_err }
%struct.lsqpack_ringbuf = type { i32, i32, i32, ptr }
%struct.anon = type { ptr, ptr }
%struct.anon.0 = type { ptr, ptr }
%struct.anon.1 = type { i32, %union.anon }
%union.anon = type { %struct.anon.2 }
%struct.anon.2 = type { %struct.lsqpack_dec_int_state, %struct.lsqpack_huff_decode_state, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i8, i8 }
%struct.lsqpack_dec_int_state = type { i32, i32, i32, i64 }
%struct.lsqpack_huff_decode_state = type { i32, %struct.lsqpack_decode_status }
%struct.lsqpack_decode_status = type { i8, i8 }
%struct.lsqpack_dec_err = type { i32, i32, i64, i64 }

@__const.main.callbacks = external hidden unnamed_addr constant %struct.lsqpack_dec_hset_if, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.lsqpack_dec, align 8
  %7 = alloca %struct.lsqpack_dec_hset_if, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca [16384 x i8], align 16
  %11 = alloca i64, align 8
  %12 = alloca [10 x i8], align 1
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 352, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 @__const.main.callbacks, i64 24, i1 false)
  %16 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @lsqpack_dec_init(ptr noundef %6, ptr noundef %16, i32 noundef 16384, i32 noundef 100, ptr noundef %7, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %17 = call noalias ptr @fopen(ptr noundef @.str, ptr noundef @.str.1)
  store ptr %17, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %18 = call noalias ptr @fopen(ptr noundef @.str.2, ptr noundef @.str.1)
  store ptr %18, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16384, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !11
  %19 = load ptr, ptr %8, align 8, !tbaa !9
  %20 = icmp ne ptr %19, null
  br i1 %20, label %24, label %21

21:                                               ; preds = %2
  %22 = call noalias ptr @fopen(ptr noundef @.str.3, ptr noundef @.str.1)
  store ptr %22, ptr %8, align 8, !tbaa !9
  %23 = call noalias ptr @fopen(ptr noundef @.str.4, ptr noundef @.str.1)
  store ptr %23, ptr %9, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %21, %2
  br label %25

25:                                               ; preds = %30, %24
  %26 = getelementptr inbounds [16384 x i8], ptr %10, i64 0, i64 0
  %27 = load ptr, ptr %8, align 8, !tbaa !9
  %28 = call i64 @fread(ptr noundef %26, i64 noundef 1, i64 noundef 16384, ptr noundef %27)
  store i64 %28, ptr %11, align 8, !tbaa !11
  %29 = icmp ugt i64 %28, 0
  br i1 %29, label %30, label %34

30:                                               ; preds = %25
  %31 = getelementptr inbounds [16384 x i8], ptr %10, i64 0, i64 0
  %32 = load i64, ptr %11, align 8, !tbaa !11
  %33 = call i32 @lsqpack_dec_enc_in(ptr noundef %6, ptr noundef %31, i64 noundef %32)
  br label %25, !llvm.loop !13

34:                                               ; preds = %25
  %35 = load ptr, ptr %8, align 8, !tbaa !9
  %36 = call i32 @fclose(ptr noundef %35)
  %37 = getelementptr inbounds [16384 x i8], ptr %10, i64 0, i64 0
  %38 = load ptr, ptr %9, align 8, !tbaa !9
  %39 = call i64 @fread(ptr noundef %37, i64 noundef 1, i64 noundef 16384, ptr noundef %38)
  store i64 %39, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 10, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 10, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %40 = getelementptr inbounds [16384 x i8], ptr %10, i64 0, i64 0
  store ptr %40, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %41 = load i64, ptr %11, align 8, !tbaa !11
  %42 = load i64, ptr %11, align 8, !tbaa !11
  %43 = getelementptr inbounds [10 x i8], ptr %12, i64 0, i64 0
  %44 = call i32 @lsqpack_dec_header_in(ptr noundef %6, ptr noundef null, i64 noundef 2092, i64 noundef %41, ptr noundef %14, i64 noundef %42, ptr noundef %43, ptr noundef %13)
  store i32 %44, ptr %15, align 4, !tbaa !5
  %45 = load i32, ptr %15, align 4, !tbaa !5
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %45)
  %47 = load ptr, ptr %9, align 8, !tbaa !9
  %48 = call i32 @fclose(ptr noundef %47)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 10, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 16384, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 352, ptr %6) #4
  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: 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

declare void @lsqpack_dec_init(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #3

declare noalias ptr @fopen(ptr noundef, ptr noundef) #3

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

declare i32 @lsqpack_dec_enc_in(ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @fclose(ptr noundef) #3

declare i32 @lsqpack_dec_header_in(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #3

; 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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.lsqpack_dec_hset_if = type { ptr, ptr, ptr }
%struct.lsqpack_dec = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, %struct.lsqpack_ringbuf, %struct.anon, [8 x %struct.anon.0], i32, float, %struct.anon.1, %struct.lsqpack_dec_err }
%struct.lsqpack_ringbuf = type { i32, i32, i32, ptr }
%struct.anon = type { ptr, ptr }
%struct.anon.0 = type { ptr, ptr }
%struct.anon.1 = type { i32, %union.anon }
%union.anon = type { %struct.anon.2 }
%struct.anon.2 = type { %struct.lsqpack_dec_int_state, %struct.lsqpack_huff_decode_state, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i8, i8 }
%struct.lsqpack_dec_int_state = type { i32, i32, i32, i64 }
%struct.lsqpack_huff_decode_state = type { i32, %struct.lsqpack_decode_status }
%struct.lsqpack_decode_status = type { i8, i8 }
%struct.lsqpack_dec_err = type { i32, i32, i64, i64 }

@__const.main.callbacks = external hidden unnamed_addr constant %struct.lsqpack_dec_hset_if, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca %struct.lsqpack_dec, align 8
  %4 = alloca %struct.lsqpack_dec_hset_if, align 8
  %5 = alloca [16384 x i8], align 16
  %6 = alloca [10 x i8], align 1
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 352, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) @__const.main.callbacks, i64 24, i1 false)
  %9 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @lsqpack_dec_init(ptr noundef nonnull %3, ptr noundef %9, i32 noundef 16384, i32 noundef 100, ptr noundef nonnull %4, i32 noundef 0) #5
  %10 = call noalias ptr @fopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1)
  %11 = call noalias ptr @fopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1)
  call void @llvm.lifetime.start.p0(i64 16384, ptr nonnull %5) #5
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %12, label %15

12:                                               ; preds = %2
  %13 = call noalias ptr @fopen(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1)
  %14 = call noalias ptr @fopen(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1)
  br label %15

15:                                               ; preds = %12, %2
  %.08 = phi ptr [ %11, %2 ], [ %14, %12 ]
  %.0 = phi ptr [ %10, %2 ], [ %13, %12 ]
  %16 = call i64 @fread(ptr noundef nonnull %5, i64 noundef 1, i64 noundef 16384, ptr noundef %.0)
  %.not1112 = icmp eq i64 %16, 0
  br i1 %.not1112, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %15, %.lr.ph
  %17 = phi i64 [ %19, %.lr.ph ], [ %16, %15 ]
  %18 = call i32 @lsqpack_dec_enc_in(ptr noundef nonnull %3, ptr noundef nonnull %5, i64 noundef %17) #5
  %19 = call i64 @fread(ptr noundef nonnull %5, i64 noundef 1, i64 noundef 16384, ptr noundef %.0)
  %.not11 = icmp eq i64 %19, 0
  br i1 %.not11, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %15
  %20 = call i32 @fclose(ptr noundef %.0)
  %21 = call i64 @fread(ptr noundef nonnull %5, i64 noundef 1, i64 noundef 16384, ptr noundef %.08)
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store i64 10, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  store ptr %5, ptr %8, align 8, !tbaa !5
  %22 = call i32 @lsqpack_dec_header_in(ptr noundef nonnull %3, ptr noundef null, i64 noundef 2092, i64 noundef %21, ptr noundef nonnull %8, i64 noundef %21, ptr noundef nonnull %6, ptr noundef nonnull %7) #5
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %22)
  %24 = call i32 @fclose(ptr noundef %.08)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 16384, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 352, ptr nonnull %3) #5
  ret i32 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare void @lsqpack_dec_init(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4

declare i32 @lsqpack_dec_enc_in(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #4

declare i32 @lsqpack_dec_header_in(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass