	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function msgqueue_seq_acquire
_msgqueue_seq_acquire:                  ## @msgqueue_seq_acquire
	.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	16(%rdi), %rax
	movq	(%rax), %r15
	leaq	8(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movl	12(%rbx), %edi
	movq	_NVKM_MSGQUEUE_NUM_SEQUENCES@GOTPCREL(%rip), %r13
	movq	(%r13), %rsi
	callq	_find_first_zero_bit
	cmpq	(%r13), %rax
	jae	LBB0_2
## %bb.1:
	movq	%rax, %r12
	movl	12(%rbx), %esi
	movq	%rax, %rdi
	callq	_set_bit
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	(%rbx), %rcx
	leaq	(%rcx,%r12,4), %rax
	movq	_SEQ_STATE_PENDING@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, (%rcx,%r12,4)
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_nvkm_error
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	subl	(%rax), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NVKM_MSGQUEUE_NUM_SEQUENCES,8,3 ## @NVKM_MSGQUEUE_NUM_SEQUENCES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no free sequence available\n"

	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_SEQ_STATE_PENDING,4,2          ## @SEQ_STATE_PENDING
	.no_dead_strip	_msgqueue_seq_acquire
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function msgqueue_seq_acquire
_msgqueue_seq_acquire:                  ; @msgqueue_seq_acquire
	.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
	mov	x20, x0
	ldr	x8, [x0, #16]
	ldr	x21, [x8]
	add	x19, x0, #8
	mov	x0, x19
	bl	_mutex_lock
	ldr	w0, [x20, #12]
Lloh0:
	adrp	x23, _NVKM_MSGQUEUE_NUM_SEQUENCES@GOTPAGE
Lloh1:
	ldr	x23, [x23, _NVKM_MSGQUEUE_NUM_SEQUENCES@GOTPAGEOFF]
	ldr	x1, [x23]
	bl	_find_first_zero_bit
	ldr	x8, [x23]
	cmp	x0, x8
	b.hs	LBB0_2
; %bb.1:
	mov	x22, x0
	ldr	w1, [x20, #12]
	bl	_set_bit
	mov	x0, x19
	bl	_mutex_unlock
	ldr	x8, [x20]
	add	x0, x8, x22, lsl #2
Lloh2:
	adrp	x8, _SEQ_STATE_PENDING@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SEQ_STATE_PENDING@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	str	w8, [x0]
	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_2:
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_nvkm_error
	mov	x0, x19
	bl	_mutex_unlock
Lloh7:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w0, w8
	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
	b	_ERR_PTR
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_NVKM_MSGQUEUE_NUM_SEQUENCES,8,3 ; @NVKM_MSGQUEUE_NUM_SEQUENCES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no free sequence available\n"

	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_SEQ_STATE_PENDING,4,2          ; @SEQ_STATE_PENDING
	.no_dead_strip	_msgqueue_seq_acquire
.subsections_via_symbols
