	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ks8851_set_eeprom
_ks8851_set_eeprom:                     ## @ks8851_set_eeprom
	.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	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %rbx
	callq	_netdev_priv
	cmpl	$1, 4(%rbx)
	jne	LBB0_1
## %bb.3:
	movq	%rax, %r12
	movq	8(%rbx), %rax
	movq	_KS_EEPROM_MAGIC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
## %bb.4:
	movl	(%rbx), %ebx
	movq	%r12, %rdi
	callq	_ks8851_eeprom_claim
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	_ENOENT@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	%r12, %rdi
	movl	$1, %esi
	callq	_eeprom_93cx6_wren
	movl	%ebx, %r15d
	shrl	$31, %r15d
	addl	%ebx, %r15d
	sarl	%r15d
	leaq	-36(%rbp), %rdx
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_eeprom_93cx6_read
	movl	-36(%rbp), %edx
	testb	$1, %bl
	jne	LBB0_7
## %bb.8:
	andl	$65280, %edx                    ## imm = 0xFF00
	orl	(%r14), %edx
	jmp	LBB0_9
LBB0_7:
	movzbl	%dl, %eax
	movl	(%r14), %edx
	shll	$8, %edx
	orl	%eax, %edx
LBB0_9:
	movl	%edx, -36(%rbp)
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_eeprom_93cx6_write
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_eeprom_93cx6_wren
	movq	%r12, %rdi
	callq	_ks8851_eeprom_release
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_KS_EEPROM_MAGIC,8,3            ## @KS_EEPROM_MAGIC
	.comm	_ENOENT,4,2                     ## @ENOENT
	.no_dead_strip	_ks8851_set_eeprom
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ks8851_set_eeprom
_ks8851_set_eeprom:                     ; @ks8851_set_eeprom
	.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	x21, x1
	bl	_netdev_priv
	ldr	w8, [x21, #4]
	cmp	w8, #1
	b.ne	LBB0_4
; %bb.1:
	ldr	x8, [x21, #8]
Lloh0:
	adrp	x9, _KS_EEPROM_MAGIC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _KS_EEPROM_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.2:
	mov	x19, x0
	ldr	w22, [x21]
	bl	_ks8851_eeprom_claim
	cbz	x0, LBB0_7
; %bb.3:
Lloh3:
	adrp	x8, _ENOENT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	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_7:
	mov	x0, x19
	mov	w1, #1
	bl	_eeprom_93cx6_wren
	cmp	w22, #0
	cinc	w8, w22, lt
	asr	w21, w8, #1
	add	x2, sp, #12
	mov	x0, x19
	mov	x1, x21
	bl	_eeprom_93cx6_read
	ldr	w2, [sp, #12]
	tbnz	w22, #0, LBB0_9
; %bb.8:
	and	w8, w2, #0xff00
	ldr	w9, [x20]
	orr	w2, w9, w8
	b	LBB0_10
LBB0_9:
	ldr	w8, [x20]
	bfi	w2, w8, #8, #24
LBB0_10:
	str	w2, [sp, #12]
	mov	x0, x19
	mov	x1, x21
	bl	_eeprom_93cx6_write
	mov	x0, x19
	mov	w1, #0
	bl	_eeprom_93cx6_wren
	mov	x0, x19
	bl	_ks8851_eeprom_release
	mov	w0, #0
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_KS_EEPROM_MAGIC,8,3            ; @KS_EEPROM_MAGIC
	.comm	_ENOENT,4,2                     ; @ENOENT
	.no_dead_strip	_ks8851_set_eeprom
.subsections_via_symbols
