	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aw_spi_transfer
_aw_spi_transfer:                       ## @aw_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	%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
	movq	%rdx, %r14
	movl	%esi, %ebx
	movl	%edi, %r15d
	callq	_device_get_softc
	movq	%rax, %r12
	leaq	-44(%rbp), %rsi
	movl	%ebx, %edi
	callq	_spibus_get_cs
	leaq	-48(%rbp), %rsi
	movl	%ebx, %edi
	callq	_spibus_get_clock
	leaq	-52(%rbp), %rsi
	movl	%ebx, %edi
	callq	_spibus_get_mode
	movl	8(%r12), %edi
	movl	-48(%rbp), %esi
	addl	%esi, %esi
	movq	_CLK_SET_ROUND_DOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_clk_set_freq
	movl	8(%r12), %edi
	leaq	4(%r12), %rsi
	callq	_clk_get_freq
	movl	-44(%rbp), %edx
	movq	_AW_SPI_MAX_CS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jge	LBB0_1
## %bb.2:
	movq	%r12, %rdi
	callq	_mtx_lock
	movq	_AW_SPI_GCR@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%r12, %rdi
	callq	_AW_SPI_READ_4
	movq	_AW_SPI_GCR_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_AW_SPI_GCR_SRST@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	(%r13), %esi
	movq	%r12, %rdi
	movl	%eax, %edx
	callq	_AW_SPI_WRITE_4
	movl	-48(%rbp), %esi
	movq	%r12, %rdi
	callq	_aw_spi_setup_clock
	movl	-52(%rbp), %esi
	movq	%r12, %rdi
	callq	_aw_spi_setup_mode
	movl	-44(%rbp), %esi
	movq	_SPIBUS_CS_HIGH@GOTPCREL(%rip), %rbx
	xorl	%edx, %edx
	movl	(%rbx), %eax
	andl	%esi, %eax
	sete	%dl
	movq	%r12, %rdi
	callq	_aw_spi_setup_cs
	movl	20(%r14), %ecx
	testl	%ecx, %ecx
	jle	LBB0_3
## %bb.4:
	movl	28(%r14), %esi
	movl	16(%r14), %r8d
	movl	24(%r14), %edx
	movq	%r12, %rdi
	callq	_aw_spi_xfer
	movl	%eax, %r15d
	jmp	LBB0_5
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %edi
	callq	_device_printf
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_9
LBB0_3:
	xorl	%r15d, %r15d
LBB0_5:
	movl	4(%r14), %ecx
	testl	%ecx, %ecx
	jle	LBB0_8
## %bb.6:
	testl	%r15d, %r15d
	jne	LBB0_8
## %bb.7:
	movl	12(%r14), %esi
	movl	(%r14), %r8d
	movl	8(%r14), %edx
	movq	%r12, %rdi
	callq	_aw_spi_xfer
	movl	%eax, %r15d
LBB0_8:
	movl	-44(%rbp), %esi
	xorl	%edx, %edx
	movl	(%rbx), %eax
	andl	%esi, %eax
	setne	%dl
	movq	%r12, %rdi
	callq	_aw_spi_setup_cs
	movl	(%r13), %esi
	movq	%r12, %rdi
	callq	_AW_SPI_READ_4
	movq	_AW_SPI_GCR_EN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	notl	%edx
	andl	%eax, %edx
	movl	(%r13), %esi
	movq	%r12, %rdi
	callq	_AW_SPI_WRITE_4
	movq	%r12, %rdi
	callq	_mtx_unlock
LBB0_9:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CLK_SET_ROUND_DOWN,4,2         ## @CLK_SET_ROUND_DOWN
	.comm	_AW_SPI_MAX_CS,4,2              ## @AW_SPI_MAX_CS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid cs %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AW_SPI_GCR,4,2                 ## @AW_SPI_GCR
	.comm	_AW_SPI_GCR_EN,4,2              ## @AW_SPI_GCR_EN
	.comm	_AW_SPI_GCR_SRST,4,2            ## @AW_SPI_GCR_SRST
	.comm	_SPIBUS_CS_HIGH,4,2             ## @SPIBUS_CS_HIGH
	.no_dead_strip	_aw_spi_transfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aw_spi_transfer
_aw_spi_transfer:                       ; @aw_spi_transfer
	.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	x20, x2
	mov	x22, x1
	mov	x21, x0
	bl	_device_get_softc
	mov	x19, x0
	add	x1, sp, #12
	mov	x0, x22
	bl	_spibus_get_cs
	add	x1, sp, #4
	mov	x0, x22
	bl	_spibus_get_clock
	add	x1, sp, #8
	mov	x0, x22
	bl	_spibus_get_mode
	ldr	w0, [x19, #8]
	ldr	w8, [sp, #4]
	lsl	w1, w8, #1
Lloh0:
	adrp	x8, _CLK_SET_ROUND_DOWN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CLK_SET_ROUND_DOWN@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	bl	_clk_set_freq
	ldr	w0, [x19, #8]
	add	x1, x19, #4
	bl	_clk_get_freq
	ldr	w2, [sp, #12]
Lloh3:
	adrp	x8, _AW_SPI_MAX_CS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AW_SPI_MAX_CS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w2, w8
	b.ge	LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_mtx_lock
Lloh6:
	adrp	x22, _AW_SPI_GCR@GOTPAGE
Lloh7:
	ldr	x22, [x22, _AW_SPI_GCR@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_AW_SPI_READ_4
Lloh8:
	adrp	x23, _AW_SPI_GCR_EN@GOTPAGE
Lloh9:
	ldr	x23, [x23, _AW_SPI_GCR_EN@GOTPAGEOFF]
	ldr	w8, [x23]
Lloh10:
	adrp	x9, _AW_SPI_GCR_SRST@GOTPAGE
Lloh11:
	ldr	x9, [x9, _AW_SPI_GCR_SRST@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	orr	w8, w8, w0
	orr	w2, w8, w9
	ldr	w1, [x22]
	mov	x0, x19
	bl	_AW_SPI_WRITE_4
	ldr	w1, [sp, #4]
	mov	x0, x19
	bl	_aw_spi_setup_clock
	ldr	w1, [sp, #8]
	mov	x0, x19
	bl	_aw_spi_setup_mode
	ldr	w1, [sp, #12]
Lloh13:
	adrp	x24, _SPIBUS_CS_HIGH@GOTPAGE
Lloh14:
	ldr	x24, [x24, _SPIBUS_CS_HIGH@GOTPAGEOFF]
	ldr	w8, [x24]
	tst	w8, w1
	cset	w2, eq
	mov	x0, x19
	bl	_aw_spi_setup_cs
	ldr	w3, [x20, #20]
	cmp	w3, #1
	b.lt	LBB0_4
; %bb.2:
	ldp	w2, w1, [x20, #24]
	ldr	w4, [x20, #16]
	mov	x0, x19
	bl	_aw_spi_xfer
	mov	x21, x0
	b	LBB0_5
LBB0_3:
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_device_printf
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh19:
	ldr	w21, [x8]
	b	LBB0_9
LBB0_4:
	mov	w21, #0
LBB0_5:
	ldr	w3, [x20, #4]
	cmp	w3, #1
	b.lt	LBB0_8
; %bb.6:
	cbnz	w21, LBB0_8
; %bb.7:
	ldp	w2, w1, [x20, #8]
	ldr	w4, [x20]
	mov	x0, x19
	bl	_aw_spi_xfer
	mov	x21, x0
LBB0_8:
	ldr	w1, [sp, #12]
	ldr	w8, [x24]
	tst	w8, w1
	cset	w2, ne
	mov	x0, x19
	bl	_aw_spi_setup_cs
	ldr	w1, [x22]
	mov	x0, x19
	bl	_AW_SPI_READ_4
	ldr	w8, [x23]
	bic	w2, w0, w8
	ldr	w1, [x22]
	mov	x0, x19
	bl	_AW_SPI_WRITE_4
	mov	x0, x19
	bl	_mtx_unlock
LBB0_9:
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_CLK_SET_ROUND_DOWN,4,2         ; @CLK_SET_ROUND_DOWN
	.comm	_AW_SPI_MAX_CS,4,2              ; @AW_SPI_MAX_CS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid cs %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AW_SPI_GCR,4,2                 ; @AW_SPI_GCR
	.comm	_AW_SPI_GCR_EN,4,2              ; @AW_SPI_GCR_EN
	.comm	_AW_SPI_GCR_SRST,4,2            ; @AW_SPI_GCR_SRST
	.comm	_SPIBUS_CS_HIGH,4,2             ; @SPIBUS_CS_HIGH
	.no_dead_strip	_aw_spi_transfer
.subsections_via_symbols
