	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function altera_pcie_retrain
_altera_pcie_retrain:                   ## @altera_pcie_retrain
	.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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	8(%rdi), %rax
	movq	(%rax), %rax
	callq	*(%rax)
	testl	%eax, %eax
	je	LBB0_4
## %bb.1:
	movl	(%rbx), %esi
	movq	_RP_DEVFN@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	movq	_PCI_EXP_LNKCAP@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-36(%rbp), %r8
	movq	%rbx, %rdi
	callq	_altera_read_cap_word
	movq	_PCI_EXP_LNKCAP_SLS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	-36(%rbp), %eax
	movq	_PCI_EXP_LNKCAP_SLS_2_5GB@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_4
## %bb.2:
	movl	(%rbx), %esi
	movl	(%r14), %edx
	movq	_PCI_EXP_LNKSTA@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-32(%rbp), %r8
	movq	%rbx, %rdi
	callq	_altera_read_cap_word
	movq	_PCI_EXP_LNKSTA_CLS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	-32(%rbp), %eax
	movq	_PCI_EXP_LNKSTA_CLS_2_5GB@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_4
## %bb.3:
	movl	(%rbx), %esi
	movl	(%r14), %edx
	movq	_PCI_EXP_LNKCTL@GOTPCREL(%rip), %r15
	movl	(%r15), %ecx
	leaq	-28(%rbp), %r8
	movq	%rbx, %rdi
	callq	_altera_read_cap_word
	movq	_PCI_EXP_LNKCTL_RL@GOTPCREL(%rip), %rax
	movl	-28(%rbp), %r8d
	orl	(%rax), %r8d
	movl	%r8d, -28(%rbp)
	movl	(%rbx), %esi
	movl	(%r14), %edx
	movl	(%r15), %ecx
	movq	%rbx, %rdi
	callq	_altera_write_cap_word
	movq	%rbx, %rdi
	callq	_altera_wait_link_retrain
LBB0_4:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RP_DEVFN,4,2                   ## @RP_DEVFN
	.comm	_PCI_EXP_LNKCAP,4,2             ## @PCI_EXP_LNKCAP
	.comm	_PCI_EXP_LNKCAP_SLS,4,2         ## @PCI_EXP_LNKCAP_SLS
	.comm	_PCI_EXP_LNKCAP_SLS_2_5GB,4,2   ## @PCI_EXP_LNKCAP_SLS_2_5GB
	.comm	_PCI_EXP_LNKSTA,4,2             ## @PCI_EXP_LNKSTA
	.comm	_PCI_EXP_LNKSTA_CLS,4,2         ## @PCI_EXP_LNKSTA_CLS
	.comm	_PCI_EXP_LNKSTA_CLS_2_5GB,4,2   ## @PCI_EXP_LNKSTA_CLS_2_5GB
	.comm	_PCI_EXP_LNKCTL,4,2             ## @PCI_EXP_LNKCTL
	.comm	_PCI_EXP_LNKCTL_RL,4,2          ## @PCI_EXP_LNKCTL_RL
	.no_dead_strip	_altera_pcie_retrain
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function altera_pcie_retrain
_altera_pcie_retrain:                   ; @altera_pcie_retrain
	.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
	ldr	x8, [x0, #8]
	ldr	x8, [x8]
	ldr	x8, [x8]
	blr	x8
	cbz	w0, LBB0_4
; %bb.1:
	ldr	w1, [x19]
Lloh0:
	adrp	x20, _RP_DEVFN@GOTPAGE
Lloh1:
	ldr	x20, [x20, _RP_DEVFN@GOTPAGEOFF]
	ldr	w2, [x20]
Lloh2:
	adrp	x8, _PCI_EXP_LNKCAP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PCI_EXP_LNKCAP@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
	add	x4, sp, #12
	mov	x0, x19
	bl	_altera_read_cap_word
	ldr	w8, [sp, #12]
Lloh5:
	adrp	x9, _PCI_EXP_LNKCAP_SLS@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PCI_EXP_LNKCAP_SLS@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	and	w8, w9, w8
Lloh8:
	adrp	x9, _PCI_EXP_LNKCAP_SLS_2_5GB@GOTPAGE
Lloh9:
	ldr	x9, [x9, _PCI_EXP_LNKCAP_SLS_2_5GB@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_4
; %bb.2:
	ldr	w1, [x19]
	ldr	w2, [x20]
Lloh11:
	adrp	x8, _PCI_EXP_LNKSTA@GOTPAGE
Lloh12:
	ldr	x8, [x8, _PCI_EXP_LNKSTA@GOTPAGEOFF]
Lloh13:
	ldr	w3, [x8]
	add	x4, sp, #8
	mov	x0, x19
	bl	_altera_read_cap_word
	ldr	w8, [sp, #8]
Lloh14:
	adrp	x9, _PCI_EXP_LNKSTA_CLS@GOTPAGE
Lloh15:
	ldr	x9, [x9, _PCI_EXP_LNKSTA_CLS@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	and	w8, w9, w8
Lloh17:
	adrp	x9, _PCI_EXP_LNKSTA_CLS_2_5GB@GOTPAGE
Lloh18:
	ldr	x9, [x9, _PCI_EXP_LNKSTA_CLS_2_5GB@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_4
; %bb.3:
	ldr	w1, [x19]
	ldr	w2, [x20]
Lloh20:
	adrp	x21, _PCI_EXP_LNKCTL@GOTPAGE
Lloh21:
	ldr	x21, [x21, _PCI_EXP_LNKCTL@GOTPAGEOFF]
	ldr	w3, [x21]
	add	x4, sp, #4
	mov	x0, x19
	bl	_altera_read_cap_word
Lloh22:
	adrp	x8, _PCI_EXP_LNKCTL_RL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _PCI_EXP_LNKCTL_RL@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	ldr	w9, [sp, #4]
	orr	w4, w9, w8
	str	w4, [sp, #4]
	ldr	w1, [x19]
	ldr	w2, [x20]
	ldr	w3, [x21]
	mov	x0, x19
	bl	_altera_write_cap_word
	mov	x0, x19
	bl	_altera_wait_link_retrain
LBB0_4:
	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	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_RP_DEVFN,4,2                   ; @RP_DEVFN
	.comm	_PCI_EXP_LNKCAP,4,2             ; @PCI_EXP_LNKCAP
	.comm	_PCI_EXP_LNKCAP_SLS,4,2         ; @PCI_EXP_LNKCAP_SLS
	.comm	_PCI_EXP_LNKCAP_SLS_2_5GB,4,2   ; @PCI_EXP_LNKCAP_SLS_2_5GB
	.comm	_PCI_EXP_LNKSTA,4,2             ; @PCI_EXP_LNKSTA
	.comm	_PCI_EXP_LNKSTA_CLS,4,2         ; @PCI_EXP_LNKSTA_CLS
	.comm	_PCI_EXP_LNKSTA_CLS_2_5GB,4,2   ; @PCI_EXP_LNKSTA_CLS_2_5GB
	.comm	_PCI_EXP_LNKCTL,4,2             ; @PCI_EXP_LNKCTL
	.comm	_PCI_EXP_LNKCTL_RL,4,2          ; @PCI_EXP_LNKCTL_RL
	.no_dead_strip	_altera_pcie_retrain
.subsections_via_symbols
