	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function PinBuffer
_PinBuffer:                             ## @PinBuffer
	.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
	movq	%rsi, %r15
	movq	%rdi, %r13
	callq	_BufferDescriptorGetBuffer
	movl	%eax, %ebx
	movl	$1, %r14d
	movl	%eax, %edi
	movl	$1, %esi
	callq	_GetPrivateRefCountEntry
	testq	%rax, %rax
	jne	LBB0_11
## %bb.1:
	xorl	%eax, %eax
	callq	_ReservePrivateRefCountEntry
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	movl	%ebx, %edi
	callq	_NewPrivateRefCountEntry
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	callq	_pg_atomic_read_u32
	movl	%eax, %ebx
	movl	%eax, -44(%rbp)
	movq	_BUF_REFCOUNT_ONE@GOTPCREL(%rip), %r12
	leaq	-44(%rbp), %r14
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	_BM_LOCKED@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	callq	_WaitBufHdrUnlocked
	movl	%eax, %ebx
	movl	%eax, -44(%rbp)
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	addl	(%r12), %ebx
	movl	%ebx, %edi
	callq	_BUF_STATE_GET_USAGECOUNT
	testq	%r15, %r15
	je	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	testq	%rax, %rax
	jne	LBB0_8
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_BUF_USAGECOUNT_ONE@GOTPCREL(%rip), %rax
	addl	(%rax), %ebx
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_pg_atomic_compare_exchange_u32
	testq	%rax, %rax
	jne	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %ebx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_BM_MAX_USAGE_COUNT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_7
	jmp	LBB0_8
LBB0_10:
	movq	_BM_VALID@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	andl	(%rax), %ebx
	setne	%r14b
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movq	-56(%rbp), %rax                 ## 8-byte Reload
LBB0_11:
	movq	(%rax), %rdi
	leaq	1(%rdi), %rcx
	movq	%rcx, (%rax)
	shrq	$63, %rdi
	xorl	$1, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_Assert
	movq	_CurrentResourceOwner@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	callq	_ResourceOwnerRememberBuffer
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BM_LOCKED,4,2                  ## @BM_LOCKED
	.comm	_BUF_REFCOUNT_ONE,8,3           ## @BUF_REFCOUNT_ONE
	.comm	_BM_MAX_USAGE_COUNT,8,3         ## @BM_MAX_USAGE_COUNT
	.comm	_BUF_USAGECOUNT_ONE,8,3         ## @BUF_USAGECOUNT_ONE
	.comm	_BM_VALID,4,2                   ## @BM_VALID
	.comm	_CurrentResourceOwner,4,2       ## @CurrentResourceOwner
	.no_dead_strip	_PinBuffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function PinBuffer
_PinBuffer:                             ; @PinBuffer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	mov	x21, x0
	bl	_BufferDescriptorGetBuffer
	mov	x19, x0
	mov	w23, #1
	mov	w1, #1
	bl	_GetPrivateRefCountEntry
	cbz	x0, LBB0_2
; %bb.1:
	mov	x22, x0
	b	LBB0_12
LBB0_2:
	bl	_ReservePrivateRefCountEntry
	mov	x0, x19
	bl	_NewPrivateRefCountEntry
	mov	x22, x0
	mov	x0, x21
	bl	_pg_atomic_read_u32
	str	w0, [sp, #12]
Lloh0:
	adrp	x24, _BM_LOCKED@GOTPAGE
Lloh1:
	ldr	x24, [x24, _BM_LOCKED@GOTPAGEOFF]
Lloh2:
	adrp	x25, _BUF_REFCOUNT_ONE@GOTPAGE
Lloh3:
	ldr	x25, [x25, _BUF_REFCOUNT_ONE@GOTPAGEOFF]
Lloh4:
	adrp	x26, _BM_MAX_USAGE_COUNT@GOTPAGE
Lloh5:
	ldr	x26, [x26, _BM_MAX_USAGE_COUNT@GOTPAGEOFF]
Lloh6:
	adrp	x27, _BUF_USAGECOUNT_ONE@GOTPAGE
Lloh7:
	ldr	x27, [x27, _BUF_USAGECOUNT_ONE@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x24]
	tst	w8, w0
	b.eq	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x21
	bl	_WaitBufHdrUnlocked
	str	w0, [sp, #12]
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x25]
	add	w23, w0, w8
	mov	x0, x23
	bl	_BUF_STATE_GET_USAGECOUNT
	cbz	x20, LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	cbnz	x0, LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x27]
	add	w23, w23, w8
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x1, sp, #12
	mov	x0, x21
	mov	x2, x23
	bl	_pg_atomic_compare_exchange_u32
	cbnz	x0, LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [sp, #12]
	b	LBB0_3
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x26]
	cmp	x0, x8
	b.lt	LBB0_7
	b	LBB0_8
LBB0_11:
Lloh8:
	adrp	x8, _BM_VALID@GOTPAGE
Lloh9:
	ldr	x8, [x8, _BM_VALID@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	tst	w8, w23
	cset	w23, ne
LBB0_12:
	ldr	x8, [x22]
	add	x9, x8, #1
	str	x9, [x22]
	lsr	x8, x8, #63
	eor	w0, w8, #0x1
	bl	_Assert
Lloh11:
	adrp	x8, _CurrentResourceOwner@GOTPAGE
Lloh12:
	ldr	x8, [x8, _CurrentResourceOwner@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	mov	x1, x19
	bl	_ResourceOwnerRememberBuffer
	mov	x0, x23
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_BM_LOCKED,4,2                  ; @BM_LOCKED
	.comm	_BUF_REFCOUNT_ONE,8,3           ; @BUF_REFCOUNT_ONE
	.comm	_BM_MAX_USAGE_COUNT,8,3         ; @BM_MAX_USAGE_COUNT
	.comm	_BUF_USAGECOUNT_ONE,8,3         ; @BUF_USAGECOUNT_ONE
	.comm	_BM_VALID,4,2                   ; @BM_VALID
	.comm	_CurrentResourceOwner,4,2       ; @CurrentResourceOwner
	.no_dead_strip	_PinBuffer
.subsections_via_symbols
