	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mcs7830_write_phy
_mcs7830_write_phy:                     ## @mcs7830_write_phy
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movl	%esi, %r15d
	movq	%rdi, %r12
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_HIF_REG_PHY_CMD1_WRITE@GOTPCREL(%rip), %rax
	movq	_HIF_REG_PHY_CMD1_PHYADDR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movl	%ecx, -56(%rbp)
	movq	_HIF_REG_PHY_CMD2_PEND_FLAG_BIT@GOTPCREL(%rip), %rax
	movl	%esi, %ecx
	andl	$31, %ecx
	orl	(%rax), %ecx
	movl	%ecx, -52(%rbp)
	callq	_mutex_lock
	movl	%r14d, %edi
	callq	_cpu_to_le16
	movl	%eax, -68(%rbp)
	movq	_HIF_REG_PHY_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-68(%rbp), %rcx
	movq	%r12, %rdi
	movl	$2, %edx
	callq	_mcs7830_set_reg
	testl	%eax, %eax
	js	LBB0_8
## %bb.1:
	movq	_HIF_REG_PHY_CMD1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-56(%rbp), %rcx
	movq	%r12, %rdi
	movl	$2, %edx
	callq	_mcs7830_set_reg
	testl	%eax, %eax
	js	LBB0_8
## %bb.2:
	movl	%r15d, -60(%rbp)                ## 4-byte Spill
	movl	%r14d, -64(%rbp)                ## 4-byte Spill
	xorl	%r13d, %r13d
	leaq	-56(%rbp), %r14
	movq	_HIF_REG_PHY_CMD2_READY_FLAG_BIT@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	_HIF_REG_PHY_CMD1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	$2, %edx
	movq	%r14, %rcx
	callq	_mcs7830_get_reg
	testl	%eax, %eax
	js	LBB0_8
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r15), %eax
	testl	%eax, -52(%rbp)
	jne	LBB0_12
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	$1, %edi
	callq	_msleep
	incl	%r13d
	cmpl	$10, %r13d
	jne	LBB0_3
## %bb.6:
	testl	%ebx, %ebx
	jle	LBB0_11
## %bb.7:
	negl	%ebx
	jmp	LBB0_13
LBB0_8:
	movl	%eax, %ebx
LBB0_13:
	movq	%r12, %rdi
	callq	_mutex_unlock
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_15
## %bb.14:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movl	$10, %r13d
LBB0_12:
	movq	8(%r12), %rdi
	leaq	L_.str(%rip), %rsi
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	movl	-64(%rbp), %ecx                 ## 4-byte Reload
	movl	%r13d, %r8d
	callq	_dev_dbg
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_15:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_HIF_REG_PHY_CMD1_WRITE,4,2     ## @HIF_REG_PHY_CMD1_WRITE
	.comm	_HIF_REG_PHY_CMD1_PHYADDR,4,2   ## @HIF_REG_PHY_CMD1_PHYADDR
	.comm	_HIF_REG_PHY_CMD2_PEND_FLAG_BIT,4,2 ## @HIF_REG_PHY_CMD2_PEND_FLAG_BIT
	.comm	_HIF_REG_PHY_DATA,4,2           ## @HIF_REG_PHY_DATA
	.comm	_HIF_REG_PHY_CMD1,4,2           ## @HIF_REG_PHY_CMD1
	.comm	_HIF_REG_PHY_CMD2_READY_FLAG_BIT,4,2 ## @HIF_REG_PHY_CMD2_READY_FLAG_BIT
	.comm	_EIO,4,2                        ## @EIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write PHY reg %02x: %04x (%d tries)\n"

	.no_dead_strip	_mcs7830_write_phy
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mcs7830_write_phy
_mcs7830_write_phy:                     ; @mcs7830_write_phy
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
Lloh3:
	adrp	x8, _HIF_REG_PHY_CMD1_WRITE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _HIF_REG_PHY_CMD1_WRITE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _HIF_REG_PHY_CMD1_PHYADDR@GOTPAGE
Lloh7:
	ldr	x9, [x9, _HIF_REG_PHY_CMD1_PHYADDR@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
Lloh9:
	adrp	x10, _HIF_REG_PHY_CMD2_PEND_FLAG_BIT@GOTPAGE
Lloh10:
	ldr	x10, [x10, _HIF_REG_PHY_CMD2_PEND_FLAG_BIT@GOTPAGEOFF]
	orr	w8, w9, w8
Lloh11:
	ldr	w9, [x10]
	and	w10, w1, #0x1f
	orr	w9, w9, w10
	stp	w8, w9, [sp, #16]
	bl	_mutex_lock
	mov	x0, x20
	bl	_cpu_to_le16
	str	w0, [sp, #12]
Lloh12:
	adrp	x8, _HIF_REG_PHY_DATA@GOTPAGE
Lloh13:
	ldr	x8, [x8, _HIF_REG_PHY_DATA@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	add	x3, sp, #12
	mov	x0, x19
	mov	w2, #2
	bl	_mcs7830_set_reg
	tbnz	w0, #31, LBB0_8
; %bb.1:
Lloh15:
	adrp	x24, _HIF_REG_PHY_CMD1@GOTPAGE
Lloh16:
	ldr	x24, [x24, _HIF_REG_PHY_CMD1@GOTPAGEOFF]
	ldr	w1, [x24]
	add	x3, sp, #16
	mov	x0, x19
	mov	w2, #2
	bl	_mcs7830_set_reg
	tbnz	w0, #31, LBB0_8
; %bb.2:
	mov	w22, #0
Lloh17:
	adrp	x25, _HIF_REG_PHY_CMD2_READY_FLAG_BIT@GOTPAGE
Lloh18:
	ldr	x25, [x25, _HIF_REG_PHY_CMD2_READY_FLAG_BIT@GOTPAGEOFF]
Lloh19:
	adrp	x26, _EIO@GOTPAGE
Lloh20:
	ldr	x26, [x26, _EIO@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x24]
	add	x3, sp, #16
	mov	x0, x19
	mov	w2, #2
	bl	_mcs7830_get_reg
	tbnz	w0, #31, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [sp, #20]
	ldr	w9, [x25]
	tst	w9, w8
	b.ne	LBB0_12
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w23, [x26]
	mov	w0, #1
	bl	_msleep
	add	w22, w22, #1
	cmp	w22, #10
	b.ne	LBB0_3
; %bb.6:
	cmp	w23, #0
	b.le	LBB0_11
; %bb.7:
	neg	w23, w23
	b	LBB0_9
LBB0_8:
	mov	x23, x0
LBB0_9:
	mov	x0, x19
	bl	_mutex_unlock
	ldr	x8, [sp, #24]
Lloh21:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh22:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_13
; %bb.10:
	mov	x0, x23
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_11:
	mov	w22, #10
LBB0_12:
	ldr	x0, [x19, #8]
Lloh24:
	adrp	x1, l_.str@PAGE
Lloh25:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	mov	x3, x20
	mov	x4, x22
	bl	_dev_dbg
	mov	w23, #0
	b	LBB0_9
LBB0_13:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_HIF_REG_PHY_CMD1_WRITE,4,2     ; @HIF_REG_PHY_CMD1_WRITE
	.comm	_HIF_REG_PHY_CMD1_PHYADDR,4,2   ; @HIF_REG_PHY_CMD1_PHYADDR
	.comm	_HIF_REG_PHY_CMD2_PEND_FLAG_BIT,4,2 ; @HIF_REG_PHY_CMD2_PEND_FLAG_BIT
	.comm	_HIF_REG_PHY_DATA,4,2           ; @HIF_REG_PHY_DATA
	.comm	_HIF_REG_PHY_CMD1,4,2           ; @HIF_REG_PHY_CMD1
	.comm	_HIF_REG_PHY_CMD2_READY_FLAG_BIT,4,2 ; @HIF_REG_PHY_CMD2_READY_FLAG_BIT
	.comm	_EIO,4,2                        ; @EIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write PHY reg %02x: %04x (%d tries)\n"

	.no_dead_strip	_mcs7830_write_phy
.subsections_via_symbols
