	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_replorigin_session_setup       ## -- Begin function replorigin_session_setup
	.p2align	4, 0x90
_replorigin_session_setup:              ## @replorigin_session_setup
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	cmpb	$0, _replorigin_session_setup.registered_cleanup(%rip)
	jne	LBB0_2
## %bb.1:
	movq	_ReplicationOriginExitCleanup@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	callq	_on_shmem_exit
	movb	$1, _replorigin_session_setup.registered_cleanup(%rip)
LBB0_2:
	movq	_max_replication_slots@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	$0, (%rax)
	setg	%dil
	callq	_Assert
	movq	_session_replication_state@GOTPCREL(%rip), %r12
	cmpq	$0, (%r12)
	je	LBB0_4
## %bb.3:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_errcode
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_errmsg
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_ereport
LBB0_4:
	movq	_ReplicationOriginLock@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_LW_EXCLUSIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_LWLockAcquire
	movq	_max_replication_slots@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	$-1, %r14d
	testl	%eax, %eax
	jle	LBB0_5
## %bb.6:
	movq	_replication_states@GOTPCREL(%rip), %rdx
	movq	_InvalidRepOriginId@GOTPCREL(%rip), %rdi
	xorl	%r15d, %r15d
	xorl	%r13d, %r13d
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	movl	%r13d, %r14d
LBB0_14:                                ##   in Loop: Header=BB0_7 Depth=1
	incq	%r13
	movslq	%eax, %rcx
	addq	$40, %r15
	cmpq	%rcx, %r13
	jge	LBB0_15
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rdx), %rbx
	movq	(%rbx,%r15), %rcx
	cmpq	(%rdi), %rcx
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	cmpl	$-1, %r14d
	je	LBB0_9
LBB0_10:                                ##   in Loop: Header=BB0_7 Depth=1
	cmpq	%rsi, %rcx
	jne	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	leaq	(%rbx,%r15), %rcx
	cmpq	$0, 8(%rbx,%r15)
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_ERRCODE_OBJECT_IN_USE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	callq	_errcode
	movq	(%rbx,%r15), %rsi
	movq	8(%rbx,%r15), %rdx
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_errmsg
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_ereport
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	_InvalidRepOriginId@GOTPCREL(%rip), %rdi
	movq	_replication_states@GOTPCREL(%rip), %rdx
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	_max_replication_slots@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_13:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	%rcx, (%r12)
	jmp	LBB0_14
LBB0_5:
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
LBB0_15:
	movq	(%r12), %rax
	testq	%rax, %rax
	jne	LBB0_18
## %bb.16:
	cmpl	$-1, %r14d
	jne	LBB0_18
## %bb.17:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_ERRCODE_CONFIGURATION_LIMIT_EXCEEDED@GOTPCREL(%rip), %rax
	movq	%rsi, %rbx
	movl	(%rax), %edi
	callq	_errcode
	leaq	L_.str.2(%rip), %rdi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_errmsg
	leaq	L_.str.3(%rip), %rdi
	callq	_errhint
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_ereport
	movq	(%r12), %rax
	jmp	LBB0_20
LBB0_18:
	testq	%rax, %rax
	jne	LBB0_20
## %bb.19:
	movq	_replication_states@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%r14d, %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rax,%rcx,8), %rdx
	movq	%rdx, (%r12)
	movq	16(%rax,%rcx,8), %rax
	movq	_InvalidXLogRecPtr@GOTPCREL(%rip), %r14
	movq	%rsi, %rbx
	xorl	%edi, %edi
	cmpq	(%r14), %rax
	sete	%dil
	callq	_Assert
	movq	(%r12), %rax
	movq	24(%rax), %rax
	xorl	%edi, %edi
	cmpq	(%r14), %rax
	sete	%dil
	callq	_Assert
	movq	(%r12), %rax
	movq	%rbx, (%rax)
LBB0_20:
	movq	(%rax), %rax
	movq	_InvalidRepOriginId@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setne	%dil
	callq	_Assert
	movq	_MyProcPid@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r12), %rcx
	movq	%rax, 8(%rcx)
	movq	_ReplicationOriginLock@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_LWLockRelease
	movq	(%r12), %rdi
	addq	$32, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ConditionVariableBroadcast     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_replorigin_session_setup.registered_cleanup,1,2 ## @replorigin_session_setup.registered_cleanup
	.comm	_ReplicationOriginExitCleanup,4,2 ## @ReplicationOriginExitCleanup
	.comm	_max_replication_slots,4,2      ## @max_replication_slots
	.comm	_session_replication_state,8,3  ## @session_replication_state
	.comm	_ERROR,4,2                      ## @ERROR
	.comm	_ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE,4,2 ## @ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot setup replication origin when one is already setup"

	.comm	_ReplicationOriginLock,4,2      ## @ReplicationOriginLock
	.comm	_LW_EXCLUSIVE,4,2               ## @LW_EXCLUSIVE
	.comm	_replication_states,8,3         ## @replication_states
	.comm	_InvalidRepOriginId,8,3         ## @InvalidRepOriginId
	.comm	_ERRCODE_OBJECT_IN_USE,4,2      ## @ERRCODE_OBJECT_IN_USE
L_.str.1:                               ## @.str.1
	.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.2:                               ## @.str.2
	.asciz	"could not find free replication state slot for replication origin with OID %u"

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

	.comm	_InvalidXLogRecPtr,8,3          ## @InvalidXLogRecPtr
	.comm	_MyProcPid,8,3                  ## @MyProcPid
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_replorigin_session_setup       ; -- Begin function replorigin_session_setup
	.p2align	2
_replorigin_session_setup:              ; @replorigin_session_setup
	.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
	adrp	x20, _replorigin_session_setup.registered_cleanup@PAGE
	ldrb	w8, [x20, _replorigin_session_setup.registered_cleanup@PAGEOFF]
	tbnz	w8, #0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _ReplicationOriginExitCleanup@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ReplicationOriginExitCleanup@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	mov	w1, #0
	bl	_on_shmem_exit
	mov	w8, #1
	strb	w8, [x20, _replorigin_session_setup.registered_cleanup@PAGEOFF]
LBB0_2:
Lloh3:
	adrp	x8, _max_replication_slots@GOTPAGE
Lloh4:
	ldr	x8, [x8, _max_replication_slots@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, #0
	cset	w0, gt
	bl	_Assert
Lloh6:
	adrp	x21, _session_replication_state@GOTPAGE
Lloh7:
	ldr	x21, [x21, _session_replication_state@GOTPAGEOFF]
	ldr	x8, [x21]
Lloh8:
	adrp	x9, _ERROR@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ERROR@GOTPAGEOFF]
	cbz	x8, LBB0_4
; %bb.3:
	ldr	w20, [x9]
Lloh10:
	adrp	x8, _ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	bl	_errcode
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
	bl	_errmsg
	mov	x1, x0
	mov	x0, x20
	bl	_ereport
LBB0_4:
Lloh15:
	adrp	x8, _ReplicationOriginLock@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ReplicationOriginLock@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
Lloh18:
	adrp	x8, _LW_EXCLUSIVE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _LW_EXCLUSIVE@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	bl	_LWLockAcquire
Lloh21:
	adrp	x8, _max_replication_slots@GOTPAGE
Lloh22:
	ldr	x8, [x8, _max_replication_slots@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x24, _InvalidRepOriginId@GOTPAGE
Lloh25:
	ldr	x24, [x24, _InvalidRepOriginId@GOTPAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.5:
	mov	x28, #0
	mov	x23, #0
	mov	w27, #-1
Lloh26:
	adrp	x25, _replication_states@GOTPAGE
Lloh27:
	ldr	x25, [x25, _replication_states@GOTPAGEOFF]
	b	LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
	mov	x27, x23
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x23, x23, #1
	add	x28, x28, #40
	cmp	x23, w8, sxtw
	b.ge	LBB0_14
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x26, [x25]
	add	x20, x26, x28
	ldr	x9, [x20]
	ldr	x10, [x24]
	cmp	x9, x10
	ccmn	w27, #1, #0, eq
	b.eq	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	cmp	x9, x19
	b.ne	LBB0_7
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	add	x22, x26, x28
	ldr	x9, [x22, #8]
	cbz	x9, LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	mov	x24, x19
	mov	x19, x21
Lloh28:
	adrp	x8, _ERROR@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh30:
	ldr	w21, [x8]
Lloh31:
	adrp	x8, _ERRCODE_OBJECT_IN_USE@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ERRCODE_OBJECT_IN_USE@GOTPAGEOFF]
Lloh33:
	ldr	w0, [x8]
	bl	_errcode
	ldr	x8, [x26, x28]
	ldr	x9, [x22, #8]
	stp	x8, x9, [sp]
Lloh34:
	adrp	x0, l_.str.1@PAGE
Lloh35:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_errmsg
	mov	x1, x0
	mov	x0, x21
	mov	x21, x19
	mov	x19, x24
Lloh36:
	adrp	x24, _InvalidRepOriginId@GOTPAGE
Lloh37:
	ldr	x24, [x24, _InvalidRepOriginId@GOTPAGEOFF]
	bl	_ereport
Lloh38:
	adrp	x8, _max_replication_slots@GOTPAGE
Lloh39:
	ldr	x8, [x8, _max_replication_slots@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
LBB0_12:                                ;   in Loop: Header=BB0_8 Depth=1
	str	x20, [x21]
	b	LBB0_7
LBB0_13:
	mov	w27, #-1
LBB0_14:
	ldr	x8, [x21]
	cmp	x8, #0
	ccmn	w27, #1, #0, eq
	b.eq	LBB0_17
; %bb.15:
Lloh41:
	adrp	x22, _ReplicationOriginLock@GOTPAGE
Lloh42:
	ldr	x22, [x22, _ReplicationOriginLock@GOTPAGEOFF]
	cbnz	x8, LBB0_18
; %bb.16:
Lloh43:
	adrp	x8, _replication_states@GOTPAGE
Lloh44:
	ldr	x8, [x8, _replication_states@GOTPAGEOFF]
Lloh45:
	ldr	x8, [x8]
	mov	w9, #40
	smaddl	x8, w27, w9, x8
	str	x8, [x21]
	ldr	x8, [x8, #16]
Lloh46:
	adrp	x20, _InvalidXLogRecPtr@GOTPAGE
Lloh47:
	ldr	x20, [x20, _InvalidXLogRecPtr@GOTPAGEOFF]
	ldr	x9, [x20]
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	ldr	x8, [x21]
	ldr	x8, [x8, #24]
	ldr	x9, [x20]
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	ldr	x8, [x21]
	str	x19, [x8]
	b	LBB0_18
LBB0_17:
Lloh48:
	adrp	x8, _ERROR@GOTPAGE
Lloh49:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh50:
	ldr	w20, [x8]
Lloh51:
	adrp	x8, _ERRCODE_CONFIGURATION_LIMIT_EXCEEDED@GOTPAGE
Lloh52:
	ldr	x8, [x8, _ERRCODE_CONFIGURATION_LIMIT_EXCEEDED@GOTPAGEOFF]
Lloh53:
	ldr	w0, [x8]
	bl	_errcode
	str	x19, [sp]
Lloh54:
	adrp	x0, l_.str.2@PAGE
Lloh55:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_errmsg
Lloh56:
	adrp	x0, l_.str.3@PAGE
Lloh57:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_errhint
	mov	x1, x0
	mov	x0, x20
	bl	_ereport
	ldr	x8, [x21]
Lloh58:
	adrp	x22, _ReplicationOriginLock@GOTPAGE
Lloh59:
	ldr	x22, [x22, _ReplicationOriginLock@GOTPAGEOFF]
LBB0_18:
	ldr	x8, [x8]
	ldr	x9, [x24]
	cmp	x8, x9
	cset	w0, ne
	bl	_Assert
Lloh60:
	adrp	x8, _MyProcPid@GOTPAGE
Lloh61:
	ldr	x8, [x8, _MyProcPid@GOTPAGEOFF]
Lloh62:
	ldr	x8, [x8]
	ldr	x9, [x21]
	str	x8, [x9, #8]
	ldr	w0, [x22]
	bl	_LWLockRelease
	ldr	x8, [x21]
	add	x0, x8, #32
	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	_ConditionVariableBroadcast
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpLdrGot	Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGot	Lloh58, Lloh59
	.loh AdrpAdd	Lloh56, Lloh57
	.loh AdrpAdd	Lloh54, Lloh55
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh60, Lloh61, Lloh62
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_replorigin_session_setup.registered_cleanup,1,2 ; @replorigin_session_setup.registered_cleanup
	.comm	_ReplicationOriginExitCleanup,4,2 ; @ReplicationOriginExitCleanup
	.comm	_max_replication_slots,4,2      ; @max_replication_slots
	.comm	_session_replication_state,8,3  ; @session_replication_state
	.comm	_ERROR,4,2                      ; @ERROR
	.comm	_ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE,4,2 ; @ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot setup replication origin when one is already setup"

	.comm	_ReplicationOriginLock,4,2      ; @ReplicationOriginLock
	.comm	_LW_EXCLUSIVE,4,2               ; @LW_EXCLUSIVE
	.comm	_replication_states,8,3         ; @replication_states
	.comm	_InvalidRepOriginId,8,3         ; @InvalidRepOriginId
	.comm	_ERRCODE_OBJECT_IN_USE,4,2      ; @ERRCODE_OBJECT_IN_USE
l_.str.1:                               ; @.str.1
	.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.2:                               ; @.str.2
	.asciz	"could not find free replication state slot for replication origin with OID %u"

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

	.comm	_InvalidXLogRecPtr,8,3          ; @InvalidXLogRecPtr
	.comm	_MyProcPid,8,3                  ; @MyProcPid
.subsections_via_symbols
