	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sata_pmp_handle_link_fail
_sata_pmp_handle_link_fail:             ## @sata_pmp_handle_link_fail
	.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
	movq	%rdi, %rbx
	movq	(%rdi), %rcx
	movq	32(%rdi), %r14
	movl	(%rsi,%rcx,4), %edx
	testl	%edx, %edx
	je	LBB0_2
## %bb.1:
	movl	$1, %eax
	decl	%edx
	movl	%edx, (%rsi,%rcx,4)
	jne	LBB0_5
LBB0_2:
	movq	_ATA_LFLAG_DISABLED@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	testl	%eax, 8(%rbx)
	jne	LBB0_4
## %bb.3:
	movq	_KERN_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ATA_EH_PMP_LINK_TRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %rdx
	movq	%rbx, %rdi
	callq	_ata_link_printk
	movl	(%r14), %edi
	callq	_spin_lock_irqsave
	movl	(%r15), %eax
	orl	%eax, 8(%rbx)
	movl	(%r14), %edi
	callq	_spin_unlock_irqrestore
LBB0_4:
	movl	24(%rbx), %edi
	callq	_ata_dev_disable
	movq	$0, 16(%rbx)
	xorl	%eax, %eax
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_LFLAG_DISABLED,4,2         ## @ATA_LFLAG_DISABLED
	.comm	_KERN_WARNING,4,2               ## @KERN_WARNING
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to recover link after %d tries, disabling\n"

	.comm	_ATA_EH_PMP_LINK_TRIES,4,2      ## @ATA_EH_PMP_LINK_TRIES
	.no_dead_strip	_sata_pmp_handle_link_fail
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sata_pmp_handle_link_fail
_sata_pmp_handle_link_fail:             ; @sata_pmp_handle_link_fail
	.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
	mov	x19, x0
	ldr	x20, [x0, #32]
	ldr	x8, [x0]
	ldr	w9, [x1, x8, lsl #2]
	cbz	w9, LBB0_3
; %bb.1:
	subs	w9, w9, #1
	str	w9, [x1, x8, lsl #2]
	b.eq	LBB0_3
; %bb.2:
	mov	w0, #1
	b	LBB0_6
LBB0_3:
	ldr	w8, [x19, #8]
Lloh0:
	adrp	x21, _ATA_LFLAG_DISABLED@GOTPAGE
Lloh1:
	ldr	x21, [x21, _ATA_LFLAG_DISABLED@GOTPAGEOFF]
	ldr	w9, [x21]
	tst	w9, w8
	b.ne	LBB0_5
; %bb.4:
Lloh2:
	adrp	x8, _KERN_WARNING@GOTPAGE
Lloh3:
	ldr	x8, [x8, _KERN_WARNING@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
Lloh5:
	adrp	x8, _ATA_EH_PMP_LINK_TRIES@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ATA_EH_PMP_LINK_TRIES@GOTPAGEOFF]
Lloh7:
	ldr	w3, [x8]
Lloh8:
	adrp	x2, l_.str@PAGE
Lloh9:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_ata_link_printk
	ldr	w0, [x20]
	bl	_spin_lock_irqsave
	ldr	w8, [x21]
	ldr	w9, [x19, #8]
	orr	w8, w9, w8
	str	w8, [x19, #8]
	ldr	w0, [x20]
	bl	_spin_unlock_irqrestore
LBB0_5:
	ldr	w0, [x19, #24]
	bl	_ata_dev_disable
	mov	w0, #0
	str	xzr, [x19, #16]
LBB0_6:
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_LFLAG_DISABLED,4,2         ; @ATA_LFLAG_DISABLED
	.comm	_KERN_WARNING,4,2               ; @KERN_WARNING
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to recover link after %d tries, disabling\n"

	.comm	_ATA_EH_PMP_LINK_TRIES,4,2      ; @ATA_EH_PMP_LINK_TRIES
	.no_dead_strip	_sata_pmp_handle_link_fail
.subsections_via_symbols
