	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rtl8367b_write_phy_reg
_rtl8367b_write_phy_reg:                ## @rtl8367b_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	%rcx, %r12
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	(%rdi), %edi
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdx
	movq	%r15, %rcx
	movq	%r12, %r8
	callq	_dev_dbg
	movq	_RTL8367B_PHY_ADDR_MAX@GOTPCREL(%rip), %rax
	cmpq	%rbx, (%rax)
	jl	LBB0_1
## %bb.2:
	movq	_RTL8367B_PHY_REG_MAX@GOTPCREL(%rip), %rax
	cmpq	%r15, (%rax)
	jge	LBB0_3
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_3:
	movq	_RTL8367B_IA_STATUS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	callq	_REG_RD
	movq	_RTL8367B_IA_STATUS_PHY_BUSY@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	testq	%rax, -48(%rbp)
	jne	LBB0_7
## %bb.4:
	movq	_RTL8367B_IA_WRITE_DATA_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movq	%r12, %rdx
	callq	_REG_WR
	movq	_RTL8367B_IA_ADDRESS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_RTL8367B_INTERNAL_PHY_REG
	movq	%r14, %rdi
	movl	%r12d, %esi
	movq	%rax, %rdx
	callq	_REG_WR
	movq	_RTL8367B_IA_CTRL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RTL8367B_IA_CTRL_CMD_MASK@GOTPCREL(%rip), %rax
	movq	_RTL8367B_IA_CTRL_RW_WRITE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	orq	(%rax), %rdx
	movq	%r14, %rdi
	callq	_REG_WR
	movq	_RTL8367B_IA_STATUS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	callq	_REG_RD
	movq	(%r13), %rax
	testq	%rax, -48(%rbp)
	je	LBB0_5
## %bb.6:
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
LBB0_7:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rcx
LBB0_8:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	xorl	%eax, %eax
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"phy_write: addr:%02x, reg:%02x, val:%04x\n"

	.comm	_RTL8367B_PHY_ADDR_MAX,8,3      ## @RTL8367B_PHY_ADDR_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RTL8367B_PHY_REG_MAX,8,3       ## @RTL8367B_PHY_REG_MAX
	.comm	_RTL8367B_IA_STATUS_REG,4,2     ## @RTL8367B_IA_STATUS_REG
	.comm	_RTL8367B_IA_STATUS_PHY_BUSY,8,3 ## @RTL8367B_IA_STATUS_PHY_BUSY
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_RTL8367B_IA_WRITE_DATA_REG,4,2 ## @RTL8367B_IA_WRITE_DATA_REG
	.comm	_RTL8367B_IA_ADDRESS_REG,4,2    ## @RTL8367B_IA_ADDRESS_REG
	.comm	_RTL8367B_IA_CTRL_REG,4,2       ## @RTL8367B_IA_CTRL_REG
	.comm	_RTL8367B_IA_CTRL_CMD_MASK,8,3  ## @RTL8367B_IA_CTRL_CMD_MASK
	.comm	_RTL8367B_IA_CTRL_RW_WRITE,8,3  ## @RTL8367B_IA_CTRL_RW_WRITE
L_.str.1:                               ## @.str.1
	.asciz	"phy write timed out\n"

	.no_dead_strip	_rtl8367b_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 rtl8367b_write_phy_reg
_rtl8367b_write_phy_reg:                ; @rtl8367b_write_phy_reg
	.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
	mov	x22, x3
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	w0, [x0]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	mov	x3, x20
	mov	x4, x22
	bl	_dev_dbg
Lloh2:
	adrp	x8, _RTL8367B_PHY_ADDR_MAX@GOTPAGE
Lloh3:
	ldr	x8, [x8, _RTL8367B_PHY_ADDR_MAX@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x8, x21
	b.lt	LBB0_2
; %bb.1:
Lloh5:
	adrp	x8, _RTL8367B_PHY_REG_MAX@GOTPAGE
Lloh6:
	ldr	x8, [x8, _RTL8367B_PHY_REG_MAX@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	cmp	x8, x20
	b.ge	LBB0_3
LBB0_2:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_7
LBB0_3:
Lloh10:
	adrp	x23, _RTL8367B_IA_STATUS_REG@GOTPAGE
Lloh11:
	ldr	x23, [x23, _RTL8367B_IA_STATUS_REG@GOTPAGEOFF]
	ldr	w1, [x23]
	add	x2, sp, #8
	mov	x0, x19
	bl	_REG_RD
	ldr	x8, [sp, #8]
Lloh12:
	adrp	x24, _RTL8367B_IA_STATUS_PHY_BUSY@GOTPAGE
Lloh13:
	ldr	x24, [x24, _RTL8367B_IA_STATUS_PHY_BUSY@GOTPAGEOFF]
	ldr	x9, [x24]
	tst	x9, x8
	b.ne	LBB0_6
; %bb.4:
Lloh14:
	adrp	x8, _RTL8367B_IA_WRITE_DATA_REG@GOTPAGE
Lloh15:
	ldr	x8, [x8, _RTL8367B_IA_WRITE_DATA_REG@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x22
	bl	_REG_WR
Lloh17:
	adrp	x8, _RTL8367B_IA_ADDRESS_REG@GOTPAGE
Lloh18:
	ldr	x8, [x8, _RTL8367B_IA_ADDRESS_REG@GOTPAGEOFF]
Lloh19:
	ldr	w22, [x8]
	mov	x0, x21
	mov	x1, x20
	bl	_RTL8367B_INTERNAL_PHY_REG
	mov	x2, x0
	mov	x0, x19
	mov	x1, x22
	bl	_REG_WR
Lloh20:
	adrp	x8, _RTL8367B_IA_CTRL_REG@GOTPAGE
Lloh21:
	ldr	x8, [x8, _RTL8367B_IA_CTRL_REG@GOTPAGEOFF]
Lloh22:
	adrp	x9, _RTL8367B_IA_CTRL_CMD_MASK@GOTPAGE
Lloh23:
	ldr	x9, [x9, _RTL8367B_IA_CTRL_CMD_MASK@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
Lloh25:
	ldr	x8, [x9]
Lloh26:
	adrp	x9, _RTL8367B_IA_CTRL_RW_WRITE@GOTPAGE
Lloh27:
	ldr	x9, [x9, _RTL8367B_IA_CTRL_RW_WRITE@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	orr	x2, x9, x8
	mov	x0, x19
	bl	_REG_WR
	ldr	w1, [x23]
	add	x2, sp, #8
	mov	x0, x19
	bl	_REG_RD
	ldr	x8, [sp, #8]
	ldr	x9, [x24]
	tst	x9, x8
	b.eq	LBB0_9
; %bb.5:
	ldr	w0, [x19]
Lloh29:
	adrp	x1, l_.str.1@PAGE
Lloh30:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
LBB0_6:
Lloh31:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	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
LBB0_9:
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh24
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"phy_write: addr:%02x, reg:%02x, val:%04x\n"

	.comm	_RTL8367B_PHY_ADDR_MAX,8,3      ; @RTL8367B_PHY_ADDR_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RTL8367B_PHY_REG_MAX,8,3       ; @RTL8367B_PHY_REG_MAX
	.comm	_RTL8367B_IA_STATUS_REG,4,2     ; @RTL8367B_IA_STATUS_REG
	.comm	_RTL8367B_IA_STATUS_PHY_BUSY,8,3 ; @RTL8367B_IA_STATUS_PHY_BUSY
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_RTL8367B_IA_WRITE_DATA_REG,4,2 ; @RTL8367B_IA_WRITE_DATA_REG
	.comm	_RTL8367B_IA_ADDRESS_REG,4,2    ; @RTL8367B_IA_ADDRESS_REG
	.comm	_RTL8367B_IA_CTRL_REG,4,2       ; @RTL8367B_IA_CTRL_REG
	.comm	_RTL8367B_IA_CTRL_CMD_MASK,8,3  ; @RTL8367B_IA_CTRL_CMD_MASK
	.comm	_RTL8367B_IA_CTRL_RW_WRITE,8,3  ; @RTL8367B_IA_CTRL_RW_WRITE
l_.str.1:                               ; @.str.1
	.asciz	"phy write timed out\n"

	.no_dead_strip	_rtl8367b_write_phy_reg
.subsections_via_symbols
