	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function UnpinBuffer
_UnpinBuffer:                           ## @UnpinBuffer
	.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	%esi, %r12d
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_BufferDescriptorGetBuffer
	movl	%eax, %r14d
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_GetPrivateRefCountEntry
	movq	%rax, %rbx
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	callq	_Assert
	testl	%r12d, %r12d
	je	LBB0_2
## %bb.1:
	movq	_CurrentResourceOwner@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r14d, %esi
	callq	_ResourceOwnerForgetBuffer
LBB0_2:
	xorl	%edi, %edi
	cmpq	$0, (%rbx)
	setg	%dil
	callq	_Assert
	decq	(%rbx)
	jne	LBB0_14
## %bb.3:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_BufferDescriptorGetContentLock
	movl	%eax, %edi
	callq	_LWLockHeldByMe
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_Assert
	movq	%rbx, %rdi
	callq	_BufferDescriptorGetIOLock
	movl	%eax, %edi
	callq	_LWLockHeldByMe
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_Assert
	leaq	4(%rbx), %r12
	movq	%r12, %rdi
	callq	_pg_atomic_read_u32
	movl	%eax, %ebx
	movl	%eax, -44(%rbp)
	movq	_BM_LOCKED@GOTPCREL(%rip), %r14
	movq	_BUF_REFCOUNT_ONE@GOTPCREL(%rip), %r15
	leaq	-44(%rbp), %r13
	testl	%ebx, (%r14)
	je	LBB0_6
	.p2align	4, 0x90
LBB0_5:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_WaitBufHdrUnlocked
	movl	%eax, %ebx
	movl	%eax, -44(%rbp)
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	subl	(%r15), %ebx
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	%ebx, %edx
	callq	_pg_atomic_compare_exchange_u32
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	-44(%rbp), %ebx
	testl	%ebx, (%r14)
	jne	LBB0_5
	jmp	LBB0_6
LBB0_8:
	movq	_BM_PIN_COUNT_WAITER@GOTPCREL(%rip), %r14
	testl	%ebx, (%r14)
	je	LBB0_13
## %bb.9:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_LockBufHdr
	movl	%eax, %ebx
	testl	%eax, (%r14)
	je	LBB0_12
## %bb.10:
	movl	%ebx, %edi
	callq	_BUF_STATE_GET_REFCOUNT
	cmpl	$1, %eax
	jne	LBB0_12
## %bb.11:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	(%rdi), %r12d
	movl	(%r14), %eax
	notl	%eax
	andl	%eax, %ebx
	movl	%ebx, %esi
	callq	_UnlockBufHdr
	movl	%r12d, %edi
	callq	_ProcSendSignal
	jmp	LBB0_13
LBB0_12:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	callq	_UnlockBufHdr
LBB0_13:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_ForgetPrivateRefCountEntry
LBB0_14:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CurrentResourceOwner,4,2       ## @CurrentResourceOwner
	.comm	_BM_LOCKED,4,2                  ## @BM_LOCKED
	.comm	_BUF_REFCOUNT_ONE,8,3           ## @BUF_REFCOUNT_ONE
	.comm	_BM_PIN_COUNT_WAITER,4,2        ## @BM_PIN_COUNT_WAITER
	.no_dead_strip	_UnpinBuffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function UnpinBuffer
_UnpinBuffer:                           ; @UnpinBuffer
	.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	x22, x1
	mov	x20, x0
	bl	_BufferDescriptorGetBuffer
	mov	x21, x0
	mov	w1, #0
	bl	_GetPrivateRefCountEntry
	mov	x19, x0
	cmp	x0, #0
	cset	w0, ne
	bl	_Assert
	cbz	w22, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _CurrentResourceOwner@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CurrentResourceOwner@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	mov	x1, x21
	bl	_ResourceOwnerForgetBuffer
LBB0_2:
	ldr	x8, [x19]
	cmp	x8, #0
	cset	w0, gt
	bl	_Assert
	ldr	x8, [x19]
	subs	x8, x8, #1
	str	x8, [x19]
	b.ne	LBB0_14
; %bb.3:
	mov	x0, x20
	bl	_BufferDescriptorGetContentLock
	bl	_LWLockHeldByMe
	cmp	w0, #0
	cset	w0, eq
	bl	_Assert
	mov	x0, x20
	bl	_BufferDescriptorGetIOLock
	bl	_LWLockHeldByMe
	cmp	w0, #0
	cset	w0, eq
	bl	_Assert
	add	x21, x20, #4
	mov	x0, x21
	bl	_pg_atomic_read_u32
	str	w0, [sp, #12]
Lloh3:
	adrp	x23, _BM_LOCKED@GOTPAGE
Lloh4:
	ldr	x23, [x23, _BM_LOCKED@GOTPAGEOFF]
Lloh5:
	adrp	x24, _BUF_REFCOUNT_ONE@GOTPAGE
Lloh6:
	ldr	x24, [x24, _BUF_REFCOUNT_ONE@GOTPAGEOFF]
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x23]
	tst	w8, w0
	b.eq	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_WaitBufHdrUnlocked
	str	w0, [sp, #12]
LBB0_6:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x24]
	sub	w22, w0, w8
	add	x1, sp, #12
	mov	x0, x21
	mov	x2, x22
	bl	_pg_atomic_compare_exchange_u32
	cbnz	x0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w0, [sp, #12]
	b	LBB0_4
LBB0_8:
Lloh7:
	adrp	x23, _BM_PIN_COUNT_WAITER@GOTPAGE
Lloh8:
	ldr	x23, [x23, _BM_PIN_COUNT_WAITER@GOTPAGEOFF]
	ldr	w8, [x23]
	tst	w8, w22
	b.eq	LBB0_13
; %bb.9:
	mov	x0, x20
	bl	_LockBufHdr
	mov	x21, x0
	ldr	w8, [x23]
	tst	w8, w0
	b.eq	LBB0_12
; %bb.10:
	mov	x0, x21
	bl	_BUF_STATE_GET_REFCOUNT
	cmp	w0, #1
	b.ne	LBB0_12
; %bb.11:
	ldr	w22, [x20]
	ldr	w8, [x23]
	bic	w1, w21, w8
	mov	x0, x20
	bl	_UnlockBufHdr
	mov	x0, x22
	bl	_ProcSendSignal
	b	LBB0_13
LBB0_12:
	mov	x0, x20
	mov	x1, x21
	bl	_UnlockBufHdr
LBB0_13:
	mov	x0, x19
	bl	_ForgetPrivateRefCountEntry
LBB0_14:
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_CurrentResourceOwner,4,2       ; @CurrentResourceOwner
	.comm	_BM_LOCKED,4,2                  ; @BM_LOCKED
	.comm	_BUF_REFCOUNT_ONE,8,3           ; @BUF_REFCOUNT_ONE
	.comm	_BM_PIN_COUNT_WAITER,4,2        ; @BM_PIN_COUNT_WAITER
	.no_dead_strip	_UnpinBuffer
.subsections_via_symbols
