; LLVM IR from intel/qpl :: tools/utils/generators/deflate_generator (gen)

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

%"class.gz_generator::gen_c" = type { %struct.anon, i8, %"class.gz_generator::huffman_c", %"class.gz_generator::grammar_c", %"class.gz_generator::BitBuffer", ptr, i32, [286 x i32], i32, [32 x i32], i32, [19 x i32], i32, [19 x i32], i32, [1024 x i32], i32, [1024 x i32], i32, [19 x i32], i32, i32, i32, i8, [32768 x i8], i32, i32, [3 x i8], i32 }
%struct.anon = type { i8, i8, i8, i8 }
%"class.gz_generator::huffman_c" = type { %class.symbol_list, %class.histogram, [288 x i32], [32 x i32], i8, i8, i8, i32, %"class.std::vector" }
%class.symbol_list = type { ptr, ptr, i32, i32 }
%class.histogram = type { [32768 x i32], [513 x i32], [32 x i32], [286 x i32] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.gz_generator::grammar_c" = type { %class.token_parser_c, ptr }
%class.token_parser_c = type { ptr, %class.token_c, i8, i32 }
%class.token_c = type { i8, i32 }
%"class.gz_generator::BitBuffer" = type { i8, i32, %struct.anon.0, ptr }
%struct.anon.0 = type { i64, i32 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12gz_generator5gen_c11start_blockEbbbbb(ptr noundef nonnull align 8 dereferenceable(178336) %0, i1 noundef zeroext %1, i1 noundef zeroext %2, i1 noundef zeroext %3, i1 noundef zeroext %4, i1 noundef zeroext %5) #0 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  %13 = zext i1 %1 to i8
  store i8 %13, ptr %8, align 1, !tbaa !9
  %14 = zext i1 %2 to i8
  store i8 %14, ptr %9, align 1, !tbaa !9
  %15 = zext i1 %3 to i8
  store i8 %15, ptr %10, align 1, !tbaa !9
  %16 = zext i1 %4 to i8
  store i8 %16, ptr %11, align 1, !tbaa !9
  %17 = zext i1 %5 to i8
  store i8 %17, ptr %12, align 1, !tbaa !9
  %18 = load ptr, ptr %7, align 8
  %19 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 0
  %20 = getelementptr inbounds %struct.anon, ptr %19, i32 0, i32 0
  %21 = load i8, ptr %20, align 8, !tbaa !11, !range !30, !noundef !31
  %22 = trunc i8 %21 to i1
  br i1 %22, label %23, label %24

23:                                               ; preds = %6
  call void @_ZN12gz_generator5gen_c9end_blockEv(ptr noundef nonnull align 8 dereferenceable(178336) %18)
  br label %24

24:                                               ; preds = %23, %6
  %25 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 2
  call void @_ZN12gz_generator9huffman_c5resetEv(ptr noundef nonnull align 8 dereferenceable(135736) %25)
  %26 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 14
  store i32 0, ptr %26, align 8, !tbaa !32
  %27 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 12
  store i32 0, ptr %27, align 8, !tbaa !33
  %28 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 10
  store i32 0, ptr %28, align 8, !tbaa !34
  %29 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 8
  store i32 0, ptr %29, align 4, !tbaa !35
  %30 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 20
  store i32 0, ptr %30, align 8, !tbaa !36
  %31 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 18
  store i32 0, ptr %31, align 8, !tbaa !37
  %32 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 16
  store i32 0, ptr %32, align 4, !tbaa !38
  %33 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 22
  store i32 0, ptr %33, align 8, !tbaa !39
  %34 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 21
  store i32 0, ptr %34, align 4, !tbaa !40
  %35 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 0
  %36 = getelementptr inbounds %struct.anon, ptr %35, i32 0, i32 0
  store i8 1, ptr %36, align 8, !tbaa !11
  %37 = load i8, ptr %8, align 1, !tbaa !9, !range !30, !noundef !31
  %38 = trunc i8 %37 to i1
  %39 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 0
  %40 = getelementptr inbounds %struct.anon, ptr %39, i32 0, i32 1
  %41 = zext i1 %38 to i8
  store i8 %41, ptr %40, align 1, !tbaa !41
  %42 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 0
  %43 = getelementptr inbounds %struct.anon, ptr %42, i32 0, i32 2
  store i8 1, ptr %43, align 2, !tbaa !42
  %44 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 2
  call void @_ZN12gz_generator9huffman_c8set_boutEb(ptr noundef nonnull align 8 dereferenceable(135736) %44, i1 noundef zeroext true)
  %45 = load i8, ptr %12, align 1, !tbaa !9, !range !30, !noundef !31
  %46 = trunc i8 %45 to i1
  %47 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 0
  %48 = getelementptr inbounds %struct.anon, ptr %47, i32 0, i32 3
  %49 = zext i1 %46 to i8
  store i8 %49, ptr %48, align 1, !tbaa !43
  %50 = load i8, ptr %11, align 1, !tbaa !9, !range !30, !noundef !31
  %51 = trunc i8 %50 to i1
  br i1 %51, label %52, label %54

52:                                               ; preds = %24
  %53 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 1
  store i8 3, ptr %53, align 4, !tbaa !44
  br label %68

54:                                               ; preds = %24
  %55 = load i8, ptr %9, align 1, !tbaa !9, !range !30, !noundef !31
  %56 = trunc i8 %55 to i1
  br i1 %56, label %57, label %59

57:                                               ; preds = %54
  %58 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 1
  store i8 1, ptr %58, align 4, !tbaa !44
  br label %67

59:                                               ; preds = %54
  %60 = load i8, ptr %10, align 1, !tbaa !9, !range !30, !noundef !31
  %61 = trunc i8 %60 to i1
  br i1 %61, label %62, label %64

62:                                               ; preds = %59
  %63 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 1
  store i8 2, ptr %63, align 4, !tbaa !44
  br label %66

64:                                               ; preds = %59
  %65 = getelementptr inbounds %"class.gz_generator::gen_c", ptr %18, i32 0, i32 1
  store i8 0, ptr %65, align 4, !tbaa !44
  br label %66

66:                                               ; preds = %64, %62
  br label %67

67:                                               ; preds = %66, %57
  br label %68

68:                                               ; preds = %67, %52
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator5gen_c9end_blockEv(ptr noundef nonnull align 8 dereferenceable(178336)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator9huffman_c5resetEv(ptr noundef nonnull align 8 dereferenceable(135736)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN12gz_generator9huffman_c8set_boutEb(ptr noundef nonnull align 8 dereferenceable(135736), i1 noundef zeroext) #1 align 2

attributes #0 = { mustprogress 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 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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN12gz_generator5gen_cE", !13, i64 0, !14, i64 4, !15, i64 8, !23, i64 135744, !27, i64 135776, !6, i64 135808, !17, i64 135816, !7, i64 135820, !17, i64 136964, !7, i64 136968, !17, i64 137096, !7, i64 137100, !17, i64 137176, !7, i64 137180, !17, i64 137256, !7, i64 137260, !17, i64 141356, !7, i64 141360, !17, i64 145456, !7, i64 145460, !17, i64 145536, !17, i64 145540, !17, i64 145544, !10, i64 145548, !7, i64 145549, !17, i64 178320, !17, i64 178324, !7, i64 178328, !17, i64 178332}
!13 = !{!"_ZTSN12gz_generator5gen_cUt_E", !10, i64 0, !10, i64 1, !10, i64 2, !10, i64 3}
!14 = !{!"_ZTSN12gz_generator5gen_cUt0_E", !7, i64 0}
!15 = !{!"_ZTSN12gz_generator9huffman_cE", !16, i64 0, !18, i64 24, !7, i64 134420, !7, i64 135572, !10, i64 135700, !10, i64 135701, !10, i64 135702, !17, i64 135704, !19, i64 135712}
!16 = !{!"_ZTS11symbol_list", !6, i64 0, !6, i64 8, !17, i64 16, !17, i64 20}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTS9histogram", !7, i64 0, !7, i64 131072, !7, i64 133124, !7, i64 133252}
!19 = !{!"_ZTSSt6vectorIjSaIjEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTSN12gz_generator9grammar_cE", !24, i64 0, !6, i64 24}
!24 = !{!"_ZTS14token_parser_c", !6, i64 0, !25, i64 8, !10, i64 16, !17, i64 20}
!25 = !{!"_ZTS7token_c", !26, i64 0, !17, i64 4}
!26 = !{!"_ZTS12token_type_t", !7, i64 0}
!27 = !{!"_ZTSN12gz_generator9BitBufferE", !10, i64 0, !17, i64 4, !28, i64 8, !6, i64 24}
!28 = !{!"_ZTSN12gz_generator9BitBufferUt_E", !29, i64 0, !17, i64 8}
!29 = !{!"long", !7, i64 0}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!12, !17, i64 137256}
!33 = !{!12, !17, i64 137176}
!34 = !{!12, !17, i64 137096}
!35 = !{!12, !17, i64 136964}
!36 = !{!12, !17, i64 145536}
!37 = !{!12, !17, i64 145456}
!38 = !{!12, !17, i64 141356}
!39 = !{!12, !17, i64 145544}
!40 = !{!12, !17, i64 145540}
!41 = !{!12, !10, i64 1}
!42 = !{!12, !10, i64 2}
!43 = !{!12, !10, i64 3}
!44 = !{!12, !14, i64 4}


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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12gz_generator5gen_c11start_blockEbbbbb(ptr noundef nonnull align 8 dereferenceable(178336) %0, i1 noundef zeroext %1, i1 noundef zeroext %2, i1 noundef zeroext %3, i1 noundef zeroext %4, i1 noundef zeroext %5) local_unnamed_addr #0 align 2 {
  %7 = load i8, ptr %0, align 8, !tbaa !5, !range !28, !noundef !29
  %8 = trunc nuw i8 %7 to i1
  br i1 %8, label %9, label %10

9:                                                ; preds = %6
  tail call void @_ZN12gz_generator5gen_c9end_blockEv(ptr noundef nonnull align 8 dereferenceable(178336) %0)
  br label %10

10:                                               ; preds = %9, %6
  %11 = zext i1 %5 to i8
  %12 = zext i1 %1 to i8
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN12gz_generator9huffman_c5resetEv(ptr noundef nonnull align 8 dereferenceable(135736) %13)
  %14 = getelementptr inbounds i8, ptr %0, i64 137256
  store i32 0, ptr %14, align 8, !tbaa !30
  %15 = getelementptr inbounds i8, ptr %0, i64 137176
  store i32 0, ptr %15, align 8, !tbaa !31
  %16 = getelementptr inbounds i8, ptr %0, i64 137096
  store i32 0, ptr %16, align 8, !tbaa !32
  %17 = getelementptr inbounds i8, ptr %0, i64 136964
  store i32 0, ptr %17, align 4, !tbaa !33
  %18 = getelementptr inbounds i8, ptr %0, i64 145536
  store i32 0, ptr %18, align 8, !tbaa !34
  %19 = getelementptr inbounds i8, ptr %0, i64 145456
  store i32 0, ptr %19, align 8, !tbaa !35
  %20 = getelementptr inbounds i8, ptr %0, i64 141356
  store i32 0, ptr %20, align 4, !tbaa !36
  %21 = getelementptr inbounds i8, ptr %0, i64 145544
  store i32 0, ptr %21, align 8, !tbaa !37
  %22 = getelementptr inbounds i8, ptr %0, i64 145540
  store i32 0, ptr %22, align 4, !tbaa !38
  store i8 1, ptr %0, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %0, i64 1
  store i8 %12, ptr %23, align 1, !tbaa !39
  %24 = getelementptr inbounds i8, ptr %0, i64 2
  store i8 1, ptr %24, align 2, !tbaa !40
  tail call void @_ZN12gz_generator9huffman_c8set_boutEb(ptr noundef nonnull align 8 dereferenceable(135736) %13, i1 noundef zeroext true)
  %25 = getelementptr inbounds i8, ptr %0, i64 3
  store i8 %11, ptr %25, align 1, !tbaa !41
  %26 = getelementptr inbounds i8, ptr %0, i64 4
  %. = select i1 %3, i8 2, i8 0
  %spec.select = select i1 %2, i8 1, i8 %.
  %.sink = select i1 %4, i8 3, i8 %spec.select
  store i8 %.sink, ptr %26, align 4, !tbaa !42
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator5gen_c9end_blockEv(ptr noundef nonnull align 8 dereferenceable(178336)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator9huffman_c5resetEv(ptr noundef nonnull align 8 dereferenceable(135736)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN12gz_generator9huffman_c8set_boutEb(ptr noundef nonnull align 8 dereferenceable(135736), i1 noundef zeroext) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress 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 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)"}
!5 = !{!6, !8, i64 0}
!6 = !{!"_ZTSN12gz_generator5gen_cE", !7, i64 0, !11, i64 4, !12, i64 8, !21, i64 135744, !25, i64 135776, !14, i64 135808, !15, i64 135816, !9, i64 135820, !15, i64 136964, !9, i64 136968, !15, i64 137096, !9, i64 137100, !15, i64 137176, !9, i64 137180, !15, i64 137256, !9, i64 137260, !15, i64 141356, !9, i64 141360, !15, i64 145456, !9, i64 145460, !15, i64 145536, !15, i64 145540, !15, i64 145544, !8, i64 145548, !9, i64 145549, !15, i64 178320, !15, i64 178324, !9, i64 178328, !15, i64 178332}
!7 = !{!"_ZTSN12gz_generator5gen_cUt_E", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3}
!8 = !{!"bool", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN12gz_generator5gen_cUt0_E", !9, i64 0}
!12 = !{!"_ZTSN12gz_generator9huffman_cE", !13, i64 0, !16, i64 24, !9, i64 134420, !9, i64 135572, !8, i64 135700, !8, i64 135701, !8, i64 135702, !15, i64 135704, !17, i64 135712}
!13 = !{!"_ZTS11symbol_list", !14, i64 0, !14, i64 8, !15, i64 16, !15, i64 20}
!14 = !{!"any pointer", !9, i64 0}
!15 = !{!"int", !9, i64 0}
!16 = !{!"_ZTS9histogram", !9, i64 0, !9, i64 131072, !9, i64 133124, !9, i64 133252}
!17 = !{!"_ZTSSt6vectorIjSaIjEE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!21 = !{!"_ZTSN12gz_generator9grammar_cE", !22, i64 0, !14, i64 24}
!22 = !{!"_ZTS14token_parser_c", !14, i64 0, !23, i64 8, !8, i64 16, !15, i64 20}
!23 = !{!"_ZTS7token_c", !24, i64 0, !15, i64 4}
!24 = !{!"_ZTS12token_type_t", !9, i64 0}
!25 = !{!"_ZTSN12gz_generator9BitBufferE", !8, i64 0, !15, i64 4, !26, i64 8, !14, i64 24}
!26 = !{!"_ZTSN12gz_generator9BitBufferUt_E", !27, i64 0, !15, i64 8}
!27 = !{!"long", !9, i64 0}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!6, !15, i64 137256}
!31 = !{!6, !15, i64 137176}
!32 = !{!6, !15, i64 137096}
!33 = !{!6, !15, i64 136964}
!34 = !{!6, !15, i64 145536}
!35 = !{!6, !15, i64 145456}
!36 = !{!6, !15, i64 141356}
!37 = !{!6, !15, i64 145544}
!38 = !{!6, !15, i64 145540}
!39 = !{!6, !8, i64 1}
!40 = !{!6, !8, i64 2}
!41 = !{!6, !8, i64 3}
!42 = !{!6, !11, i64 4}


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