	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function rtl8367_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
_rtl8367_sw_get_port_link:              ## @rtl8367_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	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movl	%esi, %ebx
	callq	_sw_to_rtl8366_smi
	movq	%rax, %r15
	movl	$0, -28(%rbp)
	movq	_RTL8367_NUM_PORTS@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jle	LBB0_1
## %bb.2:
	movl	%ebx, %edi
	callq	_RTL8367_PORT_STATUS_REG
	leaq	-28(%rbp), %rdx
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_rtl8366_smi_read_reg
	movl	-28(%rbp), %ecx
	movq	_RTL8367_PORT_STATUS_LINK@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	(%rdx), %edx
	andl	%ecx, %edx
	setne	%sil
	movl	%esi, (%r14)
	je	LBB0_11
## %bb.3:
	movq	_RTL8367_PORT_STATUS_DUPLEX@GOTPCREL(%rip), %rdx
	movq	_RTL8367_PORT_STATUS_RXPAUSE@GOTPCREL(%rip), %rsi
	movq	_RTL8367_PORT_STATUS_TXPAUSE@GOTPCREL(%rip), %rdi
	movq	_RTL8367_PORT_STATUS_NWAY@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	_RTL8367_PORT_STATUS_SPEED_MASK@GOTPCREL(%rip), %rdx
	andl	(%rdx), %ecx
	cmpl	$2, %ecx
	je	LBB0_8
## %bb.4:
	cmpl	$1, %ecx
	je	LBB0_7
## %bb.5:
	testl	%ecx, %ecx
	jne	LBB0_9
## %bb.6:
	movq	_SWITCH_PORT_SPEED_10@GOTPCREL(%rip), %rcx
	jmp	LBB0_10
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_11
LBB0_8:
	movq	_SWITCH_PORT_SPEED_1000@GOTPCREL(%rip), %rcx
	jmp	LBB0_10
LBB0_7:
	movq	_SWITCH_PORT_SPEED_100@GOTPCREL(%rip), %rcx
	jmp	LBB0_10
LBB0_9:
	movq	_SWITCH_PORT_SPEED_UNKNOWN@GOTPCREL(%rip), %rcx
LBB0_10:
	movl	(%rcx), %ecx
	movl	%ecx, 20(%r14)
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RTL8367_NUM_PORTS,4,2          ## @RTL8367_NUM_PORTS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RTL8367_PORT_STATUS_LINK,4,2   ## @RTL8367_PORT_STATUS_LINK
	.comm	_RTL8367_PORT_STATUS_DUPLEX,4,2 ## @RTL8367_PORT_STATUS_DUPLEX
	.comm	_RTL8367_PORT_STATUS_RXPAUSE,4,2 ## @RTL8367_PORT_STATUS_RXPAUSE
	.comm	_RTL8367_PORT_STATUS_TXPAUSE,4,2 ## @RTL8367_PORT_STATUS_TXPAUSE
	.comm	_RTL8367_PORT_STATUS_NWAY,4,2   ## @RTL8367_PORT_STATUS_NWAY
	.comm	_RTL8367_PORT_STATUS_SPEED_MASK,4,2 ## @RTL8367_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	_rtl8367_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 rtl8367_sw_get_port_link
_rtl8367_sw_get_port_link:              ; @rtl8367_sw_get_port_link
	.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
	mov	x19, x2
	mov	x21, x1
	bl	_sw_to_rtl8366_smi
	str	wzr, [sp, #12]
Lloh0:
	adrp	x8, _RTL8367_NUM_PORTS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RTL8367_NUM_PORTS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w21
	b.le	LBB0_6
; %bb.1:
	mov	x20, x0
	mov	x0, x21
	bl	_RTL8367_PORT_STATUS_REG
	mov	x1, x0
	add	x2, sp, #12
	mov	x0, x20
	bl	_rtl8366_smi_read_reg
	ldr	w8, [sp, #12]
Lloh3:
	adrp	x9, _RTL8367_PORT_STATUS_LINK@GOTPAGE
Lloh4:
	ldr	x9, [x9, _RTL8367_PORT_STATUS_LINK@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	ands	w9, w9, w8
	cset	w10, ne
	str	w10, [x19]
	cbz	w9, LBB0_7
; %bb.2:
Lloh6:
	adrp	x9, _RTL8367_PORT_STATUS_DUPLEX@GOTPAGE
Lloh7:
	ldr	x9, [x9, _RTL8367_PORT_STATUS_DUPLEX@GOTPAGEOFF]
Lloh8:
	adrp	x10, _RTL8367_PORT_STATUS_RXPAUSE@GOTPAGE
Lloh9:
	ldr	x10, [x10, _RTL8367_PORT_STATUS_RXPAUSE@GOTPAGEOFF]
Lloh10:
	adrp	x11, _RTL8367_PORT_STATUS_TXPAUSE@GOTPAGE
Lloh11:
	ldr	x11, [x11, _RTL8367_PORT_STATUS_TXPAUSE@GOTPAGEOFF]
Lloh12:
	adrp	x12, _RTL8367_PORT_STATUS_NWAY@GOTPAGE
Lloh13:
	ldr	x12, [x12, _RTL8367_PORT_STATUS_NWAY@GOTPAGEOFF]
Lloh14:
	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]
Lloh15:
	adrp	x9, _RTL8367_PORT_STATUS_SPEED_MASK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _RTL8367_PORT_STATUS_SPEED_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	and	w8, w9, w8
	cmp	w8, #2
	b.eq	LBB0_8
; %bb.3:
	cmp	w8, #1
	b.eq	LBB0_9
; %bb.4:
	mov	w0, #0
	cbnz	w8, LBB0_10
; %bb.5:
Lloh18:
	adrp	x8, _SWITCH_PORT_SPEED_10@GOTPAGE
Lloh19:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_10@GOTPAGEOFF]
	b	LBB0_11
LBB0_6:
Lloh20:
	adrp	x8, _EINVAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_12
LBB0_7:
	mov	w0, #0
	b	LBB0_12
LBB0_8:
	mov	w0, #0
Lloh23:
	adrp	x8, _SWITCH_PORT_SPEED_1000@GOTPAGE
Lloh24:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_1000@GOTPAGEOFF]
	b	LBB0_11
LBB0_9:
	mov	w0, #0
Lloh25:
	adrp	x8, _SWITCH_PORT_SPEED_100@GOTPAGE
Lloh26:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_100@GOTPAGEOFF]
	b	LBB0_11
LBB0_10:
Lloh27:
	adrp	x8, _SWITCH_PORT_SPEED_UNKNOWN@GOTPAGE
Lloh28:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_UNKNOWN@GOTPAGEOFF]
LBB0_11:
	ldr	w8, [x8]
	str	w8, [x19, #20]
LBB0_12:
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh14
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_RTL8367_NUM_PORTS,4,2          ; @RTL8367_NUM_PORTS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RTL8367_PORT_STATUS_LINK,4,2   ; @RTL8367_PORT_STATUS_LINK
	.comm	_RTL8367_PORT_STATUS_DUPLEX,4,2 ; @RTL8367_PORT_STATUS_DUPLEX
	.comm	_RTL8367_PORT_STATUS_RXPAUSE,4,2 ; @RTL8367_PORT_STATUS_RXPAUSE
	.comm	_RTL8367_PORT_STATUS_TXPAUSE,4,2 ; @RTL8367_PORT_STATUS_TXPAUSE
	.comm	_RTL8367_PORT_STATUS_NWAY,4,2   ; @RTL8367_PORT_STATUS_NWAY
	.comm	_RTL8367_PORT_STATUS_SPEED_MASK,4,2 ; @RTL8367_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	_rtl8367_sw_get_port_link
.subsections_via_symbols
