	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sata_link_resume               ## -- Begin function sata_link_resume
	.p2align	4, 0x90
_sata_link_resume:                      ## @sata_link_resume
	.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	%rdx, %r12
	movq	%rsi, %r14
	movq	%rdi, %r13
	movq	_ATA_LINK_RESUME_TRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_SCR_CONTROL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	leaq	-44(%rbp), %rdx
	callq	_sata_scr_read
	testl	%eax, %eax
	je	LBB0_1
LBB0_13:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %ecx
	leaq	-44(%rbp), %r12
	movq	_ATA_LINK_RESUME_TRIES@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	andl	$240, %ecx
	orl	$768, %ecx                      ## imm = 0x300
	movl	%ecx, -44(%rbp)
	movl	(%r15), %esi
	movq	%r13, %rdi
	movl	%ecx, %edx
	callq	_sata_scr_write
	testl	%eax, %eax
	jne	LBB0_13
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r13), %edi
	movl	$200, %esi
	callq	_ata_msleep
	movl	(%r15), %esi
	movq	%r13, %rdi
	movq	%r12, %rdx
	callq	_sata_scr_read
	testl	%eax, %eax
	jne	LBB0_13
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %ecx
	movl	%ecx, %eax
	andl	$3855, %eax                     ## imm = 0xF0F
	cmpl	$768, %eax                      ## imm = 0x300
	je	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	decl	%ebx
	jne	LBB0_2
## %bb.6:
	movq	_KERN_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r13, %rdi
	callq	_ata_link_printk
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_7:
	movl	(%r14), %ecx
	subl	%ebx, %ecx
	jle	LBB0_9
## %bb.8:
	movq	_KERN_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	movq	%r13, %rdi
	callq	_ata_link_printk
LBB0_9:
	movq	%r13, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	callq	_sata_link_debounce
	testl	%eax, %eax
	jne	LBB0_13
## %bb.10:
	movq	_SCR_ERROR@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	callq	_sata_scr_read
	movl	%eax, %ecx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.11:
	movl	(%rbx), %esi
	movl	-48(%rbp), %edx
	movq	%r13, %rdi
	callq	_sata_scr_write
	movl	%eax, %ecx
LBB0_12:
	movq	_EINVAL@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	movl	(%rdx), %edx
	addl	%ecx, %edx
	cmovnel	%ecx, %eax
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_LINK_RESUME_TRIES,4,2      ## @ATA_LINK_RESUME_TRIES
	.comm	_SCR_CONTROL,4,2                ## @SCR_CONTROL
	.comm	_KERN_ERR,4,2                   ## @KERN_ERR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to resume link (SControl %X)\n"

	.comm	_KERN_WARNING,4,2               ## @KERN_WARNING
L_.str.1:                               ## @.str.1
	.asciz	"link resume succeeded after %d retries\n"

	.comm	_SCR_ERROR,4,2                  ## @SCR_ERROR
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sata_link_resume               ; -- Begin function sata_link_resume
	.p2align	2
_sata_link_resume:                      ; @sata_link_resume
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x23, _ATA_LINK_RESUME_TRIES@GOTPAGE
Lloh1:
	ldr	x23, [x23, _ATA_LINK_RESUME_TRIES@GOTPAGEOFF]
	ldr	w22, [x23]
Lloh2:
	adrp	x24, _SCR_CONTROL@GOTPAGE
Lloh3:
	ldr	x24, [x24, _SCR_CONTROL@GOTPAGEOFF]
	ldr	w1, [x24]
	add	x2, sp, #12
	bl	_sata_scr_read
	cbz	w0, LBB0_2
LBB0_1:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_2:
	ldr	w3, [sp, #12]
	mov	w25, #3855
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	and	w8, w3, #0xf0
	orr	w2, w8, #0x300
	str	w2, [sp, #12]
	ldr	w1, [x24]
	mov	x0, x19
	bl	_sata_scr_write
	cbnz	w0, LBB0_1
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x19]
	mov	w1, #200
	bl	_ata_msleep
	ldr	w1, [x24]
	add	x2, sp, #12
	mov	x0, x19
	bl	_sata_scr_read
	cbnz	w0, LBB0_1
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w3, [sp, #12]
	and	w8, w3, w25
	cmp	w8, #768
	b.eq	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	subs	w22, w22, #1
	b.ne	LBB0_3
; %bb.7:
Lloh4:
	adrp	x8, _KERN_ERR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _KERN_ERR@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
Lloh7:
	adrp	x2, l_.str@PAGE
Lloh8:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_ata_link_printk
	mov	w0, #0
	b	LBB0_1
LBB0_8:
	ldr	w8, [x23]
	subs	w3, w8, w22
	b.le	LBB0_10
; %bb.9:
Lloh9:
	adrp	x8, _KERN_WARNING@GOTPAGE
Lloh10:
	ldr	x8, [x8, _KERN_WARNING@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
Lloh12:
	adrp	x2, l_.str.1@PAGE
Lloh13:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_ata_link_printk
LBB0_10:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	bl	_sata_link_debounce
	cbnz	w0, LBB0_1
; %bb.11:
Lloh14:
	adrp	x20, _SCR_ERROR@GOTPAGE
Lloh15:
	ldr	x20, [x20, _SCR_ERROR@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #8
	mov	x0, x19
	bl	_sata_scr_read
	cbnz	w0, LBB0_13
; %bb.12:
	ldr	w1, [x20]
	ldr	w2, [sp, #8]
	mov	x0, x19
	bl	_sata_scr_write
LBB0_13:
Lloh16:
	adrp	x8, _EINVAL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	cmn	w0, w8
	csel	w0, wzr, w0, eq
	b	LBB0_1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_LINK_RESUME_TRIES,4,2      ; @ATA_LINK_RESUME_TRIES
	.comm	_SCR_CONTROL,4,2                ; @SCR_CONTROL
	.comm	_KERN_ERR,4,2                   ; @KERN_ERR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to resume link (SControl %X)\n"

	.comm	_KERN_WARNING,4,2               ; @KERN_WARNING
l_.str.1:                               ; @.str.1
	.asciz	"link resume succeeded after %d retries\n"

	.comm	_SCR_ERROR,4,2                  ; @SCR_ERROR
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
