; LLVM IR from intel/qpl :: sources/middle-layer/compression/huffman_only (huffman_only_units)

; 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.qpl::ml::compression::huffman_only_state" = type { %"struct.qpl::ml::util::checksum_accumulator", ptr, ptr, ptr, i8, i32, i8, i8, i8, i8, ptr }
%"struct.qpl::ml::util::checksum_accumulator" = type { i32, i32 }
%struct.isal_zstream = type { ptr, i32, i32, ptr, i32, i32, ptr, i32, i32, ptr, i16, i16, i16, i16, %struct.isal_zstate }
%struct.isal_zstate = type { i32, i32, i32, i32, i32, i32, %struct.BitBuf2, i32, i8, i8, i8, i8, i16, i32, [16 x i8], i32, i32, i32, i32, [65824 x i8], [8192 x i16] }
%struct.BitBuf2 = type { i64, i32, ptr, ptr, ptr }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3qpl2ml11compression12update_stateERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEEPhS6_S6_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef, ptr noundef) #0

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #2

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

; Function Attrs: nounwind
declare void @_ZN3qpl2ml11compression18huffman_only_stateILNS0_16execution_path_tE2EE16reset_bit_bufferEv(ptr noundef nonnull align 8 dereferenceable(56)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN3qpl2ml11compressionL16get_literal_codeEPK15isal_hufftablesjRjS5_(ptr noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZL10write_bitsP7BitBuf2mj(ptr noundef, i64 noundef, i32 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN3qpl2ml11compression21huffman_only_finalizeERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEERNS1_19compression_state_tE(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 1 dereferenceable(1) %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %15, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds %struct.isal_zstream, ptr %17, i32 0, i32 14
  store ptr %18, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.isal_zstate, ptr %19, i32 0, i32 6
  store ptr %20, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %21, i32 0, i32 1
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct.isal_zstream, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !17
  store ptr %25, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %26, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds %struct.isal_zstream, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 8, !tbaa !24
  %33 = zext i32 %32 to i64
  %34 = getelementptr inbounds i8, ptr %27, i64 %33
  store ptr %34, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !16
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3qpl2ml11compression18huffman_only_stateILNS0_16execution_path_tE2EE16reset_bit_bufferEv(ptr noundef nonnull align 8 dereferenceable(56) %35) #6
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %36, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.isal_zstream, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  store ptr %40, ptr %9, align 8, !tbaa !5
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %42, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.isal_zstream, ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 8, !tbaa !24
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds i8, ptr %41, i64 %47
  store ptr %48, ptr %11, align 8, !tbaa !5
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %49, ptr %10, align 8, !tbaa !5
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = getelementptr inbounds %struct.isal_zstream, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !24
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %125

56:                                               ; preds = %2
  br label %57

57:                                               ; preds = %87, %56
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %58, i64 3
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = icmp ult ptr %59, %60
  br i1 %61, label %62, label %90

62:                                               ; preds = %57
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = invoke noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef %63)
          to label %65 unwind label %152

65:                                               ; preds = %62
  %66 = icmp ne i32 %64, 0
  br i1 %66, label %67, label %72

67:                                               ; preds = %65
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN3qpl2ml11compression12update_stateERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEEPhS6_S6_(ptr noundef nonnull align 8 dereferenceable(56) %68, ptr noundef %69, ptr noundef %70, ptr noundef %71) #6
  store i32 2, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %150

72:                                               ; preds = %65
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = load i32, ptr %73, align 4, !tbaa !16
  store i32 %74, ptr %8, align 4, !tbaa !16
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !9
  %78 = getelementptr inbounds %struct.isal_zstream, ptr %77, i32 0, i32 6
  %79 = load ptr, ptr %78, align 8, !tbaa !25
  %80 = load i32, ptr %8, align 4, !tbaa !16
  %81 = and i32 %80, 255
  invoke void @_ZN3qpl2ml11compressionL16get_literal_codeEPK15isal_hufftablesjRjS5_(ptr noundef %79, i32 noundef %81, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %82 unwind label %152

82:                                               ; preds = %72
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = load i32, ptr %12, align 4, !tbaa !16
  %85 = zext i32 %84 to i64
  %86 = load i32, ptr %13, align 4, !tbaa !16
  invoke void @_ZL10write_bitsP7BitBuf2mj(ptr noundef %83, i64 noundef %85, i32 noundef %86)
          to label %87 unwind label %152

87:                                               ; preds = %82
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i32 1
  store ptr %89, ptr %10, align 8, !tbaa !5
  br label %57, !llvm.loop !26

90:                                               ; preds = %57
  br label %91

91:                                               ; preds = %121, %90
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = icmp ult ptr %92, %93
  br i1 %94, label %95, label %124

95:                                               ; preds = %91
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = invoke noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef %96)
          to label %98 unwind label %152

98:                                               ; preds = %95
  %99 = icmp ne i32 %97, 0
  br i1 %99, label %100, label %105

100:                                              ; preds = %98
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN3qpl2ml11compression12update_stateERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEEPhS6_S6_(ptr noundef nonnull align 8 dereferenceable(56) %101, ptr noundef %102, ptr noundef %103, ptr noundef %104) #6
  store i32 2, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %150

105:                                              ; preds = %98
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = load i8, ptr %106, align 1, !tbaa !28
  %108 = zext i8 %107 to i32
  store i32 %108, ptr %8, align 4, !tbaa !16
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %109, i32 0, i32 1
  %111 = load ptr, ptr %110, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct.isal_zstream, ptr %111, i32 0, i32 6
  %113 = load ptr, ptr %112, align 8, !tbaa !25
  %114 = load i32, ptr %8, align 4, !tbaa !16
  %115 = and i32 %114, 255
  invoke void @_ZN3qpl2ml11compressionL16get_literal_codeEPK15isal_hufftablesjRjS5_(ptr noundef %113, i32 noundef %115, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %116 unwind label %152

116:                                              ; preds = %105
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = load i32, ptr %12, align 4, !tbaa !16
  %119 = zext i32 %118 to i64
  %120 = load i32, ptr %13, align 4, !tbaa !16
  invoke void @_ZL10write_bitsP7BitBuf2mj(ptr noundef %117, i64 noundef %119, i32 noundef %120)
          to label %121 unwind label %152

121:                                              ; preds = %116
  %122 = load ptr, ptr %10, align 8, !tbaa !5
  %123 = getelementptr inbounds i8, ptr %122, i32 1
  store ptr %123, ptr %10, align 8, !tbaa !5
  br label %91, !llvm.loop !29

124:                                              ; preds = %91
  br label %125

125:                                              ; preds = %124, %2
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  %127 = invoke noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef %126)
          to label %128 unwind label %152

128:                                              ; preds = %125
  %129 = icmp ne i32 %127, 0
  br i1 %129, label %139, label %130

130:                                              ; preds = %128
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  store i8 11, ptr %131, align 1, !tbaa !30
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.BitBuf2, ptr %132, i32 0, i32 1
  %134 = load i32, ptr %133, align 8, !tbaa !32
  %135 = and i32 %134, 7
  %136 = trunc i32 %135 to i8
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = getelementptr inbounds %"class.qpl::ml::compression::huffman_only_state", ptr %137, i32 0, i32 8
  store i8 %136, ptr %138, align 2, !tbaa !33
  br label %139

139:                                              ; preds = %130, %128
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = load ptr, ptr %9, align 8, !tbaa !5
  %142 = load ptr, ptr %10, align 8, !tbaa !5
  %143 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN3qpl2ml11compression12update_stateERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEEPhS6_S6_(ptr noundef nonnull align 8 dereferenceable(56) %140, ptr noundef %141, ptr noundef %142, ptr noundef %143) #6
  %144 = load ptr, ptr %7, align 8, !tbaa !5
  %145 = invoke noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef %144)
          to label %146 unwind label %152

146:                                              ; preds = %139
  %147 = icmp ne i32 %145, 0
  %148 = zext i1 %147 to i64
  %149 = select i1 %147, i32 2, i32 0
  store i32 %149, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %150

150:                                              ; preds = %146, %100, %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %151 = load i32, ptr %3, align 4
  ret i32 %151

152:                                              ; preds = %139, %125, %116, %105, %95, %82, %72, %62
  %153 = landingpad { ptr, i32 }
          catch ptr null
  %154 = extractvalue { ptr, i32 } %153, 0
  call void @__clang_call_terminate(ptr %154) #7
  unreachable
}

attributes #0 = { 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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noinline noreturn nounwind uwtable "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 = { 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 = { inlinehint 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" }
attributes #5 = { inlinehint 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 #6 = { nounwind }
attributes #7 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN3qpl2ml11compression18huffman_only_stateILNS0_16execution_path_tE2EEE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !12, i64 36, !14, i64 40, !15, i64 41, !7, i64 42, !14, i64 43, !6, i64 48}
!11 = !{!"_ZTSN3qpl2ml4util20checksum_accumulatorE", !12, i64 0, !12, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSN3qpl2ml11compression12endianness_tE", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSN3qpl2ml11compression18compression_mode_tE", !7, i64 0}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTS12isal_zstream", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16, !12, i64 24, !12, i64 28, !6, i64 32, !12, i64 40, !12, i64 44, !6, i64 48, !19, i64 56, !19, i64 58, !19, i64 60, !19, i64 62, !20, i64 64}
!19 = !{!"short", !7, i64 0}
!20 = !{!"_ZTS11isal_zstate", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !21, i64 20, !22, i64 24, !12, i64 64, !7, i64 68, !7, i64 69, !7, i64 70, !7, i64 71, !19, i64 72, !12, i64 76, !7, i64 80, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !7, i64 112, !7, i64 65936}
!21 = !{!"_ZTS17isal_zstate_state", !7, i64 0}
!22 = !{!"_ZTS7BitBuf2", !23, i64 0, !12, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!23 = !{!"long", !7, i64 0}
!24 = !{!18, !12, i64 8}
!25 = !{!18, !6, i64 32}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !27}
!30 = !{!31, !31, i64 0}
!31 = !{!"_ZTSN3qpl2ml11compression19compression_state_tE", !7, i64 0}
!32 = !{!22, !12, i64 8}
!33 = !{!10, !7, i64 42}


; 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 nounwind uwtable
declare dso_local void @_ZN3qpl2ml11compression12update_stateERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEEPhS6_S6_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare void @_ZN3qpl2ml11compression18huffman_only_stateILNS0_16execution_path_tE2EE16reset_bit_bufferEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN3qpl2ml11compressionL16get_literal_codeEPK15isal_hufftablesjRjS5_(ptr noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZL10write_bitsP7BitBuf2mj(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 0, 3) i32 @_ZN3qpl2ml11compression21huffman_only_finalizeERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEERNS1_19compression_state_tE(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr nocapture noundef nonnull writeonly align 1 dereferenceable(1) %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 88
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 0, ptr %3, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 0, ptr %4, align 4, !tbaa !15
  tail call void @_ZN3qpl2ml11compression18huffman_only_stateILNS0_16execution_path_tE2EE16reset_bit_bufferEv(ptr noundef nonnull align 8 dereferenceable(56) %0) #6
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %8, align 8, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %8, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !23
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds i8, ptr %9, i64 %12
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %.loopexit, label %.preheader53

.preheader53:                                     ; preds = %2
  %14 = icmp ugt i32 %11, 3
  br i1 %14, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %27, %.preheader53
  %.0.lcssa = phi ptr [ %9, %.preheader53 ], [ %28, %27 ]
  %15 = icmp ult ptr %.0.lcssa, %13
  br i1 %15, label %.lr.ph60, label %.loopexit

.lr.ph:                                           ; preds = %.preheader53, %27
  %.058 = phi ptr [ %28, %27 ], [ %9, %.preheader53 ]
  %16 = call noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef nonnull %7)
  %.not51 = icmp eq i32 %16, 0
  br i1 %.not51, label %18, label %17

17:                                               ; preds = %.lr.ph
  call void @_ZN3qpl2ml11compression12update_stateERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEEPhS6_S6_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %9, ptr noundef %.058, ptr noundef nonnull %13) #6
  br label %55

18:                                               ; preds = %.lr.ph
  %19 = load i32, ptr %.058, align 4, !tbaa !15
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 32
  %22 = load ptr, ptr %21, align 8, !tbaa !24
  %23 = and i32 %19, 255
  call void @_ZN3qpl2ml11compressionL16get_literal_codeEPK15isal_hufftablesjRjS5_(ptr noundef %22, i32 noundef %23, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %24 = load i32, ptr %3, align 4, !tbaa !15
  %25 = zext i32 %24 to i64
  %26 = load i32, ptr %4, align 4, !tbaa !15
  invoke void @_ZL10write_bitsP7BitBuf2mj(ptr noundef nonnull %7, i64 noundef %25, i32 noundef %26)
          to label %27 unwind label %.loopexit.split-lp

27:                                               ; preds = %18
  %28 = getelementptr inbounds i8, ptr %.058, i64 1
  %29 = getelementptr inbounds i8, ptr %.058, i64 4
  %30 = icmp ult ptr %29, %13
  br i1 %30, label %.lr.ph, label %.preheader, !llvm.loop !25

.lr.ph60:                                         ; preds = %.preheader, %42
  %.159 = phi ptr [ %43, %42 ], [ %.0.lcssa, %.preheader ]
  %31 = call noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef nonnull %7)
  %.not50 = icmp eq i32 %31, 0
  br i1 %.not50, label %33, label %32

32:                                               ; preds = %.lr.ph60
  call void @_ZN3qpl2ml11compression12update_stateERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEEPhS6_S6_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %9, ptr noundef %.159, ptr noundef nonnull %13) #6
  br label %55

33:                                               ; preds = %.lr.ph60
  %34 = load i8, ptr %.159, align 1, !tbaa !27
  %35 = zext i8 %34 to i32
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %36, i64 32
  %38 = load ptr, ptr %37, align 8, !tbaa !24
  call void @_ZN3qpl2ml11compressionL16get_literal_codeEPK15isal_hufftablesjRjS5_(ptr noundef %38, i32 noundef %35, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %39 = load i32, ptr %3, align 4, !tbaa !15
  %40 = zext i32 %39 to i64
  %41 = load i32, ptr %4, align 4, !tbaa !15
  invoke void @_ZL10write_bitsP7BitBuf2mj(ptr noundef nonnull %7, i64 noundef %40, i32 noundef %41)
          to label %42 unwind label %.loopexit52

42:                                               ; preds = %33
  %43 = getelementptr inbounds i8, ptr %.159, i64 1
  %44 = icmp ult ptr %43, %13
  br i1 %44, label %.lr.ph60, label %.loopexit, !llvm.loop !28

.loopexit:                                        ; preds = %42, %.preheader, %2
  %.2 = phi ptr [ %9, %2 ], [ %.0.lcssa, %.preheader ], [ %43, %42 ]
  %45 = call noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef nonnull %7)
  %.not48 = icmp eq i32 %45, 0
  br i1 %.not48, label %46, label %52

46:                                               ; preds = %.loopexit
  store i8 11, ptr %1, align 1, !tbaa !29
  %47 = getelementptr inbounds i8, ptr %6, i64 96
  %48 = load i32, ptr %47, align 8, !tbaa !31
  %49 = trunc i32 %48 to i8
  %50 = and i8 %49, 7
  %51 = getelementptr inbounds i8, ptr %0, i64 42
  store i8 %50, ptr %51, align 2, !tbaa !32
  br label %52

52:                                               ; preds = %46, %.loopexit
  call void @_ZN3qpl2ml11compression12update_stateERNS1_18huffman_only_stateILNS0_16execution_path_tE2EEEPhS6_S6_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %9, ptr noundef %.2, ptr noundef %13) #6
  %53 = call noundef i32 @_ZL7is_fullP7BitBuf2(ptr noundef nonnull %7)
  %.not49 = icmp eq i32 %53, 0
  %54 = select i1 %.not49, i32 0, i32 2
  br label %55

55:                                               ; preds = %52, %32, %17
  %.045 = phi i32 [ 2, %17 ], [ 2, %32 ], [ %54, %52 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret i32 %.045

.loopexit52:                                      ; preds = %33
  %lpad.loopexit = landingpad { ptr, i32 }
          catch ptr null
  br label %56

.loopexit.split-lp:                               ; preds = %18
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          catch ptr null
  br label %56

56:                                               ; preds = %.loopexit.split-lp, %.loopexit52
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit52 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  %57 = extractvalue { ptr, i32 } %lpad.phi, 0
  call void @__clang_call_terminate(ptr %57) #7
  unreachable
}

attributes #0 = { 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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noinline noreturn nounwind uwtable "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 = { 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 = { inlinehint 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" }
attributes #5 = { inlinehint 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 #6 = { nounwind }
attributes #7 = { 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, !11, i64 8}
!6 = !{!"_ZTSN3qpl2ml11compression18huffman_only_stateILNS0_16execution_path_tE2EEE", !7, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !8, i64 36, !13, i64 40, !14, i64 41, !9, i64 42, !13, i64 43, !11, i64 48}
!7 = !{!"_ZTSN3qpl2ml4util20checksum_accumulatorE", !8, i64 0, !8, i64 4}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTSN3qpl2ml11compression12endianness_tE", !9, i64 0}
!13 = !{!"bool", !9, i64 0}
!14 = !{!"_ZTSN3qpl2ml11compression18compression_mode_tE", !9, i64 0}
!15 = !{!8, !8, i64 0}
!16 = !{!17, !11, i64 0}
!17 = !{!"_ZTS12isal_zstream", !11, i64 0, !8, i64 8, !8, i64 12, !11, i64 16, !8, i64 24, !8, i64 28, !11, i64 32, !8, i64 40, !8, i64 44, !11, i64 48, !18, i64 56, !18, i64 58, !18, i64 60, !18, i64 62, !19, i64 64}
!18 = !{!"short", !9, i64 0}
!19 = !{!"_ZTS11isal_zstate", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !8, i64 16, !20, i64 20, !21, i64 24, !8, i64 64, !9, i64 68, !9, i64 69, !9, i64 70, !9, i64 71, !18, i64 72, !8, i64 76, !9, i64 80, !8, i64 96, !8, i64 100, !8, i64 104, !8, i64 108, !9, i64 112, !9, i64 65936}
!20 = !{!"_ZTS17isal_zstate_state", !9, i64 0}
!21 = !{!"_ZTS7BitBuf2", !22, i64 0, !8, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!22 = !{!"long", !9, i64 0}
!23 = !{!17, !8, i64 8}
!24 = !{!17, !11, i64 32}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!9, !9, i64 0}
!28 = distinct !{!28, !26}
!29 = !{!30, !30, i64 0}
!30 = !{!"_ZTSN3qpl2ml11compression19compression_state_tE", !9, i64 0}
!31 = !{!21, !8, i64 8}
!32 = !{!6, !9, i64 42}


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