	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__mt7620_mii_write              ## -- Begin function _mt7620_mii_write
	.p2align	4, 0x90
__mt7620_mii_write:                     ## @_mt7620_mii_write
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r12d
	movl	%edx, %r15d
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_mt7620_mii_busy_wait
	movq	%rax, %rcx
	movl	$-1, %eax
	testq	%rcx, %rcx
	jne	LBB0_2
## %bb.1:
	movzwl	%r12w, %esi
	movq	_GSW_MDIO_ACCESS@GOTPCREL(%rip), %rax
	movq	_GSW_MDIO_REG_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %r15d
	movq	_GSW_MDIO_ADDR_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %r14d
	movq	_GSW_MDIO_START@GOTPCREL(%rip), %rcx
	movq	_GSW_MDIO_WRITE@GOTPCREL(%rip), %rdx
	orl	(%rax), %esi
	orl	(%rcx), %esi
	orl	(%rdx), %esi
	orl	%r15d, %esi
	orl	%r14d, %esi
	movq	_MT7620A_GSW_REG_PIAC@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_mtk_switch_w32
	movq	%rbx, %rdi
	callq	_mt7620_mii_busy_wait
	movq	%rax, %rcx
	xorl	%eax, %eax
	negq	%rcx
	sbbl	%eax, %eax
LBB0_2:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GSW_MDIO_ACCESS,4,2            ## @GSW_MDIO_ACCESS
	.comm	_GSW_MDIO_START,4,2             ## @GSW_MDIO_START
	.comm	_GSW_MDIO_WRITE,4,2             ## @GSW_MDIO_WRITE
	.comm	_GSW_MDIO_REG_SHIFT,4,2         ## @GSW_MDIO_REG_SHIFT
	.comm	_GSW_MDIO_ADDR_SHIFT,4,2        ## @GSW_MDIO_ADDR_SHIFT
	.comm	_MT7620A_GSW_REG_PIAC,4,2       ## @MT7620A_GSW_REG_PIAC
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__mt7620_mii_write              ; -- Begin function _mt7620_mii_write
	.p2align	2
__mt7620_mii_write:                     ; @_mt7620_mii_write
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x22, x3
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	bl	_mt7620_mii_busy_wait
	cbz	x0, LBB0_2
; %bb.1:
	mov	w0, #-1
	b	LBB0_3
LBB0_2:
Lloh0:
	adrp	x8, _GSW_MDIO_ACCESS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GSW_MDIO_ACCESS@GOTPAGEOFF]
	and	w9, w22, #0xffff
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x10, _GSW_MDIO_START@GOTPAGE
Lloh4:
	ldr	x10, [x10, _GSW_MDIO_START@GOTPAGEOFF]
Lloh5:
	adrp	x11, _GSW_MDIO_WRITE@GOTPAGE
Lloh6:
	ldr	x11, [x11, _GSW_MDIO_WRITE@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
Lloh8:
	ldr	w11, [x11]
Lloh9:
	adrp	x12, _GSW_MDIO_REG_SHIFT@GOTPAGE
Lloh10:
	ldr	x12, [x12, _GSW_MDIO_REG_SHIFT@GOTPAGEOFF]
Lloh11:
	ldr	w12, [x12]
	lsl	w12, w21, w12
Lloh12:
	adrp	x13, _GSW_MDIO_ADDR_SHIFT@GOTPAGE
Lloh13:
	ldr	x13, [x13, _GSW_MDIO_ADDR_SHIFT@GOTPAGEOFF]
Lloh14:
	ldr	w13, [x13]
	lsl	w13, w20, w13
	orr	w8, w8, w9
	orr	w8, w8, w10
	orr	w8, w8, w11
	orr	w8, w8, w12
	orr	w1, w8, w13
Lloh15:
	adrp	x8, _MT7620A_GSW_REG_PIAC@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MT7620A_GSW_REG_PIAC@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mtk_switch_w32
	mov	x0, x19
	bl	_mt7620_mii_busy_wait
	cmp	x0, #0
	csetm	w0, ne
LBB0_3:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_GSW_MDIO_ACCESS,4,2            ; @GSW_MDIO_ACCESS
	.comm	_GSW_MDIO_START,4,2             ; @GSW_MDIO_START
	.comm	_GSW_MDIO_WRITE,4,2             ; @GSW_MDIO_WRITE
	.comm	_GSW_MDIO_REG_SHIFT,4,2         ; @GSW_MDIO_REG_SHIFT
	.comm	_GSW_MDIO_ADDR_SHIFT,4,2        ; @GSW_MDIO_ADDR_SHIFT
	.comm	_MT7620A_GSW_REG_PIAC,4,2       ; @MT7620A_GSW_REG_PIAC
.subsections_via_symbols
