	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ahci_a10_attach
_ahci_a10_attach:                       ## @ahci_a10_attach
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %rbx
	movq	$0, -48(%rbp)
	movq	$0, -40(%rbp)
	movq	_AHCI_Q_NOPMP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 64(%rbx)
	leaq	8(%rbx), %rdx
	movq	$0, 8(%rbx)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 48(%rbx)
	movups	%xmm0, 32(%rbx)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movl	%eax, 4(%rbx)
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	leaq	-48(%rbp), %rcx
	movl	%r14d, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_clk_get_by_ofw_index
	testl	%eax, %eax
	je	LBB0_10
## %bb.3:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_4
LBB0_1:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_20
LBB0_10:
	leaq	-40(%rbp), %rcx
	movl	%r14d, %edi
	xorl	%esi, %esi
	movl	$1, %edx
	callq	_clk_get_by_ofw_index
	testl	%eax, %eax
	je	LBB0_12
## %bb.11:
	movl	%eax, %r15d
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_4
LBB0_12:
	movq	-40(%rbp), %rdi
	movq	_PLL_FREQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CLK_SET_ROUND_DOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_clk_set_freq
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	movl	%eax, %r15d
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_4
LBB0_14:
	movq	-40(%rbp), %rdi
	callq	_clk_enable
	testl	%eax, %eax
	je	LBB0_16
## %bb.15:
	movl	%eax, %r15d
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_4
LBB0_16:
	movq	-48(%rbp), %rdi
	callq	_clk_enable
	testl	%eax, %eax
	je	LBB0_18
## %bb.17:
	movl	%eax, %r15d
	leaq	L_.str.4(%rip), %rsi
LBB0_4:
	movl	%r14d, %edi
	callq	_device_printf
LBB0_5:
	movq	-48(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_7
## %bb.6:
	callq	_clk_release
LBB0_7:
	movq	-40(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_9
## %bb.8:
	callq	_clk_release
LBB0_9:
	movl	(%r12), %esi
	movq	8(%rbx), %rdx
	movl	4(%rbx), %ecx
	movl	%r14d, %edi
	callq	_bus_release_resource
LBB0_20:
	movl	%r15d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	movl	%r14d, %edi
	callq	_ahci_a10_ctlr_reset
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_5
## %bb.19:
	movq	$0, 24(%rbx)
	movl	$1, (%rbx)
	movq	_ahci_a10_ch_start@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rbx)
	movl	%r14d, %edi
	callq	_ahci_attach
	movl	%eax, %r15d
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_AHCI_Q_NOPMP,4,2               ## @AHCI_Q_NOPMP
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
	.comm	_ENXIO,4,2                      ## @ENXIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot get gate clock\n"

L_.str.1:                               ## @.str.1
	.asciz	"Cannot get PLL clock\n"

	.comm	_PLL_FREQ,4,2                   ## @PLL_FREQ
	.comm	_CLK_SET_ROUND_DOWN,4,2         ## @CLK_SET_ROUND_DOWN
L_.str.2:                               ## @.str.2
	.asciz	"Cannot set PLL frequency\n"

L_.str.3:                               ## @.str.3
	.asciz	"Cannot enable PLL\n"

L_.str.4:                               ## @.str.4
	.asciz	"Cannot enable clk gate\n"

	.comm	_ahci_a10_ch_start,4,2          ## @ahci_a10_ch_start
	.no_dead_strip	_ahci_a10_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ahci_a10_attach
_ahci_a10_attach:                       ; @ahci_a10_attach
	.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	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	stp	xzr, xzr, [sp]
Lloh0:
	adrp	x8, _AHCI_Q_NOPMP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AHCI_Q_NOPMP@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x0, #64]
	mov	x2, x0
	str	xzr, [x2, #8]!
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [x0, #32]
Lloh3:
	adrp	x22, _SYS_RES_MEMORY@GOTPAGE
Lloh4:
	ldr	x22, [x22, _SYS_RES_MEMORY@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh5:
	adrp	x8, _RF_ACTIVE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _RF_ACTIVE@GOTPAGEOFF]
Lloh7:
	ldr	w3, [x8]
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	w0, [x20, #4]
	cbz	w0, LBB0_3
; %bb.1:
	mov	x3, sp
	mov	x0, x19
	mov	w1, #0
	mov	w2, #0
	bl	_clk_get_by_ofw_index
	cbz	w0, LBB0_4
; %bb.2:
	mov	x21, x0
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_12
LBB0_3:
Lloh10:
	adrp	x8, _ENXIO@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh12:
	ldr	w21, [x8]
	b	LBB0_18
LBB0_4:
	add	x3, sp, #8
	mov	x0, x19
	mov	w1, #0
	mov	w2, #1
	bl	_clk_get_by_ofw_index
	cbz	w0, LBB0_6
; %bb.5:
	mov	x21, x0
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_12
LBB0_6:
	ldr	x0, [sp, #8]
Lloh15:
	adrp	x8, _PLL_FREQ@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PLL_FREQ@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	adrp	x8, _CLK_SET_ROUND_DOWN@GOTPAGE
Lloh19:
	ldr	x8, [x8, _CLK_SET_ROUND_DOWN@GOTPAGEOFF]
Lloh20:
	ldr	w2, [x8]
	bl	_clk_set_freq
	cbz	w0, LBB0_8
; %bb.7:
	mov	x21, x0
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_12
LBB0_8:
	ldr	x0, [sp, #8]
	bl	_clk_enable
	cbz	w0, LBB0_10
; %bb.9:
	mov	x21, x0
Lloh23:
	adrp	x1, l_.str.3@PAGE
Lloh24:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_12
LBB0_10:
	ldr	x0, [sp]
	bl	_clk_enable
	cbz	w0, LBB0_19
; %bb.11:
	mov	x21, x0
Lloh25:
	adrp	x1, l_.str.4@PAGE
Lloh26:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_12:
	mov	x0, x19
	bl	_device_printf
LBB0_13:
	ldr	x0, [sp]
	cbz	x0, LBB0_15
; %bb.14:
	bl	_clk_release
LBB0_15:
	ldr	x0, [sp, #8]
	cbz	x0, LBB0_17
; %bb.16:
	bl	_clk_release
LBB0_17:
	ldr	w1, [x22]
	ldr	x2, [x20, #8]
	ldr	w3, [x20, #4]
	mov	x0, x19
	bl	_bus_release_resource
LBB0_18:
	mov	x0, x21
	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_19:
	mov	x0, x19
	bl	_ahci_a10_ctlr_reset
	mov	x21, x0
	cbnz	w0, LBB0_13
; %bb.20:
	str	xzr, [x20, #24]
	mov	w8, #1
	str	w8, [x20]
Lloh27:
	adrp	x8, _ahci_a10_ch_start@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ahci_a10_ch_start@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	str	w8, [x20, #16]
	mov	x0, x19
	bl	_ahci_attach
	mov	x21, x0
	b	LBB0_18
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_AHCI_Q_NOPMP,4,2               ; @AHCI_Q_NOPMP
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
	.comm	_ENXIO,4,2                      ; @ENXIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot get gate clock\n"

l_.str.1:                               ; @.str.1
	.asciz	"Cannot get PLL clock\n"

	.comm	_PLL_FREQ,4,2                   ; @PLL_FREQ
	.comm	_CLK_SET_ROUND_DOWN,4,2         ; @CLK_SET_ROUND_DOWN
l_.str.2:                               ; @.str.2
	.asciz	"Cannot set PLL frequency\n"

l_.str.3:                               ; @.str.3
	.asciz	"Cannot enable PLL\n"

l_.str.4:                               ; @.str.4
	.asciz	"Cannot enable clk gate\n"

	.comm	_ahci_a10_ch_start,4,2          ; @ahci_a10_ch_start
	.no_dead_strip	_ahci_a10_attach
.subsections_via_symbols
