	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qsv_frame_alloc
_qsv_frame_alloc:                       ## @qsv_frame_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
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movl	(%rsi), %eax
	movq	_MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET@GOTPCREL(%rip), %rcx
	movq	_MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	testl	%eax, %edx
	je	LBB0_16
## %bb.1:
	movq	_MFX_MEMTYPE_FROM_DECODE@GOTPCREL(%rip), %rcx
	movq	_MFX_MEMTYPE_FROM_ENCODE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	testl	%eax, %edx
	je	LBB0_16
## %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	_MFX_MEMTYPE_EXTERNAL_FRAME@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_10
## %bb.3:
	movq	8(%r15), %rsi
	movq	(%rsi), %rax
	movq	32(%rax), %rax
	movq	8(%rax), %rdx
	movq	8(%rbx), %rcx
	movq	16(%rbx), %r8
	movq	(%rdx), %rax
	movq	8(%rdx), %r10
	cmpq	%rax, %rcx
	jg	LBB0_9
## %bb.4:
	cmpq	%r10, %r8
	jg	LBB0_9
## %bb.5:
	movq	24(%rbx), %rdi
	cmpq	16(%rdx), %rdi
	jne	LBB0_9
## %bb.6:
	movq	32(%rbx), %rdi
	cmpq	24(%rdx), %rdi
	jne	LBB0_9
## %bb.7:
	movq	16(%r15), %rdx
	movq	%r14, %rdi
	callq	_qsv_setup_mids
	testl	%eax, %eax
	jns	LBB0_15
## %bb.8:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	jmp	LBB0_21
LBB0_9:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	movq	24(%rbx), %r9
	movq	32(%rbx), %rbx
	movups	16(%rdx), %xmm0
	movups	%xmm0, 24(%rsp)
	movq	%r10, 16(%rsp)
	movq	%rax, 8(%rsp)
	movq	%rbx, (%rsp)
	leaq	L_.str(%rip), %rdx
	xorl	%eax, %eax
	callq	_av_log
	jmp	LBB0_16
LBB0_10:
	movq	_MFX_MEMTYPE_INTERNAL_FRAME@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_16
## %bb.11:
	movq	8(%r15), %rax
	movq	(%rax), %rax
	movl	40(%rax), %edi
	callq	_av_hwframe_ctx_alloc
	movq	%rax, -48(%rbp)
	testq	%rax, %rax
	je	LBB0_22
## %bb.12:
	movq	%rax, %r12
	movq	(%rax), %r13
	movq	32(%r13), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_AV_PIX_FMT_QSV@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r13)
	movq	24(%rbx), %rdi
	callq	_ff_qsv_map_fourcc
	movl	%eax, 20(%r13)
	movups	8(%rbx), %xmm0
	movups	%xmm0, (%r13)
	movl	4(%rbx), %eax
	movl	%eax, 16(%r13)
	movl	(%rbx), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	movq	%r12, %rdi
	callq	_av_hwframe_ctx_init
	testl	%eax, %eax
	js	LBB0_18
## %bb.13:
	movq	%r12, %rdi
	callq	_qsv_create_mids
	movq	%rax, -64(%rbp)
	testq	%rax, %rax
	je	LBB0_19
## %bb.14:
	movq	%r14, %rdi
	movq	%r12, %rsi
	movq	%rax, %rdx
	callq	_qsv_setup_mids
	movl	%eax, %ebx
	leaq	-64(%rbp), %rdi
	callq	_av_buffer_unref
	leaq	-48(%rbp), %rdi
	callq	_av_buffer_unref
	testl	%ebx, %ebx
	js	LBB0_20
LBB0_15:
	movq	_MFX_ERR_NONE@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_16:
	movq	_MFX_ERR_UNSUPPORTED@GOTPCREL(%rip), %rax
LBB0_17:
	movl	(%rax), %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdx
	xorl	%eax, %eax
	callq	_av_log
LBB0_19:
	leaq	-48(%rbp), %rdi
	callq	_av_buffer_unref
	movq	_MFX_ERR_MEMORY_ALLOC@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_20:
	movl	(%r15), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.3(%rip), %rdx
LBB0_21:
	xorl	%eax, %eax
	callq	_av_log
LBB0_22:
	movq	_MFX_ERR_MEMORY_ALLOC@GOTPCREL(%rip), %rax
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET,4,2 ## @MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET
	.comm	_MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET,4,2 ## @MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET
	.comm	_MFX_MEMTYPE_FROM_DECODE,4,2    ## @MFX_MEMTYPE_FROM_DECODE
	.comm	_MFX_MEMTYPE_FROM_ENCODE,4,2    ## @MFX_MEMTYPE_FROM_ENCODE
	.comm	_MFX_ERR_UNSUPPORTED,4,2        ## @MFX_ERR_UNSUPPORTED
	.comm	_MFX_MEMTYPE_EXTERNAL_FRAME,4,2 ## @MFX_MEMTYPE_EXTERNAL_FRAME
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Mismatching surface properties in an allocation request: %dx%d %d %d vs %dx%d %d %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Error filling an external frame allocation request\n"

	.comm	_MFX_ERR_MEMORY_ALLOC,4,2       ## @MFX_ERR_MEMORY_ALLOC
	.comm	_MFX_MEMTYPE_INTERNAL_FRAME,4,2 ## @MFX_MEMTYPE_INTERNAL_FRAME
	.comm	_AV_PIX_FMT_QSV,4,2             ## @AV_PIX_FMT_QSV
L_.str.2:                               ## @.str.2
	.asciz	"Error initializing a frames context for an internal frame allocation request\n"

L_.str.3:                               ## @.str.3
	.asciz	"Error filling an internal frame allocation request\n"

	.comm	_MFX_ERR_NONE,4,2               ## @MFX_ERR_NONE
	.no_dead_strip	_qsv_frame_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qsv_frame_alloc
_qsv_frame_alloc:                       ; @qsv_frame_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	ldr	w8, [x1]
Lloh0:
	adrp	x9, _MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
Lloh3:
	adrp	x10, _MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET@GOTPAGE
Lloh4:
	ldr	x10, [x10, _MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.eq	LBB0_15
; %bb.1:
Lloh6:
	adrp	x9, _MFX_MEMTYPE_FROM_DECODE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MFX_MEMTYPE_FROM_DECODE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
Lloh9:
	adrp	x10, _MFX_MEMTYPE_FROM_ENCODE@GOTPAGE
Lloh10:
	ldr	x10, [x10, _MFX_MEMTYPE_FROM_ENCODE@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.eq	LBB0_15
; %bb.2:
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh12:
	adrp	x9, _MFX_MEMTYPE_EXTERNAL_FRAME@GOTPAGE
Lloh13:
	ldr	x9, [x9, _MFX_MEMTYPE_EXTERNAL_FRAME@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.3:
	ldr	x1, [x19, #8]
	ldr	x8, [x1]
	ldr	x8, [x8, #32]
	ldr	x11, [x8, #8]
	ldp	x8, x9, [x21, #8]
	ldp	x10, x12, [x11]
	cmp	x8, x10
	ccmp	x9, x12, #0, le
	b.gt	LBB0_8
; %bb.4:
	ldr	x13, [x21, #24]
	ldr	x14, [x11, #16]
	cmp	x13, x14
	b.ne	LBB0_8
; %bb.5:
	ldr	x13, [x21, #32]
	ldr	x14, [x11, #24]
	cmp	x13, x14
	b.ne	LBB0_8
; %bb.6:
	ldr	x2, [x19, #16]
	mov	x0, x20
	bl	_qsv_setup_mids
	tbz	w0, #31, LBB0_14
; %bb.7:
	ldr	w0, [x19]
Lloh15:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh16:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	adrp	x2, l_.str.1@PAGE
Lloh19:
	add	x2, x2, l_.str.1@PAGEOFF
	b	LBB0_20
LBB0_8:
Lloh20:
	adrp	x13, _AV_LOG_ERROR@GOTPAGE
Lloh21:
	ldr	x13, [x13, _AV_LOG_ERROR@GOTPAGEOFF]
	ldr	w0, [x19]
Lloh22:
	ldr	w1, [x13]
	ldp	x13, x14, [x21, #24]
	ldp	x15, x11, [x11, #16]
	stp	x15, x11, [sp, #48]
	stp	x10, x12, [sp, #32]
Lloh23:
	adrp	x2, l_.str@PAGE
Lloh24:
	add	x2, x2, l_.str@PAGEOFF
	stp	x13, x14, [sp, #16]
	stp	x8, x9, [sp]
	bl	_av_log
	b	LBB0_15
LBB0_9:
Lloh25:
	adrp	x9, _MFX_MEMTYPE_INTERNAL_FRAME@GOTPAGE
Lloh26:
	ldr	x9, [x9, _MFX_MEMTYPE_INTERNAL_FRAME@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.10:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	ldr	w0, [x8, #40]
	bl	_av_hwframe_ctx_alloc
	stur	x0, [x29, #-56]
	cbz	x0, LBB0_21
; %bb.11:
	mov	x22, x0
	ldr	x23, [x0]
	ldr	x24, [x23, #32]
Lloh28:
	adrp	x8, _AV_PIX_FMT_QSV@GOTPAGE
Lloh29:
	ldr	x8, [x8, _AV_PIX_FMT_QSV@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	str	w8, [x23, #24]
	ldr	x0, [x21, #24]
	bl	_ff_qsv_map_fourcc
	str	w0, [x23, #20]
	ldur	q0, [x21, #8]
	str	q0, [x23]
	ldr	w8, [x21, #4]
	str	w8, [x23, #16]
	ldr	w8, [x21]
	str	w8, [x24]
	mov	x0, x22
	bl	_av_hwframe_ctx_init
	tbnz	w0, #31, LBB0_17
; %bb.12:
	mov	x0, x22
	bl	_qsv_create_mids
	str	x0, [sp, #64]
	cbz	x0, LBB0_18
; %bb.13:
	mov	x2, x0
	mov	x0, x20
	mov	x1, x22
	bl	_qsv_setup_mids
	mov	x20, x0
	add	x0, sp, #64
	bl	_av_buffer_unref
	sub	x0, x29, #56
	bl	_av_buffer_unref
	tbnz	w20, #31, LBB0_19
LBB0_14:
Lloh31:
	adrp	x8, _MFX_ERR_NONE@GOTPAGE
Lloh32:
	ldr	x8, [x8, _MFX_ERR_NONE@GOTPAGEOFF]
	b	LBB0_16
LBB0_15:
Lloh33:
	adrp	x8, _MFX_ERR_UNSUPPORTED@GOTPAGE
Lloh34:
	ldr	x8, [x8, _MFX_ERR_UNSUPPORTED@GOTPAGEOFF]
LBB0_16:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_17:
	ldr	w0, [x19]
Lloh35:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh36:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
Lloh38:
	adrp	x2, l_.str.2@PAGE
Lloh39:
	add	x2, x2, l_.str.2@PAGEOFF
	bl	_av_log
LBB0_18:
	sub	x0, x29, #56
	bl	_av_buffer_unref
	b	LBB0_21
LBB0_19:
	ldr	w0, [x19]
Lloh40:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh41:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh42:
	ldr	w1, [x8]
Lloh43:
	adrp	x2, l_.str.3@PAGE
Lloh44:
	add	x2, x2, l_.str.3@PAGEOFF
LBB0_20:
	bl	_av_log
LBB0_21:
Lloh45:
	adrp	x8, _MFX_ERR_MEMORY_ALLOC@GOTPAGE
Lloh46:
	ldr	x8, [x8, _MFX_ERR_MEMORY_ALLOC@GOTPAGEOFF]
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGot	Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET,4,2 ; @MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET
	.comm	_MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET,4,2 ; @MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET
	.comm	_MFX_MEMTYPE_FROM_DECODE,4,2    ; @MFX_MEMTYPE_FROM_DECODE
	.comm	_MFX_MEMTYPE_FROM_ENCODE,4,2    ; @MFX_MEMTYPE_FROM_ENCODE
	.comm	_MFX_ERR_UNSUPPORTED,4,2        ; @MFX_ERR_UNSUPPORTED
	.comm	_MFX_MEMTYPE_EXTERNAL_FRAME,4,2 ; @MFX_MEMTYPE_EXTERNAL_FRAME
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Mismatching surface properties in an allocation request: %dx%d %d %d vs %dx%d %d %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Error filling an external frame allocation request\n"

	.comm	_MFX_ERR_MEMORY_ALLOC,4,2       ; @MFX_ERR_MEMORY_ALLOC
	.comm	_MFX_MEMTYPE_INTERNAL_FRAME,4,2 ; @MFX_MEMTYPE_INTERNAL_FRAME
	.comm	_AV_PIX_FMT_QSV,4,2             ; @AV_PIX_FMT_QSV
l_.str.2:                               ; @.str.2
	.asciz	"Error initializing a frames context for an internal frame allocation request\n"

l_.str.3:                               ; @.str.3
	.asciz	"Error filling an internal frame allocation request\n"

	.comm	_MFX_ERR_NONE,4,2               ; @MFX_ERR_NONE
	.no_dead_strip	_qsv_frame_alloc
.subsections_via_symbols
