	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function spi_detach
_spi_detach:                            ## @spi_detach
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %r15
	movl	16(%rax), %edi
	callq	_bus_generic_detach
	testl	%eax, %eax
	jne	LBB0_15
## %bb.1:
	movq	48(%r15), %rsi
	testq	%rsi, %rsi
	je	LBB0_3
## %bb.2:
	movl	%r14d, %edi
	callq	_device_delete_child
LBB0_3:
	movq	40(%r15), %rdi
	callq	_nitems
	testl	%eax, %eax
	jle	LBB0_8
## %bb.4:
	xorl	%ebx, %ebx
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	incq	%rbx
	callq	_nitems
	cltq
	cmpq	%rax, %rbx
	jge	LBB0_8
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	40(%r15), %rdi
	movq	(%rdi,%rbx,8), %rax
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%rax, %rdi
	callq	_gpio_pin_release
	movq	40(%r15), %rdi
	jmp	LBB0_7
LBB0_8:
	movq	32(%r15), %rdx
	testq	%rdx, %rdx
	je	LBB0_10
## %bb.9:
	movl	16(%r15), %edi
	movq	24(%r15), %rsi
	callq	_bus_teardown_intr
LBB0_10:
	movq	24(%r15), %rcx
	testq	%rcx, %rcx
	je	LBB0_12
## %bb.11:
	movl	16(%r15), %edi
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_bus_release_resource
LBB0_12:
	movq	8(%r15), %rcx
	testq	%rcx, %rcx
	je	LBB0_14
## %bb.13:
	movl	16(%r15), %edi
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_bus_release_resource
LBB0_14:
	movq	%r15, %rdi
	callq	_mtx_destroy
	xorl	%eax, %eax
LBB0_15:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.no_dead_strip	_spi_detach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function spi_detach
_spi_detach:                            ; @spi_detach
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x0
	bl	_device_get_softc
	mov	x19, x0
	ldr	w0, [x0, #16]
	bl	_bus_generic_detach
	cbnz	w0, LBB0_15
; %bb.1:
	ldr	x1, [x19, #48]
	cbz	x1, LBB0_3
; %bb.2:
	mov	x0, x20
	bl	_device_delete_child
LBB0_3:
	ldr	x0, [x19, #40]
	bl	_nitems
	cmp	w0, #1
	b.lt	LBB0_8
; %bb.4:
	mov	x20, #0
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	x20, x20, #1
	bl	_nitems
	cmp	x20, w0, sxtw
	b.ge	LBB0_8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x19, #40]
	ldr	x8, [x0, x20, lsl #3]
	cbz	x8, LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x8
	bl	_gpio_pin_release
	ldr	x0, [x19, #40]
	b	LBB0_5
LBB0_8:
	ldr	x2, [x19, #32]
	cbz	x2, LBB0_10
; %bb.9:
	ldr	w0, [x19, #16]
	ldr	x1, [x19, #24]
	bl	_bus_teardown_intr
LBB0_10:
	ldr	x3, [x19, #24]
	cbz	x3, LBB0_12
; %bb.11:
	ldr	w0, [x19, #16]
Lloh0:
	adrp	x8, _SYS_RES_IRQ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SYS_RES_IRQ@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_bus_release_resource
LBB0_12:
	ldr	x3, [x19, #8]
	cbz	x3, LBB0_14
; %bb.13:
	ldr	w0, [x19, #16]
Lloh3:
	adrp	x8, _SYS_RES_MEMORY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SYS_RES_MEMORY@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_bus_release_resource
LBB0_14:
	mov	x0, x19
	bl	_mtx_destroy
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.no_dead_strip	_spi_detach
.subsections_via_symbols
