	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tegra_ahci_attach
_tegra_ahci_attach:                     ## @tegra_ahci_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	%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	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %rbx
	movl	%r14d, 8(%rax)
	movl	%r14d, %edi
	callq	_ofw_bus_get_node
	movl	%eax, %r12d
	leaq	16(%rbx), %rdx
	movl	$0, 16(%rbx)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	movl	%r14d, %edi
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	callq	_bus_alloc_resource_any
	movq	%rax, 24(%rbx)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movl	$1, -44(%rbp)
	movl	(%r15), %esi
	movl	(%r13), %ecx
	leaq	-44(%rbp), %rdx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, (%rbx)
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_get_fdt_resources
	testl	%eax, %eax
	je	LBB0_11
## %bb.5:
	movl	%eax, %r12d
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_6
LBB0_1:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	jmp	LBB0_17
LBB0_3:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r13
	jmp	LBB0_9
LBB0_11:
	movq	%rbx, %rdi
	callq	_enable_fdt_resources
	testl	%eax, %eax
	je	LBB0_13
## %bb.12:
	movl	%eax, %r12d
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_6
LBB0_13:
	movq	%rbx, %rdi
	callq	_tegra_ahci_ctrl_init
	testl	%eax, %eax
	je	LBB0_15
## %bb.14:
	movl	%eax, %r12d
	leaq	L_.str.2(%rip), %rsi
LBB0_6:
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r13
	movl	8(%rbx), %edi
	callq	_device_printf
LBB0_7:
	movq	(%rbx), %rcx
	testq	%rcx, %rcx
	je	LBB0_9
## %bb.8:
	movl	(%r13), %esi
	movl	%r14d, %edi
	movl	$1, %edx
	callq	_bus_release_resource
LBB0_9:
	movq	24(%rbx), %rcx
	testq	%rcx, %rcx
	je	LBB0_17
## %bb.10:
	movl	(%r13), %esi
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edx
	movl	%r14d, %edi
	callq	_bus_release_resource
LBB0_17:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movl	$1, 20(%rbx)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 32(%rbx)
	movl	%r14d, %edi
	callq	_tegra_ahci_ctlr_reset
	movl	%eax, %r12d
	testl	%eax, %eax
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r13
	jne	LBB0_7
## %bb.16:
	movl	%r14d, %edi
	callq	_ahci_attach
	movl	%eax, %r12d
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.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	"Failed to allocate FDT resource(s)\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to enable FDT resource(s)\n"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to initialize controller)\n"

	.no_dead_strip	_tegra_ahci_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tegra_ahci_attach
_tegra_ahci_attach:                     ; @tegra_ahci_attach
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	str	w19, [x0, #8]
	mov	x0, x19
	bl	_ofw_bus_get_node
	mov	x22, x0
	mov	x21, x20
	str	wzr, [x21, #16]!
Lloh0:
	adrp	x23, _SYS_RES_MEMORY@GOTPAGE
Lloh1:
	ldr	x23, [x23, _SYS_RES_MEMORY@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh2:
	adrp	x24, _RF_ACTIVE@GOTPAGE
Lloh3:
	ldr	x24, [x24, _RF_ACTIVE@GOTPAGEOFF]
	ldr	w3, [x24]
	mov	x0, x19
	mov	x2, x21
	bl	_bus_alloc_resource_any
	str	x0, [x20, #24]
	cbz	x0, LBB0_4
; %bb.1:
	mov	w8, #1
	str	w8, [sp, #12]
	ldr	w1, [x23]
	ldr	w3, [x24]
	add	x2, sp, #12
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	x0, [x20]
	cbz	x0, LBB0_5
; %bb.2:
	mov	x0, x20
	mov	x1, x22
	bl	_get_fdt_resources
	cbz	w0, LBB0_6
; %bb.3:
	mov	x22, x0
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_10
LBB0_4:
Lloh6:
	adrp	x8, _ENXIO@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh8:
	ldr	w22, [x8]
	b	LBB0_15
LBB0_5:
Lloh9:
	adrp	x8, _ENXIO@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh11:
	ldr	w22, [x8]
	b	LBB0_13
LBB0_6:
	mov	x0, x20
	bl	_enable_fdt_resources
	cbz	w0, LBB0_8
; %bb.7:
	mov	x22, x0
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_10
LBB0_8:
	mov	x0, x20
	bl	_tegra_ahci_ctrl_init
	cbz	w0, LBB0_16
; %bb.9:
	mov	x22, x0
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_10:
	ldr	w0, [x20, #8]
	bl	_device_printf
LBB0_11:
	ldr	x3, [x20]
	cbz	x3, LBB0_13
; %bb.12:
	ldr	w1, [x23]
	mov	x0, x19
	mov	w2, #1
	bl	_bus_release_resource
LBB0_13:
	ldr	x3, [x20, #24]
	cbz	x3, LBB0_15
; %bb.14:
	ldr	w1, [x23]
	ldr	w2, [x21]
	mov	x0, x19
	bl	_bus_release_resource
LBB0_15:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
LBB0_16:
	mov	w8, #1
	str	w8, [x20, #20]
	stp	xzr, xzr, [x20, #32]
	mov	x0, x19
	bl	_tegra_ahci_ctlr_reset
	mov	x22, x0
	cbnz	w0, LBB0_11
; %bb.17:
	mov	x0, x19
	bl	_ahci_attach
	mov	x22, x0
	b	LBB0_15
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.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	"Failed to allocate FDT resource(s)\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to enable FDT resource(s)\n"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to initialize controller)\n"

	.no_dead_strip	_tegra_ahci_attach
.subsections_via_symbols
