	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_GetCachedPlan                  ## -- Begin function GetCachedPlan
	.p2align	4, 0x90
_GetCachedPlan:                         ## @GetCachedPlan
	.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, %r12
	movl	%edx, %r14d
	movq	%rsi, %r13
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movq	_CACHEDPLANSOURCE_MAGIC@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	callq	_Assert
	movl	8(%rbx), %edi
	callq	_Assert
	testl	%r14d, %r14d
	je	LBB0_3
## %bb.1:
	cmpq	$0, 24(%rbx)
	jne	LBB0_3
## %bb.2:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_elog
LBB0_3:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_RevalidateCachedQuery
	movq	%rax, %r15
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_choose_custom_plan
	testl	%eax, %eax
	je	LBB0_7
LBB0_4:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r13, %rdx
	movq	%r12, %rcx
	callq	_BuildCachedPlan
	movq	%rax, %r15
	movq	16(%rbx), %rax
	movq	_INT_MAX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_6
## %bb.5:
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_cached_plan_cost
	addl	%eax, 32(%rbx)
	incq	16(%rbx)
LBB0_6:
	xorl	%r12d, %r12d
	jmp	LBB0_10
LBB0_7:
	movq	%rbx, %rdi
	callq	_CheckCachedPlan
	testq	%rax, %rax
	je	LBB0_16
## %bb.8:
	movq	56(%rbx), %r15
	movq	(%r15), %rax
	movq	_CACHEDPLAN_MAGIC@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	callq	_Assert
LBB0_9:
	movb	$1, %r12b
LBB0_10:
	xorl	%edi, %edi
	testq	%r15, %r15
	setne	%dil
	callq	_Assert
	testl	%r14d, %r14d
	je	LBB0_12
## %bb.11:
	movq	_CurrentResourceOwner@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	callq	_ResourceOwnerEnlargePlanCacheRefs
	incl	16(%r15)
	movl	(%r14), %edi
	movq	%r15, %rsi
	callq	_ResourceOwnerRememberPlanCacheRef
	testb	%r12b, %r12b
	je	LBB0_13
	jmp	LBB0_15
LBB0_12:
	incl	16(%r15)
	testb	%r12b, %r12b
	jne	LBB0_15
LBB0_13:
	cmpq	$0, 24(%rbx)
	je	LBB0_15
## %bb.14:
	movl	12(%r15), %edi
	movq	_CacheMemoryContext@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_MemoryContextSetParent
	movl	$1, 8(%r15)
LBB0_15:
	movq	%r15, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	xorl	%edx, %edx
	movq	%r12, %rcx
	callq	_BuildCachedPlan
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	_ReleaseGenericPlan
	movq	%r15, 56(%rbx)
	incl	16(%r15)
	cmpq	$0, 24(%rbx)
	movl	12(%r15), %edi
	je	LBB0_18
## %bb.17:
	movq	_CacheMemoryContext@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_MemoryContextSetParent
	movl	$1, 8(%r15)
	jmp	LBB0_19
LBB0_18:
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movl	48(%rbx), %edi
	callq	_MemoryContextGetParent
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_MemoryContextSetParent
LBB0_19:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_cached_plan_cost
	movq	%rax, 40(%rbx)
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_choose_custom_plan
	testl	%eax, %eax
	je	LBB0_9
## %bb.20:
	movq	_NIL@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_CACHEDPLANSOURCE_MAGIC,8,3     ## @CACHEDPLANSOURCE_MAGIC
	.comm	_ERROR,4,2                      ## @ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot apply ResourceOwner to non-saved cached plan"

	.comm	_CACHEDPLAN_MAGIC,8,3           ## @CACHEDPLAN_MAGIC
	.comm	_CacheMemoryContext,4,2         ## @CacheMemoryContext
	.comm	_NIL,8,3                        ## @NIL
	.comm	_INT_MAX,8,3                    ## @INT_MAX
	.comm	_CurrentResourceOwner,4,2       ## @CurrentResourceOwner
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_GetCachedPlan                  ; -- Begin function GetCachedPlan
	.p2align	2
_GetCachedPlan:                         ; @GetCachedPlan
	.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	x22, x3
	mov	x20, x2
	mov	x23, x1
	mov	x19, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _CACHEDPLANSOURCE_MAGIC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CACHEDPLANSOURCE_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	ldr	w0, [x19, #8]
	bl	_Assert
	cbz	w20, LBB0_3
; %bb.1:
	ldr	x8, [x19, #24]
	cbnz	x8, 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, x19
	mov	x1, x22
	bl	_RevalidateCachedQuery
	mov	x21, x0
	mov	x0, x19
	mov	x1, x23
	bl	_choose_custom_plan
	cbz	w0, LBB0_6
LBB0_4:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x23
	mov	x3, x22
	bl	_BuildCachedPlan
	mov	x21, x0
	ldr	x8, [x19, #16]
Lloh8:
	adrp	x9, _INT_MAX@GOTPAGE
Lloh9:
	ldr	x9, [x9, _INT_MAX@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_8
; %bb.5:
	mov	x0, x21
	mov	w1, #1
	bl	_cached_plan_cost
	mov	w22, #0
	ldr	w8, [x19, #32]
	add	w8, w8, w0
	str	w8, [x19, #32]
	ldr	x8, [x19, #16]
	add	x8, x8, #1
	str	x8, [x19, #16]
	b	LBB0_9
LBB0_6:
	mov	x0, x19
	bl	_CheckCachedPlan
	cbz	x0, LBB0_15
; %bb.7:
	ldr	x21, [x19, #56]
	ldr	x8, [x21]
Lloh11:
	adrp	x9, _CACHEDPLAN_MAGIC@GOTPAGE
Lloh12:
	ldr	x9, [x9, _CACHEDPLAN_MAGIC@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, eq
	bl	_Assert
	mov	w22, #1
	b	LBB0_9
LBB0_8:
	mov	w22, #0
LBB0_9:
	cmp	x21, #0
	cset	w0, ne
	bl	_Assert
	cbz	w20, LBB0_11
; %bb.10:
Lloh14:
	adrp	x20, _CurrentResourceOwner@GOTPAGE
Lloh15:
	ldr	x20, [x20, _CurrentResourceOwner@GOTPAGEOFF]
	ldr	w0, [x20]
	bl	_ResourceOwnerEnlargePlanCacheRefs
	ldr	w8, [x21, #16]
	add	w8, w8, #1
	str	w8, [x21, #16]
	ldr	w0, [x20]
	mov	x1, x21
	bl	_ResourceOwnerRememberPlanCacheRef
	tbz	w22, #0, LBB0_12
	b	LBB0_14
LBB0_11:
	ldr	w8, [x21, #16]
	add	w8, w8, #1
	str	w8, [x21, #16]
	tbnz	w22, #0, LBB0_14
LBB0_12:
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_14
; %bb.13:
	ldr	w0, [x21, #12]
Lloh16:
	adrp	x8, _CacheMemoryContext@GOTPAGE
Lloh17:
	ldr	x8, [x8, _CacheMemoryContext@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_MemoryContextSetParent
	mov	w8, #1
	str	w8, [x21, #8]
LBB0_14:
	mov	x0, x21
	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
LBB0_15:
	mov	x0, x19
	mov	x1, x21
	mov	x2, #0
	mov	x3, x22
	bl	_BuildCachedPlan
	mov	x21, x0
	mov	x0, x19
	bl	_ReleaseGenericPlan
	str	x21, [x19, #56]
	ldp	w24, w8, [x21, #12]
	add	w8, w8, #1
	str	w8, [x21, #16]
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_17
; %bb.16:
Lloh19:
	adrp	x8, _CacheMemoryContext@GOTPAGE
Lloh20:
	ldr	x8, [x8, _CacheMemoryContext@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	mov	x0, x24
	bl	_MemoryContextSetParent
	mov	w8, #1
	str	w8, [x21, #8]
	b	LBB0_18
LBB0_17:
	ldr	w0, [x19, #48]
	bl	_MemoryContextGetParent
	mov	x1, x0
	mov	x0, x24
	bl	_MemoryContextSetParent
LBB0_18:
	mov	x0, x21
	mov	w1, #0
	bl	_cached_plan_cost
	str	x0, [x19, #40]
	mov	x0, x19
	mov	x1, x23
	bl	_choose_custom_plan
	cbz	w0, LBB0_20
; %bb.19:
Lloh22:
	adrp	x8, _NIL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _NIL@GOTPAGEOFF]
Lloh24:
	ldr	x21, [x8]
	b	LBB0_4
LBB0_20:
	mov	w22, #1
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_CACHEDPLANSOURCE_MAGIC,8,3     ; @CACHEDPLANSOURCE_MAGIC
	.comm	_ERROR,4,2                      ; @ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot apply ResourceOwner to non-saved cached plan"

	.comm	_CACHEDPLAN_MAGIC,8,3           ; @CACHEDPLAN_MAGIC
	.comm	_CacheMemoryContext,4,2         ; @CacheMemoryContext
	.comm	_NIL,8,3                        ; @NIL
	.comm	_INT_MAX,8,3                    ; @INT_MAX
	.comm	_CurrentResourceOwner,4,2       ; @CurrentResourceOwner
.subsections_via_symbols
