	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function reserve_doorbell
_reserve_doorbell:                      ## @reserve_doorbell
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	(%rdi), %rax
	movq	_GUC_DOORBELL_INVALID@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setne	%dil
	callq	_GEM_BUG_ON
	movq	_GUC_NUM_DOORBELLS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	movslq	%ecx, %rbx
	movq	%r15, %rdi
	callq	_is_high_priority
	testq	%rax, %rax
	cmovneq	%rbx, %rax
	setne	%cl
	shlq	%cl, %rbx
	movq	16(%r15), %rcx
	movl	(%rcx), %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_find_next_zero_bit
	cmpq	%rbx, %rax
	jne	LBB0_2
## %bb.1:
	movq	_ENOSPC@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_3
LBB0_2:
	movq	%rax, %r14
	movq	16(%r15), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	___set_bit
	movq	%r14, (%r15)
	movl	8(%r15), %ebx
	movq	%r15, %rdi
	callq	_is_high_priority
	movq	%rax, %rdi
	callq	_yesno
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	movq	%r14, %rcx
	callq	_DRM_DEBUG_DRIVER
	xorl	%eax, %eax
LBB0_3:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GUC_DOORBELL_INVALID,8,3       ## @GUC_DOORBELL_INVALID
	.comm	_GUC_NUM_DOORBELLS,4,2          ## @GUC_NUM_DOORBELLS
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"client %u (high prio=%s) reserved doorbell: %d\n"

	.no_dead_strip	_reserve_doorbell
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function reserve_doorbell
_reserve_doorbell:                      ; @reserve_doorbell
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _GUC_DOORBELL_INVALID@GOTPAGE
Lloh1:
	ldr	x9, [x9, _GUC_DOORBELL_INVALID@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, ne
	bl	_GEM_BUG_ON
Lloh3:
	adrp	x8, _GUC_NUM_DOORBELLS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GUC_NUM_DOORBELLS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, #0
	cinc	w8, w8, lt
	sbfx	x20, x8, #1, #31
	mov	x0, x19
	bl	_is_high_priority
	cmp	x0, #0
	csel	x2, xzr, x20, eq
	cset	w8, ne
	lsl	x21, x20, x8
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	mov	x1, x21
	bl	_find_next_zero_bit
	cmp	x0, x21
	b.ne	LBB0_2
; %bb.1:
Lloh6:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_3
LBB0_2:
	mov	x20, x0
	ldr	x8, [x19, #16]
	ldr	w1, [x8]
	bl	___set_bit
	str	x20, [x19]
	ldr	w21, [x19, #8]
	mov	x0, x19
	bl	_is_high_priority
	bl	_yesno
	mov	x2, x0
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	mov	x3, x20
	bl	_DRM_DEBUG_DRIVER
	mov	w0, #0
LBB0_3:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_GUC_DOORBELL_INVALID,8,3       ; @GUC_DOORBELL_INVALID
	.comm	_GUC_NUM_DOORBELLS,4,2          ; @GUC_NUM_DOORBELLS
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"client %u (high prio=%s) reserved doorbell: %d\n"

	.no_dead_strip	_reserve_doorbell
.subsections_via_symbols
