	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function build_huffman
_build_huffman:                         ## @build_huffman
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r14
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %r15
	movq	(%r15), %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movq	%r14, %rdi
	callq	_get_bits_left
	movl	$0, %r12d
	cmpl	$8, %eax
	jl	LBB0_22
## %bb.1:
	movslq	-44(%rbp), %rbx                 ## 4-byte Folded Reload
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%r11, -56(%rbp)                 ## 8-byte Spill
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	jg	LBB0_19
LBB0_21:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%r14, %rdi
	callq	_get_bits_left
	cmpl	$7, %eax
	jle	LBB0_22
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_get_bits
	movl	%eax, %r12d
	movq	%r14, %rdi
	movl	$7, %esi
	callq	_get_bits
	movl	%eax, %r13d
	shll	$3, %r12d
	movq	%r14, %rdi
	movl	%r12d, %esi
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	callq	_get_bitsz
                                        ## kill: def $eax killed $eax def $rax
	movslq	%r12d, %r10
	testl	%eax, %eax
	movq	-56(%rbp), %r11                 ## 8-byte Reload
	js	LBB0_15
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movslq	%r11d, %r8
	leal	1(%rax), %r9d
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%r9d, %esi
	andl	$-2, %esi
	negq	%rsi
	xorl	%edi, %edi
	movq	%r8, %rdx
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=2
	addq	$2, %rdx
	addq	$-2, %rdi
	cmpq	%rdi, %rsi
	je	LBB0_11
LBB0_6:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	%rbx, %rdx
	jge	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	movq	(%r15), %rcx
	movq	(%rcx,%r10,8), %rcx
	movl	%r13d, (%rcx,%rdx,4)
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=2
	leaq	1(%rdx), %rcx
	cmpq	%rbx, %rcx
	jge	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=2
	movq	(%r15), %rcx
	movq	(%rcx,%r10,8), %rcx
	movl	%r13d, 4(%rcx,%rdx,4)
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	negq	%rdi
	testb	$1, %r9b
	jne	LBB0_13
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edi, %edi
	testb	$1, %r9b
	je	LBB0_15
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	addq	%r8, %rdi
	cmpq	%rbx, %rdi
	jge	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r15), %rcx
	movq	(%rcx,%r10,8), %rcx
	movl	%r13d, (%rcx,%rdi,4)
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_2 Depth=1
	addl	%eax, %r11d
	incl	%r11d
	cmpl	-44(%rbp), %r11d                ## 4-byte Folded Reload
	jne	LBB0_18
## %bb.16:                              ##   in Loop: Header=BB0_2 Depth=1
	leaq	(,%r10,4), %rdi
	addq	16(%r15), %rdi
	movq	(%r15), %rax
	movq	(%rax,%r10,8), %rsi
	callq	*24(%r15)
	testq	%rax, %rax
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	jne	LBB0_17
## %bb.20:                              ##   in Loop: Header=BB0_2 Depth=1
	incl	%r12d
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	cmpl	8(%r15), %r12d
	jne	LBB0_21
LBB0_22:
	cmpl	8(%r15), %r12d
	movl	$0, %eax
	je	LBB0_25
## %bb.23:
	leaq	L_.str.2(%rip), %rdx
	jmp	LBB0_24
LBB0_19:
	leaq	L_.str.1(%rip), %rdx
	jmp	LBB0_24
LBB0_17:
	leaq	L_.str(%rip), %rdx
LBB0_24:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_av_log
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_25:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot build Huffman codes\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ## @AVERROR_INVALIDDATA
L_.str.1:                               ## @.str.1
	.asciz	"Invalid Huffman codes\n"

L_.str.2:                               ## @.str.2
	.asciz	"Huffman tables too short\n"

	.no_dead_strip	_build_huffman
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function build_huffman
_build_huffman:                         ; @build_huffman
	.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
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x25, [x0]
	ldr	x0, [x25]
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	mov	x0, x21
	bl	_get_bits_left
	mov	w26, #0
	cmp	w0, #8
	b.lt	LBB0_13
; %bb.1:
	mov	w26, #0
	mov	w28, #0
	sxtw	x27, w20
Lloh0:
	adrp	x22, l_.str@PAGE
Lloh1:
	add	x22, x22, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	b.gt	LBB0_18
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x21
	bl	_get_bits_left
	cmp	w0, #7
	b.le	LBB0_13
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	mov	x0, x21
	mov	w1, #1
	bl	_get_bits
	mov	x24, x0
	mov	x0, x21
	mov	w1, #7
	bl	_get_bits
	mov	x23, x0
	lsl	w1, w24, #3
	mov	x0, x21
	bl	_get_bitsz
	tbnz	w0, #31, LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	sxtw	x8, w26
	sxtw	x9, w28
	add	w10, w0, #1
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=2
	add	x9, x9, #1
	subs	x10, x10, #1
	b.eq	LBB0_9
LBB0_7:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	x9, x27
	b.ge	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	ldr	x11, [x25]
	ldr	x11, [x11, x8, lsl #3]
	str	w23, [x11, x9, lsl #2]
	b	LBB0_6
LBB0_9:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	w8, w28, w0
	add	w28, w8, #1
	cmp	w28, w20
	b.ne	LBB0_2
; %bb.10:                               ;   in Loop: Header=BB0_4 Depth=1
	ldp	x9, x8, [x25, #16]
	add	x0, x9, w26, sxtw #2
	ldr	x9, [x25]
	ldr	x1, [x9, w26, sxtw #3]
	blr	x8
	cbnz	x0, LBB0_16
; %bb.11:                               ;   in Loop: Header=BB0_4 Depth=1
	add	w26, w26, #1
	ldr	w8, [x25, #8]
	cmp	w26, w8
	b.eq	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_4 Depth=1
	mov	w28, #0
	b	LBB0_3
LBB0_13:
	ldr	w8, [x25, #8]
	cmp	w26, w8
	b.ne	LBB0_15
; %bb.14:
	mov	w0, #0
	b	LBB0_17
LBB0_15:
Lloh2:
	adrp	x22, l_.str.2@PAGE
Lloh3:
	add	x22, x22, l_.str.2@PAGEOFF
LBB0_16:
Lloh4:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x22
	bl	_av_log
Lloh7:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
LBB0_17:
	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_18:
Lloh10:
	adrp	x22, l_.str.1@PAGE
Lloh11:
	add	x22, x22, l_.str.1@PAGEOFF
	b	LBB0_16
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot build Huffman codes\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ; @AVERROR_INVALIDDATA
l_.str.1:                               ; @.str.1
	.asciz	"Invalid Huffman codes\n"

l_.str.2:                               ; @.str.2
	.asciz	"Huffman tables too short\n"

	.no_dead_strip	_build_huffman
.subsections_via_symbols
