	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ata_dev_set_mode
_ata_dev_set_mode:                      ## @ata_dev_set_mode
	.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	%rdi, %r12
	movq	56(%rdi), %r14
	movq	8(%r14), %rax
	movq	_ATA_HORKAGE_NOSETXFER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	(%rdi), %ecx
	movq	_ATA_DFLAG_PIO@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, %edi
	notl	%edi
	movl	48(%r12), %esi
	andl	%esi, %edi
	movl	%edi, 48(%r12)
	movq	8(%r12), %rdi
	movq	_ATA_SHIFT_PIO@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rdi
	jne	LBB0_2
## %bb.1:
	orl	%edx, %esi
	movl	%esi, 48(%r12)
LBB0_2:
	testl	%ecx, %ecx
	je	LBB0_7
## %bb.3:
	movq	_ATA_FLAG_SATA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_6
## %bb.4:
	movq	16(%r12), %rdi
	callq	_ata_id_is_sata
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	xorl	%r15d, %r15d
	leaq	L_.str.1(%rip), %rcx
	jmp	LBB0_8
LBB0_6:
	movq	_KERN_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdx
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_ata_dev_printk
LBB0_7:
	movq	%r12, %rdi
	callq	_ata_dev_set_xfermode
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rcx
LBB0_8:
	movq	_AC_ERR_DEV@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	testl	%eax, %r15d
	je	LBB0_9
LBB0_22:
	movq	_KERN_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.6(%rip), %rdx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_ata_dev_printk
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_23
LBB0_9:
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	_ATA_EHI_POST_SETMODE@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	orl	%eax, (%r14)
	movq	_ATA_DEV_UNKNOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_ata_dev_revalidate
	movl	%eax, %ebx
	movl	(%r13), %eax
	notl	%eax
	andl	%eax, (%r14)
	testl	%ebx, %ebx
	jne	LBB0_23
## %bb.10:
	movq	8(%r12), %rax
	movq	_ATA_SHIFT_PIO@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movl	$0, %r13d
	jne	LBB0_15
## %bb.11:
	movq	16(%r12), %rdi
	callq	_ata_id_is_cfa
	xorl	%r13d, %r13d
	testq	%rax, %rax
	setne	%r13b
	movq	16(%r12), %rdi
	callq	_ata_id_major_version
	testq	%rax, %rax
	jne	LBB0_13
## %bb.12:
	movq	24(%r12), %rax
	movq	_XFER_PIO_2@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	$1, %eax
	cmovlel	%eax, %r13d
LBB0_13:
	movq	16(%r12), %rdi
	callq	_ata_id_has_iordy
	testl	%eax, %eax
	jne	LBB0_15
## %bb.14:
	movq	24(%r12), %rax
	movq	_XFER_PIO_2@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	$1, %eax
	cmovlel	%eax, %r13d
LBB0_15:
	movq	8(%r12), %rax
	movq	_ATA_SHIFT_MWDMA@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.16:
	movq	32(%r12), %rax
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.17:
	movq	16(%r12), %rax
	testb	$1, 253(%rax)
	movl	$1, %eax
	cmovnel	%eax, %r13d
LBB0_18:
	movq	16(%r12), %rdi
	movq	40(%r12), %rbx
	callq	_ata_id_xfermask
	movl	%eax, %edi
	callq	_ata_xfer_mask2mode
	movq	_AC_ERR_DEV@GOTPCREL(%rip), %rcx
	testl	%r15d, (%rcx)
	je	LBB0_21
## %bb.19:
	leaq	L_.str.3(%rip), %r14
	cmpq	%rax, %rbx
	je	LBB0_21
## %bb.20:
	testl	%r13d, %r13d
	je	LBB0_22
LBB0_21:
	movq	8(%r12), %rsi
	movl	40(%r12), %edx
	leaq	L_.str.4(%rip), %rdi
	callq	_DPRINTK
	movq	_KERN_INFO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	40(%r12), %rdi
	callq	_ata_xfer_mode2mask
	movl	%eax, %edi
	callq	_ata_mode_string
	leaq	L_.str.5(%rip), %rdx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movl	%r15d, %esi
	movl	%eax, %ecx
	movq	%r14, %r8
	xorl	%eax, %eax
	callq	_ata_dev_printk
LBB0_23:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_HORKAGE_NOSETXFER,4,2      ## @ATA_HORKAGE_NOSETXFER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.space	1

	.comm	_ATA_DFLAG_PIO,4,2              ## @ATA_DFLAG_PIO
	.comm	_ATA_SHIFT_PIO,8,3              ## @ATA_SHIFT_PIO
	.comm	_ATA_FLAG_SATA,4,2              ## @ATA_FLAG_SATA
L_.str.1:                               ## @.str.1
	.asciz	" (SET_XFERMODE skipped)"

	.comm	_KERN_WARNING,4,2               ## @KERN_WARNING
L_.str.2:                               ## @.str.2
	.asciz	"NOSETXFER but PATA detected - can't skip SETXFER, might malfunction\n"

	.comm	_AC_ERR_DEV,4,2                 ## @AC_ERR_DEV
	.comm	_ATA_EHI_POST_SETMODE,4,2       ## @ATA_EHI_POST_SETMODE
	.comm	_ATA_DEV_UNKNOWN,4,2            ## @ATA_DEV_UNKNOWN
	.comm	_XFER_PIO_2,8,3                 ## @XFER_PIO_2
	.comm	_ATA_SHIFT_MWDMA,8,3            ## @ATA_SHIFT_MWDMA
	.comm	_XFER_MW_DMA_0,8,3              ## @XFER_MW_DMA_0
L_.str.3:                               ## @.str.3
	.asciz	" (device error ignored)"

L_.str.4:                               ## @.str.4
	.asciz	"xfer_shift=%u, xfer_mode=0x%x\n"

	.comm	_KERN_INFO,4,2                  ## @KERN_INFO
L_.str.5:                               ## @.str.5
	.asciz	"configured for %s%s\n"

	.comm	_KERN_ERR,4,2                   ## @KERN_ERR
L_.str.6:                               ## @.str.6
	.asciz	"failed to set xfermode (err_mask=0x%x)\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_ata_dev_set_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ata_dev_set_mode
_ata_dev_set_mode:                      ; @ata_dev_set_mode
	.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	x19, x0
	ldr	x23, [x0, #56]
	ldr	x8, [x23, #8]
	ldr	w9, [x0]
Lloh0:
	adrp	x10, _ATA_HORKAGE_NOSETXFER@GOTPAGE
Lloh1:
	ldr	x10, [x10, _ATA_HORKAGE_NOSETXFER@GOTPAGEOFF]
Lloh2:
	ldr	w10, [x10]
	and	w9, w10, w9
Lloh3:
	adrp	x10, _ATA_DFLAG_PIO@GOTPAGE
Lloh4:
	ldr	x10, [x10, _ATA_DFLAG_PIO@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	ldr	w11, [x0, #48]
	bic	w12, w11, w10
	str	w12, [x0, #48]
	ldr	x12, [x0, #8]
Lloh6:
	adrp	x24, _ATA_SHIFT_PIO@GOTPAGE
Lloh7:
	ldr	x24, [x24, _ATA_SHIFT_PIO@GOTPAGEOFF]
	ldr	x13, [x24]
	cmp	x12, x13
	b.ne	LBB0_2
; %bb.1:
	orr	w10, w11, w10
	str	w10, [x19, #48]
LBB0_2:
	cbz	w9, LBB0_7
; %bb.3:
	ldr	w8, [x8]
Lloh8:
	adrp	x9, _ATA_FLAG_SATA@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ATA_FLAG_SATA@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.4:
	ldr	x0, [x19, #16]
	bl	_ata_id_is_sata
	cbz	x0, LBB0_6
; %bb.5:
	mov	w20, #0
Lloh11:
	adrp	x21, l_.str.1@PAGE
Lloh12:
	add	x21, x21, l_.str.1@PAGEOFF
	b	LBB0_8
LBB0_6:
Lloh13:
	adrp	x8, _KERN_WARNING@GOTPAGE
Lloh14:
	ldr	x8, [x8, _KERN_WARNING@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
Lloh16:
	adrp	x2, l_.str.2@PAGE
Lloh17:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_ata_dev_printk
LBB0_7:
	mov	x0, x19
	bl	_ata_dev_set_xfermode
	mov	x20, x0
Lloh18:
	adrp	x21, l_.str@PAGE
Lloh19:
	add	x21, x21, l_.str@PAGEOFF
LBB0_8:
Lloh20:
	adrp	x22, _AC_ERR_DEV@GOTPAGE
Lloh21:
	ldr	x22, [x22, _AC_ERR_DEV@GOTPAGEOFF]
	ldr	w8, [x22]
	bics	wzr, w20, w8
	b.eq	LBB0_10
LBB0_9:
Lloh22:
	adrp	x8, _KERN_ERR@GOTPAGE
Lloh23:
	ldr	x8, [x8, _KERN_ERR@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	str	x20, [sp]
Lloh25:
	adrp	x2, l_.str.6@PAGE
Lloh26:
	add	x2, x2, l_.str.6@PAGEOFF
	mov	x0, x19
	bl	_ata_dev_printk
Lloh27:
	adrp	x8, _EIO@GOTPAGE
Lloh28:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_24
LBB0_10:
Lloh30:
	adrp	x25, _ATA_EHI_POST_SETMODE@GOTPAGE
Lloh31:
	ldr	x25, [x25, _ATA_EHI_POST_SETMODE@GOTPAGEOFF]
	ldr	w8, [x25]
	ldr	w9, [x23]
	orr	w8, w9, w8
	str	w8, [x23]
Lloh32:
	adrp	x8, _ATA_DEV_UNKNOWN@GOTPAGE
Lloh33:
	ldr	x8, [x8, _ATA_DEV_UNKNOWN@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_ata_dev_revalidate
	ldr	w8, [x25]
	ldr	w9, [x23]
	bic	w8, w9, w8
	str	w8, [x23]
	cbnz	w0, LBB0_24
; %bb.11:
	ldr	x8, [x19, #8]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_16
; %bb.12:
	ldr	x0, [x19, #16]
	bl	_ata_id_is_cfa
	cmp	x0, #0
	cset	w23, ne
	ldr	x0, [x19, #16]
	bl	_ata_id_major_version
	cbnz	x0, LBB0_14
; %bb.13:
	ldr	x8, [x19, #24]
Lloh35:
	adrp	x9, _XFER_PIO_2@GOTPAGE
Lloh36:
	ldr	x9, [x9, _XFER_PIO_2@GOTPAGEOFF]
Lloh37:
	ldr	x9, [x9]
	cmp	x8, x9
	csinc	w23, w23, wzr, gt
LBB0_14:
	ldr	x0, [x19, #16]
	bl	_ata_id_has_iordy
	cbnz	w0, LBB0_17
; %bb.15:
	ldr	x8, [x19, #24]
Lloh38:
	adrp	x9, _XFER_PIO_2@GOTPAGE
Lloh39:
	ldr	x9, [x9, _XFER_PIO_2@GOTPAGEOFF]
Lloh40:
	ldr	x9, [x9]
	cmp	x8, x9
	csinc	w23, w23, wzr, gt
	b	LBB0_17
LBB0_16:
	mov	w23, #0
LBB0_17:
	ldr	x8, [x19, #8]
Lloh41:
	adrp	x9, _ATA_SHIFT_MWDMA@GOTPAGE
Lloh42:
	ldr	x9, [x9, _ATA_SHIFT_MWDMA@GOTPAGEOFF]
Lloh43:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_20
; %bb.18:
	ldr	x8, [x19, #32]
Lloh44:
	adrp	x9, _XFER_MW_DMA_0@GOTPAGE
Lloh45:
	ldr	x9, [x9, _XFER_MW_DMA_0@GOTPAGEOFF]
Lloh46:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_20
; %bb.19:
	ldr	x8, [x19, #16]
	ldrb	w8, [x8, #253]
	tst	w8, #0x1
	csinc	w23, w23, wzr, eq
LBB0_20:
	ldr	x24, [x19, #40]
	ldr	x0, [x19, #16]
	bl	_ata_id_xfermask
	bl	_ata_xfer_mask2mode
	ldr	w8, [x22]
	tst	w8, w20
	b.eq	LBB0_23
; %bb.21:
Lloh47:
	adrp	x21, l_.str.3@PAGE
Lloh48:
	add	x21, x21, l_.str.3@PAGEOFF
	cmp	x24, x0
	b.eq	LBB0_23
; %bb.22:
	cbz	w23, LBB0_9
LBB0_23:
	ldr	x1, [x19, #8]
	ldr	w2, [x19, #40]
Lloh49:
	adrp	x0, l_.str.4@PAGE
Lloh50:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DPRINTK
Lloh51:
	adrp	x8, _KERN_INFO@GOTPAGE
Lloh52:
	ldr	x8, [x8, _KERN_INFO@GOTPAGEOFF]
Lloh53:
	ldr	w20, [x8]
	ldr	x0, [x19, #40]
	bl	_ata_xfer_mode2mask
	bl	_ata_mode_string
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x0, x21, [sp]
Lloh54:
	adrp	x2, l_.str.5@PAGE
Lloh55:
	add	x2, x2, l_.str.5@PAGEOFF
	mov	x0, x19
	mov	x1, x20
	bl	_ata_dev_printk
	mov	w0, #0
LBB0_24:
	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
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpAdd	Lloh54, Lloh55
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpAdd	Lloh49, Lloh50
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_HORKAGE_NOSETXFER,4,2      ; @ATA_HORKAGE_NOSETXFER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.space	1

	.comm	_ATA_DFLAG_PIO,4,2              ; @ATA_DFLAG_PIO
	.comm	_ATA_SHIFT_PIO,8,3              ; @ATA_SHIFT_PIO
	.comm	_ATA_FLAG_SATA,4,2              ; @ATA_FLAG_SATA
l_.str.1:                               ; @.str.1
	.asciz	" (SET_XFERMODE skipped)"

	.comm	_KERN_WARNING,4,2               ; @KERN_WARNING
l_.str.2:                               ; @.str.2
	.asciz	"NOSETXFER but PATA detected - can't skip SETXFER, might malfunction\n"

	.comm	_AC_ERR_DEV,4,2                 ; @AC_ERR_DEV
	.comm	_ATA_EHI_POST_SETMODE,4,2       ; @ATA_EHI_POST_SETMODE
	.comm	_ATA_DEV_UNKNOWN,4,2            ; @ATA_DEV_UNKNOWN
	.comm	_XFER_PIO_2,8,3                 ; @XFER_PIO_2
	.comm	_ATA_SHIFT_MWDMA,8,3            ; @ATA_SHIFT_MWDMA
	.comm	_XFER_MW_DMA_0,8,3              ; @XFER_MW_DMA_0
l_.str.3:                               ; @.str.3
	.asciz	" (device error ignored)"

l_.str.4:                               ; @.str.4
	.asciz	"xfer_shift=%u, xfer_mode=0x%x\n"

	.comm	_KERN_INFO,4,2                  ; @KERN_INFO
l_.str.5:                               ; @.str.5
	.asciz	"configured for %s%s\n"

	.comm	_KERN_ERR,4,2                   ; @KERN_ERR
l_.str.6:                               ; @.str.6
	.asciz	"failed to set xfermode (err_mask=0x%x)\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_ata_dev_set_mode
.subsections_via_symbols
