	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ar7240sw_phy_write             ## -- Begin function ar7240sw_phy_write
	.p2align	4, 0x90
_ar7240sw_phy_write:                    ## @ar7240sw_phy_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	%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
	movq	_AR7240_NUM_PHYS@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jbe	LBB0_1
## %bb.3:
	movl	%ecx, %r13d
	movl	%edx, %r12d
	movl	%esi, %ebx
	movq	%rdi, %r15
	movq	_reg_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	_AR7240_MDIO_CTRL_PHY_ADDR_S@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	movq	_AR7240_MDIO_CTRL_REG_ADDR_S@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r12d
	movq	_AR7240_MDIO_CTRL_MASTER_EN@GOTPCREL(%rip), %rax
	movq	_AR7240_MDIO_CTRL_BUSY@GOTPCREL(%rip), %r14
	movq	_AR7240_MDIO_CTRL_CMD_WRITE@GOTPCREL(%rip), %rcx
	orl	%r13d, %ebx
	orl	%r12d, %ebx
	orl	(%rax), %ebx
	orl	(%r14), %ebx
	orl	(%rcx), %ebx
	movq	_AR7240_REG_MDIO_CTRL@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	___ar7240sw_reg_write
	movl	(%r12), %esi
	movl	(%r14), %edx
	movq	%r15, %rdi
	xorl	%ecx, %ecx
	movl	$5, %r8d
	callq	___ar7240sw_reg_wait
	movl	%eax, %ebx
	movq	_reg_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	jmp	LBB0_2
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_2:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AR7240_NUM_PHYS,4,2            ## @AR7240_NUM_PHYS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_reg_mutex,4,2                  ## @reg_mutex
	.comm	_AR7240_MDIO_CTRL_PHY_ADDR_S,4,2 ## @AR7240_MDIO_CTRL_PHY_ADDR_S
	.comm	_AR7240_MDIO_CTRL_REG_ADDR_S,4,2 ## @AR7240_MDIO_CTRL_REG_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_WRITE,4,2 ## @AR7240_MDIO_CTRL_CMD_WRITE
	.comm	_AR7240_REG_MDIO_CTRL,4,2       ## @AR7240_REG_MDIO_CTRL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ar7240sw_phy_write             ; -- Begin function ar7240sw_phy_write
	.p2align	2
_ar7240sw_phy_write:                    ; @ar7240sw_phy_write
	.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
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_2
; %bb.1:
	mov	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
Lloh3:
	adrp	x23, _reg_mutex@GOTPAGE
Lloh4:
	ldr	x23, [x23, _reg_mutex@GOTPAGEOFF]
	mov	x0, x23
	bl	_mutex_lock
Lloh5:
	adrp	x8, _AR7240_MDIO_CTRL_PHY_ADDR_S@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AR7240_MDIO_CTRL_PHY_ADDR_S@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	lsl	w8, w22, w8
Lloh8:
	adrp	x9, _AR7240_MDIO_CTRL_REG_ADDR_S@GOTPAGE
Lloh9:
	ldr	x9, [x9, _AR7240_MDIO_CTRL_REG_ADDR_S@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	lsl	w9, w21, w9
Lloh11:
	adrp	x10, _AR7240_MDIO_CTRL_MASTER_EN@GOTPAGE
Lloh12:
	ldr	x10, [x10, _AR7240_MDIO_CTRL_MASTER_EN@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
Lloh14:
	adrp	x21, _AR7240_MDIO_CTRL_BUSY@GOTPAGE
Lloh15:
	ldr	x21, [x21, _AR7240_MDIO_CTRL_BUSY@GOTPAGEOFF]
	ldr	w11, [x21]
Lloh16:
	adrp	x12, _AR7240_MDIO_CTRL_CMD_WRITE@GOTPAGE
Lloh17:
	ldr	x12, [x12, _AR7240_MDIO_CTRL_CMD_WRITE@GOTPAGEOFF]
Lloh18:
	ldr	w12, [x12]
	orr	w8, w8, w20
	orr	w8, w8, w9
	orr	w8, w8, w10
	orr	w8, w8, w11
	orr	w2, w8, w12
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
	mov	x19, x0
	mov	x0, x23
	bl	_mutex_unlock
	mov	x0, x19
	b	LBB0_3
LBB0_2:
Lloh21:
	adrp	x8, _EINVAL@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_3:
	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
	.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	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_AR7240_NUM_PHYS,4,2            ; @AR7240_NUM_PHYS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_reg_mutex,4,2                  ; @reg_mutex
	.comm	_AR7240_MDIO_CTRL_PHY_ADDR_S,4,2 ; @AR7240_MDIO_CTRL_PHY_ADDR_S
	.comm	_AR7240_MDIO_CTRL_REG_ADDR_S,4,2 ; @AR7240_MDIO_CTRL_REG_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_WRITE,4,2 ; @AR7240_MDIO_CTRL_CMD_WRITE
	.comm	_AR7240_REG_MDIO_CTRL,4,2       ; @AR7240_REG_MDIO_CTRL
.subsections_via_symbols
