	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_file_apprentice                ## -- Begin function file_apprentice
	.p2align	4, 0x90
_file_apprentice:                       ## @file_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %rbx
	movq	%rdi, %r13
	xorl	%esi, %esi
	callq	_file_reset
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_magic_getpath
	movl	$-1, %r12d
	testq	%rax, %rax
	je	LBB0_23
## %bb.1:
	movq	%rax, %rbx
	xorl	%eax, %eax
	callq	_init_file_tables
	movq	%rbx, %rdi
	callq	_strdup
	testq	%rax, %rax
	je	LBB0_24
## %bb.2:
	movq	%rax, %r15
	movq	_MAGIC_SETS@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.3:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	_mlist_free
	xorl	%eax, %eax
	callq	_mlist_alloc
	movq	(%r13), %rcx
	movq	%rax, (%rcx,%rbx,8)
	testq	%rax, %rax
	je	LBB0_5
## %bb.8:                               ##   in Loop: Header=BB0_4 Depth=1
	incq	%rbx
	movq	_MAGIC_SETS@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jb	LBB0_4
LBB0_9:
	movl	$-1, %r12d
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	movq	%r15, %rbx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	_PATHSEP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_strchr
	testq	%rax, %rax
	je	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	%rax, %r15
	incq	%r15
	movb	$0, (%rax)
	cmpb	$0, (%rbx)
	jne	LBB0_14
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_10 Depth=1
	xorl	%r15d, %r15d
	cmpb	$0, (%rbx)
	je	LBB0_15
LBB0_14:                                ##   in Loop: Header=BB0_10 Depth=1
	movq	%r13, %rdi
	movq	%rbx, %rsi
	movl	%r14d, %edx
	callq	_apprentice_1
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_MAX
	movl	%eax, %r12d
	movq	%r15, %rbx
	testq	%r15, %r15
	jne	LBB0_10
LBB0_15:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
	cmpl	$-1, %r12d
	je	LBB0_16
## %bb.20:
	movl	%r14d, %eax
	andl	$-4, %eax
	xorl	%r12d, %r12d
	cmpl	$128, %eax
	je	LBB0_23
## %bb.21:
	leaq	L_.str.1(%rip), %rdx
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	_file_error
	jmp	LBB0_22
LBB0_24:
	movq	%rbx, %rdi
	callq	_strlen
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_file_oomem
	jmp	LBB0_23
LBB0_5:
	movq	%r13, %rdi
	movl	$4, %esi
	callq	_file_oomem
	testq	%rbx, %rbx
	je	LBB0_7
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rax
	movq	-8(%rax,%rbx,8), %rdi
	callq	_mlist_free
	movq	(%r13), %rax
	movq	$0, -8(%rax,%rbx,8)
	decq	%rbx
	jne	LBB0_6
LBB0_7:
	movq	%r15, %rdi
	callq	_free
	jmp	LBB0_23
LBB0_16:
	movq	_MAGIC_SETS@GOTPCREL(%rip), %r14
	cmpq	$0, (%r14)
	je	LBB0_19
## %bb.17:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	_mlist_free
	movq	(%r13), %rax
	movq	$0, (%rax,%rbx,8)
	incq	%rbx
	cmpq	(%r14), %rbx
	jb	LBB0_18
LBB0_19:
	leaq	L_.str(%rip), %rdx
	movq	%r13, %rdi
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	_file_error
LBB0_22:
	movl	$-1, %r12d
LBB0_23:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAGIC_SETS,8,3                 ## @MAGIC_SETS
	.comm	_PATHSEP,4,2                    ## @PATHSEP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not find any valid magic files!"

L_.str.1:                               ## @.str.1
	.asciz	"Invalid action %d"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_file_apprentice                ; -- Begin function file_apprentice
	.p2align	2
_file_apprentice:                       ; @file_apprentice
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	mov	w1, #0
	bl	_file_reset
	mov	x0, x21
	mov	x1, x20
	bl	_magic_getpath
	cbz	x0, LBB0_25
; %bb.1:
	mov	x22, x0
	bl	_init_file_tables
	mov	x0, x22
	bl	_strdup
	cbz	x0, LBB0_14
; %bb.2:
	mov	x21, x0
Lloh0:
	adrp	x25, _MAGIC_SETS@GOTPAGE
Lloh1:
	ldr	x25, [x25, _MAGIC_SETS@GOTPAGEOFF]
	ldr	x8, [x25]
	cbz	x8, LBB0_6
; %bb.3:
	mov	x22, #0
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	lsl	x23, x22, #3
	ldr	x0, [x8, x23]
	bl	_mlist_free
	bl	_mlist_alloc
	ldr	x8, [x19]
	str	x0, [x8, x23]
	cbz	x0, LBB0_15
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x22, x22, #1
	ldr	x8, [x25]
	cmp	x22, x8
	b.lo	LBB0_4
LBB0_6:
	mov	w22, #-1
Lloh2:
	adrp	x26, _PATHSEP@GOTPAGE
Lloh3:
	ldr	x26, [x26, _PATHSEP@GOTPAGEOFF]
	mov	x23, x21
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x26]
	mov	x0, x23
	bl	_strchr
	mov	x24, x0
	cbz	x0, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	strb	wzr, [x24], #1
LBB0_9:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldrb	w8, [x23]
	cbz	w8, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	mov	x0, x19
	mov	x1, x23
	mov	x2, x20
	bl	_apprentice_1
	mov	x1, x0
	mov	x0, x22
	bl	_MAX
	mov	x22, x0
	mov	x23, x24
	cbnz	x24, LBB0_7
LBB0_11:
	mov	x0, x21
	bl	_free
	cmn	w22, #1
	b.eq	LBB0_19
; %bb.12:
	and	w8, w20, #0xfffffffc
	cmp	w8, #128
	b.ne	LBB0_23
; %bb.13:
	mov	w0, #0
	b	LBB0_26
LBB0_14:
	mov	x0, x22
	bl	_strlen
	mov	x1, x0
	mov	x0, x19
	bl	_file_oomem
	b	LBB0_25
LBB0_15:
	mov	x0, x19
	mov	w1, #4
	bl	_file_oomem
	cbz	x22, LBB0_18
; %bb.16:
	sub	x20, x22, #1
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	lsl	x22, x20, #3
	ldr	x0, [x8, x22]
	bl	_mlist_free
	ldr	x8, [x19]
	str	xzr, [x8, x22]
	sub	x20, x20, #1
	cmn	x20, #1
	b.ne	LBB0_17
LBB0_18:
	mov	x0, x21
	bl	_free
	b	LBB0_25
LBB0_19:
	ldr	x8, [x25]
	cbz	x8, LBB0_22
; %bb.20:
	mov	x20, #0
LBB0_21:                                ; =>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, [x25]
	cmp	x20, x8
	b.lo	LBB0_21
LBB0_22:
Lloh4:
	adrp	x2, l_.str@PAGE
Lloh5:
	add	x2, x2, l_.str@PAGEOFF
	b	LBB0_24
LBB0_23:
	str	x20, [sp]
Lloh6:
	adrp	x2, l_.str.1@PAGE
Lloh7:
	add	x2, x2, l_.str.1@PAGEOFF
LBB0_24:
	mov	x0, x19
	mov	w1, #0
	bl	_file_error
LBB0_25:
	mov	w0, #-1
LBB0_26:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_MAGIC_SETS,8,3                 ; @MAGIC_SETS
	.comm	_PATHSEP,4,2                    ; @PATHSEP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not find any valid magic files!"

l_.str.1:                               ; @.str.1
	.asciz	"Invalid action %d"

.subsections_via_symbols
