	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function AdvanceXLInsertBuffer
_AdvanceXLInsertBuffer:                 ## @AdvanceXLInsertBuffer
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	_XLogCtl@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	_WALBufMappingLock@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_LW_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_LWLockAcquire
	movq	(%r14), %rax
	movq	(%rax), %r13
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	testl	%ebx, %ebx
	jne	LBB0_2
## %bb.1:
	cmpq	-56(%rbp), %r13                 ## 8-byte Folded Reload
	jle	LBB0_2
LBB0_20:
	movq	_WALBufMappingLock@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_LWLockRelease                  ## TAILCALL
LBB0_2:
	movq	_LogwrtResult@GOTPCREL(%rip), %r15
	jmp	LBB0_3
LBB0_17:                                ##   in Loop: Header=BB0_3 Depth=1
	xorl	%eax, %eax
	callq	_TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START
	xorl	%edi, %edi
	movq	%r13, %rsi
	xorl	%edx, %edx
	callq	_XLogWrite
	movl	(%r12), %edi
	callq	_LWLockRelease
	xorl	%eax, %eax
	callq	_TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE
LBB0_18:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_WALBufMappingLock@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_LW_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_LWLockAcquire
	movq	(%r14), %rax
	movq	(%rax), %r13
LBB0_19:                                ##   in Loop: Header=BB0_3 Depth=1
	cmpq	-56(%rbp), %r13                 ## 8-byte Folded Reload
	jg	LBB0_20
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	callq	_XLogRecPtrToBufIdx
	movl	%eax, %r12d
	movq	(%r14), %rdi
	movq	8(%rdi), %rax
	movslq	%r12d, %rbx
	movq	(%rax,%rbx,8), %r13
	cmpq	%r13, (%r15)
	jge	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_20
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	addq	$32, %rdi
	callq	_SpinLockAcquire
	movq	(%r14), %rdi
	cmpq	%r13, 40(%rdi)
	jge	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r13, 40(%rdi)
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	24(%rdi), %rax
	movq	%rax, (%r15)
	addq	$32, %rdi
	callq	_SpinLockRelease
	cmpq	%r13, (%r15)
	jge	LBB0_9
## %bb.15:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_WALBufMappingLock@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_LWLockRelease
	movq	%r13, %rdi
	callq	_WaitXLogInsertionsToFinish
	movq	_WALWriteLock@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	movq	_LW_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_LWLockAcquire
	movq	(%r14), %rax
	movq	24(%rax), %rax
	movq	%rax, (%r15)
	cmpq	%r13, %rax
	jl	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r12), %edi
	callq	_LWLockRelease
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	(%r14), %rdi
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	(%rdi), %rbx
	movq	_XLOG_BLCKSZ@GOTPCREL(%rip), %r15
	movq	(%r15), %r13
	addq	%rbx, %r13
	movq	%rbx, %rdi
	callq	_XLogRecPtrToBufIdx
	xorl	%edi, %edi
	cmpl	%r12d, %eax
	sete	%dil
	callq	_Assert
	movq	(%r14), %rax
	movq	16(%rax), %r14
	movq	(%r15), %rdx
	movl	%edx, %eax
	imull	%r12d, %eax
	movslq	%eax, %r15
	leaq	(%r14,%r15), %r12
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_MemSet
	movq	_XLOG_PAGE_MAGIC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%r14,%r15)
	movq	_ThisTimeLineID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r14,%r15)
	movq	%rbx, 8(%r14,%r15)
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	cmpl	$0, 48(%rax)
	jne	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_XLP_BKP_REMOVABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r12)
LBB0_12:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_wal_segment_size@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_XLogSegmentOffset
	testq	%rax, %rax
	movq	_LogwrtResult@GOTPCREL(%rip), %r15
	jne	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_ControlFile@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r12)
	movq	_wal_segment_size@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r12)
	movq	_XLOG_BLCKSZ@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r12)
	movq	_XLP_LONG_HEADER@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%r12)
LBB0_14:                                ##   in Loop: Header=BB0_3 Depth=1
	xorl	%eax, %eax
	callq	_pg_write_barrier
	movq	_XLogCtl@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	movq	8(%rax), %rcx
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movq	%r13, (%rcx,%rdx,8)
	movq	%r13, (%rax)
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_19
	jmp	LBB0_3
	.cfi_endproc
                                        ## -- End function
	.comm	_XLogCtl,8,3                    ## @XLogCtl
	.comm	_InvalidXLogRecPtr,8,3          ## @InvalidXLogRecPtr
	.comm	_WALBufMappingLock,4,2          ## @WALBufMappingLock
	.comm	_LW_EXCLUSIVE,4,2               ## @LW_EXCLUSIVE
	.comm	_LogwrtResult,8,3               ## @LogwrtResult
	.comm	_WALWriteLock,4,2               ## @WALWriteLock
	.comm	_XLOG_BLCKSZ,8,3                ## @XLOG_BLCKSZ
	.comm	_XLOG_PAGE_MAGIC,4,2            ## @XLOG_PAGE_MAGIC
	.comm	_ThisTimeLineID,4,2             ## @ThisTimeLineID
	.comm	_XLP_BKP_REMOVABLE,4,2          ## @XLP_BKP_REMOVABLE
	.comm	_wal_segment_size,4,2           ## @wal_segment_size
	.comm	_ControlFile,8,3                ## @ControlFile
	.comm	_XLP_LONG_HEADER,4,2            ## @XLP_LONG_HEADER
	.comm	_DEBUG1,4,2                     ## @DEBUG1
	.comm	_XLOG_DEBUG,8,3                 ## @XLOG_DEBUG
	.no_dead_strip	_AdvanceXLInsertBuffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function AdvanceXLInsertBuffer
_AdvanceXLInsertBuffer:                 ; @AdvanceXLInsertBuffer
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, x1
	mov	x20, x0
Lloh0:
	adrp	x23, _XLogCtl@GOTPAGE
Lloh1:
	ldr	x23, [x23, _XLogCtl@GOTPAGEOFF]
	ldr	x25, [x23]
Lloh2:
	adrp	x8, _WALBufMappingLock@GOTPAGE
Lloh3:
	ldr	x8, [x8, _WALBufMappingLock@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
Lloh5:
	adrp	x8, _LW_EXCLUSIVE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _LW_EXCLUSIVE@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_LWLockAcquire
	ldr	x8, [x23]
	ldr	x21, [x8]
	cbnz	w19, LBB0_3
; %bb.1:
	cmp	x21, x20
	b.le	LBB0_3
LBB0_2:
Lloh8:
	adrp	x8, _WALBufMappingLock@GOTPAGE
Lloh9:
	ldr	x8, [x8, _WALBufMappingLock@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_LWLockRelease
LBB0_3:
Lloh11:
	adrp	x27, _LogwrtResult@GOTPAGE
Lloh12:
	ldr	x27, [x27, _LogwrtResult@GOTPAGEOFF]
Lloh13:
	adrp	x28, _XLOG_BLCKSZ@GOTPAGE
Lloh14:
	ldr	x28, [x28, _XLOG_BLCKSZ@GOTPAGEOFF]
	b	LBB0_7
LBB0_4:                                 ;   in Loop: Header=BB0_7 Depth=1
	bl	_TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START
	mov	x0, #0
	mov	x1, x21
	mov	w2, #0
	bl	_XLogWrite
	ldr	w0, [x22]
	bl	_LWLockRelease
	bl	_TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
Lloh15:
	adrp	x8, _WALBufMappingLock@GOTPAGE
Lloh16:
	ldr	x8, [x8, _WALBufMappingLock@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
Lloh18:
	adrp	x8, _LW_EXCLUSIVE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _LW_EXCLUSIVE@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	bl	_LWLockAcquire
	ldr	x8, [x23]
	ldr	x21, [x8]
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	cmp	x21, x20
	b.gt	LBB0_2
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	bl	_XLogRecPtrToBufIdx
	mov	x22, x0
	ldr	x8, [x23]
	ldr	x9, [x8, #8]
	ldr	x21, [x9, w0, sxtw #3]
	ldr	x9, [x27]
	cmp	x9, x21
	b.ge	LBB0_15
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	cbnz	w19, LBB0_2
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	add	x0, x8, #32
	bl	_SpinLockAcquire
	ldr	x8, [x23]
	ldr	x9, [x8, #40]
	cmp	x9, x21
	b.ge	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	str	x21, [x8, #40]
LBB0_11:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	x9, [x8, #24]
	str	x9, [x27]
	add	x0, x8, #32
	bl	_SpinLockRelease
	ldr	x8, [x27]
	cmp	x8, x21
	b.ge	LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_7 Depth=1
Lloh21:
	adrp	x8, _WALBufMappingLock@GOTPAGE
Lloh22:
	ldr	x8, [x8, _WALBufMappingLock@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	bl	_LWLockRelease
	mov	x0, x21
	bl	_WaitXLogInsertionsToFinish
Lloh24:
	adrp	x22, _WALWriteLock@GOTPAGE
Lloh25:
	ldr	x22, [x22, _WALWriteLock@GOTPAGEOFF]
	ldr	w0, [x22]
Lloh26:
	adrp	x8, _LW_EXCLUSIVE@GOTPAGE
Lloh27:
	ldr	x8, [x8, _LW_EXCLUSIVE@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	bl	_LWLockAcquire
	ldr	x8, [x23]
	ldr	x8, [x8, #24]
	str	x8, [x27]
	cmp	x8, x21
	b.lt	LBB0_4
; %bb.13:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	w0, [x22]
	bl	_LWLockRelease
	b	LBB0_5
LBB0_14:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x23]
LBB0_15:                                ;   in Loop: Header=BB0_7 Depth=1
	sxtw	x24, w22
	ldr	x21, [x8]
	ldr	x26, [x28]
	mov	x0, x21
	bl	_XLogRecPtrToBufIdx
	cmp	w0, w24
	cset	w0, eq
	bl	_Assert
	ldr	x8, [x23]
	ldr	x8, [x8, #16]
	ldr	x2, [x28]
	mul	w9, w24, w2
	add	x22, x8, w9, sxtw
	mov	x0, x22
	mov	w1, #0
	bl	_MemSet
Lloh29:
	adrp	x8, _XLOG_PAGE_MAGIC@GOTPAGE
Lloh30:
	ldr	x8, [x8, _XLOG_PAGE_MAGIC@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
Lloh32:
	adrp	x9, _ThisTimeLineID@GOTPAGE
Lloh33:
	ldr	x9, [x9, _ThisTimeLineID@GOTPAGEOFF]
Lloh34:
	ldr	w9, [x9]
	stp	w9, w8, [x22, #16]
	str	x21, [x22, #8]
	ldr	w8, [x25, #48]
	cbnz	w8, LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_7 Depth=1
Lloh35:
	adrp	x8, _XLP_BKP_REMOVABLE@GOTPAGE
Lloh36:
	ldr	x8, [x8, _XLP_BKP_REMOVABLE@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	ldr	w9, [x22]
	orr	w8, w9, w8
	str	w8, [x22]
LBB0_17:                                ;   in Loop: Header=BB0_7 Depth=1
Lloh38:
	adrp	x8, _wal_segment_size@GOTPAGE
Lloh39:
	ldr	x8, [x8, _wal_segment_size@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_XLogSegmentOffset
	cbnz	x0, LBB0_19
; %bb.18:                               ;   in Loop: Header=BB0_7 Depth=1
Lloh41:
	adrp	x8, _ControlFile@GOTPAGE
Lloh42:
	ldr	x8, [x8, _ControlFile@GOTPAGEOFF]
Lloh43:
	ldr	x8, [x8]
	ldr	w8, [x8]
Lloh44:
	adrp	x9, _wal_segment_size@GOTPAGE
Lloh45:
	ldr	x9, [x9, _wal_segment_size@GOTPAGEOFF]
Lloh46:
	ldr	w9, [x9]
	stp	w9, w8, [x22, #8]
	ldr	x8, [x28]
	str	x8, [x22]
Lloh47:
	adrp	x9, _XLP_LONG_HEADER@GOTPAGE
Lloh48:
	ldr	x9, [x9, _XLP_LONG_HEADER@GOTPAGEOFF]
Lloh49:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x22]
LBB0_19:                                ;   in Loop: Header=BB0_7 Depth=1
	add	x21, x26, x21
	bl	_pg_write_barrier
	ldr	x8, [x23]
	ldr	x9, [x8, #8]
	str	x21, [x9, x24, lsl #3]
	str	x21, [x8]
	cbz	w19, LBB0_6
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_XLogCtl,8,3                    ; @XLogCtl
	.comm	_InvalidXLogRecPtr,8,3          ; @InvalidXLogRecPtr
	.comm	_WALBufMappingLock,4,2          ; @WALBufMappingLock
	.comm	_LW_EXCLUSIVE,4,2               ; @LW_EXCLUSIVE
	.comm	_LogwrtResult,8,3               ; @LogwrtResult
	.comm	_WALWriteLock,4,2               ; @WALWriteLock
	.comm	_XLOG_BLCKSZ,8,3                ; @XLOG_BLCKSZ
	.comm	_XLOG_PAGE_MAGIC,4,2            ; @XLOG_PAGE_MAGIC
	.comm	_ThisTimeLineID,4,2             ; @ThisTimeLineID
	.comm	_XLP_BKP_REMOVABLE,4,2          ; @XLP_BKP_REMOVABLE
	.comm	_wal_segment_size,4,2           ; @wal_segment_size
	.comm	_ControlFile,8,3                ; @ControlFile
	.comm	_XLP_LONG_HEADER,4,2            ; @XLP_LONG_HEADER
	.comm	_DEBUG1,4,2                     ; @DEBUG1
	.comm	_XLOG_DEBUG,8,3                 ; @XLOG_DEBUG
	.no_dead_strip	_AdvanceXLInsertBuffer
.subsections_via_symbols
