	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ar7240sw_phy_read              ## -- Begin function ar7240sw_phy_read
	.p2align	4, 0x90
_ar7240sw_phy_read:                     ## @ar7240sw_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	_AR7240_NUM_PHYS@GOTPCREL(%rip), %rax
	movl	$65535, %r12d                   ## imm = 0xFFFF
	cmpl	%esi, (%rax)
	jbe	LBB0_4
## %bb.1:
	movl	%edx, %r15d
	movl	%esi, %ebx
	movq	%rdi, %r14
	movq	_reg_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	_AR7240_MDIO_CTRL_REG_ADDR_S@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r15d
	movq	_AR7240_MDIO_CTRL_PHY_ADDR_S@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	orl	%r15d, %ebx
	movq	_AR7240_MDIO_CTRL_MASTER_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_AR7240_MDIO_CTRL_BUSY@GOTPCREL(%rip), %r12
	orl	(%r12), %ebx
	movq	_AR7240_MDIO_CTRL_CMD_READ@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_AR7240_REG_MDIO_CTRL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	___ar7240sw_reg_write
	movl	(%r15), %esi
	movl	(%r12), %edx
	movq	%r14, %rdi
	xorl	%ecx, %ecx
	movl	$5, %r8d
	callq	___ar7240sw_reg_wait
	movl	$65535, %r12d                   ## imm = 0xFFFF
	testl	%eax, %eax
	jne	LBB0_3
## %bb.2:
	movl	(%r15), %esi
	movq	%r14, %rdi
	callq	___ar7240sw_reg_read
	movl	%eax, %r12d
LBB0_3:
	movq	_reg_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movq	_AR7240_MDIO_CTRL_DATA_M@GOTPCREL(%rip), %rax
	andl	(%rax), %r12d
LBB0_4:
	movl	%r12d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AR7240_NUM_PHYS,4,2            ## @AR7240_NUM_PHYS
	.comm	_reg_mutex,4,2                  ## @reg_mutex
	.comm	_AR7240_MDIO_CTRL_REG_ADDR_S,4,2 ## @AR7240_MDIO_CTRL_REG_ADDR_S
	.comm	_AR7240_MDIO_CTRL_PHY_ADDR_S,4,2 ## @AR7240_MDIO_CTRL_PHY_ADDR_S
	.comm	_AR7240_MDIO_CTRL_MASTER_EN,4,2 ## @AR7240_MDIO_CTRL_MASTER_EN
	.comm	_AR7240_MDIO_CTRL_BUSY,4,2      ## @AR7240_MDIO_CTRL_BUSY
	.comm	_AR7240_MDIO_CTRL_CMD_READ,4,2  ## @AR7240_MDIO_CTRL_CMD_READ
	.comm	_AR7240_REG_MDIO_CTRL,4,2       ## @AR7240_REG_MDIO_CTRL
	.comm	_AR7240_MDIO_CTRL_DATA_M,4,2    ## @AR7240_MDIO_CTRL_DATA_M
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ar7240sw_phy_read              ; -- Begin function ar7240sw_phy_read
	.p2align	2
_ar7240sw_phy_read:                     ; @ar7240sw_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, _AR7240_NUM_PHYS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AR7240_NUM_PHYS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ls	LBB0_3
; %bb.1:
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
Lloh3:
	adrp	x0, _reg_mutex@GOTPAGE
Lloh4:
	ldr	x0, [x0, _reg_mutex@GOTPAGEOFF]
	bl	_mutex_lock
Lloh5:
	adrp	x8, _AR7240_MDIO_CTRL_REG_ADDR_S@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AR7240_MDIO_CTRL_REG_ADDR_S@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	lsl	w8, w21, w8
Lloh8:
	adrp	x9, _AR7240_MDIO_CTRL_PHY_ADDR_S@GOTPAGE
Lloh9:
	ldr	x9, [x9, _AR7240_MDIO_CTRL_PHY_ADDR_S@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	lsl	w9, w20, w9
	orr	w8, w9, w8
Lloh11:
	adrp	x9, _AR7240_MDIO_CTRL_MASTER_EN@GOTPAGE
Lloh12:
	ldr	x9, [x9, _AR7240_MDIO_CTRL_MASTER_EN@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh14:
	adrp	x21, _AR7240_MDIO_CTRL_BUSY@GOTPAGE
Lloh15:
	ldr	x21, [x21, _AR7240_MDIO_CTRL_BUSY@GOTPAGEOFF]
	ldr	w9, [x21]
Lloh16:
	adrp	x10, _AR7240_MDIO_CTRL_CMD_READ@GOTPAGE
Lloh17:
	ldr	x10, [x10, _AR7240_MDIO_CTRL_CMD_READ@GOTPAGEOFF]
	orr	w8, w8, w9
Lloh18:
	ldr	w9, [x10]
	orr	w2, w8, w9
Lloh19:
	adrp	x20, _AR7240_REG_MDIO_CTRL@GOTPAGE
Lloh20:
	ldr	x20, [x20, _AR7240_REG_MDIO_CTRL@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	bl	___ar7240sw_reg_write
	ldr	w1, [x20]
	ldr	w2, [x21]
	mov	x0, x19
	mov	w3, #0
	mov	w4, #5
	bl	___ar7240sw_reg_wait
	cbz	w0, LBB0_4
; %bb.2:
	mov	w19, #65535
	b	LBB0_5
LBB0_3:
	mov	w0, #65535
	b	LBB0_6
LBB0_4:
	ldr	w1, [x20]
	mov	x0, x19
	bl	___ar7240sw_reg_read
	mov	x19, x0
LBB0_5:
Lloh21:
	adrp	x0, _reg_mutex@GOTPAGE
Lloh22:
	ldr	x0, [x0, _reg_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
Lloh23:
	adrp	x8, _AR7240_MDIO_CTRL_DATA_M@GOTPAGE
Lloh24:
	ldr	x8, [x8, _AR7240_MDIO_CTRL_DATA_M@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	and	w0, w8, w19
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	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_AR7240_NUM_PHYS,4,2            ; @AR7240_NUM_PHYS
	.comm	_reg_mutex,4,2                  ; @reg_mutex
	.comm	_AR7240_MDIO_CTRL_REG_ADDR_S,4,2 ; @AR7240_MDIO_CTRL_REG_ADDR_S
	.comm	_AR7240_MDIO_CTRL_PHY_ADDR_S,4,2 ; @AR7240_MDIO_CTRL_PHY_ADDR_S
	.comm	_AR7240_MDIO_CTRL_MASTER_EN,4,2 ; @AR7240_MDIO_CTRL_MASTER_EN
	.comm	_AR7240_MDIO_CTRL_BUSY,4,2      ; @AR7240_MDIO_CTRL_BUSY
	.comm	_AR7240_MDIO_CTRL_CMD_READ,4,2  ; @AR7240_MDIO_CTRL_CMD_READ
	.comm	_AR7240_REG_MDIO_CTRL,4,2       ; @AR7240_REG_MDIO_CTRL
	.comm	_AR7240_MDIO_CTRL_DATA_M,4,2    ; @AR7240_MDIO_CTRL_DATA_M
.subsections_via_symbols
