	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_replorigin_advance             ## -- Begin function replorigin_advance
	.p2align	4, 0x90
_replorigin_advance:                    ## @replorigin_advance
	.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	%r8d, %r13d
	movl	%ecx, %r14d
	movq	%rdx, %rbx
	movq	%rsi, %r12
	movq	%rdi, %r15
	movq	_InvalidRepOriginId@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpq	%r15, (%rax)
	setne	%dil
	callq	_Assert
	movq	_DoNotReplicateId@GOTPCREL(%rip), %rax
	cmpq	%r15, (%rax)
	je	LBB0_21
## %bb.1:
	movl	%r13d, -48(%rbp)                ## 4-byte Spill
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	_ReplicationOriginLock@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_LW_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_LWLockAcquire
	movq	_max_replication_slots@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_10
## %bb.2:
	movq	_replication_states@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r14
	movq	_InvalidRepOriginId@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	xorl	%edx, %edx
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%rdx, %r13
	cmpq	%r15, %rsi
	je	LBB0_6
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	addq	$40, %r14
	movq	%r13, %rdx
	decq	%rax
	je	LBB0_9
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rsi
	cmpq	%rcx, %rsi
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r14, %r13
	testq	%rdx, %rdx
	je	LBB0_8
	jmp	LBB0_5
LBB0_9:
	testq	%r13, %r13
	jne	LBB0_11
LBB0_10:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_ERRCODE_CONFIGURATION_LIMIT_EXCEEDED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_errcode
	leaq	L_.str.1(%rip), %rdi
	xorl	%r13d, %r13d
	movq	%r15, %rsi
	xorl	%eax, %eax
	callq	_errmsg
	leaq	L_.str.2(%rip), %rdi
	callq	_errhint
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_ereport
LBB0_11:
	leaq	32(%r13), %rdi
	movq	_LW_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_LWLockAcquire
	movq	16(%r13), %rax
	movq	_InvalidXLogRecPtr@GOTPCREL(%rip), %r14
	xorl	%edi, %edi
	cmpq	(%r14), %rax
	sete	%dil
	callq	_Assert
	movq	24(%r13), %rax
	xorl	%edi, %edi
	cmpq	(%r14), %rax
	sete	%dil
	callq	_Assert
	movq	%r15, (%r13)
	movq	%r13, %r14
LBB0_12:
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	movq	(%r14), %rax
	xorl	%edi, %edi
	movq	_InvalidRepOriginId@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	setne	%dil
	callq	_Assert
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_14
## %bb.13:
	movq	%r12, -56(%rbp)
	movq	%r15, -64(%rbp)
	movl	%r13d, -72(%rbp)
	xorl	%eax, %eax
	callq	_XLogBeginInsert
	leaq	-72(%rbp), %rdi
	movl	$24, %esi
	callq	_XLogRegisterData
	movq	_RM_REPLORIGIN_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_XLOG_REPLORIGIN_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_XLogInsert
LBB0_14:
	testl	%r13d, %r13d
	je	LBB0_15
## %bb.22:
	movq	%r12, 16(%r14)
	movq	_InvalidXLogRecPtr@GOTPCREL(%rip), %rax
	cmpq	%rbx, (%rax)
	jne	LBB0_19
	jmp	LBB0_20
LBB0_15:
	cmpq	%r12, 16(%r14)
	jge	LBB0_17
## %bb.16:
	movq	%r12, 16(%r14)
LBB0_17:
	movq	_InvalidXLogRecPtr@GOTPCREL(%rip), %rax
	cmpq	%rbx, (%rax)
	je	LBB0_20
## %bb.18:
	cmpq	%rbx, 24(%r14)
	jge	LBB0_20
LBB0_19:
	movq	%rbx, 24(%r14)
LBB0_20:
	addq	$32, %r14
	movq	%r14, %rdi
	callq	_LWLockRelease
	movq	_ReplicationOriginLock@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_LWLockRelease
LBB0_21:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	leaq	32(%r14), %rdi
	movq	_LW_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_LWLockAcquire
	cmpq	$0, 8(%r14)
	je	LBB0_12
## %bb.7:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	_ERRCODE_OBJECT_IN_USE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_errcode
	movq	(%r14), %rsi
	movq	8(%r14), %rdx
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_errmsg
	movl	%r13d, %edi
	movl	%eax, %esi
	callq	_ereport
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_InvalidRepOriginId,8,3         ## @InvalidRepOriginId
	.comm	_DoNotReplicateId,8,3           ## @DoNotReplicateId
	.comm	_ReplicationOriginLock,8,3      ## @ReplicationOriginLock
	.comm	_LW_EXCLUSIVE,4,2               ## @LW_EXCLUSIVE
	.comm	_max_replication_slots,4,2      ## @max_replication_slots
	.comm	_replication_states,8,3         ## @replication_states
	.comm	_ERROR,4,2                      ## @ERROR
	.comm	_ERRCODE_OBJECT_IN_USE,4,2      ## @ERRCODE_OBJECT_IN_USE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"replication origin with OID %d is already active for PID %d"

	.comm	_ERRCODE_CONFIGURATION_LIMIT_EXCEEDED,4,2 ## @ERRCODE_CONFIGURATION_LIMIT_EXCEEDED
L_.str.1:                               ## @.str.1
	.asciz	"could not find free replication state slot for replication origin with OID %u"

L_.str.2:                               ## @.str.2
	.asciz	"Increase max_replication_slots and try again."

	.comm	_InvalidXLogRecPtr,8,3          ## @InvalidXLogRecPtr
	.comm	_RM_REPLORIGIN_ID,4,2           ## @RM_REPLORIGIN_ID
	.comm	_XLOG_REPLORIGIN_SET,4,2        ## @XLOG_REPLORIGIN_SET
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_replorigin_advance             ; -- Begin function replorigin_advance
	.p2align	2
_replorigin_advance:                    ; @replorigin_advance
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x23, x4
	mov	x21, x3
	mov	x19, x2
	mov	x20, x1
	mov	x22, x0
Lloh0:
	adrp	x27, _InvalidRepOriginId@GOTPAGE
Lloh1:
	ldr	x27, [x27, _InvalidRepOriginId@GOTPAGEOFF]
	ldr	x8, [x27]
	cmp	x8, x0
	cset	w0, ne
	bl	_Assert
Lloh2:
	adrp	x8, _DoNotReplicateId@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DoNotReplicateId@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x8, x22
	b.eq	LBB0_21
; %bb.1:
Lloh5:
	adrp	x8, _ReplicationOriginLock@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ReplicationOriginLock@GOTPAGEOFF]
Lloh7:
	ldr	x0, [x8]
Lloh8:
	adrp	x25, _LW_EXCLUSIVE@GOTPAGE
Lloh9:
	ldr	x25, [x25, _LW_EXCLUSIVE@GOTPAGEOFF]
	ldr	w1, [x25]
	bl	_LWLockAcquire
Lloh10:
	adrp	x8, _max_replication_slots@GOTPAGE
Lloh11:
	ldr	x8, [x8, _max_replication_slots@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x26, _InvalidXLogRecPtr@GOTPAGE
Lloh14:
	ldr	x26, [x26, _InvalidXLogRecPtr@GOTPAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.2:
	mov	x10, #0
Lloh15:
	adrp	x9, _replication_states@GOTPAGE
Lloh16:
	ldr	x9, [x9, _replication_states@GOTPAGEOFF]
Lloh17:
	ldr	x28, [x9]
	ldr	x9, [x27]
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x28, x28, #40
	mov	x10, x24
	subs	x8, x8, #1
	b.eq	LBB0_8
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x28]
	cmp	x11, x9
	ccmp	x10, #0, #0, eq
	mov	x24, x28
	b.eq	LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x24, x10
	cmp	x11, x22
	b.ne	LBB0_3
; %bb.6:
	add	x0, x28, #32
	ldr	w1, [x25]
	bl	_LWLockAcquire
	ldr	x8, [x28, #8]
	cbz	x8, LBB0_11
; %bb.7:
Lloh18:
	adrp	x8, _ERROR@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh20:
	ldr	w24, [x8]
Lloh21:
	adrp	x8, _ERRCODE_OBJECT_IN_USE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ERRCODE_OBJECT_IN_USE@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	bl	_errcode
	ldp	x1, x8, [x28]
	str	x8, [sp]
Lloh24:
	adrp	x0, l_.str@PAGE
Lloh25:
	add	x0, x0, l_.str@PAGEOFF
	bl	_errmsg
	mov	x1, x0
	mov	x0, x24
	bl	_ereport
	b	LBB0_11
LBB0_8:
	cbnz	x24, LBB0_10
LBB0_9:
Lloh26:
	adrp	x8, _ERROR@GOTPAGE
Lloh27:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh28:
	ldr	w24, [x8]
Lloh29:
	adrp	x8, _ERRCODE_CONFIGURATION_LIMIT_EXCEEDED@GOTPAGE
Lloh30:
	ldr	x8, [x8, _ERRCODE_CONFIGURATION_LIMIT_EXCEEDED@GOTPAGEOFF]
Lloh31:
	ldr	w0, [x8]
	bl	_errcode
Lloh32:
	adrp	x0, l_.str.1@PAGE
Lloh33:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x22
	bl	_errmsg
Lloh34:
	adrp	x0, l_.str.2@PAGE
Lloh35:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_errhint
	mov	x1, x0
	mov	x0, x24
	bl	_ereport
	mov	x24, #0
LBB0_10:
	add	x0, x24, #32
	ldr	w1, [x25]
	bl	_LWLockAcquire
	ldr	x8, [x24, #16]
	ldr	x9, [x26]
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	ldr	x8, [x24, #24]
	ldr	x9, [x26]
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	str	x22, [x24]
	mov	x28, x24
LBB0_11:
	ldr	x8, [x28]
	ldr	x9, [x27]
	cmp	x8, x9
	cset	w0, ne
	bl	_Assert
	cbz	w23, LBB0_13
; %bb.12:
	stp	x22, x20, [sp, #16]
	str	w21, [sp, #8]
	bl	_XLogBeginInsert
	add	x0, sp, #8
	mov	w1, #24
	bl	_XLogRegisterData
Lloh36:
	adrp	x8, _RM_REPLORIGIN_ID@GOTPAGE
Lloh37:
	ldr	x8, [x8, _RM_REPLORIGIN_ID@GOTPAGEOFF]
Lloh38:
	ldr	w0, [x8]
Lloh39:
	adrp	x8, _XLOG_REPLORIGIN_SET@GOTPAGE
Lloh40:
	ldr	x8, [x8, _XLOG_REPLORIGIN_SET@GOTPAGEOFF]
Lloh41:
	ldr	w1, [x8]
	bl	_XLogInsert
LBB0_13:
	cbz	w21, LBB0_15
; %bb.14:
	str	x20, [x28, #16]
	ldr	x8, [x26]
	cmp	x8, x19
	b.ne	LBB0_19
	b	LBB0_20
LBB0_15:
	ldr	x8, [x28, #16]
	cmp	x8, x20
	b.ge	LBB0_17
; %bb.16:
	str	x20, [x28, #16]
LBB0_17:
	ldr	x8, [x26]
	cmp	x8, x19
	b.eq	LBB0_20
; %bb.18:
	ldr	x8, [x28, #24]
	cmp	x8, x19
	b.ge	LBB0_20
LBB0_19:
	str	x19, [x28, #24]
LBB0_20:
	add	x0, x28, #32
	bl	_LWLockRelease
Lloh42:
	adrp	x8, _ReplicationOriginLock@GOTPAGE
Lloh43:
	ldr	x8, [x8, _ReplicationOriginLock@GOTPAGEOFF]
Lloh44:
	ldr	x0, [x8]
	bl	_LWLockRelease
LBB0_21:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.cfi_endproc
                                        ; -- End function
	.comm	_InvalidRepOriginId,8,3         ; @InvalidRepOriginId
	.comm	_DoNotReplicateId,8,3           ; @DoNotReplicateId
	.comm	_ReplicationOriginLock,8,3      ; @ReplicationOriginLock
	.comm	_LW_EXCLUSIVE,4,2               ; @LW_EXCLUSIVE
	.comm	_max_replication_slots,4,2      ; @max_replication_slots
	.comm	_replication_states,8,3         ; @replication_states
	.comm	_ERROR,4,2                      ; @ERROR
	.comm	_ERRCODE_OBJECT_IN_USE,4,2      ; @ERRCODE_OBJECT_IN_USE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"replication origin with OID %d is already active for PID %d"

	.comm	_ERRCODE_CONFIGURATION_LIMIT_EXCEEDED,4,2 ; @ERRCODE_CONFIGURATION_LIMIT_EXCEEDED
l_.str.1:                               ; @.str.1
	.asciz	"could not find free replication state slot for replication origin with OID %u"

l_.str.2:                               ; @.str.2
	.asciz	"Increase max_replication_slots and try again."

	.comm	_InvalidXLogRecPtr,8,3          ; @InvalidXLogRecPtr
	.comm	_RM_REPLORIGIN_ID,4,2           ; @RM_REPLORIGIN_ID
	.comm	_XLOG_REPLORIGIN_SET,4,2        ; @XLOG_REPLORIGIN_SET
.subsections_via_symbols
