	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atl2_phy_init
_atl2_phy_init:                         ## @atl2_phy_init
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	cmpl	$0, (%rdi)
	je	LBB0_1
LBB0_7:
	xorl	%eax, %eax
	jmp	LBB0_8
LBB0_1:
	movq	%rdi, %rbx
	movq	_REG_PHY_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$1, %edx
	callq	_ATL2_WRITE_REGW
	movq	%rbx, %rdi
	callq	_ATL2_WRITE_FLUSH
	movl	$1, %edi
	callq	_msleep
	movq	_MII_DBG_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_atl2_write_phy_reg
	movq	_MII_DBG_DATA@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	leaq	-20(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_atl2_read_phy_reg
	movl	-20(%rbp), %edx
	testl	$4096, %edx                     ## imm = 0x1000
	je	LBB0_3
## %bb.2:
	andl	$-4097, %edx                    ## imm = 0xEFFF
	movl	%edx, -20(%rbp)
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_atl2_write_phy_reg
LBB0_3:
	movl	$1, %edi
	callq	_msleep
	movq	%rbx, %rdi
	movl	$18, %esi
	movl	$3072, %edx                     ## imm = 0xC00
	callq	_atl2_write_phy_reg
	testq	%rax, %rax
	jne	LBB0_8
## %bb.4:
	movq	%rbx, %rdi
	callq	_atl2_phy_setup_autoneg_adv
	testq	%rax, %rax
	jne	LBB0_8
## %bb.5:
	movq	%rbx, %rdi
	callq	_atl2_phy_commit
	testq	%rax, %rax
	je	LBB0_6
LBB0_8:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_6:
	movl	$1, (%rbx)
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_REG_PHY_ENABLE,4,2             ## @REG_PHY_ENABLE
	.comm	_MII_DBG_ADDR,4,2               ## @MII_DBG_ADDR
	.comm	_MII_DBG_DATA,4,2               ## @MII_DBG_DATA
	.no_dead_strip	_atl2_phy_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atl2_phy_init
_atl2_phy_init:                         ; @atl2_phy_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	w8, [x0]
	cbz	w8, LBB0_2
; %bb.1:
	mov	x0, #0
	b	LBB0_8
LBB0_2:
	mov	x19, x0
Lloh0:
	adrp	x8, _REG_PHY_ENABLE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _REG_PHY_ENABLE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w2, #1
	bl	_ATL2_WRITE_REGW
	mov	x0, x19
	bl	_ATL2_WRITE_FLUSH
	mov	w0, #1
	bl	_msleep
Lloh3:
	adrp	x8, _MII_DBG_ADDR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MII_DBG_ADDR@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_atl2_write_phy_reg
Lloh6:
	adrp	x20, _MII_DBG_DATA@GOTPAGE
Lloh7:
	ldr	x20, [x20, _MII_DBG_DATA@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #12
	mov	x0, x19
	bl	_atl2_read_phy_reg
	ldr	w8, [sp, #12]
	tbz	w8, #12, LBB0_4
; %bb.3:
	and	w2, w8, #0xffffefff
	str	w2, [sp, #12]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_atl2_write_phy_reg
LBB0_4:
	mov	w0, #1
	bl	_msleep
	mov	x0, x19
	mov	w1, #18
	mov	w2, #3072
	bl	_atl2_write_phy_reg
	cbnz	x0, LBB0_8
; %bb.5:
	mov	x0, x19
	bl	_atl2_phy_setup_autoneg_adv
	cbnz	x0, LBB0_8
; %bb.6:
	mov	x0, x19
	bl	_atl2_phy_commit
	cbnz	x0, LBB0_8
; %bb.7:
	mov	w8, #1
	str	w8, [x19]
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_REG_PHY_ENABLE,4,2             ; @REG_PHY_ENABLE
	.comm	_MII_DBG_ADDR,4,2               ; @MII_DBG_ADDR
	.comm	_MII_DBG_DATA,4,2               ; @MII_DBG_DATA
	.no_dead_strip	_atl2_phy_init
.subsections_via_symbols
