	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function get_chunk
_get_chunk:                             ## @get_chunk
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	(%rdi), %rbx
	movq	8(%rdi), %r12
	movl	(%r12), %edx
	leaq	L_.str(%rip), %rsi
	callq	_ff_dlog
	movq	%rbx, %rdi
	callq	_avio_feof
	testq	%rax, %rax
	je	LBB0_4
LBB0_1:
	movq	_AVERROR_EOF@GOTPCREL(%rip), %rax
LBB0_2:
	movl	(%rax), %eax
LBB0_3:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_TIVO_PES_FILEID@GOTPCREL(%rip), %r13
	leaq	L_.str(%rip), %r14
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r12), %rsi
	movq	_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_avio_read
	incl	(%r12)
	cmpl	$4, %eax
	jl	LBB0_1
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	8(%r12), %rdi
	callq	_AV_RB32
	testq	%rax, %rax
	je	LBB0_1
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	8(%r12), %rdi
	callq	_AV_RB32
	cmpq	(%r13), %rax
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%r15, %rdi
	callq	_parse_master
	movq	(%r15), %rbx
	movq	8(%r15), %r12
	movl	(%r12), %edx
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_ff_dlog
	movq	%rbx, %rdi
	callq	_avio_feof
	testq	%rax, %rax
	je	LBB0_5
	jmp	LBB0_1
LBB0_9:
	movq	8(%r12), %rax
	testb	$-128, 12(%rax)
	jne	LBB0_11
## %bb.10:
	movl	(%rax), %r14d
	movl	%r14d, 16(%r12)
	movl	4(%rax), %eax
	movl	%eax, 20(%r12)
	jmp	LBB0_13
LBB0_11:
	movl	4(%rax), %r14d
	shll	$8, %r14d
	addl	(%rax), %r14d
	movl	%r14d, 16(%r12)
	movl	12(%rax), %ecx
	shll	$8, %ecx
	addl	8(%rax), %ecx
	movl	%ecx, 20(%r12)
	cmpl	$65535, %ecx                    ## imm = 0xFFFF
	je	LBB0_13
## %bb.12:
	andl	$-32769, %ecx                   ## imm = 0xFFFF7FFF
	movl	%ecx, 20(%r12)
LBB0_13:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 32(%r12)
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movl	%r14d, %edx
	callq	_ff_dlog
	movl	$4, 24(%r12)
	leaq	28(%r12), %rdi
	callq	_av_freep
	movl	%r14d, %ebx
	shll	$4, %ebx
	movq	_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	$-4, %eax
	cmpl	%eax, %ebx
	jge	LBB0_16
## %bb.14:
	movq	8(%r12), %rdi
	addq	$16, %rdi
	movl	%r14d, %esi
	callq	_parse_chunk_headers
	movl	%eax, 28(%r12)
	testl	%eax, %eax
	je	LBB0_17
## %bb.15:
	addl	%ebx, 24(%r12)
	xorl	%eax, %eax
	jmp	LBB0_3
LBB0_16:
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_17:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"parsing ty chunk #%d\n"

	.comm	_AVERROR_EOF,4,2                ## @AVERROR_EOF
	.comm	_CHUNK_SIZE,4,2                 ## @CHUNK_SIZE
	.comm	_TIVO_PES_FILEID,8,3            ## @TIVO_PES_FILEID
L_.str.1:                               ## @.str.1
	.asciz	"chunk has %d records\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ## @AVERROR_INVALIDDATA
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_get_chunk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function get_chunk
_get_chunk:                             ; @get_chunk
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x0
	ldp	x21, x22, [x0]
	ldr	w2, [x22]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_ff_dlog
	mov	x0, x21
	bl	_avio_feof
	cbz	x0, LBB0_4
LBB0_1:
Lloh2:
	adrp	x8, _AVERROR_EOF@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AVERROR_EOF@GOTPAGEOFF]
LBB0_2:
	ldr	w0, [x8]
LBB0_3:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_4:
Lloh4:
	adrp	x23, _CHUNK_SIZE@GOTPAGE
Lloh5:
	ldr	x23, [x23, _CHUNK_SIZE@GOTPAGEOFF]
Lloh6:
	adrp	x24, _TIVO_PES_FILEID@GOTPAGE
Lloh7:
	ldr	x24, [x24, _TIVO_PES_FILEID@GOTPAGEOFF]
Lloh8:
	adrp	x20, l_.str@PAGE
Lloh9:
	add	x20, x20, l_.str@PAGEOFF
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x1, [x22, #8]
	ldr	w2, [x23]
	mov	x0, x21
	bl	_avio_read
	ldr	w8, [x22]
	add	w8, w8, #1
	str	w8, [x22]
	cmp	w0, #4
	b.lt	LBB0_1
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x0, [x22, #8]
	bl	_AV_RB32
	cbz	x0, LBB0_1
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x0, [x22, #8]
	bl	_AV_RB32
	ldr	x8, [x24]
	cmp	x0, x8
	b.ne	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	bl	_parse_master
	ldp	x21, x22, [x19]
	ldr	w2, [x22]
	mov	x0, x19
	mov	x1, x20
	bl	_ff_dlog
	mov	x0, x21
	bl	_avio_feof
	cbz	x0, LBB0_5
	b	LBB0_1
LBB0_9:
	ldr	x8, [x22, #8]
	ldrb	w9, [x8, #12]
	tbnz	w9, #7, LBB0_11
; %bb.10:
	ldr	w20, [x8]
	str	w20, [x22, #16]
	ldr	w8, [x8, #4]
	b	LBB0_13
LBB0_11:
	ldp	w10, w9, [x8]
	add	w20, w10, w9, lsl #8
	str	w20, [x22, #16]
	ldp	w8, w9, [x8, #8]
	add	w8, w8, w9, lsl #8
	str	w8, [x22, #20]
	mov	w9, #65535
	cmp	w8, w9
	b.eq	LBB0_14
; %bb.12:
	and	w8, w8, #0xffff7fff
LBB0_13:
	str	w8, [x22, #20]
LBB0_14:
	stp	xzr, xzr, [x22, #32]
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x20
	bl	_ff_dlog
	mov	w8, #4
	str	w8, [x22, #24]
	add	x0, x22, #28
	bl	_av_freep
	lsl	w19, w20, #4
	ldr	w8, [x23]
	sub	w8, w8, #4
	cmp	w19, w8
	b.ge	LBB0_17
; %bb.15:
	ldr	x8, [x22, #8]
	add	x0, x8, #16
	mov	x1, x20
	bl	_parse_chunk_headers
	str	w0, [x22, #28]
	cbz	w0, LBB0_18
; %bb.16:
	mov	w0, #0
	ldr	w8, [x22, #24]
	add	w8, w8, w19
	str	w8, [x22, #24]
	b	LBB0_3
LBB0_17:
Lloh12:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
	b	LBB0_2
LBB0_18:
Lloh14:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_AVERROR
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"parsing ty chunk #%d\n"

	.comm	_AVERROR_EOF,4,2                ; @AVERROR_EOF
	.comm	_CHUNK_SIZE,4,2                 ; @CHUNK_SIZE
	.comm	_TIVO_PES_FILEID,8,3            ; @TIVO_PES_FILEID
l_.str.1:                               ; @.str.1
	.asciz	"chunk has %d records\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ; @AVERROR_INVALIDDATA
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_get_chunk
.subsections_via_symbols
