	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_temac_mdio_setup               ## -- Begin function temac_mdio_setup
	.p2align	4, 0x90
_temac_mdio_setup:                      ## @temac_mdio_setup
	.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	%rsi, %r14
	movq	%rdi, %r12
	leaq	L_.str(%rip), %rsi
	leaq	-44(%rbp), %rdx
	movq	%r14, %rdi
	callq	_of_get_property
	movl	$127, %ebx
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	cmpl	$4, -44(%rbp)
	jb	LBB0_3
## %bb.2:
	movslq	(%rax), %rax
	imulq	$1801439851, %rax, %rax         ## imm = 0x6B5FCA6B
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$53, %rax
	addl	%ecx, %eax
	cmpl	$3, %eax
	movl	$2, %ecx
	cmovgel	%eax, %ecx
	cmpl	$64, %ecx
	movl	$64, %ebx
	cmovll	%ecx, %ebx
	decl	%ebx
	orl	$64, %ebx
LBB0_3:
	movq	%r12, %rdi
	callq	_mutex_lock
	movq	_XTE_MC_OFFSET@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%r12, %rdi
	movl	%ebx, %edx
	callq	_temac_indirect_out32
	movq	%r12, %rdi
	callq	_mutex_unlock
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_mdiobus_alloc
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rax, %rbx
	xorl	%r15d, %r15d
	leaq	-56(%rbp), %rdx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_of_address_to_resource
	movl	32(%rbx), %edi
	movq	_MII_BUS_ID_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rcx
	leaq	L_.str.1(%rip), %rdx
	callq	_snprintf
	movq	%r12, 24(%rbx)
	leaq	L_.str.2(%rip), %rax
	movq	%rax, (%rbx)
	movq	_temac_mdio_read@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	movq	_temac_mdio_write@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rbx)
	movl	4(%r12), %eax
	movl	%eax, 12(%rbx)
	movl	16(%r12), %eax
	movl	%eax, 8(%rbx)
	movq	%rbx, 8(%r12)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_of_mdiobus_register
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_mdiobus_free
	movl	%r14d, %r15d
	jmp	LBB0_8
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_8
LBB0_6:
	movq	%r12, %rdi
	callq	_mutex_lock
	movl	4(%r12), %ebx
	movl	(%r13), %esi
	movq	%r12, %rdi
	callq	_temac_indirect_in32
	leaq	L_.str.3(%rip), %rsi
	movl	%ebx, %edi
	movl	%eax, %edx
	callq	_dev_dbg
	movq	%r12, %rdi
	callq	_mutex_unlock
LBB0_8:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"clock-frequency"

	.comm	_XTE_MC_OFFSET,4,2              ## @XTE_MC_OFFSET
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MII_BUS_ID_SIZE,4,2            ## @MII_BUS_ID_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"%.8llx"

L_.str.2:                               ## @.str.2
	.asciz	"Xilinx TEMAC MDIO"

	.comm	_temac_mdio_read,4,2            ## @temac_mdio_read
	.comm	_temac_mdio_write,4,2           ## @temac_mdio_write
L_.str.3:                               ## @.str.3
	.asciz	"MDIO bus registered;  MC:%x\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_temac_mdio_setup               ; -- Begin function temac_mdio_setup
	.p2align	2
_temac_mdio_setup:                      ; @temac_mdio_setup
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	add	x2, sp, #12
	mov	x0, x20
	bl	_of_get_property
	ldr	w8, [sp, #12]
	cmp	x0, #0
	ccmp	w8, #4, #0, ne
	b.hs	LBB0_2
; %bb.1:
	mov	w21, #127
	b	LBB0_3
LBB0_2:
	ldrsw	x8, [x0]
	mov	w9, #51819
	movk	w9, #27487, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #53
	add	w8, w8, w9
	mov	w9, #2
	cmp	w8, #2
	csel	w8, w8, w9, gt
	mov	w9, #64
	cmp	w8, #64
	csel	w8, w8, w9, lt
	sub	w8, w8, #1
	orr	w21, w8, #0x40
LBB0_3:
	mov	x0, x19
	bl	_mutex_lock
Lloh2:
	adrp	x22, _XTE_MC_OFFSET@GOTPAGE
Lloh3:
	ldr	x22, [x22, _XTE_MC_OFFSET@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	mov	x2, x21
	bl	_temac_indirect_out32
	mov	x0, x19
	bl	_mutex_unlock
	bl	_mdiobus_alloc
	cbz	x0, LBB0_6
; %bb.4:
	mov	x21, x0
	mov	x2, sp
	mov	x0, x20
	mov	w1, #0
	bl	_of_address_to_resource
	ldr	w0, [x21, #32]
Lloh4:
	adrp	x8, _MII_BUS_ID_SIZE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _MII_BUS_ID_SIZE@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	ldr	x3, [sp]
Lloh7:
	adrp	x2, l_.str.1@PAGE
Lloh8:
	add	x2, x2, l_.str.1@PAGEOFF
	bl	_snprintf
	str	x19, [x21, #24]
Lloh9:
	adrp	x8, l_.str.2@PAGE
Lloh10:
	add	x8, x8, l_.str.2@PAGEOFF
Lloh11:
	adrp	x9, _temac_mdio_read@GOTPAGE
Lloh12:
	ldr	x9, [x9, _temac_mdio_read@GOTPAGEOFF]
	str	x8, [x21]
Lloh13:
	ldr	w8, [x9]
Lloh14:
	adrp	x9, _temac_mdio_write@GOTPAGE
Lloh15:
	ldr	x9, [x9, _temac_mdio_write@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	stp	w9, w8, [x21, #16]
	ldr	w8, [x19, #4]
	ldr	w9, [x19, #16]
	stp	w9, w8, [x21, #8]
	str	x21, [x19, #8]
	mov	x0, x21
	mov	x1, x20
	bl	_of_mdiobus_register
	cbz	w0, LBB0_7
; %bb.5:
	mov	x20, x0
	mov	x0, x21
	bl	_mdiobus_free
	b	LBB0_8
LBB0_6:
Lloh17:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_8
LBB0_7:
	mov	x0, x19
	bl	_mutex_lock
	ldr	w20, [x19, #4]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_temac_indirect_in32
	mov	x2, x0
Lloh20:
	adrp	x1, l_.str.3@PAGE
Lloh21:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
	mov	x0, x19
	bl	_mutex_unlock
	mov	w20, #0
LBB0_8:
	mov	x0, x20
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"clock-frequency"

	.comm	_XTE_MC_OFFSET,4,2              ; @XTE_MC_OFFSET
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MII_BUS_ID_SIZE,4,2            ; @MII_BUS_ID_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"%.8llx"

l_.str.2:                               ; @.str.2
	.asciz	"Xilinx TEMAC MDIO"

	.comm	_temac_mdio_read,4,2            ; @temac_mdio_read
	.comm	_temac_mdio_write,4,2           ; @temac_mdio_write
l_.str.3:                               ; @.str.3
	.asciz	"MDIO bus registered;  MC:%x\n"

.subsections_via_symbols
