; LLVM IR from ebiggers/libdeflate :: programs (test_slow_decompression)

; 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"

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@orig_repro = external hidden constant [3962 x i8], align 16

; 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 [4096 x i8], align 16
  %7 = alloca [10000 x i8], align 16
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  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 4096, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 10000, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %10 = load ptr, ptr %5, align 8, !tbaa !9
  call void @begin_program(ptr noundef %10)
  call void @begin_performance_test()
  %11 = getelementptr inbounds [4096 x i8], ptr %6, i64 0, i64 0
  call void @generate_empty_static_huffman_blocks(ptr noundef %11, i64 noundef 4096)
  %12 = getelementptr inbounds [4096 x i8], ptr %6, i64 0, i64 0
  %13 = getelementptr inbounds [10000 x i8], ptr %7, i64 0, i64 0
  %14 = call i64 @do_test_libdeflate(ptr noundef @.str, ptr noundef %12, i64 noundef 4096, ptr noundef %13, i64 noundef 10000)
  store i64 %14, ptr %8, align 8, !tbaa !11
  %15 = getelementptr inbounds [4096 x i8], ptr %6, i64 0, i64 0
  %16 = getelementptr inbounds [10000 x i8], ptr %7, i64 0, i64 0
  %17 = call i64 @do_test_zlib(ptr noundef @.str, ptr noundef %15, i64 noundef 4096, ptr noundef %16, i64 noundef 10000)
  store i64 %17, ptr %9, align 8, !tbaa !11
  %18 = call i32 @putchar(i32 noundef 10)
  %19 = load i64, ptr %8, align 8, !tbaa !11
  %20 = load i64, ptr %9, align 8, !tbaa !11
  %21 = icmp ult i64 %19, %20
  %22 = xor i1 %21, true
  %23 = xor i1 %22, true
  %24 = xor i1 %23, true
  %25 = zext i1 %24 to i32
  %26 = sext i32 %25 to i64
  %27 = call i64 @llvm.expect.i64(i64 %26, i64 0)
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %2
  call void @assertion_failed(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 448) #7
  unreachable

30:                                               ; preds = %2
  %31 = getelementptr inbounds [4096 x i8], ptr %6, i64 0, i64 0
  call void @generate_empty_dynamic_huffman_blocks(ptr noundef %31, i64 noundef 4096)
  %32 = getelementptr inbounds [4096 x i8], ptr %6, i64 0, i64 0
  %33 = getelementptr inbounds [10000 x i8], ptr %7, i64 0, i64 0
  %34 = call i64 @do_test_libdeflate(ptr noundef @.str.3, ptr noundef %32, i64 noundef 4096, ptr noundef %33, i64 noundef 10000)
  store i64 %34, ptr %8, align 8, !tbaa !11
  %35 = getelementptr inbounds [4096 x i8], ptr %6, i64 0, i64 0
  %36 = getelementptr inbounds [10000 x i8], ptr %7, i64 0, i64 0
  %37 = call i64 @do_test_zlib(ptr noundef @.str.3, ptr noundef %35, i64 noundef 4096, ptr noundef %36, i64 noundef 10000)
  store i64 %37, ptr %9, align 8, !tbaa !11
  %38 = call i32 @putchar(i32 noundef 10)
  %39 = load i64, ptr %8, align 8, !tbaa !11
  %40 = load i64, ptr %9, align 8, !tbaa !11
  %41 = mul i64 4, %40
  %42 = icmp ult i64 %39, %41
  %43 = xor i1 %42, true
  %44 = xor i1 %43, true
  %45 = xor i1 %44, true
  %46 = zext i1 %45 to i32
  %47 = sext i32 %46 to i64
  %48 = call i64 @llvm.expect.i64(i64 %47, i64 0)
  %49 = icmp ne i64 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %30
  call void @assertion_failed(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 462) #7
  unreachable

51:                                               ; preds = %30
  %52 = getelementptr inbounds [10000 x i8], ptr %7, i64 0, i64 0
  %53 = call i64 @do_test_libdeflate(ptr noundef @.str.5, ptr noundef @orig_repro, i64 noundef 3962, ptr noundef %52, i64 noundef 10000)
  store i64 %53, ptr %8, align 8, !tbaa !11
  %54 = getelementptr inbounds [10000 x i8], ptr %7, i64 0, i64 0
  %55 = call i64 @do_test_zlib(ptr noundef @.str.5, ptr noundef @orig_repro, i64 noundef 3962, ptr noundef %54, i64 noundef 10000)
  store i64 %55, ptr %9, align 8, !tbaa !11
  %56 = load i64, ptr %8, align 8, !tbaa !11
  %57 = load i64, ptr %9, align 8, !tbaa !11
  %58 = icmp ult i64 %56, %57
  %59 = xor i1 %58, true
  %60 = xor i1 %59, true
  %61 = xor i1 %60, true
  %62 = zext i1 %61 to i32
  %63 = sext i32 %62 to i64
  %64 = call i64 @llvm.expect.i64(i64 %63, i64 0)
  %65 = icmp ne i64 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %51
  call void @assertion_failed(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 469) #7
  unreachable

67:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 10000, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr %6) #6
  ret i32 0
}

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

declare void @begin_program(ptr noundef) #2

declare void @begin_performance_test() #2

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

; Function Attrs: nounwind uwtable
declare hidden i64 @do_test_libdeflate(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i64 @do_test_zlib(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare i32 @putchar(i32 noundef) #3

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

; Function Attrs: noreturn
declare void @assertion_failed(ptr noundef, ptr noundef, i32 noundef) #5

; Function Attrs: nounwind uwtable
declare hidden void @generate_empty_dynamic_huffman_blocks(ptr noundef, i64 noundef) #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 = { "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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #5 = { noreturn "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 #6 = { nounwind }
attributes #7 = { noreturn }

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


; 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"

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@orig_repro = external hidden constant [3962 x i8], align 16

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca [4096 x i8], align 16
  %4 = alloca [10000 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %4) #5
  tail call void @begin_program(ptr noundef %1) #5
  tail call void @begin_performance_test() #5
  call void @generate_empty_static_huffman_blocks(ptr noundef nonnull %3, i64 noundef 4096)
  %5 = call i64 @do_test_libdeflate(ptr noundef nonnull @.str, ptr noundef nonnull %3, i64 noundef 4096, ptr noundef nonnull %4, i64 noundef 10000)
  %6 = call i64 @do_test_zlib(ptr noundef nonnull @.str, ptr noundef nonnull %3, i64 noundef 4096, ptr noundef nonnull %4, i64 noundef 10000)
  %7 = call i32 @putchar(i32 noundef 10)
  %.not = icmp ult i64 %5, %6
  br i1 %.not, label %9, label %8, !prof !5

8:                                                ; preds = %2
  call void @assertion_failed(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 448) #6
  unreachable

9:                                                ; preds = %2
  call void @generate_empty_dynamic_huffman_blocks(ptr noundef nonnull %3, i64 noundef 4096)
  %10 = call i64 @do_test_libdeflate(ptr noundef nonnull @.str.3, ptr noundef nonnull %3, i64 noundef 4096, ptr noundef nonnull %4, i64 noundef 10000)
  %11 = call i64 @do_test_zlib(ptr noundef nonnull @.str.3, ptr noundef nonnull %3, i64 noundef 4096, ptr noundef nonnull %4, i64 noundef 10000)
  %12 = call i32 @putchar(i32 noundef 10)
  %13 = shl i64 %11, 2
  %.not6 = icmp ult i64 %10, %13
  br i1 %.not6, label %15, label %14, !prof !5

14:                                               ; preds = %9
  call void @assertion_failed(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 462) #6
  unreachable

15:                                               ; preds = %9
  %16 = call i64 @do_test_libdeflate(ptr noundef nonnull @.str.5, ptr noundef nonnull @orig_repro, i64 noundef 3962, ptr noundef nonnull %4, i64 noundef 10000)
  %17 = call i64 @do_test_zlib(ptr noundef nonnull @.str.5, ptr noundef nonnull @orig_repro, i64 noundef 3962, ptr noundef nonnull %4, i64 noundef 10000)
  %.not7 = icmp ult i64 %16, %17
  br i1 %.not7, label %19, label %18, !prof !5

18:                                               ; preds = %15
  call void @assertion_failed(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 469) #6
  unreachable

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4096, 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

declare void @begin_program(ptr noundef) local_unnamed_addr #2

declare void @begin_performance_test() local_unnamed_addr #2

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

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

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

; Function Attrs: inlinehint nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3

; Function Attrs: noreturn
declare void @assertion_failed(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

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

; 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 = { "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 = { inlinehint nofree 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 = { noreturn "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 }
attributes #6 = { 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 = !{!"branch_weights", !"expected", i32 2000, i32 1}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass