	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar7240_get_port_link
_ar7240_get_port_link:                  ## @ar7240_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_ar7240
	movq	_AR7240_NUM_PORTS@GOTPCREL(%rip), %rcx
	cmpl	%ebx, (%rcx)
	jle	LBB0_1
## %bb.2:
	movq	(%rax), %r15
	movl	%ebx, %edi
	callq	_AR7240_REG_PORT_STATUS
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_ar7240sw_reg_read
	movq	_AR7240_PORT_STATUS_LINK_AUTO@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	movl	%eax, %esi
	andl	(%rcx), %esi
	setne	%dl
	movl	%edx, (%r14)
	je	LBB0_5
## %bb.3:
	movq	_AR7240_PORT_STATUS_LINK_UP@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	setne	%dl
	movl	%edx, 4(%r14)
	jne	LBB0_6
## %bb.4:
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_13
LBB0_5:
	movl	$1, 4(%r14)
LBB0_6:
	movq	_AR7240_PORT_STATUS_DUPLEX@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	setne	%dl
	movl	%edx, 8(%r14)
	movq	_AR7240_PORT_STATUS_TXFLOW@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	setne	%dl
	movl	%edx, 12(%r14)
	movq	_AR7240_PORT_STATUS_RXFLOW@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	setne	%dl
	movl	%edx, 16(%r14)
	movq	_AR7240_PORT_STATUS_SPEED_M@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	xorl	%eax, %eax
	cmpl	$128, %ecx
	je	LBB0_11
## %bb.7:
	cmpl	$129, %ecx
	je	LBB0_10
## %bb.8:
	cmpl	$130, %ecx
	jne	LBB0_13
## %bb.9:
	movq	_SWITCH_PORT_SPEED_10@GOTPCREL(%rip), %rcx
	jmp	LBB0_12
LBB0_11:
	movq	_SWITCH_PORT_SPEED_1000@GOTPCREL(%rip), %rcx
	jmp	LBB0_12
LBB0_10:
	movq	_SWITCH_PORT_SPEED_100@GOTPCREL(%rip), %rcx
LBB0_12:
	movl	(%rcx), %ecx
	movl	%ecx, 20(%r14)
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AR7240_NUM_PORTS,4,2           ## @AR7240_NUM_PORTS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AR7240_PORT_STATUS_LINK_AUTO,4,2 ## @AR7240_PORT_STATUS_LINK_AUTO
	.comm	_AR7240_PORT_STATUS_LINK_UP,4,2 ## @AR7240_PORT_STATUS_LINK_UP
	.comm	_AR7240_PORT_STATUS_DUPLEX,4,2  ## @AR7240_PORT_STATUS_DUPLEX
	.comm	_AR7240_PORT_STATUS_TXFLOW,4,2  ## @AR7240_PORT_STATUS_TXFLOW
	.comm	_AR7240_PORT_STATUS_RXFLOW,4,2  ## @AR7240_PORT_STATUS_RXFLOW
	.comm	_AR7240_PORT_STATUS_SPEED_M,4,2 ## @AR7240_PORT_STATUS_SPEED_M
	.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
	.no_dead_strip	_ar7240_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 ar7240_get_port_link
_ar7240_get_port_link:                  ; @ar7240_get_port_link
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x2
	mov	x20, x1
	bl	_sw_to_ar7240
Lloh0:
	adrp	x8, _AR7240_NUM_PORTS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AR7240_NUM_PORTS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w20
	b.le	LBB0_3
; %bb.1:
	ldr	x21, [x0]
	mov	x0, x20
	bl	_AR7240_REG_PORT_STATUS
	mov	x1, x0
	mov	x0, x21
	bl	_ar7240sw_reg_read
Lloh3:
	adrp	x8, _AR7240_PORT_STATUS_LINK_AUTO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AR7240_PORT_STATUS_LINK_AUTO@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ands	w8, w8, w0
	cset	w9, ne
	str	w9, [x19]
	cbz	w8, LBB0_4
; %bb.2:
Lloh6:
	adrp	x8, _AR7240_PORT_STATUS_LINK_UP@GOTPAGE
Lloh7:
	ldr	x8, [x8, _AR7240_PORT_STATUS_LINK_UP@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ands	w8, w8, w0
	cset	w9, ne
	str	w9, [x19, #4]
	cbnz	w8, LBB0_5
	b	LBB0_9
LBB0_3:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_13
LBB0_4:
	mov	w8, #1
	str	w8, [x19, #4]
LBB0_5:
Lloh12:
	adrp	x8, _AR7240_PORT_STATUS_DUPLEX@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AR7240_PORT_STATUS_DUPLEX@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	tst	w8, w0
	cset	w8, ne
Lloh15:
	adrp	x9, _AR7240_PORT_STATUS_TXFLOW@GOTPAGE
Lloh16:
	ldr	x9, [x9, _AR7240_PORT_STATUS_TXFLOW@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	tst	w9, w0
	cset	w9, ne
	stp	w8, w9, [x19, #8]
Lloh18:
	adrp	x8, _AR7240_PORT_STATUS_RXFLOW@GOTPAGE
Lloh19:
	ldr	x8, [x8, _AR7240_PORT_STATUS_RXFLOW@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	tst	w8, w0
	cset	w8, ne
	str	w8, [x19, #16]
Lloh21:
	adrp	x8, _AR7240_PORT_STATUS_SPEED_M@GOTPAGE
Lloh22:
	ldr	x8, [x8, _AR7240_PORT_STATUS_SPEED_M@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	and	w8, w8, w0
	cmp	w8, #128
	b.eq	LBB0_10
; %bb.6:
	cmp	w8, #129
	b.eq	LBB0_11
; %bb.7:
	cmp	w8, #130
	b.ne	LBB0_9
; %bb.8:
	mov	w0, #0
Lloh24:
	adrp	x8, _SWITCH_PORT_SPEED_10@GOTPAGE
Lloh25:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_10@GOTPAGEOFF]
	b	LBB0_12
LBB0_9:
	mov	w0, #0
	b	LBB0_13
LBB0_10:
	mov	w0, #0
Lloh26:
	adrp	x8, _SWITCH_PORT_SPEED_1000@GOTPAGE
Lloh27:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_1000@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
	mov	w0, #0
Lloh28:
	adrp	x8, _SWITCH_PORT_SPEED_100@GOTPAGE
Lloh29:
	ldr	x8, [x8, _SWITCH_PORT_SPEED_100@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	str	w8, [x19, #20]
LBB0_13:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_AR7240_NUM_PORTS,4,2           ; @AR7240_NUM_PORTS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AR7240_PORT_STATUS_LINK_AUTO,4,2 ; @AR7240_PORT_STATUS_LINK_AUTO
	.comm	_AR7240_PORT_STATUS_LINK_UP,4,2 ; @AR7240_PORT_STATUS_LINK_UP
	.comm	_AR7240_PORT_STATUS_DUPLEX,4,2  ; @AR7240_PORT_STATUS_DUPLEX
	.comm	_AR7240_PORT_STATUS_TXFLOW,4,2  ; @AR7240_PORT_STATUS_TXFLOW
	.comm	_AR7240_PORT_STATUS_RXFLOW,4,2  ; @AR7240_PORT_STATUS_RXFLOW
	.comm	_AR7240_PORT_STATUS_SPEED_M,4,2 ; @AR7240_PORT_STATUS_SPEED_M
	.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
	.no_dead_strip	_ar7240_get_port_link
.subsections_via_symbols
