	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function rtl8366rb_sw_get_port_link
LCPI0_0:
	.long	1                               ## 0x1
	.long	1                               ## 0x1
	.long	1                               ## 0x1
	.long	1                               ## 0x1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_rtl8366rb_sw_get_port_link:            ## @rtl8366rb_sw_get_port_link
	.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
	movq	%rdx, %r14
	movl	%esi, %ebx
	callq	_sw_to_rtl8366_smi
	movl	$0, -20(%rbp)
	movq	_RTL8366RB_NUM_PORTS@GOTPCREL(%rip), %rcx
	cmpl	%ebx, (%rcx)
	jle	LBB0_1
## %bb.2:
	movq	_RTL8366RB_PORT_LINK_STATUS_BASE@GOTPCREL(%rip), %rcx
	movl	%ebx, %edx
	shrl	$31, %edx
	addl	%ebx, %edx
	sarl	%edx
	movslq	%edx, %rsi
	addq	(%rcx), %rsi
	leaq	-20(%rbp), %rdx
	movq	%rax, %rdi
	callq	_rtl8366_smi_read_reg
	movl	-20(%rbp), %ecx
	testb	$1, %bl
	je	LBB0_4
## %bb.3:
	sarl	$8, %ecx
	movl	%ecx, -20(%rbp)
LBB0_4:
	movq	_RTL8366RB_PORT_STATUS_LINK_MASK@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	(%rdx), %edx
	andl	%ecx, %edx
	setne	%sil
	movl	%esi, (%r14)
	je	LBB0_13
## %bb.5:
	movq	_RTL8366RB_PORT_STATUS_DUPLEX_MASK@GOTPCREL(%rip), %rdx
	movq	_RTL8366RB_PORT_STATUS_RXPAUSE_MASK@GOTPCREL(%rip), %rsi
	movq	_RTL8366RB_PORT_STATUS_TXPAUSE_MASK@GOTPCREL(%rip), %rdi
	movq	_RTL8366RB_PORT_STATUS_AN_MASK@GOTPCREL(%rip), %rbx
	movd	(%rdx), %xmm0                   ## xmm0 = mem[0],zero,zero,zero
	pinsrd	$1, (%rsi), %xmm0
	pinsrd	$2, (%rdi), %xmm0
	pinsrd	$3, (%rbx), %xmm0
	movd	%ecx, %xmm1
	pshufd	$0, %xmm1, %xmm1                ## xmm1 = xmm1[0,0,0,0]
	pand	%xmm0, %xmm1
	pxor	%xmm0, %xmm0
	pcmpeqd	%xmm1, %xmm0
	pandn	LCPI0_0(%rip), %xmm0
	movdqu	%xmm0, 4(%r14)
	movq	_RTL8366RB_PORT_STATUS_SPEED_MASK@GOTPCREL(%rip), %rdx
	andl	(%rdx), %ecx
	cmpl	$2, %ecx
	je	LBB0_10
## %bb.6:
	cmpl	$1, %ecx
	je	LBB0_9
## %bb.7:
	testl	%ecx, %ecx
	jne	LBB0_11
## %bb.8:
	movq	_SWITCH_PORT_SPEED_10@GOTPCREL(%rip), %rcx
	jmp	LBB0_12
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_13
LBB0_10:
	movq	_SWITCH_PORT_SPEED_1000@GOTPCREL(%rip), %rcx
	jmp	LBB0_12
LBB0_9:
	movq	_SWITCH_PORT_SPEED_100@GOTPCREL(%rip), %rcx
	jmp	LBB0_12
LBB0_11:
	movq	_SWITCH_PORT_SPEED_UNKNOWN@GOTPCREL(%rip), %rcx
LBB0_12:
	movl	(%rcx), %ecx
	movl	%ecx, 20(%r14)
LBB0_13:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RTL8366RB_NUM_PORTS,4,2        ## @RTL8366RB_NUM_PORTS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RTL8366RB_PORT_LINK_STATUS_BASE,8,3 ## @RTL8366RB_PORT_LINK_STATUS_BASE
	.comm	_RTL8366RB_PORT_STATUS_LINK_MASK,4,2 ## @RTL8366RB_PORT_STATUS_LINK_MASK
	.comm	_RTL8366RB_PORT_STATUS_DUPLEX_MASK,4,2 ## @RTL8366RB_PORT_STATUS_DUPLEX_MASK
	.comm	_RTL8366RB_PORT_STATUS_RXPAUSE_MASK,4,2 ## @RTL8366RB_PORT_STATUS_RXPAUSE_MASK
	.comm	_RTL8366RB_PORT_STATUS_TXPAUSE_MASK,4,2 ## @RTL8366RB_PORT_STATUS_TXPAUSE_MASK
	.comm	_RTL8366RB_PORT_STATUS_AN_MASK,4,2 ## @RTL8366RB_PORT_STATUS_AN_MASK
	.comm	_RTL8366RB_PORT_STATUS_SPEED_MASK,4,2 ## @RTL8366RB_PORT_STATUS_SPEED_MASK
	.comm	_SWITCH_PORT_SPEED_10,4,2       ## @SWITCH_PORT_SPEED_10
	.comm	_SWITCH_PORT_SPEED_100,4,2      ## @SWITCH_PORT_SPEED_100
	.comm	_SWITCH_PORT_SPEED_1000,4,2     ## @SWITCH_PORT_SPEED_1000
	.comm	_SWITCH_PORT_SPEED_UNKNOWN,4,2  ## @SWITCH_PORT_SPEED_UNKNOWN
	.no_dead_strip	_rtl8366rb_sw_get_port_link
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rtl8366rb_sw_get_port_link
_rtl8366rb_sw_get_port_link:            ; @rtl8366rb_sw_get_port_link
	.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
	mov	x19, x2
	mov	x20, x1
	bl	_sw_to_rtl8366_smi
	str	wzr, [sp, #12]
Lloh0:
	adrp	x8, _RTL8366RB_NUM_PORTS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RTL8366RB_NUM_PORTS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w20
	b.le	LBB0_8
; %bb.1:
Lloh3:
	adrp	x8, _RTL8366RB_PORT_LINK_STATUS_BASE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _RTL8366RB_PORT_LINK_STATUS_BASE@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	w20, #0
	cinc	w9, w20, lt
	asr	w9, w9, #1
	add	x1, x8, w9, sxtw
	add	x2, sp, #12
	bl	_rtl8366_smi_read_reg
	ldr	w8, [sp, #12]
	tbz	w20, #0, LBB0_3
; %bb.2:
	asr	w8, w8, #8
	str	w8, [sp, #12]
LBB0_3:
Lloh6:
	adrp	x9, _RTL8366RB_PORT_STATUS_LINK_MASK@GOTPAGE
Lloh7:
	ldr	x9, [x9, _RTL8366RB_PORT_STATUS_LINK_MASK@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	ands	w9, w9, w8
	cset	w10, ne
	str	w10, [x19]
	cbz	w9, LBB0_9
; %bb.4:
Lloh9:
	adrp	x9, _RTL8366RB_PORT_STATUS_DUPLEX_MASK@GOTPAGE
Lloh10:
	ldr	x9, [x9, _RTL8366RB_PORT_STATUS_DUPLEX_MASK@GOTPAGEOFF]
Lloh11:
	adrp	x10, _RTL8366RB_PORT_STATUS_RXPAUSE_MASK@GOTPAGE
Lloh12:
	ldr	x10, [x10, _RTL8366RB_PORT_STATUS_RXPAUSE_MASK@GOTPAGEOFF]
Lloh13:
	adrp	x11, _RTL8366RB_PORT_STATUS_TXPAUSE_MASK@GOTPAGE
Lloh14:
	ldr	x11, [x11, _RTL8366RB_PORT_STATUS_TXPAUSE_MASK@GOTPAGEOFF]
Lloh15:
	adrp	x12, _RTL8366RB_PORT_STATUS_AN_MASK@GOTPAGE
Lloh16:
	ldr	x12, [x12, _RTL8366RB_PORT_STATUS_AN_MASK@GOTPAGEOFF]
Lloh17:
	ldr	s0, [x9]
	ld1.s	{ v0 }[1], [x10]
	ld1.s	{ v0 }[2], [x11]
	ld1.s	{ v0 }[3], [x12]
	dup.4s	v1, w8
	and.16b	v0, v0, v1
	cmeq.4s	v0, v0, #0
	movi.4s	v1, #1
	bic.16b	v0, v1, v0
	stur	q0, [x19, #4]
Lloh18:
	adrp	x9, _RTL8366RB_PORT_STATUS_SPEED_MASK@GOTPAGE
Lloh19:
	ldr	x9, [x9, _RTL8366RB_PORT_STATUS_SPEED_MASK@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	and	w8, w9, w8
	cmp	w8, #2
	b.eq	LBB0_10
; %bb.5:
	cmp	w8, #1
	b.eq	LBB0_11
; %bb.6:
	mov	w0, #0
	cbnz	w8, LBB0_12
; %bb.7:
Lloh21:
	adrp	x8, _SWITCH_PORT_SPEED_10@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_10@GOTPAGEOFF]
	b	LBB0_13
LBB0_8:
Lloh23:
	adrp	x8, _EINVAL@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_14
LBB0_9:
	mov	w0, #0
	b	LBB0_14
LBB0_10:
	mov	w0, #0
Lloh26:
	adrp	x8, _SWITCH_PORT_SPEED_1000@GOTPAGE
Lloh27:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_1000@GOTPAGEOFF]
	b	LBB0_13
LBB0_11:
	mov	w0, #0
Lloh28:
	adrp	x8, _SWITCH_PORT_SPEED_100@GOTPAGE
Lloh29:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_100@GOTPAGEOFF]
	b	LBB0_13
LBB0_12:
Lloh30:
	adrp	x8, _SWITCH_PORT_SPEED_UNKNOWN@GOTPAGE
Lloh31:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_UNKNOWN@GOTPAGEOFF]
LBB0_13:
	ldr	w8, [x8]
	str	w8, [x19, #20]
LBB0_14:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh17
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_RTL8366RB_NUM_PORTS,4,2        ; @RTL8366RB_NUM_PORTS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RTL8366RB_PORT_LINK_STATUS_BASE,8,3 ; @RTL8366RB_PORT_LINK_STATUS_BASE
	.comm	_RTL8366RB_PORT_STATUS_LINK_MASK,4,2 ; @RTL8366RB_PORT_STATUS_LINK_MASK
	.comm	_RTL8366RB_PORT_STATUS_DUPLEX_MASK,4,2 ; @RTL8366RB_PORT_STATUS_DUPLEX_MASK
	.comm	_RTL8366RB_PORT_STATUS_RXPAUSE_MASK,4,2 ; @RTL8366RB_PORT_STATUS_RXPAUSE_MASK
	.comm	_RTL8366RB_PORT_STATUS_TXPAUSE_MASK,4,2 ; @RTL8366RB_PORT_STATUS_TXPAUSE_MASK
	.comm	_RTL8366RB_PORT_STATUS_AN_MASK,4,2 ; @RTL8366RB_PORT_STATUS_AN_MASK
	.comm	_RTL8366RB_PORT_STATUS_SPEED_MASK,4,2 ; @RTL8366RB_PORT_STATUS_SPEED_MASK
	.comm	_SWITCH_PORT_SPEED_10,4,2       ; @SWITCH_PORT_SPEED_10
	.comm	_SWITCH_PORT_SPEED_100,4,2      ; @SWITCH_PORT_SPEED_100
	.comm	_SWITCH_PORT_SPEED_1000,4,2     ; @SWITCH_PORT_SPEED_1000
	.comm	_SWITCH_PORT_SPEED_UNKNOWN,4,2  ; @SWITCH_PORT_SPEED_UNKNOWN
	.no_dead_strip	_rtl8366rb_sw_get_port_link
.subsections_via_symbols
