	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ff_mpv_reallocate_putbitbuffer ## -- Begin function ff_mpv_reallocate_putbitbuffer
	.p2align	4, 0x90
_ff_mpv_reallocate_putbitbuffer:        ## @ff_mpv_reallocate_putbitbuffer
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r14
	movq	%rdi, %r13
	leaq	12(%rdi), %r15
	movl	12(%rdi), %ebx
	movl	16(%rdi), %r12d
	movq	%r15, %rdi
	callq	_put_bits_count
	sarl	$3, %eax
	addl	%r12d, %eax
	subl	%eax, %ebx
	movslq	%ebx, %rax
	cmpq	%r14, %rax
	jae	LBB0_6
## %bb.1:
	cmpl	$1, (%r13)
	jne	LBB0_6
## %bb.2:
	movslq	16(%r13), %rbx
	movq	24(%r13), %rdi
	movq	(%rdi), %rax
	cmpq	%rbx, (%rax)
	jne	LBB0_6
## %bb.3:
	movl	4(%r13), %r12d
	movl	8(%r13), %r8d
	movq	$0, -56(%rbp)
	movl	$0, -44(%rbp)
	movq	(%rdi), %rax
	movq	8(%rax), %rax
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	addq	%rsi, %rax
	movq	_INT_MAX@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	leal	7(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$3, %edx
	movslq	%edx, %rcx
	cmpq	%rcx, %rax
	jae	LBB0_10
## %bb.4:
	movl	%r8d, -64(%rbp)                 ## 4-byte Spill
	movl	%r12d, -60(%rbp)                ## 4-byte Spill
	xorl	%eax, %eax
	movq	%rsi, %r12
	callq	_emms_c
	movq	24(%r13), %rax
	movq	(%rax), %rax
	addq	8(%rax), %r12
	leaq	-56(%rbp), %rdi
	leaq	-44(%rbp), %rsi
	movq	%r12, %rdx
	callq	_av_fast_padded_malloc
	movq	-56(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_11
## %bb.5:
	movl	-60(%rbp), %r12d                ## 4-byte Reload
	subl	%ebx, %r12d
	movl	-64(%rbp), %eax                 ## 4-byte Reload
	subl	%ebx, %eax
	movl	%eax, %ebx
	movq	24(%r13), %rax
	movq	(%rax), %rax
	movq	(%rax), %rsi
	movq	8(%rax), %rdx
	callq	_memcpy
	movq	24(%r13), %rax
	movq	(%rax), %rax
	movq	(%rax), %rdi
	callq	_av_free
	movq	-56(%rbp), %rsi
	movq	24(%r13), %rax
	movq	(%rax), %rax
	movq	%rsi, (%rax)
	movslq	-44(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	%r15, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_rebase_put_bits
	movl	16(%r13), %eax
	addl	%eax, %r12d
	movl	%r12d, 4(%r13)
	movl	%ebx, %ecx
	addl	%eax, %ecx
	movl	%ecx, 8(%r13)
LBB0_6:
	movl	12(%r13), %ebx
	movl	16(%r13), %r12d
	movq	%r15, %rdi
	callq	_put_bits_count
	sarl	$3, %eax
	addl	%r12d, %eax
	subl	%eax, %ebx
	movslq	%ebx, %rcx
	xorl	%eax, %eax
	cmpq	%r14, %rcx
	jae	LBB0_9
## %bb.7:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %edi
	callq	_AVERROR
LBB0_9:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	callq	_av_log
LBB0_11:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_INT_MAX,4,2                    ## @INT_MAX
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot reallocate putbit buffer\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ff_mpv_reallocate_putbitbuffer ; -- Begin function ff_mpv_reallocate_putbitbuffer
	.p2align	2
_ff_mpv_reallocate_putbitbuffer:        ; @ff_mpv_reallocate_putbitbuffer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	d9, d8, [sp, #16]               ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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 b8, -72
	.cfi_offset b9, -80
	mov	x22, x2
	mov	x19, x1
	mov	x21, x0
	mov	x20, x0
	ldp	w23, w24, [x20, #12]!
	mov	x0, x20
	bl	_put_bits_count
	add	w8, w24, w0, asr #3
	sub	w8, w23, w8
	sxtw	x8, w8
	cmp	x8, x19
	b.hs	LBB0_6
; %bb.1:
	ldr	w8, [x21]
	cmp	w8, #1
	b.ne	LBB0_6
; %bb.2:
	ldrsw	x23, [x21, #16]
	ldr	x0, [x21, #24]
	ldr	x8, [x0]
	ldr	x8, [x8]
	cmp	x8, x23
	b.ne	LBB0_6
; %bb.3:
	ldur	d8, [x21, #4]
	str	xzr, [sp, #8]
	str	wzr, [sp, #4]
	ldr	x8, [x0]
	ldr	x8, [x8, #8]
	add	x8, x8, x22
Lloh0:
	adrp	x9, _INT_MAX@GOTPAGE
Lloh1:
	ldr	x9, [x9, _INT_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	add	w10, w9, #7
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w9, w9, #3
	cmp	x8, w9, sxtw
	b.hs	LBB0_11
; %bb.4:
	bl	_emms_c
	ldr	x8, [x21, #24]
	ldr	x8, [x8]
	ldr	x8, [x8, #8]
	add	x2, x8, x22
	add	x0, sp, #8
	add	x1, sp, #4
	bl	_av_fast_padded_malloc
	ldr	x0, [sp, #8]
	cbz	x0, LBB0_12
; %bb.5:
	dup.2s	v0, w23
	sub.2s	v8, v8, v0
	ldr	x8, [x21, #24]
	ldr	x8, [x8]
	ldp	x1, x2, [x8]
	bl	_memcpy
	ldr	x8, [x21, #24]
	ldr	x8, [x8]
	ldr	x0, [x8]
	bl	_av_free
	ldr	x1, [sp, #8]
	ldr	x8, [x21, #24]
	ldr	x8, [x8]
	ldrsw	x2, [sp, #4]
	stp	x1, x2, [x8]
	mov	x0, x20
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_rebase_put_bits
	add	x8, x21, #16
	ld1r.2s	{ v0 }, [x8]
	add.2s	v0, v8, v0
	stur	d0, [x21, #4]
LBB0_6:
	ldp	w22, w21, [x21, #12]
	mov	x0, x20
	bl	_put_bits_count
	add	w8, w21, w0, asr #3
	sub	w8, w22, w8
	sxtw	x8, w8
	cmp	x8, x19
	b.hs	LBB0_9
; %bb.7:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_8:
	ldr	w0, [x8]
	bl	_AVERROR
	b	LBB0_10
LBB0_9:
	mov	w0, #0
LBB0_10:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp, #16]               ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_11:
Lloh5:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	adrp	x2, l_.str@PAGE
Lloh9:
	add	x2, x2, l_.str@PAGEOFF
	bl	_av_log
LBB0_12:
Lloh10:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_INT_MAX,4,2                    ; @INT_MAX
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot reallocate putbit buffer\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
