	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function buffer_write
_buffer_write:                          ## @buffer_write
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	(%rdi), %rdi
	leaq	(%rdi,%rdx), %rsi
	cmpq	8(%rbx), %rsi
	jbe	LBB0_1
## %bb.2:
	movq	16(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_3
## %bb.4:
	callq	_realloc
	testq	%rax, %rax
	je	LBB0_6
LBB0_7:
	movq	%rax, 16(%rbx)
	movq	(%rbx), %rdi
	leaq	(%rdi,%r14), %rcx
	movq	%rcx, 8(%rbx)
	jmp	LBB0_8
LBB0_1:
	movq	16(%rbx), %rax
LBB0_8:
	addq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_memcpy
	addq	%r14, (%rbx)
	jmp	LBB0_9
LBB0_3:
	movl	$1024, %edi                     ## imm = 0x400
	callq	_malloc
	testq	%rax, %rax
	jne	LBB0_7
LBB0_6:
	movq	$-1, %r14
LBB0_9:
	movq	%r14, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_buffer_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function buffer_write
_buffer_write:                          ; @buffer_write
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	ldp	x8, x9, [x0]
	add	x1, x8, x2
	cmp	x1, x9
	b.ls	LBB0_4
; %bb.1:
	ldr	x0, [x20, #16]
	cbz	x0, LBB0_6
; %bb.2:
	bl	_realloc
	cbz	x0, LBB0_7
LBB0_3:
	ldr	x8, [x20]
	add	x9, x8, x19
	stp	x9, x0, [x20, #8]
	b	LBB0_5
LBB0_4:
	ldr	x0, [x20, #16]
LBB0_5:
	add	x0, x0, x8
	mov	x1, x21
	mov	x2, x19
	bl	_memcpy
	ldr	x8, [x20]
	add	x8, x8, x19
	str	x8, [x20]
	b	LBB0_8
LBB0_6:
	mov	w0, #1024
	bl	_malloc
	cbnz	x0, LBB0_3
LBB0_7:
	mov	x19, #-1
LBB0_8:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_buffer_write
.subsections_via_symbols
