	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ata_dev_config_ncq
_ata_dev_config_ncq:                    ## @ata_dev_config_ncq
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	16(%rdi), %rax
	movq	(%rax), %r13
	movl	4(%rdi), %edi
	callq	_ata_id_queue_depth
	movl	%eax, %r15d
	movl	4(%rbx), %edi
	callq	_ata_id_has_ncq
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movl	(%rbx), %eax
	movq	_ATA_HORKAGE_NONCQ@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rdx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_snprintf
	jmp	LBB0_18
LBB0_1:
	movb	$0, (%r12)
	xorl	%ebx, %ebx
	jmp	LBB0_18
LBB0_4:
	movq	_ATA_FLAG_NCQ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%r13)
	je	LBB0_5
## %bb.6:
	movq	8(%r13), %rax
	movl	(%rax), %edi
	movq	_ATA_MAX_QUEUE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	decq	%rsi
	callq	_min
	movl	%eax, %ecx
	movq	_ATA_DFLAG_NCQ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%rbx)
	movl	(%rbx), %eax
	jmp	LBB0_7
LBB0_5:
	xorl	%ecx, %ecx
LBB0_7:
	movq	_ATA_HORKAGE_BROKEN_FPDMA_AA@GOTPCREL(%rip), %rdx
	leaq	L_.str(%rip), %r9
	testl	%eax, (%rdx)
	je	LBB0_8
LBB0_13:
	cmpl	%r15d, %ecx
	jge	LBB0_14
## %bb.17:
	leaq	L_.str.5(%rip), %rdx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%r14, %rsi
	movl	%r15d, %r8d
	xorl	%eax, %eax
	callq	_snprintf
	jmp	LBB0_18
LBB0_14:
	leaq	L_.str.4(%rip), %rdx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%r14, %rsi
	movl	%r15d, %ecx
	movq	%r9, %r8
	xorl	%eax, %eax
	callq	_snprintf
LBB0_18:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	_ATA_FLAG_FPDMA_AA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r13)
	je	LBB0_13
## %bb.9:
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	4(%rbx), %edi
	callq	_ata_id_has_fpdma_aa
	testq	%rax, %rax
	je	LBB0_10
## %bb.11:
	movq	_SETFEATURES_SATA_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_SATA_FPDMA_AA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_ata_dev_set_feature
	testl	%eax, %eax
	je	LBB0_12
## %bb.15:
	movq	_KERN_ERR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	leaq	L_.str.2(%rip), %rdx
	movq	%rbx, %rdi
	movl	%eax, %r13d
	movl	%eax, %ecx
	callq	_ata_dev_printk
	movq	_AC_ERR_DEV@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	leaq	L_.str(%rip), %r9
	je	LBB0_13
## %bb.16:
	movq	_ATA_HORKAGE_BROKEN_FPDMA_AA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%rbx)
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_18
LBB0_10:
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	leaq	L_.str(%rip), %r9
	jmp	LBB0_13
LBB0_12:
	leaq	L_.str.3(%rip), %r9
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.space	1

	.comm	_ATA_HORKAGE_NONCQ,4,2          ## @ATA_HORKAGE_NONCQ
L_.str.1:                               ## @.str.1
	.asciz	"NCQ (not used)"

	.comm	_ATA_FLAG_NCQ,4,2               ## @ATA_FLAG_NCQ
	.comm	_ATA_MAX_QUEUE,8,3              ## @ATA_MAX_QUEUE
	.comm	_ATA_DFLAG_NCQ,4,2              ## @ATA_DFLAG_NCQ
	.comm	_ATA_HORKAGE_BROKEN_FPDMA_AA,4,2 ## @ATA_HORKAGE_BROKEN_FPDMA_AA
	.comm	_ATA_FLAG_FPDMA_AA,4,2          ## @ATA_FLAG_FPDMA_AA
	.comm	_SETFEATURES_SATA_ENABLE,4,2    ## @SETFEATURES_SATA_ENABLE
	.comm	_SATA_FPDMA_AA,4,2              ## @SATA_FPDMA_AA
	.comm	_KERN_ERR,4,2                   ## @KERN_ERR
L_.str.2:                               ## @.str.2
	.asciz	"failed to enable AA(error_mask=0x%x)\n"

	.comm	_AC_ERR_DEV,4,2                 ## @AC_ERR_DEV
	.comm	_EIO,4,2                        ## @EIO
L_.str.3:                               ## @.str.3
	.asciz	", AA"

L_.str.4:                               ## @.str.4
	.asciz	"NCQ (depth %d)%s"

L_.str.5:                               ## @.str.5
	.asciz	"NCQ (depth %d/%d)%s"

	.no_dead_strip	_ata_dev_config_ncq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ata_dev_config_ncq
_ata_dev_config_ncq:                    ; @ata_dev_config_ncq
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x19, x2
	mov	x20, x1
	mov	x22, x0
	ldr	x8, [x0, #16]
	ldr	x24, [x8]
	ldr	w0, [x0, #4]
	bl	_ata_id_queue_depth
	mov	x21, x0
	ldr	w0, [x22, #4]
	bl	_ata_id_has_ncq
	cbz	w0, LBB0_3
; %bb.1:
	ldr	w8, [x22]
Lloh0:
	adrp	x9, _ATA_HORKAGE_NONCQ@GOTPAGE
Lloh1:
	ldr	x9, [x9, _ATA_HORKAGE_NONCQ@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.2:
Lloh3:
	adrp	x2, l_.str.1@PAGE
Lloh4:
	add	x2, x2, l_.str.1@PAGEOFF
	b	LBB0_17
LBB0_3:
	strb	wzr, [x20]
	b	LBB0_18
LBB0_4:
	ldr	w9, [x24]
Lloh5:
	adrp	x10, _ATA_FLAG_NCQ@GOTPAGE
Lloh6:
	ldr	x10, [x10, _ATA_FLAG_NCQ@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_6
; %bb.5:
	ldr	x8, [x24, #8]
	ldr	w0, [x8]
Lloh8:
	adrp	x8, _ATA_MAX_QUEUE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ATA_MAX_QUEUE@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	sub	x1, x8, #1
	bl	_min
	mov	x23, x0
Lloh11:
	adrp	x8, _ATA_DFLAG_NCQ@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ATA_DFLAG_NCQ@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	ldr	w9, [x22, #8]
	orr	w8, w9, w8
	str	w8, [x22, #8]
	ldr	w8, [x22]
	b	LBB0_7
LBB0_6:
	mov	w23, #0
LBB0_7:
Lloh14:
	adrp	x25, _ATA_HORKAGE_BROKEN_FPDMA_AA@GOTPAGE
Lloh15:
	ldr	x25, [x25, _ATA_HORKAGE_BROKEN_FPDMA_AA@GOTPAGEOFF]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_10
LBB0_8:
Lloh16:
	adrp	x8, l_.str@PAGE
Lloh17:
	add	x8, x8, l_.str@PAGEOFF
	cmp	w23, w21
	b.ge	LBB0_16
LBB0_9:
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	stp	x21, x8, [sp, #8]
	str	x23, [sp]
Lloh18:
	adrp	x2, l_.str.5@PAGE
Lloh19:
	add	x2, x2, l_.str.5@PAGEOFF
	b	LBB0_17
LBB0_10:
	ldr	w8, [x24]
Lloh20:
	adrp	x9, _ATA_FLAG_FPDMA_AA@GOTPAGE
Lloh21:
	ldr	x9, [x9, _ATA_FLAG_FPDMA_AA@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.11:
	ldr	w0, [x22, #4]
	bl	_ata_id_has_fpdma_aa
	cbz	x0, LBB0_8
; %bb.12:
Lloh23:
	adrp	x8, _SETFEATURES_SATA_ENABLE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _SETFEATURES_SATA_ENABLE@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
Lloh26:
	adrp	x8, _SATA_FPDMA_AA@GOTPAGE
Lloh27:
	ldr	x8, [x8, _SATA_FPDMA_AA@GOTPAGEOFF]
Lloh28:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_ata_dev_set_feature
	cbz	w0, LBB0_15
; %bb.13:
	mov	x24, x0
Lloh29:
	adrp	x8, _KERN_ERR@GOTPAGE
Lloh30:
	ldr	x8, [x8, _KERN_ERR@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
Lloh32:
	adrp	x2, l_.str.2@PAGE
Lloh33:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x22
	mov	x3, x24
	bl	_ata_dev_printk
Lloh34:
	adrp	x8, _AC_ERR_DEV@GOTPAGE
Lloh35:
	ldr	x8, [x8, _AC_ERR_DEV@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	cmp	w24, w8
	b.eq	LBB0_8
; %bb.14:
	ldr	w8, [x25]
	ldr	w9, [x22]
	orr	w8, w9, w8
	str	w8, [x22]
Lloh37:
	adrp	x8, _EIO@GOTPAGE
Lloh38:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_18
LBB0_15:
Lloh40:
	adrp	x8, l_.str.3@PAGE
Lloh41:
	add	x8, x8, l_.str.3@PAGEOFF
	cmp	w23, w21
	b.lt	LBB0_9
LBB0_16:
	stp	x21, x8, [sp]
Lloh42:
	adrp	x2, l_.str.4@PAGE
Lloh43:
	add	x2, x2, l_.str.4@PAGEOFF
LBB0_17:
	mov	x0, x20
	mov	x1, x19
	bl	_snprintf
	mov	w0, #0
LBB0_18:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.space	1

	.comm	_ATA_HORKAGE_NONCQ,4,2          ; @ATA_HORKAGE_NONCQ
l_.str.1:                               ; @.str.1
	.asciz	"NCQ (not used)"

	.comm	_ATA_FLAG_NCQ,4,2               ; @ATA_FLAG_NCQ
	.comm	_ATA_MAX_QUEUE,8,3              ; @ATA_MAX_QUEUE
	.comm	_ATA_DFLAG_NCQ,4,2              ; @ATA_DFLAG_NCQ
	.comm	_ATA_HORKAGE_BROKEN_FPDMA_AA,4,2 ; @ATA_HORKAGE_BROKEN_FPDMA_AA
	.comm	_ATA_FLAG_FPDMA_AA,4,2          ; @ATA_FLAG_FPDMA_AA
	.comm	_SETFEATURES_SATA_ENABLE,4,2    ; @SETFEATURES_SATA_ENABLE
	.comm	_SATA_FPDMA_AA,4,2              ; @SATA_FPDMA_AA
	.comm	_KERN_ERR,4,2                   ; @KERN_ERR
l_.str.2:                               ; @.str.2
	.asciz	"failed to enable AA(error_mask=0x%x)\n"

	.comm	_AC_ERR_DEV,4,2                 ; @AC_ERR_DEV
	.comm	_EIO,4,2                        ; @EIO
l_.str.3:                               ; @.str.3
	.asciz	", AA"

l_.str.4:                               ; @.str.4
	.asciz	"NCQ (depth %d)%s"

l_.str.5:                               ; @.str.5
	.asciz	"NCQ (depth %d/%d)%s"

	.no_dead_strip	_ata_dev_config_ncq
.subsections_via_symbols
