	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ahci_build_iov
_ahci_build_iov:                        ## @ahci_build_iov
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	xorl	%r14d, %r14d
	testl	%ecx, %ecx
	jle	LBB0_1
## %bb.2:
	movq	%rdx, %rbx
	movq	_BLOCKIF_IOV_MAX@GOTPCREL(%rip), %rdx
	cmpl	$0, (%rdx)
	movb	$1, %r15b
	jle	LBB0_3
## %bb.4:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %r13d
	movl	4(%rax), %r8d
	subl	%r13d, %r8d
	movl	$0, %r12d
	testl	%r8d, %r8d
	jle	LBB0_13
## %bb.5:
	addq	$8, %rbx
	xorl	%r14d, %r14d
	movl	$1, %eax
	movq	_DBCMASK@GOTPCREL(%rip), %rdi
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movl	%ecx, -60(%rbp)                 ## 4-byte Spill
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	%eax, %esi
	movl	(%rdi), %eax
	andl	-8(%rbx), %eax
	leal	1(%rax), %r15d
	cmpl	%r13d, %eax
	jge	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	subl	%r15d, %r13d
	cmpl	%esi, %ecx
	jne	LBB0_6
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	subl	%r13d, %r15d
	cmpl	%r8d, %r15d
	cmovgel	%r8d, %r15d
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	4(%rax), %edi
	movl	%r8d, %r12d
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	callq	_ahci_ctx
	movslq	%r13d, %rsi
	addq	(%rbx), %rsi
	movl	%eax, %edi
	movl	%r15d, %edx
	callq	_paddr_guest2host
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	_DBCMASK@GOTPCREL(%rip), %rdi
	movl	%r12d, %r8d
	movq	_BLOCKIF_IOV_MAX@GOTPCREL(%rip), %rdx
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	24(%rcx), %rcx
	movslq	%r14d, %r14
	movl	%eax, 4(%rcx,%r14,8)
	movl	%r15d, (%rcx,%r14,8)
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
	addl	%r15d, -44(%rbp)                ## 4-byte Folded Spill
	subl	%r15d, %r8d
	incl	%r14d
	xorl	%r13d, %r13d
	cmpl	%esi, %ecx
	je	LBB0_12
LBB0_6:                                 ##   in Loop: Header=BB0_8 Depth=1
	cmpl	(%rdx), %r14d
	jge	LBB0_12
## %bb.7:                               ##   in Loop: Header=BB0_8 Depth=1
	addq	$16, %rbx
	leal	1(%rsi), %eax
	testl	%r8d, %r8d
	jg	LBB0_8
LBB0_12:
	cmpl	%ecx, %esi
	setl	%r15b
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	jmp	LBB0_13
LBB0_1:
	xorl	%r12d, %r12d
	xorl	%r15d, %r15d
	jmp	LBB0_13
LBB0_3:
	xorl	%r12d, %r12d
LBB0_13:
	movq	_BLOCKIF_IOV_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jne	LBB0_19
## %bb.14:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	callq	_blockif_sectsz
	movl	%eax, %ecx
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	movl	%edx, %ebx
	xorl	%edi, %edi
	subl	%edx, %r12d
	setg	%dil
	callq	_assert
	testl	%ebx, %ebx
	jle	LBB0_19
## %bb.15:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	24(%rax), %rax
	movslq	%r14d, %rcx
	leaq	(%rax,%rcx,8), %rax
	addq	$-8, %rax
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rax), %ecx
	cmpl	%ecx, %ebx
	jl	LBB0_17
## %bb.18:                              ##   in Loop: Header=BB0_16 Depth=1
	decl	%r14d
	addq	$-8, %rax
	subl	%ecx, %ebx
	jg	LBB0_16
	jmp	LBB0_19
LBB0_17:
	subl	%ebx, %ecx
	movl	%ecx, (%rax)
LBB0_19:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	%r14d, 16(%rcx)
	movl	%r12d, 20(%rcx)
	addl	(%rcx), %r12d
	movl	%r12d, (%rcx)
	cmpl	4(%rcx), %r12d
	setl	%al
	andb	%r15b, %al
	movzbl	%al, %eax
	movl	%eax, 8(%rcx)
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BLOCKIF_IOV_MAX,4,2            ## @BLOCKIF_IOV_MAX
	.comm	_DBCMASK,4,2                    ## @DBCMASK
	.no_dead_strip	_ahci_build_iov
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ahci_build_iov
_ahci_build_iov:                        ; @ahci_build_iov
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	str	x0, [sp, #8]                    ; 8-byte Folded Spill
Lloh0:
	adrp	x20, _BLOCKIF_IOV_MAX@GOTPAGE
Lloh1:
	ldr	x20, [x20, _BLOCKIF_IOV_MAX@GOTPAGEOFF]
	cmp	w3, #1
	b.lt	LBB0_3
; %bb.1:
	ldp	w27, w8, [x19]
	sub	w21, w8, w27
	ldr	w8, [x20]
	cmp	w8, #1
	ccmp	w21, #1, #8, ge
	b.ge	LBB0_4
; %bb.2:
	mov	w24, #0
	mov	w23, #0
	mov	w21, #1
	b	LBB0_10
LBB0_3:
	mov	w24, #0
	mov	w23, #0
	mov	w21, #0
	b	LBB0_10
LBB0_4:
	mov	x26, x3
	mov	w24, #0
	mov	w23, #0
	add	x28, x2, #8
	mov	w8, #1
Lloh2:
	adrp	x11, _DBCMASK@GOTPAGE
Lloh3:
	ldr	x11, [x11, _DBCMASK@GOTPAGEOFF]
	str	x19, [sp]                       ; 8-byte Folded Spill
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	mov	x25, x8
	ldur	w8, [x28, #-8]
	ldr	w9, [x11]
	and	w9, w9, w8
	add	w8, w9, #1
	cmp	w9, w27
	b.ge	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	sub	w27, w27, w8
	cmp	w26, w25
	b.ne	LBB0_8
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	sub	w8, w8, w27
	cmp	w8, w21
	csel	w22, w8, w21, lt
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	w0, [x8, #4]
	mov	x19, x23
	mov	x23, x11
	bl	_ahci_ctx
	ldr	x8, [x28]
	add	x1, x8, w27, sxtw
	mov	x2, x22
	bl	_paddr_guest2host
	mov	x11, x23
	mov	x23, x19
	ldr	x19, [sp]                       ; 8-byte Folded Reload
	mov	w27, #0
	ldr	x8, [x19, #24]
	add	x8, x8, w24, sxtw #3
	stp	w22, w0, [x8]
	add	w23, w22, w23
	sub	w21, w21, w22
	add	w24, w24, #1
	cmp	w26, w25
	b.eq	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x20]
	add	x28, x28, #16
	add	w8, w25, #1
	cmp	w24, w9
	ccmp	w21, #1, #8, lt
	b.ge	LBB0_5
LBB0_9:
	cmp	w25, w26
	cset	w21, lt
LBB0_10:
	ldr	w8, [x20]
	cmp	w24, w8
	b.ne	LBB0_16
; %bb.11:
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	w0, [x8]
	bl	_blockif_sectsz
	sdiv	w8, w23, w0
	mul	w8, w8, w0
	sub	w20, w23, w8
	mov	x23, x8
	cmp	w8, #0
	cset	w0, gt
	bl	_assert
	cmp	w20, #1
	b.lt	LBB0_16
; %bb.12:
	ldr	x8, [x19, #24]
	add	x8, x8, w24, sxtw #3
	sub	x8, x8, #8
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8]
	subs	w9, w20, w10
	b.lt	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	sub	w24, w24, #1
	sub	x8, x8, #8
	mov	x20, x9
	cmp	w9, #0
	b.gt	LBB0_13
	b	LBB0_16
LBB0_15:
	sub	w9, w10, w20
	str	w9, [x8]
LBB0_16:
	stp	w24, w23, [x19, #16]
	ldp	w8, w9, [x19]
	add	w8, w8, w23
	cmp	w8, w9
	str	w8, [x19]
	cset	w8, lt
	and	w8, w8, w21
	str	w8, [x19, #8]
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_BLOCKIF_IOV_MAX,4,2            ; @BLOCKIF_IOV_MAX
	.comm	_DBCMASK,4,2                    ; @DBCMASK
	.no_dead_strip	_ahci_build_iov
.subsections_via_symbols
