	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function spi_transfer
_spi_transfer:                          ## @spi_transfer
	.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	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movl	%esi, %ebx
	callq	_device_get_softc
	movq	%rax, %r14
	movq	%rax, %r12
	leaq	-40(%rbp), %rsi
	movl	%ebx, %edi
	callq	_spibus_get_cs
	leaq	-48(%rbp), %rsi
	movl	%ebx, %edi
	callq	_spibus_get_clock
	leaq	-56(%rbp), %rsi
	movl	%ebx, %edi
	callq	_spibus_get_mode
	movq	-40(%rbp), %rdx
	movq	_CS_MAX@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	ja	LBB0_2
## %bb.1:
	movq	16(%r12), %rax
	cmpq	$0, (%rax,%rdx,8)
	je	LBB0_2
## %bb.6:
	addq	$4, %r14
	movq	%r14, %rdi
	callq	_mtx_lock
	movl	8(%r12), %edi
	callq	_device_busy
	cmpl	$0, (%r12)
	jle	LBB0_8
## %bb.7:
	movl	8(%r12), %edi
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rcx
	movq	-56(%rbp), %r8
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
LBB0_8:
	movq	-40(%rbp), %rsi
	movq	-56(%rbp), %rdx
	movq	-48(%rbp), %rcx
	movq	%r12, %rdi
	callq	_spi_hw_setup
	movq	-40(%rbp), %rsi
	movq	%r12, %rdi
	movl	$1, %edx
	callq	_spi_set_chipsel
	movl	12(%r15), %ecx
	testl	%ecx, %ecx
	jle	LBB0_9
## %bb.10:
	movl	16(%r15), %edx
	movl	20(%r15), %esi
	movq	%r12, %rdi
	callq	_spi_xfer_buf
	movl	%eax, %ebx
	jmp	LBB0_11
LBB0_2:
	cmpl	$0, (%r12)
	jne	LBB0_4
## %bb.3:
	movq	_bootverbose@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_5
LBB0_4:
	movl	8(%r12), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_15
LBB0_9:
	xorl	%ebx, %ebx
LBB0_11:
	movl	(%r15), %ecx
	testl	%ecx, %ecx
	jle	LBB0_14
## %bb.12:
	testl	%ebx, %ebx
	jne	LBB0_14
## %bb.13:
	movl	4(%r15), %edx
	movl	8(%r15), %esi
	movq	%r12, %rdi
	callq	_spi_xfer_buf
	movl	%eax, %ebx
LBB0_14:
	movq	-40(%rbp), %rsi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_spi_set_chipsel
	movq	_ECSPI_CTLREG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_WR4
	movl	8(%r12), %edi
	callq	_device_unbusy
	movq	%r14, %rdi
	callq	_mtx_unlock
LBB0_15:
	movl	%ebx, %eax
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CS_MAX,8,3                     ## @CS_MAX
	.comm	_bootverbose,8,3                ## @bootverbose
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid chip select %u\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"spi_transfer, cs 0x%x clock %u mode %u\n"

	.comm	_ECSPI_CTLREG,4,2               ## @ECSPI_CTLREG
	.no_dead_strip	_spi_transfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function spi_transfer
_spi_transfer:                          ; @spi_transfer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, x2
	mov	x21, x1
	bl	_device_get_softc
	mov	x19, x0
	add	x1, sp, #40
	mov	x0, x21
	bl	_spibus_get_cs
	add	x1, sp, #24
	mov	x0, x21
	bl	_spibus_get_clock
	add	x1, sp, #32
	mov	x0, x21
	bl	_spibus_get_mode
	ldr	x2, [sp, #40]
Lloh0:
	adrp	x8, _CS_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CS_MAX@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x2, x8
	b.hi	LBB0_6
; %bb.1:
	ldr	x8, [x19, #16]
	ldr	x8, [x8, x2, lsl #3]
	cbz	x8, LBB0_6
; %bb.2:
	add	x21, x19, #4
	mov	x0, x21
	bl	_mtx_lock
	ldr	w0, [x19, #8]
	bl	_device_busy
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_4
; %bb.3:
	ldr	w0, [x19, #8]
	ldp	x9, x2, [sp, #32]
	ldr	x8, [sp, #24]
	stp	x8, x9, [sp]
Lloh3:
	adrp	x1, l_.str.1@PAGE
Lloh4:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_device_printf
LBB0_4:
	ldp	x2, x1, [sp, #32]
	ldr	x3, [sp, #24]
	mov	x0, x19
	bl	_spi_hw_setup
	ldr	x1, [sp, #40]
	mov	x0, x19
	mov	w2, #1
	bl	_spi_set_chipsel
	ldr	w3, [x20, #12]
	cmp	w3, #1
	b.lt	LBB0_9
; %bb.5:
	ldp	w2, w1, [x20, #16]
	mov	x0, x19
	bl	_spi_xfer_buf
	mov	x22, x0
	b	LBB0_10
LBB0_6:
	ldr	w8, [x19]
Lloh5:
	adrp	x9, _bootverbose@GOTPAGE
Lloh6:
	ldr	x9, [x9, _bootverbose@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	w8, #0
	ccmp	x9, #0, #0, eq
	b.eq	LBB0_8
; %bb.7:
	ldr	w0, [x19, #8]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_device_printf
LBB0_8:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh12:
	ldr	w22, [x8]
	b	LBB0_14
LBB0_9:
	mov	w22, #0
LBB0_10:
	ldr	w3, [x20]
	cmp	w3, #1
	b.lt	LBB0_13
; %bb.11:
	cbnz	w22, LBB0_13
; %bb.12:
	ldp	w2, w1, [x20, #4]
	mov	x0, x19
	bl	_spi_xfer_buf
	mov	x22, x0
LBB0_13:
	ldr	x1, [sp, #40]
	mov	x0, x19
	mov	w2, #0
	bl	_spi_set_chipsel
Lloh13:
	adrp	x8, _ECSPI_CTLREG@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ECSPI_CTLREG@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_WR4
	ldr	w0, [x19, #8]
	bl	_device_unbusy
	mov	x0, x21
	bl	_mtx_unlock
LBB0_14:
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_CS_MAX,8,3                     ; @CS_MAX
	.comm	_bootverbose,8,3                ; @bootverbose
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid chip select %u\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"spi_transfer, cs 0x%x clock %u mode %u\n"

	.comm	_ECSPI_CTLREG,4,2               ; @ECSPI_CTLREG
	.no_dead_strip	_spi_transfer
.subsections_via_symbols
