	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function avisynth_read_packet_audio
_avisynth_read_packet_audio:            ## @avisynth_read_packet_audio
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	(%rdi), %r15
	movq	(%r15), %rax
	movq	32(%r15), %rdi
	cmpq	(%rdi), %rax
	jge	LBB0_1
## %bb.2:
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movl	32(%rdi), %r14d
	movl	8(%rdi), %r13d
	movl	28(%rdi), %ebx
	callq	_avs_has_video
	testq	%rax, %rax
	je	LBB0_3
## %bb.8:
	movq	8(%r15), %rdi
	movq	32(%r15), %rax
	cmpq	16(%rax), %rdi
	jge	LBB0_10
## %bb.9:
	shlq	$32, %rbx
	orq	$1, %rbx
	shlq	$32, %r14
	orq	%r13, %r14
                                        ## kill: def $edi killed $edi killed $rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_av_rescale_q
	subl	(%r15), %eax
	testl	%eax, %eax
	jg	LBB0_4
	jmp	LBB0_12
LBB0_1:
	movq	_AVERROR_EOF@GOTPCREL(%rip), %rax
LBB0_16:
	movl	(%rax), %ebx
	jmp	LBB0_17
LBB0_3:
	movl	$1000, %eax                     ## imm = 0x3E8
	jmp	LBB0_4
LBB0_10:
	shlq	$32, %rbx
	orq	$1, %rbx
	shlq	$32, %r14
	orq	%r13, %r14
	movl	$1, %edi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_av_rescale_q
	testl	%eax, %eax
	jle	LBB0_12
LBB0_4:
	movq	(%r15), %r13
	movq	32(%r15), %rdi
	movl	%eax, %ecx
	addq	%r13, %rcx
	movq	(%rdi), %rdx
	movl	%edx, %r14d
	subl	%r13d, %r14d
	cmpq	%rdx, %rcx
	cmovlel	%eax, %r14d
	movslq	%r14d, %rax
	addq	%r13, %rax
	movq	%rax, (%r15)
	xorl	%ebx, %ebx
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_17
## %bb.5:
	callq	_avs_bytes_per_channel_sample
	imull	%r14d, %eax
	movq	32(%r15), %rcx
	imull	24(%rcx), %eax
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, (%rdi)
	testl	%eax, %eax
	je	LBB0_15
## %bb.6:
	movl	%eax, %esi
	callq	_av_new_packet
	testq	%rax, %rax
	js	LBB0_7
## %bb.13:
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%r13, 32(%rcx)
	movq	%r13, 24(%rcx)
	movl	%r14d, 4(%rcx)
	movl	24(%r15), %eax
	movl	%eax, 16(%rcx)
	movq	_avs_library@GOTPCREL(%rip), %rax
	movl	20(%r15), %edi
	movq	8(%rcx), %rsi
	movq	%r13, %rdx
	movl	%r14d, %ecx
	movq	%rax, %r14
	callq	*8(%rax)
	movl	20(%r15), %edi
	callq	*(%r14)
	testq	%rax, %rax
	je	LBB0_17
## %bb.14:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r12, %rdi
	movq	%rax, %rcx
	callq	_av_log
	movl	$1, 16(%r15)
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_av_packet_unref
LBB0_15:
	movq	_AVERROR_UNKNOWN@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_12:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	$0, (%rax)
	movq	$0, 8(%rax)
	xorl	%ebx, %ebx
LBB0_17:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_AVERROR_EOF,4,2                ## @AVERROR_EOF
	.comm	_AVERROR_UNKNOWN,4,2            ## @AVERROR_UNKNOWN
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_avs_library,16,3               ## @avs_library
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s\n"

	.no_dead_strip	_avisynth_read_packet_audio
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function avisynth_read_packet_audio
_avisynth_read_packet_audio:            ; @avisynth_read_packet_audio
	.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	x20, x0
	ldr	x24, [x0]
	ldr	x8, [x24]
	ldr	x0, [x24, #32]
	ldr	x9, [x0]
	cmp	x8, x9
	b.ge	LBB0_4
; %bb.1:
	mov	x21, x2
	mov	x19, x1
	ldr	w22, [x0, #8]
	ldp	w25, w23, [x0, #28]
	bl	_avs_has_video
	cbz	x0, LBB0_6
; %bb.2:
	ldr	x0, [x24, #8]
	ldr	x8, [x24, #32]
	ldr	x8, [x8, #16]
	mov	w1, #1
	bfi	x1, x25, #32, #32
	bfi	x22, x23, #32, #32
	cmp	x0, x8
	b.ge	LBB0_7
; %bb.3:
                                        ; kill: def $w0 killed $w0 killed $x0
	mov	x2, x22
	bl	_av_rescale_q
	ldr	w8, [x24]
	sub	w0, w0, w8
	cmp	w0, #0
	b.gt	LBB0_8
	b	LBB0_15
LBB0_4:
Lloh0:
	adrp	x8, _AVERROR_EOF@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AVERROR_EOF@GOTPAGEOFF]
LBB0_5:
	ldr	w0, [x8]
	b	LBB0_16
LBB0_6:
	mov	w0, #1000
	b	LBB0_8
LBB0_7:
	mov	w0, #1
	mov	x2, x22
	bl	_av_rescale_q
	cmp	w0, #0
	b.le	LBB0_15
LBB0_8:
	ldr	x22, [x24]
	add	x9, x22, w0, uxtw
	ldr	x8, [x24, #32]
	ldr	x10, [x8]
	sub	w11, w10, w22
	cmp	x9, x10
	csel	w23, w11, w0, gt
	add	x9, x22, w23, sxtw
	str	x9, [x24]
	cbz	w21, LBB0_10
; %bb.9:
	mov	w0, #0
	b	LBB0_16
LBB0_10:
	mov	x0, x8
	bl	_avs_bytes_per_channel_sample
	mul	w8, w0, w23
	ldr	x9, [x24, #32]
	ldr	w9, [x9, #24]
	mul	w1, w8, w9
	str	w1, [x19]
	cbz	w1, LBB0_14
; %bb.11:
	mov	x0, x19
	bl	_av_new_packet
	tbnz	x0, #63, LBB0_17
; %bb.12:
	stp	x22, x22, [x19, #24]
	str	w23, [x19, #4]
	ldp	w0, w8, [x24, #20]
	str	w8, [x19, #16]
Lloh2:
	adrp	x21, _avs_library@GOTPAGE
Lloh3:
	ldr	x21, [x21, _avs_library@GOTPAGEOFF]
	ldr	x8, [x21, #8]
	ldr	x1, [x19, #8]
	mov	x2, x22
	mov	x3, x23
	blr	x8
	ldr	x8, [x21]
	ldr	w0, [x24, #20]
	blr	x8
	cbz	x0, LBB0_16
; %bb.13:
	mov	x3, x0
Lloh4:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
Lloh7:
	adrp	x2, l_.str@PAGE
Lloh8:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	bl	_av_log
	mov	w8, #1
	str	w8, [x24, #16]
	mov	x0, x19
	bl	_av_packet_unref
LBB0_14:
Lloh9:
	adrp	x8, _AVERROR_UNKNOWN@GOTPAGE
Lloh10:
	ldr	x8, [x8, _AVERROR_UNKNOWN@GOTPAGEOFF]
	b	LBB0_5
LBB0_15:
	mov	w0, #0
	str	wzr, [x19]
	str	xzr, [x19, #8]
LBB0_16:
	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_17:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_AVERROR_EOF,4,2                ; @AVERROR_EOF
	.comm	_AVERROR_UNKNOWN,4,2            ; @AVERROR_UNKNOWN
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_avs_library,16,3               ; @avs_library
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s\n"

	.no_dead_strip	_avisynth_read_packet_audio
.subsections_via_symbols
