	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apply_overlay
_apply_overlay:                         ## @apply_overlay
	.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, %r13
	movq	%rdi, %r15
	movq	_dt_overlays_dir@GOTPCREL(%rip), %rax
	movslq	(%rax), %rsi
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	movq	%r13, %rdx
	xorl	%eax, %eax
	callq	_sprintf_dup
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_dir_exists
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_error
	jmp	LBB0_13
LBB0_2:
	movq	_DIR_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_mkdir
	testq	%rax, %rax
	je	LBB0_3
## %bb.12:
	leaq	L_.str.6(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_error
	jmp	LBB0_13
LBB0_3:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_dtoverlay_load_dtb
	testq	%rax, %rax
	je	LBB0_4
## %bb.6:
	movq	%rax, %r15
	leaq	L_.str.3(%rip), %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_sprintf_dup
	movq	%rax, %r12
	movq	%r15, %rdi
	movq	%rax, %rsi
	callq	_dtoverlay_save_dtb
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:
	leaq	L_.str.4(%rip), %rdi
LBB0_8:
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_error
	movq	%r12, %rdi
	callq	_free_string
	movq	%r15, %rdi
	callq	_dtoverlay_free_dtb
	jmp	LBB0_5
LBB0_4:
	leaq	L_.str.2(%rip), %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_error
LBB0_5:
	movq	%r14, %rdi
	callq	_rmdir
	xorl	%ebx, %ebx
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	%r14, %rdi
	callq	_overlay_applied
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:
	movq	%r12, %rdi
	callq	_free_string
	movq	%r15, %rdi
	callq	_dtoverlay_free_dtb
	movl	$1, %ebx
	jmp	LBB0_13
LBB0_10:
	leaq	L_.str.5(%rip), %rdi
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s/%s"

	.comm	_dt_overlays_dir,4,2            ## @dt_overlays_dir
L_.str.1:                               ## @.str.1
	.asciz	"Overlay '%s' is already loaded"

	.comm	_DIR_MODE,4,2                   ## @DIR_MODE
L_.str.2:                               ## @.str.2
	.asciz	"Failed to apply overlay '%s' (load)"

L_.str.3:                               ## @.str.3
	.asciz	"%s/dtbo"

L_.str.4:                               ## @.str.4
	.asciz	"Failed to apply overlay '%s' (save)"

L_.str.5:                               ## @.str.5
	.asciz	"Failed to apply overlay '%s' (kernel)"

L_.str.6:                               ## @.str.6
	.asciz	"Failed to create overlay directory"

	.no_dead_strip	_apply_overlay
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apply_overlay
_apply_overlay:                         ; @apply_overlay
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _dt_overlays_dir@GOTPAGE
Lloh1:
	ldr	x8, [x8, _dt_overlays_dir@GOTPAGEOFF]
Lloh2:
	ldrsw	x1, [x8]
	str	x20, [sp]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_sprintf_dup
	mov	x19, x0
	bl	_dir_exists
	cbz	x0, LBB0_2
; %bb.1:
	str	x20, [sp]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_4
LBB0_2:
Lloh7:
	adrp	x8, _DIR_MODE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _DIR_MODE@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_mkdir
	cbz	x0, LBB0_7
; %bb.3:
Lloh10:
	adrp	x0, l_.str.6@PAGE
Lloh11:
	add	x0, x0, l_.str.6@PAGEOFF
LBB0_4:
	bl	_error
LBB0_5:
	mov	w0, #0
LBB0_6:
	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
	add	sp, sp, #64
	ret
LBB0_7:
	mov	x0, x21
	mov	w1, #0
	bl	_dtoverlay_load_dtb
	cbz	x0, LBB0_11
; %bb.8:
	mov	x21, x0
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x19
	bl	_sprintf_dup
	mov	x22, x0
	mov	x0, x21
	mov	x1, x22
	bl	_dtoverlay_save_dtb
	cbz	x0, LBB0_13
; %bb.9:
	str	x20, [sp]
Lloh14:
	adrp	x0, l_.str.4@PAGE
Lloh15:
	add	x0, x0, l_.str.4@PAGEOFF
LBB0_10:
	bl	_error
	mov	x0, x22
	bl	_free_string
	mov	x0, x21
	bl	_dtoverlay_free_dtb
	b	LBB0_12
LBB0_11:
	str	x20, [sp]
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_error
LBB0_12:
	mov	x0, x19
	bl	_rmdir
	b	LBB0_5
LBB0_13:
	mov	x0, x19
	bl	_overlay_applied
	cbz	w0, LBB0_15
; %bb.14:
	mov	x0, x22
	bl	_free_string
	mov	x0, x21
	bl	_dtoverlay_free_dtb
	mov	w0, #1
	b	LBB0_6
LBB0_15:
	str	x20, [sp]
Lloh18:
	adrp	x0, l_.str.5@PAGE
Lloh19:
	add	x0, x0, l_.str.5@PAGEOFF
	b	LBB0_10
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s/%s"

	.comm	_dt_overlays_dir,4,2            ; @dt_overlays_dir
l_.str.1:                               ; @.str.1
	.asciz	"Overlay '%s' is already loaded"

	.comm	_DIR_MODE,4,2                   ; @DIR_MODE
l_.str.2:                               ; @.str.2
	.asciz	"Failed to apply overlay '%s' (load)"

l_.str.3:                               ; @.str.3
	.asciz	"%s/dtbo"

l_.str.4:                               ; @.str.4
	.asciz	"Failed to apply overlay '%s' (save)"

l_.str.5:                               ; @.str.5
	.asciz	"Failed to apply overlay '%s' (kernel)"

l_.str.6:                               ; @.str.6
	.asciz	"Failed to create overlay directory"

	.no_dead_strip	_apply_overlay
.subsections_via_symbols
