	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function protect_out_of_mem
_protect_out_of_mem:                    ## @protect_out_of_mem
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	movslq	%eax, %rcx
	movq	_MaxAllocSize@GOTPCREL(%rip), %rax
	movslq	(%rax), %r14
	movabsq	$-6148914691236517205, %rdx     ## imm = 0xAAAAAAAAAAAAAAAB
	movq	%r14, %rax
	mulq	%rdx
	shrq	$3, %rdx
	cmpq	%rcx, %rdx
	jbe	LBB0_3
## %bb.1:
	movl	%edi, %ebx
	xorl	%eax, %eax
	callq	_pg_database_encoding_max_length
	movl	%eax, %ecx
	movl	%r14d, %eax
	cltd
	idivl	%ecx
	cmpl	%ebx, %eax
	jle	LBB0_3
## %bb.2:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_3:
	movq	_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_ERRCODE_PROGRAM_LIMIT_EXCEEDED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_errcode
	leaq	L_.str(%rip), %rdi
	callq	_errmsg
	movl	%ebx, %edi
	movl	%eax, %esi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_ereport                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MaxAllocSize,4,2               ## @MaxAllocSize
	.comm	_ERROR,4,2                      ## @ERROR
	.comm	_ERRCODE_PROGRAM_LIMIT_EXCEEDED,4,2 ## @ERRCODE_PROGRAM_LIMIT_EXCEEDED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"out of memory"

	.no_dead_strip	_protect_out_of_mem
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function protect_out_of_mem
_protect_out_of_mem:                    ; @protect_out_of_mem
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	cmp	w0, #0
	cinc	w8, w0, lt
	sbfx	x8, x8, #1, #31
Lloh0:
	adrp	x9, _MaxAllocSize@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MaxAllocSize@GOTPAGEOFF]
Lloh2:
	ldrsw	x20, [x9]
	mov	x9, #-6148914691236517206
	movk	x9, #43691
	umulh	x9, x20, x9
	cmp	x8, x9, lsr #3
	b.hs	LBB0_3
; %bb.1:
	mov	x19, x0
	bl	_pg_database_encoding_max_length
	sdiv	w8, w20, w0
	cmp	w8, w19
	b.le	LBB0_3
; %bb.2:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_3:
Lloh3:
	adrp	x8, _ERROR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh5:
	ldr	w19, [x8]
Lloh6:
	adrp	x8, _ERRCODE_PROGRAM_LIMIT_EXCEEDED@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ERRCODE_PROGRAM_LIMIT_EXCEEDED@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_errcode
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	bl	_errmsg
	mov	x1, x0
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_ereport
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_MaxAllocSize,4,2               ; @MaxAllocSize
	.comm	_ERROR,4,2                      ; @ERROR
	.comm	_ERRCODE_PROGRAM_LIMIT_EXCEEDED,4,2 ; @ERRCODE_PROGRAM_LIMIT_EXCEEDED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"out of memory"

	.no_dead_strip	_protect_out_of_mem
.subsections_via_symbols
