	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ag71xx_phy_connect             ## -- Begin function ag71xx_phy_connect
	.p2align	4, 0x90
_ag71xx_phy_connect:                    ## @ag71xx_phy_connect
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	callq	_ag71xx_get_pdata
	movq	16(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_7
## %bb.1:
	cmpq	$0, (%rdi)
	je	LBB0_7
## %bb.2:
	movq	%rax, %r14
	callq	_dev_to_mii_bus
	movq	%rax, (%rbx)
	testq	%rax, %rax
	je	LBB0_8
## %bb.3:
	cmpq	$0, 8(%rax)
	je	LBB0_5
## %bb.4:
	movq	%rax, %rdi
	callq	_mutex_lock
	movq	(%rbx), %rdi
	callq	*8(%rdi)
	movq	(%rbx), %rdi
	callq	_mutex_unlock
LBB0_5:
	cmpq	$0, 8(%r14)
	je	LBB0_6
## %bb.9:
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_ag71xx_ar7240_init             ## TAILCALL
LBB0_8:
	movq	8(%rbx), %rbx
	movq	16(%r14), %rdi
	callq	_dev_name
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	movl	%eax, %edx
	callq	_dev_err
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_6:
	cmpq	$0, (%r14)
	je	LBB0_7
## %bb.10:
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_ag71xx_phy_connect_multi       ## TAILCALL
LBB0_7:
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_ag71xx_phy_connect_fixed       ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to find MII bus on device '%s'\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ag71xx_phy_connect             ; -- Begin function ag71xx_phy_connect
	.p2align	2
_ag71xx_phy_connect:                    ; @ag71xx_phy_connect
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	bl	_ag71xx_get_pdata
	mov	x20, x0
	ldr	x0, [x0, #16]
	cbz	x0, LBB0_10
; %bb.1:
	ldr	x8, [x0]
	cbz	x8, LBB0_10
; %bb.2:
	bl	_dev_to_mii_bus
	str	x0, [x19]
	cbz	x0, LBB0_7
; %bb.3:
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_5
; %bb.4:
	bl	_mutex_lock
	ldr	x0, [x19]
	ldr	x8, [x0, #8]
	blr	x8
	ldr	x0, [x19]
	bl	_mutex_unlock
LBB0_5:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_8
; %bb.6:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_ag71xx_ar7240_init
LBB0_7:
	ldr	x19, [x19, #8]
	ldr	x0, [x20, #16]
	bl	_dev_name
	mov	x2, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh2:
	adrp	x8, _ENODEV@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_8:
	ldr	x8, [x20]
	cbz	x8, LBB0_10
; %bb.9:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_ag71xx_phy_connect_multi
LBB0_10:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_ag71xx_phy_connect_fixed
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to find MII bus on device '%s'\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
.subsections_via_symbols
