	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hns_mac_init_ex
_hns_mac_init_ex:                       ## @hns_mac_init_ex
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_hns_dsaf_fix_mac_mode
	leaq	-40(%rbp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$4, %edx
	callq	_memset
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_hns_mac_param_get
	movl	-40(%rbp), %edi
	callq	_MAC_SPEED_FROM_MODE
	movq	_MAC_SPEED_10000@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_2
## %bb.1:
	leaq	-40(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_hns_gmac_config
	jmp	LBB0_3
LBB0_2:
	leaq	-40(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_hns_xgmac_config
LBB0_3:
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%r14, (%rbx)
	movq	%rbx, %rdi
	callq	_hns_mac_reset
	movl	16(%rbx), %esi
	xorl	%edx, %edx
	cmpl	$0, 12(%rbx)
	sete	%dl
	movq	%rbx, %rdi
	callq	_hns_mac_adjust_link
	movl	8(%rbx), %esi
	xorl	%r15d, %r15d
	movq	%rbx, %rdi
	xorl	%edx, %edx
	movl	$1, %ecx
	callq	_hns_mac_port_config_bc_en
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r12d
	movq	(%rbx), %rdi
	callq	*(%r14)
	movq	$0, (%rbx)
	movl	%r12d, %r15d
	jmp	LBB0_7
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_7:
	movl	%r15d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAC_SPEED_10000,8,3            ## @MAC_SPEED_10000
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_hns_mac_init_ex
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hns_mac_init_ex
_hns_mac_init_ex:                       ; @hns_mac_init_ex
	.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, x0
	bl	_hns_dsaf_fix_mac_mode
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #4
	bl	_memset
	add	x0, sp, #8
	mov	x1, x19
	bl	_hns_mac_param_get
	ldr	w0, [sp, #8]
	bl	_MAC_SPEED_FROM_MODE
Lloh0:
	adrp	x8, _MAC_SPEED_10000@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAC_SPEED_10000@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	add	x1, sp, #8
	cmp	x0, x8
	b.ge	LBB0_4
; %bb.1:
	mov	x0, x19
	bl	_hns_gmac_config
	mov	x20, x0
	cbz	x0, LBB0_5
LBB0_2:
	str	x20, [x19]
	mov	x0, x19
	bl	_hns_mac_reset
	ldp	w8, w1, [x19, #12]
	cmp	w8, #0
	cset	w2, eq
	mov	x0, x19
	bl	_hns_mac_adjust_link
	ldr	w1, [x19, #8]
	mov	x0, x19
	mov	w2, #0
	mov	w3, #1
	bl	_hns_mac_port_config_bc_en
	mov	x21, x0
	cbz	w0, LBB0_6
; %bb.3:
	ldr	x8, [x20]
	ldr	x0, [x19]
	blr	x8
	str	xzr, [x19]
	b	LBB0_6
LBB0_4:
	mov	x0, x19
	bl	_hns_xgmac_config
	mov	x20, x0
	cbnz	x0, LBB0_2
LBB0_5:
Lloh3:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_6:
	mov	x0, x21
	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
	.cfi_endproc
                                        ; -- End function
	.comm	_MAC_SPEED_10000,8,3            ; @MAC_SPEED_10000
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_hns_mac_init_ex
.subsections_via_symbols
