	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cmd_queue_open
_cmd_queue_open:                        ## @cmd_queue_open
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r13d
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	(%rdi), %r12
	movq	(%r12), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$0, -44(%rbp)
	leaq	8(%rsi), %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	leaq	-44(%rbp), %rcx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%r13d, %edx
	callq	_cmd_queue_has_room
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movl	(%rbx), %esi
	movq	%r12, %rdi
	callq	_nvkm_falcon_rd32
	movl	%eax, 4(%rbx)
	xorl	%r15d, %r15d
	cmpl	$0, -44(%rbp)
	je	LBB0_4
## %bb.3:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_cmd_queue_rewind
	jmp	LBB0_4
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_nvkm_error
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_4:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"queue full\n"

	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.no_dead_strip	_cmd_queue_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cmd_queue_open
_cmd_queue_open:                        ; @cmd_queue_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x24, x2
	mov	x19, x1
	mov	x20, x0
	ldr	x23, [x0]
	ldr	x22, [x23]
	str	wzr, [sp, #12]
	add	x21, x1, #8
	mov	x0, x21
	bl	_mutex_lock
	add	x3, sp, #12
	mov	x0, x20
	mov	x1, x19
	mov	x2, x24
	bl	_cmd_queue_has_room
	cbz	w0, LBB0_4
; %bb.1:
	ldr	w1, [x19]
	mov	x0, x23
	bl	_nvkm_falcon_rd32
	str	w0, [x19, #4]
	ldr	w8, [sp, #12]
	cbz	w8, LBB0_3
; %bb.2:
	mov	x0, x20
	mov	x1, x19
	bl	_cmd_queue_rewind
LBB0_3:
	mov	w0, #0
	b	LBB0_5
LBB0_4:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	bl	_nvkm_error
	mov	x0, x21
	bl	_mutex_unlock
Lloh2:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"queue full\n"

	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.no_dead_strip	_cmd_queue_open
.subsections_via_symbols
