	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ahci_handle_dsm_trim
_ahci_handle_dsm_trim:                  ## @ahci_handle_dsm_trim
	.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	$2088, %rsp                     ## imm = 0x828
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r15d
	movq	%rdx, %r13
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movl	8(%rdx), %ebx
	movq	_ATA_DATA_SET_MANAGEMENT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	12(%rdx), %rax
	leaq	48(%rdx), %r8
	xorl	%edx, %edx
	movl	%ebx, -2104(%rbp)               ## 4-byte Spill
	movl	%ecx, -2128(%rbp)               ## 4-byte Spill
	cmpl	%ecx, %ebx
	setne	-2097(%rbp)                     ## 1-byte Folded Spill
	sete	%dl
	movl	44(%r13,%rdx,8), %edx
	cmoveq	%r8, %rax
	movl	(%rax), %r14d
	shll	$17, %edx
	shll	$9, %r14d
	orl	%edx, %r14d
	leaq	-2096(%rbp), %rcx
	movq	%rdi, -2120(%rbp)               ## 8-byte Spill
	movl	%esi, -2108(%rbp)               ## 4-byte Spill
	movq	%r13, %rdx
	movl	$2048, %r8d                     ## imm = 0x800
	callq	_read_prdt
	movl	%r15d, %ebx
	movslq	%r15d, %rax
	movslq	%r14d, %rcx
	leal	8(%rax), %r12d
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	-2068(%rbp,%rax,4), %r15d
	shll	$8, %r15d
	orl	-2072(%rbp,%rax,4), %r15d
	jne	LBB0_10
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	addq	$8, %rax
	addl	$8, %r12d
	cmpq	%rcx, %rax
	jl	LBB0_1
## %bb.3:
	movl	-2128(%rbp), %eax               ## 4-byte Reload
	cmpl	%eax, -2104(%rbp)               ## 4-byte Folded Reload
	jne	LBB0_4
## %bb.7:
	movl	%ebx, %r15d
	movq	_ATA_S_READY@GOTPCREL(%rip), %rax
	movq	_ATA_S_DSC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	-2120(%rbp), %rbx               ## 8-byte Reload
	movq	%rbx, %rdi
	movl	-2108(%rbp), %r14d              ## 4-byte Reload
	movl	%r14d, %esi
	movq	%r13, %rdx
	callq	_ahci_write_fis_d2h
	jmp	LBB0_8
LBB0_10:
	testl	%ebx, %ebx
	setne	-2104(%rbp)                     ## 1-byte Folded Spill
	movq	-2120(%rbp), %rax               ## 8-byte Reload
	leaq	12(%rax), %rdi
	movq	%rdi, -2128(%rbp)               ## 8-byte Spill
	callq	_STAILQ_FIRST
	movq	%rax, %rbx
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	callq	_assert
	movq	_io_flist@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-2128(%rbp), %rdi               ## 8-byte Reload
	callq	_STAILQ_REMOVE_HEAD
	movq	%r13, (%rbx)
	movl	-2108(%rbp), %r13d              ## 4-byte Reload
	movl	%r13d, 8(%rbx)
	movl	%r14d, 12(%rbx)
	movl	%r12d, 16(%rbx)
	xorl	%eax, %eax
	cmpl	%r12d, %r14d
	movq	-2120(%rbp), %r14               ## 8-byte Reload
	setne	%al
	movl	%eax, 20(%rbx)
	leaq	24(%rbx), %r12
	movl	4(%r14), %edi
	callq	_blockif_sectsz
	movl	4(%r14), %edi
	callq	_blockif_sectsz
	imull	%r15d, %eax
	movl	%r13d, %r15d
	movl	$1, %edx
	movl	%r15d, %ecx
	shll	%cl, %edx
	movl	%eax, 28(%rbx)
	orl	%edx, (%r14)
	leaq	8(%r14), %rdi
	movq	_io_blist@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rsi
	callq	_TAILQ_INSERT_HEAD
	movb	-2097(%rbp), %al                ## 1-byte Reload
	xorb	$1, %al
	orb	-2104(%rbp), %al                ## 1-byte Folded Reload
	jne	LBB0_12
## %bb.11:
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_ahci_write_fis_d2h_ncq
LBB0_12:
	movl	4(%r14), %edi
	movq	%r12, %rsi
	callq	_blockif_delete
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_assert
	jmp	LBB0_13
LBB0_4:
	movl	%ebx, %r15d
	testl	%ebx, %ebx
	movq	-2120(%rbp), %rbx               ## 8-byte Reload
	movl	-2108(%rbp), %r14d              ## 4-byte Reload
	jne	LBB0_6
## %bb.5:
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_ahci_write_fis_d2h_ncq
LBB0_6:
	movq	_ATA_S_READY@GOTPCREL(%rip), %rax
	movq	_ATA_S_DSC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	%rbx, %rdi
	movl	%r14d, %esi
	movq	%r13, %rdx
	callq	_ahci_write_fis_sdb
LBB0_8:
	movl	$-2, %eax
	movl	%r14d, %ecx
	roll	%cl, %eax
	andl	%eax, (%rbx)
	movq	%rbx, %rdi
	callq	_ahci_check_stopped
	testl	%r15d, %r15d
	je	LBB0_13
## %bb.9:
	movq	%rbx, %rdi
	callq	_ahci_handle_port
LBB0_13:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_15
## %bb.14:
	addq	$2088, %rsp                     ## imm = 0x828
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_DATA_SET_MANAGEMENT,4,2    ## @ATA_DATA_SET_MANAGEMENT
	.comm	_ATA_S_READY,4,2                ## @ATA_S_READY
	.comm	_ATA_S_DSC,4,2                  ## @ATA_S_DSC
	.comm	_io_flist,4,2                   ## @io_flist
	.comm	_io_blist,4,2                   ## @io_blist
	.no_dead_strip	_ahci_handle_dsm_trim
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ahci_handle_dsm_trim
_ahci_handle_dsm_trim:                  ; @ahci_handle_dsm_trim
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #2064
	mov	x22, x3
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-96]
	ldr	w23, [x2, #8]
Lloh3:
	adrp	x8, _ATA_DATA_SET_MANAGEMENT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ATA_DATA_SET_MANAGEMENT@GOTPAGEOFF]
Lloh5:
	ldr	w26, [x8]
	cmp	w23, w26
	cset	w24, ne
	mov	w8, #44
	mov	w9, #52
	csel	x8, x9, x8, eq
	mov	w9, #12
	mov	w10, #48
	csel	x9, x10, x9, eq
	ldr	w8, [x2, x8]
	ldr	w9, [x2, x9]
	lsl	w9, w9, #9
	orr	w25, w9, w8, lsl #17
	mov	x27, sp
	mov	x3, sp
	mov	w4, #2048
	bl	_read_prdt
	sxtw	x8, w22
	sxtw	x9, w25
	add	x10, x27, w22, sxtw #2
	add	x10, x10, #28
	add	w27, w22, #8
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldp	w12, w11, [x10, #-4]
	orr	w28, w12, w11, lsl #8
	cbnz	w28, LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	add	x8, x8, #8
	add	x10, x10, #32
	add	w27, w27, #8
	cmp	x8, x9
	b.lt	LBB0_1
; %bb.3:
	cmp	w23, w26
	b.ne	LBB0_8
; %bb.4:
Lloh6:
	adrp	x8, _ATA_S_READY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ATA_S_READY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _ATA_S_DSC@GOTPAGE
Lloh10:
	ldr	x9, [x9, _ATA_S_DSC@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w3, w9, w8
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_ahci_write_fis_d2h
	b	LBB0_11
LBB0_5:
	cmp	w22, #0
	cset	w26, ne
	add	x22, x19, #12
	mov	x0, x22
	bl	_STAILQ_FIRST
	mov	x23, x0
	cmp	x0, #0
	cset	w0, ne
	bl	_assert
Lloh12:
	adrp	x8, _io_flist@GOTPAGE
Lloh13:
	ldr	x8, [x8, _io_flist@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_STAILQ_REMOVE_HEAD
	str	x21, [x23]
	stp	w20, w25, [x23, #8]
	cmp	w25, w27
	cset	w8, ne
	stp	w27, w8, [x23, #16]
	add	x21, x23, #24
	ldr	w0, [x19, #4]
	bl	_blockif_sectsz
	ldr	w0, [x19, #4]
	bl	_blockif_sectsz
	mul	w8, w0, w28
	str	w8, [x23, #28]
	mov	w8, #1
	lsl	w8, w8, w20
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
	add	x0, x19, #8
Lloh15:
	adrp	x8, _io_blist@GOTPAGE
Lloh16:
	ldr	x8, [x8, _io_blist@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x1, x23
	bl	_TAILQ_INSERT_HEAD
	eor	w8, w24, #0x1
	orr	w8, w26, w8
	tbnz	w8, #0, LBB0_7
; %bb.6:
	mov	x0, x19
	mov	x1, x20
	bl	_ahci_write_fis_d2h_ncq
LBB0_7:
	ldr	w0, [x19, #4]
	mov	x1, x21
	bl	_blockif_delete
	cmp	w0, #0
	cset	w0, eq
	bl	_assert
	b	LBB0_13
LBB0_8:
	cbnz	w22, LBB0_10
; %bb.9:
	mov	x0, x19
	mov	x1, x20
	bl	_ahci_write_fis_d2h_ncq
LBB0_10:
Lloh18:
	adrp	x8, _ATA_S_READY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ATA_S_READY@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
Lloh21:
	adrp	x9, _ATA_S_DSC@GOTPAGE
Lloh22:
	ldr	x9, [x9, _ATA_S_DSC@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	orr	w3, w9, w8
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_ahci_write_fis_sdb
LBB0_11:
	mov	w8, #1
	lsl	w8, w8, w20
	ldr	w9, [x19]
	bic	w8, w9, w8
	str	w8, [x19]
	mov	x0, x19
	bl	_ahci_check_stopped
	cbz	w22, LBB0_13
; %bb.12:
	mov	x0, x19
	bl	_ahci_handle_port
LBB0_13:
	ldur	x8, [x29, #-96]
Lloh24:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh25:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.14:
	add	sp, sp, #2064
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_DATA_SET_MANAGEMENT,4,2    ; @ATA_DATA_SET_MANAGEMENT
	.comm	_ATA_S_READY,4,2                ; @ATA_S_READY
	.comm	_ATA_S_DSC,4,2                  ; @ATA_S_DSC
	.comm	_io_flist,4,2                   ; @io_flist
	.comm	_io_blist,4,2                   ; @io_blist
	.no_dead_strip	_ahci_handle_dsm_trim
.subsections_via_symbols
