	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function IndexNextWithReorder
_IndexNextWithReorder:                  ## @IndexNextWithReorder
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	104(%rdi), %rax
	movq	112(%rdi), %r13
	movl	(%rax), %edi
	callq	_ScanDirectionIsBackward
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_Assert
	movl	4(%r13), %edi
	callq	_ScanDirectionIsForward
	movl	%eax, %edi
	callq	_Assert
	movq	64(%rbx), %r12
	movq	88(%rbx), %r14
	movq	96(%rbx), %r15
	testq	%r12, %r12
	jne	LBB0_4
## %bb.1:
	movl	80(%rbx), %edi
	movl	72(%rbx), %esi
	movl	(%r13), %edx
	movl	40(%rbx), %r8d
	movl	48(%rbx), %ecx
	callq	_index_beginscan
	movq	%rax, %r12
	movq	%rax, 64(%rbx)
	cmpq	$0, (%rbx)
	je	LBB0_3
## %bb.2:
	cmpq	$0, 56(%rbx)
	je	LBB0_4
LBB0_3:
	movl	52(%rbx), %esi
	movl	48(%rbx), %edx
	movl	40(%rbx), %r8d
	movl	44(%rbx), %ecx
	movq	%r12, %rdi
	callq	_index_rescan
LBB0_4:
	leaq	8(%r12), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	leaq	24(%rbx), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	leaq	16(%rbx), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	_ForwardScanDirection@GOTPCREL(%rip), %r13
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
                                        ## implicit-def: $eax
                                        ## kill: killed $eax
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	$1, 8(%rbx)
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_10 Depth 2
	xorl	%eax, %eax
	callq	_CHECK_FOR_INTERRUPTS
	movl	36(%rbx), %edi
	callq	_pairingheap_is_empty
	testl	%eax, %eax
	je	LBB0_6
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	cmpl	$0, 8(%rbx)
	je	LBB0_10
	jmp	LBB0_27
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	36(%rbx), %edi
	callq	_pairingheap_first
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	cmpl	$0, 8(%rbx)
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rsi
	movq	8(%rax), %rdi
	movq	(%r12), %rcx
	movq	8(%r12), %rdx
	movq	%rbx, %r8
	callq	_cmp_orderbyvals
	testl	%eax, %eax
	jle	LBB0_8
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r13), %esi
	movq	%r12, %rdi
	movq	%r14, %rdx
	callq	_index_getnext_slot
	testl	%eax, %eax
	je	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=2
	cmpq	$0, 24(%r12)
	je	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_10 Depth=2
	movq	%r14, (%r15)
	movl	32(%rbx), %edi
	movq	%r15, %rsi
	callq	_ExecQualAndReset
	testl	%eax, %eax
	jne	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_10 Depth=2
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_InstrCountFiltered2
	xorl	%eax, %eax
	callq	_CHECK_FOR_INTERRUPTS
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_5 Depth=1
	cmpq	$0, 16(%r12)
	je	LBB0_16
## %bb.21:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	%r14, (%r15)
	movq	%r15, %rdi
	callq	_ResetExprContext
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_EvalOrderByExpressions
	movq	16(%rbx), %rsi
	movq	24(%rbx), %rdi
	movq	(%r12), %rcx
	movq	8(%r12), %rdx
	movq	%rbx, %r8
	callq	_cmp_orderbyvals
	testl	%eax, %eax
	js	LBB0_24
## %bb.22:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	je	LBB0_17
## %bb.23:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %r8
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %r9
	jmp	LBB0_25
LBB0_16:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	%r12, %rcx
LBB0_17:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	(%rcx), %r8
	movq	(%rax), %r9
	movl	$1, -44(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_18
LBB0_24:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_elog
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %r8
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %r9
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_25
LBB0_18:                                ##   in Loop: Header=BB0_5 Depth=1
	cmpq	$0, -56(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_20
## %bb.19:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rcx
	movq	8(%rax), %rdx
	movq	%r9, %rdi
	movq	%r8, %rsi
	movq	%r8, -88(%rbp)                  ## 8-byte Spill
	movq	%rbx, %r8
	movq	%r9, %r13
	callq	_cmp_orderbyvals
	movq	%r13, %r9
	movq	-88(%rbp), %r8                  ## 8-byte Reload
	movq	_ForwardScanDirection@GOTPCREL(%rip), %r13
	testl	%eax, %eax
	jg	LBB0_26
	jmp	LBB0_20
LBB0_25:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_26:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%r9, %rdx
	movq	%r8, %rcx
	callq	_reorderqueue_push
	jmp	LBB0_5
LBB0_8:
	movq	%rbx, %rdi
	callq	_reorderqueue_pop
	movl	%eax, %edi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	_ExecForceStoreHeapTuple
LBB0_20:
	movq	%r14, %rax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_27:
	movq	%r14, %rdi
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ExecClearTuple                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ForwardScanDirection,4,2       ## @ForwardScanDirection
	.comm	_ERROR,4,2                      ## @ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"index returned tuples in wrong order"

	.no_dead_strip	_IndexNextWithReorder
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function IndexNextWithReorder
_IndexNextWithReorder:                  ; @IndexNextWithReorder
	.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
	ldp	x8, x23, [x0, #104]
	ldr	w0, [x8]
	bl	_ScanDirectionIsBackward
	cmp	w0, #0
	cset	w0, eq
	bl	_Assert
	ldr	w0, [x23, #4]
	bl	_ScanDirectionIsForward
	bl	_Assert
	ldr	x22, [x19, #64]
	ldp	x20, x21, [x19, #88]
	cbnz	x22, LBB0_4
; %bb.1:
	ldr	w0, [x19, #80]
	ldr	w1, [x19, #72]
	ldr	w2, [x23]
	ldr	w3, [x19, #48]
	ldr	w4, [x19, #40]
	bl	_index_beginscan
	mov	x22, x0
	str	x0, [x19, #64]
	ldr	x8, [x19]
	cbz	x8, LBB0_3
; %bb.2:
	ldr	x8, [x19, #56]
	cbz	x8, LBB0_4
LBB0_3:
	ldp	w2, w1, [x19, #48]
	ldp	w4, w3, [x19, #40]
	mov	x0, x22
	bl	_index_rescan
LBB0_4:
	mov	x23, #0
	add	x9, x22, #8
	add	x8, x19, #24
	stp	x9, x8, [sp]                    ; 16-byte Folded Spill
Lloh0:
	adrp	x24, _ForwardScanDirection@GOTPAGE
Lloh1:
	ldr	x24, [x24, _ForwardScanDirection@GOTPAGEOFF]
	add	x27, x19, #16
                                        ; implicit-def: $w28
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	w8, #1
	str	w8, [x19, #8]
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	bl	_CHECK_FOR_INTERRUPTS
	ldr	w0, [x19, #36]
	bl	_pairingheap_is_empty
	cbz	w0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w8, [x19, #8]
	cbz	w8, LBB0_10
	b	LBB0_26
LBB0_8:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	w0, [x19, #36]
	bl	_pairingheap_first
	ldr	w8, [x19, #8]
	cbnz	w8, LBB0_24
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x23, x0
	ldr	x0, [x0, #8]
	ldr	x1, [x23]
	ldp	x3, x2, [x22]
	mov	x4, x19
	bl	_cmp_orderbyvals
	cmp	w0, #0
	b.le	LBB0_24
LBB0_10:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x24]
	mov	x0, x22
	mov	x2, x20
	bl	_index_getnext_slot
	cbz	w0, LBB0_5
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=2
	ldr	x8, [x22, #24]
	cbz	x8, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=2
	str	x20, [x21]
	ldr	w0, [x19, #32]
	mov	x1, x21
	bl	_ExecQualAndReset
	cbnz	w0, LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=2
	mov	x0, x19
	mov	w1, #1
	bl	_InstrCountFiltered2
	bl	_CHECK_FOR_INTERRUPTS
	b	LBB0_10
LBB0_14:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x22, #16]
	cbz	x8, LBB0_18
; %bb.15:                               ;   in Loop: Header=BB0_6 Depth=1
	str	x20, [x21]
	mov	x0, x21
	bl	_ResetExprContext
	mov	x0, x19
	mov	x1, x21
	bl	_EvalOrderByExpressions
	ldp	x1, x0, [x19, #16]
	ldp	x3, x2, [x22]
	mov	x4, x19
	bl	_cmp_orderbyvals
	tbnz	w0, #31, LBB0_20
; %bb.16:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	mov	x9, x27
	cbz	w0, LBB0_19
; %bb.17:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	w28, #0
	ldr	x25, [x27]
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	x26, [x8]
	b	LBB0_23
LBB0_18:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [sp]                        ; 8-byte Folded Reload
	mov	x9, x22
LBB0_19:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x25, [x9]
	ldr	x26, [x8]
	mov	w28, #1
	b	LBB0_21
LBB0_20:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh2:
	adrp	x8, _ERROR@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	bl	_elog
	ldr	x25, [x27]
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	x26, [x8]
	cbz	w28, LBB0_23
LBB0_21:                                ;   in Loop: Header=BB0_6 Depth=1
	cbz	x23, LBB0_25
; %bb.22:                               ;   in Loop: Header=BB0_6 Depth=1
	ldp	x3, x2, [x23]
	mov	x0, x26
	mov	x1, x25
	mov	x4, x19
	bl	_cmp_orderbyvals
	cmp	w0, #1
	b.lt	LBB0_25
LBB0_23:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x19
	mov	x1, x20
	mov	x2, x26
	mov	x3, x25
	bl	_reorderqueue_push
	b	LBB0_6
LBB0_24:
	mov	x0, x19
	bl	_reorderqueue_pop
	mov	x1, x20
	mov	w2, #1
	bl	_ExecForceStoreHeapTuple
LBB0_25:
	mov	x0, x20
	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
	ret
LBB0_26:
	mov	x0, x20
	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	_ExecClearTuple
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_ForwardScanDirection,4,2       ; @ForwardScanDirection
	.comm	_ERROR,4,2                      ; @ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"index returned tuples in wrong order"

	.no_dead_strip	_IndexNextWithReorder
.subsections_via_symbols
