	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ebuf_head_extend
_ebuf_head_extend:                      ## @ebuf_head_extend
	.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	%rsi, %r14
	movq	%rdi, %r15
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movq	(%r15), %rax
	movq	_EBUF_MAGIC@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	jmp	LBB0_3
LBB0_1:
	xorl	%edi, %edi
LBB0_3:
	callq	_PJDLOG_ASSERT
	movq	16(%r15), %rdx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	3(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$2, %ecx
	movslq	%ecx, %r13
	movq	8(%r15), %rbx
	addq	%r14, %rbx
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	subq	%rdx, %rbx
	addq	%r13, %rbx
	movq	%rbx, %rdi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rax, %r12
	addq	%rax, %r13
	addq	%r14, %r13
	movq	24(%r15), %rsi
	movq	%rsi, %r14
	subq	-48(%rbp), %r14                 ## 8-byte Folded Reload
	addq	%r13, %r14
	movl	32(%r15), %edx
	movq	%r14, %rdi
	callq	_memmove
	movq	%r12, 16(%r15)
	movq	%r14, 24(%r15)
	addq	%r12, %rbx
	movq	%rbx, 8(%r15)
	xorl	%eax, %eax
	jmp	LBB0_6
LBB0_4:
	movl	$-1, %eax
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUF_MAGIC,8,3                 ## @EBUF_MAGIC
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.no_dead_strip	_ebuf_head_extend
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ebuf_head_extend
_ebuf_head_extend:                      ; @ebuf_head_extend
	.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	x20, x1
	mov	x19, x0
	cbz	x0, LBB0_2
; %bb.1:
	ldr	x8, [x19]
Lloh0:
	adrp	x9, _EBUF_MAGIC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _EBUF_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, eq
LBB0_2:
	bl	_PJDLOG_ASSERT
	ldp	x8, x23, [x19, #8]
Lloh3:
	adrp	x9, _PAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PAGE_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	add	w10, w9, #3
	cmp	w9, #0
	csel	w9, w10, w9, lt
	sbfx	x24, x9, #2, #30
	add	x8, x8, x20
	sub	x8, x8, x23
	add	x21, x8, x24
	mov	x0, x21
	bl	_malloc
	cbz	x0, LBB0_4
; %bb.3:
	mov	x22, x0
	add	x8, x0, x24
	add	x8, x8, x20
	ldr	x1, [x19, #24]
	sub	x9, x1, x23
	add	x20, x8, x9
	ldr	w2, [x19, #32]
	mov	x0, x20
	bl	_memmove
	mov	w0, #0
	stp	x22, x20, [x19, #16]
	add	x8, x22, x21
	str	x8, [x19, #8]
	b	LBB0_5
LBB0_4:
	mov	w0, #-1
LBB0_5:
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUF_MAGIC,8,3                 ; @EBUF_MAGIC
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.no_dead_strip	_ebuf_head_extend
.subsections_via_symbols
