	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar8216_phy_read
_ar8216_phy_read:                       ## @ar8216_phy_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_AR8216_NUM_PORTS@GOTPCREL(%rip), %rcx
	movl	$65535, %eax                    ## imm = 0xFFFF
	cmpl	%esi, (%rcx)
	jle	LBB0_4
## %bb.1:
	movl	%esi, %ebx
	movq	%rdi, %r14
	movq	_AR8216_MDIO_CTRL_REG_ADDR_S@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %edx
	movq	_AR8216_MDIO_CTRL_PHY_ADDR_S@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	orl	%edx, %ebx
	movq	_AR8216_MDIO_CTRL_MASTER_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_AR8216_MDIO_CTRL_BUSY@GOTPCREL(%rip), %r12
	orl	(%r12), %ebx
	movq	_AR8216_MDIO_CTRL_CMD_READ@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_AR8216_REG_MDIO_CTRL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	%ebx, %edx
	callq	_ar8xxx_write
	movl	(%r15), %esi
	movl	(%r12), %edx
	movq	%r14, %rdi
	xorl	%ecx, %ecx
	movl	$5, %r8d
	callq	_ar8xxx_reg_wait
	movl	%eax, %ecx
	movl	$65535, %eax                    ## imm = 0xFFFF
	testl	%ecx, %ecx
	jne	LBB0_3
## %bb.2:
	movl	(%r15), %esi
	movq	%r14, %rdi
	callq	_ar8xxx_read
LBB0_3:
	movq	_AR8216_MDIO_CTRL_DATA_M@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
LBB0_4:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AR8216_NUM_PORTS,4,2           ## @AR8216_NUM_PORTS
	.comm	_AR8216_MDIO_CTRL_REG_ADDR_S,4,2 ## @AR8216_MDIO_CTRL_REG_ADDR_S
	.comm	_AR8216_MDIO_CTRL_PHY_ADDR_S,4,2 ## @AR8216_MDIO_CTRL_PHY_ADDR_S
	.comm	_AR8216_MDIO_CTRL_MASTER_EN,4,2 ## @AR8216_MDIO_CTRL_MASTER_EN
	.comm	_AR8216_MDIO_CTRL_BUSY,4,2      ## @AR8216_MDIO_CTRL_BUSY
	.comm	_AR8216_MDIO_CTRL_CMD_READ,4,2  ## @AR8216_MDIO_CTRL_CMD_READ
	.comm	_AR8216_REG_MDIO_CTRL,4,2       ## @AR8216_REG_MDIO_CTRL
	.comm	_AR8216_MDIO_CTRL_DATA_M,4,2    ## @AR8216_MDIO_CTRL_DATA_M
	.no_dead_strip	_ar8216_phy_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar8216_phy_read
_ar8216_phy_read:                       ; @ar8216_phy_read
	.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
Lloh0:
	adrp	x8, _AR8216_NUM_PORTS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AR8216_NUM_PORTS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.le	LBB0_3
; %bb.1:
	mov	x19, x0
Lloh3:
	adrp	x8, _AR8216_MDIO_CTRL_REG_ADDR_S@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AR8216_MDIO_CTRL_REG_ADDR_S@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	lsl	w8, w2, w8
Lloh6:
	adrp	x9, _AR8216_MDIO_CTRL_PHY_ADDR_S@GOTPAGE
Lloh7:
	ldr	x9, [x9, _AR8216_MDIO_CTRL_PHY_ADDR_S@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	lsl	w9, w1, w9
	orr	w8, w9, w8
Lloh9:
	adrp	x9, _AR8216_MDIO_CTRL_MASTER_EN@GOTPAGE
Lloh10:
	ldr	x9, [x9, _AR8216_MDIO_CTRL_MASTER_EN@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh12:
	adrp	x21, _AR8216_MDIO_CTRL_BUSY@GOTPAGE
Lloh13:
	ldr	x21, [x21, _AR8216_MDIO_CTRL_BUSY@GOTPAGEOFF]
	ldr	w9, [x21]
Lloh14:
	adrp	x10, _AR8216_MDIO_CTRL_CMD_READ@GOTPAGE
Lloh15:
	ldr	x10, [x10, _AR8216_MDIO_CTRL_CMD_READ@GOTPAGEOFF]
	orr	w8, w8, w9
Lloh16:
	ldr	w9, [x10]
	orr	w2, w8, w9
Lloh17:
	adrp	x20, _AR8216_REG_MDIO_CTRL@GOTPAGE
Lloh18:
	ldr	x20, [x20, _AR8216_REG_MDIO_CTRL@GOTPAGEOFF]
	ldr	w1, [x20]
	bl	_ar8xxx_write
	ldr	w1, [x20]
	ldr	w2, [x21]
	mov	x0, x19
	mov	w3, #0
	mov	w4, #5
	bl	_ar8xxx_reg_wait
	cbz	w0, LBB0_4
; %bb.2:
	mov	w0, #65535
	b	LBB0_5
LBB0_3:
	mov	w0, #65535
	b	LBB0_6
LBB0_4:
	ldr	w1, [x20]
	mov	x0, x19
	bl	_ar8xxx_read
LBB0_5:
Lloh19:
	adrp	x8, _AR8216_MDIO_CTRL_DATA_M@GOTPAGE
Lloh20:
	ldr	x8, [x8, _AR8216_MDIO_CTRL_DATA_M@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	and	w0, w8, w0
LBB0_6:
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_AR8216_NUM_PORTS,4,2           ; @AR8216_NUM_PORTS
	.comm	_AR8216_MDIO_CTRL_REG_ADDR_S,4,2 ; @AR8216_MDIO_CTRL_REG_ADDR_S
	.comm	_AR8216_MDIO_CTRL_PHY_ADDR_S,4,2 ; @AR8216_MDIO_CTRL_PHY_ADDR_S
	.comm	_AR8216_MDIO_CTRL_MASTER_EN,4,2 ; @AR8216_MDIO_CTRL_MASTER_EN
	.comm	_AR8216_MDIO_CTRL_BUSY,4,2      ; @AR8216_MDIO_CTRL_BUSY
	.comm	_AR8216_MDIO_CTRL_CMD_READ,4,2  ; @AR8216_MDIO_CTRL_CMD_READ
	.comm	_AR8216_REG_MDIO_CTRL,4,2       ; @AR8216_REG_MDIO_CTRL
	.comm	_AR8216_MDIO_CTRL_DATA_M,4,2    ; @AR8216_MDIO_CTRL_DATA_M
	.no_dead_strip	_ar8216_phy_read
.subsections_via_symbols
