	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function viv_read_packet
_viv_read_packet:                       ## @viv_read_packet
	.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, %rbx
	movq	8(%rdi), %r13
	movq	80(%r13), %rdi
	testq	%rdi, %rdi
	je	LBB0_19
## %bb.1:
	movq	%rsi, %r14
	callq	_avio_feof
	testq	%rax, %rax
	je	LBB0_5
## %bb.2:
	movq	_AVERROR_EOF@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %eax
LBB0_4:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movslq	(%r13), %rax
	cmpl	4(%r13), %eax
	jge	LBB0_9
## %bb.6:
	movq	64(%r13), %rcx
	movq	80(%r13), %rdi
	movl	8(%rcx,%rax,8), %edx
	subl	(%rcx,%rax,8), %edx
	movq	%r14, %rsi
	callq	_av_get_packet
	testl	%eax, %eax
	js	LBB0_4
## %bb.7:
	movq	8(%r13), %rax
	movq	48(%r13), %rcx
	shlq	$4, %rax
	movl	8(%rcx,%rax), %eax
	addl	56(%r13), %eax
	addl	%eax, 20(%r14)
	movl	$1, (%r14)
	movq	(%rbx), %rax
	movq	8(%rax), %rbx
	movl	16(%r13), %edi
	movl	8(%rbx), %edx
	movl	12(%rbx), %esi
	callq	_av_rescale
	movq	(%rbx), %rcx
	cltd
	idivl	(%rcx)
	movl	%eax, 4(%r14)
	movq	64(%r13), %rax
	movslq	(%r13), %rsi
	movl	4(%rax,%rsi,8), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltd
	idivl	4(%rcx)
	addl	%eax, 16(%r13)
	movq	_AV_PKT_FLAG_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 16(%r14)
	leal	1(%rsi), %eax
	movl	%eax, (%r13)
LBB0_8:
	xorl	%eax, %eax
	jmp	LBB0_4
LBB0_9:
	movq	24(%r13), %rax
	cmpq	32(%r13), %rax
	jb	LBB0_12
## %bb.10:
	movq	8(%r13), %rax
	incq	%rax
	movslq	40(%r13), %rcx
	cmpq	%rcx, %rax
	jae	LBB0_19
## %bb.11:
	movq	%rax, 8(%r13)
	movq	%rbx, %rdi
	movq	%r13, %rsi
	xorl	%edx, %edx
	callq	_load_sb_block
	movq	$0, 24(%r13)
LBB0_12:
	movq	80(%r13), %r15
	testq	%r15, %r15
	je	LBB0_19
## %bb.13:
	movq	%r15, %rdi
	callq	_avio_tell
	movq	%rax, %rbx
	movq	24(%r13), %rax
	movq	72(%r13), %rcx
	shlq	$4, %rax
	addq	8(%rcx,%rax), %rbx
	movq	(%rcx,%rax), %r12
	movq	%r15, %rdi
	callq	_ffio_read_varlen
	movl	%eax, %edx
	testq	%r12, %r12
	je	LBB0_20
## %bb.14:
	movq	_INT_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jg	LBB0_21
## %bb.15:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_av_get_packet
	testl	%eax, %eax
	js	LBB0_4
## %bb.16:
	movq	8(%r13), %rcx
	movq	48(%r13), %rdx
	shlq	$4, %rcx
	movl	8(%rdx,%rcx), %eax
	addl	56(%r13), %eax
	addl	%eax, 20(%r14)
	movq	24(%r13), %rax
	movl	(%rdx,%rcx), %ecx
	addl	%eax, %ecx
	movl	%ecx, 4(%r14)
	movq	8(%r14), %rdx
	xorl	%ecx, %ecx
	testb	$-128, (%rdx)
	jne	LBB0_18
## %bb.17:
	movq	_AV_PKT_FLAG_KEY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_18:
	orl	%ecx, 16(%r14)
	movl	$0, (%r14)
	jmp	LBB0_31
LBB0_19:
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_20:
	movq	%r15, %rdi
	movl	%edx, %r12d
	callq	_ffio_read_varlen
	movq	_INT_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jle	LBB0_22
LBB0_21:
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_22:
	movl	%r12d, %edx
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_av_get_packet
	testl	%eax, %eax
	js	LBB0_4
## %bb.23:
	movq	8(%r13), %rax
	movq	48(%r13), %rcx
	shlq	$4, %rax
	movl	8(%rcx,%rax), %edx
	addl	56(%r13), %edx
	addl	%edx, 20(%r14)
	movl	(%rcx,%rax), %eax
	addl	24(%r13), %eax
	movl	%eax, 4(%r14)
	movq	8(%r14), %rcx
	xorl	%eax, %eax
	testb	$-128, (%rcx)
	jne	LBB0_25
## %bb.24:
	movq	_AV_PKT_FLAG_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_25:
	orl	%eax, 16(%r14)
	movl	$0, (%r14)
	movq	_MAX_AUDIO_SUBPACKETS@GOTPCREL(%rip), %rax
	cmpl	$2, (%rax)
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	jl	LBB0_30
## %bb.26:
	movq	%rax, %r12
	xorl	%r14d, %r14d
	jmp	LBB0_28
LBB0_27:                                ##   in Loop: Header=BB0_28 Depth=1
	leaq	1(%r14), %rcx
	movl	%ecx, 4(%r13)
	movq	64(%r13), %rdx
	movl	%ebx, (%rdx,%r14,8)
	movl	%eax, 4(%rdx,%r14,8)
	movslq	(%r12), %rax
	decq	%rax
	movq	%rcx, %r14
	cmpq	%rax, %rcx
	jge	LBB0_30
LBB0_28:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_ffio_read_varlen
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_ffio_read_varlen
	testq	%r14, %r14
	je	LBB0_27
## %bb.29:                              ##   in Loop: Header=BB0_28 Depth=1
	testl	%ebx, %ebx
	jne	LBB0_27
LBB0_30:
	movq	%r15, %rdi
	callq	_avio_tell
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	subl	%eax, %edx
	movq	64(%r13), %rax
	movslq	4(%r13), %rcx
	movl	%edx, (%rax,%rcx,8)
	movl	$0, (%r13)
	movq	24(%r13), %rax
LBB0_31:
	incq	%rax
	movq	%rax, 24(%r13)
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_EIO,4,2                        ## @EIO
	.comm	_AVERROR_EOF,4,2                ## @AVERROR_EOF
	.comm	_AV_PKT_FLAG_KEY,4,2            ## @AV_PKT_FLAG_KEY
	.comm	_INT_MAX,4,2                    ## @INT_MAX
	.comm	_AVERROR_INVALIDDATA,4,2        ## @AVERROR_INVALIDDATA
	.comm	_MAX_AUDIO_SUBPACKETS,4,2       ## @MAX_AUDIO_SUBPACKETS
	.no_dead_strip	_viv_read_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function viv_read_packet
_viv_read_packet:                       ; @viv_read_packet
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x21, x0
	ldr	x19, [x0, #8]
	ldr	x0, [x19, #80]
	cbz	x0, LBB0_16
; %bb.1:
	mov	x20, x1
	bl	_avio_feof
	cbz	x0, LBB0_5
; %bb.2:
Lloh0:
	adrp	x8, _AVERROR_EOF@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AVERROR_EOF@GOTPAGEOFF]
LBB0_3:
	ldr	w0, [x8]
LBB0_4:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_5:
	ldp	w8, w9, [x19]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	cmp	w8, w9
	b.ge	LBB0_8
; %bb.6:
	ldr	x9, [x19, #64]
	add	x8, x9, x8, lsl #3
	ldr	w9, [x8, #8]
	ldr	w8, [x8]
	sub	w2, w9, w8
	ldr	x0, [x19, #80]
	mov	x1, x20
	bl	_av_get_packet
	tbnz	w0, #31, LBB0_4
; %bb.7:
	ldr	w8, [x19, #56]
	ldr	x9, [x19, #48]
	ldr	x10, [x19, #8]
	add	x9, x9, x10, lsl #4
	ldr	w9, [x9, #8]
	ldr	w10, [x20, #20]
	add	w8, w9, w8
	add	w8, w10, w8
	str	w8, [x20, #20]
	mov	w8, #1
	str	w8, [x20]
	ldr	x8, [x21]
	ldr	x21, [x8, #8]
	ldr	w0, [x19, #16]
	ldp	w2, w1, [x21, #8]
	bl	_av_rescale
	mov	x8, x0
	mov	w0, #0
	ldr	x9, [x21]
	ldp	w10, w9, [x9]
	sdiv	w8, w8, w10
	str	w8, [x20, #4]
	ldr	x8, [x19, #64]
	ldrsw	x10, [x19]
	add	x8, x8, x10, lsl #3
	ldr	w8, [x8, #4]
	cmp	w8, #0
	cinc	w8, w8, lt
	asr	w8, w8, #1
	sdiv	w8, w8, w9
	ldr	w9, [x19, #16]
	add	w8, w9, w8
	str	w8, [x19, #16]
Lloh2:
	adrp	x8, _AV_PKT_FLAG_KEY@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AV_PKT_FLAG_KEY@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	ldr	w9, [x20, #16]
	orr	w8, w9, w8
	str	w8, [x20, #16]
	add	w8, w10, #1
	str	w8, [x19]
	b	LBB0_4
LBB0_8:
	ldp	x8, x9, [x19, #24]
	cmp	x8, x9
	b.lo	LBB0_11
; %bb.9:
	ldr	x8, [x19, #8]
	add	x8, x8, #1
	ldrsw	x9, [x19, #40]
	cmp	x8, x9
	b.hs	LBB0_16
; %bb.10:
	str	x8, [x19, #8]
	mov	x0, x21
	mov	x1, x19
	mov	w2, #0
	bl	_load_sb_block
	str	xzr, [x19, #24]
LBB0_11:
	ldr	x21, [x19, #80]
	cbz	x21, LBB0_16
; %bb.12:
	mov	x0, x21
	bl	_avio_tell
	mov	x22, x0
	ldr	x8, [x19, #72]
	ldr	x9, [x19, #24]
	add	x8, x8, x9, lsl #4
	ldp	x25, x24, [x8]
	mov	x0, x21
	bl	_ffio_read_varlen
	mov	x23, x0
	cbz	x25, LBB0_17
; %bb.13:
Lloh5:
	adrp	x8, _INT_MAX@GOTPAGE
Lloh6:
	ldr	x8, [x8, _INT_MAX@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w23, w8
	b.gt	LBB0_18
; %bb.14:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x23
	bl	_av_get_packet
	tbnz	w0, #31, LBB0_4
; %bb.15:
	ldr	w8, [x19, #56]
	ldr	x9, [x19, #48]
	ldr	x10, [x19, #8]
	add	x9, x9, x10, lsl #4
	ldr	w10, [x9, #8]
	ldp	w12, w11, [x20, #16]
	add	w8, w10, w8
	add	w8, w11, w8
	str	w8, [x20, #20]
	ldr	w9, [x9]
	ldr	x8, [x19, #24]
	add	w9, w9, w8
	str	w9, [x20, #4]
	ldr	x9, [x20, #8]
	ldr	w9, [x9]
Lloh8:
	adrp	x10, _AV_PKT_FLAG_KEY@GOTPAGE
Lloh9:
	ldr	x10, [x10, _AV_PKT_FLAG_KEY@GOTPAGEOFF]
	tst	w9, #0x80
Lloh10:
	ldr	w9, [x10]
	csel	w9, w9, wzr, eq
	orr	w9, w9, w12
	str	w9, [x20, #16]
	str	wzr, [x20]
	b	LBB0_26
LBB0_16:
Lloh11:
	adrp	x8, _EIO@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_AVERROR
LBB0_17:
	mov	x0, x21
	bl	_ffio_read_varlen
Lloh14:
	adrp	x8, _INT_MAX@GOTPAGE
Lloh15:
	ldr	x8, [x8, _INT_MAX@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	cmp	w23, w8
	b.le	LBB0_19
LBB0_18:
Lloh17:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
	b	LBB0_3
LBB0_19:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x23
	bl	_av_get_packet
	tbnz	w0, #31, LBB0_4
; %bb.20:
	add	x22, x24, x22
	ldr	w8, [x19, #56]
	ldr	x9, [x19, #48]
	ldr	x10, [x19, #8]
	add	x9, x9, x10, lsl #4
	ldr	w10, [x9, #8]
	ldp	w12, w11, [x20, #16]
	add	w8, w10, w8
	add	w8, w11, w8
	str	w8, [x20, #20]
	ldr	w8, [x9]
	ldr	w9, [x19, #24]
	add	w8, w8, w9
	str	w8, [x20, #4]
	ldr	x8, [x20, #8]
	ldr	w8, [x8]
Lloh19:
	adrp	x9, _AV_PKT_FLAG_KEY@GOTPAGE
Lloh20:
	ldr	x9, [x9, _AV_PKT_FLAG_KEY@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	tst	w8, #0x80
	csel	w8, w9, wzr, eq
	orr	w8, w8, w12
	str	w8, [x20, #16]
	str	wzr, [x20]
Lloh22:
	adrp	x23, _MAX_AUDIO_SUBPACKETS@GOTPAGE
Lloh23:
	ldr	x23, [x23, _MAX_AUDIO_SUBPACKETS@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, #2
	b.lt	LBB0_25
; %bb.21:
	mov	x24, #0
	mov	x25, #0
	b	LBB0_23
LBB0_22:                                ;   in Loop: Header=BB0_23 Depth=1
	add	x25, x25, #1
	str	w25, [x19, #4]
	ldr	x8, [x19, #64]
	add	x8, x8, x24
	stp	w20, w0, [x8]
	ldrsw	x8, [x23]
	sub	x8, x8, #1
	add	x24, x24, #8
	cmp	x25, x8
	b.ge	LBB0_25
LBB0_23:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	bl	_ffio_read_varlen
	mov	x20, x0
	mov	x0, x21
	bl	_ffio_read_varlen
	cbz	x24, LBB0_22
; %bb.24:                               ;   in Loop: Header=BB0_23 Depth=1
	cbnz	w20, LBB0_22
LBB0_25:
	mov	x0, x21
	bl	_avio_tell
	sub	w8, w22, w0
	ldr	x9, [x19, #64]
	ldrsw	x10, [x19, #4]
	lsl	x10, x10, #3
	str	w8, [x9, x10]
	str	wzr, [x19]
	ldr	x8, [x19, #24]
LBB0_26:
	mov	w0, #0
	add	x8, x8, #1
	str	x8, [x19, #24]
	b	LBB0_4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_EIO,4,2                        ; @EIO
	.comm	_AVERROR_EOF,4,2                ; @AVERROR_EOF
	.comm	_AV_PKT_FLAG_KEY,4,2            ; @AV_PKT_FLAG_KEY
	.comm	_INT_MAX,4,2                    ; @INT_MAX
	.comm	_AVERROR_INVALIDDATA,4,2        ; @AVERROR_INVALIDDATA
	.comm	_MAX_AUDIO_SUBPACKETS,4,2       ; @MAX_AUDIO_SUBPACKETS
	.no_dead_strip	_viv_read_packet
.subsections_via_symbols
