	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rtl8366rb_phy_read
_rtl8366rb_phy_read:                    ## @rtl8366rb_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	%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	_RTL8366RB_PHY_NO_MAX@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jge	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_7
LBB0_2:
	movl	%edx, %r14d
	movl	%esi, %r13d
	movq	%rdi, %r15
	movl	4(%rdi), %edi
	movq	_RTL8366RB_PHY_ACCESS_CTRL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RTL8366RB_PHY_CTRL_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_regmap_write
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_7
## %bb.3:
	movq	_RTL8366RB_PHY_NO_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r13d, %eax
	movl	%r14d, %r12d
	btsl	%eax, %r12d
	orl	$32768, %r12d                   ## imm = 0x8000
	movl	4(%r15), %edi
	movl	%r12d, %esi
	xorl	%edx, %edx
	callq	_regmap_write
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %ebx
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %edx
	movl	%r14d, %ecx
	movl	%r12d, %r8d
	movl	%eax, %r9d
	callq	_dev_err
	jmp	LBB0_7
LBB0_5:
	movl	4(%r15), %edi
	movq	_RTL8366RB_PHY_ACCESS_DATA_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	callq	_regmap_read
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_7
## %bb.6:
	movl	(%r15), %edi
	movl	-44(%rbp), %r9d
	leaq	L_.str.1(%rip), %rsi
	movl	%r13d, %edx
	movl	%r14d, %ecx
	movl	%r12d, %r8d
	callq	_dev_dbg
	movl	-44(%rbp), %ebx
LBB0_7:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RTL8366RB_PHY_NO_MAX,4,2       ## @RTL8366RB_PHY_NO_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RTL8366RB_PHY_ACCESS_CTRL_REG,4,2 ## @RTL8366RB_PHY_ACCESS_CTRL_REG
	.comm	_RTL8366RB_PHY_CTRL_READ,4,2    ## @RTL8366RB_PHY_CTRL_READ
	.comm	_RTL8366RB_PHY_NO_OFFSET,4,2    ## @RTL8366RB_PHY_NO_OFFSET
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to write PHY%d reg %04x @ %04x, ret %d\n"

	.comm	_RTL8366RB_PHY_ACCESS_DATA_REG,4,2 ## @RTL8366RB_PHY_ACCESS_DATA_REG
L_.str.1:                               ## @.str.1
	.asciz	"read PHY%d register 0x%04x @ %08x, val <- %04x\n"

	.no_dead_strip	_rtl8366rb_phy_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rtl8366rb_phy_read
_rtl8366rb_phy_read:                    ; @rtl8366rb_phy_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, _RTL8366RB_PHY_NO_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RTL8366RB_PHY_NO_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ge	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_7
LBB0_2:
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	ldr	w0, [x0, #4]
Lloh6:
	adrp	x8, _RTL8366RB_PHY_ACCESS_CTRL_REG@GOTPAGE
Lloh7:
	ldr	x8, [x8, _RTL8366RB_PHY_ACCESS_CTRL_REG@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
Lloh9:
	adrp	x8, _RTL8366RB_PHY_CTRL_READ@GOTPAGE
Lloh10:
	ldr	x8, [x8, _RTL8366RB_PHY_CTRL_READ@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	bl	_regmap_write
	mov	x23, x0
	cbnz	w0, LBB0_7
; %bb.3:
Lloh12:
	adrp	x8, _RTL8366RB_PHY_NO_OFFSET@GOTPAGE
Lloh13:
	ldr	x8, [x8, _RTL8366RB_PHY_NO_OFFSET@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	add	w8, w8, w20
	mov	w9, #1
	lsl	w8, w9, w8
	orr	w8, w8, w19
	orr	w22, w8, #0x8000
	ldr	w0, [x21, #4]
	mov	x1, x22
	mov	w2, #0
	bl	_regmap_write
	cbz	w0, LBB0_5
; %bb.4:
	mov	x23, x0
	ldr	w0, [x21]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	mov	x3, x19
	mov	x4, x22
	mov	x5, x23
	bl	_dev_err
	b	LBB0_7
LBB0_5:
	ldr	w0, [x21, #4]
Lloh17:
	adrp	x8, _RTL8366RB_PHY_ACCESS_DATA_REG@GOTPAGE
Lloh18:
	ldr	x8, [x8, _RTL8366RB_PHY_ACCESS_DATA_REG@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	add	x2, sp, #12
	bl	_regmap_read
	mov	x23, x0
	cbnz	w0, LBB0_7
; %bb.6:
	ldr	w0, [x21]
	ldr	w5, [sp, #12]
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	mov	x3, x19
	mov	x4, x22
	bl	_dev_dbg
	ldr	w23, [sp, #12]
LBB0_7:
	mov	x0, x23
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_RTL8366RB_PHY_NO_MAX,4,2       ; @RTL8366RB_PHY_NO_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RTL8366RB_PHY_ACCESS_CTRL_REG,4,2 ; @RTL8366RB_PHY_ACCESS_CTRL_REG
	.comm	_RTL8366RB_PHY_CTRL_READ,4,2    ; @RTL8366RB_PHY_CTRL_READ
	.comm	_RTL8366RB_PHY_NO_OFFSET,4,2    ; @RTL8366RB_PHY_NO_OFFSET
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to write PHY%d reg %04x @ %04x, ret %d\n"

	.comm	_RTL8366RB_PHY_ACCESS_DATA_REG,4,2 ; @RTL8366RB_PHY_ACCESS_DATA_REG
l_.str.1:                               ; @.str.1
	.asciz	"read PHY%d register 0x%04x @ %08x, val <- %04x\n"

	.no_dead_strip	_rtl8366rb_phy_read
.subsections_via_symbols
