	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ks8851_wrreg16
_ks8851_wrreg16:                        ## @ks8851_wrreg16
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	leaq	8(%rdi), %r14
	movl	%esi, %eax
	andl	$2, %eax
	shrl	%eax
	leal	(%rax,%rax,8), %edi
	addl	$3, %edi
	callq	_MK_OP
	movq	_KS_SPIOP_WR@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, %edi
	callq	_cpu_to_le16
	movl	%eax, -40(%rbp)
	movl	%r15d, %edi
	callq	_cpu_to_le16
	movl	%eax, -36(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, 32(%rbx)
	movq	$0, 24(%rbx)
	movl	$4, 16(%rbx)
	movl	4(%rbx), %edi
	movq	%r14, %rsi
	callq	_spi_sync
	testl	%eax, %eax
	jns	LBB0_2
## %bb.1:
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_netdev_err
LBB0_2:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-32(%rbp), %rax
	jne	LBB0_4
## %bb.3:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_KS_SPIOP_WR,4,2                ## @KS_SPIOP_WR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"spi_sync() failed\n"

	.no_dead_strip	_ks8851_wrreg16
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ks8851_wrreg16
_ks8851_wrreg16:                        ; @ks8851_wrreg16
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x2
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #8]
	add	x21, x0, #8
	tst	w1, #0x2
	mov	w8, #12
	mov	w9, #3
	csel	w0, w9, w8, eq
	bl	_MK_OP
Lloh3:
	adrp	x8, _KS_SPIOP_WR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _KS_SPIOP_WR@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	orr	w0, w8, w0
	bl	_cpu_to_le16
	str	w0, [sp]
	mov	x0, x20
	bl	_cpu_to_le16
	str	w0, [sp, #4]
	mov	x8, sp
	stp	xzr, x8, [x19, #24]
	mov	w8, #4
	str	w8, [x19, #16]
	ldr	w0, [x19, #4]
	mov	x1, x21
	bl	_spi_sync
	tbz	w0, #31, LBB0_2
; %bb.1:
	ldr	w0, [x19]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_netdev_err
LBB0_2:
	ldr	x8, [sp, #8]
Lloh8:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh9:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_4
; %bb.3:
	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
	add	sp, sp, #64
	ret
LBB0_4:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_KS_SPIOP_WR,4,2                ; @KS_SPIOP_WR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"spi_sync() failed\n"

	.no_dead_strip	_ks8851_wrreg16
.subsections_via_symbols
