	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function GetBufferFromRing
_GetBufferFromRing:                     ## @GetBufferFromRing
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	incq	%rax
	xorl	%ecx, %ecx
	cmpq	8(%rdi), %rax
	movq	16(%rdi), %rdx
	cmovlq	%rax, %rcx
	movq	%rcx, (%rdi)
	movq	(%rdx,%rcx,8), %rdi
	movq	_InvalidBuffer@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdi
	je	LBB0_5
## %bb.1:
	movq	%rsi, %r14
	decq	%rdi
	callq	_GetBufferDescriptor
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_LockBufHdr
	movl	%eax, %r12d
	movl	%eax, %edi
	callq	_BUF_STATE_GET_REFCOUNT
	testq	%rax, %rax
	jne	LBB0_4
## %bb.2:
	movl	%r12d, %edi
	callq	_BUF_STATE_GET_USAGECOUNT
	cmpl	$1, %eax
	jg	LBB0_4
## %bb.3:
	movl	$1, 24(%rbx)
	movl	%r12d, (%r14)
	jmp	LBB0_6
LBB0_4:
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_UnlockBufHdr
LBB0_5:
	movl	$0, 24(%rbx)
	xorl	%r15d, %r15d
LBB0_6:
	movq	%r15, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_InvalidBuffer,8,3              ## @InvalidBuffer
	.no_dead_strip	_GetBufferFromRing
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function GetBufferFromRing
_GetBufferFromRing:                     ; @GetBufferFromRing
	.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
	ldp	x8, x9, [x0]
	add	x10, x8, #1
	cmp	x10, x9
	csinc	x8, xzr, x8, ge
	str	x8, [x0]
	ldr	x9, [x0, #16]
	ldr	x8, [x9, x8, lsl #3]
Lloh0:
	adrp	x9, _InvalidBuffer@GOTPAGE
Lloh1:
	ldr	x9, [x9, _InvalidBuffer@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_5
; %bb.1:
	mov	x20, x1
	sub	x0, x8, #1
	bl	_GetBufferDescriptor
	mov	x21, x0
	bl	_LockBufHdr
	mov	x22, x0
	bl	_BUF_STATE_GET_REFCOUNT
	cbnz	x0, LBB0_4
; %bb.2:
	mov	x0, x22
	bl	_BUF_STATE_GET_USAGECOUNT
	cmp	w0, #1
	b.gt	LBB0_4
; %bb.3:
	mov	w8, #1
	str	w8, [x19, #24]
	str	w22, [x20]
	b	LBB0_6
LBB0_4:
	mov	x0, x21
	mov	x1, x22
	bl	_UnlockBufHdr
LBB0_5:
	mov	x21, #0
	str	wzr, [x19, #24]
LBB0_6:
	mov	x0, x21
	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	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_InvalidBuffer,8,3              ; @InvalidBuffer
	.no_dead_strip	_GetBufferFromRing
.subsections_via_symbols
