	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_alpine_serdes_eth_mode_set     ## -- Begin function alpine_serdes_eth_mode_set
	.p2align	4, 0x90
_alpine_serdes_eth_mode_set:            ## @alpine_serdes_eth_mode_set
	.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
	movq	_serdes_base@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_1
## %bb.2:
	movq	%rdi, %rbx
	movq	_SERDES_NUM_GROUPS@GOTPCREL(%rip), %rax
	cmpq	%rdi, (%rax)
	jbe	LBB0_1
## %bb.3:
	movl	%esi, %r15d
	movq	_alpine_serdes_eth_group_mode@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	leaq	(%rbx,%rbx,2), %r12
	leaq	8(,%r12,4), %r14
	addq	%r13, %r14
	movq	%r14, %rdi
	callq	_mtx_lock
	cmpl	$0, (%r13,%r12,4)
	je	LBB0_5
## %bb.4:
	cmpl	%r15d, 4(%r13,%r12,4)
	je	LBB0_6
LBB0_5:
	leaq	(,%r12,4), %rax
	addq	%r13, %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_alpine_serdes_resource_get
	leaq	-64(%rbp), %rcx
	movl	%eax, %edi
	movq	%rbx, %rsi
	movq	%rcx, %rbx
	movq	%rcx, %rdx
	callq	_al_serdes_handle_grp_init
	movq	_ALPINE_SERDES_ETH_MODE_SGMII@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	leaq	-56(%rbp), %rcx
	cmovneq	%rbx, %rcx
	movq	%rbx, %rdi
	callq	*(%rcx)
	movl	%r15d, 4(%r13,%r12,4)
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	$1, (%rax)
LBB0_6:
	movq	%r14, %rdi
	callq	_mtx_unlock
	xorl	%eax, %eax
	jmp	LBB0_7
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_7:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_alpine_serdes_eth_group_mode,8,3 ## @alpine_serdes_eth_group_mode
	.comm	_serdes_base,8,3                ## @serdes_base
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SERDES_NUM_GROUPS,8,3          ## @SERDES_NUM_GROUPS
	.comm	_ALPINE_SERDES_ETH_MODE_SGMII,4,2 ## @ALPINE_SERDES_ETH_MODE_SGMII
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_alpine_serdes_eth_mode_set     ; -- Begin function alpine_serdes_eth_mode_set
	.p2align	2
_alpine_serdes_eth_mode_set:            ; @alpine_serdes_eth_mode_set
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
Lloh0:
	adrp	x8, _serdes_base@GOTPAGE
Lloh1:
	ldr	x8, [x8, _serdes_base@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cbz	x8, LBB0_6
; %bb.1:
	mov	x20, x0
Lloh3:
	adrp	x8, _SERDES_NUM_GROUPS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SERDES_NUM_GROUPS@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x8, x0
	b.ls	LBB0_6
; %bb.2:
	mov	x19, x1
Lloh6:
	adrp	x8, _alpine_serdes_eth_group_mode@GOTPAGE
Lloh7:
	ldr	x8, [x8, _alpine_serdes_eth_group_mode@GOTPAGEOFF]
Lloh8:
	ldr	x23, [x8]
	mov	w8, #12
	madd	x22, x20, x8, x23
	add	x21, x22, #8
	mov	x0, x21
	bl	_mtx_lock
	ldr	w8, [x22]
	cbz	w8, LBB0_4
; %bb.3:
	mov	w8, #12
	madd	x8, x20, x8, x23
	ldr	w8, [x8, #4]
	cmp	w8, w19
	b.eq	LBB0_5
LBB0_4:
	mov	x0, x20
	bl	_alpine_serdes_resource_get
	mov	x24, sp
	mov	x2, sp
	mov	x1, x20
	bl	_al_serdes_handle_grp_init
Lloh9:
	adrp	x8, _ALPINE_SERDES_ETH_MODE_SGMII@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ALPINE_SERDES_ETH_MODE_SGMII@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	add	x9, x24, #8
	cmp	w8, w19
	csel	x8, x9, x24, eq
	ldr	x8, [x8]
	mov	x0, sp
	blr	x8
	mov	w8, #12
	madd	x8, x20, x8, x23
	str	w19, [x8, #4]
	mov	w8, #1
	str	w8, [x22]
LBB0_5:
	mov	x0, x21
	bl	_mtx_unlock
	mov	w0, #0
	b	LBB0_7
LBB0_6:
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
LBB0_7:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_alpine_serdes_eth_group_mode,8,3 ; @alpine_serdes_eth_group_mode
	.comm	_serdes_base,8,3                ; @serdes_base
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SERDES_NUM_GROUPS,8,3          ; @SERDES_NUM_GROUPS
	.comm	_ALPINE_SERDES_ETH_MODE_SGMII,4,2 ; @ALPINE_SERDES_ETH_MODE_SGMII
.subsections_via_symbols
