	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ata_dbdma_setprd
_ata_dbdma_setprd:                      ## @ata_dbdma_setprd
	.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
	movl	%edx, %r14d
	movq	%rsi, -96(%rbp)                 ## 8-byte Spill
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	16(%rdi), %r15
	leaq	4(%r15), %rdi
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	callq	_mtx_lock
	movl	(%r15), %ebx
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
                                        ## kill: def $ebx killed $ebx killed $rbx def $rbx
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	testl	%r14d, %r14d
	jle	LBB0_5
## %bb.1:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	negq	%rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	$1, %r12d
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
                                        ## kill: def $ebx killed $ebx killed $rbx def $rbx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r15), %ebx
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	addq	%r12, %rax
	incq	%rax
	incq	%r12
	cmpq	$1, %rax
	je	LBB0_5
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$255, %ebx
	movq	_DBDMA_NEVER@GOTPCREL(%rip), %rsi
	movq	%rsi, %rax
	movq	_DBDMA_ALWAYS@GOTPCREL(%rip), %r13
	cmoveq	%r13, %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	cmpq	$0, 8(%rcx)
	movq	_DBDMA_OUTPUT_MORE@GOTPCREL(%rip), %rcx
	cmoveq	_DBDMA_INPUT_MORE@GOTPCREL(%rip), %rcx
	movq	_DBDMA_OUTPUT_LAST@GOTPCREL(%rip), %rdx
	cmoveq	_DBDMA_INPUT_LAST@GOTPCREL(%rip), %rdx
	cmpq	-88(%rbp), %r12                 ## 8-byte Folded Reload
	cmovbq	%rcx, %rdx
	movl	(%rax), %r14d
	movl	(%rdx), %edx
	movl	8(%r15), %edi
	leal	1(%rbx), %eax
	movl	%eax, (%r15)
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	movl	-8(%rax,%r12,8), %r9d
	movl	-4(%rax,%r12,8), %r8d
	movl	(%rsi), %eax
	movl	%ebx, %esi
	xorl	%ecx, %ecx
	pushq	$0
	pushq	%rax
	pushq	%r14
	pushq	%rax
	callq	_dbdma_insert_command
	addq	$32, %rsp
	cmpl	(%r13), %r14d
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	$0, (%r15)
	jmp	LBB0_4
LBB0_5:
	cmpl	$255, %ebx
	jne	LBB0_7
## %bb.6:
	movl	8(%r15), %edi
	xorl	%ebx, %ebx
	movl	$255, %esi
	xorl	%edx, %edx
	callq	_dbdma_insert_branch
LBB0_7:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	leal	-1(%rcx), %eax
	testl	%ecx, %ecx
	movl	$255, %r13d
	cmovgl	%eax, %r13d
	movl	8(%r15), %edi
	leal	1(%rbx), %eax
	movl	%eax, (%r15)
	movl	%ebx, %esi
	callq	_dbdma_insert_stop
	movl	8(%r15), %edi
	movl	%r13d, %esi
	callq	_dbdma_insert_nop
	movl	8(%r15), %edi
	movq	_BUS_DMASYNC_PREWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_dbdma_sync_commands
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_mtx_unlock
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DBDMA_ALWAYS,4,2               ## @DBDMA_ALWAYS
	.comm	_DBDMA_NEVER,4,2                ## @DBDMA_NEVER
	.comm	_DBDMA_OUTPUT_MORE,4,2          ## @DBDMA_OUTPUT_MORE
	.comm	_DBDMA_OUTPUT_LAST,4,2          ## @DBDMA_OUTPUT_LAST
	.comm	_DBDMA_INPUT_MORE,4,2           ## @DBDMA_INPUT_MORE
	.comm	_DBDMA_INPUT_LAST,4,2           ## @DBDMA_INPUT_LAST
	.comm	_BUS_DMASYNC_PREWRITE,4,2       ## @BUS_DMASYNC_PREWRITE
	.comm	_DBDMA_NOP,4,2                  ## @DBDMA_NOP
	.no_dead_strip	_ata_dbdma_setprd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ata_dbdma_setprd
_ata_dbdma_setprd:                      ; @ata_dbdma_setprd
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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, x2
	mov	x22, x1
	mov	x20, x0
	ldr	x23, [x0, #16]
	add	x0, x23, #4
	str	x0, [sp, #16]                   ; 8-byte Folded Spill
	bl	_mtx_lock
	ldr	w1, [x23]
	cmp	w19, #1
	str	w19, [sp, #28]                  ; 4-byte Folded Spill
	str	w1, [sp, #12]                   ; 4-byte Folded Spill
	b.lt	LBB0_5
; %bb.1:
	mov	x25, #0
	add	x26, x22, #4
Lloh0:
	adrp	x27, _DBDMA_ALWAYS@GOTPAGE
Lloh1:
	ldr	x27, [x27, _DBDMA_ALWAYS@GOTPAGEOFF]
Lloh2:
	adrp	x28, _DBDMA_NEVER@GOTPAGE
Lloh3:
	ldr	x28, [x28, _DBDMA_NEVER@GOTPAGEOFF]
Lloh4:
	adrp	x24, _DBDMA_INPUT_LAST@GOTPAGE
Lloh5:
	ldr	x24, [x24, _DBDMA_INPUT_LAST@GOTPAGEOFF]
	mov	w21, w19
Lloh6:
	adrp	x19, _DBDMA_OUTPUT_LAST@GOTPAGE
Lloh7:
	ldr	x19, [x19, _DBDMA_OUTPUT_LAST@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x23]
	add	x26, x26, #8
	cmp	x21, x25
	b.eq	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w1, #255
	csel	x8, x27, x28, eq
	ldr	w22, [x8]
	ldr	x8, [x20, #8]
	add	x25, x25, #1
	cmp	x8, #0
Lloh8:
	adrp	x8, _DBDMA_INPUT_MORE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DBDMA_INPUT_MORE@GOTPAGEOFF]
Lloh10:
	adrp	x9, _DBDMA_OUTPUT_MORE@GOTPAGE
Lloh11:
	ldr	x9, [x9, _DBDMA_OUTPUT_MORE@GOTPAGEOFF]
	csel	x8, x8, x9, eq
	csel	x9, x24, x19, eq
	cmp	x25, x21
	csel	x8, x8, x9, lo
	ldr	w2, [x8]
	ldr	w0, [x23, #8]
	add	w8, w1, #1
	str	w8, [x23]
	ldp	w5, w4, [x26, #-4]
	ldr	w6, [x28]
	stp	w6, wzr, [sp]
	mov	w3, #0
	mov	x7, x22
	bl	_dbdma_insert_command
	ldr	w8, [x27]
	cmp	w22, w8
	b.ne	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	str	wzr, [x23]
	b	LBB0_2
LBB0_5:
	cmp	w1, #255
	b.ne	LBB0_7
; %bb.6:
	ldr	w0, [x23, #8]
	mov	w2, #0
	bl	_dbdma_insert_branch
	mov	w1, #0
LBB0_7:
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	subs	w8, w8, #1
	mov	w9, #255
	csel	w22, w9, w8, lt
	ldr	w0, [x23, #8]
	add	w8, w1, #1
	str	w8, [x23]
	bl	_dbdma_insert_stop
	ldr	w0, [x23, #8]
	mov	x1, x22
	bl	_dbdma_insert_nop
	ldr	w0, [x23, #8]
Lloh12:
	adrp	x8, _BUS_DMASYNC_PREWRITE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BUS_DMASYNC_PREWRITE@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	bl	_dbdma_sync_commands
	ldr	x0, [sp, #16]                   ; 8-byte Folded Reload
	bl	_mtx_unlock
	ldr	w8, [sp, #28]                   ; 4-byte Folded Reload
	str	w8, [x20]
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_DBDMA_ALWAYS,4,2               ; @DBDMA_ALWAYS
	.comm	_DBDMA_NEVER,4,2                ; @DBDMA_NEVER
	.comm	_DBDMA_OUTPUT_MORE,4,2          ; @DBDMA_OUTPUT_MORE
	.comm	_DBDMA_OUTPUT_LAST,4,2          ; @DBDMA_OUTPUT_LAST
	.comm	_DBDMA_INPUT_MORE,4,2           ; @DBDMA_INPUT_MORE
	.comm	_DBDMA_INPUT_LAST,4,2           ; @DBDMA_INPUT_LAST
	.comm	_BUS_DMASYNC_PREWRITE,4,2       ; @BUS_DMASYNC_PREWRITE
	.comm	_DBDMA_NOP,4,2                  ; @DBDMA_NOP
	.no_dead_strip	_ata_dbdma_setprd
.subsections_via_symbols
