	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ConditionalLockBufferForCleanup ## -- Begin function ConditionalLockBufferForCleanup
	.p2align	4, 0x90
_ConditionalLockBufferForCleanup:       ## @ConditionalLockBufferForCleanup
	.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
	movl	%edi, %r14d
	callq	_BufferIsValid
	movl	%eax, %edi
	callq	_Assert
	movl	%r14d, %edi
	callq	_BufferIsLocal
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_LocalRefCount@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	notl	%r14d
	movslq	%r14d, %rcx
	movl	(%rax,%rcx,4), %r14d
	xorl	%edi, %edi
	testl	%r14d, %r14d
	setg	%dil
	callq	_Assert
	xorl	%ebx, %ebx
	cmpl	$1, %r14d
	sete	%bl
	jmp	LBB0_6
LBB0_2:
	movl	%r14d, %edi
	callq	_GetPrivateRefCount
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	_Assert
	xorl	%ebx, %ebx
	cmpl	$1, %r15d
	jne	LBB0_6
## %bb.3:
	movl	%r14d, %edi
	callq	_ConditionalLockBuffer
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	leal	-1(%r14), %edi
	callq	_GetBufferDescriptor
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_LockBufHdr
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_BUF_STATE_GET_REFCOUNT
	movl	%eax, %r12d
	xorl	%edi, %edi
	testl	%eax, %eax
	setg	%dil
	callq	_Assert
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_UnlockBufHdr
	movl	$1, %ebx
	cmpl	$1, %r12d
	je	LBB0_6
## %bb.5:
	movq	_BUFFER_LOCK_UNLOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_LockBuffer
	xorl	%ebx, %ebx
LBB0_6:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LocalRefCount,8,3              ## @LocalRefCount
	.comm	_BUFFER_LOCK_UNLOCK,4,2         ## @BUFFER_LOCK_UNLOCK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ConditionalLockBufferForCleanup ; -- Begin function ConditionalLockBufferForCleanup
	.p2align	2
_ConditionalLockBufferForCleanup:       ; @ConditionalLockBufferForCleanup
	.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
	bl	_BufferIsValid
	bl	_Assert
	mov	x0, x19
	bl	_BufferIsLocal
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _LocalRefCount@GOTPAGE
Lloh1:
	ldr	x8, [x8, _LocalRefCount@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	mvn	w9, w19
	ldr	w19, [x8, w9, sxtw #2]
	cmp	w19, #0
	cset	w0, gt
	bl	_Assert
	cmp	w19, #1
	cset	w0, eq
	b	LBB0_8
LBB0_2:
	mov	x0, x19
	bl	_GetPrivateRefCount
	mov	x20, x0
	bl	_Assert
	cmp	w20, #1
	b.ne	LBB0_7
; %bb.3:
	mov	x0, x19
	bl	_ConditionalLockBuffer
	cbz	w0, LBB0_8
; %bb.4:
	sub	w0, w19, #1
	bl	_GetBufferDescriptor
	mov	x20, x0
	bl	_LockBufHdr
	mov	x21, x0
	bl	_BUF_STATE_GET_REFCOUNT
	mov	x22, x0
	cmp	w0, #0
	cset	w0, gt
	bl	_Assert
	mov	x0, x20
	mov	x1, x21
	bl	_UnlockBufHdr
	cmp	w22, #1
	b.ne	LBB0_6
; %bb.5:
	mov	w0, #1
	b	LBB0_8
LBB0_6:
Lloh3:
	adrp	x8, _BUFFER_LOCK_UNLOCK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BUFFER_LOCK_UNLOCK@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_LockBuffer
LBB0_7:
	mov	w0, #0
LBB0_8:
	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
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_LocalRefCount,8,3              ; @LocalRefCount
	.comm	_BUFFER_LOCK_UNLOCK,4,2         ; @BUFFER_LOCK_UNLOCK
.subsections_via_symbols
