	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_buffer_apprentice              ## -- Begin function buffer_apprentice
	.p2align	4, 0x90
_buffer_apprentice:                     ## @buffer_apprentice
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movl	$-1, %eax
	testq	%rcx, %rcx
	je	LBB0_18
## %bb.1:
	movq	%rcx, %r13
	movq	%rdi, %r12
	xorl	%esi, %esi
	callq	_file_reset
	xorl	%eax, %eax
	callq	_init_file_tables
	movq	_MAGIC_SETS@GOTPCREL(%rip), %r15
	cmpq	$0, (%r15)
	je	LBB0_5
## %bb.2:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	_mlist_free
	xorl	%eax, %eax
	callq	_mlist_alloc
	movq	(%r12), %rcx
	movq	%rax, (%rcx,%rbx,8)
	testq	%rax, %rax
	je	LBB0_11
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	incq	%rbx
	cmpq	(%r15), %rbx
	jb	LBB0_3
LBB0_5:
	cmpq	$2, %r13
	movl	$1, %eax
	cmovaeq	%r13, %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_6 Depth=1
	incq	%rbx
	cmpq	-48(%rbp), %rbx                 ## 8-byte Folded Reload
	je	LBB0_17
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_10 Depth 2
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax,%rbx,8), %rsi
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax,%rbx,8), %rdx
	movq	%r12, %rdi
	callq	_apprentice_buf
	testq	%rax, %rax
	je	LBB0_12
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	cmpq	$0, (%r15)
	je	LBB0_16
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, %r13
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%r12), %rax
	movq	(%rax,%r14,8), %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	callq	_add_mlist
	cmpl	$-1, %eax
	je	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_10 Depth=2
	incq	%r14
	cmpq	(%r15), %r14
	jb	LBB0_10
	jmp	LBB0_16
LBB0_11:
	movq	%r12, %rdi
	movl	$4, %esi
	callq	_file_oomem
LBB0_12:
	cmpq	$0, (%r15)
	je	LBB0_15
## %bb.13:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	_mlist_free
	movq	(%r12), %rax
	movq	$0, (%rax,%rbx,8)
	incq	%rbx
	cmpq	(%r15), %rbx
	jb	LBB0_14
LBB0_15:
	movl	$-1, %eax
LBB0_18:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	xorl	%eax, %eax
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_MAGIC_SETS,8,3                 ## @MAGIC_SETS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_buffer_apprentice              ; -- Begin function buffer_apprentice
	.p2align	2
_buffer_apprentice:                     ; @buffer_apprentice
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	cbz	x3, LBB0_16
; %bb.1:
	mov	x22, x3
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	mov	w1, #0
	bl	_file_reset
	bl	_init_file_tables
Lloh0:
	adrp	x24, _MAGIC_SETS@GOTPAGE
Lloh1:
	ldr	x24, [x24, _MAGIC_SETS@GOTPAGEOFF]
	ldr	x8, [x24]
	cbz	x8, LBB0_5
; %bb.2:
	mov	x23, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	lsl	x25, x23, #3
	ldr	x0, [x8, x25]
	bl	_mlist_free
	bl	_mlist_alloc
	ldr	x8, [x19]
	str	x0, [x8, x25]
	cbz	x0, LBB0_12
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x23, x23, #1
	ldr	x8, [x24]
	cmp	x23, x8
	b.lo	LBB0_3
LBB0_5:
	mov	x25, #0
	cmp	x22, #1
	csinc	x26, x22, xzr, hi
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x25, x25, #1
	cmp	x25, x26
	b.eq	LBB0_18
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	lsl	x8, x25, #3
	ldr	x1, [x21, x8]
	ldr	x2, [x20, x8]
	mov	x0, x19
	bl	_apprentice_buf
	cbz	x0, LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x24]
	cbz	x8, LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x22, x0
	mov	x23, #0
LBB0_10:                                ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x8, [x19]
	ldr	x0, [x8, x23, lsl #3]
	mov	x1, x22
	mov	x2, x23
	bl	_add_mlist
	cmn	w0, #1
	b.eq	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=2
	add	x23, x23, #1
	ldr	x8, [x24]
	cmp	x23, x8
	b.lo	LBB0_10
	b	LBB0_6
LBB0_12:
	mov	x0, x19
	mov	w1, #4
	bl	_file_oomem
LBB0_13:
	ldr	x8, [x24]
	cbz	x8, LBB0_16
; %bb.14:
	mov	x20, #0
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	lsl	x21, x20, #3
	ldr	x0, [x8, x21]
	bl	_mlist_free
	ldr	x8, [x19]
	str	xzr, [x8, x21]
	add	x20, x20, #1
	ldr	x8, [x24]
	cmp	x20, x8
	b.lo	LBB0_15
LBB0_16:
	mov	w0, #-1
LBB0_17:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_18:
	mov	w0, #0
	b	LBB0_17
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_MAGIC_SETS,8,3                 ; @MAGIC_SETS
.subsections_via_symbols
