	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function GetXLogBuffer
_GetXLogBuffer:                         ## @GetXLogBuffer
	.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
	movq	%rdi, %rbx
	movq	_XLOG_BLCKSZ@GOTPCREL(%rip), %r15
	movq	(%r15), %rcx
	movq	%rdi, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_1
## %bb.2:
	movq	%rbx, %rax
	cqto
	idivq	%rcx
	cmpq	_GetXLogBuffer.cachedPage(%rip), %rax
	jne	LBB0_5
LBB0_4:
	movq	_GetXLogBuffer.cachedPos(%rip), %rax
	jmp	LBB0_27
LBB0_1:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
	cmpq	_GetXLogBuffer.cachedPage(%rip), %rax
	je	LBB0_4
LBB0_5:
	movq	%rbx, %rdi
	callq	_XLogRecPtrToBufIdx
	movl	%eax, %r14d
	movq	(%r15), %r13
	movq	%rbx, %rax
	orq	%r13, %rax
	shrq	$32, %rax
	je	LBB0_6
## %bb.7:
	movq	%rbx, %rax
	cqto
	idivq	%r13
	jmp	LBB0_8
LBB0_6:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%r13d
                                        ## kill: def $edx killed $edx def $rdx
LBB0_8:
	subq	%rdx, %r13
	addq	%rbx, %r13
	movq	_XLogCtl@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax), %rax
	movslq	%r14d, %r12
	cmpq	(%rax,%r12,8), %r13
	jne	LBB0_9
## %bb.21:
	xorl	%eax, %eax
	callq	_pg_memory_barrier
	jmp	LBB0_22
LBB0_9:
	movq	_SizeOfXLogShortPHD@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	jne	LBB0_15
## %bb.10:
	movq	_wal_segment_size@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_XLogSegmentOffset
	movq	(%r15), %rcx
	cmpq	%rcx, %rax
	jle	LBB0_11
## %bb.13:
	movq	%rbx, %rdi
	movq	_SizeOfXLogShortPHD@GOTPCREL(%rip), %rax
	jmp	LBB0_18
LBB0_11:
	movq	%rbx, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_12
## %bb.14:
	movq	%rbx, %rax
	cqto
	idivq	%rcx
	jmp	LBB0_15
LBB0_12:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_15:
	movq	_SizeOfXLogLongPHD@GOTPCREL(%rip), %rax
	movq	%rbx, %rdi
	cmpq	(%rax), %rdx
	jne	LBB0_19
## %bb.16:
	movq	_wal_segment_size@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_XLogSegmentOffset
	movq	%rbx, %rdi
	cmpq	(%r15), %rax
	movq	_SizeOfXLogLongPHD@GOTPCREL(%rip), %rax
	jge	LBB0_19
## %bb.17:
	movq	%rbx, %rdi
LBB0_18:
	subq	(%rax), %rdi
LBB0_19:
	callq	_WALInsertLockUpdateInsertingAt
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_AdvanceXLInsertBuffer
	movq	_XLogCtl@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rax
	movq	(%rax), %rax
	cmpq	(%rax,%r12,8), %r13
	je	LBB0_23
## %bb.20:
	movq	_PANIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rdx
	shrq	$32, %rdx
	leaq	L_.str(%rip), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	movl	%ebx, %ecx
	callq	_elog
LBB0_22:
	movq	_XLogCtl@GOTPCREL(%rip), %rsi
LBB0_23:
	movq	(%r15), %rcx
	movq	%rbx, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_24
## %bb.25:
	movq	%rbx, %rax
	cqto
	idivq	%rcx
	jmp	LBB0_26
LBB0_24:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
LBB0_26:
	movq	%rax, _GetXLogBuffer.cachedPage(%rip)
	movq	(%rsi), %rdx
	imull	%ecx, %r14d
	movslq	%r14d, %rax
	addq	8(%rdx), %rax
	movq	%rax, _GetXLogBuffer.cachedPos(%rip)
LBB0_27:
	movq	(%rax), %rax
	movq	_XLOG_PAGE_MAGIC@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	callq	_Assert
	movq	_GetXLogBuffer.cachedPos(%rip), %rax
	movq	8(%rax), %rcx
	movq	(%r15), %rsi
	movq	%rbx, %rax
	orq	%rsi, %rax
	shrq	$32, %rax
	je	LBB0_28
## %bb.29:
	movq	%rbx, %rax
	cqto
	idivq	%rsi
	jmp	LBB0_30
LBB0_28:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%esi
                                        ## kill: def $edx killed $edx def $rdx
LBB0_30:
	movq	%rbx, %rax
	subq	%rdx, %rax
	xorl	%edi, %edi
	cmpq	%rax, %rcx
	sete	%dil
	callq	_Assert
	movq	_GetXLogBuffer.cachedPos(%rip), %rcx
	movq	(%r15), %rsi
	movq	%rbx, %rax
	orq	%rsi, %rax
	shrq	$32, %rax
	je	LBB0_31
## %bb.32:
	movq	%rbx, %rax
	cqto
	idivq	%rsi
	jmp	LBB0_33
LBB0_31:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%esi
                                        ## kill: def $edx killed $edx def $rdx
LBB0_33:
	addq	%rdx, %rcx
	movq	%rcx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_GetXLogBuffer.cachedPage,8,3 ## @GetXLogBuffer.cachedPage
.zerofill __DATA,__bss,_GetXLogBuffer.cachedPos,8,3 ## @GetXLogBuffer.cachedPos
	.comm	_XLOG_BLCKSZ,8,3                ## @XLOG_BLCKSZ
	.comm	_XLOG_PAGE_MAGIC,8,3            ## @XLOG_PAGE_MAGIC
	.comm	_XLogCtl,8,3                    ## @XLogCtl
	.comm	_SizeOfXLogShortPHD,8,3         ## @SizeOfXLogShortPHD
	.comm	_wal_segment_size,4,2           ## @wal_segment_size
	.comm	_SizeOfXLogLongPHD,8,3          ## @SizeOfXLogLongPHD
	.comm	_PANIC,4,2                      ## @PANIC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not find WAL buffer for %X/%X"

	.no_dead_strip	_GetXLogBuffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function GetXLogBuffer
_GetXLogBuffer:                         ; @GetXLogBuffer
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
Lloh0:
	adrp	x20, _XLOG_BLCKSZ@GOTPAGE
Lloh1:
	ldr	x20, [x20, _XLOG_BLCKSZ@GOTPAGEOFF]
	ldr	x8, [x20]
	sdiv	x8, x0, x8
	adrp	x22, _GetXLogBuffer.cachedPage@PAGE
	ldr	x9, [x22, _GetXLogBuffer.cachedPage@PAGEOFF]
	adrp	x21, _GetXLogBuffer.cachedPos@PAGE
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	ldr	x8, [x21, _GetXLogBuffer.cachedPos@PAGEOFF]
	b	LBB0_13
LBB0_2:
	mov	x0, x19
	bl	_XLogRecPtrToBufIdx
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	x9, [x20]
	sdiv	x8, x19, x9
	msub	x8, x8, x9, x19
	sub	x9, x9, x8
	add	x25, x9, x19
Lloh2:
	adrp	x23, _XLogCtl@GOTPAGE
Lloh3:
	ldr	x23, [x23, _XLogCtl@GOTPAGEOFF]
	ldr	x9, [x23]
	ldr	x9, [x9]
	sxtw	x24, w0
	ldr	x9, [x9, w0, sxtw #3]
	cmp	x25, x9
	b.ne	LBB0_4
; %bb.3:
	bl	_pg_memory_barrier
	b	LBB0_12
LBB0_4:
Lloh4:
	adrp	x26, _SizeOfXLogShortPHD@GOTPAGE
Lloh5:
	ldr	x26, [x26, _SizeOfXLogShortPHD@GOTPAGEOFF]
	ldr	x9, [x26]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.5:
Lloh6:
	adrp	x8, _wal_segment_size@GOTPAGE
Lloh7:
	ldr	x8, [x8, _wal_segment_size@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_XLogSegmentOffset
	ldr	x8, [x20]
	cmp	x0, x8
	b.gt	LBB0_9
; %bb.6:
	sdiv	x9, x19, x8
	msub	x8, x9, x8, x19
LBB0_7:
Lloh9:
	adrp	x26, _SizeOfXLogLongPHD@GOTPAGE
Lloh10:
	ldr	x26, [x26, _SizeOfXLogLongPHD@GOTPAGEOFF]
	ldr	x9, [x26]
	mov	x0, x19
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.8:
Lloh11:
	adrp	x8, _wal_segment_size@GOTPAGE
Lloh12:
	ldr	x8, [x8, _wal_segment_size@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_XLogSegmentOffset
	mov	x8, x0
	ldr	x9, [x20]
	mov	x0, x19
	cmp	x8, x9
	b.ge	LBB0_10
LBB0_9:
	ldr	x8, [x26]
	sub	x0, x19, x8
LBB0_10:
	bl	_WALInsertLockUpdateInsertingAt
	mov	x0, x19
	mov	w1, #0
	bl	_AdvanceXLInsertBuffer
	ldr	x8, [x23]
	ldr	x8, [x8]
	ldr	x8, [x8, x24, lsl #3]
	cmp	x25, x8
	b.eq	LBB0_12
; %bb.11:
Lloh14:
	adrp	x8, _PANIC@GOTPAGE
Lloh15:
	ldr	x8, [x8, _PANIC@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	lsr	x2, x19, #32
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
                                        ; kill: def $w2 killed $w2 killed $x2
	mov	x3, x19
	bl	_elog
LBB0_12:
	ldr	x8, [x20]
	sdiv	x9, x19, x8
	str	x9, [x22, _GetXLogBuffer.cachedPage@PAGEOFF]
	ldr	x9, [x23]
	ldr	x9, [x9, #8]
	mul	w8, w24, w8
	add	x8, x9, w8, sxtw
	str	x8, [x21, _GetXLogBuffer.cachedPos@PAGEOFF]
LBB0_13:
	ldr	x8, [x8]
Lloh19:
	adrp	x9, _XLOG_PAGE_MAGIC@GOTPAGE
Lloh20:
	ldr	x9, [x9, _XLOG_PAGE_MAGIC@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	ldr	x8, [x21, _GetXLogBuffer.cachedPos@PAGEOFF]
	ldr	x8, [x8, #8]
	ldr	x9, [x20]
	sdiv	x10, x19, x9
	mul	x9, x10, x9
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	ldr	x8, [x21, _GetXLogBuffer.cachedPos@PAGEOFF]
	ldr	x9, [x20]
	sdiv	x10, x19, x9
	msub	x9, x10, x9, x19
	add	x0, x8, x9
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_GetXLogBuffer.cachedPage,8,3 ; @GetXLogBuffer.cachedPage
.zerofill __DATA,__bss,_GetXLogBuffer.cachedPos,8,3 ; @GetXLogBuffer.cachedPos
	.comm	_XLOG_BLCKSZ,8,3                ; @XLOG_BLCKSZ
	.comm	_XLOG_PAGE_MAGIC,8,3            ; @XLOG_PAGE_MAGIC
	.comm	_XLogCtl,8,3                    ; @XLogCtl
	.comm	_SizeOfXLogShortPHD,8,3         ; @SizeOfXLogShortPHD
	.comm	_wal_segment_size,4,2           ; @wal_segment_size
	.comm	_SizeOfXLogLongPHD,8,3          ; @SizeOfXLogLongPHD
	.comm	_PANIC,4,2                      ; @PANIC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not find WAL buffer for %X/%X"

	.no_dead_strip	_GetXLogBuffer
.subsections_via_symbols
