	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function port_set_link_speed
_port_set_link_speed:                   ## @port_set_link_speed
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$0, 4(%rdi)
	jle	LBB0_17
## %bb.1:
	movq	%rdi, %r13
	movq	16(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	(%rdi), %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_2 Depth=1
	incl	%r12d
	cmpl	4(%r13), %r12d
	jge	LBB0_17
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leal	(%rax,%r12), %r14d
	movq	_KS884X_PORT_CTRL_4_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%r14d, %esi
	leaq	-44(%rbp), %rcx
	callq	_port_r16
	movq	_KS884X_PORT_STATUS_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movl	%r14d, %esi
	leaq	-48(%rbp), %rcx
	callq	_port_r8
	movq	_PORT_STATUS_LINK_GOOD@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	andl	-48(%rbp), %r15d
	movl	-44(%rbp), %esi
	cmovnel	%esi, %r15d
	movq	_PORT_AUTO_NEG_ENABLE@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movl	%esi, -44(%rbp)
	movq	%r13, %rdi
	callq	_advertised_flow_ctrl
	movq	_PORT_AUTO_NEG_100BTX_FD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movq	_PORT_AUTO_NEG_100BTX@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r9d
	movl	%r9d, %edi
	orl	%r8d, %edi
	movq	_PORT_AUTO_NEG_10BT_FD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r10d
	movq	_PORT_AUTO_NEG_10BT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	%edx, %ebx
	orl	%r10d, %ebx
	orl	%ebx, %eax
	movl	%eax, %ecx
	orl	%edi, %ecx
	movl	%ecx, -44(%rbp)
	movl	8(%r13), %esi
	cmpl	$100, %esi
	je	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$10, %esi
	je	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	testl	%esi, %esi
	jne	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	12(%r13), %eax
	testl	%eax, %eax
	je	LBB0_14
	.p2align	4, 0x90
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$2, %eax
	je	LBB0_12
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$1, %eax
	jne	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	orl	%r8d, %r10d
	notl	%r10d
	andl	%r10d, %ecx
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	notl	%edi
	andl	%edi, %eax
	movl	%eax, -44(%rbp)
	movl	%eax, %ecx
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	notl	%ebx
	andl	%ebx, %ecx
	movl	%ecx, -44(%rbp)
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	12(%r13), %eax
	cmpl	$2, %eax
	jne	LBB0_10
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	orl	%r9d, %edx
	notl	%edx
	andl	%edx, %ecx
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%ecx, -44(%rbp)
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%r15d, %ecx
	je	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_PORT_AUTO_NEG_RESTART@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, -44(%rbp)
	movq	_KS884X_PORT_CTRL_4_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r14d, %esi
	callq	_port_w16
	jmp	LBB0_16
LBB0_17:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_KS884X_PORT_CTRL_4_OFFSET,4,2  ## @KS884X_PORT_CTRL_4_OFFSET
	.comm	_KS884X_PORT_STATUS_OFFSET,4,2  ## @KS884X_PORT_STATUS_OFFSET
	.comm	_PORT_STATUS_LINK_GOOD,4,2      ## @PORT_STATUS_LINK_GOOD
	.comm	_PORT_AUTO_NEG_ENABLE,4,2       ## @PORT_AUTO_NEG_ENABLE
	.comm	_PORT_AUTO_NEG_100BTX_FD,4,2    ## @PORT_AUTO_NEG_100BTX_FD
	.comm	_PORT_AUTO_NEG_100BTX,4,2       ## @PORT_AUTO_NEG_100BTX
	.comm	_PORT_AUTO_NEG_10BT_FD,4,2      ## @PORT_AUTO_NEG_10BT_FD
	.comm	_PORT_AUTO_NEG_10BT,4,2         ## @PORT_AUTO_NEG_10BT
	.comm	_PORT_AUTO_NEG_RESTART,4,2      ## @PORT_AUTO_NEG_RESTART
	.no_dead_strip	_port_set_link_speed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function port_set_link_speed
_port_set_link_speed:                   ; @port_set_link_speed
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldr	w8, [x0, #4]
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.1:
	mov	x19, x0
	mov	w22, #0
	ldr	x20, [x0, #16]
	ldr	w23, [x0]
Lloh0:
	adrp	x24, _KS884X_PORT_CTRL_4_OFFSET@GOTPAGE
Lloh1:
	ldr	x24, [x24, _KS884X_PORT_CTRL_4_OFFSET@GOTPAGEOFF]
Lloh2:
	adrp	x25, _PORT_AUTO_NEG_100BTX@GOTPAGE
Lloh3:
	ldr	x25, [x25, _PORT_AUTO_NEG_100BTX@GOTPAGEOFF]
Lloh4:
	adrp	x26, _PORT_AUTO_NEG_10BT_FD@GOTPAGE
Lloh5:
	ldr	x26, [x26, _PORT_AUTO_NEG_10BT_FD@GOTPAGEOFF]
Lloh6:
	adrp	x27, _PORT_AUTO_NEG_10BT@GOTPAGE
Lloh7:
	ldr	x27, [x27, _PORT_AUTO_NEG_10BT@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	w22, w22, #1
	ldr	w8, [x19, #4]
	cmp	w22, w8
	b.ge	LBB0_18
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	add	w21, w23, w22
	ldr	w2, [x24]
	add	x3, sp, #12
	mov	x0, x20
	mov	x1, x21
	bl	_port_r16
Lloh8:
	adrp	x8, _KS884X_PORT_STATUS_OFFSET@GOTPAGE
Lloh9:
	ldr	x8, [x8, _KS884X_PORT_STATUS_OFFSET@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	add	x3, sp, #8
	mov	x0, x20
	mov	x1, x21
	bl	_port_r8
	ldp	w8, w10, [sp, #8]
Lloh11:
	adrp	x9, _PORT_STATUS_LINK_GOOD@GOTPAGE
Lloh12:
	ldr	x9, [x9, _PORT_STATUS_LINK_GOOD@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	tst	w9, w8
	csel	w28, wzr, w10, eq
Lloh14:
	adrp	x8, _PORT_AUTO_NEG_ENABLE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _PORT_AUTO_NEG_ENABLE@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	orr	w1, w8, w10
	str	w1, [sp, #12]
	mov	x0, x19
	bl	_advertised_flow_ctrl
Lloh17:
	adrp	x8, _PORT_AUTO_NEG_100BTX_FD@GOTPAGE
Lloh18:
	ldr	x8, [x8, _PORT_AUTO_NEG_100BTX_FD@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x8]
	ldr	w11, [x25]
	orr	w13, w11, w9
	ldr	w10, [x26]
	ldr	w12, [x27]
	orr	w16, w12, w10
	orr	w14, w16, w0
	orr	w8, w14, w13
	str	w8, [sp, #12]
	ldr	w15, [x19, #8]
	cmp	w15, #100
	b.eq	LBB0_11
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w15, #10
	b.eq	LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	cbnz	w15, LBB0_13
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w13, [x19, #12]
	cbz	w13, LBB0_16
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w13, #2
	b.eq	LBB0_14
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	cmp	w13, #1
	b.ne	LBB0_16
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	orr	w9, w10, w9
	b	LBB0_15
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
	bic	w8, w14, w13
	b	LBB0_12
LBB0_11:                                ;   in Loop: Header=BB0_3 Depth=1
	bic	w8, w8, w16
LBB0_12:                                ;   in Loop: Header=BB0_3 Depth=1
	str	w8, [sp, #12]
LBB0_13:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w13, [x19, #12]
	cmp	w13, #2
	b.ne	LBB0_8
LBB0_14:                                ;   in Loop: Header=BB0_3 Depth=1
	orr	w9, w12, w11
LBB0_15:                                ;   in Loop: Header=BB0_3 Depth=1
	bic	w8, w8, w9
	str	w8, [sp, #12]
LBB0_16:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w8, w28
	b.eq	LBB0_2
; %bb.17:                               ;   in Loop: Header=BB0_3 Depth=1
Lloh20:
	adrp	x9, _PORT_AUTO_NEG_RESTART@GOTPAGE
Lloh21:
	ldr	x9, [x9, _PORT_AUTO_NEG_RESTART@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	orr	w3, w9, w8
	str	w3, [sp, #12]
	ldr	w2, [x24]
	mov	x0, x20
	mov	x1, x21
	bl	_port_w16
	b	LBB0_2
LBB0_18:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_KS884X_PORT_CTRL_4_OFFSET,4,2  ; @KS884X_PORT_CTRL_4_OFFSET
	.comm	_KS884X_PORT_STATUS_OFFSET,4,2  ; @KS884X_PORT_STATUS_OFFSET
	.comm	_PORT_STATUS_LINK_GOOD,4,2      ; @PORT_STATUS_LINK_GOOD
	.comm	_PORT_AUTO_NEG_ENABLE,4,2       ; @PORT_AUTO_NEG_ENABLE
	.comm	_PORT_AUTO_NEG_100BTX_FD,4,2    ; @PORT_AUTO_NEG_100BTX_FD
	.comm	_PORT_AUTO_NEG_100BTX,4,2       ; @PORT_AUTO_NEG_100BTX
	.comm	_PORT_AUTO_NEG_10BT_FD,4,2      ; @PORT_AUTO_NEG_10BT_FD
	.comm	_PORT_AUTO_NEG_10BT,4,2         ; @PORT_AUTO_NEG_10BT
	.comm	_PORT_AUTO_NEG_RESTART,4,2      ; @PORT_AUTO_NEG_RESTART
	.no_dead_strip	_port_set_link_speed
.subsections_via_symbols
