	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apply_bad_link_workaround
_apply_bad_link_workaround:             ## @apply_bad_link_workaround
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	callq	_to_dw_pcie_from_pp
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_to_tegra_pcie
	movq	%rax, %r14
	movq	_PCI_EXP_LNKSTA@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	movq	%rbx, %rdi
	callq	_dw_pcie_readw_dbi
	movq	_PCI_EXP_LNKSTA_LBMS@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_2
## %bb.1:
	movq	_PCI_EXP_LNKSTA_NLW@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movq	_PCI_EXP_LNKSTA_NLW_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	cmpl	%eax, (%r14)
	jle	LBB0_2
## %bb.3:
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	movq	_PCI_EXP_LNKCTL2@GOTPCREL(%rip), %r15
	movq	(%r15), %rsi
	addq	8(%r14), %rsi
	movq	%rbx, %rdi
	callq	_dw_pcie_readw_dbi
	movq	_PCI_EXP_LNKCTL2_TLS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	notl	%edx
	andl	%eax, %edx
	movq	_PCI_EXP_LNKCTL2_TLS_2_5GT@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	(%r15), %rsi
	addq	8(%r14), %rsi
	movq	%rbx, %rdi
	callq	_dw_pcie_writew_dbi
	movq	_PCI_EXP_LNKCTL@GOTPCREL(%rip), %r15
	movq	(%r15), %rsi
	addq	8(%r14), %rsi
	movq	%rbx, %rdi
	callq	_dw_pcie_readw_dbi
	movq	_PCI_EXP_LNKCTL_RL@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	(%r15), %rsi
	addq	8(%r14), %rsi
	movq	%rbx, %rdi
	movl	%eax, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dw_pcie_writew_dbi             ## TAILCALL
LBB0_2:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PCI_EXP_LNKSTA,8,3             ## @PCI_EXP_LNKSTA
	.comm	_PCI_EXP_LNKSTA_LBMS,4,2        ## @PCI_EXP_LNKSTA_LBMS
	.comm	_PCI_EXP_LNKSTA_NLW,4,2         ## @PCI_EXP_LNKSTA_NLW
	.comm	_PCI_EXP_LNKSTA_NLW_SHIFT,4,2   ## @PCI_EXP_LNKSTA_NLW_SHIFT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"PCIe link is bad, width reduced\n"

	.comm	_PCI_EXP_LNKCTL2,8,3            ## @PCI_EXP_LNKCTL2
	.comm	_PCI_EXP_LNKCTL2_TLS,4,2        ## @PCI_EXP_LNKCTL2_TLS
	.comm	_PCI_EXP_LNKCTL2_TLS_2_5GT,4,2  ## @PCI_EXP_LNKCTL2_TLS_2_5GT
	.comm	_PCI_EXP_LNKCTL,8,3             ## @PCI_EXP_LNKCTL
	.comm	_PCI_EXP_LNKCTL_RL,4,2          ## @PCI_EXP_LNKCTL_RL
	.no_dead_strip	_apply_bad_link_workaround
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apply_bad_link_workaround
_apply_bad_link_workaround:             ; @apply_bad_link_workaround
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	bl	_to_dw_pcie_from_pp
	mov	x19, x0
	bl	_to_tegra_pcie
	mov	x20, x0
	ldr	x8, [x0, #8]
Lloh0:
	adrp	x9, _PCI_EXP_LNKSTA@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PCI_EXP_LNKSTA@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x19
	bl	_dw_pcie_readw_dbi
Lloh3:
	adrp	x8, _PCI_EXP_LNKSTA_LBMS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PCI_EXP_LNKSTA_LBMS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_3
; %bb.1:
Lloh6:
	adrp	x8, _PCI_EXP_LNKSTA_NLW@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PCI_EXP_LNKSTA_NLW@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh9:
	adrp	x9, _PCI_EXP_LNKSTA_NLW_SHIFT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PCI_EXP_LNKSTA_NLW_SHIFT@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	asr	w8, w8, w9
	ldr	w9, [x20]
	cmp	w9, w8
	b.le	LBB0_3
; %bb.2:
	ldr	w0, [x19]
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
	ldr	x8, [x20, #8]
Lloh14:
	adrp	x21, _PCI_EXP_LNKCTL2@GOTPAGE
Lloh15:
	ldr	x21, [x21, _PCI_EXP_LNKCTL2@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x1, x9, x8
	mov	x0, x19
	bl	_dw_pcie_readw_dbi
Lloh16:
	adrp	x8, _PCI_EXP_LNKCTL2_TLS@GOTPAGE
Lloh17:
	ldr	x8, [x8, _PCI_EXP_LNKCTL2_TLS@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
Lloh19:
	adrp	x9, _PCI_EXP_LNKCTL2_TLS_2_5GT@GOTPAGE
Lloh20:
	ldr	x9, [x9, _PCI_EXP_LNKCTL2_TLS_2_5GT@GOTPAGEOFF]
	bic	w8, w0, w8
Lloh21:
	ldr	w9, [x9]
	orr	w2, w8, w9
	ldr	x8, [x20, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	mov	x0, x19
	bl	_dw_pcie_writew_dbi
	ldr	x8, [x20, #8]
Lloh22:
	adrp	x21, _PCI_EXP_LNKCTL@GOTPAGE
Lloh23:
	ldr	x21, [x21, _PCI_EXP_LNKCTL@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x1, x9, x8
	mov	x0, x19
	bl	_dw_pcie_readw_dbi
Lloh24:
	adrp	x8, _PCI_EXP_LNKCTL_RL@GOTPAGE
Lloh25:
	ldr	x8, [x8, _PCI_EXP_LNKCTL_RL@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	orr	w2, w8, w0
	ldr	x8, [x20, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_dw_pcie_writew_dbi
LBB0_3:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_PCI_EXP_LNKSTA,8,3             ; @PCI_EXP_LNKSTA
	.comm	_PCI_EXP_LNKSTA_LBMS,4,2        ; @PCI_EXP_LNKSTA_LBMS
	.comm	_PCI_EXP_LNKSTA_NLW,4,2         ; @PCI_EXP_LNKSTA_NLW
	.comm	_PCI_EXP_LNKSTA_NLW_SHIFT,4,2   ; @PCI_EXP_LNKSTA_NLW_SHIFT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"PCIe link is bad, width reduced\n"

	.comm	_PCI_EXP_LNKCTL2,8,3            ; @PCI_EXP_LNKCTL2
	.comm	_PCI_EXP_LNKCTL2_TLS,4,2        ; @PCI_EXP_LNKCTL2_TLS
	.comm	_PCI_EXP_LNKCTL2_TLS_2_5GT,4,2  ; @PCI_EXP_LNKCTL2_TLS_2_5GT
	.comm	_PCI_EXP_LNKCTL,8,3             ; @PCI_EXP_LNKCTL
	.comm	_PCI_EXP_LNKCTL_RL,4,2          ; @PCI_EXP_LNKCTL_RL
	.no_dead_strip	_apply_bad_link_workaround
.subsections_via_symbols
