	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aw_spi_attach
_aw_spi_attach:                         ## @aw_spi_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
	pushq	%rax
	.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, %r13
	movl	%r14d, 32(%rax)
	leaq	28(%rax), %rbx
	movl	%r14d, %edi
	callq	_device_get_nameunit
	movq	_MTX_DEF@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	_aw_spi_spec@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	16(%r13), %rdx
	movl	%r14d, %edi
	callq	_bus_alloc_resources
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_2:
	movl	%r14d, %edi
	callq	_aw_spi_detach
	jmp	LBB0_18
LBB0_3:
	movq	16(%r13), %rax
	movq	_INTR_TYPE_MISC@GOTPCREL(%rip), %rcx
	movq	_INTR_MPSAFE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movl	4(%rax), %esi
	movq	_aw_spi_intr@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	leaq	24(%r13), %rax
	movq	%rax, (%rsp)
	movl	%r14d, %edi
	xorl	%ecx, %ecx
	movq	%r13, %r9
	callq	_bus_setup_intr
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movl	(%rbx), %esi
	movq	16(%r13), %rdx
	movl	%r14d, %edi
	callq	_bus_release_resources
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_18:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	leaq	12(%r13), %r15
	movl	%r14d, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	movq	%r15, %rcx
	callq	_hwreset_get_by_ofw_idx
	testq	%rax, %rax
	je	LBB0_6
LBB0_9:
	leaq	8(%r13), %r12
	leaq	L_.str.3(%rip), %rdx
	movl	%r14d, %edi
	xorl	%esi, %esi
	movq	%r12, %rcx
	callq	_clk_get_by_ofw_name
	testl	%eax, %eax
	je	LBB0_11
## %bb.10:
	movl	%eax, %r15d
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_8
LBB0_6:
	movl	(%r15), %edi
	callq	_hwreset_deassert
	testl	%eax, %eax
	je	LBB0_9
## %bb.7:
	movl	%eax, %r15d
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_8
LBB0_11:
	movq	%r13, %rbx
	addq	$4, %rbx
	leaq	L_.str.5(%rip), %rdx
	movl	%r14d, %edi
	xorl	%esi, %esi
	movq	%rbx, %rcx
	callq	_clk_get_by_ofw_name
	testl	%eax, %eax
	je	LBB0_13
## %bb.12:
	movl	%eax, %r15d
	leaq	L_.str.6(%rip), %rsi
	jmp	LBB0_8
LBB0_13:
	movl	(%r12), %edi
	callq	_clk_enable
	testl	%eax, %eax
	je	LBB0_15
## %bb.14:
	movl	%eax, %r15d
	leaq	L_.str.7(%rip), %rsi
	jmp	LBB0_8
LBB0_15:
	movl	(%rbx), %edi
	callq	_clk_enable
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movl	%eax, %r15d
	leaq	L_.str.8(%rip), %rsi
LBB0_8:
	movl	%r14d, %edi
	callq	_device_printf
	jmp	LBB0_2
LBB0_17:
	leaq	L_.str.9(%rip), %rsi
	movl	%r14d, %edi
	movl	$-1, %edx
	callq	_device_add_child
	movl	%eax, (%r13)
	xorl	%r15d, %r15d
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_MTX_DEF,4,2                    ## @MTX_DEF
	.comm	_aw_spi_spec,4,2                ## @aw_spi_spec
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot allocate resources for device\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_INTR_TYPE_MISC,4,2             ## @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ## @INTR_MPSAFE
	.comm	_aw_spi_intr,4,2                ## @aw_spi_intr
L_.str.1:                               ## @.str.1
	.asciz	"cannot setup interrupt handler\n"

L_.str.2:                               ## @.str.2
	.asciz	"cannot de-assert reset\n"

L_.str.3:                               ## @.str.3
	.asciz	"ahb"

L_.str.4:                               ## @.str.4
	.asciz	"cannot get ahb clock\n"

L_.str.5:                               ## @.str.5
	.asciz	"mod"

L_.str.6:                               ## @.str.6
	.asciz	"cannot get mod clock\n"

L_.str.7:                               ## @.str.7
	.asciz	"cannot enable ahb clock\n"

L_.str.8:                               ## @.str.8
	.asciz	"cannot enable mod clock\n"

L_.str.9:                               ## @.str.9
	.asciz	"spibus"

	.no_dead_strip	_aw_spi_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aw_spi_attach
_aw_spi_attach:                         ; @aw_spi_attach
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	str	w19, [x0, #32]
	add	x21, x0, #28
	mov	x0, x19
	bl	_device_get_nameunit
	mov	x1, x0
Lloh0:
	adrp	x8, _MTX_DEF@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTX_DEF@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	x0, x21
	mov	x2, #0
	bl	_mtx_init
Lloh3:
	adrp	x21, _aw_spi_spec@GOTPAGE
Lloh4:
	ldr	x21, [x21, _aw_spi_spec@GOTPAGEOFF]
	ldr	w1, [x21]
	ldr	x2, [x20, #16]
	mov	x0, x19
	bl	_bus_alloc_resources
	cbz	x0, LBB0_3
; %bb.1:
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_device_printf
Lloh7:
	adrp	x8, _ENXIO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh9:
	ldr	w21, [x8]
LBB0_2:
	mov	x0, x19
	bl	_aw_spi_detach
	b	LBB0_5
LBB0_3:
	ldr	x8, [x20, #16]
	ldr	w1, [x8, #4]
Lloh10:
	adrp	x8, _INTR_TYPE_MISC@GOTPAGE
Lloh11:
	ldr	x8, [x8, _INTR_TYPE_MISC@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _INTR_MPSAFE@GOTPAGE
Lloh14:
	ldr	x9, [x9, _INTR_MPSAFE@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh16:
	adrp	x8, _aw_spi_intr@GOTPAGE
Lloh17:
	ldr	x8, [x8, _aw_spi_intr@GOTPAGEOFF]
Lloh18:
	ldr	w4, [x8]
	add	x6, x20, #24
	mov	x0, x19
	mov	x3, #0
	mov	x5, x20
	bl	_bus_setup_intr
	cbz	x0, LBB0_6
; %bb.4:
	ldr	w1, [x21]
	ldr	x2, [x20, #16]
	mov	x0, x19
	bl	_bus_release_resources
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_device_printf
Lloh21:
	adrp	x8, _ENXIO@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh23:
	ldr	w21, [x8]
LBB0_5:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_6:
	add	x21, x20, #12
	mov	x0, x19
	mov	w1, #0
	mov	w2, #0
	mov	x3, x21
	bl	_hwreset_get_by_ofw_idx
	cbz	x0, LBB0_9
LBB0_7:
	add	x22, x20, #8
Lloh24:
	adrp	x2, l_.str.3@PAGE
Lloh25:
	add	x2, x2, l_.str.3@PAGEOFF
	mov	x0, x19
	mov	w1, #0
	mov	x3, x22
	bl	_clk_get_by_ofw_name
	cbz	w0, LBB0_11
; %bb.8:
	mov	x21, x0
Lloh26:
	adrp	x1, l_.str.4@PAGE
Lloh27:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_17
LBB0_9:
	ldr	w0, [x21]
	bl	_hwreset_deassert
	cbz	w0, LBB0_7
; %bb.10:
	mov	x21, x0
Lloh28:
	adrp	x1, l_.str.2@PAGE
Lloh29:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_17
LBB0_11:
	add	x23, x20, #4
Lloh30:
	adrp	x2, l_.str.5@PAGE
Lloh31:
	add	x2, x2, l_.str.5@PAGEOFF
	mov	x0, x19
	mov	w1, #0
	mov	x3, x23
	bl	_clk_get_by_ofw_name
	cbz	w0, LBB0_13
; %bb.12:
	mov	x21, x0
Lloh32:
	adrp	x1, l_.str.6@PAGE
Lloh33:
	add	x1, x1, l_.str.6@PAGEOFF
	b	LBB0_17
LBB0_13:
	ldr	w0, [x22]
	bl	_clk_enable
	cbz	w0, LBB0_15
; %bb.14:
	mov	x21, x0
Lloh34:
	adrp	x1, l_.str.7@PAGE
Lloh35:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_17
LBB0_15:
	ldr	w0, [x23]
	bl	_clk_enable
	mov	x21, x0
	cbz	w0, LBB0_18
; %bb.16:
Lloh36:
	adrp	x1, l_.str.8@PAGE
Lloh37:
	add	x1, x1, l_.str.8@PAGEOFF
LBB0_17:
	mov	x0, x19
	bl	_device_printf
	b	LBB0_2
LBB0_18:
Lloh38:
	adrp	x1, l_.str.9@PAGE
Lloh39:
	add	x1, x1, l_.str.9@PAGEOFF
	mov	x0, x19
	mov	w2, #-1
	bl	_device_add_child
	str	w0, [x20]
	b	LBB0_5
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_MTX_DEF,4,2                    ; @MTX_DEF
	.comm	_aw_spi_spec,4,2                ; @aw_spi_spec
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot allocate resources for device\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_INTR_TYPE_MISC,4,2             ; @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ; @INTR_MPSAFE
	.comm	_aw_spi_intr,4,2                ; @aw_spi_intr
l_.str.1:                               ; @.str.1
	.asciz	"cannot setup interrupt handler\n"

l_.str.2:                               ; @.str.2
	.asciz	"cannot de-assert reset\n"

l_.str.3:                               ; @.str.3
	.asciz	"ahb"

l_.str.4:                               ; @.str.4
	.asciz	"cannot get ahb clock\n"

l_.str.5:                               ; @.str.5
	.asciz	"mod"

l_.str.6:                               ; @.str.6
	.asciz	"cannot get mod clock\n"

l_.str.7:                               ; @.str.7
	.asciz	"cannot enable ahb clock\n"

l_.str.8:                               ; @.str.8
	.asciz	"cannot enable mod clock\n"

l_.str.9:                               ; @.str.9
	.asciz	"spibus"

	.no_dead_strip	_aw_spi_attach
.subsections_via_symbols
