	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fill_buffer
_fill_buffer:                           ## @fill_buffer
	.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	%rdi, %rbx
	movl	(%rdi), %ecx
	testl	%ecx, %ecx
	jne	LBB0_2
## %bb.1:
	movq	_IO_BUFFER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
LBB0_2:
	movq	32(%rbx), %rdx
	movq	48(%rbx), %rax
	movq	%rdx, %rsi
	subq	%rax, %rsi
	sarq	$2, %rsi
	movslq	%ecx, %rcx
	addq	%rsi, %rcx
	movslq	4(%rbx), %r15
	cmpq	%r15, %rcx
	movq	%rax, %r14
	cmovlq	%rdx, %r14
	movq	64(%rbx), %rcx
	testq	%rcx, %rcx
	jne	LBB0_5
## %bb.3:
	cmpq	%rdx, 40(%rbx)
	jb	LBB0_5
## %bb.4:
	movl	$1, 8(%rbx)
LBB0_5:
	cmpl	$0, 8(%rbx)
	jne	LBB0_27
## %bb.6:
	movq	%r14, %r12
	subq	%rax, %r12
	shrq	$2, %r12
	movq	80(%rbx), %r8
	testq	%r8, %r8
	je	LBB0_11
## %bb.7:
	cmpq	%rax, %r14
	jne	LBB0_11
## %bb.8:
	movq	56(%rbx), %rsi
	subq	%rsi, %rdx
	jbe	LBB0_10
## %bb.9:
	movl	72(%rbx), %edi
	shrq	$2, %rdx
                                        ## kill: def $edx killed $edx killed $rdx
	callq	*%r8
	movl	%eax, 72(%rbx)
	movq	48(%rbx), %rax
	movq	64(%rbx), %rcx
LBB0_10:
	movq	%rax, 56(%rbx)
LBB0_11:
	subl	%r12d, %r15d
	testq	%rcx, %rcx
	je	LBB0_22
## %bb.12:
	movl	12(%rbx), %esi
	testl	%esi, %esi
	je	LBB0_22
## %bb.13:
	cmpl	%esi, 4(%rbx)
	jle	LBB0_22
## %bb.14:
	cmpl	%esi, %r15d
	jl	LBB0_22
## %bb.15:
	cmpq	%rax, %r14
	je	LBB0_17
LBB0_21:
	movl	%esi, %r15d
	jmp	LBB0_22
LBB0_17:
	cmpq	%r14, 40(%rbx)
	je	LBB0_21
## %bb.18:
	movq	%rbx, %rdi
	callq	_ffio_set_buf_size
	testl	%eax, %eax
	jns	LBB0_20
## %bb.19:
	movq	_AV_LOG_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%rbx, %rdi
	callq	_av_log
LBB0_20:
	movq	48(%rbx), %r14
	movq	%r14, 56(%rbx)
	movl	12(%rbx), %r15d
LBB0_22:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	%r15d, %edx
	callq	_read_packet_wrapper
	movq	_AVERROR_EOF@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_24
## %bb.23:
	movl	$1, 8(%rbx)
	jmp	LBB0_27
LBB0_24:
	testl	%eax, %eax
	js	LBB0_26
## %bb.25:
	addl	%eax, 20(%rbx)
	movq	%r14, 40(%rbx)
	movl	%eax, %ecx
	leaq	(%r14,%rcx,4), %rcx
	movq	%rcx, 32(%rbx)
	addl	%eax, 24(%rbx)
	jmp	LBB0_27
LBB0_26:
	movl	$1, 8(%rbx)
	movl	%eax, 16(%rbx)
LBB0_27:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IO_BUFFER_SIZE,4,2             ## @IO_BUFFER_SIZE
	.comm	_AV_LOG_WARNING,4,2             ## @AV_LOG_WARNING
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to decrease buffer size\n"

	.comm	_AVERROR_EOF,4,2                ## @AVERROR_EOF
	.no_dead_strip	_fill_buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fill_buffer
_fill_buffer:                           ; @fill_buffer
	.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, x0
Lloh0:
	adrp	x8, _IO_BUFFER_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IO_BUFFER_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldp	w9, w11, [x0]
                                        ; kill: def $w11 killed $w11 def $x11
	sxtw	x11, w11
	cmp	w9, #0
	csel	w9, w8, w9, eq
	ldr	x10, [x0, #32]
	ldr	x8, [x0, #48]
	sub	x12, x10, x8
	asr	x12, x12, #2
	add	x9, x12, w9, sxtw
	cmp	x9, x11
	csel	x20, x10, x8, lt
	ldr	x9, [x0, #64]
	cbnz	x9, LBB0_3
; %bb.1:
	ldr	x12, [x19, #40]
	cmp	x12, x10
	b.lo	LBB0_3
; %bb.2:
	mov	w12, #1
	str	w12, [x19, #8]
LBB0_3:
	ldr	w12, [x19, #8]
	cbnz	w12, LBB0_24
; %bb.4:
	sub	x12, x20, x8
	lsr	x12, x12, #2
	sub	w21, w11, w12
	ldr	x11, [x19, #80]
	cbz	x11, LBB0_9
; %bb.5:
	cmp	x20, x8
	b.ne	LBB0_9
; %bb.6:
	ldr	x1, [x19, #56]
	subs	x10, x10, x1
	b.ls	LBB0_8
; %bb.7:
	ldr	w0, [x19, #72]
	lsr	x2, x10, #2
                                        ; kill: def $w2 killed $w2 killed $x2
	blr	x11
	str	w0, [x19, #72]
	ldr	x8, [x19, #48]
	ldr	x9, [x19, #64]
LBB0_8:
	str	x8, [x19, #56]
LBB0_9:
	cbz	x9, LBB0_19
; %bb.10:
	ldr	w1, [x19, #12]
	cbz	w1, LBB0_19
; %bb.11:
	ldr	w9, [x19, #4]
	cmp	w9, w1
	b.le	LBB0_19
; %bb.12:
	cmp	w21, w1
	b.lt	LBB0_19
; %bb.13:
	cmp	x20, x8
	b.eq	LBB0_15
LBB0_14:
	mov	x21, x1
	b	LBB0_19
LBB0_15:
	ldr	x8, [x19, #40]
	cmp	x8, x20
	b.eq	LBB0_14
; %bb.16:
	mov	x0, x19
	bl	_ffio_set_buf_size
	tbz	w0, #31, LBB0_18
; %bb.17:
Lloh3:
	adrp	x8, _AV_LOG_WARNING@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AV_LOG_WARNING@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x2, l_.str@PAGE
Lloh7:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_av_log
LBB0_18:
	ldr	x20, [x19, #48]
	str	x20, [x19, #56]
	ldr	w21, [x19, #12]
LBB0_19:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_read_packet_wrapper
Lloh8:
	adrp	x8, _AVERROR_EOF@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AVERROR_EOF@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_21
; %bb.20:
	mov	w8, #1
	str	w8, [x19, #8]
	b	LBB0_24
LBB0_21:
	tbnz	w0, #31, LBB0_23
; %bb.22:
	add	x8, x20, w0, uxtw #2
	stp	x8, x20, [x19, #32]
	ldur	d0, [x19, #20]
	dup.2s	v1, w0
	add.2s	v0, v0, v1
	stur	d0, [x19, #20]
	b	LBB0_24
LBB0_23:
	mov	w8, #1
	str	w8, [x19, #8]
	str	w0, [x19, #16]
LBB0_24:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_IO_BUFFER_SIZE,4,2             ; @IO_BUFFER_SIZE
	.comm	_AV_LOG_WARNING,4,2             ; @AV_LOG_WARNING
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to decrease buffer size\n"

	.comm	_AVERROR_EOF,4,2                ; @AVERROR_EOF
	.no_dead_strip	_fill_buffer
.subsections_via_symbols
