	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movq	%rsi, %rbx
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	callq	_init_file_tables
	testq	%rbx, %rbx
	je	LBB0_1
## %bb.2:
	testq	%rbx, %rbx
	jne	LBB0_4
LBB0_3:
	movq	_MAGICFILE@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
LBB0_4:
	movq	%rbx, %rdi
	callq	_strdup
	testq	%rax, %rax
	je	LBB0_5
## %bb.7:
	movq	%rax, %r12
	movl	$16, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_8
## %bb.9:
	movq	%rax, %r13
	movq	%rax, (%rax)
	movq	%rax, 8(%rax)
	movl	$-1, %ebx
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	_PATHSEP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_strchr
	testq	%rax, %rax
	je	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	%rax, %r14
	incq	%r14
	movb	$0, (%rax)
	cmpb	$0, (%r12)
	jne	LBB0_14
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_10 Depth=1
	xorl	%r14d, %r14d
	cmpb	$0, (%r12)
	je	LBB0_15
LBB0_14:                                ##   in Loop: Header=BB0_10 Depth=1
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r12, %rsi
	movl	%r15d, %edx
	movq	%r13, %rcx
	callq	_apprentice_1
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_R_MAX
	movl	%eax, %ebx
	movq	%r14, %r12
	testq	%r14, %r14
	jne	LBB0_10
LBB0_15:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
	cmpl	$-1, %ebx
	jne	LBB0_17
## %bb.16:
	movq	%r13, %rdi
	callq	_R_FREE
	leaq	L_.str.1(%rip), %rdx
	xorl	%r13d, %r13d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	xorl	%esi, %esi
	callq	_file_error
	jmp	LBB0_17
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_getenv
	movq	%rax, %rbx
	testq	%rbx, %rbx
	je	LBB0_3
	jmp	LBB0_4
LBB0_5:
	movq	%rbx, %rdi
	callq	_strlen
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %esi
	jmp	LBB0_6
LBB0_8:
	movq	%r12, %rdi
	callq	_free
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	$16, %esi
LBB0_6:
	callq	_file_oomem
	xorl	%r13d, %r13d
LBB0_17:
	movq	%r13, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MAGIC"

	.comm	_MAGICFILE,8,3                  ## @MAGICFILE
	.comm	_PATHSEP,4,2                    ## @PATHSEP
L_.str.1:                               ## @.str.1
	.asciz	"could not find any magic files!"

.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:
	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
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	bl	_init_file_tables
	cbnz	x21, LBB0_2
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_getenv
	mov	x21, x0
LBB0_2:
Lloh2:
	adrp	x8, _MAGICFILE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MAGICFILE@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x21, #0
	csel	x21, x8, x21, eq
	mov	x0, x21
	bl	_strdup
	cbz	x0, LBB0_11
; %bb.3:
	mov	x22, x0
	mov	w0, #16
	bl	_malloc
	mov	x21, x0
	cbz	x0, LBB0_13
; %bb.4:
	stp	x21, x21, [x21]
	mov	w23, #-1
	mov	x24, x22
Lloh5:
	adrp	x26, _PATHSEP@GOTPAGE
Lloh6:
	ldr	x26, [x26, _PATHSEP@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x26]
	mov	x0, x24
	bl	_strchr
	mov	x25, x0
	cbz	x0, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	strb	wzr, [x25], #1
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldrb	w8, [x24]
	cbz	w8, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x24
	mov	x2, x20
	mov	x3, x21
	bl	_apprentice_1
	mov	x1, x0
	mov	x0, x23
	bl	_R_MAX
	mov	x23, x0
	mov	x24, x25
	cbnz	x25, LBB0_5
LBB0_9:
	mov	x0, x22
	bl	_free
	cmn	w23, #1
	b.ne	LBB0_14
; %bb.10:
	mov	x0, x21
	bl	_R_FREE
Lloh7:
	adrp	x2, l_.str.1@PAGE
Lloh8:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	w1, #0
	bl	_file_error
	b	LBB0_12
LBB0_11:
	mov	x0, x21
	bl	_strlen
	mov	x1, x0
	mov	x0, x19
	bl	_file_oomem
LBB0_12:
	mov	x21, #0
	b	LBB0_14
LBB0_13:
	mov	x0, x22
	bl	_free
	mov	x0, x19
	mov	w1, #16
	bl	_file_oomem
LBB0_14:
	mov	x0, x21
	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
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MAGIC"

	.comm	_MAGICFILE,8,3                  ; @MAGICFILE
	.comm	_PATHSEP,4,2                    ; @PATHSEP
l_.str.1:                               ; @.str.1
	.asciz	"could not find any magic files!"

.subsections_via_symbols
