	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_memac_init                     ## -- Begin function memac_init
	.p2align	4, 0x90
_memac_init:                            ## @memac_init
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	8(%rdi), %rdi
	callq	_is_init_done
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_37
LBB0_3:
	movq	%r12, %rdi
	callq	_check_init_parameters
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_4
LBB0_37:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	8(%r12), %r14
	xorl	%r13d, %r13d
	cmpl	$6, 64(%r12)
	jne	LBB0_6
## %bb.5:
	xorl	%r13d, %r13d
	cmpl	$4, 68(%r12)
	sete	%r13b
LBB0_6:
	cmpq	$0, 16(%r14)
	je	LBB0_9
## %bb.7:
	movq	56(%r12), %rdi
	callq	_reset
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_37
LBB0_9:
	movl	80(%r12), %edi
	callq	_MAKE_ENET_ADDR_FROM_UINT64
	movq	56(%r12), %rdi
	xorl	%edx, %edx
	callq	_add_addr_in_paddr
	movq	8(%r14), %r15
	movq	56(%r12), %rdi
	movq	(%r12), %rdx
	movq	8(%r12), %rsi
	movl	76(%r12), %ecx
	movl	72(%r12), %r9d
	movl	%r13d, %r8d
	callq	_init
	cmpl	$6, 64(%r12)
	jne	LBB0_13
## %bb.10:
	movl	68(%r12), %eax
	cmpl	$3, %eax
	je	LBB0_12
## %bb.11:
	testl	%eax, %eax
	jne	LBB0_13
LBB0_12:
	movq	56(%r12), %rdi
	callq	_ioread32be
	movq	_CMD_CFG_CRC_FWD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	notl	%edi
	andl	%eax, %edi
	movq	56(%r12), %rsi
	callq	_iowrite32be
LBB0_13:
	movq	(%r12), %rax
	movq	_PHY_INTERFACE_MODE_SGMII@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_17
## %bb.14:
	cmpq	$0, 48(%r12)
	je	LBB0_16
## %bb.15:
	movq	%r12, %rdi
	callq	_setup_sgmii_internal_phy_base_x
	jmp	LBB0_31
LBB0_17:
	movq	_PHY_INTERFACE_MODE_QSGMII@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_31
## %bb.18:
	movq	40(%r12), %rax
	movl	(%rax), %r13d
	leal	(,%r13,4), %ebx
	movl	%ebx, (%rax)
	cmpq	$0, 48(%r12)
	je	LBB0_20
## %bb.19:
	movq	%r12, %rdi
	callq	_setup_sgmii_internal_phy_base_x
	jmp	LBB0_21
LBB0_16:
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_setup_sgmii_internal_phy
	jmp	LBB0_31
LBB0_20:
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_setup_sgmii_internal_phy
LBB0_21:
	movq	40(%r12), %rax
	movl	%ebx, %ecx
	orl	$1, %ecx
	movl	%ecx, (%rax)
	cmpq	$0, 48(%r12)
	je	LBB0_23
## %bb.22:
	movq	%r12, %rdi
	callq	_setup_sgmii_internal_phy_base_x
	jmp	LBB0_24
LBB0_23:
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_setup_sgmii_internal_phy
LBB0_24:
	movq	40(%r12), %rax
	movl	%ebx, %ecx
	orl	$2, %ecx
	movl	%ecx, (%rax)
	cmpq	$0, 48(%r12)
	je	LBB0_26
## %bb.25:
	movq	%r12, %rdi
	callq	_setup_sgmii_internal_phy_base_x
	jmp	LBB0_27
LBB0_26:
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_setup_sgmii_internal_phy
LBB0_27:
	movq	40(%r12), %rax
	orl	$3, %ebx
	movl	%ebx, (%rax)
	cmpq	$0, 48(%r12)
	je	LBB0_29
## %bb.28:
	movq	%r12, %rdi
	callq	_setup_sgmii_internal_phy_base_x
	jmp	LBB0_30
LBB0_29:
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_setup_sgmii_internal_phy
LBB0_30:
	movq	40(%r12), %rax
	movl	%r13d, (%rax)
LBB0_31:
	movl	16(%r12), %esi
	movl	20(%r12), %edi
	movl	(%r14), %edx
	callq	_fman_set_mac_max_frame
	testl	%eax, %eax
	je	LBB0_33
## %bb.32:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_37
LBB0_33:
	movq	_HASH_TABLE_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_alloc_hash_table
	movq	%rax, 32(%r12)
	testq	%rax, %rax
	je	LBB0_34
## %bb.35:
	movl	(%rbx), %edi
	callq	_alloc_hash_table
	movq	%rax, 24(%r12)
	testq	%rax, %rax
	je	LBB0_34
## %bb.36:
	movl	16(%r12), %edx
	movl	20(%r12), %edi
	movq	_FMAN_MOD_MAC@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	_FMAN_INTR_TYPE_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_memac_err_exception@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %r9
	callq	_fman_register_intr
	movl	16(%r12), %edx
	movl	20(%r12), %edi
	movl	(%rbx), %esi
	movq	_FMAN_INTR_TYPE_NORMAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_memac_exception@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %r9
	callq	_fman_register_intr
	movq	%r14, %rdi
	callq	_kfree
	movq	$0, 8(%r12)
	xorl	%ebx, %ebx
	jmp	LBB0_37
LBB0_34:
	movq	%r12, %rdi
	callq	_free_init_resources
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mEMAC reset failed\n"

	.comm	_CMD_CFG_CRC_FWD,4,2            ## @CMD_CFG_CRC_FWD
	.comm	_PHY_INTERFACE_MODE_SGMII,8,3   ## @PHY_INTERFACE_MODE_SGMII
	.comm	_PHY_INTERFACE_MODE_QSGMII,8,3  ## @PHY_INTERFACE_MODE_QSGMII
L_.str.1:                               ## @.str.1
	.asciz	"settings Mac max frame length is FAILED\n"

	.comm	_HASH_TABLE_SIZE,4,2            ## @HASH_TABLE_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"allocation hash table is FAILED\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_FMAN_MOD_MAC,4,2               ## @FMAN_MOD_MAC
	.comm	_FMAN_INTR_TYPE_ERR,4,2         ## @FMAN_INTR_TYPE_ERR
	.comm	_memac_err_exception,4,2        ## @memac_err_exception
	.comm	_FMAN_INTR_TYPE_NORMAL,4,2      ## @FMAN_INTR_TYPE_NORMAL
	.comm	_memac_exception,4,2            ## @memac_exception
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_memac_init                     ; -- Begin function memac_init
	.p2align	2
_memac_init:                            ; @memac_init
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	ldr	x0, [x0, #8]
	bl	_is_init_done
	cbz	x0, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_4
LBB0_3:
	mov	x0, x19
	bl	_check_init_parameters
	mov	x21, x0
	cbz	w0, LBB0_5
LBB0_4:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_5:
	ldr	x20, [x19, #8]
	ldr	w8, [x19, #64]
	cmp	w8, #6
	b.ne	LBB0_7
; %bb.6:
	ldr	w8, [x19, #68]
	cmp	w8, #4
	cset	w22, eq
	ldr	x8, [x20, #16]
	cbnz	x8, LBB0_8
	b	LBB0_10
LBB0_7:
	mov	w22, #0
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_10
LBB0_8:
	ldr	x0, [x19, #56]
	bl	_reset
	cbz	w0, LBB0_10
; %bb.9:
	mov	x21, x0
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	b	LBB0_4
LBB0_10:
	ldr	w0, [x19, #80]
	bl	_MAKE_ENET_ADDR_FROM_UINT64
	ldr	x0, [x19, #56]
	mov	w2, #0
	bl	_add_addr_in_paddr
	ldr	x21, [x20, #8]
	ldr	x0, [x19, #56]
	ldp	x2, x1, [x19]
	ldp	w5, w3, [x19, #72]
	mov	x4, x22
	bl	_init
	ldr	w8, [x19, #64]
	cmp	w8, #6
	b.ne	LBB0_14
; %bb.11:
	ldr	w8, [x19, #68]
	cmp	w8, #3
	b.eq	LBB0_13
; %bb.12:
	cbnz	w8, LBB0_14
LBB0_13:
	ldr	x0, [x19, #56]
	bl	_ioread32be
Lloh4:
	adrp	x8, _CMD_CFG_CRC_FWD@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CMD_CFG_CRC_FWD@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	bic	w0, w0, w8
	ldr	x1, [x19, #56]
	bl	_iowrite32be
LBB0_14:
	ldr	x8, [x19]
Lloh7:
	adrp	x9, _PHY_INTERFACE_MODE_SGMII@GOTPAGE
Lloh8:
	ldr	x9, [x9, _PHY_INTERFACE_MODE_SGMII@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_17
; %bb.15:
	ldr	x8, [x19, #48]
	cbz	x8, LBB0_20
; %bb.16:
	mov	x0, x19
	bl	_setup_sgmii_internal_phy_base_x
	b	LBB0_32
LBB0_17:
Lloh10:
	adrp	x9, _PHY_INTERFACE_MODE_QSGMII@GOTPAGE
Lloh11:
	ldr	x9, [x9, _PHY_INTERFACE_MODE_QSGMII@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_32
; %bb.18:
	ldp	x8, x9, [x19, #40]
	ldr	w22, [x8]
	lsl	w23, w22, #2
	str	w23, [x8]
	mov	x0, x19
	cbz	x9, LBB0_21
; %bb.19:
	bl	_setup_sgmii_internal_phy_base_x
	b	LBB0_22
LBB0_20:
	mov	x0, x19
	mov	x1, x21
	bl	_setup_sgmii_internal_phy
	b	LBB0_32
LBB0_21:
	mov	x1, x21
	bl	_setup_sgmii_internal_phy
LBB0_22:
	orr	w8, w23, #0x1
	ldp	x9, x10, [x19, #40]
	str	w8, [x9]
	mov	x0, x19
	cbz	x10, LBB0_24
; %bb.23:
	bl	_setup_sgmii_internal_phy_base_x
	b	LBB0_25
LBB0_24:
	mov	x1, x21
	bl	_setup_sgmii_internal_phy
LBB0_25:
	orr	w8, w23, #0x2
	ldp	x9, x10, [x19, #40]
	str	w8, [x9]
	mov	x0, x19
	cbz	x10, LBB0_27
; %bb.26:
	bl	_setup_sgmii_internal_phy_base_x
	b	LBB0_28
LBB0_27:
	mov	x1, x21
	bl	_setup_sgmii_internal_phy
LBB0_28:
	orr	w8, w23, #0x3
	ldp	x9, x10, [x19, #40]
	str	w8, [x9]
	mov	x0, x19
	cbz	x10, LBB0_30
; %bb.29:
	bl	_setup_sgmii_internal_phy_base_x
	b	LBB0_31
LBB0_30:
	mov	x1, x21
	bl	_setup_sgmii_internal_phy
LBB0_31:
	ldr	x8, [x19, #40]
	str	w22, [x8]
LBB0_32:
	ldp	w1, w0, [x19, #16]
	ldr	w2, [x20]
	bl	_fman_set_mac_max_frame
	cbz	w0, LBB0_34
; %bb.33:
	mov	x21, x0
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
	b	LBB0_4
LBB0_34:
Lloh15:
	adrp	x21, _HASH_TABLE_SIZE@GOTPAGE
Lloh16:
	ldr	x21, [x21, _HASH_TABLE_SIZE@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_alloc_hash_table
	str	x0, [x19, #32]
	cbz	x0, LBB0_37
; %bb.35:
	ldr	w0, [x21]
	bl	_alloc_hash_table
	str	x0, [x19, #24]
	cbz	x0, LBB0_37
; %bb.36:
Lloh17:
	adrp	x21, _FMAN_MOD_MAC@GOTPAGE
Lloh18:
	ldr	x21, [x21, _FMAN_MOD_MAC@GOTPAGEOFF]
	ldr	w1, [x21]
	ldp	w2, w0, [x19, #16]
Lloh19:
	adrp	x8, _FMAN_INTR_TYPE_ERR@GOTPAGE
Lloh20:
	ldr	x8, [x8, _FMAN_INTR_TYPE_ERR@GOTPAGEOFF]
Lloh21:
	ldr	w3, [x8]
Lloh22:
	adrp	x8, _memac_err_exception@GOTPAGE
Lloh23:
	ldr	x8, [x8, _memac_err_exception@GOTPAGEOFF]
Lloh24:
	ldr	w4, [x8]
	mov	x5, x19
	bl	_fman_register_intr
	ldr	w1, [x21]
	ldp	w2, w0, [x19, #16]
Lloh25:
	adrp	x8, _FMAN_INTR_TYPE_NORMAL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _FMAN_INTR_TYPE_NORMAL@GOTPAGEOFF]
Lloh27:
	ldr	w3, [x8]
Lloh28:
	adrp	x8, _memac_exception@GOTPAGE
Lloh29:
	ldr	x8, [x8, _memac_exception@GOTPAGEOFF]
Lloh30:
	ldr	w4, [x8]
	mov	x5, x19
	bl	_fman_register_intr
	mov	x0, x20
	bl	_kfree
	mov	w21, #0
	str	xzr, [x19, #8]
	b	LBB0_4
LBB0_37:
	mov	x0, x19
	bl	_free_init_resources
Lloh31:
	adrp	x0, l_.str.2@PAGE
Lloh32:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_err
Lloh33:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mEMAC reset failed\n"

	.comm	_CMD_CFG_CRC_FWD,4,2            ; @CMD_CFG_CRC_FWD
	.comm	_PHY_INTERFACE_MODE_SGMII,8,3   ; @PHY_INTERFACE_MODE_SGMII
	.comm	_PHY_INTERFACE_MODE_QSGMII,8,3  ; @PHY_INTERFACE_MODE_QSGMII
l_.str.1:                               ; @.str.1
	.asciz	"settings Mac max frame length is FAILED\n"

	.comm	_HASH_TABLE_SIZE,4,2            ; @HASH_TABLE_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"allocation hash table is FAILED\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_FMAN_MOD_MAC,4,2               ; @FMAN_MOD_MAC
	.comm	_FMAN_INTR_TYPE_ERR,4,2         ; @FMAN_INTR_TYPE_ERR
	.comm	_memac_err_exception,4,2        ; @memac_err_exception
	.comm	_FMAN_INTR_TYPE_NORMAL,4,2      ; @FMAN_INTR_TYPE_NORMAL
	.comm	_memac_exception,4,2            ; @memac_exception
.subsections_via_symbols
