	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ahci_handle_rw
_ahci_handle_rw:                        ## @ahci_handle_rw
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rdi, %r14
	movq	_AHCI_CL_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movslq	%esi, %rdx
	imulq	%rax, %rdx
	movq	%rdx, -96(%rbp)                 ## 8-byte Spill
	movl	8(%r15), %r11d
	movq	_ATA_WRITE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r11d
	sete	%al
	movq	_ATA_WRITE48@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r8d
	cmpl	%r8d, %r11d
	sete	%bl
	movq	_ATA_WRITE_MUL@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %r11d
	sete	%dl
	orb	%al, %dl
	orb	%bl, %dl
	movq	_ATA_WRITE_MUL48@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	cmpl	%r9d, %r11d
	sete	%al
	movq	_ATA_WRITE_DMA@GOTPCREL(%rip), %rdi
	cmpl	(%rdi), %r11d
	leaq	512(%r15), %rdi
	movq	%rdi, -88(%rbp)                 ## 8-byte Spill
	sete	%r10b
	orb	%al, %r10b
	orb	%dl, %r10b
	movq	_ATA_WRITE_DMA48@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	cmpl	%edi, %r11d
	sete	%al
	movq	_ATA_WRITE_FPDMA_QUEUED@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %r11d
	sete	%dl
	orb	%dl, %al
	movq	_ATA_READ_FPDMA_QUEUED@GOTPCREL(%rip), %rbx
	cmpl	(%rbx), %r11d
	sete	%bl
	orb	%dl, %bl
	movq	16(%r14), %rdx
	movq	%rdx, -80(%rbp)                 ## 8-byte Spill
	movb	%bl, -42(%rbp)                  ## 1-byte Spill
	cmpb	$1, %bl
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	jne	LBB0_3
## %bb.1:
	movl	44(%r15), %edx
	shll	$8, %edx
	orl	12(%r15), %edx
	jmp	LBB0_2
LBB0_3:
	movq	_ATA_READ48@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %r11d
	je	LBB0_9
## %bb.4:
	cmpl	%r8d, %r11d
	je	LBB0_9
## %bb.5:
	movq	_ATA_READ_MUL48@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %r11d
	je	LBB0_9
## %bb.6:
	cmpl	%r9d, %r11d
	je	LBB0_9
## %bb.7:
	movq	_ATA_READ_DMA48@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %r11d
	je	LBB0_9
## %bb.8:
	cmpl	%edi, %r11d
	je	LBB0_9
## %bb.10:
	movl	28(%r15), %esi
	andl	$15, %esi
	shll	$24, %esi
	movl	20(%r15), %edi
	movl	24(%r15), %edx
	shll	$16, %edx
	shll	$8, %edi
	orl	%edx, %edi
	orl	%esi, %edi
	orl	16(%r15), %edi
	movl	48(%r15), %edx
	testl	%edx, %edx
	movl	$256, %esi                      ## imm = 0x100
	cmovnel	%edx, %esi
	shlq	$32, %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_11
LBB0_9:
	movl	52(%r15), %edx
	shll	$8, %edx
	orl	48(%r15), %edx
LBB0_2:
	movl	$65536, %esi                    ## imm = 0x10000
	cmovnel	%edx, %esi
                                        ## implicit-def: $rdx
                                        ## kill: killed $rdx
LBB0_11:
	orb	%al, %r10b
	movb	%r10b, -43(%rbp)                ## 1-byte Spill
	testq	%rcx, %rcx
	setne	-41(%rbp)                       ## 1-byte Folded Spill
	movslq	%esi, %r12
	movl	4(%r14), %edi
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	callq	_blockif_sectsz
	movq	%r14, %rbx
	movq	%rax, %r14
	movl	4(%rbx), %edi
	callq	_blockif_sectsz
	movq	%rax, %r15
	imulq	%r12, %r15
	leaq	12(%rbx), %r12
	movq	%r12, %rdi
	callq	_STAILQ_FIRST
	movq	%rax, %r13
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	callq	_assert
	movq	_io_flist@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_STAILQ_REMOVE_HEAD
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, (%r13)
	movl	-48(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, 8(%r13)
	movq	%r15, 32(%r13)
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 24(%r13)
	imulq	-56(%rbp), %r14                 ## 8-byte Folded Reload
	sarq	$32, %r14
	addq	%rax, %r14
	movq	%r14, 16(%r13)
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rax,%rcx), %ecx
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	callq	_ahci_build_iov
	movl	$1, %eax
	movl	%r12d, %ecx
	shll	%cl, %eax
	orl	%eax, (%rbx)
	leaq	8(%rbx), %rdi
	movq	_io_blist@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rsi
	callq	_TAILQ_INSERT_HEAD
	movb	-42(%rbp), %al                  ## 1-byte Reload
	xorb	$1, %al
	orb	-41(%rbp), %al                  ## 1-byte Folded Reload
	jne	LBB0_13
## %bb.12:
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_ahci_write_fis_d2h_ncq
LBB0_13:
	addq	$16, %r13
	movl	4(%rbx), %edi
	testb	$1, -43(%rbp)                   ## 1-byte Folded Reload
	je	LBB0_14
## %bb.15:
	movq	%r13, %rsi
	callq	_blockif_write
	jmp	LBB0_16
LBB0_14:
	movq	%r13, %rsi
	callq	_blockif_read
LBB0_16:
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_assert                         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_AHCI_CL_SIZE,4,2               ## @AHCI_CL_SIZE
	.comm	_ATA_WRITE,4,2                  ## @ATA_WRITE
	.comm	_ATA_WRITE48,4,2                ## @ATA_WRITE48
	.comm	_ATA_WRITE_MUL,4,2              ## @ATA_WRITE_MUL
	.comm	_ATA_WRITE_MUL48,4,2            ## @ATA_WRITE_MUL48
	.comm	_ATA_WRITE_DMA,4,2              ## @ATA_WRITE_DMA
	.comm	_ATA_WRITE_DMA48,4,2            ## @ATA_WRITE_DMA48
	.comm	_ATA_WRITE_FPDMA_QUEUED,4,2     ## @ATA_WRITE_FPDMA_QUEUED
	.comm	_ATA_READ_FPDMA_QUEUED,4,2      ## @ATA_READ_FPDMA_QUEUED
	.comm	_ATA_READ48,4,2                 ## @ATA_READ48
	.comm	_ATA_READ_MUL48,4,2             ## @ATA_READ_MUL48
	.comm	_ATA_READ_DMA48,4,2             ## @ATA_READ_DMA48
	.comm	_io_flist,4,2                   ## @io_flist
	.comm	_io_blist,4,2                   ## @io_blist
	.no_dead_strip	_ahci_handle_rw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ahci_handle_rw
_ahci_handle_rw:                        ; @ahci_handle_rw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x3
	mov	x23, x2
	mov	x20, x1
	mov	x19, x0
	add	x8, x2, #512
	str	x8, [sp, #40]                   ; 8-byte Folded Spill
Lloh0:
	adrp	x8, _AHCI_CL_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AHCI_CL_SIZE@GOTPAGEOFF]
	ldr	x10, [x0, #16]
Lloh2:
	ldrsw	x8, [x8]
	sxtw	x9, w20
	mul	x8, x8, x9
	stp	x8, x10, [sp, #24]              ; 16-byte Folded Spill
Lloh3:
	adrp	x8, _ATA_WRITE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ATA_WRITE@GOTPAGEOFF]
	ldr	w10, [x2, #8]
Lloh5:
	ldr	w8, [x8]
	cmp	w10, w8
Lloh6:
	adrp	x8, _ATA_WRITE48@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ATA_WRITE48@GOTPAGEOFF]
Lloh8:
	ldr	w13, [x8]
	ccmp	w10, w13, #4, ne
Lloh9:
	adrp	x8, _ATA_WRITE_MUL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ATA_WRITE_MUL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _ATA_WRITE_MUL48@GOTPAGE
Lloh13:
	ldr	x9, [x9, _ATA_WRITE_MUL48@GOTPAGEOFF]
	ccmp	w10, w8, #4, ne
Lloh14:
	ldr	w12, [x9]
	ccmp	w10, w12, #4, ne
Lloh15:
	adrp	x8, _ATA_WRITE_DMA@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ATA_WRITE_DMA@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	ccmp	w10, w8, #4, ne
Lloh18:
	adrp	x8, _ATA_WRITE_DMA48@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ATA_WRITE_DMA48@GOTPAGEOFF]
Lloh20:
	ldr	w11, [x8]
	ccmp	w10, w11, #4, ne
	cset	w8, eq
Lloh21:
	adrp	x9, _ATA_WRITE_FPDMA_QUEUED@GOTPAGE
Lloh22:
	ldr	x9, [x9, _ATA_WRITE_FPDMA_QUEUED@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	cmp	w10, w9
Lloh24:
	adrp	x14, _ATA_READ_FPDMA_QUEUED@GOTPAGE
Lloh25:
	ldr	x14, [x14, _ATA_READ_FPDMA_QUEUED@GOTPAGEOFF]
	cset	w9, eq
Lloh26:
	ldr	w14, [x14]
	cmp	w10, w14
	cset	w14, eq
	orr	w14, w9, w14
	str	w14, [sp, #20]                  ; 4-byte Folded Spill
	cmp	w14, #1
	b.ne	LBB0_2
; %bb.1:
	ldr	w10, [x23, #44]
	ldr	w11, [x23, #12]
	b	LBB0_10
LBB0_2:
Lloh27:
	adrp	x14, _ATA_READ48@GOTPAGE
Lloh28:
	ldr	x14, [x14, _ATA_READ48@GOTPAGEOFF]
Lloh29:
	ldr	w14, [x14]
	cmp	w10, w14
	b.eq	LBB0_9
; %bb.3:
	cmp	w10, w13
	b.eq	LBB0_9
; %bb.4:
Lloh30:
	adrp	x13, _ATA_READ_MUL48@GOTPAGE
Lloh31:
	ldr	x13, [x13, _ATA_READ_MUL48@GOTPAGEOFF]
Lloh32:
	ldr	w13, [x13]
	cmp	w10, w13
	b.eq	LBB0_9
; %bb.5:
	cmp	w10, w12
	b.eq	LBB0_9
; %bb.6:
Lloh33:
	adrp	x12, _ATA_READ_DMA48@GOTPAGE
Lloh34:
	ldr	x12, [x12, _ATA_READ_DMA48@GOTPAGEOFF]
Lloh35:
	ldr	w12, [x12]
	cmp	w10, w12
	b.eq	LBB0_9
; %bb.7:
	cmp	w10, w11
	b.eq	LBB0_9
; %bb.8:
	ldp	w11, w10, [x23, #24]
	ubfiz	w10, w10, #24, #4
	orr	w10, w10, w11, lsl #16
	ldp	w12, w11, [x23, #16]
	orr	w10, w10, w11, lsl #8
	orr	w11, w10, w12
	ldr	w10, [x23, #48]
	mov	w12, #256
	cmp	w10, #0
	csel	w10, w12, w10, eq
	lsl	x11, x11, #32
	str	x11, [sp, #8]                   ; 8-byte Folded Spill
	b	LBB0_11
LBB0_9:
	ldp	w11, w10, [x23, #48]
LBB0_10:
	orr	w10, w11, w10, lsl #8
	mov	w11, #65536
	cmp	w10, #0
	csel	w10, w11, w10, eq
                                        ; implicit-def: $x11
                                        ; kill: killed $x11
LBB0_11:
	orr	w27, w8, w9
	cmp	x22, #0
	cset	w28, ne
	sxtw	x25, w10
	ldr	w0, [x19, #4]
	bl	_blockif_sectsz
	mov	x24, x0
	ldr	w0, [x19, #4]
	bl	_blockif_sectsz
	mul	x21, x0, x25
	add	x25, x19, #12
	mov	x0, x25
	bl	_STAILQ_FIRST
	mov	x26, x0
	cmp	x0, #0
	cset	w0, ne
	bl	_assert
Lloh36:
	adrp	x8, _io_flist@GOTPAGE
Lloh37:
	ldr	x8, [x8, _io_flist@GOTPAGEOFF]
Lloh38:
	ldr	w1, [x8]
	mov	x0, x25
	bl	_STAILQ_REMOVE_HEAD
	str	x23, [x26]
	str	w20, [x26, #8]
	stp	x22, x21, [x26, #24]
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	mul	x8, x8, x24
	add	x8, x22, x8, asr #32
	mov	x22, x26
	str	x8, [x22, #16]!
	ldp	x9, x8, [sp, #24]               ; 16-byte Folded Reload
	ldr	w3, [x9, x8]
	mov	x0, x19
	mov	x1, x26
	ldr	x2, [sp, #40]                   ; 8-byte Folded Reload
	bl	_ahci_build_iov
	mov	w8, #1
	lsl	w8, w8, w20
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
	add	x0, x19, #8
Lloh39:
	adrp	x8, _io_blist@GOTPAGE
Lloh40:
	ldr	x8, [x8, _io_blist@GOTPAGEOFF]
Lloh41:
	ldr	w2, [x8]
	mov	x1, x26
	bl	_TAILQ_INSERT_HEAD
	ldr	w8, [sp, #20]                   ; 4-byte Folded Reload
	eor	w8, w8, #0x1
	orr	w8, w28, w8
	tbnz	w8, #0, LBB0_13
; %bb.12:
	mov	x0, x19
	mov	x1, x20
	bl	_ahci_write_fis_d2h_ncq
LBB0_13:
	ldr	w0, [x19, #4]
	mov	x1, x22
	tbz	w27, #0, LBB0_15
; %bb.14:
	bl	_blockif_write
	b	LBB0_16
LBB0_15:
	bl	_blockif_read
LBB0_16:
	cmp	w0, #0
	cset	w0, eq
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	b	_assert
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_AHCI_CL_SIZE,4,2               ; @AHCI_CL_SIZE
	.comm	_ATA_WRITE,4,2                  ; @ATA_WRITE
	.comm	_ATA_WRITE48,4,2                ; @ATA_WRITE48
	.comm	_ATA_WRITE_MUL,4,2              ; @ATA_WRITE_MUL
	.comm	_ATA_WRITE_MUL48,4,2            ; @ATA_WRITE_MUL48
	.comm	_ATA_WRITE_DMA,4,2              ; @ATA_WRITE_DMA
	.comm	_ATA_WRITE_DMA48,4,2            ; @ATA_WRITE_DMA48
	.comm	_ATA_WRITE_FPDMA_QUEUED,4,2     ; @ATA_WRITE_FPDMA_QUEUED
	.comm	_ATA_READ_FPDMA_QUEUED,4,2      ; @ATA_READ_FPDMA_QUEUED
	.comm	_ATA_READ48,4,2                 ; @ATA_READ48
	.comm	_ATA_READ_MUL48,4,2             ; @ATA_READ_MUL48
	.comm	_ATA_READ_DMA48,4,2             ; @ATA_READ_DMA48
	.comm	_io_flist,4,2                   ; @io_flist
	.comm	_io_blist,4,2                   ; @io_blist
	.no_dead_strip	_ahci_handle_rw
.subsections_via_symbols
