	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tm2_build_huff_table
_tm2_build_huff_table:                  ## @tm2_build_huff_table
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	leaq	4(%rdi), %rbx
	movq	%rbx, %rdi
	movl	$5, %esi
	callq	_get_bits
	movq	%rax, %r13
	movl	%r13d, -104(%rbp)
	movq	%rbx, %rdi
	movl	$5, %esi
	callq	_get_bits
	movq	%rax, %r14
	movl	%r14d, -100(%rbp)
	movq	%rbx, %rdi
	movl	$5, %esi
	callq	_get_bits
	movq	%rax, -56(%rbp)
	movq	%rbx, %rdi
	movl	$17, %esi
	callq	_get_bits_long
	movl	%eax, %r12d
	movl	%eax, -96(%rbp)
	movl	$0, -92(%rbp)
	leal	-33(%r13), %eax
	cmpl	$-32, %eax
	jb	LBB0_3
## %bb.1:
	testl	%r14d, %r14d
	js	LBB0_3
## %bb.2:
	cmpl	$26, %r14d
	jge	LBB0_3
## %bb.4:
	leal	-65537(%r12), %eax
	cmpl	$-65537, %eax                   ## imm = 0xFFFEFFFF
	ja	LBB0_7
## %bb.5:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	movl	%r12d, %ecx
	xorl	%eax, %eax
	callq	_av_log
	jmp	LBB0_6
LBB0_3:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movl	%r13d, %ecx
	movl	%r14d, %r8d
	xorl	%eax, %eax
	callq	_av_log
LBB0_6:
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_26
LBB0_7:
	testl	%r14d, %r14d
	jne	LBB0_9
## %bb.8:
	movl	$1, -100(%rbp)
LBB0_9:
	incl	%r12d
	shrl	%r12d
	movl	%r12d, -88(%rbp)
	movl	%r12d, %edi
	movl	$4, %esi
	callq	_av_calloc
	movq	%rax, %r14
	movq	%rax, -64(%rbp)
	movl	%r12d, %edi
	movl	$4, %esi
	callq	_av_calloc
	movq	%rax, %rbx
	movq	%rax, -72(%rbp)
	movl	%r12d, %edi
	movl	$4, %esi
	callq	_av_calloc
	movq	%rax, -80(%rbp)
	testq	%r14, %r14
	je	LBB0_12
## %bb.10:
	testq	%rbx, %rbx
	je	LBB0_12
## %bb.11:
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:
	leaq	-104(%rbp), %rcx
	movq	%r15, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_tm2_read_tree
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_16
## %bb.14:
	movl	-100(%rbp), %r8d
	cmpl	%r8d, %ebx
	je	LBB0_16
## %bb.15:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdx
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_av_log
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_16:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movl	-92(%rbp), %ecx
	movl	-88(%rbp), %r8d
	cmpl	%r8d, %ecx
	je	LBB0_18
## %bb.17:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.3(%rip), %rdx
	xorl	%eax, %eax
	callq	_av_log
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_18:
	testl	%ebx, %ebx
	js	LBB0_25
## %bb.19:
	leaq	16(%r14), %rdi
	movl	-100(%rbp), %esi
	movl	-88(%rbp), %edx
	movq	-80(%rbp), %rcx
	movl	$4, %r8d
	movl	$4, %r9d
	pushq	$0
	pushq	$4
	pushq	$4
	pushq	-72(%rbp)
	callq	_init_vlc
	addq	$32, %rsp
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_20
## %bb.21:
	movl	-100(%rbp), %eax
	movl	%eax, (%r14)
	movl	-88(%rbp), %edi
	movl	%edi, 4(%r14)
	movl	$4, %esi
	callq	_av_malloc_array
	movq	%rax, 8(%r14)
	testq	%rax, %rax
	je	LBB0_12
## %bb.22:
	cmpl	$0, 4(%r14)
	jle	LBB0_25
## %bb.23:
	movq	-64(%rbp), %rcx
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_24:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rcx,%rdx,4), %esi
	movl	%esi, (%rax,%rdx,4)
	incq	%rdx
	movslq	4(%r14), %rsi
	cmpq	%rsi, %rdx
	jl	LBB0_24
	jmp	LBB0_25
LBB0_12:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_AVERROR
	movl	%eax, %ebx
LBB0_25:
	movq	-64(%rbp), %rdi
	callq	_av_free
	movq	-72(%rbp), %rdi
	callq	_av_free
	movq	-80(%rbp), %rdi
	callq	_av_free
LBB0_26:
	movl	%ebx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.4(%rip), %rdx
	xorl	%eax, %eax
	callq	_av_log
	jmp	LBB0_25
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Incorrect tree parameters - literal length: %i, max code length: %i\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ## @AVERROR_INVALIDDATA
L_.str.1:                               ## @.str.1
	.asciz	"Incorrect number of Huffman tree nodes: %i\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.2:                               ## @.str.2
	.asciz	"Got less bits than expected: %i of %i\n"

L_.str.3:                               ## @.str.3
	.asciz	"Got less codes than expected: %i of %i\n"

L_.str.4:                               ## @.str.4
	.asciz	"Cannot build VLC table\n"

	.no_dead_strip	_tm2_build_huff_table
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tm2_build_huff_table
_tm2_build_huff_table:                  ; @tm2_build_huff_table
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	mov	x19, x1
	mov	x20, x0
	add	x21, x0, #4
	mov	x0, x21
	mov	w1, #5
	bl	_get_bits
	mov	x22, x0
	str	w0, [sp, #24]
	mov	x0, x21
	mov	w1, #5
	bl	_get_bits
	mov	x23, x0
	str	w0, [sp, #28]
	mov	x0, x21
	mov	w1, #5
	bl	_get_bits
	str	x0, [sp, #72]
	mov	x0, x21
	mov	w1, #17
	bl	_get_bits_long
                                        ; kill: def $w0 killed $w0 def $x0
	stp	w0, wzr, [sp, #32]
	sub	w8, w22, #33
	cmn	w8, #32
	b.lo	LBB0_5
; %bb.1:
	tbnz	w23, #31, LBB0_5
; %bb.2:
	cmp	w23, #26
	b.ge	LBB0_5
; %bb.3:
	mov	w8, #-65537
	add	w9, w0, w8
	cmp	w9, w8
	b.hi	LBB0_7
; %bb.4:
	ldr	w8, [x20]
Lloh0:
	adrp	x9, _AV_LOG_ERROR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x9]
	str	x0, [sp]
Lloh3:
	adrp	x2, l_.str.1@PAGE
Lloh4:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x8
	b	LBB0_6
LBB0_5:
	ldr	w0, [x20]
Lloh5:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	stp	x22, x23, [sp]
Lloh8:
	adrp	x2, l_.str@PAGE
Lloh9:
	add	x2, x2, l_.str@PAGEOFF
LBB0_6:
	bl	_av_log
Lloh10:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh11:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
Lloh12:
	ldr	w21, [x8]
	b	LBB0_25
LBB0_7:
	cbnz	w23, LBB0_9
; %bb.8:
	mov	w8, #1
	str	w8, [sp, #28]
LBB0_9:
	add	w8, w0, #1
	lsr	w22, w8, #1
	str	w22, [sp, #40]
	mov	x0, x22
	mov	w1, #4
	bl	_av_calloc
	mov	x23, x0
	str	x0, [sp, #64]
	mov	x0, x22
	mov	w1, #4
	bl	_av_calloc
	mov	x21, x0
	str	x0, [sp, #56]
	mov	x0, x22
	mov	w1, #4
	bl	_av_calloc
	str	x0, [sp, #48]
	cbz	x23, LBB0_23
; %bb.10:
	cbz	x21, LBB0_23
; %bb.11:
	cbz	x0, LBB0_23
; %bb.12:
	add	x3, sp, #24
	mov	x0, x20
	mov	w1, #0
	mov	w2, #0
	bl	_tm2_read_tree
	mov	x21, x0
	tbnz	w0, #31, LBB0_15
; %bb.13:
	ldr	w8, [sp, #28]
	cmp	w21, w8
	b.eq	LBB0_15
; %bb.14:
	ldr	w0, [x20]
Lloh13:
	adrp	x9, _AV_LOG_ERROR@GOTPAGE
Lloh14:
	ldr	x9, [x9, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x9]
	stp	x21, x8, [sp]
Lloh16:
	adrp	x2, l_.str.2@PAGE
Lloh17:
	add	x2, x2, l_.str.2@PAGEOFF
	bl	_av_log
Lloh18:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh19:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
Lloh20:
	ldr	w21, [x8]
LBB0_15:
	ldp	w8, w9, [sp, #36]
	cmp	w8, w9
	b.eq	LBB0_17
; %bb.16:
	ldr	w0, [x20]
Lloh21:
	adrp	x10, _AV_LOG_ERROR@GOTPAGE
Lloh22:
	ldr	x10, [x10, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x10]
	stp	x8, x9, [sp]
Lloh24:
	adrp	x2, l_.str.3@PAGE
Lloh25:
	add	x2, x2, l_.str.3@PAGEOFF
	bl	_av_log
Lloh26:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh27:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
Lloh28:
	ldr	w21, [x8]
LBB0_17:
	tbnz	w21, #31, LBB0_24
; %bb.18:
	add	x0, x19, #16
	ldr	w1, [sp, #28]
	ldr	w2, [sp, #40]
	ldp	x3, x6, [sp, #48]
	mov	w8, #4
	str	x8, [sp]
	mov	w4, #4
	mov	w5, #4
	mov	w7, #4
	bl	_init_vlc
	mov	x21, x0
	tbnz	w0, #31, LBB0_26
; %bb.19:
	ldr	w8, [sp, #28]
	ldr	w0, [sp, #40]
	stp	w8, w0, [x19]
	mov	w1, #4
	bl	_av_malloc_array
	str	x0, [x19, #8]
	cbz	x0, LBB0_23
; %bb.20:
	ldr	w8, [x19, #4]
	cmp	w8, #1
	b.lt	LBB0_24
; %bb.21:
	mov	x8, #0
	ldr	x9, [sp, #64]
LBB0_22:                                ; =>This Inner Loop Header: Depth=1
	lsl	x10, x8, #2
	ldr	w11, [x9, x10]
	str	w11, [x0, x10]
	add	x8, x8, #1
	ldrsw	x10, [x19, #4]
	cmp	x8, x10
	b.lt	LBB0_22
	b	LBB0_24
LBB0_23:
Lloh29:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh30:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh31:
	ldr	w0, [x8]
	bl	_AVERROR
	mov	x21, x0
LBB0_24:
	ldr	x0, [sp, #64]
	bl	_av_free
	ldr	x0, [sp, #56]
	bl	_av_free
	ldr	x0, [sp, #48]
	bl	_av_free
LBB0_25:
	mov	x0, x21
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_26:
	ldr	w0, [x20]
Lloh32:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh33:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
Lloh35:
	adrp	x2, l_.str.4@PAGE
Lloh36:
	add	x2, x2, l_.str.4@PAGEOFF
	bl	_av_log
	b	LBB0_24
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Incorrect tree parameters - literal length: %i, max code length: %i\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ; @AVERROR_INVALIDDATA
l_.str.1:                               ; @.str.1
	.asciz	"Incorrect number of Huffman tree nodes: %i\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.2:                               ; @.str.2
	.asciz	"Got less bits than expected: %i of %i\n"

l_.str.3:                               ; @.str.3
	.asciz	"Got less codes than expected: %i of %i\n"

l_.str.4:                               ; @.str.4
	.asciz	"Cannot build VLC table\n"

	.no_dead_strip	_tm2_build_huff_table
.subsections_via_symbols
