	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function radeon_vce_validate_handle
_radeon_vce_validate_handle:            ## @radeon_vce_validate_handle
	.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	$0, (%rdx)
	movq	_RADEON_MAX_VCE_HANDLES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_11
## %bb.1:
	movl	%esi, %r12d
	movq	%rdi, %r15
	movq	%rdx, %r14
	xorl	%ebx, %ebx
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rax
	movq	16(%rax), %rdi
	addq	%rbx, %rdi
	callq	_atomic_read
	cmpl	%r12d, %eax
	je	LBB0_3
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	incq	%r13
	movq	_RADEON_MAX_VCE_HANDLES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addq	$4, %rbx
	cmpq	%rax, %r13
	jb	LBB0_2
## %bb.6:
	testl	%eax, %eax
	je	LBB0_11
## %bb.7:
	movq	%r14, %rbx
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rax
	movq	16(%rax), %rdi
	addq	%r14, %rdi
	xorl	%esi, %esi
	movl	%r12d, %edx
	callq	_atomic_cmpxchg
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=1
	incq	%r13
	movq	_RADEON_MAX_VCE_HANDLES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addq	$4, %r14
	cmpq	%rax, %r13
	jb	LBB0_8
LBB0_11:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_12
LBB0_3:
	movq	8(%r15), %rax
	movq	(%rax), %rax
	movq	(%rax,%r13,8), %rax
	cmpq	(%r15), %rax
	je	LBB0_13
## %bb.4:
	leaq	L_.str(%rip), %rdi
LBB0_12:
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_13:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	(%r15), %rax
	movq	8(%r15), %rcx
	movq	(%rcx), %rdx
	movq	%rax, (%rdx,%r13,8)
	movq	8(%rcx), %rax
	movq	$0, (%rax,%r13,8)
	movl	$1, (%rbx)
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_RADEON_MAX_VCE_HANDLES,4,2     ## @RADEON_MAX_VCE_HANDLES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"VCE handle collision detected!\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"No more free VCE handles!\n"

	.no_dead_strip	_radeon_vce_validate_handle
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function radeon_vce_validate_handle
_radeon_vce_validate_handle:            ; @radeon_vce_validate_handle
	.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
	str	wzr, [x2]
Lloh0:
	adrp	x23, _RADEON_MAX_VCE_HANDLES@GOTPAGE
Lloh1:
	ldr	x23, [x23, _RADEON_MAX_VCE_HANDLES@GOTPAGEOFF]
	ldr	w8, [x23]
	cbz	w8, LBB0_8
; %bb.1:
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	mov	x24, #0
	mov	x22, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #8]
	ldr	x8, [x8, #16]
	add	x0, x8, x24
	bl	_atomic_read
	cmp	w0, w21
	b.eq	LBB0_9
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x22, x22, #1
	ldr	w8, [x23]
	add	x24, x24, #4
	cmp	x22, x8
	b.lo	LBB0_2
; %bb.4:
	cbz	w8, LBB0_8
; %bb.5:
	mov	x24, #0
	mov	x22, #0
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #8]
	ldr	x8, [x8, #16]
	add	x0, x8, x24
	mov	w1, #0
	mov	x2, x21
	bl	_atomic_cmpxchg
	cbz	w0, LBB0_13
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x22, x22, #1
	ldr	w8, [x23]
	add	x24, x24, #4
	cmp	x22, x8
	b.lo	LBB0_6
LBB0_8:
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_11
LBB0_9:
	ldp	x9, x8, [x20]
	ldr	x8, [x8]
	ldr	x8, [x8, x22, lsl #3]
	cmp	x8, x9
	b.eq	LBB0_12
; %bb.10:
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
LBB0_11:
	bl	_DRM_ERROR
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_12:
	mov	x0, x22
	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_13:
	ldp	x8, x9, [x20]
	lsl	x10, x22, #3
	ldp	x11, x9, [x9]
	str	x8, [x11, x10]
	str	xzr, [x9, x10]
	mov	w8, #1
	str	w8, [x19]
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	b	LBB0_12
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_RADEON_MAX_VCE_HANDLES,4,2     ; @RADEON_MAX_VCE_HANDLES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"VCE handle collision detected!\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"No more free VCE handles!\n"

	.no_dead_strip	_radeon_vce_validate_handle
.subsections_via_symbols
