	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vaapi_encode_add_ref
_vaapi_encode_add_ref:                  ## @vaapi_encode_add_ref
	.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
	movl	%r9d, %r15d
	movl	%r8d, %r12d
	movq	%rdx, %r14
	movq	%rsi, %rbx
	testl	%ecx, %ecx
	je	LBB0_1
## %bb.2:
	xorl	%edi, %edi
	cmpq	%r14, %rbx
	setne	%dil
	callq	_av_assert0
	movq	(%rbx), %rax
	movq	_MAX_PICTURE_REFERENCES@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setl	%dil
	callq	_av_assert0
	movq	(%rbx), %rax
	movq	40(%rbx), %rcx
	leaq	1(%rax), %rdx
	movq	%rdx, (%rbx)
	movq	%r14, (%rcx,%rax,8)
	movl	$1, %r13d
	testl	%r12d, %r12d
	je	LBB0_5
LBB0_4:
	movq	8(%rbx), %rax
	movq	_MAX_DPB_SIZE@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setl	%dil
	callq	_av_assert0
	movq	8(%rbx), %rax
	movq	32(%rbx), %rcx
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rbx)
	movq	%r14, (%rcx,%rax,8)
	incl	%r13d
LBB0_5:
	testl	%r15d, %r15d
	je	LBB0_7
## %bb.6:
	xorl	%edi, %edi
	cmpq	$0, 24(%rbx)
	sete	%dil
	callq	_av_assert0
	movq	%r14, 24(%rbx)
	incl	%r13d
LBB0_7:
	movq	16(%r14), %rax
	addl	%r13d, (%rax)
	addl	%r13d, 4(%rax)
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	xorl	%r13d, %r13d
	testl	%r12d, %r12d
	jne	LBB0_4
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_PICTURE_REFERENCES,8,3     ## @MAX_PICTURE_REFERENCES
	.comm	_MAX_DPB_SIZE,8,3               ## @MAX_DPB_SIZE
	.no_dead_strip	_vaapi_encode_add_ref
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vaapi_encode_add_ref
_vaapi_encode_add_ref:                  ; @vaapi_encode_add_ref
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x5
	mov	x22, x4
	mov	x19, x2
	mov	x20, x1
	cbz	w3, LBB0_6
; %bb.1:
	cmp	x20, x19
	cset	w0, ne
	bl	_av_assert0
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _MAX_PICTURE_REFERENCES@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MAX_PICTURE_REFERENCES@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, lt
	bl	_av_assert0
	ldr	x8, [x20, #40]
	ldr	x9, [x20]
	add	x10, x9, #1
	str	x10, [x20]
	str	x19, [x8, x9, lsl #3]
	mov	w23, #1
	cbz	w22, LBB0_3
LBB0_2:
	ldr	x8, [x20, #8]
Lloh3:
	adrp	x9, _MAX_DPB_SIZE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MAX_DPB_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, lt
	bl	_av_assert0
	ldr	x8, [x20, #32]
	ldr	x9, [x20, #8]
	add	x10, x9, #1
	str	x10, [x20, #8]
	str	x19, [x8, x9, lsl #3]
	add	w23, w23, #1
LBB0_3:
	cbz	w21, LBB0_5
; %bb.4:
	ldr	x8, [x20, #24]
	cmp	x8, #0
	cset	w0, eq
	bl	_av_assert0
	str	x19, [x20, #24]
	add	w23, w23, #1
LBB0_5:
	ldr	x8, [x19, #16]
	ldr	d0, [x8]
	dup.2s	v1, w23
	add.2s	v0, v0, v1
	str	d0, [x8]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_6:
	mov	w23, #0
	cbnz	w22, LBB0_2
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_PICTURE_REFERENCES,8,3     ; @MAX_PICTURE_REFERENCES
	.comm	_MAX_DPB_SIZE,8,3               ; @MAX_DPB_SIZE
	.no_dead_strip	_vaapi_encode_add_ref
.subsections_via_symbols
