	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rtl8366s_write_phy_reg
_rtl8366s_write_phy_reg:                ## @rtl8366s_write_phy_reg
	.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	_RTL8366S_PHY_NO_MAX@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jl	LBB0_1
## %bb.2:
	movl	%edx, %r13d
	movq	_RTL8366S_PHY_PAGE_MAX@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	jl	LBB0_1
## %bb.3:
	movl	%ecx, %r12d
	movq	_RTL8366S_PHY_ADDR_MAX@GOTPCREL(%rip), %rax
	cmpl	%ecx, (%rax)
	jge	LBB0_4
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	%r8d, %r14d
	movl	%esi, %ebx
	movq	%rdi, %r15
	movq	_RTL8366S_PHY_ACCESS_CTRL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RTL8366S_PHY_CTRL_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_rtl8366_smi_write_reg
	testl	%eax, %eax
	jne	LBB0_5
## %bb.6:
	movq	_RTL8366S_PHY_NO_OFFSET@GOTPCREL(%rip), %rax
	addl	(%rax), %ebx
	movq	_RTL8366S_PHY_PAGE_OFFSET@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r13d
	movq	_RTL8366S_PHY_PAGE_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %r13d
	movq	_RTL8366S_PHY_REG_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %r12d
	btsl	%ebx, %r13d
	orl	%r12d, %r13d
	orl	$32768, %r13d                   ## imm = 0x8000
	movq	%r15, %rdi
	movl	%r13d, %esi
	movl	%r14d, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_rtl8366_smi_write_reg          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_RTL8366S_PHY_NO_MAX,4,2        ## @RTL8366S_PHY_NO_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RTL8366S_PHY_PAGE_MAX,4,2      ## @RTL8366S_PHY_PAGE_MAX
	.comm	_RTL8366S_PHY_ADDR_MAX,4,2      ## @RTL8366S_PHY_ADDR_MAX
	.comm	_RTL8366S_PHY_ACCESS_CTRL_REG,4,2 ## @RTL8366S_PHY_ACCESS_CTRL_REG
	.comm	_RTL8366S_PHY_CTRL_WRITE,4,2    ## @RTL8366S_PHY_CTRL_WRITE
	.comm	_RTL8366S_PHY_NO_OFFSET,4,2     ## @RTL8366S_PHY_NO_OFFSET
	.comm	_RTL8366S_PHY_PAGE_OFFSET,4,2   ## @RTL8366S_PHY_PAGE_OFFSET
	.comm	_RTL8366S_PHY_PAGE_MASK,4,2     ## @RTL8366S_PHY_PAGE_MASK
	.comm	_RTL8366S_PHY_REG_MASK,4,2      ## @RTL8366S_PHY_REG_MASK
	.no_dead_strip	_rtl8366s_write_phy_reg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rtl8366s_write_phy_reg
_rtl8366s_write_phy_reg:                ; @rtl8366s_write_phy_reg
	.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, _RTL8366S_PHY_NO_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RTL8366S_PHY_NO_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.lt	LBB0_3
; %bb.1:
	mov	x22, x2
Lloh3:
	adrp	x8, _RTL8366S_PHY_PAGE_MAX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _RTL8366S_PHY_PAGE_MAX@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, w2
	b.lt	LBB0_3
; %bb.2:
	mov	x21, x3
Lloh6:
	adrp	x8, _RTL8366S_PHY_ADDR_MAX@GOTPAGE
Lloh7:
	ldr	x8, [x8, _RTL8366S_PHY_ADDR_MAX@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w8, w3
	b.ge	LBB0_5
LBB0_3:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_4:
	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_5:
	mov	x19, x4
	mov	x23, x1
	mov	x20, x0
Lloh12:
	adrp	x8, _RTL8366S_PHY_ACCESS_CTRL_REG@GOTPAGE
Lloh13:
	ldr	x8, [x8, _RTL8366S_PHY_ACCESS_CTRL_REG@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
Lloh15:
	adrp	x8, _RTL8366S_PHY_CTRL_WRITE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _RTL8366S_PHY_CTRL_WRITE@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	bl	_rtl8366_smi_write_reg
	cbnz	w0, LBB0_4
; %bb.6:
Lloh18:
	adrp	x8, _RTL8366S_PHY_NO_OFFSET@GOTPAGE
Lloh19:
	ldr	x8, [x8, _RTL8366S_PHY_NO_OFFSET@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	add	w8, w8, w23
	mov	w9, #1
	lsl	w8, w9, w8
Lloh21:
	adrp	x9, _RTL8366S_PHY_PAGE_OFFSET@GOTPAGE
Lloh22:
	ldr	x9, [x9, _RTL8366S_PHY_PAGE_OFFSET@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	lsl	w9, w22, w9
Lloh24:
	adrp	x10, _RTL8366S_PHY_PAGE_MASK@GOTPAGE
Lloh25:
	ldr	x10, [x10, _RTL8366S_PHY_PAGE_MASK@GOTPAGEOFF]
Lloh26:
	ldr	w10, [x10]
	and	w9, w9, w10
Lloh27:
	adrp	x10, _RTL8366S_PHY_REG_MASK@GOTPAGE
Lloh28:
	ldr	x10, [x10, _RTL8366S_PHY_REG_MASK@GOTPAGEOFF]
Lloh29:
	ldr	w10, [x10]
	and	w10, w10, w21
	orr	w8, w8, w9
	orr	w8, w8, w10
	orr	w1, w8, #0x8000
	mov	x0, x20
	mov	x2, x19
	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
	b	_rtl8366_smi_write_reg
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_RTL8366S_PHY_NO_MAX,4,2        ; @RTL8366S_PHY_NO_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RTL8366S_PHY_PAGE_MAX,4,2      ; @RTL8366S_PHY_PAGE_MAX
	.comm	_RTL8366S_PHY_ADDR_MAX,4,2      ; @RTL8366S_PHY_ADDR_MAX
	.comm	_RTL8366S_PHY_ACCESS_CTRL_REG,4,2 ; @RTL8366S_PHY_ACCESS_CTRL_REG
	.comm	_RTL8366S_PHY_CTRL_WRITE,4,2    ; @RTL8366S_PHY_CTRL_WRITE
	.comm	_RTL8366S_PHY_NO_OFFSET,4,2     ; @RTL8366S_PHY_NO_OFFSET
	.comm	_RTL8366S_PHY_PAGE_OFFSET,4,2   ; @RTL8366S_PHY_PAGE_OFFSET
	.comm	_RTL8366S_PHY_PAGE_MASK,4,2     ; @RTL8366S_PHY_PAGE_MASK
	.comm	_RTL8366S_PHY_REG_MASK,4,2      ; @RTL8366S_PHY_REG_MASK
	.no_dead_strip	_rtl8366s_write_phy_reg
.subsections_via_symbols
