	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ape_read_packet
_ape_read_packet:                       ## @ape_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	8(%rdi), %r12
	movl	(%rdi), %edi
	callq	_avio_feof
	testq	%rax, %rax
	jne	LBB0_1
## %bb.2:
	movq	(%r12), %rax
	cmpq	8(%r12), %rax
	jae	LBB0_1
## %bb.3:
	movl	(%rbx), %edi
	movq	24(%r12), %rcx
	leaq	(%rax,%rax,2), %rax
	movl	16(%rcx,%rax,8), %esi
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_avio_seek
	testq	%rax, %rax
	js	LBB0_4
## %bb.6:
	movq	(%r12), %rcx
	movq	8(%r12), %rdx
	decq	%rdx
	xorl	%eax, %eax
	cmpq	%rdx, %rcx
	setne	%dl
	movq	24(%r12), %rsi
	leaq	(%rcx,%rcx,2), %rcx
	movq	(%rsi,%rcx,8), %rcx
	testq	%rcx, %rcx
	jle	LBB0_8
## %bb.7:
	movq	_INT_MAX@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	addq	$-8, %rsi
	cmpq	%rsi, %rcx
	jle	LBB0_9
LBB0_8:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%rbx, %rdi
	callq	_av_log
	incq	(%r12)
LBB0_4:
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_5:
	movl	(%rax), %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_1:
	movq	_AVERROR_EOF@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_14:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movb	%dl, %al
	movl	16(%r12,%rax,4), %r15d
	addq	$8, %rcx
	movq	%r14, %rdi
	movq	%rcx, %rsi
	callq	_av_new_packet
	testq	%rax, %rax
	js	LBB0_10
## %bb.11:
	movq	(%r14), %rdi
	movl	%r15d, %esi
	callq	_AV_WL32
	movq	(%r14), %rdi
	addq	$4, %rdi
	movq	(%r12), %rax
	movq	24(%r12), %rcx
	leaq	(%rax,%rax,2), %rax
	movl	8(%rcx,%rax,8), %esi
	callq	_AV_WL32
	movl	(%rbx), %edi
	movq	(%r14), %rsi
	addq	$8, %rsi
	movq	(%r12), %rax
	movq	24(%r12), %rcx
	leaq	(%rax,%rax,2), %rax
	movq	(%rcx,%rax,8), %rdx
	callq	_avio_read
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_12
## %bb.13:
	movq	(%r12), %rax
	movq	24(%r12), %rcx
	leaq	(%rax,%rax,2), %rdx
	movl	12(%rcx,%rdx,8), %ecx
	movl	%ecx, 24(%r14)
	movq	$0, 16(%r14)
	movl	%ebx, %ecx
	addq	$8, %rcx
	movq	%rcx, 8(%r14)
	incq	%rax
	movq	%rax, (%r12)
	xorl	%ebx, %ebx
	jmp	LBB0_14
LBB0_10:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_12:
	movq	%r14, %rdi
	callq	_av_packet_unref
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_AVERROR_EOF,4,2                ## @AVERROR_EOF
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.comm	_EIO,4,2                        ## @EIO
	.comm	_INT_MAX,8,3                    ## @INT_MAX
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"invalid packet size: %d\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_ape_read_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ape_read_packet
_ape_read_packet:                       ; @ape_read_packet
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x1
	mov	x20, x0
	ldr	x22, [x0, #8]
	ldr	w0, [x0]
	bl	_avio_feof
	cbnz	x0, LBB0_8
; %bb.1:
	ldp	x8, x9, [x22]
	cmp	x8, x9
	b.hs	LBB0_8
; %bb.2:
	ldr	w0, [x20]
	ldr	x9, [x22, #24]
	mov	w10, #24
	madd	x8, x8, x10, x9
	ldr	w1, [x8, #16]
Lloh0:
	adrp	x8, _SEEK_SET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SEEK_SET@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	bl	_avio_seek
	tbnz	x0, #63, LBB0_6
; %bb.3:
	ldp	x9, x8, [x22]
	sub	x8, x8, #1
	mov	w10, #20
	mov	w11, #16
	cmp	x9, x8
	csel	x8, x11, x10, eq
	ldr	x10, [x22, #24]
	mov	w11, #24
	mul	x9, x9, x11
	ldr	x3, [x10, x9]
	cmp	x3, #1
	b.lt	LBB0_5
; %bb.4:
Lloh3:
	adrp	x9, _INT_MAX@GOTPAGE
Lloh4:
	ldr	x9, [x9, _INT_MAX@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	sub	x9, x9, #8
	cmp	x3, x9
	b.le	LBB0_10
LBB0_5:
Lloh6:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh7:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
Lloh9:
	adrp	x2, l_.str@PAGE
Lloh10:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	bl	_av_log
	ldr	x8, [x22]
	add	x8, x8, #1
	str	x8, [x22]
LBB0_6:
Lloh11:
	adrp	x8, _EIO@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_7:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_AVERROR
LBB0_8:
Lloh13:
	adrp	x8, _AVERROR_EOF@GOTPAGE
Lloh14:
	ldr	x8, [x8, _AVERROR_EOF@GOTPAGEOFF]
Lloh15:
	ldr	w20, [x8]
LBB0_9:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_10:
	ldr	w21, [x22, x8]
	add	x1, x3, #8
	mov	x0, x19
	bl	_av_new_packet
	tbnz	x0, #63, LBB0_13
; %bb.11:
	ldr	x0, [x19]
	mov	x1, x21
	bl	_AV_WL32
	ldr	x8, [x19]
	add	x0, x8, #4
	ldr	x8, [x22, #24]
	ldr	x9, [x22]
	mov	w21, #24
	madd	x8, x9, x21, x8
	ldr	w1, [x8, #8]
	bl	_AV_WL32
	ldr	w0, [x20]
	ldr	x8, [x19]
	add	x1, x8, #8
	ldr	x8, [x22, #24]
	ldr	x9, [x22]
	mul	x9, x9, x21
	ldr	x2, [x8, x9]
	bl	_avio_read
	mov	x20, x0
	tbnz	w0, #31, LBB0_14
; %bb.12:
	ldr	x8, [x22, #24]
	ldr	x9, [x22]
	mov	w10, #24
	madd	x8, x9, x10, x8
	ldr	w8, [x8, #12]
	str	w8, [x19, #24]
	mov	w8, w20
	add	x8, x8, #8
	stp	x8, xzr, [x19, #8]
	add	x8, x9, #1
	str	x8, [x22]
	mov	w20, #0
	b	LBB0_9
LBB0_13:
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_7
LBB0_14:
	mov	x0, x19
	bl	_av_packet_unref
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_AVERROR_EOF,4,2                ; @AVERROR_EOF
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.comm	_EIO,4,2                        ; @EIO
	.comm	_INT_MAX,8,3                    ; @INT_MAX
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"invalid packet size: %d\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_ape_read_packet
.subsections_via_symbols
