	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vaapi_pool_alloc
_vaapi_pool_alloc:                      ## @vaapi_pool_alloc
	.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
	movq	%rdi, %rbx
	movq	32(%rdi), %rax
	movq	(%rax), %rax
	movq	16(%rdi), %r12
	movq	24(%rdi), %rcx
	movq	(%rcx), %r13
	movq	(%rdi), %rcx
	testq	%rcx, %rcx
	jle	LBB0_2
## %bb.1:
	cmpq	%rcx, (%r12)
	jge	LBB0_9
LBB0_2:
	movl	(%r13), %edi
	movl	8(%rax), %esi
	movl	8(%rbx), %ecx
	movl	12(%rbx), %edx
	movl	(%rax), %r10d
	movl	4(%rax), %eax
	leaq	-48(%rbp), %r8
	movl	$1, %r9d
	pushq	%r10
	pushq	%rax
	callq	_vaCreateSurfaces
	addq	$16, %rsp
	movq	%rax, %r15
	movq	_VA_STATUS_SUCCESS@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r15
	jne	LBB0_6
## %bb.3:
	movq	_AV_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-48(%rbp), %rcx
	leaq	L_.str.1(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_av_log
	movq	-48(%rbp), %rdi
	movq	_AV_BUFFER_FLAG_READONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	_vaapi_buffer_free@GOTPCREL(%rip), %rdx
	movl	$8, %esi
	movq	%rbx, %rcx
	callq	_av_buffer_create
	testq	%rax, %rax
	je	LBB0_8
## %bb.4:
	movq	%rax, %r14
	movq	(%rbx), %rax
	testq	%rax, %rax
	jle	LBB0_10
## %bb.5:
	xorl	%edi, %edi
	cmpq	%rax, (%r12)
	setl	%dil
	callq	_av_assert0
	movq	-48(%rbp), %rax
	movq	(%r12), %rcx
	movq	8(%r12), %rdx
	movq	%rax, (%rdx,%rcx,8)
	incq	(%r12)
	jmp	LBB0_10
LBB0_6:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	%r15, %rdi
	callq	_vaErrorStr
	leaq	L_.str(%rip), %rdx
	xorl	%r14d, %r14d
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movq	%r15, %rcx
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_av_log
	jmp	LBB0_10
LBB0_8:
	movl	(%r13), %edi
	leaq	-48(%rbp), %rsi
	movl	$1, %edx
	callq	_vaDestroySurfaces
LBB0_9:
	xorl	%r14d, %r14d
LBB0_10:
	movq	%r14, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_VA_STATUS_SUCCESS,8,3          ## @VA_STATUS_SUCCESS
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to create surface: %d (%s).\n"

	.comm	_AV_LOG_DEBUG,4,2               ## @AV_LOG_DEBUG
L_.str.1:                               ## @.str.1
	.asciz	"Created surface %#x.\n"

	.comm	_vaapi_buffer_free,4,2          ## @vaapi_buffer_free
	.comm	_AV_BUFFER_FLAG_READONLY,4,2    ## @AV_BUFFER_FLAG_READONLY
	.no_dead_strip	_vaapi_pool_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vaapi_pool_alloc
_vaapi_pool_alloc:                      ; @vaapi_pool_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	ldp	x9, x8, [x0, #24]
	ldr	x8, [x8]
	ldr	x21, [x0, #16]
	ldr	x22, [x9]
	ldr	x9, [x0]
	cmp	x9, #1
	b.lt	LBB0_2
; %bb.1:
	ldr	x10, [x21]
	cmp	x10, x9
	b.ge	LBB0_7
LBB0_2:
	ldr	w0, [x22]
	ldp	w6, w1, [x8, #4]
	ldp	w3, w2, [x19, #8]
	ldr	w7, [x8]
	add	x4, sp, #8
	mov	w5, #1
	bl	_vaCreateSurfaces
Lloh0:
	adrp	x8, _VA_STATUS_SUCCESS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VA_STATUS_SUCCESS@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_6
; %bb.3:
Lloh3:
	adrp	x8, _AV_LOG_DEBUG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AV_LOG_DEBUG@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	ldr	x3, [sp, #8]
Lloh6:
	adrp	x2, l_.str.1@PAGE
Lloh7:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_av_log
	ldr	x0, [sp, #8]
Lloh8:
	adrp	x8, _AV_BUFFER_FLAG_READONLY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AV_BUFFER_FLAG_READONLY@GOTPAGEOFF]
Lloh10:
	ldr	w4, [x8]
Lloh11:
	adrp	x2, _vaapi_buffer_free@GOTPAGE
Lloh12:
	ldr	x2, [x2, _vaapi_buffer_free@GOTPAGEOFF]
	mov	w1, #8
	mov	x3, x19
	bl	_av_buffer_create
	mov	x20, x0
	cbz	x0, LBB0_9
; %bb.4:
	ldr	x8, [x19]
	cmp	x8, #1
	b.lt	LBB0_8
; %bb.5:
	ldr	x9, [x21]
	cmp	x9, x8
	cset	w0, lt
	bl	_av_assert0
	ldr	x8, [sp, #8]
	ldp	x10, x9, [x21]
	str	x8, [x9, x10, lsl #3]
	ldr	x8, [x21]
	add	x8, x8, #1
	str	x8, [x21]
	b	LBB0_8
LBB0_6:
	mov	x20, x0
Lloh13:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh14:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh15:
	ldr	w21, [x8]
	bl	_vaErrorStr
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh16:
	adrp	x2, l_.str@PAGE
Lloh17:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	mov	x1, x21
	mov	x3, x20
	bl	_av_log
LBB0_7:
	mov	x20, #0
LBB0_8:
	mov	x0, x20
	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
	add	sp, sp, #64
	ret
LBB0_9:
	ldr	w0, [x22]
	add	x1, sp, #8
	mov	w2, #1
	bl	_vaDestroySurfaces
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_VA_STATUS_SUCCESS,8,3          ; @VA_STATUS_SUCCESS
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to create surface: %d (%s).\n"

	.comm	_AV_LOG_DEBUG,4,2               ; @AV_LOG_DEBUG
l_.str.1:                               ; @.str.1
	.asciz	"Created surface %#x.\n"

	.comm	_vaapi_buffer_free,4,2          ; @vaapi_buffer_free
	.comm	_AV_BUFFER_FLAG_READONLY,4,2    ; @AV_BUFFER_FLAG_READONLY
	.no_dead_strip	_vaapi_pool_alloc
.subsections_via_symbols
