	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ag71xx_mdio_mii_read           ## -- Begin function ag71xx_mdio_mii_read
	.p2align	4, 0x90
_ag71xx_mdio_mii_read:                  ## @ag71xx_mdio_mii_read
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movl	%esi, %r15d
	movq	%rdi, %rbx
	callq	_ag71xx_mdio_wait_busy
	movl	$65535, %r12d                   ## imm = 0xFFFF
	testl	%eax, %eax
	jne	LBB0_3
## %bb.1:
	movq	_AG71XX_REG_MII_CMD@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	_MII_CMD_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_ag71xx_mdio_wr
	movzbl	%r15b, %eax
	movq	_MII_ADDR_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	movq	_AG71XX_REG_MII_ADDR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movzbl	%r14b, %edx
	orl	%eax, %edx
	movq	%rbx, %rdi
	callq	_ag71xx_mdio_wr
	movl	(%r13), %esi
	movq	_MII_CMD_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_ag71xx_mdio_wr
	movq	%rbx, %rdi
	callq	_ag71xx_mdio_wait_busy
	testl	%eax, %eax
	jne	LBB0_3
## %bb.2:
	movq	_AG71XX_REG_MII_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_ag71xx_mdio_rr
	movzwl	%ax, %r12d
	movl	(%r13), %esi
	movq	_MII_CMD_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_ag71xx_mdio_wr
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	movl	%r12d, %ecx
	callq	_DBG
LBB0_3:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AG71XX_REG_MII_CMD,4,2         ## @AG71XX_REG_MII_CMD
	.comm	_MII_CMD_WRITE,4,2              ## @MII_CMD_WRITE
	.comm	_AG71XX_REG_MII_ADDR,4,2        ## @AG71XX_REG_MII_ADDR
	.comm	_MII_ADDR_SHIFT,4,2             ## @MII_ADDR_SHIFT
	.comm	_MII_CMD_READ,4,2               ## @MII_CMD_READ
	.comm	_AG71XX_REG_MII_STATUS,4,2      ## @AG71XX_REG_MII_STATUS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mii_read: addr=%04x, reg=%04x, value=%04x\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ag71xx_mdio_mii_read           ; -- Begin function ag71xx_mdio_mii_read
	.p2align	2
_ag71xx_mdio_mii_read:                  ; @ag71xx_mdio_mii_read
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	bl	_ag71xx_mdio_wait_busy
	cbnz	w0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x23, _AG71XX_REG_MII_CMD@GOTPAGE
Lloh1:
	ldr	x23, [x23, _AG71XX_REG_MII_CMD@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh2:
	adrp	x24, _MII_CMD_WRITE@GOTPAGE
Lloh3:
	ldr	x24, [x24, _MII_CMD_WRITE@GOTPAGEOFF]
	ldr	w2, [x24]
	mov	x0, x21
	bl	_ag71xx_mdio_wr
Lloh4:
	adrp	x8, _AG71XX_REG_MII_ADDR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _AG71XX_REG_MII_ADDR@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	and	w8, w20, #0xff
Lloh7:
	adrp	x9, _MII_ADDR_SHIFT@GOTPAGE
Lloh8:
	ldr	x9, [x9, _MII_ADDR_SHIFT@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	lsl	w8, w8, w9
	and	w9, w19, #0xff
	orr	w2, w8, w9
	mov	x0, x21
	bl	_ag71xx_mdio_wr
	ldr	w1, [x23]
Lloh10:
	adrp	x8, _MII_CMD_READ@GOTPAGE
Lloh11:
	ldr	x8, [x8, _MII_CMD_READ@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	mov	x0, x21
	bl	_ag71xx_mdio_wr
	mov	x0, x21
	bl	_ag71xx_mdio_wait_busy
	cbz	w0, LBB0_4
LBB0_2:
	mov	w22, #65535
LBB0_3:
	mov	x0, x22
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_4:
Lloh13:
	adrp	x8, _AG71XX_REG_MII_STATUS@GOTPAGE
Lloh14:
	ldr	x8, [x8, _AG71XX_REG_MII_STATUS@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_ag71xx_mdio_rr
	and	w22, w0, #0xffff
	ldr	w1, [x23]
	ldr	w2, [x24]
	mov	x0, x21
	bl	_ag71xx_mdio_wr
Lloh16:
	adrp	x0, l_.str@PAGE
Lloh17:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	mov	x2, x19
	mov	x3, x22
	bl	_DBG
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_AG71XX_REG_MII_CMD,4,2         ; @AG71XX_REG_MII_CMD
	.comm	_MII_CMD_WRITE,4,2              ; @MII_CMD_WRITE
	.comm	_AG71XX_REG_MII_ADDR,4,2        ; @AG71XX_REG_MII_ADDR
	.comm	_MII_ADDR_SHIFT,4,2             ; @MII_ADDR_SHIFT
	.comm	_MII_CMD_READ,4,2               ; @MII_CMD_READ
	.comm	_AG71XX_REG_MII_STATUS,4,2      ; @AG71XX_REG_MII_STATUS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mii_read: addr=%04x, reg=%04x, value=%04x\n"

.subsections_via_symbols
