	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function PortalRunSelect
_PortalRunSelect:                       ## @PortalRunSelect
	.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	%rcx, %rbx
	movq	%rdx, %r12
	movl	%esi, %r13d
	movq	%rdi, %r14
	movq	32(%rdi), %r15
	testq	%r15, %r15
	je	LBB0_1
## %bb.2:
	movl	$1, %edi
	callq	_Assert
	movq	%rbx, 16(%r15)
	testl	%r13d, %r13d
	je	LBB0_14
LBB0_4:
	cmpl	$0, (%r14)
	setne	%al
	testq	%r12, %r12
	setle	%cl
	xorl	%edx, %edx
	orb	%al, %cl
	cmovneq	%rdx, %r12
	movq	_ForwardScanDirection@GOTPCREL(%rip), %rax
	cmovneq	_NoMovementScanDirection@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	_FETCH_ALL@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r12
	cmoveq	%rdx, %r12
	cmpq	$0, 24(%r14)
	je	LBB0_6
## %bb.5:
	movq	%r14, %rdi
	movl	%r13d, %esi
	movq	%r12, %rdx
	movq	%rbx, %rcx
	callq	_RunFromStore
	movq	%rax, %r15
	jmp	LBB0_7
LBB0_1:
	xorl	%edi, %edi
	cmpq	$0, 24(%r14)
	setne	%dil
	callq	_Assert
	testl	%r13d, %r13d
	jne	LBB0_4
LBB0_14:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	_CURSOR_OPT_NO_SCROLL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 16(%r14)
	je	LBB0_16
## %bb.15:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_errcode
	leaq	L_.str(%rip), %rdi
	callq	_errmsg
	leaq	L_.str.1(%rip), %rdi
	callq	_errhint
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_ereport
LBB0_16:
	cmpl	$0, 4(%r14)
	setne	%al
	testq	%r12, %r12
	setle	%cl
	xorl	%edx, %edx
	orb	%al, %cl
	cmovneq	%rdx, %r12
	movq	_BackwardScanDirection@GOTPCREL(%rip), %rax
	cmovneq	_NoMovementScanDirection@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	_FETCH_ALL@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r12
	cmoveq	%rdx, %r12
	cmpq	$0, 24(%r14)
	je	LBB0_18
## %bb.17:
	movq	%r14, %rdi
	movl	%r13d, %esi
	movq	%r12, %rdx
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	callq	_RunFromStore
	movq	%rax, %r15
	jmp	LBB0_19
LBB0_6:
	movl	8(%r15), %edi
	callq	_PushActiveSnapshot
	movl	20(%r14), %ecx
	movq	%r15, %rdi
	movl	%r13d, %esi
	movq	%r12, %rdx
	callq	_ExecutorRun
	movq	(%r15), %rax
	movq	(%rax), %r15
	xorl	%eax, %eax
	callq	_PopActiveSnapshot
LBB0_7:
	movl	%r13d, %edi
	callq	_ScanDirectionIsNoMovement
	testl	%eax, %eax
	jne	LBB0_27
## %bb.8:
	testq	%r15, %r15
	jle	LBB0_10
## %bb.9:
	movl	$0, 4(%r14)
LBB0_10:
	testq	%r12, %r12
	je	LBB0_12
## %bb.11:
	cmpq	%r12, %r15
	jge	LBB0_13
LBB0_12:
	movl	$1, (%r14)
LBB0_13:
	addq	%r15, 8(%r14)
	jmp	LBB0_27
LBB0_18:
	movl	8(%r15), %edi
	callq	_PushActiveSnapshot
	movl	20(%r14), %ecx
	movq	%r15, %rdi
	movl	%r13d, %esi
	movq	%r12, %rdx
	callq	_ExecutorRun
	movq	(%r15), %rax
	movq	(%rax), %r15
	xorl	%eax, %eax
	callq	_PopActiveSnapshot
LBB0_19:
	movl	%r13d, %edi
	callq	_ScanDirectionIsNoMovement
	testl	%eax, %eax
	jne	LBB0_27
## %bb.20:
	testq	%r15, %r15
	jle	LBB0_23
## %bb.21:
	cmpl	$0, (%r14)
	je	LBB0_23
## %bb.22:
	movl	$0, (%r14)
	incq	8(%r14)
LBB0_23:
	testq	%r12, %r12
	je	LBB0_25
## %bb.24:
	cmpq	%r12, %r15
	jl	LBB0_25
## %bb.26:
	subq	%r15, 8(%r14)
	jmp	LBB0_27
LBB0_25:
	movl	$1, 4(%r14)
	movq	$0, 8(%r14)
LBB0_27:
	movq	%r15, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NoMovementScanDirection,4,2    ## @NoMovementScanDirection
	.comm	_ForwardScanDirection,4,2       ## @ForwardScanDirection
	.comm	_FETCH_ALL,8,3                  ## @FETCH_ALL
	.comm	_CURSOR_OPT_NO_SCROLL,4,2       ## @CURSOR_OPT_NO_SCROLL
	.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	"cursor can only scan forward"

L_.str.1:                               ## @.str.1
	.asciz	"Declare it with SCROLL option to enable backward scan."

	.comm	_BackwardScanDirection,4,2      ## @BackwardScanDirection
	.no_dead_strip	_PortalRunSelect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function PortalRunSelect
_PortalRunSelect:                       ; @PortalRunSelect
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x21, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
	ldr	x20, [x0, #32]
	cbz	x20, LBB0_4
; %bb.1:
	mov	w0, #1
	bl	_Assert
	str	x21, [x20, #16]
	cbz	w23, LBB0_5
LBB0_2:
	ldr	w8, [x19]
	cmp	x22, #1
	ccmp	w8, #0, #0, ge
	csel	x8, xzr, x22, ne
Lloh0:
	adrp	x9, _NoMovementScanDirection@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NoMovementScanDirection@GOTPAGEOFF]
Lloh2:
	adrp	x10, _ForwardScanDirection@GOTPAGE
Lloh3:
	ldr	x10, [x10, _ForwardScanDirection@GOTPAGEOFF]
	csel	x9, x9, x10, ne
	ldr	w23, [x9]
Lloh4:
	adrp	x9, _FETCH_ALL@GOTPAGE
Lloh5:
	ldr	x9, [x9, _FETCH_ALL@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
	cmp	x8, x9
	csel	x22, xzr, x8, eq
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_9
; %bb.3:
	mov	x0, x19
	mov	x1, x23
	mov	x2, x22
	mov	x3, x21
	bl	_RunFromStore
	mov	x20, x0
	b	LBB0_10
LBB0_4:
	ldr	x8, [x19, #24]
	cmp	x8, #0
	cset	w0, ne
	bl	_Assert
	cbnz	w23, LBB0_2
LBB0_5:
	ldr	w8, [x19, #16]
Lloh7:
	adrp	x9, _CURSOR_OPT_NO_SCROLL@GOTPAGE
Lloh8:
	ldr	x9, [x9, _CURSOR_OPT_NO_SCROLL@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.6:
Lloh10:
	adrp	x8, _ERROR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh12:
	ldr	w23, [x8]
Lloh13:
	adrp	x8, _ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	bl	_errcode
Lloh16:
	adrp	x0, l_.str@PAGE
Lloh17:
	add	x0, x0, l_.str@PAGEOFF
	bl	_errmsg
Lloh18:
	adrp	x0, l_.str.1@PAGE
Lloh19:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_errhint
	mov	x1, x0
	mov	x0, x23
	bl	_ereport
LBB0_7:
	ldr	w8, [x19, #4]
	cmp	x22, #1
	ccmp	w8, #0, #0, ge
	csel	x8, xzr, x22, ne
Lloh20:
	adrp	x9, _NoMovementScanDirection@GOTPAGE
Lloh21:
	ldr	x9, [x9, _NoMovementScanDirection@GOTPAGEOFF]
Lloh22:
	adrp	x10, _BackwardScanDirection@GOTPAGE
Lloh23:
	ldr	x10, [x10, _BackwardScanDirection@GOTPAGEOFF]
	csel	x9, x9, x10, ne
	ldr	w23, [x9]
Lloh24:
	adrp	x9, _FETCH_ALL@GOTPAGE
Lloh25:
	ldr	x9, [x9, _FETCH_ALL@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	cmp	x8, x9
	csel	x22, xzr, x8, eq
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_16
; %bb.8:
	mov	x0, x19
	mov	x1, x23
	mov	x2, x22
	mov	x3, x21
	bl	_RunFromStore
	mov	x20, x0
	b	LBB0_17
LBB0_9:
	ldr	w0, [x20, #8]
	bl	_PushActiveSnapshot
	ldr	w3, [x19, #20]
	mov	x0, x20
	mov	x1, x23
	mov	x2, x22
	bl	_ExecutorRun
	ldr	x8, [x20]
	ldr	x20, [x8]
	bl	_PopActiveSnapshot
LBB0_10:
	mov	x0, x23
	bl	_ScanDirectionIsNoMovement
	cbnz	w0, LBB0_25
; %bb.11:
	cmp	x20, #1
	b.lt	LBB0_13
; %bb.12:
	str	wzr, [x19, #4]
LBB0_13:
	cmp	x22, #0
	ccmp	x20, x22, #8, ne
	b.ge	LBB0_15
; %bb.14:
	mov	w8, #1
	str	w8, [x19]
LBB0_15:
	ldr	x8, [x19, #8]
	add	x8, x8, x20
	b	LBB0_24
LBB0_16:
	ldr	w0, [x20, #8]
	bl	_PushActiveSnapshot
	ldr	w3, [x19, #20]
	mov	x0, x20
	mov	x1, x23
	mov	x2, x22
	bl	_ExecutorRun
	ldr	x8, [x20]
	ldr	x20, [x8]
	bl	_PopActiveSnapshot
LBB0_17:
	mov	x0, x23
	bl	_ScanDirectionIsNoMovement
	cbnz	w0, LBB0_25
; %bb.18:
	cmp	x20, #1
	b.lt	LBB0_21
; %bb.19:
	ldr	w8, [x19]
	cbz	w8, LBB0_21
; %bb.20:
	str	wzr, [x19]
	ldr	x8, [x19, #8]
	add	x8, x8, #1
	str	x8, [x19, #8]
LBB0_21:
	cmp	x22, #0
	ccmp	x20, x22, #8, ne
	b.ge	LBB0_23
; %bb.22:
	mov	w8, #1
	str	w8, [x19, #4]
	str	xzr, [x19, #8]
	b	LBB0_25
LBB0_23:
	ldr	x8, [x19, #8]
	sub	x8, x8, x20
LBB0_24:
	str	x8, [x19, #8]
LBB0_25:
	mov	x0, x20
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_NoMovementScanDirection,4,2    ; @NoMovementScanDirection
	.comm	_ForwardScanDirection,4,2       ; @ForwardScanDirection
	.comm	_FETCH_ALL,8,3                  ; @FETCH_ALL
	.comm	_CURSOR_OPT_NO_SCROLL,4,2       ; @CURSOR_OPT_NO_SCROLL
	.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	"cursor can only scan forward"

l_.str.1:                               ; @.str.1
	.asciz	"Declare it with SCROLL option to enable backward scan."

	.comm	_BackwardScanDirection,4,2      ; @BackwardScanDirection
	.no_dead_strip	_PortalRunSelect
.subsections_via_symbols
