	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ata_build_rw_tf                ## -- Begin function ata_build_rw_tf
	.p2align	4, 0x90
_ata_build_rw_tf:                       ## @ata_build_rw_tf
	.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	_ATA_TFLAG_ISADDR@GOTPCREL(%rip), %rax
	movq	_ATA_TFLAG_DEVICE@GOTPCREL(%rip), %rbx
	orl	(%rax), %r8d
	orl	(%rbx), %r8d
	movl	%r9d, %ebx
	movl	%ecx, %r13d
	movl	%edx, %r12d
	movq	%rsi, %r14
	movq	%rdi, %r15
	orl	%r8d, (%rdi)
	movq	%rsi, %rdi
	callq	_ata_ncq_enabled
	testq	%rax, %rax
	je	LBB0_9
## %bb.1:
	movq	_ATA_TAG_INTERNAL@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	%ebx, (%rax)
	setne	%dil
	callq	_likely
	testq	%rax, %rax
	je	LBB0_9
## %bb.2:
	movl	%r12d, %edi
	movl	%r13d, %esi
	callq	_lba_48_ok
	testq	%rax, %rax
	je	LBB0_3
## %bb.5:
	movq	_ATA_PROT_NCQ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 52(%r15)
	movq	_ATA_TFLAG_LBA@GOTPCREL(%rip), %rcx
	movq	_ATA_TFLAG_LBA48@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	(%rcx), %eax
	orl	(%r15), %eax
	movl	%eax, (%r15)
	movq	_ATA_TFLAG_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	jne	LBB0_6
## %bb.7:
	movq	_ATA_CMD_FPDMA_READ@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_9:
	movq	_ATA_DFLAG_LBA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_18
## %bb.10:
	movq	_ATA_TFLAG_LBA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r15)
	movl	%r12d, %edi
	movl	%r13d, %ebx
	movl	%r13d, %esi
	callq	_lba_28_ok
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:
	movl	%r12d, %eax
	shrl	$24, %eax
	andl	$15, %eax
	orl	%eax, 40(%r15)
	movl	%r12d, %ebx
LBB0_15:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_ata_rwcmd_protocol
	shrq	$63, %rax
	movl	%eax, %edi
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_16
## %bb.17:
	movzbl	%r13b, %eax
	movl	%eax, 4(%r15)
	movl	%ebx, %eax
	shrl	$16, %eax
	movzbl	%al, %eax
	movl	%eax, 28(%r15)
	movzbl	%bh, %eax
	movl	%eax, 32(%r15)
	movzbl	%bl, %eax
	movl	%eax, 36(%r15)
	movq	_ATA_LBA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 40(%r15)
	jmp	LBB0_24
LBB0_18:
	movl	%r12d, %edi
	movl	%r13d, %esi
	callq	_lba_28_ok
	testq	%rax, %rax
	je	LBB0_3
## %bb.19:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_ata_rwcmd_protocol
	shrq	$63, %rax
	movl	%eax, %edi
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_20
LBB0_16:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	jmp	LBB0_4
LBB0_12:
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	movl	%r12d, %edi
	movl	%ebx, %esi
	callq	_lba_48_ok
	testq	%rax, %rax
	je	LBB0_3
## %bb.13:
	movq	_ATA_DFLAG_LBA48@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_3
## %bb.14:
	movq	_ATA_TFLAG_LBA48@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r15)
	movl	%r13d, %eax
	movzbl	%ah, %eax
	movl	%eax, 44(%r15)
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %eax
	shrl	$24, %eax
	movl	%eax, 24(%r15)
	jmp	LBB0_15
LBB0_6:
	movq	_ATA_CMD_FPDMA_WRITE@GOTPCREL(%rip), %rcx
LBB0_8:
	movl	(%rcx), %ecx
	movl	%ecx, 48(%r15)
	shll	$3, %ebx
	movl	%ebx, 4(%r15)
	movl	%r13d, %edx
	movzbl	%dh, %ecx
	movl	%ecx, 8(%r15)
	movzbl	%dl, %ecx
	movl	%ecx, 12(%r15)
	movl	%r12d, %edx
	movl	%r12d, %ecx
	shrl	$24, %ecx
	movl	%ecx, 24(%r15)
	movl	%r12d, %ecx
	shrl	$16, %ecx
	movzbl	%cl, %ecx
	movl	%ecx, 28(%r15)
	movzbl	%dh, %ecx
	movl	%ecx, 32(%r15)
	movzbl	%dl, %ecx
	movl	%ecx, 36(%r15)
	movq	_ATA_TFLAG_FUA@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	andl	(%rcx), %eax
	setne	%dl
	shll	$7, %edx
	orl	$64, %edx
	movl	%edx, 40(%r15)
LBB0_24:
	xorl	%eax, %eax
	jmp	LBB0_25
LBB0_20:
	movl	%r12d, %eax
	cltd
	idivl	4(%r14)
	movl	%edx, %edi
	movl	%eax, %ecx
	cltd
	idivl	8(%r14)
	movl	%r12d, %esi
	movl	%eax, %ebx
	movl	%edx, %r14d
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	leal	1(%rdi), %r12d
	leaq	L_.str(%rip), %rdi
	movl	%ecx, %edx
	movl	%eax, %ecx
	movl	%r14d, %r8d
	movl	%r12d, %r9d
	callq	_DPRINTK
	cmpl	$65535, %ebx                    ## imm = 0xFFFF
	ja	LBB0_3
## %bb.21:
	cmpl	$15, %r14d
	ja	LBB0_3
## %bb.22:
	cmpl	$255, -48(%rbp)                 ## 4-byte Folded Reload
	jae	LBB0_3
## %bb.23:
	movzbl	%r13b, %eax
	movl	%eax, 4(%r15)
	movl	%r12d, 36(%r15)
	movl	%ebx, 32(%r15)
	shrl	$8, %ebx
	movl	%ebx, 28(%r15)
	orl	%r14d, 40(%r15)
	jmp	LBB0_24
LBB0_3:
	movq	_ERANGE@GOTPCREL(%rip), %rcx
LBB0_4:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_25:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_TFLAG_ISADDR,4,2           ## @ATA_TFLAG_ISADDR
	.comm	_ATA_TFLAG_DEVICE,4,2           ## @ATA_TFLAG_DEVICE
	.comm	_ATA_TAG_INTERNAL,4,2           ## @ATA_TAG_INTERNAL
	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_ATA_PROT_NCQ,4,2               ## @ATA_PROT_NCQ
	.comm	_ATA_TFLAG_LBA,4,2              ## @ATA_TFLAG_LBA
	.comm	_ATA_TFLAG_LBA48,4,2            ## @ATA_TFLAG_LBA48
	.comm	_ATA_TFLAG_WRITE,4,2            ## @ATA_TFLAG_WRITE
	.comm	_ATA_CMD_FPDMA_WRITE,4,2        ## @ATA_CMD_FPDMA_WRITE
	.comm	_ATA_CMD_FPDMA_READ,4,2         ## @ATA_CMD_FPDMA_READ
	.comm	_ATA_TFLAG_FUA,4,2              ## @ATA_TFLAG_FUA
	.comm	_ATA_DFLAG_LBA,4,2              ## @ATA_DFLAG_LBA
	.comm	_ATA_DFLAG_LBA48,4,2            ## @ATA_DFLAG_LBA48
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ATA_LBA,4,2                    ## @ATA_LBA
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"block %u track %u cyl %u head %u sect %u\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function ata_build_rw_tf
lCPI0_0:
	.long	4294967280                      ; 0xfffffff0
	.long	4294967288                      ; 0xfffffff8
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_ata_build_rw_tf
	.p2align	2
_ata_build_rw_tf:                       ; @ata_build_rw_tf
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x23, x5
	mov	x21, x3
	mov	x20, x2
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _ATA_TFLAG_ISADDR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ATA_TFLAG_ISADDR@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _ATA_TFLAG_DEVICE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _ATA_TFLAG_DEVICE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	ldr	w10, [x0]
	orr	w8, w8, w4
	orr	w8, w8, w9
	orr	w8, w8, w10
	str	w8, [x0]
	mov	x0, x1
	bl	_ata_ncq_enabled
	cbz	x0, LBB0_4
; %bb.1:
Lloh6:
	adrp	x8, _ATA_TAG_INTERNAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ATA_TAG_INTERNAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w8, w23
	cset	w0, ne
	bl	_likely
	cbz	x0, LBB0_4
; %bb.2:
	mov	x0, x20
	mov	x1, x21
	bl	_lba_48_ok
	cbz	x0, LBB0_19
; %bb.3:
	mov	w0, #0
Lloh9:
	adrp	x8, _ATA_PROT_NCQ@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ATA_PROT_NCQ@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	str	w8, [x19, #52]
Lloh12:
	adrp	x8, _ATA_TFLAG_LBA@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ATA_TFLAG_LBA@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _ATA_TFLAG_LBA48@GOTPAGE
Lloh16:
	ldr	x9, [x9, _ATA_TFLAG_LBA48@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	w9, [x19]
	orr	w8, w8, w9
Lloh18:
	adrp	x9, _ATA_TFLAG_WRITE@GOTPAGE
Lloh19:
	ldr	x9, [x9, _ATA_TFLAG_WRITE@GOTPAGEOFF]
	str	w8, [x19]
Lloh20:
	ldr	w9, [x9]
Lloh21:
	adrp	x10, _ATA_CMD_FPDMA_READ@GOTPAGE
Lloh22:
	ldr	x10, [x10, _ATA_CMD_FPDMA_READ@GOTPAGEOFF]
Lloh23:
	adrp	x11, _ATA_CMD_FPDMA_WRITE@GOTPAGE
Lloh24:
	ldr	x11, [x11, _ATA_CMD_FPDMA_WRITE@GOTPAGEOFF]
	tst	w9, w8
	csel	x9, x10, x11, eq
	ldr	w9, [x9]
	str	w9, [x19, #48]
	lsl	w9, w23, #3
	ubfx	w10, w21, #8, #8
	stp	w9, w10, [x19, #4]
	and	w9, w21, #0xff
	str	w9, [x19, #12]
	lsr	w9, w20, #24
	str	w9, [x19, #24]
	dup.2s	v0, w20
Lloh25:
	adrp	x9, lCPI0_0@PAGE
Lloh26:
	ldr	d1, [x9, lCPI0_0@PAGEOFF]
	ushl.2s	v0, v0, v1
	movi	d1, #0x0000ff000000ff
	and.8b	v0, v0, v1
	stur	d0, [x19, #28]
	and	w9, w20, #0xff
Lloh27:
	adrp	x10, _ATA_TFLAG_FUA@GOTPAGE
Lloh28:
	ldr	x10, [x10, _ATA_TFLAG_FUA@GOTPAGEOFF]
Lloh29:
	ldr	w10, [x10]
	tst	w10, w8
	mov	w8, #192
	mov	w10, #64
	csel	w8, w10, w8, eq
	str	w9, [x19, #36]
	b	LBB0_18
LBB0_4:
	ldr	w8, [x22]
Lloh30:
	adrp	x9, _ATA_DFLAG_LBA@GOTPAGE
Lloh31:
	ldr	x9, [x9, _ATA_DFLAG_LBA@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.5:
Lloh33:
	adrp	x8, _ATA_TFLAG_LBA@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ATA_TFLAG_LBA@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
	mov	x0, x20
	mov	x1, x21
	bl	_lba_28_ok
	cbz	x0, LBB0_12
; %bb.6:
	ubfx	w8, w20, #24, #4
	ldr	w9, [x19, #40]
	orr	w8, w9, w8
	str	w8, [x19, #40]
LBB0_7:
	mov	x0, x19
	mov	x1, x22
	bl	_ata_rwcmd_protocol
	lsr	x0, x0, #63
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_unlikely
	cbnz	x0, LBB0_11
; %bb.8:
	and	w8, w21, #0xff
	str	w8, [x19, #4]
Lloh36:
	adrp	x8, lCPI0_0@PAGE
Lloh37:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
Lloh38:
	adrp	x8, _ATA_LBA@GOTPAGE
Lloh39:
	ldr	x8, [x8, _ATA_LBA@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	ldr	w9, [x19, #40]
	orr	w8, w9, w8
	dup.2s	v1, w20
	ushl.2s	v0, v1, v0
	movi	d1, #0x0000ff000000ff
	and.8b	v0, v0, v1
	stur	d0, [x19, #28]
	and	w9, w20, #0xff
	str	w9, [x19, #36]
	b	LBB0_18
LBB0_9:
	mov	x0, x20
	mov	x1, x21
	bl	_lba_28_ok
	cbz	x0, LBB0_19
; %bb.10:
	mov	x0, x19
	mov	x1, x22
	bl	_ata_rwcmd_protocol
	lsr	x0, x0, #63
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_unlikely
	cbz	x0, LBB0_15
LBB0_11:
Lloh41:
	adrp	x8, _EINVAL@GOTPAGE
Lloh42:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_20
LBB0_12:
	mov	x0, x20
	mov	x1, x21
	bl	_lba_48_ok
	cbz	x0, LBB0_19
; %bb.13:
	ldr	w8, [x22]
Lloh43:
	adrp	x9, _ATA_DFLAG_LBA48@GOTPAGE
Lloh44:
	ldr	x9, [x9, _ATA_DFLAG_LBA48@GOTPAGEOFF]
Lloh45:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_19
; %bb.14:
Lloh46:
	adrp	x8, _ATA_TFLAG_LBA48@GOTPAGE
Lloh47:
	ldr	x8, [x8, _ATA_TFLAG_LBA48@GOTPAGEOFF]
Lloh48:
	ldr	w8, [x8]
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
	ubfx	w8, w21, #8, #8
	str	w8, [x19, #44]
	lsr	w8, w20, #24
	str	w8, [x19, #24]
	b	LBB0_7
LBB0_15:
	ldp	w8, w9, [x22, #4]
	sdiv	w2, w20, w8
	sdiv	w23, w2, w9
	msub	w22, w23, w9, w2
	msub	w25, w2, w8, w20
	add	w24, w25, #1
Lloh49:
	adrp	x0, l_.str@PAGE
Lloh50:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	mov	x3, x23
	mov	x4, x22
	mov	x5, x24
	bl	_DPRINTK
	lsr	w8, w23, #16
	cmp	w8, #0
	ccmp	w22, #15, #2, eq
	b.hi	LBB0_19
; %bb.16:
	cmp	w25, #255
	b.hs	LBB0_19
; %bb.17:
	mov	w0, #0
	and	w8, w21, #0xff
	str	w8, [x19, #4]
	lsr	w8, w23, #8
	stp	w8, w23, [x19, #28]
	ldr	w8, [x19, #40]
	orr	w8, w8, w22
	str	w24, [x19, #36]
LBB0_18:
	str	w8, [x19, #40]
	b	LBB0_21
LBB0_19:
Lloh51:
	adrp	x8, _ERANGE@GOTPAGE
Lloh52:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
LBB0_20:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_21:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdr	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdrp	Lloh36, Lloh38
	.loh AdrpLdr	Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpAdd	Lloh49, Lloh50
	.loh AdrpLdrGot	Lloh51, Lloh52
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_TFLAG_ISADDR,4,2           ; @ATA_TFLAG_ISADDR
	.comm	_ATA_TFLAG_DEVICE,4,2           ; @ATA_TFLAG_DEVICE
	.comm	_ATA_TAG_INTERNAL,4,2           ; @ATA_TAG_INTERNAL
	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_ATA_PROT_NCQ,4,2               ; @ATA_PROT_NCQ
	.comm	_ATA_TFLAG_LBA,4,2              ; @ATA_TFLAG_LBA
	.comm	_ATA_TFLAG_LBA48,4,2            ; @ATA_TFLAG_LBA48
	.comm	_ATA_TFLAG_WRITE,4,2            ; @ATA_TFLAG_WRITE
	.comm	_ATA_CMD_FPDMA_WRITE,4,2        ; @ATA_CMD_FPDMA_WRITE
	.comm	_ATA_CMD_FPDMA_READ,4,2         ; @ATA_CMD_FPDMA_READ
	.comm	_ATA_TFLAG_FUA,4,2              ; @ATA_TFLAG_FUA
	.comm	_ATA_DFLAG_LBA,4,2              ; @ATA_DFLAG_LBA
	.comm	_ATA_DFLAG_LBA48,4,2            ; @ATA_DFLAG_LBA48
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ATA_LBA,4,2                    ; @ATA_LBA
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"block %u track %u cyl %u head %u sect %u\n"

.subsections_via_symbols
