	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_LockBufferForCleanup           ## -- Begin function LockBufferForCleanup
	.p2align	4, 0x90
_LockBufferForCleanup:                  ## @LockBufferForCleanup
	.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
	movl	%edi, %r14d
	callq	_BufferIsValid
	movl	%eax, %edi
	callq	_Assert
	movq	_PinCountWaitBuf@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpq	$0, (%rax)
	sete	%dil
	callq	_Assert
	movl	%r14d, %edi
	callq	_BufferIsLocal
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	_LocalRefCount@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	notl	%r14d
	movslq	%r14d, %rcx
	movl	(%rax,%rcx,4), %edx
	cmpl	$1, %edx
	jne	LBB0_2
## %bb.17:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movl	%r14d, %edi
	callq	_GetPrivateRefCount
	cmpl	$1, %eax
	je	LBB0_5
## %bb.4:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	%r14d, %edi
	callq	_GetPrivateRefCount
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_elog
LBB0_5:
	leal	-1(%r14), %edi
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	callq	_GetBufferDescriptor
	movq	%rax, %r13
	movq	_BUFFER_LOCK_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_LockBuffer
	movq	%r13, %rdi
	callq	_LockBufHdr
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_BUF_STATE_GET_REFCOUNT
	xorl	%edi, %edi
	testl	%eax, %eax
	setg	%dil
	callq	_Assert
	movl	%ebx, %edi
	callq	_BUF_STATE_GET_REFCOUNT
	cmpl	$1, %eax
	jne	LBB0_6
LBB0_16:
	movq	%r13, %rdi
	movl	%ebx, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_UnlockBufHdr                   ## TAILCALL
LBB0_2:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_elog                           ## TAILCALL
LBB0_6:
	movq	_BM_PIN_COUNT_WAITER@GOTPCREL(%rip), %r12
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_UnlockBufHdr
	movq	_PinCountWaitBuf@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_BUFFER_LOCK_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_LockBuffer
	movq	%r13, %rdi
	callq	_LockBufHdr
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_BUF_STATE_GET_REFCOUNT
	xorl	%edi, %edi
	testl	%eax, %eax
	setg	%dil
	callq	_Assert
	movl	%ebx, %edi
	callq	_BUF_STATE_GET_REFCOUNT
	cmpl	$1, %eax
	je	LBB0_16
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %esi
	testl	%ebx, %esi
	movq	_BUFFER_LOCK_UNLOCK@GOTPCREL(%rip), %r15
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_UnlockBufHdr
	movl	(%r15), %esi
	movl	%r14d, %edi
	callq	_LockBuffer
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_elog
	movl	(%r12), %esi
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	movq	_MyProcPid@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r13)
	movq	_PinCountWaitBuf@GOTPCREL(%rip), %rax
	movq	%r13, (%rax)
	orl	%ebx, %esi
	movq	%r13, %rdi
	callq	_UnlockBufHdr
	movl	(%r15), %esi
	movl	%r14d, %edi
	callq	_LockBuffer
	movq	_InHotStandby@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_SetStartupBufferPinWaitBufId
	xorl	%eax, %eax
	callq	_ResolveRecoveryConflictWithBufferPin
	movl	$-1, %edi
	callq	_SetStartupBufferPinWaitBufId
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	_PG_WAIT_BUFFER_PIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ProcWaitForSignal
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	%r13, %rdi
	callq	_LockBufHdr
	movl	(%r12), %ecx
	testl	%eax, %ecx
	je	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	(%r13), %rdx
	movq	_MyProcPid@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	jne	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_7 Depth=1
	notl	%ecx
	andl	%ecx, %eax
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_PinCountWaitBuf,8,3            ## @PinCountWaitBuf
	.comm	_LocalRefCount,8,3              ## @LocalRefCount
	.comm	_ERROR,4,2                      ## @ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"incorrect local pin count: %d"

	.comm	_BUFFER_LOCK_EXCLUSIVE,4,2      ## @BUFFER_LOCK_EXCLUSIVE
	.comm	_BM_PIN_COUNT_WAITER,4,2        ## @BM_PIN_COUNT_WAITER
	.comm	_BUFFER_LOCK_UNLOCK,4,2         ## @BUFFER_LOCK_UNLOCK
L_.str.1:                               ## @.str.1
	.asciz	"multiple backends attempting to wait for pincount 1"

	.comm	_MyProcPid,8,3                  ## @MyProcPid
	.comm	_InHotStandby,8,3               ## @InHotStandby
	.comm	_PG_WAIT_BUFFER_PIN,4,2         ## @PG_WAIT_BUFFER_PIN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_LockBufferForCleanup           ; -- Begin function LockBufferForCleanup
	.p2align	2
_LockBufferForCleanup:                  ; @LockBufferForCleanup
	.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	x19, x0
	bl	_BufferIsValid
	bl	_Assert
Lloh0:
	adrp	x24, _PinCountWaitBuf@GOTPAGE
Lloh1:
	ldr	x24, [x24, _PinCountWaitBuf@GOTPAGEOFF]
	ldr	x8, [x24]
	cmp	x8, #0
	cset	w0, eq
	bl	_Assert
	mov	x0, x19
	bl	_BufferIsLocal
	cbz	x0, LBB0_4
; %bb.1:
Lloh2:
	adrp	x8, _LocalRefCount@GOTPAGE
Lloh3:
	ldr	x8, [x8, _LocalRefCount@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	mvn	w9, w19
	ldr	w8, [x8, w9, sxtw #2]
	cmp	w8, #1
	b.eq	LBB0_3
; %bb.2:
Lloh5:
	adrp	x9, _ERROR@GOTPAGE
Lloh6:
	ldr	x9, [x9, _ERROR@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x9]
	str	x8, [sp]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_elog
LBB0_3:
	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
LBB0_4:
	mov	x0, x19
	bl	_GetPrivateRefCount
	cmp	w0, #1
	b.eq	LBB0_6
; %bb.5:
Lloh10:
	adrp	x8, _ERROR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh12:
	ldr	w20, [x8]
	mov	x0, x19
	bl	_GetPrivateRefCount
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_elog
LBB0_6:
	sub	w21, w19, #1
	mov	x0, x21
	bl	_GetBufferDescriptor
	mov	x20, x0
Lloh15:
	adrp	x25, _BUFFER_LOCK_EXCLUSIVE@GOTPAGE
Lloh16:
	ldr	x25, [x25, _BUFFER_LOCK_EXCLUSIVE@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x19
	bl	_LockBuffer
	mov	x0, x20
	bl	_LockBufHdr
	mov	x23, x0
	bl	_BUF_STATE_GET_REFCOUNT
	cmp	w0, #0
	cset	w0, gt
	bl	_Assert
	mov	x0, x23
	bl	_BUF_STATE_GET_REFCOUNT
	cmp	w0, #1
	b.ne	LBB0_8
LBB0_7:
	mov	x0, x20
	mov	x1, 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
	b	_UnlockBufHdr
LBB0_8:
Lloh17:
	adrp	x26, _BM_PIN_COUNT_WAITER@GOTPAGE
Lloh18:
	ldr	x26, [x26, _BM_PIN_COUNT_WAITER@GOTPAGEOFF]
Lloh19:
	adrp	x27, _MyProcPid@GOTPAGE
Lloh20:
	ldr	x27, [x27, _MyProcPid@GOTPAGEOFF]
Lloh21:
	adrp	x28, _BUFFER_LOCK_UNLOCK@GOTPAGE
Lloh22:
	ldr	x28, [x28, _BUFFER_LOCK_UNLOCK@GOTPAGEOFF]
Lloh23:
	adrp	x22, _InHotStandby@GOTPAGE
Lloh24:
	ldr	x22, [x22, _InHotStandby@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x20
	bl	_UnlockBufHdr
	str	xzr, [x24]
	ldr	w1, [x25]
	mov	x0, x19
	bl	_LockBuffer
	mov	x0, x20
	bl	_LockBufHdr
	mov	x23, x0
	bl	_BUF_STATE_GET_REFCOUNT
	cmp	w0, #0
	cset	w0, gt
	bl	_Assert
	mov	x0, x23
	bl	_BUF_STATE_GET_REFCOUNT
	cmp	w0, #1
	b.eq	LBB0_7
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x26]
	tst	w8, w23
	b.eq	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x20
	mov	x1, x23
	bl	_UnlockBufHdr
	ldr	w1, [x28]
	mov	x0, x19
	bl	_LockBuffer
Lloh25:
	adrp	x8, _ERROR@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh27:
	ldr	w0, [x8]
Lloh28:
	adrp	x1, l_.str.1@PAGE
Lloh29:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_elog
	ldr	w8, [x26]
LBB0_12:                                ;   in Loop: Header=BB0_10 Depth=1
	ldr	x9, [x27]
	str	x9, [x20]
	str	x20, [x24]
	orr	w1, w8, w23
	mov	x0, x20
	bl	_UnlockBufHdr
	ldr	w1, [x28]
	mov	x0, x19
	bl	_LockBuffer
	ldr	x8, [x22]
	cbz	x8, LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x21
	bl	_SetStartupBufferPinWaitBufId
	bl	_ResolveRecoveryConflictWithBufferPin
	mov	w0, #-1
	bl	_SetStartupBufferPinWaitBufId
	b	LBB0_15
LBB0_14:                                ;   in Loop: Header=BB0_10 Depth=1
Lloh30:
	adrp	x8, _PG_WAIT_BUFFER_PIN@GOTPAGE
Lloh31:
	ldr	x8, [x8, _PG_WAIT_BUFFER_PIN@GOTPAGEOFF]
Lloh32:
	ldr	w0, [x8]
	bl	_ProcWaitForSignal
LBB0_15:                                ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x20
	bl	_LockBufHdr
	mov	x1, x0
	ldr	w8, [x26]
	tst	w8, w0
	b.eq	LBB0_9
; %bb.16:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x9, [x20]
	ldr	x10, [x27]
	cmp	x9, x10
	bic	w8, w1, w8
	csel	w1, w1, w8, ne
	b	LBB0_9
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_PinCountWaitBuf,8,3            ; @PinCountWaitBuf
	.comm	_LocalRefCount,8,3              ; @LocalRefCount
	.comm	_ERROR,4,2                      ; @ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"incorrect local pin count: %d"

	.comm	_BUFFER_LOCK_EXCLUSIVE,4,2      ; @BUFFER_LOCK_EXCLUSIVE
	.comm	_BM_PIN_COUNT_WAITER,4,2        ; @BM_PIN_COUNT_WAITER
	.comm	_BUFFER_LOCK_UNLOCK,4,2         ; @BUFFER_LOCK_UNLOCK
l_.str.1:                               ; @.str.1
	.asciz	"multiple backends attempting to wait for pincount 1"

	.comm	_MyProcPid,8,3                  ; @MyProcPid
	.comm	_InHotStandby,8,3               ; @InHotStandby
	.comm	_PG_WAIT_BUFFER_PIN,4,2         ; @PG_WAIT_BUFFER_PIN
.subsections_via_symbols
