	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function llrun_encoder_finish
_llrun_encoder_finish:                  ## @llrun_encoder_finish
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$184, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r13
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	callq	_dyn_mark
	movl	(%r13), %eax
	xorl	%edi, %edi
	cmpl	4(%r13), %eax
	sete	%dil
	callq	_assert
	movl	4(%r13), %esi
	movl	20(%r13), %edi
	callq	_get_max_possible_gap
	movl	%eax, %r14d
	movl	%eax, %edi
	callq	_llrun_get_buckets_quantity
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -192(%rbp)                ## 8-byte Spill
	leal	(,%rax,4), %edi
	callq	_zmalloc0
	movq	%rax, %r12
	cmpl	$0, 4(%r13)
	jle	LBB0_3
## %bb.1:
	movq	8(%r13), %rax
	movl	$-1, %ecx
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rax,%rbx,4), %r15d
	subl	%ecx, %r15d
	setg	%al
	cmpl	%r14d, %r15d
	setle	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_assert
	movl	%r15d, %edi
	callq	_bsr
	incl	(%r12,%rax,4)
	movq	8(%r13), %rax
	movl	(%rax,%rbx,4), %ecx
	incq	%rbx
	movslq	4(%r13), %rdx
	cmpq	%rdx, %rbx
	jl	LBB0_2
LBB0_3:
	movq	_HUFFMAN_MAX_CODE_LENGTH@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-184(%rbp), %rcx
	movq	%r12, %rdi
	movq	-192(%rbp), %rbx                ## 8-byte Reload
	movl	%ebx, %esi
	callq	_get_huffman_codes_lengths
	movq	%rax, %r15
	movq	%rax, %rdi
	movl	%ebx, %esi
	callq	_llhuf_check_codes_lengths
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_assert
	leaq	16(%r13), %rdi
	movq	%rdi, -224(%rbp)                ## 8-byte Spill
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_bwrite_huffman_codes
	movq	%rsp, -208(%rbp)                ## 8-byte Spill
	movl	-184(%rbp), %eax
	movl	%eax, -180(%rbp)                ## 4-byte Spill
	movq	_HUFFMAN_MAX_CODE_LENGTH@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	incl	%eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, -200(%rbp)                ## 8-byte Spill
	movl	(%r12), %r12d
	movl	%r12d, %eax
	shll	$5, %eax
	addl	$32, %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r9
	leaq	-176(%rbp), %r8
	movq	%r15, -216(%rbp)                ## 8-byte Spill
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%r12d, %edx
	movq	-200(%rbp), %rcx                ## 8-byte Reload
	callq	_canonical_huffman
	cmpl	$0, 4(%r13)
	movq	8(%r13), %rdi
	jle	LBB0_8
## %bb.4:
	movl	$-1, %eax
	xorl	%ebx, %ebx
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	btcl	%r15d, %r12d
	movq	-224(%rbp), %rdi                ## 8-byte Reload
	movl	%r12d, %esi
	movl	%r15d, %edx
	callq	_bwrite_nbits
	movq	8(%r13), %rdi
	movl	(%rdi,%rbx,4), %eax
	incq	%rbx
	movslq	4(%r13), %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_8
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rdi,%rbx,4), %r12d
	subl	%eax, %r12d
	setg	%al
	cmpl	%r14d, %r12d
	setle	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_assert
	movl	%r12d, %edi
	callq	_bsr
	movq	%rax, %r15
	testl	%r15d, %r15d
	setns	%al
	cmpl	%r15d, -192(%rbp)               ## 4-byte Folded Reload
	setg	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_assert
	cmpl	$2, -180(%rbp)                  ## 4-byte Folded Reload
	jl	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r15d, %rax
	movl	-176(%rbp,%rax,4), %esi
	movq	-216(%rbp), %rcx                ## 8-byte Reload
	movl	(%rcx,%rax,4), %edx
	movq	%r13, %rdi
	callq	_list_encode_nbits
	jmp	LBB0_7
LBB0_8:
	callq	_free
	callq	_dyn_release
	movq	-208(%rbp), %rsp                ## 8-byte Reload
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_10
## %bb.9:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_HUFFMAN_MAX_CODE_LENGTH,4,2    ## @HUFFMAN_MAX_CODE_LENGTH
	.no_dead_strip	_llrun_encoder_finish
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function llrun_encoder_finish
_llrun_encoder_finish:                  ; @llrun_encoder_finish
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #160
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-96]
	bl	_dyn_mark
	ldp	w8, w9, [x19]
	cmp	w8, w9
	cset	w0, eq
	bl	_assert
	ldr	w0, [x19, #20]
	ldr	w1, [x19, #4]
	bl	_get_max_possible_gap
	mov	x20, x0
	bl	_llrun_get_buckets_quantity
	mov	x21, x0
	lsl	w0, w0, #2
	bl	_zmalloc0
	mov	x22, x0
	ldr	w8, [x19, #4]
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.1:
	mov	x24, #0
	ldr	x8, [x19, #8]
	mov	w9, #-1
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	lsl	x25, x24, #2
	ldr	w8, [x8, x25]
	sub	w23, w8, w9
	cmp	w23, #0
	ccmp	w23, w20, #0, gt
	cset	w0, le
	bl	_assert
	mov	x0, x23
	bl	_bsr
	lsl	x8, x0, #2
	ldr	w9, [x22, x8]
	add	w9, w9, #1
	str	w9, [x22, x8]
	ldr	x8, [x19, #8]
	ldr	w9, [x8, x25]
	add	x24, x24, #1
	ldrsw	x10, [x19, #4]
	cmp	x24, x10
	b.lt	LBB0_2
LBB0_3:
Lloh3:
	adrp	x24, _HUFFMAN_MAX_CODE_LENGTH@GOTPAGE
Lloh4:
	ldr	x24, [x24, _HUFFMAN_MAX_CODE_LENGTH@GOTPAGEOFF]
	ldr	w2, [x24]
	sub	x3, x29, #228
	mov	x0, x22
	mov	x1, x21
	bl	_get_huffman_codes_lengths
	mov	x22, x0
	mov	x1, x21
	bl	_llhuf_check_codes_lengths
	cmp	x0, #0
	cset	w0, eq
	bl	_assert
	add	x23, x19, #16
	mov	x0, x23
	mov	x1, x22
	mov	x2, x21
	bl	_bwrite_huffman_codes
	mov	x8, sp
	stur	x8, [x29, #-240]                ; 8-byte Folded Spill
	ldur	w27, [x29, #-228]
	ldr	w8, [x24]
	add	w8, w8, #1
	lsl	x8, x8, #2
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x3, x9, x8
	mov	sp, x3
	ldr	w2, [x24]
	lsl	w8, w2, #5
	add	w8, w8, #32
	lsl	x8, x8, #2
	mov	x9, x8
Lloh7:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh8:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	sub	x5, x9, x8
	mov	sp, x5
	sub	x4, x29, #224
	mov	x0, x22
	mov	x1, x21
	bl	_canonical_huffman
	ldr	w8, [x19, #4]
	ldr	x0, [x19, #8]
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.4:
	mov	x26, #0
	mov	w8, #-1
	mov	w28, #1
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	lsl	w8, w28, w25
	eor	w1, w8, w24
	mov	x0, x23
	mov	x2, x25
	bl	_bwrite_nbits
	ldr	x0, [x19, #8]
	ldr	w8, [x0, x26, lsl #2]
	add	x26, x26, #1
	ldrsw	x9, [x19, #4]
	cmp	x26, x9
	b.ge	LBB0_8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x0, x26, lsl #2]
	sub	w24, w9, w8
	cmp	w24, #0
	ccmp	w24, w20, #0, gt
	cset	w0, le
	bl	_assert
	mov	x0, x24
	bl	_bsr
	mov	x25, x0
	cmp	w25, #0
	ccmp	w21, w25, #4, ge
	cset	w0, gt
	bl	_assert
	cmp	w27, #2
	b.lt	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	sbfiz	x8, x25, #2, #32
	sub	x9, x29, #224
	ldr	w1, [x9, x8]
	ldr	w2, [x22, x8]
	mov	x0, x19
	bl	_list_encode_nbits
	b	LBB0_5
LBB0_8:
	bl	_free
	bl	_dyn_release
	ldur	x8, [x29, #-240]                ; 8-byte Folded Reload
	mov	sp, x8
	ldur	x8, [x29, #-96]
Lloh9:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh10:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_10
; %bb.9:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_10:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_HUFFMAN_MAX_CODE_LENGTH,4,2    ; @HUFFMAN_MAX_CODE_LENGTH
	.no_dead_strip	_llrun_encoder_finish
.subsections_via_symbols
