	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mtk_sgmii_setup_mode_an        ## -- Begin function mtk_sgmii_setup_mode_an
	.p2align	4, 0x90
_mtk_sgmii_setup_mode_an:               ## @mtk_sgmii_setup_mode_an
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movslq	%esi, %r15
	movl	(%rax,%r15,4), %edi
	testl	%edi, %edi
	je	LBB0_1
## %bb.2:
	movq	_SGMSYS_PCS_LINK_TIMER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_SGMII_LINK_TIMER_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_regmap_write
	movq	(%rbx), %rax
	movl	(%rax,%r15,4), %edi
	movq	_SGMSYS_SGMII_MODE@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	leaq	-36(%rbp), %r14
	movq	%r14, %rdx
	callq	_regmap_read
	movq	_SGMII_REMOTE_FAULT_DIS@GOTPCREL(%rip), %rax
	movl	-36(%rbp), %edx
	orl	(%rax), %edx
	movl	%edx, -36(%rbp)
	movq	(%rbx), %rax
	movl	(%rax,%r15,4), %edi
	movl	(%r12), %esi
	callq	_regmap_write
	movq	(%rbx), %rax
	movl	(%rax,%r15,4), %edi
	movq	_SGMSYS_PCS_CONTROL_1@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r14, %rdx
	callq	_regmap_read
	movq	_SGMII_AN_RESTART@GOTPCREL(%rip), %rax
	movl	-36(%rbp), %edx
	orl	(%rax), %edx
	movl	%edx, -36(%rbp)
	movq	(%rbx), %rax
	movl	(%rax,%r15,4), %edi
	movl	(%r12), %esi
	callq	_regmap_write
	movq	(%rbx), %rax
	movl	(%rax,%r15,4), %edi
	movq	_SGMSYS_QPHY_PWR_STATE_CTRL@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r14, %rdx
	callq	_regmap_read
	movq	_SGMII_PHYA_PWD@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	notl	%edx
	andl	-36(%rbp), %edx
	movl	%edx, -36(%rbp)
	movq	(%rbx), %rax
	movl	(%rax,%r15,4), %edi
	movl	(%r12), %esi
	callq	_regmap_write
	xorl	%eax, %eax
	jmp	LBB0_3
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_3:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SGMSYS_PCS_LINK_TIMER,4,2      ## @SGMSYS_PCS_LINK_TIMER
	.comm	_SGMII_LINK_TIMER_DEFAULT,4,2   ## @SGMII_LINK_TIMER_DEFAULT
	.comm	_SGMSYS_SGMII_MODE,4,2          ## @SGMSYS_SGMII_MODE
	.comm	_SGMII_REMOTE_FAULT_DIS,4,2     ## @SGMII_REMOTE_FAULT_DIS
	.comm	_SGMSYS_PCS_CONTROL_1,4,2       ## @SGMSYS_PCS_CONTROL_1
	.comm	_SGMII_AN_RESTART,4,2           ## @SGMII_AN_RESTART
	.comm	_SGMSYS_QPHY_PWR_STATE_CTRL,4,2 ## @SGMSYS_QPHY_PWR_STATE_CTRL
	.comm	_SGMII_PHYA_PWD,4,2             ## @SGMII_PHYA_PWD
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mtk_sgmii_setup_mode_an        ; -- Begin function mtk_sgmii_setup_mode_an
	.p2align	2
_mtk_sgmii_setup_mode_an:               ; @mtk_sgmii_setup_mode_an
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
                                        ; kill: def $w1 killed $w1 def $x1
	mov	x19, x0
	ldr	x8, [x0]
	ldr	w0, [x8, w1, sxtw #2]
	cbz	w0, LBB0_2
; %bb.1:
	sxtw	x20, w1
Lloh0:
	adrp	x8, _SGMSYS_PCS_LINK_TIMER@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SGMSYS_PCS_LINK_TIMER@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _SGMII_LINK_TIMER_DEFAULT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SGMII_LINK_TIMER_DEFAULT@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	bl	_regmap_write
	ldr	x8, [x19]
	lsl	x20, x20, #2
	ldr	w0, [x8, x20]
Lloh6:
	adrp	x21, _SGMSYS_SGMII_MODE@GOTPAGE
Lloh7:
	ldr	x21, [x21, _SGMSYS_SGMII_MODE@GOTPAGEOFF]
	ldr	w1, [x21]
	add	x2, sp, #12
	bl	_regmap_read
Lloh8:
	adrp	x8, _SGMII_REMOTE_FAULT_DIS@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SGMII_REMOTE_FAULT_DIS@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	ldr	w9, [sp, #12]
	orr	w2, w9, w8
	str	w2, [sp, #12]
	ldr	x8, [x19]
	ldr	w0, [x8, x20]
	ldr	w1, [x21]
	bl	_regmap_write
	ldr	x8, [x19]
	ldr	w0, [x8, x20]
Lloh11:
	adrp	x21, _SGMSYS_PCS_CONTROL_1@GOTPAGE
Lloh12:
	ldr	x21, [x21, _SGMSYS_PCS_CONTROL_1@GOTPAGEOFF]
	ldr	w1, [x21]
	add	x2, sp, #12
	bl	_regmap_read
Lloh13:
	adrp	x8, _SGMII_AN_RESTART@GOTPAGE
Lloh14:
	ldr	x8, [x8, _SGMII_AN_RESTART@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	ldr	w9, [sp, #12]
	orr	w2, w9, w8
	str	w2, [sp, #12]
	ldr	x8, [x19]
	ldr	w0, [x8, x20]
	ldr	w1, [x21]
	bl	_regmap_write
	ldr	x8, [x19]
	ldr	w0, [x8, x20]
Lloh16:
	adrp	x21, _SGMSYS_QPHY_PWR_STATE_CTRL@GOTPAGE
Lloh17:
	ldr	x21, [x21, _SGMSYS_QPHY_PWR_STATE_CTRL@GOTPAGEOFF]
	ldr	w1, [x21]
	add	x2, sp, #12
	bl	_regmap_read
Lloh18:
	adrp	x8, _SGMII_PHYA_PWD@GOTPAGE
Lloh19:
	ldr	x8, [x8, _SGMII_PHYA_PWD@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	ldr	w9, [sp, #12]
	bic	w2, w9, w8
	str	w2, [sp, #12]
	ldr	x8, [x19]
	ldr	w0, [x8, x20]
	ldr	w1, [x21]
	bl	_regmap_write
	mov	w0, #0
	b	LBB0_3
LBB0_2:
Lloh21:
	adrp	x8, _EINVAL@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_3:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SGMSYS_PCS_LINK_TIMER,4,2      ; @SGMSYS_PCS_LINK_TIMER
	.comm	_SGMII_LINK_TIMER_DEFAULT,4,2   ; @SGMII_LINK_TIMER_DEFAULT
	.comm	_SGMSYS_SGMII_MODE,4,2          ; @SGMSYS_SGMII_MODE
	.comm	_SGMII_REMOTE_FAULT_DIS,4,2     ; @SGMII_REMOTE_FAULT_DIS
	.comm	_SGMSYS_PCS_CONTROL_1,4,2       ; @SGMSYS_PCS_CONTROL_1
	.comm	_SGMII_AN_RESTART,4,2           ; @SGMII_AN_RESTART
	.comm	_SGMSYS_QPHY_PWR_STATE_CTRL,4,2 ; @SGMSYS_QPHY_PWR_STATE_CTRL
	.comm	_SGMII_PHYA_PWD,4,2             ; @SGMII_PHYA_PWD
.subsections_via_symbols
