	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function addOrReplaceTuple
_addOrReplaceTuple:                     ## @addOrReplaceTuple
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r12
	movl	%edx, %r14d
	movl	%esi, %r15d
	movl	%edi, %ebx
	callq	_PageGetMaxOffsetNumber
	cmpq	%r12, %rax
	jl	LBB0_4
## %bb.1:
	movl	%ebx, %edi
	movq	%r12, %rsi
	callq	_PageGetItemId
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_PageGetItem
	cltq
	movq	(%rax), %rax
	movq	_SPGIST_PLACEHOLDER@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_3
## %bb.2:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_elog
LBB0_3:
	movl	%ebx, %edi
	callq	_SpGistPageGetOpaque
	xorl	%edi, %edi
	cmpq	$0, (%rax)
	setg	%dil
	callq	_Assert
	movl	%ebx, %edi
	callq	_SpGistPageGetOpaque
	decq	(%rax)
	movl	%ebx, %edi
	movq	%r12, %rsi
	callq	_PageIndexTupleDelete
LBB0_4:
	movl	%ebx, %edi
	callq	_PageGetMaxOffsetNumber
	incq	%rax
	xorl	%edi, %edi
	cmpq	%r12, %rax
	setge	%dil
	callq	_Assert
	movl	%ebx, %edi
	movl	%r15d, %esi
	movl	%r14d, %edx
	movq	%r12, %rcx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_PageAddItem
	cmpq	%r12, %rax
	jne	LBB0_6
## %bb.5:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_elog                           ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SPGIST_PLACEHOLDER,8,3         ## @SPGIST_PLACEHOLDER
	.comm	_ERROR,4,2                      ## @ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SPGiST tuple to be replaced is not a placeholder"

L_.str.1:                               ## @.str.1
	.asciz	"failed to add item of size %u to SPGiST index page"

	.no_dead_strip	_addOrReplaceTuple
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function addOrReplaceTuple
_addOrReplaceTuple:                     ; @addOrReplaceTuple
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x3
	mov	x19, x2
	mov	x21, x1
	mov	x22, x0
	bl	_PageGetMaxOffsetNumber
	cmp	x0, x20
	b.lt	LBB0_4
; %bb.1:
	mov	x0, x22
	mov	x1, x20
	bl	_PageGetItemId
	mov	x1, x0
	mov	x0, x22
	bl	_PageGetItem
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	ldr	x8, [x8]
Lloh0:
	adrp	x9, _SPGIST_PLACEHOLDER@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SPGIST_PLACEHOLDER@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_3
; %bb.2:
Lloh3:
	adrp	x8, _ERROR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_elog
LBB0_3:
	mov	x0, x22
	bl	_SpGistPageGetOpaque
	ldr	x8, [x0]
	cmp	x8, #0
	cset	w0, gt
	bl	_Assert
	mov	x0, x22
	bl	_SpGistPageGetOpaque
	ldr	x8, [x0]
	sub	x8, x8, #1
	str	x8, [x0]
	mov	x0, x22
	mov	x1, x20
	bl	_PageIndexTupleDelete
LBB0_4:
	mov	x0, x22
	bl	_PageGetMaxOffsetNumber
	add	x8, x0, #1
	cmp	x8, x20
	cset	w0, ge
	bl	_Assert
	mov	x0, x22
	mov	x1, x21
	mov	x2, x19
	mov	x3, x20
	mov	w4, #0
	mov	w5, #0
	bl	_PageAddItem
	cmp	x0, x20
	b.eq	LBB0_6
; %bb.5:
Lloh8:
	adrp	x8, _ERROR@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	str	x19, [sp]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_elog
LBB0_6:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_SPGIST_PLACEHOLDER,8,3         ; @SPGIST_PLACEHOLDER
	.comm	_ERROR,4,2                      ; @ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SPGiST tuple to be replaced is not a placeholder"

l_.str.1:                               ; @.str.1
	.asciz	"failed to add item of size %u to SPGiST index page"

	.no_dead_strip	_addOrReplaceTuple
.subsections_via_symbols
